summaryrefslogtreecommitdiff
path: root/libavcodec/adxenc.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-12-19 10:18:09 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-01-03 18:47:42 -0500
commitf1be41c63d8c2f0d0ecc6cbde4eb50701f809834 (patch)
treec7235c5773a863f227f02db2ccb50d40b86920cf /libavcodec/adxenc.c
parent6c117bd8e072319dd0895efd64c4470ad0872213 (diff)
adxenc: use a loop to encode each channel
Diffstat (limited to 'libavcodec/adxenc.c')
-rw-r--r--libavcodec/adxenc.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/libavcodec/adxenc.c b/libavcodec/adxenc.c
index 12690d2ed0..aea479884b 100644
--- a/libavcodec/adxenc.c
+++ b/libavcodec/adxenc.c
@@ -128,6 +128,7 @@ static int adx_encode_frame(AVCodecContext *avctx, uint8_t *frame,
ADXContext *c = avctx->priv_data;
const int16_t *samples = data;
uint8_t *dst = frame;
+ int ch;
if (!c->header_parsed) {
int hdrsize = adx_encode_header(avctx, dst, buf_size);
@@ -135,13 +136,9 @@ static int adx_encode_frame(AVCodecContext *avctx, uint8_t *frame,
c->header_parsed = 1;
}
- if (avctx->channels == 1) {
- adx_encode(c, dst, samples, c->prev, avctx->channels);
- dst += 18;
- } else {
- adx_encode(c, dst, samples, c->prev, avctx->channels);
- adx_encode(c, dst + 18, samples + 1, c->prev + 1, avctx->channels);
- dst += 18*2;
+ for (ch = 0; ch < avctx->channels; ch++) {
+ adx_encode(c, dst, samples + ch, &c->prev[ch], avctx->channels);
+ dst += 18;
}
return dst - frame;
}