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
f0d3e43b
Commit
f0d3e43b
authored
9 years ago
by
Diego Biurrun
Browse files
Options
Downloads
Patches
Plain Diff
ac3enc: Reshuffle functions to avoid forward declarations
parent
e22c63ac
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libavcodec/ac3enc_fixed.c
+28
-30
28 additions, 30 deletions
libavcodec/ac3enc_fixed.c
libavcodec/ac3enc_float.c
+36
-34
36 additions, 34 deletions
libavcodec/ac3enc_float.c
libavcodec/ac3enc_template.c
+0
-9
0 additions, 9 deletions
libavcodec/ac3enc_template.c
with
64 additions
and
73 deletions
libavcodec/ac3enc_fixed.c
+
28
−
30
View file @
f0d3e43b
...
...
@@ -38,36 +38,6 @@
static
const
AVClass
ac3enc_class
=
{
"Fixed-Point AC-3 Encoder"
,
av_default_item_name
,
ac3_options
,
LIBAVUTIL_VERSION_INT
};
static
int
normalize_samples
(
AC3EncodeContext
*
s
);
#include
"ac3enc_template.c"
/**
* Finalize MDCT and free allocated memory.
*
* @param s AC-3 encoder private context
*/
av_cold
void
AC3_NAME
(
mdct_end
)(
AC3EncodeContext
*
s
)
{
ff_mdct_end
(
&
s
->
mdct
);
}
/**
* Initialize MDCT tables.
*
* @param s AC-3 encoder private context
* @return 0 on success, negative error code on failure
*/
av_cold
int
AC3_NAME
(
mdct_init
)(
AC3EncodeContext
*
s
)
{
int
ret
=
ff_mdct_init
(
&
s
->
mdct
,
9
,
0
,
-
1
.
0
);
s
->
mdct_window
=
ff_ac3_window
;
return
ret
;
}
/*
* Normalize the input samples to use the maximum available precision.
* This assumes signed 16-bit input samples.
...
...
@@ -126,6 +96,34 @@ static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl)
}
#include
"ac3enc_template.c"
/**
* Finalize MDCT and free allocated memory.
*
* @param s AC-3 encoder private context
*/
av_cold
void
AC3_NAME
(
mdct_end
)(
AC3EncodeContext
*
s
)
{
ff_mdct_end
(
&
s
->
mdct
);
}
/**
* Initialize MDCT tables.
*
* @param s AC-3 encoder private context
* @return 0 on success, negative error code on failure
*/
av_cold
int
AC3_NAME
(
mdct_init
)(
AC3EncodeContext
*
s
)
{
int
ret
=
ff_mdct_init
(
&
s
->
mdct
,
9
,
0
,
-
1
.
0
);
s
->
mdct_window
=
ff_ac3_window
;
return
ret
;
}
static
av_cold
int
ac3_fixed_encode_init
(
AVCodecContext
*
avctx
)
{
AC3EncodeContext
*
s
=
avctx
->
priv_data
;
...
...
This diff is collapsed.
Click to expand it.
libavcodec/ac3enc_float.c
+
36
−
34
View file @
f0d3e43b
...
...
@@ -39,6 +39,42 @@
static
const
AVClass
ac3enc_class
=
{
"AC-3 Encoder"
,
av_default_item_name
,
ac3_options
,
LIBAVUTIL_VERSION_INT
};
/*
* Scale MDCT coefficients from float to 24-bit fixed-point.
*/
static
void
scale_coefficients
(
AC3EncodeContext
*
s
)
{
int
chan_size
=
AC3_MAX_COEFS
*
s
->
num_blocks
;
int
cpl
=
s
->
cpl_on
;
s
->
ac3dsp
.
float_to_fixed24
(
s
->
fixed_coef_buffer
+
(
chan_size
*
!
cpl
),
s
->
mdct_coef_buffer
+
(
chan_size
*
!
cpl
),
chan_size
*
(
s
->
channels
+
cpl
));
}
/*
* Clip MDCT coefficients to allowable range.
*/
static
void
clip_coefficients
(
AudioDSPContext
*
adsp
,
float
*
coef
,
unsigned
int
len
)
{
adsp
->
vector_clipf
(
coef
,
coef
,
len
,
COEF_MIN
,
COEF_MAX
);
}
/*
* Calculate a single coupling coordinate.
*/
static
CoefType
calc_cpl_coord
(
CoefSumType
energy_ch
,
CoefSumType
energy_cpl
)
{
float
coord
=
0
.
125
;
if
(
energy_cpl
>
0
)
coord
*=
sqrtf
(
energy_ch
/
energy_cpl
);
return
FFMIN
(
coord
,
COEF_MAX
);
}
#include
"ac3enc_template.c"
...
...
@@ -82,40 +118,6 @@ av_cold int ff_ac3_float_mdct_init(AC3EncodeContext *s)
}
/*
* Scale MDCT coefficients from float to 24-bit fixed-point.
*/
static
void
scale_coefficients
(
AC3EncodeContext
*
s
)
{
int
chan_size
=
AC3_MAX_COEFS
*
s
->
num_blocks
;
int
cpl
=
s
->
cpl_on
;
s
->
ac3dsp
.
float_to_fixed24
(
s
->
fixed_coef_buffer
+
(
chan_size
*
!
cpl
),
s
->
mdct_coef_buffer
+
(
chan_size
*
!
cpl
),
chan_size
*
(
s
->
channels
+
cpl
));
}
/*
* Clip MDCT coefficients to allowable range.
*/
static
void
clip_coefficients
(
AudioDSPContext
*
adsp
,
float
*
coef
,
unsigned
int
len
)
{
adsp
->
vector_clipf
(
coef
,
coef
,
len
,
COEF_MIN
,
COEF_MAX
);
}
/*
* Calculate a single coupling coordinate.
*/
static
CoefType
calc_cpl_coord
(
CoefSumType
energy_ch
,
CoefSumType
energy_cpl
)
{
float
coord
=
0
.
125
;
if
(
energy_cpl
>
0
)
coord
*=
sqrtf
(
energy_ch
/
energy_cpl
);
return
FFMIN
(
coord
,
COEF_MAX
);
}
av_cold
int
ff_ac3_float_encode_init
(
AVCodecContext
*
avctx
)
{
AC3EncodeContext
*
s
=
avctx
->
priv_data
;
...
...
This diff is collapsed.
Click to expand it.
libavcodec/ac3enc_template.c
+
0
−
9
View file @
f0d3e43b
...
...
@@ -36,15 +36,6 @@
#include
"ac3enc.h"
#include
"eac3enc.h"
/* prototypes for static functions in ac3enc_fixed.c and ac3enc_float.c */
static
void
scale_coefficients
(
AC3EncodeContext
*
s
);
static
void
clip_coefficients
(
AudioDSPContext
*
adsp
,
CoefType
*
coef
,
unsigned
int
len
);
static
CoefType
calc_cpl_coord
(
CoefSumType
energy_ch
,
CoefSumType
energy_cpl
);
int
AC3_NAME
(
allocate_sample_buffers
)(
AC3EncodeContext
*
s
)
{
...
...
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