diff options
author | Paul B Mahol <onemda@gmail.com> | 2016-09-21 14:25:50 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2016-09-21 14:37:25 +0200 |
commit | 187c4273351f517a343c00ac470e1952edbd2e9b (patch) | |
tree | 58938ac61f7c7d1e2417099d9eac4a4095bca43a | |
parent | 257fbc3af4cba08ac471dab68924182160bde6fd (diff) | |
download | ffmpeg-187c4273351f517a343c00ac470e1952edbd2e9b.tar.gz |
avcodec/on2avc: add 0x500 stereo support and improve 0x500 mono support
0x500 can be stereo.
0x500 mono can use extended window types.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavcodec/on2avc.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c index d545fea48a..4e4be7530a 100644 --- a/libavcodec/on2avc.c +++ b/libavcodec/on2avc.c @@ -685,11 +685,11 @@ static void wtf_44(On2AVCContext *c, float *out, float *src, int size) } } -static int on2avc_reconstruct_stereo(On2AVCContext *c, AVFrame *dst, int offset) +static int on2avc_reconstruct_channel_ext(On2AVCContext *c, AVFrame *dst, int offset) { int ch, i; - for (ch = 0; ch < 2; ch++) { + for (ch = 0; ch < c->avctx->channels; ch++) { float *out = (float*)dst->extended_data[ch] + offset; float *in = c->coeffs[ch]; float *saved = c->delay[ch]; @@ -810,10 +810,6 @@ static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf, } c->prev_window_type = c->window_type; c->window_type = get_bits(&gb, 3); - if (c->window_type >= WINDOW_TYPE_EXT4 && c->avctx->channels == 1) { - av_log(c->avctx, AV_LOG_ERROR, "stereo mode window for mono audio\n"); - return AVERROR_INVALIDDATA; - } c->band_start = c->modes[c->window_type].band_start; c->num_windows = c->modes[c->window_type].num_windows; @@ -834,7 +830,7 @@ static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf, for (i = 0; i < c->avctx->channels; i++) on2avc_reconstruct_channel(c, i, dst, offset); } else { - on2avc_reconstruct_stereo(c, dst, offset); + on2avc_reconstruct_channel_ext(c, dst, offset); } return 0; @@ -923,10 +919,6 @@ static av_cold int on2avc_decode_init(AVCodecContext *avctx) : AV_CH_LAYOUT_MONO; c->is_av500 = (avctx->codec_tag == 0x500); - if (c->is_av500 && avctx->channels == 2) { - av_log(avctx, AV_LOG_ERROR, "0x500 version should be mono\n"); - return AVERROR_INVALIDDATA; - } if (avctx->channels == 2) av_log(avctx, AV_LOG_WARNING, |