Commit 7dff133f4e for ffmpeg

commit 7dff133f4ee8f24ce48afa71ccdb055493fd02f3
Author: Ramiro Polla <ramiro.polla@gmail.com>
Date:   Mon Nov 2 01:14:12 2026 +0100

    avcodec/x86/cabac: use the x86-64 version of get_cabac on non-PIC builds too

    The x86-64 version of the get_cabac inline asm keeps the address of the
    tables in a register. It was only used on PIC builds, where the tables
    can only be addressed relative to the instruction pointer, which can't
    be combined with an index register. Non-PIC x86-64 builds used the
    x86-32 version, which uses absolute addresses for the tables.

    With the previous changes, the x86-64 version is faster on non-PIC
    builds as well, so use it on all x86-64 builds.

    Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
    Signed-off-by: Ramiro Polla <ramiro.polla@gmail.com>

diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h
index 8d54d2ad40..36a534cb78 100644
--- a/libavcodec/x86/cabac.h
+++ b/libavcodec/x86/cabac.h
@@ -49,7 +49,7 @@
         "jge    1f                                                      \n\t"
 #endif

-#ifdef BROKEN_RELOCATIONS
+#if ARCH_X86_64
 #define TABLES_ARG , [tables]"r"(tables)
 #define CABAC_TMP_DECL int cabac_t1, cabac_t2;
 #define CABAC_TMP_OPERANDS , [cabac_t1]"=&r"(cabac_t1), [cabac_t2]"=&r"(cabac_t2)
@@ -116,7 +116,7 @@
         BRANCHLESS_GET_CABAC_REFILL(low, tmp, norm_off, tables)              \
         "2:                                                             \n\t"

-#else /* BROKEN_RELOCATIONS */
+#else /* ARCH_X86_64 */
 #define CABAC_TMP_DECL
 #define CABAC_TMP_OPERANDS
 #define TABLES_ARG NAMED_CONSTRAINTS_ARRAY_ADD(ff_h264_cabac_tables)
@@ -198,7 +198,7 @@
         BRANCHLESS_GET_CABAC_REFILL(low, tmp, norm_off, tables)              \
         "2:                                                             \n\t"

-#endif /* BROKEN_RELOCATIONS */
+#endif /* ARCH_X86_64 */

 #if HAVE_X86_7REGS && !BROKEN_COMPILER
 #define get_cabac_inline get_cabac_inline_x86
@@ -212,7 +212,7 @@ int get_cabac_inline_x86(CABACContext *c, uint8_t *const state)
 {
     int bit, tmp;
     CABAC_TMP_DECL
-#ifdef BROKEN_RELOCATIONS
+#if ARCH_X86_64
     void *tables;

     __asm__(
diff --git a/libavcodec/x86/h264_cabac.c b/libavcodec/x86/h264_cabac.c
index d0a4541083..734879dbd6 100644
--- a/libavcodec/x86/h264_cabac.c
+++ b/libavcodec/x86/h264_cabac.c
@@ -53,7 +53,7 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
     x86_reg coeff_count;
     CABAC_TMP_DECL

-#ifdef BROKEN_RELOCATIONS
+#if ARCH_X86_64
     void *tables;

     __asm__(
@@ -133,7 +133,7 @@ static int decode_significance_8x8_x86(CABACContext *c,
     x86_reg state;
     CABAC_TMP_DECL

-#ifdef BROKEN_RELOCATIONS
+#if ARCH_X86_64
     void *tables;

     __asm__(
@@ -164,7 +164,7 @@ static int decode_significance_8x8_x86(CABACContext *c,
         "test $1, %[bit]                        \n\t"
         " jz 4f                                 \n\t"

-#ifdef BROKEN_RELOCATIONS
+#if ARCH_X86_64
         "movzb %c[lastoff](%[tables], %q[state]), %[state]\n\t"
 #else
         "movzb "MANGLE(ff_h264_cabac_tables)"+%c[lastoff](%[state]), %[state]\n\t"