From d5cd50ed73dc70707c24a9ae06bb8b77c68f5e67 Mon Sep 17 00:00:00 2001
From: Diego Biurrun <diego@biurrun.de>
Date: Sun, 29 Oct 2006 13:14:37 +0000
Subject: [PATCH] Fix compilation with PIC enabled, BRANCHLESS_GET_CABAC is
 defined under !PIC but gets used without a check for !PIC.

Originally committed as revision 6834 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/cabac.h | 4 ++--
 libavcodec/h264.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h
index 9ff2b90763b..9593789e105 100644
--- a/libavcodec/cabac.h
+++ b/libavcodec/cabac.h
@@ -683,7 +683,7 @@ static always_inline int get_cabac_bypass_sign(CABACContext *c, int val){
 
 //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!)
 //FIXME use some macros to avoid duplicatin get_cabac (cant be done yet as that would make optimization work hard)
-#ifdef ARCH_X86
+#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__))
 static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, int *index){
     void *end= significant_coeff_ctx_base + max_coeff - 1;
     int minusstart= -(int)significant_coeff_ctx_base;
@@ -789,7 +789,7 @@ static int decode_significance_8x8_x86(CABACContext *c, uint8_t *significant_coe
     );
     return coeff_count;
 }
-#endif
+#endif /* defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__)) */
 
 /**
  *
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 865e80ac395..440c254bf2e 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -6139,7 +6139,7 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n
             index[coeff_count++] = last;\
         }
         const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
-#ifdef ARCH_X86
+#if defined(ARCH_X86) && !(defined(PIC) && defined(__GNUC__))
         coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index, sig_off);
     } else {
         coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index);
-- 
GitLab