Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
e43b0a73
Commit
e43b0a73
authored
16 years ago
by
Kostya Shishkov
Browse files
Options
Downloads
Patches
Plain Diff
okayed chunks of AAC encoder
Originally committed as revision 14939 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
6986662b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/aacenc.c
+22
-8
22 additions, 8 deletions
libavcodec/aacenc.c
with
22 additions
and
8 deletions
libavcodec/aacenc.c
+
22
−
8
View file @
e43b0a73
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
* TODOs:
* TODOs:
* psy model selection with some option
* psy model selection with some option
* add sane pulse detection
* add sane pulse detection
* add temporal noise shaping
***********************************/
***********************************/
#include
"avcodec.h"
#include
"avcodec.h"
...
@@ -211,10 +212,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
...
@@ -211,10 +212,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
return
-
1
;
return
-
1
;
}
}
s
->
samplerate_index
=
i
;
s
->
samplerate_index
=
i
;
s
->
swb_sizes1024
=
swb_size_1024
[
i
];
s
->
swb_num1024
=
ff_aac_num_swb_1024
[
i
];
s
->
swb_sizes128
=
swb_size_128
[
i
];
s
->
swb_num128
=
ff_aac_num_swb_128
[
i
];
dsputil_init
(
&
s
->
dsp
,
avctx
);
dsputil_init
(
&
s
->
dsp
,
avctx
);
ff_mdct_init
(
&
s
->
mdct1024
,
11
,
0
);
ff_mdct_init
(
&
s
->
mdct1024
,
11
,
0
);
...
@@ -229,7 +226,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
...
@@ -229,7 +226,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
s
->
cpe
=
av_mallocz
(
sizeof
(
ChannelElement
)
*
aac_chan_configs
[
avctx
->
channels
-
1
][
0
]);
s
->
cpe
=
av_mallocz
(
sizeof
(
ChannelElement
)
*
aac_chan_configs
[
avctx
->
channels
-
1
][
0
]);
if
(
ff_aac_psy_init
(
&
s
->
psy
,
avctx
,
AAC_PSY_3GPP
,
if
(
ff_aac_psy_init
(
&
s
->
psy
,
avctx
,
AAC_PSY_3GPP
,
aac_chan_configs
[
avctx
->
channels
-
1
][
0
],
0
,
aac_chan_configs
[
avctx
->
channels
-
1
][
0
],
0
,
s
->
swb_size
s
1024
,
s
->
swb_num1024
,
s
->
swb_size
s
128
,
s
->
swb_num128
)
<
0
){
swb_size
_
1024
[
i
],
ff_aac_num_swb_1024
[
i
],
swb_size
_
128
[
i
],
ff_aac_num_swb_128
[
i
]
)
<
0
){
av_log
(
avctx
,
AV_LOG_ERROR
,
"Cannot initialize selected model.
\n
"
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"Cannot initialize selected model.
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -243,9 +240,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
...
@@ -243,9 +240,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
* Encode ics_info element.
* Encode ics_info element.
* @see Table 4.6 (syntax of ics_info)
* @see Table 4.6 (syntax of ics_info)
*/
*/
static
void
put_ics_info
(
A
VCode
cContext
*
avctx
,
IndividualChannelStream
*
info
)
static
void
put_ics_info
(
A
ACEn
cContext
*
s
,
IndividualChannelStream
*
info
)
{
{
AACEncContext
*
s
=
avctx
->
priv_data
;
int
i
;
int
i
;
put_bits
(
&
s
->
pb
,
1
,
0
);
// ics_reserved bit
put_bits
(
&
s
->
pb
,
1
,
0
);
// ics_reserved bit
...
@@ -261,6 +257,24 @@ static void put_ics_info(AVCodecContext *avctx, IndividualChannelStream *info)
...
@@ -261,6 +257,24 @@ static void put_ics_info(AVCodecContext *avctx, IndividualChannelStream *info)
}
}
}
}
/**
* Calculate the number of bits needed to code all coefficient signs in current band.
*/
static
int
calculate_band_sign_bits
(
AACEncContext
*
s
,
SingleChannelElement
*
sce
,
int
group_len
,
int
start
,
int
size
)
{
int
bits
=
0
;
int
i
,
w
;
for
(
w
=
0
;
w
<
group_len
;
w
++
){
for
(
i
=
0
;
i
<
size
;
i
++
){
if
(
sce
->
icoefs
[
start
+
i
])
bits
++
;
}
start
+=
128
;
}
return
bits
;
}
/**
/**
* Encode pulse data.
* Encode pulse data.
*/
*/
...
@@ -295,7 +309,7 @@ static void encode_spectral_coeffs(AACEncContext *s, SingleChannelElement *sce)
...
@@ -295,7 +309,7 @@ static void encode_spectral_coeffs(AACEncContext *s, SingleChannelElement *sce)
continue
;
continue
;
}
}
for
(
w2
=
w
;
w2
<
w
+
sce
->
ics
.
group_len
[
wg
];
w2
++
){
for
(
w2
=
w
;
w2
<
w
+
sce
->
ics
.
group_len
[
wg
];
w2
++
){
encode_band_coeffs
(
s
,
cpe
,
channel
,
start
+
w2
*
128
,
encode_band_coeffs
(
s
,
sce
,
start
+
w2
*
128
,
sce
->
ics
.
swb_sizes
[
i
],
sce
->
ics
.
swb_sizes
[
i
],
sce
->
band_type
[
w
*
16
+
i
]);
sce
->
band_type
[
w
*
16
+
i
]);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment