h264: use asm cabac reader under a generic condition
authorMans Rullgard <mans@mansr.com>
Fri, 22 Jun 2012 17:52:27 +0000 (18:52 +0100)
committerMans Rullgard <mans@mansr.com>
Sat, 23 Jun 2012 21:14:21 +0000 (22:14 +0100)
This removes a dependency on implementation details from generic
code and allows easy addition of the equivalent optimisation for
other architectures than x86.

Signed-off-by: Mans Rullgard <mans@mansr.com>
libavcodec/h264_cabac.c
libavcodec/x86/h264_i386.h

index 08a6a5b..2bf08b5 100644 (file)
@@ -1652,14 +1652,14 @@ decode_cabac_residual_internal(H264Context *h, DCTELEM *block,
             index[coeff_count++] = last;\
         }
         const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
-#if ARCH_X86 && HAVE_7REGS
-        coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index,
+#ifdef decode_significance
+        coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index,
                                                  last_coeff_ctx_base, sig_off);
     } else {
         if (is_dc && chroma422) { // dc 422
             DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]);
         } else {
-            coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index,
+            coeff_count = decode_significance(CC, max_coeff, significant_coeff_ctx_base, index,
                                                  last_coeff_ctx_base-significant_coeff_ctx_base);
         }
 #else
index 10ea32e..c0033b7 100644 (file)
@@ -37,6 +37,7 @@
 //FIXME use some macros to avoid duplicating get_cabac (cannot be done yet
 //as that would make optimization work hard)
 #if HAVE_7REGS
+#define decode_significance decode_significance_x86
 static int decode_significance_x86(CABACContext *c, int max_coeff,
                                    uint8_t *significant_coeff_ctx_base,
                                    int *index, x86_reg last_off){
@@ -105,6 +106,7 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
     return coeff_count;
 }
 
+#define decode_significance_8x8 decode_significance_8x8_x86
 static int decode_significance_8x8_x86(CABACContext *c,
                                        uint8_t *significant_coeff_ctx_base,
                                        int *index, uint8_t *last_coeff_ctx_base, const uint8_t *sig_off){