summaryrefslogtreecommitdiff
path: root/libavcodec/wmaprodec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-09-24 00:34:37 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-28 12:02:24 -0400
commitb8b4c9c328bf19f4dc8dd5666ce80ec91200cac4 (patch)
treed7456a817077351bb5af9be623ef7b8568a2213a /libavcodec/wmaprodec.c
parentd0b1b1c5c74a14d0b3acc39470c23af4561c617b (diff)
wmapro: use FmtConvertContext.float_interleave() to interleave output samples
Diffstat (limited to 'libavcodec/wmaprodec.c')
-rw-r--r--libavcodec/wmaprodec.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index b3ba9abe15..ce83bb6c54 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -92,6 +92,7 @@
#include "put_bits.h"
#include "wmaprodata.h"
#include "dsputil.h"
+#include "fmtconvert.h"
#include "sinewin.h"
#include "wma.h"
@@ -166,6 +167,7 @@ typedef struct WMAProDecodeCtx {
/* generic decoder variables */
AVCodecContext* avctx; ///< codec context for av_log
DSPContext dsp; ///< accelerated DSP functions
+ FmtConvertContext fmt_conv;
uint8_t frame_data[MAX_FRAMESIZE +
FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data
PutBitContext pb; ///< context for filling the frame_data buffer
@@ -279,6 +281,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->avctx = avctx;
dsputil_init(&s->dsp, avctx);
+ ff_fmt_convert_init(&s->fmt_conv, avctx);
init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
@@ -1281,6 +1284,7 @@ static int decode_frame(WMAProDecodeCtx *s)
int more_frames = 0;
int len = 0;
int i;
+ const float *out_ptr[WMAPRO_MAX_CHANNELS];
/** check for potential output buffer overflow */
if (s->num_channels * s->samples_per_frame > s->samples_end - s->samples) {
@@ -1356,18 +1360,12 @@ static int decode_frame(WMAProDecodeCtx *s)
}
/** interleave samples and write them to the output buffer */
- for (i = 0; i < s->num_channels; i++) {
- float* ptr = s->samples + i;
- int incr = s->num_channels;
- float* iptr = s->channel[i].out;
- float* iend = iptr + s->samples_per_frame;
-
- // FIXME should create/use a DSP function here
- while (iptr < iend) {
- *ptr = *iptr++;
- ptr += incr;
- }
+ for (i = 0; i < s->num_channels; i++)
+ out_ptr[i] = s->channel[i].out;
+ s->fmt_conv.float_interleave(s->samples, out_ptr, s->samples_per_frame,
+ s->num_channels);
+ for (i = 0; i < s->num_channels; i++) {
/** reuse second half of the IMDCT output for the next frame */
memcpy(&s->channel[i].out[0],
&s->channel[i].out[s->samples_per_frame],