Revision f62be777

View differences:

libavcodec/wmaprodec.c
143 143
    int*     scale_factors;                           ///< pointer to the scale factor values used for decoding
144 144
    uint8_t  table_idx;                               ///< index in sf_offsets for the scale factor reference block
145 145
    float*   coeffs;                                  ///< pointer to the subframe decode buffer
146
    uint16_t num_vec_coeffs;                          ///< number of vector coded coefficients
146 147
    DECLARE_ALIGNED(16, float, out)[WMAPRO_BLOCK_MAX_SIZE + WMAPRO_BLOCK_MAX_SIZE / 2]; ///< output buffer
147 148
} WMAProChannelCtx;
148 149

  
......
215 216
    int8_t           channels_for_cur_subframe;     ///< number of channels that contain the subframe
216 217
    int8_t           channel_indexes_for_cur_subframe[WMAPRO_MAX_CHANNELS];
217 218
    int8_t           num_bands;                     ///< number of scale factor bands
219
    int8_t           transmit_num_vec_coeffs;       ///< number of vector coded coefficients is part of the bitstream
218 220
    int16_t*         cur_sfb_offsets;               ///< sfb offsets for the current block
219 221
    uint8_t          table_idx;                     ///< index for the num_sfb, sfb_offsets, sf_offsets and subwoofer_cutoffs tables
220 222
    int8_t           esc_len;                       ///< length of escaped coefficients
......
794 796

  
795 797
    /** decode vector coefficients (consumes up to 167 bits per iteration for
796 798
      4 vector coded large values) */
797
    while (!rl_mode && cur_coeff + 3 < s->subframe_len) {
799
    while ((s->transmit_num_vec_coeffs || !rl_mode) &&
800
           (cur_coeff + 3 < ci->num_vec_coeffs)) {
798 801
        int vals[4];
799 802
        int i;
800 803
        unsigned int idx;
......
843 846
    }
844 847

  
845 848
    /** decode run level coded coefficients */
846
    if (rl_mode) {
849
    if (cur_coeff < s->subframe_len) {
847 850
        memset(&ci->coeffs[cur_coeff], 0,
848 851
               sizeof(*ci->coeffs) * (s->subframe_len - cur_coeff));
849 852
        if (ff_wma_run_level_decode(s->avctx, &s->gb, vlc,
......
1148 1151
    if (transmit_coeffs) {
1149 1152
        int step;
1150 1153
        int quant_step = 90 * s->bits_per_sample >> 4;
1151
        if ((get_bits1(&s->gb))) {
1152
            /** FIXME: might change run level mode decision */
1153
            av_log_ask_for_sample(s->avctx, "unsupported quant step coding\n");
1154
            return AVERROR_INVALIDDATA;
1154

  
1155
        /** decode number of vector coded coefficients */
1156
        if ((s->transmit_num_vec_coeffs = get_bits1(&s->gb))) {
1157
            int num_bits = av_log2((s->subframe_len + 3)/4) + 1;
1158
            for (i = 0; i < s->channels_for_cur_subframe; i++) {
1159
                int c = s->channel_indexes_for_cur_subframe[i];
1160
                s->channel[c].num_vec_coeffs = get_bits(&s->gb, num_bits) << 2;
1161
            }
1162
        } else {
1163
            for (i = 0; i < s->channels_for_cur_subframe; i++) {
1164
                int c = s->channel_indexes_for_cur_subframe[i];
1165
                s->channel[c].num_vec_coeffs = s->subframe_len;
1166
            }
1155 1167
        }
1156 1168
        /** decode quantization step */
1157 1169
        step = get_sbits(&s->gb, 6);

Also available in: Unified diff