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

Function bit_alloc_init

libavcodec/ac3enc.c:1063–1091  ·  view source on GitHub ↗

* Initialize bit allocation. * Set default parameter codes and calculate parameter values. */

Source from the content-addressed store, hash-verified

1061 * Set default parameter codes and calculate parameter values.
1062 */
1063static av_cold void bit_alloc_init(AC3EncodeContext *s)
1064{
1065 int ch;
1066
1067 /* init default parameters */
1068 s->slow_decay_code = 2;
1069 s->fast_decay_code = 1;
1070 s->slow_gain_code = 1;
1071 s->db_per_bit_code = s->eac3 ? 2 : 3;
1072 s->floor_code = 7;
1073 for (ch = 0; ch <= s->channels; ch++)
1074 s->fast_gain_code[ch] = 4;
1075
1076 /* initial snr offset */
1077 s->coarse_snr_offset = 40;
1078
1079 /* compute real values */
1080 /* currently none of these values change during encoding, so we can just
1081 set them once at initialization */
1082 s->bit_alloc.slow_decay = ff_ac3_slow_decay_tab[s->slow_decay_code];
1083 s->bit_alloc.fast_decay = ff_ac3_fast_decay_tab[s->fast_decay_code];
1084 s->bit_alloc.slow_gain = ff_ac3_slow_gain_tab[s->slow_gain_code];
1085 s->bit_alloc.db_per_bit = ff_ac3_db_per_bit_tab[s->db_per_bit_code];
1086 s->bit_alloc.floor = ff_ac3_floor_tab[s->floor_code];
1087 s->bit_alloc.cpl_fast_leak = 0;
1088 s->bit_alloc.cpl_slow_leak = 0;
1089
1090 count_frame_bits_fixed(s);
1091}
1092
1093
1094/*

Callers 1

ff_ac3_encode_initFunction · 0.85

Calls 1

count_frame_bits_fixedFunction · 0.85

Tested by

no test coverage detected