aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-12-03 03:36:32 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-01-09 04:06:31 +0100
commit953924781ee1e928a7e5657231998713d2a9f3ac (patch)
treed3f15b0881d6e5d6896335518823869667fabca0
parent505d4de064aff879674d0670cf1c96ca46545da3 (diff)
downloadffmpeg-953924781ee1e928a7e5657231998713d2a9f3ac.tar.gz
avcodec/ac3enc: Set function pointers earlier
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavcodec/ac3enc.c13
-rw-r--r--libavcodec/ac3enc.h12
-rw-r--r--libavcodec/ac3enc_fixed.c7
-rw-r--r--libavcodec/ac3enc_float.c7
-rw-r--r--libavcodec/ac3enc_template.c2
5 files changed, 12 insertions, 29 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index 1a8a530e52..7e9e0b16ff 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -2049,8 +2049,7 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx)
av_freep(&block->cpl_coord_mant);
}
- if (s->mdct_end)
- s->mdct_end(s);
+ s->mdct_end(s);
return 0;
}
@@ -2437,16 +2436,6 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
s->crc_inv[1] = pow_poly((CRC16_POLY >> 1), (8 * frame_size_58) - 16, CRC16_POLY);
}
- /* set function pointers */
- if (CONFIG_AC3_FIXED_ENCODER && s->fixed_point) {
- s->mdct_end = ff_ac3_fixed_mdct_end;
- s->mdct_init = ff_ac3_fixed_mdct_init;
- s->allocate_sample_buffers = ff_ac3_fixed_allocate_sample_buffers;
- } else if (CONFIG_AC3_ENCODER || CONFIG_EAC3_ENCODER) {
- s->mdct_end = ff_ac3_float_mdct_end;
- s->mdct_init = ff_ac3_float_mdct_init;
- s->allocate_sample_buffers = ff_ac3_float_allocate_sample_buffers;
- }
if (CONFIG_EAC3_ENCODER && s->eac3) {
static AVOnce init_static_once = AV_ONCE_INIT;
ff_thread_once(&init_static_once, ff_eac3_exponent_init);
diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h
index 1e4a7405bf..b4e566b4ef 100644
--- a/libavcodec/ac3enc.h
+++ b/libavcodec/ac3enc.h
@@ -295,20 +295,8 @@ void ff_ac3_quantize_mantissas(AC3EncodeContext *s);
void ff_ac3_output_frame(AC3EncodeContext *s, unsigned char *frame);
-/* prototypes for functions in ac3enc_fixed.c and ac3enc_float.c */
-
-void ff_ac3_fixed_mdct_end(AC3EncodeContext *s);
-void ff_ac3_float_mdct_end(AC3EncodeContext *s);
-
-int ff_ac3_fixed_mdct_init(AC3EncodeContext *s);
-int ff_ac3_float_mdct_init(AC3EncodeContext *s);
-
-
/* prototypes for functions in ac3enc_template.c */
-int ff_ac3_fixed_allocate_sample_buffers(AC3EncodeContext *s);
-int ff_ac3_float_allocate_sample_buffers(AC3EncodeContext *s);
-
int ff_ac3_fixed_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr);
int ff_ac3_float_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
index d2e67f3214..879e364d4e 100644
--- a/libavcodec/ac3enc_fixed.c
+++ b/libavcodec/ac3enc_fixed.c
@@ -115,7 +115,7 @@ static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl)
*
* @param s AC-3 encoder private context
*/
-av_cold void ff_ac3_fixed_mdct_end(AC3EncodeContext *s)
+static av_cold void ac3_fixed_mdct_end(AC3EncodeContext *s)
{
ff_mdct_end(&s->mdct);
}
@@ -127,7 +127,7 @@ av_cold void ff_ac3_fixed_mdct_end(AC3EncodeContext *s)
* @param s AC-3 encoder private context
* @return 0 on success, negative error code on failure
*/
-av_cold int ff_ac3_fixed_mdct_init(AC3EncodeContext *s)
+static av_cold int ac3_fixed_mdct_init(AC3EncodeContext *s)
{
int ret = ff_mdct_init(&s->mdct, 9, 0, -1.0);
s->mdct_window = ff_ac3_window;
@@ -139,6 +139,9 @@ static av_cold int ac3_fixed_encode_init(AVCodecContext *avctx)
{
AC3EncodeContext *s = avctx->priv_data;
s->fixed_point = 1;
+ s->mdct_end = ac3_fixed_mdct_end;
+ s->mdct_init = ac3_fixed_mdct_init;
+ s->allocate_sample_buffers = allocate_sample_buffers;
return ff_ac3_encode_init(avctx);
}
diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c
index 571f603182..ef23b417cf 100644
--- a/libavcodec/ac3enc_float.c
+++ b/libavcodec/ac3enc_float.c
@@ -94,7 +94,7 @@ static void sum_square_butterfly(AC3EncodeContext *s, float sum[4],
*
* @param s AC-3 encoder private context
*/
-av_cold void ff_ac3_float_mdct_end(AC3EncodeContext *s)
+static av_cold void ac3_float_mdct_end(AC3EncodeContext *s)
{
ff_mdct_end(&s->mdct);
av_freep(&s->mdct_window);
@@ -107,7 +107,7 @@ av_cold void ff_ac3_float_mdct_end(AC3EncodeContext *s)
* @param s AC-3 encoder private context
* @return 0 on success, negative error code on failure
*/
-av_cold int ff_ac3_float_mdct_init(AC3EncodeContext *s)
+static av_cold int ac3_float_mdct_init(AC3EncodeContext *s)
{
float *window;
int i, n, n2;
@@ -132,6 +132,9 @@ av_cold int ff_ac3_float_mdct_init(AC3EncodeContext *s)
av_cold int ff_ac3_float_encode_init(AVCodecContext *avctx)
{
AC3EncodeContext *s = avctx->priv_data;
+ s->mdct_end = ac3_float_mdct_end;
+ s->mdct_init = ac3_float_mdct_init;
+ s->allocate_sample_buffers = allocate_sample_buffers;
s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
if (!s->fdsp)
return AVERROR(ENOMEM);
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index b74e38aea0..e8b964aa6a 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -38,7 +38,7 @@
#include "eac3enc.h"
-int AC3_NAME(allocate_sample_buffers)(AC3EncodeContext *s)
+static int allocate_sample_buffers(AC3EncodeContext *s)
{
int ch;