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

Function parse_scale

libavcodec/dca_core.c:350–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350static inline int parse_scale(DCACoreDecoder *s, int *scale_index, int sel)
351{
352 const uint32_t *scale_table;
353 unsigned int scale_size;
354
355 // Select the root square table
356 if (sel > 5) {
357 scale_table = ff_dca_scale_factor_quant7;
358 scale_size = FF_ARRAY_ELEMS(ff_dca_scale_factor_quant7);
359 } else {
360 scale_table = ff_dca_scale_factor_quant6;
361 scale_size = FF_ARRAY_ELEMS(ff_dca_scale_factor_quant6);
362 }
363
364 // If Huffman code was used, the difference of scales was encoded
365 if (sel < 5)
366 *scale_index += get_vlc2(&s->gb, ff_dca_vlc_scale_factor[sel].table,
367 DCA_SCALES_VLC_BITS, 2);
368 else
369 *scale_index = get_bits(&s->gb, sel + 1);
370
371 // Look up scale factor from the root square table
372 if ((unsigned int)*scale_index >= scale_size) {
373 av_log(s->avctx, AV_LOG_ERROR, "Invalid scale factor index\n");
374 return AVERROR_INVALIDDATA;
375 }
376
377 return scale_table[*scale_index];
378}
379
380static inline int parse_joint_scale(DCACoreDecoder *s, int sel)
381{

Callers 2

parse_subframe_headerFunction · 0.85

Calls 3

get_vlc2Function · 0.85
av_logFunction · 0.85
get_bitsFunction · 0.70

Tested by

no test coverage detected