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
ba6bce51
Commit
ba6bce51
authored
14 years ago
by
Justin Ruggles
Browse files
Options
Downloads
Patches
Plain Diff
ac3enc: merge compute_exp_strategy_ch() into compute_exp_strategy()
parent
4142487d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/ac3enc.c
+33
-42
33 additions, 42 deletions
libavcodec/ac3enc.c
with
33 additions
and
42 deletions
libavcodec/ac3enc.c
+
33
−
42
View file @
ba6bce51
...
...
@@ -560,56 +560,47 @@ static void extract_exponents(AC3EncodeContext *s)
#define EXP_DIFF_THRESHOLD 500
/**
* Calculate exponent strategies for all blocks in a single channel.
*/
static
void
compute_exp_strategy_ch
(
AC3EncodeContext
*
s
,
uint8_t
*
exp_strategy
,
uint8_t
*
exp
)
{
int
blk
,
blk1
;
int
exp_diff
;
/* estimate if the exponent variation & decide if they should be
reused in the next frame */
exp_strategy
[
0
]
=
EXP_NEW
;
exp
+=
AC3_MAX_COEFS
;
for
(
blk
=
1
;
blk
<
AC3_MAX_BLOCKS
;
blk
++
)
{
exp_diff
=
s
->
dsp
.
sad
[
0
](
NULL
,
exp
,
exp
-
AC3_MAX_COEFS
,
16
,
16
);
if
(
exp_diff
>
EXP_DIFF_THRESHOLD
)
exp_strategy
[
blk
]
=
EXP_NEW
;
else
exp_strategy
[
blk
]
=
EXP_REUSE
;
exp
+=
AC3_MAX_COEFS
;
}
/* now select the encoding strategy type : if exponents are often
recoded, we use a coarse encoding */
blk
=
0
;
while
(
blk
<
AC3_MAX_BLOCKS
)
{
blk1
=
blk
+
1
;
while
(
blk1
<
AC3_MAX_BLOCKS
&&
exp_strategy
[
blk1
]
==
EXP_REUSE
)
blk1
++
;
switch
(
blk1
-
blk
)
{
case
1
:
exp_strategy
[
blk
]
=
EXP_D45
;
break
;
case
2
:
case
3
:
exp_strategy
[
blk
]
=
EXP_D25
;
break
;
default:
exp_strategy
[
blk
]
=
EXP_D15
;
break
;
}
blk
=
blk1
;
}
}
/**
* Calculate exponent strategies for all channels.
* Array arrangement is reversed to simplify the per-channel calculation.
*/
static
void
compute_exp_strategy
(
AC3EncodeContext
*
s
)
{
int
ch
,
blk
;
int
ch
,
blk
,
blk1
;
for
(
ch
=
0
;
ch
<
s
->
fbw_channels
;
ch
++
)
{
compute_exp_strategy_ch
(
s
,
s
->
exp_strategy
[
ch
],
s
->
blocks
[
0
].
exp
[
ch
]);
uint8_t
*
exp_strategy
=
s
->
exp_strategy
[
ch
];
uint8_t
*
exp
=
s
->
blocks
[
0
].
exp
[
ch
];
int
exp_diff
;
/* estimate if the exponent variation & decide if they should be
reused in the next frame */
exp_strategy
[
0
]
=
EXP_NEW
;
exp
+=
AC3_MAX_COEFS
;
for
(
blk
=
1
;
blk
<
AC3_MAX_BLOCKS
;
blk
++
)
{
exp_diff
=
s
->
dsp
.
sad
[
0
](
NULL
,
exp
,
exp
-
AC3_MAX_COEFS
,
16
,
16
);
if
(
exp_diff
>
EXP_DIFF_THRESHOLD
)
exp_strategy
[
blk
]
=
EXP_NEW
;
else
exp_strategy
[
blk
]
=
EXP_REUSE
;
exp
+=
AC3_MAX_COEFS
;
}
/* now select the encoding strategy type : if exponents are often
recoded, we use a coarse encoding */
blk
=
0
;
while
(
blk
<
AC3_MAX_BLOCKS
)
{
blk1
=
blk
+
1
;
while
(
blk1
<
AC3_MAX_BLOCKS
&&
exp_strategy
[
blk1
]
==
EXP_REUSE
)
blk1
++
;
switch
(
blk1
-
blk
)
{
case
1
:
exp_strategy
[
blk
]
=
EXP_D45
;
break
;
case
2
:
case
3
:
exp_strategy
[
blk
]
=
EXP_D25
;
break
;
default:
exp_strategy
[
blk
]
=
EXP_D15
;
break
;
}
blk
=
blk1
;
}
}
if
(
s
->
lfe_on
)
{
ch
=
s
->
lfe_channel
;
...
...
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