From 82313eaa34b02cf1a4b6f55c1b73549ec8d056f0 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 9 Mar 2013 20:37:11 +0100 Subject: [PATCH] h264: add a parameter to the MB_MBAFF macro. This way it does not look like a constant. --- libavcodec/h264.c | 16 ++++++++-------- libavcodec/h264.h | 4 ++-- libavcodec/h264_cabac.c | 8 ++++---- libavcodec/h264_cavlc.c | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 086737f843..c3618a83e8 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -748,7 +748,7 @@ static void await_references(H264Context *h) int ref_field_picture = ref_pic->field_picture; int pic_height = 16 * h->mb_height >> ref_field_picture; - row <<= MB_MBAFF; + row <<= MB_MBAFF(h); nrefs[list]--; if (!FIELD_PICTURE && ref_field_picture) { // frame referencing two fields @@ -2050,7 +2050,7 @@ static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y, if (!simple && FRAME_MBAFF) { if (h->mb_y & 1) { - if (!MB_MBAFF) { + if (!MB_MBAFF(h)) { top_border = h->top_borders[0][h->mb_x]; AV_COPY128(top_border, src_y + 15 * linesize); if (pixel_shift) @@ -2085,7 +2085,7 @@ static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y, } } } - } else if (MB_MBAFF) { + } else if (MB_MBAFF(h)) { top_idx = 0; } else return; @@ -2143,10 +2143,10 @@ static av_always_inline void xchg_mb_border(H264Context *h, uint8_t *src_y, if (!simple && FRAME_MBAFF) { if (h->mb_y & 1) { - if (!MB_MBAFF) + if (!MB_MBAFF(h)) return; } else { - top_idx = MB_MBAFF ? 0 : 1; + top_idx = MB_MBAFF(h) ? 0 : 1; } } @@ -3759,7 +3759,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h, if (USES_LIST(top_type, list)) { const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride; const int b8_xy = 4 * top_xy + 2; - int (*ref2frm)[64] = h->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2); + int (*ref2frm)[64] = h->ref2frm[h->slice_table[top_xy] & (MAX_SLICES - 1)][0] + (MB_MBAFF(h) ? 20 : 2); AV_COPY128(mv_dst - 1 * 8, h->cur_pic.motion_val[list][b_xy + 0]); ref_cache[0 - 1 * 8] = ref_cache[1 - 1 * 8] = ref2frm[list][h->cur_pic.ref_index[list][b8_xy + 0]]; @@ -3774,7 +3774,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h, if (USES_LIST(left_type[LTOP], list)) { const int b_xy = h->mb2b_xy[left_xy[LTOP]] + 3; const int b8_xy = 4 * left_xy[LTOP] + 1; - int (*ref2frm)[64] = h->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2); + int (*ref2frm)[64] = h->ref2frm[h->slice_table[left_xy[LTOP]] & (MAX_SLICES - 1)][0] + (MB_MBAFF(h) ? 20 : 2); AV_COPY32(mv_dst - 1 + 0, h->cur_pic.motion_val[list][b_xy + b_stride * 0]); AV_COPY32(mv_dst - 1 + 8, h->cur_pic.motion_val[list][b_xy + b_stride * 1]); AV_COPY32(mv_dst - 1 + 16, h->cur_pic.motion_val[list][b_xy + b_stride * 2]); @@ -3807,7 +3807,7 @@ static av_always_inline void fill_filter_caches_inter(H264Context *h, { int8_t *ref = &h->cur_pic.ref_index[list][4 * mb_xy]; - int (*ref2frm)[64] = h->ref2frm[h->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF ? 20 : 2); + int (*ref2frm)[64] = h->ref2frm[h->slice_num & (MAX_SLICES - 1)][0] + (MB_MBAFF(h) ? 20 : 2); uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]], ref2frm[list][ref[1]]) & 0x00FF00FF) * 0x0101; uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]], ref2frm[list][ref[3]]) & 0x00FF00FF) * 0x0101; AV_WN32A(&ref_cache[0 * 8], ref01); diff --git a/libavcodec/h264.h b/libavcodec/h264.h index 3482d897aa..1da1922188 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -59,7 +59,7 @@ #define MAX_SLICES 16 #ifdef ALLOW_INTERLACE -#define MB_MBAFF h->mb_mbaff +#define MB_MBAFF(h) h->mb_mbaff #define MB_FIELD h->mb_field_decoding_flag #define FRAME_MBAFF h->mb_aff_frame #define FIELD_PICTURE (h->picture_structure != PICT_FRAME) @@ -68,7 +68,7 @@ #define LBOT 1 #define LEFT(i) (i) #else -#define MB_MBAFF 0 +#define MB_MBAFF(h) 0 #define MB_FIELD 0 #define FRAME_MBAFF 0 #define FIELD_PICTURE 0 diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c index 12eb2c7b22..5d793ad2b2 100644 --- a/libavcodec/h264_cabac.c +++ b/libavcodec/h264_cabac.c @@ -2088,7 +2088,7 @@ decode_intra_mb: for( i = 0; i < 4; i++ ) { if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ - int rc = h->ref_count[list] << MB_MBAFF; + int rc = h->ref_count[list] << MB_MBAFF(h); if (rc > 1) { ref[list][i] = decode_cabac_mb_ref( h, list, 4*i ); if (ref[list][i] >= (unsigned) rc) { @@ -2174,7 +2174,7 @@ decode_intra_mb: if(IS_16X16(mb_type)){ for(list=0; listlist_count; list++){ if(IS_DIR(mb_type, 0, list)){ - int ref, rc = h->ref_count[list] << MB_MBAFF; + int ref, rc = h->ref_count[list] << MB_MBAFF(h); if (rc > 1) { ref= decode_cabac_mb_ref(h, list, 0); if (ref >= (unsigned) rc) { @@ -2202,7 +2202,7 @@ decode_intra_mb: for(list=0; listlist_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ - int ref, rc = h->ref_count[list] << MB_MBAFF; + int ref, rc = h->ref_count[list] << MB_MBAFF(h); if (rc > 1) { ref= decode_cabac_mb_ref( h, list, 8*i ); if (ref >= (unsigned) rc) { @@ -2237,7 +2237,7 @@ decode_intra_mb: for(list=0; listlist_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ //FIXME optimize - int ref, rc = h->ref_count[list] << MB_MBAFF; + int ref, rc = h->ref_count[list] << MB_MBAFF(h); if (rc > 1) { ref= decode_cabac_mb_ref( h, list, 4*i ); if (ref >= (unsigned) rc) { diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index be7d2e9698..424165fece 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -856,7 +856,7 @@ decode_intra_mb: } for(list=0; listlist_count; list++){ - int ref_count = IS_REF0(mb_type) ? 1 : h->ref_count[list] << MB_MBAFF; + int ref_count = IS_REF0(mb_type) ? 1 : h->ref_count[list] << MB_MBAFF(h); for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ @@ -936,7 +936,7 @@ decode_intra_mb: for(list=0; listlist_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ - int rc = h->ref_count[list] << MB_MBAFF; + int rc = h->ref_count[list] << MB_MBAFF(h); if (rc == 1) { val= 0; } else if (rc == 2) { @@ -967,7 +967,7 @@ decode_intra_mb: for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ - int rc = h->ref_count[list] << MB_MBAFF; + int rc = h->ref_count[list] << MB_MBAFF(h); if (rc == 1) { val= 0; } else if (rc == 2) { @@ -1005,7 +1005,7 @@ decode_intra_mb: for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ //FIXME optimize - int rc = h->ref_count[list] << MB_MBAFF; + int rc = h->ref_count[list] << MB_MBAFF(h); if (rc == 1) { val= 0; } else if (rc == 2) {