[FFmpeg-cvslog] h264: add a parameter to the CABAC macro.

Anton Khirnov git at videolan.org
Thu Mar 21 13:02:56 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Mar  9 20:37:11 2013 +0100| [6d2b6f21eb45ffbda1103c772060303648714832] | committer: Anton Khirnov

h264: add a parameter to the CABAC macro.

This way it does not look like a constant.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6d2b6f21eb45ffbda1103c772060303648714832
---

 libavcodec/h264.c            |    2 +-
 libavcodec/h264.h            |    6 +++---
 libavcodec/h264_cabac.c      |    4 ++--
 libavcodec/h264_cavlc.c      |    2 +-
 libavcodec/h264_loopfilter.c |    2 +-
 libavcodec/h264_mvpred.h     |    8 ++++----
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index c81ba5e..c350f49 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3932,7 +3932,7 @@ static int fill_filter_caches(H264Context *h, int mb_type)
 
     /* CAVLC 8x8dct requires NNZ values for residual decoding that differ
      * from what the loop filter needs */
-    if (!CABAC && h->pps.transform_8x8_mode) {
+    if (!CABAC(h) && h->pps.transform_8x8_mode) {
         if (IS_8x8DCT(top_type)) {
             nnz_cache[4 + 8 * 0]     =
                 nnz_cache[5 + 8 * 0] = (h->cbp_table[top_xy] & 0x4000) >> 12;
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 7218cb7..1ea788d 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -82,7 +82,7 @@
 #define FIELD_OR_MBAFF_PICTURE(h) (FRAME_MBAFF(h) || FIELD_PICTURE(h))
 
 #ifndef CABAC
-#define CABAC h->pps.cabac
+#define CABAC(h) h->pps.cabac
 #endif
 
 #define CHROMA422 (h->sps.chroma_format_idc == 2)
@@ -884,7 +884,7 @@ static av_always_inline void write_back_motion_list(H264Context *h,
     AV_COPY128(mv_dst + 1 * b_stride, mv_src + 8 * 1);
     AV_COPY128(mv_dst + 2 * b_stride, mv_src + 8 * 2);
     AV_COPY128(mv_dst + 3 * b_stride, mv_src + 8 * 3);
-    if (CABAC) {
+    if (CABAC(h)) {
         uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8 * h->mb_xy
                                                         : h->mb2br_xy[h->mb_xy]];
         uint8_t(*mvd_src)[2]  = &h->mvd_cache[list][scan8[0]];
@@ -923,7 +923,7 @@ static av_always_inline void write_back_motion(H264Context *h, int mb_type)
     if (USES_LIST(mb_type, 1))
         write_back_motion_list(h, b_stride, b_xy, b8_xy, mb_type, 1);
 
-    if (h->slice_type_nos == AV_PICTURE_TYPE_B && CABAC) {
+    if (h->slice_type_nos == AV_PICTURE_TYPE_B && CABAC(h)) {
         if (IS_8X8(mb_type)) {
             uint8_t *direct_table = &h->direct_table[4 * h->mb_xy];
             direct_table[1] = h->sub_mb_type[1] >> 1;
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index 8cd60dc..ece7bbc 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -25,7 +25,7 @@
  * @author Michael Niedermayer <michaelni at gmx.at>
  */
 
-#define CABAC 1
+#define CABAC(h) 1
 
 #include "config.h"
 #include "cabac.h"
@@ -2303,7 +2303,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);
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index b18c54e..4f46373 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -25,7 +25,7 @@
  * @author Michael Niedermayer <michaelni at gmx.at>
  */
 
-#define CABAC 0
+#define CABAC(h) 0
 
 #include "internal.h"
 #include "avcodec.h"
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index bd1cf9c..7b52236 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -500,7 +500,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
                 if (IS_INTRA(mb_type | h->cur_pic.mb_type[mbn_xy])) {
                     AV_WN64A(bS, 0x0003000300030003ULL);
                 } else {
-                    if (!CABAC && IS_8x8DCT(h->cur_pic.mb_type[mbn_xy])) {
+                    if (!CABAC(h) && IS_8x8DCT(h->cur_pic.mb_type[mbn_xy])) {
                         bS[0]= 1+((h->cbp_table[mbn_xy] & 0x4000)||h->non_zero_count_cache[scan8[0]+0]);
                         bS[1]= 1+((h->cbp_table[mbn_xy] & 0x4000)||h->non_zero_count_cache[scan8[0]+1]);
                         bS[2]= 1+((h->cbp_table[mbn_xy] & 0x8000)||h->non_zero_count_cache[scan8[0]+2]);
diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h
index e87340c..1fb56f5 100644
--- a/libavcodec/h264_mvpred.h
+++ b/libavcodec/h264_mvpred.h
@@ -545,7 +545,7 @@ static void fill_decode_caches(H264Context *h, int mb_type)
                 AV_COPY32(&nnz_cache[4 + 8 * 10], &nnz[4 * 9]);
             }
         } else {
-            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);
@@ -576,11 +576,11 @@ static void fill_decode_caches(H264Context *h, int mb_type)
                 nnz_cache[3 + 8 *  6 + 2 * 8 * i] =
                 nnz_cache[3 + 8 *  7 + 2 * 8 * i] =
                 nnz_cache[3 + 8 * 11 + 2 * 8 * i] =
-                nnz_cache[3 + 8 * 12 + 2 * 8 * i] = CABAC && !IS_INTRA(mb_type) ? 0 : 64;
+                nnz_cache[3 + 8 * 12 + 2 * 8 * i] = CABAC(h) && !IS_INTRA(mb_type) ? 0 : 64;
             }
         }
 
-        if (CABAC) {
+        if (CABAC(h)) {
             // top_cbp
             if (top_type)
                 h->top_cbp = h->cbp_table[top_xy];
@@ -689,7 +689,7 @@ static void fill_decode_caches(H264Context *h, int mb_type)
                 AV_ZERO32(mv_cache[2 + 8 * 0]);
                 AV_ZERO32(mv_cache[2 + 8 * 2]);
 
-                if (CABAC) {
+                if (CABAC(h)) {
                     if (USES_LIST(top_type, list)) {
                         const int b_xy = h->mb2br_xy[top_xy];
                         AV_COPY64(mvd_cache[0 - 1 * 8], mvd[b_xy + 0]);



More information about the ffmpeg-cvslog mailing list