MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ac3_decode_init

Function ac3_decode_init

libavcodec/ac3dec.c:97–147  ·  view source on GitHub ↗

* AVCodec initialization */

Source from the content-addressed store, hash-verified

95 * AVCodec initialization
96 */
97static av_cold int ac3_decode_init(AVCodecContext *avctx)
98{
99 AC3DecodeContext *s = avctx->priv_data;
100 const float scale = 1.0f;
101 int i, ret;
102
103 s->avctx = avctx;
104
105 if ((ret = av_tx_init(&s->tx_128, &s->tx_fn_128, IMDCT_TYPE, 1, 128, &scale, 0)))
106 return ret;
107
108 if ((ret = av_tx_init(&s->tx_256, &s->tx_fn_256, IMDCT_TYPE, 1, 256, &scale, 0)))
109 return ret;
110
111 AC3_RENAME(ff_kbd_window_init)(s->window, 5.0, 256);
112 ff_bswapdsp_init(&s->bdsp);
113
114#if (USE_FIXED)
115 s->fdsp = avpriv_alloc_fixed_dsp(avctx->flags & AV_CODEC_FLAG_BITEXACT);
116#else
117 ff_fmt_convert_init(&s->fmt_conv);
118 s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
119#endif
120 if (!s->fdsp)
121 return AVERROR(ENOMEM);
122
123 ff_ac3dsp_init(&s->ac3dsp);
124 av_lfg_init(&s->dith_state, 0);
125
126 if (USE_FIXED)
127 avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
128 else
129 avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
130
131 ac3_downmix(avctx);
132 s->downmixed = 1;
133
134 for (i = 0; i < AC3_MAX_CHANNELS; i++) {
135 s->xcfptr[i] = s->transform_coeffs[i];
136 s->dlyptr[i] = s->delay[i];
137 }
138
139#if USE_FIXED
140 ff_ac3_init_static();
141#else
142 static AVOnce init_static_once = AV_ONCE_INIT;
143 ff_thread_once(&init_static_once, ac3_float_tables_init);
144#endif
145
146 return 0;
147}
148
149static av_cold void ac3_decode_flush(AVCodecContext *avctx)
150{

Callers

nothing calls this directly

Calls 10

av_tx_initFunction · 0.85
ff_bswapdsp_initFunction · 0.85
avpriv_alloc_fixed_dspFunction · 0.85
ff_fmt_convert_initFunction · 0.85
avpriv_float_dsp_allocFunction · 0.85
ff_ac3dsp_initFunction · 0.85
av_lfg_initFunction · 0.85
ac3_downmixFunction · 0.85
ff_ac3_init_staticFunction · 0.85
ff_thread_onceFunction · 0.85

Tested by

no test coverage detected