diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-22 13:18:18 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-22 13:18:27 +0200 |
commit | a88ed5a481c365b9ca95588aeee6d9858ad5df40 (patch) | |
tree | ca46f1fab490703d6ffc7cdb68478e97b947fd90 | |
parent | f33d5af1f35e1f1fd83648d321b489c9006525c9 (diff) | |
parent | b64bd2e18bac1bd3e3e0ae4aebcad1c33f031c66 (diff) | |
download | ffmpeg-a88ed5a481c365b9ca95588aeee6d9858ad5df40.tar.gz |
Merge commit 'b64bd2e18bac1bd3e3e0ae4aebcad1c33f031c66' into release/0.10
* commit 'b64bd2e18bac1bd3e3e0ae4aebcad1c33f031c66':
qdm2: refactor joined stereo support
adpcm: Write the correct number of samples for ima-dk4
imc: Catch a division by zero
atrac3: Error on impossible encoding/channel combinations
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/adpcm.c | 2 | ||||
-rw-r--r-- | libavcodec/qdm2.c | 22 |
2 files changed, 13 insertions, 11 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 51d9c8d710..f22c0db19b 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -717,7 +717,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, src++; *samples++ = cs->predictor; } - for (n = nb_samples >> (1 - st); n > 0; n--, src++) { + for (n = (nb_samples >> (1 - st)) - 1; n > 0; n--) { uint8_t v = *src; *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 72d4a1a325..5572b9d881 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -769,7 +769,7 @@ static void fill_coding_method_array (sb_int8_array tone_level_idx, sb_int8_arra static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max) { int sb, j, k, n, ch, run, channels; - int joined_stereo, zero_encoding, chs; + int joined_stereo, zero_encoding; int type34_first; float type34_div = 0; float type34_predictor; @@ -923,16 +923,18 @@ static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int l } if (joined_stereo) { - float tmp[10][MPA_MAX_CHANNELS]; - - for (k = 0; k < run; k++) { - tmp[k][0] = samples[k]; - tmp[k][1] = (sign_bits[(j + k) / 8]) ? -samples[k] : samples[k]; + for (k = 0; k < run && j + k < 128; k++) { + q->sb_samples[0][j + k][sb] = + q->tone_level[0][sb][(j + k) / 2] * samples[k]; + if (q->nb_channels == 2) { + if (sign_bits[(j + k) / 8]) + q->sb_samples[1][j + k][sb] = + q->tone_level[1][sb][(j + k) / 2] * -samples[k]; + else + q->sb_samples[1][j + k][sb] = + q->tone_level[1][sb][(j + k) / 2] * samples[k]; + } } - for (chs = 0; chs < q->nb_channels; chs++) - for (k = 0; k < run; k++) - if ((j + k) < 128) - q->sb_samples[chs][j + k][sb] = q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs]; } else { for (k = 0; k < run; k++) if ((j + k) < 128) |