Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

support decoding of files that contain the number of vector coded coefficients in their bitstream

No known samples are fixed by this problem, but I haven't tested many.

Backport of ffmpeg revision 26388.

Change-Id: Ife9654b7477a432834e3cab2cb43d16da071445a

+18 -6
+18 -6
lib/rbcodec/codecs/libwmapro/wmaprodec.c
··· 192 192 int* scale_factors; ///< pointer to the scale factor values used for decoding 193 193 uint8_t table_idx; ///< index in sf_offsets for the scale factor reference block 194 194 int32_t* coeffs; ///< pointer to the subframe decode buffer 195 + uint16_t num_vec_coeffs; ///< number of vector coded coefficients 195 196 int32_t* out; ///< output buffer 196 197 } WMAProChannelCtx; 197 198 ··· 260 261 int8_t channels_for_cur_subframe; ///< number of channels that contain the subframe 261 262 int8_t channel_indexes_for_cur_subframe[WMAPRO_MAX_CHANNELS]; 262 263 int8_t num_bands; ///< number of scale factor bands 264 + int8_t transmit_num_vec_coeffs; ///< number of vector coded coefficients is part of the bitstream 263 265 int16_t* cur_sfb_offsets; ///< sfb offsets for the current block 264 266 uint8_t table_idx; ///< index for the num_sfb, sfb_offsets, sf_offsets and subwoofer_cutoffs tables 265 267 int8_t esc_len; ///< length of escaped coefficients ··· 845 847 846 848 /** decode vector coefficients (consumes up to 167 bits per iteration for 847 849 4 vector coded large values) */ 848 - while (!rl_mode && cur_coeff + 3 < s->subframe_len) { 850 + while ((s->transmit_num_vec_coeffs || !rl_mode) && 851 + (cur_coeff + 3 < ci->num_vec_coeffs)) { 849 852 int32_t vals[4]; 850 853 int i; 851 854 unsigned int idx; ··· 902 905 } 903 906 904 907 /** decode run level coded coefficients */ 905 - if (rl_mode) { 908 + if (cur_coeff < s->subframe_len) { 906 909 memset(&ci->coeffs[cur_coeff], 0, 907 910 sizeof(*ci->coeffs) * (s->subframe_len - cur_coeff)); 908 911 ··· 1210 1213 if (transmit_coeffs) { 1211 1214 int step; 1212 1215 int quant_step = 90 * s->bits_per_sample >> 4; 1213 - if ((get_bits1(&s->gb))) { 1214 - /** FIXME: might change run level mode decision */ 1215 - DEBUGF("unsupported quant step coding\n"); 1216 - return AVERROR_INVALIDDATA; 1216 + 1217 + /** decode number of vector coded coefficients */ 1218 + if ((s->transmit_num_vec_coeffs = get_bits1(&s->gb))) { 1219 + int num_bits = av_log2((s->subframe_len + 3)/4) + 1; 1220 + for (i = 0; i < s->channels_for_cur_subframe; i++) { 1221 + int c = s->channel_indexes_for_cur_subframe[i]; 1222 + s->channel[c].num_vec_coeffs = get_bits(&s->gb, num_bits) << 2; 1223 + } 1224 + } else { 1225 + for (i = 0; i < s->channels_for_cur_subframe; i++) { 1226 + int c = s->channel_indexes_for_cur_subframe[i]; 1227 + s->channel[c].num_vec_coeffs = s->subframe_len; 1228 + } 1217 1229 } 1218 1230 /** decode quantization step */ 1219 1231 step = get_sbits(&s->gb, 6);