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

Function decode_init

libavcodec/mpegaudiodec.c:286–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284#endif
285
286static av_cold int decode_init(AVCodecContext * avctx)
287{
288 MPADecodeContext *s = avctx->priv_data;
289 static int init=0;
290 int i, j, k;
291
292 s->avctx = avctx;
293
294 avctx->sample_fmt= OUT_FMT;
295 s->error_recognition= avctx->error_recognition;
296
297 if(avctx->antialias_algo != FF_AA_FLOAT)
298 s->compute_antialias= compute_antialias_integer;
299 else
300 s->compute_antialias= compute_antialias_float;
301
302 if (!init && !avctx->parse_only) {
303 int offset;
304
305 /* scale factors table for layer 1/2 */
306 for(i=0;i<64;i++) {
307 int shift, mod;
308 /* 1.0 (i = 3) is normalized to 2 ^ FRAC_BITS */
309 shift = (i / 3);
310 mod = i % 3;
311 scale_factor_modshift[i] = mod | (shift << 2);
312 }
313
314 /* scale factor multiply for layer 1 */
315 for(i=0;i<15;i++) {
316 int n, norm;
317 n = i + 2;
318 norm = ((INT64_C(1) << n) * FRAC_ONE) / ((1 << n) - 1);
319 scale_factor_mult[i][0] = MULL(FIXR(1.0 * 2.0), norm, FRAC_BITS);
320 scale_factor_mult[i][1] = MULL(FIXR(0.7937005259 * 2.0), norm, FRAC_BITS);
321 scale_factor_mult[i][2] = MULL(FIXR(0.6299605249 * 2.0), norm, FRAC_BITS);
322 dprintf(avctx, "%d: norm=%x s=%x %x %x\n",
323 i, norm,
324 scale_factor_mult[i][0],
325 scale_factor_mult[i][1],
326 scale_factor_mult[i][2]);
327 }
328
329 ff_mpa_synth_init(ff_mpa_synth_window);
330
331 /* huffman decode tables */
332 offset = 0;
333 for(i=1;i<16;i++) {
334 const HuffTable *h = &mpa_huff_tables[i];
335 int xsize, x, y;
336 uint8_t tmp_bits [512];
337 uint16_t tmp_codes[512];
338
339 memset(tmp_bits , 0, sizeof(tmp_bits ));
340 memset(tmp_codes, 0, sizeof(tmp_codes));
341
342 xsize = h->xsize;
343

Callers 1

decode_init_mp3on4Function · 0.70

Calls 4

ff_mpa_synth_initFunction · 0.85
int_pow_initFunction · 0.85
mpegaudio_tableinitFunction · 0.85
MULLFunction · 0.50

Tested by

no test coverage detected