From d5f4e845f048b4d0834bee580335406f33fbf36a Mon Sep 17 00:00:00 2001 From: Vitor Sessak <vitor1...@gmail.com> Date: Wed, 4 Jan 2012 21:43:47 +0100 Subject: [PATCH] mpegaudiodec: change imdct window arrangment for better pointer alignment
--- libavcodec/mpegaudiodsp.h | 4 ++-- libavcodec/mpegaudiodsp_template.c | 26 +++++++++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/libavcodec/mpegaudiodsp.h b/libavcodec/mpegaudiodsp.h index 01fd698..88ff59a 100644 --- a/libavcodec/mpegaudiodsp.h +++ b/libavcodec/mpegaudiodsp.h @@ -74,7 +74,7 @@ void ff_imdct36_blocks_fixed(int *out, int *buf, int *in, void ff_init_mpadsp_tabs_float(void); void ff_init_mpadsp_tabs_fixed(void); -extern int ff_mdct_win_fixed[8][36]; -extern float ff_mdct_win_float[8][36]; +extern int ff_mdct_win_fixed[8][40]; +extern float ff_mdct_win_float[8][40]; #endif /* AVCODEC_MPEGAUDIODSP_H */ diff --git a/libavcodec/mpegaudiodsp_template.c b/libavcodec/mpegaudiodsp_template.c index 5a6adb8..d7584e3 100644 --- a/libavcodec/mpegaudiodsp_template.c +++ b/libavcodec/mpegaudiodsp_template.c @@ -69,8 +69,10 @@ static inline int round_sample(int64_t *sum) # define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) #endif -/** Window for MDCT. */ -DECLARE_ALIGNED(16, INTFLOAT, RENAME(ff_mdct_win))[8][36]; +/** Window for MDCT. Note that only the component [0,17] and [20,37] are used, + the components 18 and 19 are there only to assure 128-bit alignment for asm + */ +DECLARE_ALIGNED(16, INTFLOAT, RENAME(ff_mdct_win))[8][40]; DECLARE_ALIGNED(16, MPA_INT, RENAME(ff_mpa_synth_window))[512+256]; @@ -244,15 +246,17 @@ void RENAME(ff_init_mpadsp_tabs)(void) if (j == 2) RENAME(ff_mdct_win)[j][i/3] = FIXHR((d / (1<<5))); - else - RENAME(ff_mdct_win)[j][i ] = FIXHR((d / (1<<5))); + else { + int idx = i < 18 ? i : i + 2; + RENAME(ff_mdct_win)[j][idx] = FIXHR((d / (1<<5))); + } } } /* NOTE: we do frequency inversion adter the MDCT by changing the sign of the right window coefs */ for (j = 0; j < 4; j++) { - for (i = 0; i < 36; i += 2) { + for (i = 0; i < 40; i += 2) { RENAME(ff_mdct_win)[j + 4][i ] = RENAME(ff_mdct_win)[j][i ]; RENAME(ff_mdct_win)[j + 4][i + 1] = -RENAME(ff_mdct_win)[j][i + 1]; } @@ -353,15 +357,15 @@ static void imdct36(INTFLOAT *out, INTFLOAT *buf, INTFLOAT *in, INTFLOAT *win) t1 = s0 - s1; out[(9 + j) * SBLIMIT] = MULH3(t1, win[ 9 + j], 1) + buf[4*(9 + j)]; out[(8 - j) * SBLIMIT] = MULH3(t1, win[ 8 - j], 1) + buf[4*(8 - j)]; - buf[4 * ( 9 + j )] = MULH3(t0, win[18 + 9 + j], 1); - buf[4 * ( 8 - j )] = MULH3(t0, win[18 + 8 - j], 1); + buf[4 * ( 9 + j )] = MULH3(t0, win[20 + 9 + j], 1); + buf[4 * ( 8 - j )] = MULH3(t0, win[20 + 8 - j], 1); t0 = s2 + s3; t1 = s2 - s3; out[(9 + 8 - j) * SBLIMIT] = MULH3(t1, win[ 9 + 8 - j], 1) + buf[4*(9 + 8 - j)]; out[ j * SBLIMIT] = MULH3(t1, win[ j], 1) + buf[4*( j)]; - buf[4 * ( 9 + 8 - j )] = MULH3(t0, win[18 + 9 + 8 - j], 1); - buf[4 * ( j )] = MULH3(t0, win[18 + j], 1); + buf[4 * ( 9 + 8 - j )] = MULH3(t0, win[20 + 9 + 8 - j], 1); + buf[4 * ( j )] = MULH3(t0, win[20 + j], 1); i += 4; } @@ -371,8 +375,8 @@ static void imdct36(INTFLOAT *out, INTFLOAT *buf, INTFLOAT *in, INTFLOAT *win) t1 = s0 - s1; out[(9 + 4) * SBLIMIT] = MULH3(t1, win[ 9 + 4], 1) + buf[4*(9 + 4)]; out[(8 - 4) * SBLIMIT] = MULH3(t1, win[ 8 - 4], 1) + buf[4*(8 - 4)]; - buf[4 * ( 9 + 4 )] = MULH3(t0, win[18 + 9 + 4], 1); - buf[4 * ( 8 - 4 )] = MULH3(t0, win[18 + 8 - 4], 1); + buf[4 * ( 9 + 4 )] = MULH3(t0, win[20 + 9 + 4], 1); + buf[4 * ( 8 - 4 )] = MULH3(t0, win[20 + 8 - 4], 1); } void RENAME(ff_imdct36_blocks)(INTFLOAT *out, INTFLOAT *buf, INTFLOAT *in, -- 1.5.4.3
_______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel