1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

h264: add a parameter to the CABAC macro.

This way it does not look like a constant.
This commit is contained in:
Anton Khirnov 2013-03-09 20:37:11 +01:00
parent a6931d8ece
commit 6d2b6f21eb
6 changed files with 12 additions and 12 deletions

View File

@ -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;

View File

@ -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;

View File

@ -25,7 +25,7 @@
* @author Michael Niedermayer <michaelni@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);

View File

@ -25,7 +25,7 @@
* @author Michael Niedermayer <michaelni@gmx.at>
*/
#define CABAC 0
#define CABAC(h) 0
#include "internal.h"
#include "avcodec.h"

View File

@ -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]);

View File

@ -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]);