summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-09-29 16:00:00 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-26 12:01:07 -0400
commit0093f96d34e411e1fb3def454598d2018f4c2941 (patch)
tree86da8f6fd1d3f3b26c5b7206e82c0c0bc95801f9
parent85579b638179f40102c4bcedb8a2dde4cf19f391 (diff)
pcmdec: return buf_size instead of src-buf.
The values will always be the same, so this change eliminates an unneeded variable. It also gets rid of the need to reset src when memcpy() is used.
-rw-r--r--libavcodec/pcm.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index ca3926402a..37dda7dac9 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -247,16 +247,15 @@ static int pcm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
+ const uint8_t *src = avpkt->data;
int buf_size = avpkt->size;
PCMDecode *s = avctx->priv_data;
int sample_size, c, n, i;
uint8_t *samples;
- const uint8_t *src, *src8, *src2[MAX_CHANNELS];
+ const uint8_t *src8, *src2[MAX_CHANNELS];
int32_t *dst_int32_t;
samples = data;
- src = buf;
sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
@@ -329,7 +328,6 @@ static int pcm_decode_frame(AVCodecContext *avctx,
AV_WN16A(samples, bytestream_get_le16(&src2[c]));
samples += 2;
}
- src = src2[avctx->channels-1];
break;
case CODEC_ID_PCM_U16LE:
DECODE(16, le16, src, samples, n, 0, 0x8000)
@@ -375,7 +373,6 @@ static int pcm_decode_frame(AVCodecContext *avctx,
#endif /* HAVE_BIGENDIAN */
case CODEC_ID_PCM_U8:
memcpy(samples, src, n*sample_size);
- src += n*sample_size;
samples += n * sample_size;
break;
case CODEC_ID_PCM_ZORK:
@@ -439,14 +436,13 @@ static int pcm_decode_frame(AVCodecContext *avctx,
((src8[2] & 0xF0) << 8) | (src8[4] << 4) | (src8[3] >> 4);
}
}
- src += n * avctx->channels * 5;
samples = (uint8_t *) dst_int32_t;
break;
default:
return -1;
}
*data_size = samples - (uint8_t *)data;
- return src - buf;
+ return buf_size;
}
#if CONFIG_ENCODERS