diff options
-rw-r--r-- | libavcodec/vima.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/libavcodec/vima.c b/libavcodec/vima.c index 0423fff091..bde7033c2c 100644 --- a/libavcodec/vima.c +++ b/libavcodec/vima.c @@ -173,47 +173,47 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, *dest++ = cs.predictor; } } else { - for (chan = 0; chan < channels; chan++) { - uint16_t *dest = (uint16_t *)frame->data[0] + chan; - int step_index = channel_hint[chan]; - int output = pcm_data[chan]; - int sample; - - for (sample = 0; sample < samples; sample++) { - int lookup_size, lookup, highbit, lowbits; - - step_index = av_clip(step_index, 0, 88); - lookup_size = size_table[step_index]; - lookup = get_bits(&gb, lookup_size); - highbit = 1 << (lookup_size - 1); - lowbits = highbit - 1; - - if (lookup & highbit) - lookup ^= highbit; - else - highbit = 0; - - if (lookup == lowbits) { - output = get_sbits(&gb, 16); - } else { - int predict_index, diff; - - predict_index = (lookup << (7 - lookup_size)) | (step_index << 6); - predict_index = av_clip(predict_index, 0, 5785); - diff = predict_table[predict_index]; - if (lookup) - diff += ff_adpcm_step_table[step_index] >> (lookup_size - 1); - if (highbit) - diff = -diff; - - output = av_clip_int16(output + diff); + for (chan = 0; chan < channels; chan++) { + uint16_t *dest = (uint16_t *)frame->data[0] + chan; + int step_index = channel_hint[chan]; + int output = pcm_data[chan]; + int sample; + + for (sample = 0; sample < samples; sample++) { + int lookup_size, lookup, highbit, lowbits; + + step_index = av_clip(step_index, 0, 88); + lookup_size = size_table[step_index]; + lookup = get_bits(&gb, lookup_size); + highbit = 1 << (lookup_size - 1); + lowbits = highbit - 1; + + if (lookup & highbit) + lookup ^= highbit; + else + highbit = 0; + + if (lookup == lowbits) { + output = get_sbits(&gb, 16); + } else { + int predict_index, diff; + + predict_index = (lookup << (7 - lookup_size)) | (step_index << 6); + predict_index = av_clip(predict_index, 0, 5785); + diff = predict_table[predict_index]; + if (lookup) + diff += ff_adpcm_step_table[step_index] >> (lookup_size - 1); + if (highbit) + diff = -diff; + + output = av_clip_int16(output + diff); + } + + *dest = output; + dest += channels; + + step_index += step_index_tables[lookup_size - 2][lookup]; } - - *dest = output; - dest += channels; - - step_index += step_index_tables[lookup_size - 2][lookup]; - } } } |