Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
257de756
Commit
257de756
authored
Apr 30, 2011
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ac3enc: clean up count_frame_bits() and count_frame_bits_fixed()
parent
c4fb3b03
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
20 deletions
+46
-20
ac3enc.c
libavcodec/ac3enc.c
+46
-20
No files found.
libavcodec/ac3enc.c
View file @
257de756
...
@@ -818,35 +818,57 @@ static void count_frame_bits_fixed(AC3EncodeContext *s)
...
@@ -818,35 +818,57 @@ static void count_frame_bits_fixed(AC3EncodeContext *s)
* no auxilliary data
* no auxilliary data
*/
*/
/* header
size
*/
/* header */
frame_bits
=
65
;
frame_bits
=
65
;
frame_bits
+=
frame_bits_inc
[
s
->
channel_mode
];
frame_bits
+=
frame_bits_inc
[
s
->
channel_mode
];
/* audio blocks */
/* audio blocks */
for
(
blk
=
0
;
blk
<
AC3_MAX_BLOCKS
;
blk
++
)
{
for
(
blk
=
0
;
blk
<
AC3_MAX_BLOCKS
;
blk
++
)
{
frame_bits
+=
s
->
fbw_channels
*
2
+
2
;
/* blksw * c, dithflag * c, dynrnge, cplstre */
/* block switch flags */
if
(
s
->
channel_mode
==
AC3_CHMODE_STEREO
)
{
frame_bits
+=
s
->
fbw_channels
;
frame_bits
++
;
/* rematstr */
}
/* dither flags */
frame_bits
+=
2
*
s
->
fbw_channels
;
/* chexpstr[2] * c */
frame_bits
+=
s
->
fbw_channels
;
/* dynamic range */
frame_bits
++
;
/* coupling strategy */
frame_bits
++
;
if
(
!
blk
)
frame_bits
++
;
/* stereo rematrixing */
if
(
s
->
channel_mode
==
AC3_CHMODE_STEREO
)
frame_bits
++
;
/* exponent strategy */
frame_bits
+=
2
*
s
->
fbw_channels
;
if
(
s
->
lfe_on
)
if
(
s
->
lfe_on
)
frame_bits
++
;
/* lfeexpstr */
frame_bits
++
;
frame_bits
++
;
/* baie */
frame_bits
++
;
/* snr */
/* bit allocation params */
frame_bits
+=
2
;
/* delta / skip */
frame_bits
++
;
if
(
!
blk
)
frame_bits
+=
2
+
2
+
2
+
2
+
3
;
/* snr offsets and fast gain codes */
frame_bits
++
;
if
(
!
blk
)
frame_bits
+=
6
+
s
->
channels
*
(
4
+
3
);
/* delta bit allocation */
frame_bits
++
;
/* skipped data */
frame_bits
++
;
}
}
frame_bits
++
;
/* cplinu for block 0 */
/* bit alloc info */
/* sdcycod[2], fdcycod[2], sgaincod[2], dbpbcod[2], floorcod[3] */
/* csnroffset[6] */
/* (fsnoffset[4] + fgaincod[4]) * c */
frame_bits
+=
2
*
4
+
3
+
6
+
s
->
channels
*
(
4
+
3
);
/* aux
datae, crcrsv
*/
/* aux
iliary data
*/
frame_bits
+=
2
;
frame_bits
++
;
/* CRC */
/* CRC */
frame_bits
+=
16
;
frame_bits
+=
1
+
1
6
;
s
->
frame_bits_fixed
=
frame_bits
;
s
->
frame_bits_fixed
=
frame_bits
;
}
}
...
@@ -896,6 +918,7 @@ static void count_frame_bits(AC3EncodeContext *s)
...
@@ -896,6 +918,7 @@ static void count_frame_bits(AC3EncodeContext *s)
int
blk
,
ch
;
int
blk
,
ch
;
int
frame_bits
=
0
;
int
frame_bits
=
0
;
/* header */
if
(
opt
->
audio_production_info
)
if
(
opt
->
audio_production_info
)
frame_bits
+=
7
;
frame_bits
+=
7
;
if
(
s
->
bitstream_id
==
6
)
{
if
(
s
->
bitstream_id
==
6
)
{
...
@@ -905,6 +928,7 @@ static void count_frame_bits(AC3EncodeContext *s)
...
@@ -905,6 +928,7 @@ static void count_frame_bits(AC3EncodeContext *s)
frame_bits
+=
14
;
frame_bits
+=
14
;
}
}
/* audio blocks */
for
(
blk
=
0
;
blk
<
AC3_MAX_BLOCKS
;
blk
++
)
{
for
(
blk
=
0
;
blk
<
AC3_MAX_BLOCKS
;
blk
++
)
{
/* stereo rematrixing */
/* stereo rematrixing */
if
(
s
->
channel_mode
==
AC3_CHMODE_STEREO
&&
if
(
s
->
channel_mode
==
AC3_CHMODE_STEREO
&&
...
@@ -912,11 +936,13 @@ static void count_frame_bits(AC3EncodeContext *s)
...
@@ -912,11 +936,13 @@ static void count_frame_bits(AC3EncodeContext *s)
frame_bits
+=
s
->
num_rematrixing_bands
;
frame_bits
+=
s
->
num_rematrixing_bands
;
}
}
/* bandwidth codes & gain range */
for
(
ch
=
0
;
ch
<
s
->
fbw_channels
;
ch
++
)
{
for
(
ch
=
0
;
ch
<
s
->
fbw_channels
;
ch
++
)
{
if
(
s
->
exp_strategy
[
ch
][
blk
]
!=
EXP_REUSE
)
if
(
s
->
exp_strategy
[
ch
][
blk
]
!=
EXP_REUSE
)
frame_bits
+=
6
+
2
;
/* chbwcod[6], gainrng[2] */
frame_bits
+=
6
+
2
;
}
}
}
}
s
->
frame_bits
=
s
->
frame_bits_fixed
+
frame_bits
;
s
->
frame_bits
=
s
->
frame_bits_fixed
+
frame_bits
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment