From 00dd9a6d6a5c3cc209082023595354a81aff9bb9 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 20 Nov 2012 00:57:41 -0500 Subject: [PATCH 1/2] pcm: fix decoding of pcm_s16le_planar on big-endian The sample count is decremented by the DECODE() macro and needs to be reset in each loop iteration. Also, DECODE() increments the src pointer so that does not need to be done separately. --- libavcodec/pcm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 906e8e83aa..a24a38ba80 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -338,15 +338,17 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, break; case AV_CODEC_ID_PCM_S16LE_PLANAR: { + int av_unused n2; n /= avctx->channels; for (c = 0; c < avctx->channels; c++) { samples = s->frame.extended_data[c]; #if HAVE_BIGENDIAN - DECODE(16, le16, src, samples, n, 0, 0) + n2 = n; + DECODE(16, le16, src, samples, n2, 0, 0) #else memcpy(samples, src, n * 2); -#endif src += n * 2; +#endif } break; } From 17fecb4a59926fc85d76efd0d0405f1aa84e429b Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 24 Oct 2012 19:14:24 +0200 Subject: [PATCH 2/2] flashsv: Drop unused function and struct parameters --- libavcodec/flashsv.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index a155befa9e..2ba32641b7 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -45,7 +45,6 @@ typedef struct BlockInfo { uint8_t *pos; int size; - int unp_size; } BlockInfo; typedef struct FlashSVContext { @@ -121,8 +120,7 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx) } -static int flashsv2_prime(FlashSVContext *s, uint8_t *src, - int size, int unp_size) +static int flashsv2_prime(FlashSVContext *s, uint8_t *src, int size) { z_stream zs; int zret; // Zlib return code @@ -173,8 +171,9 @@ static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt, return AVERROR_UNKNOWN; } if (s->zlibprime_curr || s->zlibprime_prev) { - ret = flashsv2_prime(s, s->blocks[blk_idx].pos, s->blocks[blk_idx].size, - s->blocks[blk_idx].unp_size); + ret = flashsv2_prime(s, + s->blocks[blk_idx].pos, + s->blocks[blk_idx].size); if (ret < 0) return ret; } @@ -196,7 +195,6 @@ static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt, if (s->is_keyframe) { s->blocks[blk_idx].pos = s->keyframedata + (get_bits_count(gb) / 8); s->blocks[blk_idx].size = block_size; - s->blocks[blk_idx].unp_size = s->block_size * 3 - s->zstream.avail_out; } if (!s->color_depth) { /* Flash Screen Video stores the image upside down, so copy