summaryrefslogtreecommitdiff
path: root/src/libffmpeg/libavcodec/wmadec.c
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-01-08 13:18:42 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-01-08 13:18:42 +0000
commit6f1c8d4eafabd914b87e9171bf4d04f4ef9160ea (patch)
treee70be493d1222b10f96aa5efac01c0ec0d5bcc97 /src/libffmpeg/libavcodec/wmadec.c
parent1fb58a63872660424777d41389e426dc90f1b660 (diff)
downloadxine-lib-6f1c8d4eafabd914b87e9171bf4d04f4ef9160ea.tar.gz
xine-lib-6f1c8d4eafabd914b87e9171bf4d04f4ef9160ea.tar.bz2
syncing ffmpeg (with some compilation fixes)
- fixes wma bugs - mace, huffyuv and mp3 decoders imported (but not enabled) tested: wma (v1 and v2), mpeg4, msmpeg4 v1, v2 and v3, divx3, divx4, divx5, xvid and dv decoders. everything looks fine. CVS patchset: 3828 CVS date: 2003/01/08 13:18:42
Diffstat (limited to 'src/libffmpeg/libavcodec/wmadec.c')
-rw-r--r--src/libffmpeg/libavcodec/wmadec.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/libffmpeg/libavcodec/wmadec.c b/src/libffmpeg/libavcodec/wmadec.c
index 7505a9be3..a6fa2f8b2 100644
--- a/src/libffmpeg/libavcodec/wmadec.c
+++ b/src/libffmpeg/libavcodec/wmadec.c
@@ -87,15 +87,15 @@ typedef struct WMADecodeContext {
int block_pos; /* current position in frame */
uint8_t ms_stereo; /* true if mid/side stereo mode */
uint8_t channel_coded[MAX_CHANNELS]; /* true if channel is coded */
- float exponents[MAX_CHANNELS][BLOCK_MAX_SIZE];
+ float exponents[MAX_CHANNELS][BLOCK_MAX_SIZE] __attribute__((aligned(16)));
float max_exponent[MAX_CHANNELS];
int16_t coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE];
- float coefs[MAX_CHANNELS][BLOCK_MAX_SIZE];
+ float coefs[MAX_CHANNELS][BLOCK_MAX_SIZE] __attribute__((aligned(16)));
MDCTContext mdct_ctx[BLOCK_NB_SIZES];
- float *windows[BLOCK_NB_SIZES];
- FFTSample mdct_tmp[BLOCK_MAX_SIZE]; /* temporary storage for imdct */
+ float *windows[BLOCK_NB_SIZES] __attribute__((aligned(16)));
+ FFTSample mdct_tmp[BLOCK_MAX_SIZE] __attribute__((aligned(16))); /* temporary storage for imdct */
/* output buffer for one frame and the last for IMDCT windowing */
- float frame_out[MAX_CHANNELS][BLOCK_MAX_SIZE * 2];
+ float frame_out[MAX_CHANNELS][BLOCK_MAX_SIZE * 2] __attribute__((aligned(16)));
/* last frame info */
uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4]; /* padding added */
int last_bitoffset;
@@ -1118,7 +1118,7 @@ static int wma_decode_block(WMADecodeContext *s)
for(ch = 0; ch < s->nb_channels; ch++) {
if (s->channel_coded[ch]) {
- FFTSample output[BLOCK_MAX_SIZE * 2];
+ FFTSample output[BLOCK_MAX_SIZE * 2] __attribute__((aligned(16)));
float *ptr;
int i, n4, index, n;
@@ -1240,7 +1240,7 @@ static int wma_decode_superframe(AVCodecContext *avctx,
/* add bit_offset bits to last frame */
if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) >
MAX_CODED_SUPERFRAME_SIZE)
- return -1;
+ goto fail;
q = s->last_superframe + s->last_superframe_len;
len = bit_offset;
while (len > 0) {
@@ -1259,7 +1259,7 @@ static int wma_decode_superframe(AVCodecContext *avctx,
/* this frame is stored in the last superframe and in the
current one */
if (wma_decode_frame(s, samples) < 0)
- return -1;
+ goto fail;
samples += s->nb_channels * s->frame_len;
}
@@ -1273,7 +1273,7 @@ static int wma_decode_superframe(AVCodecContext *avctx,
s->reset_block_lengths = 1;
for(i=0;i<nb_frames;i++) {
if (wma_decode_frame(s, samples) < 0)
- return -1;
+ goto fail;
samples += s->nb_channels * s->frame_len;
}
@@ -1283,18 +1283,22 @@ static int wma_decode_superframe(AVCodecContext *avctx,
pos >>= 3;
len = buf_size - pos;
if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0) {
- return -1;
+ goto fail;
}
s->last_superframe_len = len;
memcpy(s->last_superframe, buf + pos, len);
} else {
/* single frame decode */
if (wma_decode_frame(s, samples) < 0)
- return -1;
+ goto fail;
samples += s->nb_channels * s->frame_len;
}
*data_size = (int8_t *)samples - (int8_t *)data;
return s->block_align;
+ fail:
+ /* when error, we reset the bit reservoir */
+ s->last_superframe_len = 0;
+ return -1;
}
static int wma_decode_end(AVCodecContext *avctx)