summaryrefslogtreecommitdiff
path: root/libavcodec/apedec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-10-31 15:10:19 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-11-10 10:25:47 -0500
commitde157f2118eeebedd28f4fd1ed448787abd837f8 (patch)
tree9d19b5940e3f0f00163e650fb47526c268eee15c /libavcodec/apedec.c
parent4315c7d35aa946fb3a0da9a30f08fb4e0ca8edfb (diff)
downloadffmpeg-de157f2118eeebedd28f4fd1ed448787abd837f8.tar.gz
apedec: do not needlessly copy s->samples to nblocks.
also move nblocks to the local scope where it is used.
Diffstat (limited to 'libavcodec/apedec.c')
-rw-r--r--libavcodec/apedec.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 1567025183..72b4112ad6 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -814,7 +814,6 @@ static int ape_decode_frame(AVCodecContext *avctx,
int buf_size = avpkt->size;
APEContext *s = avctx->priv_data;
int16_t *samples = data;
- uint32_t nblocks;
int i;
int blockstodecode, out_size;
int bytes_used;
@@ -824,7 +823,7 @@ static int ape_decode_frame(AVCodecContext *avctx,
av_assert0(s->samples >= 0);
if(!s->samples){
- uint32_t offset;
+ uint32_t nblocks, offset;
void *tmp_data;
if (buf_size < 8) {
@@ -874,8 +873,7 @@ static int ape_decode_frame(AVCodecContext *avctx,
return buf_size;
}
- nblocks = s->samples;
- blockstodecode = FFMIN(BLOCKS_PER_LOOP, nblocks);
+ blockstodecode = FFMIN(BLOCKS_PER_LOOP, s->samples);
out_size = blockstodecode * avctx->channels *
av_get_bytes_per_sample(avctx->sample_fmt);