From 1c9878183772d770cc398e5e76c1db8f74a929fe Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sun, 29 Jul 2012 12:33:35 +0200 Subject: [PATCH] 8svx: use a more direct condition. esc->table was inited based on codec->id: re-testing codec->id is code duplication and can lead to inconsistencies. --- libavcodec/8svx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c index 6aa52d1e6c..3bece41627 100644 --- a/libavcodec/8svx.c +++ b/libavcodec/8svx.c @@ -112,13 +112,13 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, if (!esc->samples && avpkt) { uint8_t *deinterleaved_samples, *p = NULL; - esc->samples_size = avctx->codec->id == CODEC_ID_8SVX_RAW || avctx->codec->id ==CODEC_ID_PCM_S8_PLANAR? + esc->samples_size = !esc->table ? avpkt->size : avctx->channels + (avpkt->size-avctx->channels) * 2; if (!(esc->samples = av_malloc(esc->samples_size))) return AVERROR(ENOMEM); /* decompress */ - if (avctx->codec->id == CODEC_ID_8SVX_FIB || avctx->codec->id == CODEC_ID_8SVX_EXP) { + if (esc->table) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int n = esc->samples_size; @@ -166,7 +166,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, *dst++ = *src++ + 128; esc->samples_idx += out_data_size; - return avctx->codec->id == CODEC_ID_8SVX_FIB || avctx->codec->id == CODEC_ID_8SVX_EXP ? + return esc->table ? (avctx->frame_number == 0)*2 + out_data_size / 2 : out_data_size; }