]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264_cabac.c
configure: Don't pass MSVC compiler options -M[TD] to armasm
[ffmpeg] / libavcodec / h264_cabac.c
index 258e9ee7e6de9f5aaa76f319592b137530b6fed7..f1ab97a1445bf5833fd59993fd7680b7ed47a097 100644 (file)
  * @author Michael Niedermayer <michaelni@gmx.at>
  */
 
-#define CABAC 1
+#define CABAC(h) 1
 
+#include "libavutil/attributes.h"
+#include "libavutil/timer.h"
 #include "config.h"
 #include "cabac.h"
 #include "cabac_functions.h"
 #include "h264data.h"
 #include "h264_mvpred.h"
 #include "golomb.h"
+#include "mpegutils.h"
 
 #if ARCH_X86
 #include "x86/h264_i386.h"
 #endif
 
-//#undef NDEBUG
 #include <assert.h>
 
 /* Cabac pre state table */
@@ -1341,7 +1343,7 @@ static int decode_cabac_mb_skip( H264Context *h, int mb_x, int mb_y ) {
     }else{
         int mb_xy = h->mb_xy;
         mba_xy = mb_xy - 1;
-        mbb_xy = mb_xy - (h->mb_stride << FIELD_PICTURE);
+        mbb_xy = mb_xy - (h->mb_stride << FIELD_PICTURE(h));
     }
 
     if( h->slice_table[mba_xy] == h->slice_num && !IS_SKIP(h->cur_pic.mb_type[mba_xy] ))
@@ -1741,26 +1743,30 @@ decode_cabac_residual_internal(H264Context *h, int16_t *block,
 
 }
 
-static void decode_cabac_residual_dc_internal(H264Context *h, int16_t *block,
-                                              int cat, int n,
-                                              const uint8_t *scantable,
-                                              int max_coeff)
+static av_noinline void decode_cabac_residual_dc_internal(H264Context *h,
+                                                          int16_t *block,
+                                                          int cat, int n,
+                                                          const uint8_t *scantable,
+                                                          int max_coeff)
 {
     decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1, 0);
 }
 
-static void decode_cabac_residual_dc_internal_422(H264Context *h, int16_t *block,
-                                                  int cat, int n, const uint8_t *scantable,
-                                                  int max_coeff)
+static av_noinline void decode_cabac_residual_dc_internal_422(H264Context *h,
+                                                              int16_t *block,
+                                                              int cat, int n,
+                                                              const uint8_t *scantable,
+                                                              int max_coeff)
 {
     decode_cabac_residual_internal(h, block, cat, n, scantable, NULL, max_coeff, 1, 1);
 }
 
-static void decode_cabac_residual_nondc_internal(H264Context *h, int16_t *block,
-                                                 int cat, int n,
-                                                 const uint8_t *scantable,
-                                                 const uint32_t *qmul,
-                                                 int max_coeff)
+static av_noinline void decode_cabac_residual_nondc_internal(H264Context *h,
+                                                             int16_t *block,
+                                                             int cat, int n,
+                                                             const uint8_t *scantable,
+                                                             const uint32_t *qmul,
+                                                             int max_coeff)
 {
     decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 0, 0);
 }
@@ -1812,7 +1818,7 @@ static av_always_inline void decode_cabac_residual_nondc(H264Context *h,
                                                          int max_coeff)
 {
     /* read coded block flag */
-    if( (cat != 5 || CHROMA444) && get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 0 ) ] ) == 0 ) {
+    if( (cat != 5 || CHROMA444(h)) && get_cabac( &h->cabac, &h->cabac_state[get_cabac_cbf_ctx( h, cat, n, max_coeff, 0 ) ] ) == 0 ) {
         if( max_coeff == 64 ) {
             fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, 0, 1);
         } else {
@@ -2289,7 +2295,7 @@ decode_intra_mb:
 
     /* It would be better to do this in fill_decode_caches, but we don't know
      * the transform mode of the current macroblock there. */
-    if (CHROMA444 && IS_8x8DCT(mb_type)){
+    if (CHROMA444(h) && IS_8x8DCT(mb_type)){
         int i;
         uint8_t *nnz_cache = h->non_zero_count_cache;
         for (i = 0; i < 2; i++){
@@ -2303,7 +2309,7 @@ decode_intra_mb:
             }
         }
         if (h->top_type && !IS_8x8DCT(h->top_type)){
-            uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040;
+            uint32_t top_empty = CABAC(h) && !IS_INTRA(mb_type) ? 0 : 0x40404040;
             AV_WN32A(&nnz_cache[4+8* 0], top_empty);
             AV_WN32A(&nnz_cache[4+8* 5], top_empty);
             AV_WN32A(&nnz_cache[4+8*10], top_empty);
@@ -2354,10 +2360,10 @@ decode_intra_mb:
             h->last_qscale_diff=0;
 
         decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 0);
-        if(CHROMA444){
+        if (CHROMA444(h)) {
             decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 1);
             decode_cabac_luma_residual(h, scan, scan8x8, pixel_shift, mb_type, cbp, 2);
-        } else if (CHROMA422) {
+        } else if (CHROMA422(h)) {
             if( cbp&0x30 ){
                 int c;
                 for (c = 0; c < 2; c++)