1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

adxenc: use a loop to encode each channel

This commit is contained in:
Justin Ruggles 2011-12-19 10:18:09 -05:00
parent 6c117bd8e0
commit f1be41c63d

View File

@ -128,6 +128,7 @@ static int adx_encode_frame(AVCodecContext *avctx, uint8_t *frame,
ADXContext *c = avctx->priv_data; ADXContext *c = avctx->priv_data;
const int16_t *samples = data; const int16_t *samples = data;
uint8_t *dst = frame; uint8_t *dst = frame;
int ch;
if (!c->header_parsed) { if (!c->header_parsed) {
int hdrsize = adx_encode_header(avctx, dst, buf_size); 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; c->header_parsed = 1;
} }
if (avctx->channels == 1) { for (ch = 0; ch < avctx->channels; ch++) {
adx_encode(c, dst, samples, c->prev, avctx->channels); adx_encode(c, dst, samples + ch, &c->prev[ch], avctx->channels);
dst += 18; 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;
} }
return dst - frame; return dst - frame;
} }