Commit 6d2b6f21 authored by Anton Khirnov's avatar Anton Khirnov

h264: add a parameter to the CABAC macro.

This way it does not look like a constant.
parent a6931d8e
...@@ -3932,7 +3932,7 @@ static int fill_filter_caches(H264Context *h, int mb_type) ...@@ -3932,7 +3932,7 @@ static int fill_filter_caches(H264Context *h, int mb_type)
/* CAVLC 8x8dct requires NNZ values for residual decoding that differ /* CAVLC 8x8dct requires NNZ values for residual decoding that differ
* from what the loop filter needs */ * 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)) { if (IS_8x8DCT(top_type)) {
nnz_cache[4 + 8 * 0] = nnz_cache[4 + 8 * 0] =
nnz_cache[5 + 8 * 0] = (h->cbp_table[top_xy] & 0x4000) >> 12; nnz_cache[5 + 8 * 0] = (h->cbp_table[top_xy] & 0x4000) >> 12;
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
#define FIELD_OR_MBAFF_PICTURE(h) (FRAME_MBAFF(h) || FIELD_PICTURE(h)) #define FIELD_OR_MBAFF_PICTURE(h) (FRAME_MBAFF(h) || FIELD_PICTURE(h))
#ifndef CABAC #ifndef CABAC
#define CABAC h->pps.cabac #define CABAC(h) h->pps.cabac
#endif #endif
#define CHROMA422 (h->sps.chroma_format_idc == 2) #define CHROMA422 (h->sps.chroma_format_idc == 2)
...@@ -884,7 +884,7 @@ static av_always_inline void write_back_motion_list(H264Context *h, ...@@ -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 + 1 * b_stride, mv_src + 8 * 1);
AV_COPY128(mv_dst + 2 * b_stride, mv_src + 8 * 2); AV_COPY128(mv_dst + 2 * b_stride, mv_src + 8 * 2);
AV_COPY128(mv_dst + 3 * b_stride, mv_src + 8 * 3); 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 uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8 * h->mb_xy
: h->mb2br_xy[h->mb_xy]]; : h->mb2br_xy[h->mb_xy]];
uint8_t(*mvd_src)[2] = &h->mvd_cache[list][scan8[0]]; 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) ...@@ -923,7 +923,7 @@ static av_always_inline void write_back_motion(H264Context *h, int mb_type)
if (USES_LIST(mb_type, 1)) if (USES_LIST(mb_type, 1))
write_back_motion_list(h, b_stride, b_xy, b8_xy, 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)) { if (IS_8X8(mb_type)) {
uint8_t *direct_table = &h->direct_table[4 * h->mb_xy]; uint8_t *direct_table = &h->direct_table[4 * h->mb_xy];
direct_table[1] = h->sub_mb_type[1] >> 1; direct_table[1] = h->sub_mb_type[1] >> 1;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* @author Michael Niedermayer <michaelni@gmx.at> * @author Michael Niedermayer <michaelni@gmx.at>
*/ */
#define CABAC 1 #define CABAC(h) 1
#include "config.h" #include "config.h"
#include "cabac.h" #include "cabac.h"
...@@ -2303,7 +2303,7 @@ decode_intra_mb: ...@@ -2303,7 +2303,7 @@ decode_intra_mb:
} }
} }
if (h->top_type && !IS_8x8DCT(h->top_type)){ 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* 0], top_empty);
AV_WN32A(&nnz_cache[4+8* 5], top_empty); AV_WN32A(&nnz_cache[4+8* 5], top_empty);
AV_WN32A(&nnz_cache[4+8*10], top_empty); AV_WN32A(&nnz_cache[4+8*10], top_empty);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
* @author Michael Niedermayer <michaelni@gmx.at> * @author Michael Niedermayer <michaelni@gmx.at>
*/ */
#define CABAC 0 #define CABAC(h) 0
#include "internal.h" #include "internal.h"
#include "avcodec.h" #include "avcodec.h"
......
...@@ -500,7 +500,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u ...@@ -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])) { if (IS_INTRA(mb_type | h->cur_pic.mb_type[mbn_xy])) {
AV_WN64A(bS, 0x0003000300030003ULL); AV_WN64A(bS, 0x0003000300030003ULL);
} else { } 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[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[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]); bS[2]= 1+((h->cbp_table[mbn_xy] & 0x8000)||h->non_zero_count_cache[scan8[0]+2]);
......
...@@ -545,7 +545,7 @@ static void fill_decode_caches(H264Context *h, int mb_type) ...@@ -545,7 +545,7 @@ static void fill_decode_caches(H264Context *h, int mb_type)
AV_COPY32(&nnz_cache[4 + 8 * 10], &nnz[4 * 9]); AV_COPY32(&nnz_cache[4 + 8 * 10], &nnz[4 * 9]);
} }
} else { } 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 * 0], top_empty);
AV_WN32A(&nnz_cache[4 + 8 * 5], top_empty); AV_WN32A(&nnz_cache[4 + 8 * 5], top_empty);
AV_WN32A(&nnz_cache[4 + 8 * 10], 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) ...@@ -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 * 6 + 2 * 8 * i] =
nnz_cache[3 + 8 * 7 + 2 * 8 * i] = nnz_cache[3 + 8 * 7 + 2 * 8 * i] =
nnz_cache[3 + 8 * 11 + 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 // top_cbp
if (top_type) if (top_type)
h->top_cbp = h->cbp_table[top_xy]; h->top_cbp = h->cbp_table[top_xy];
...@@ -689,7 +689,7 @@ static void fill_decode_caches(H264Context *h, int mb_type) ...@@ -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 * 0]);
AV_ZERO32(mv_cache[2 + 8 * 2]); AV_ZERO32(mv_cache[2 + 8 * 2]);
if (CABAC) { if (CABAC(h)) {
if (USES_LIST(top_type, list)) { if (USES_LIST(top_type, list)) {
const int b_xy = h->mb2br_xy[top_xy]; const int b_xy = h->mb2br_xy[top_xy];
AV_COPY64(mvd_cache[0 - 1 * 8], mvd[b_xy + 0]); AV_COPY64(mvd_cache[0 - 1 * 8], mvd[b_xy + 0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment