comparison dsputil.c @ 4281:de525a2b41db libavcodec

ff_check_alignment to warn the user about a missaligned stack
author michael
date Thu, 07 Dec 2006 18:33:00 +0000
parents e880555ad2c6
children 9d64f6eacc7b
comparison
equal deleted inserted replaced
4280:57dc5aabf8c0 4281:de525a2b41db
3799 } 3799 }
3800 3800
3801 for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1; 3801 for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1;
3802 } 3802 }
3803 3803
3804 int ff_check_alignment(void){
3805 static int did_fail=0;
3806 DECLARE_ALIGNED_16(int, aligned);
3807
3808 if((int)&aligned & 15){
3809 if(!did_fail){
3810 #if defined(HAVE_MMX) || defined(HAVE_ALTIVEC)
3811 av_log(NULL, AV_LOG_ERROR,
3812 "Compiler did not align stack variables, your code has been misscompiled\n"
3813 "and may crash, this is not a bug in the application but in the compiler\n"
3814 "so reporting it anywhere but to the compiler maintainers is senseless!\n");
3815 #endif
3816 did_fail=1;
3817 }
3818 return -1;
3819 }
3820 return 0;
3821 }
3804 3822
3805 void dsputil_init(DSPContext* c, AVCodecContext *avctx) 3823 void dsputil_init(DSPContext* c, AVCodecContext *avctx)
3806 { 3824 {
3807 int i; 3825 int i;
3826
3827 ff_check_alignment();
3808 3828
3809 #ifdef CONFIG_ENCODERS 3829 #ifdef CONFIG_ENCODERS
3810 if(avctx->dct_algo==FF_DCT_FASTINT) { 3830 if(avctx->dct_algo==FF_DCT_FASTINT) {
3811 c->fdct = fdct_ifast; 3831 c->fdct = fdct_ifast;
3812 c->fdct248 = fdct_ifast248; 3832 c->fdct248 = fdct_ifast248;