Mercurial > libavcodec.hg
changeset 7794:315d2a6c6a1e libavcodec
Simplify mace_decode_frame()
author | vitor |
---|---|
date | Thu, 04 Sep 2008 23:12:20 +0000 |
parents | 0253472b1f25 |
children | 7f81fb0dd829 |
files | mace.c |
diffstat | 1 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mace.c Thu Sep 04 23:02:08 2008 +0000 +++ b/mace.c Thu Sep 04 23:12:20 2008 +0000 @@ -395,23 +395,26 @@ void *data, int *data_size, const uint8_t *buf, int buf_size) { - short *samples; + short *samples = data; MACEContext *c = avctx->priv_data; + int i; - samples = (short *)data; switch (avctx->codec->id) { case CODEC_ID_MACE3: dprintf(avctx, "mace_decode_frame[3]()"); - Exp1to3(c, buf, samples, buf_size / 2 / avctx->channels, avctx->channels, 1); - if (avctx->channels == 2) - Exp1to3(c, buf, samples+1, buf_size / 2 / 2, 2, 2); + for(i = 0; i < avctx->channels; i++) + Exp1to3(c, buf, samples + i, buf_size / 2 / avctx->channels, + avctx->channels, i + 1); + *data_size = 2 * 3 * buf_size; break; case CODEC_ID_MACE6: dprintf(avctx, "mace_decode_frame[6]()"); - Exp1to6(c, buf, samples, buf_size / avctx->channels, avctx->channels, 1); - if (avctx->channels == 2) - Exp1to6(c, buf, samples+1, buf_size / 2, 2, 2); + + for(i = 0; i < avctx->channels; i++) + Exp1to6(c, buf, samples + i, buf_size / avctx->channels, + avctx->channels, i + 1); + *data_size = 2 * 6 * buf_size; break; default: