From: Chris R. <ran...@ya...> - 2001-12-30 13:38:11
|
Hi, I have managed to get the file to compile. The problem seems to be an over-zealous optimising compiler that had tried to cache the value into a normal register, and then construct an illegal MMX instruction with it. I fixed the problem by declaring fdct_r_row to be "volatile", which forces the assembler to look at the memory location each time instead. FWIW, I have also declared all these values "static", and removed the duplicate declaration of ATTR_ALIGN. The file now compiles cleanly with gcc3. Cheers, Chris --- fdct_mmx.c.orig Sun Dec 30 13:31:42 2001 +++ fdct_mmx.c Sun Dec 30 13:27:06 2001 @@ -10,7 +10,6 @@ #include "../common.h" #include "mmx.h" -#define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align))) ////////////////////////////////////////////////////////////////////// // @@ -32,23 +31,28 @@ #define RND_FRW_COL (1 << (SHIFT_FRW_COL-1)) //concatenated table, for forward DCT transformation -const int16_t fdct_tg_all_16[] ATTR_ALIGN(8) = { +static const int16_t fdct_tg_all_16[] ATTR_ALIGN(8) = { 13036, 13036, 13036, 13036, // tg * (2<<16) + 0.5 27146, 27146, 27146, 27146, // tg * (2<<16) + 0.5 -21746, -21746, -21746, -21746, // tg * (2<<16) + 0.5 }; -const int16_t cos_4_16[4] = { +static const int16_t cos_4_16[4] = { -19195, -19195, -19195, -19195, //cos * (2<<16) + 0.5 }; -const int16_t ocos_4_16[4] = { +static const int16_t ocos_4_16[4] = { 23170, 23170, 23170, 23170, //cos * (2<<15) + 0.5 }; -const mmx_t fdct_one_corr = {0x0001000100010001LL}; -const mmx_t fdct_r_row = {d:{RND_FRW_ROW, RND_FRW_ROW} }; +static const mmx_t fdct_one_corr = {0x0001000100010001LL}; +/* + * We force the assembler to reference these memory locations + * by declaring it to be "volatile". Otherwise, it might try + * to cache the value in a normal register. + */ +static volatile mmx_t fdct_r_row = { d:{RND_FRW_ROW, RND_FRW_ROW} }; -const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = { // forward_dct coeff table +static const int16_t tab_frw_01234567[] ATTR_ALIGN(8) = { // forward_dct coeff table //row0 16384, 16384, 21407, -8867, // w09 w01 w08 w00 16384, 16384, 8867, -21407, // w13 w05 w12 w04 |
From: Miguel F. <mi...@ce...> - 2001-12-30 13:59:12
|
Thanks Chris, I will apply/test your patch and forward it to the ffmpeg-devel list. Miguel Chris Rankin wrote: > Hi, > > I have managed to get the file to compile. The problem seems to be an > over-zealous optimising compiler that had tried to cache the value > into a normal register, and then construct an illegal MMX instruction > with it. I fixed the problem by declaring fdct_r_row to be "volatile", > which forces the assembler to look at the memory location each time > instead. > > FWIW, I have also declared all these values "static", and removed the > duplicate declaration of ATTR_ALIGN. The file now compiles cleanly > with gcc3. |
From: Chris R. <ran...@ya...> - 2001-12-30 16:43:56
|
--- Miguel Freitas <mi...@ce...> wrote: > Thanks Chris, > > I will apply/test your patch and forward it to the > ffmpeg-devel list. OK, cheers. Of course, I should point out that now that I can compile it, I can also report that xine-cvs AVI playback is completely broken. My video window contained nothing but garbage, although the audio was OK. Chris __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com |