Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
2310ee4b
Commit
2310ee4b
authored
Mar 12, 2011
by
Mans Rullgard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ac3enc: move extract_exponents inner loop to ac3dsp
Signed-off-by:
Mans Rullgard
<
mans@mansr.com
>
parent
727c7aa0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
18 deletions
+28
-18
ac3dsp.c
libavcodec/ac3dsp.c
+23
-0
ac3dsp.h
libavcodec/ac3dsp.h
+2
-0
ac3enc.c
libavcodec/ac3enc.c
+3
-18
No files found.
libavcodec/ac3dsp.c
View file @
2310ee4b
...
...
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "ac3.h"
#include "ac3dsp.h"
...
...
@@ -149,6 +150,27 @@ static int ac3_compute_mantissa_size_c(int mant_cnt[5], uint8_t *bap,
return
bits
;
}
static
void
ac3_extract_exponents_c
(
uint8_t
*
exp
,
int32_t
*
coef
,
int
nb_coefs
)
{
int
i
;
for
(
i
=
0
;
i
<
nb_coefs
;
i
++
)
{
int
e
;
int
v
=
abs
(
coef
[
i
]);
if
(
v
==
0
)
e
=
24
;
else
{
e
=
23
-
av_log2
(
v
);
if
(
e
>=
24
)
{
e
=
24
;
coef
[
i
]
=
0
;
}
av_assert2
(
e
>=
0
);
}
exp
[
i
]
=
e
;
}
}
av_cold
void
ff_ac3dsp_init
(
AC3DSPContext
*
c
,
int
bit_exact
)
{
c
->
ac3_exponent_min
=
ac3_exponent_min_c
;
...
...
@@ -158,6 +180,7 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
c
->
float_to_fixed24
=
float_to_fixed24_c
;
c
->
bit_alloc_calc_bap
=
ac3_bit_alloc_calc_bap_c
;
c
->
compute_mantissa_size
=
ac3_compute_mantissa_size_c
;
c
->
extract_exponents
=
ac3_extract_exponents_c
;
if
(
ARCH_ARM
)
ff_ac3dsp_init_arm
(
c
,
bit_exact
);
...
...
libavcodec/ac3dsp.h
View file @
2310ee4b
...
...
@@ -105,6 +105,8 @@ typedef struct AC3DSPContext {
* Calculate the number of bits needed to encode a set of mantissas.
*/
int
(
*
compute_mantissa_size
)(
int
mant_cnt
[
5
],
uint8_t
*
bap
,
int
nb_coefs
);
void
(
*
extract_exponents
)(
uint8_t
*
exp
,
int32_t
*
coef
,
int
nb_coefs
);
}
AC3DSPContext
;
void
ff_ac3dsp_init
(
AC3DSPContext
*
c
,
int
bit_exact
);
...
...
libavcodec/ac3enc.c
View file @
2310ee4b
...
...
@@ -562,28 +562,13 @@ static av_cold void exponent_init(AC3EncodeContext *s)
*/
static
void
extract_exponents
(
AC3EncodeContext
*
s
)
{
int
blk
,
ch
,
i
;
int
blk
,
ch
;
for
(
ch
=
0
;
ch
<
s
->
channels
;
ch
++
)
{
for
(
blk
=
0
;
blk
<
AC3_MAX_BLOCKS
;
blk
++
)
{
AC3Block
*
block
=
&
s
->
blocks
[
blk
];
uint8_t
*
exp
=
block
->
exp
[
ch
];
int32_t
*
coef
=
block
->
fixed_coef
[
ch
];
for
(
i
=
0
;
i
<
AC3_MAX_COEFS
;
i
++
)
{
int
e
;
int
v
=
abs
(
coef
[
i
]);
if
(
v
==
0
)
e
=
24
;
else
{
e
=
23
-
av_log2
(
v
);
if
(
e
>=
24
)
{
e
=
24
;
coef
[
i
]
=
0
;
}
av_assert2
(
e
>=
0
);
}
exp
[
i
]
=
e
;
}
s
->
ac3dsp
.
extract_exponents
(
block
->
exp
[
ch
],
block
->
fixed_coef
[
ch
],
AC3_MAX_COEFS
);
}
}
}
...
...
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