mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/ac3enc: Set function pointers earlier
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
505d4de064
commit
953924781e
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "eac3enc.h"
|
||||
|
||||
|
||||
int AC3_NAME(allocate_sample_buffers)(AC3EncodeContext *s)
|
||||
static int allocate_sample_buffers(AC3EncodeContext *s)
|
||||
{
|
||||
int ch;
|
||||
|
||||
|
|
Loading…
Reference in New Issue