Commit 6c117bd8 authored by Justin Ruggles's avatar Justin Ruggles

adxenc: remove unneeded loops

avctx->frame_size is 32, so that is how many samples we process per call.
parent 99baf2c7
...@@ -128,7 +128,6 @@ static int adx_encode_frame(AVCodecContext *avctx, uint8_t *frame, ...@@ -128,7 +128,6 @@ 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 rest = avctx->frame_size;
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);
...@@ -137,20 +136,12 @@ static int adx_encode_frame(AVCodecContext *avctx, uint8_t *frame, ...@@ -137,20 +136,12 @@ static int adx_encode_frame(AVCodecContext *avctx, uint8_t *frame,
} }
if (avctx->channels == 1) { if (avctx->channels == 1) {
while (rest >= 32) {
adx_encode(c, dst, samples, c->prev, avctx->channels); adx_encode(c, dst, samples, c->prev, avctx->channels);
dst += 18; dst += 18;
samples += 32;
rest -= 32;
}
} else { } else {
while (rest >= 32*2) {
adx_encode(c, dst, samples, c->prev, avctx->channels); adx_encode(c, dst, samples, c->prev, avctx->channels);
adx_encode(c, dst + 18, samples + 1, c->prev + 1, avctx->channels); adx_encode(c, dst + 18, samples + 1, c->prev + 1, avctx->channels);
dst += 18*2; dst += 18*2;
samples += 32*2;
rest -= 32*2;
}
} }
return dst - frame; return dst - frame;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment