Mercurial > libavcodec.hg
comparison cabac.h @ 4882:8131ccb4ea72 libavcodec
Mark code parts that cannot work on AMD64 due to broken relocations as such.
This allows building shared libraries on AMD64 again.
based on a patch by Diego 'Flameeyes' Petten and suggestions by Michael
original thread:
Date: Wed, 18 Apr 2007 11:26:12 +0200
Subject: [Ffmpeg-devel] [PATCH] (try 2) Build shared libraries on AMD64 again
author | diego |
---|---|
date | Fri, 27 Apr 2007 09:32:31 +0000 |
parents | fb8cbb18b2b4 |
children | 777f250df232 |
comparison
equal
deleted
inserted
replaced
4881:fb8cbb18b2b4 | 4882:8131ccb4ea72 |
---|---|
374 #else | 374 #else |
375 #define BYTESTART "12" | 375 #define BYTESTART "12" |
376 #define BYTE "16" | 376 #define BYTE "16" |
377 #define BYTEEND "20" | 377 #define BYTEEND "20" |
378 #endif | 378 #endif |
379 #if defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(HAVE_EBX_AVAILABLE) | 379 #if defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) |
380 int bit; | 380 int bit; |
381 | 381 |
382 #ifndef BRANCHLESS_CABAC_DECODER | 382 #ifndef BRANCHLESS_CABAC_DECODER |
383 asm volatile( | 383 asm volatile( |
384 "movzbl (%1), %0 \n\t" | 384 "movzbl (%1), %0 \n\t" |
530 :"r"(state), "r"(c) | 530 :"r"(state), "r"(c) |
531 : "%"REG_c, "%ebx", "%edx", "%esi", "memory" | 531 : "%"REG_c, "%ebx", "%edx", "%esi", "memory" |
532 ); | 532 ); |
533 bit&=1; | 533 bit&=1; |
534 #endif /* BRANCHLESS_CABAC_DECODER */ | 534 #endif /* BRANCHLESS_CABAC_DECODER */ |
535 #else /* defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(HAVE_EBX_AVAILABLE) */ | 535 #else /* defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) */ |
536 int s = *state; | 536 int s = *state; |
537 int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + s]; | 537 int RangeLPS= ff_h264_lps_range[2*(c->range&0xC0) + s]; |
538 int bit, lps_mask attribute_unused; | 538 int bit, lps_mask attribute_unused; |
539 | 539 |
540 c->range -= RangeLPS; | 540 c->range -= RangeLPS; |
569 c->range<<= lps_mask; | 569 c->range<<= lps_mask; |
570 c->low <<= lps_mask; | 570 c->low <<= lps_mask; |
571 if(!(c->low & CABAC_MASK)) | 571 if(!(c->low & CABAC_MASK)) |
572 refill2(c); | 572 refill2(c); |
573 #endif /* BRANCHLESS_CABAC_DECODER */ | 573 #endif /* BRANCHLESS_CABAC_DECODER */ |
574 #endif /* defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(HAVE_EBX_AVAILABLE) */ | 574 #endif /* defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) */ |
575 return bit; | 575 return bit; |
576 } | 576 } |
577 | 577 |
578 static int av_noinline get_cabac_noinline(CABACContext *c, uint8_t * const state){ | 578 static int av_noinline get_cabac_noinline(CABACContext *c, uint8_t * const state){ |
579 return get_cabac_inline(c,state); | 579 return get_cabac_inline(c,state); |
678 #endif | 678 #endif |
679 } | 679 } |
680 | 680 |
681 //FIXME the x86 code from this file should be moved into i386/h264 or cabac something.c/h (note ill kill you if you move my code away from under my fingers before iam finished with it!) | 681 //FIXME the x86 code from this file should be moved into i386/h264 or cabac something.c/h (note ill kill you if you move my code away from under my fingers before iam finished with it!) |
682 //FIXME use some macros to avoid duplicatin get_cabac (cant be done yet as that would make optimization work hard) | 682 //FIXME use some macros to avoid duplicatin get_cabac (cant be done yet as that would make optimization work hard) |
683 #if defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(HAVE_EBX_AVAILABLE) | 683 #if defined(ARCH_X86) && defined(CONFIG_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) |
684 static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){ | 684 static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){ |
685 void *end= significant_coeff_ctx_base + max_coeff - 1; | 685 void *end= significant_coeff_ctx_base + max_coeff - 1; |
686 int minusstart= -(int)significant_coeff_ctx_base; | 686 int minusstart= -(int)significant_coeff_ctx_base; |
687 int minusindex= 4-(int)index; | 687 int minusindex= 4-(int)index; |
688 int coeff_count; | 688 int coeff_count; |
784 :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off)\ | 784 :"r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base), "m"(sig_off)\ |
785 : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory"\ | 785 : "%"REG_c, "%ebx", "%edx", "%esi", "%"REG_D, "memory"\ |
786 ); | 786 ); |
787 return coeff_count; | 787 return coeff_count; |
788 } | 788 } |
789 #endif /* defined(ARCH_X86) && && defined(CONFIG_7REGS) && defined(HAVE_EBX_AVAILABLE) */ | 789 #endif /* defined(ARCH_X86) && && defined(CONFIG_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) */ |
790 | 790 |
791 /** | 791 /** |
792 * | 792 * |
793 * @return the number of bytes read or 0 if no end | 793 * @return the number of bytes read or 0 if no end |
794 */ | 794 */ |