This way it does not look like a constant.
fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1);
fill_rectangle(h->mv_cache[0][scan8[0]], 4, 4, 8,
pack16to32((*mv)[0][0][0], (*mv)[0][0][1]), 4);
- assert(!FRAME_MBAFF);
+ assert(!FRAME_MBAFF(h));
ff_h264_hl_decode_mb(h);
}
src_cb -= uvlinesize;
src_cr -= uvlinesize;
- if (!simple && FRAME_MBAFF) {
+ if (!simple && FRAME_MBAFF(h)) {
if (h->mb_y & 1) {
if (!MB_MBAFF(h)) {
top_border = h->top_borders[0][h->mb_x];
uint8_t *top_border_m1;
uint8_t *top_border;
- if (!simple && FRAME_MBAFF) {
+ if (!simple && FRAME_MBAFF(h)) {
if (h->mb_y & 1) {
if (!MB_MBAFF(h))
return;
} else {
cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure - 1];
}
- if (h->ref_count[0] == 1 && h->ref_count[1] == 1 && !FRAME_MBAFF &&
+ if (h->ref_count[0] == 1 && h->ref_count[1] == 1 && !FRAME_MBAFF(h) &&
h->ref_list[0][0].poc + h->ref_list[1][0].poc == 2 * cur_poc) {
h->use_weight = 0;
h->use_weight_chroma = 0;
(h->avctx->err_recognition & AV_EF_EXPLODE))
return AVERROR_INVALIDDATA;
- if (FRAME_MBAFF) {
+ if (FRAME_MBAFF(h)) {
ff_h264_fill_mbaff_ref_list(h);
if (h->pps.weighted_bipred_idc == 2 && h->slice_type_nos == AV_PICTURE_TYPE_B) {
* stuff, I can't imagine that these complex rules are worth it. */
left_xy[LBOT] = left_xy[LTOP] = mb_xy - 1;
- if (FRAME_MBAFF) {
+ if (FRAME_MBAFF(h)) {
const int left_mb_field_flag = IS_INTERLACED(h->cur_pic.mb_type[mb_xy - 1]);
const int curr_mb_field_flag = IS_INTERLACED(mb_type);
if (h->mb_y & 1) {
((qp + h->cur_pic.qscale_table[left_xy[LTOP]] + 1) >> 1) <= qp_thresh) &&
(top_xy < 0 ||
((qp + h->cur_pic.qscale_table[top_xy] + 1) >> 1) <= qp_thresh)) {
- if (!FRAME_MBAFF)
+ if (!FRAME_MBAFF(h))
return 1;
if ((left_xy[LTOP] < 0 ||
((qp + h->cur_pic.qscale_table[left_xy[LBOT]] + 1) >> 1) <= qp_thresh) &&
{
uint8_t *dest_y, *dest_cb, *dest_cr;
int linesize, uvlinesize, mb_x, mb_y;
- const int end_mb_y = h->mb_y + FRAME_MBAFF;
+ const int end_mb_y = h->mb_y + FRAME_MBAFF(h);
const int old_slice_type = h->slice_type;
const int pixel_shift = h->pixel_shift;
const int block_h = 16 >> h->chroma_y_shift;
if (h->deblocking_filter) {
for (mb_x = start_x; mb_x < end_x; mb_x++)
- for (mb_y = end_mb_y - FRAME_MBAFF; mb_y <= end_mb_y; mb_y++) {
+ for (mb_y = end_mb_y - FRAME_MBAFF(h); mb_y <= end_mb_y; mb_y++) {
int mb_xy, mb_type;
mb_xy = h->mb_xy = mb_x + mb_y * h->mb_stride;
h->slice_num = h->slice_table[mb_xy];
mb_type = h->cur_pic.mb_type[mb_xy];
h->list_count = h->list_counts[mb_xy];
- if (FRAME_MBAFF)
+ if (FRAME_MBAFF(h))
h->mb_mbaff =
h->mb_field_decoding_flag = !!IS_INTERLACED(mb_type);
h->chroma_qp[0] = get_chroma_qp(h, 0, h->cur_pic.qscale_table[mb_xy]);
h->chroma_qp[1] = get_chroma_qp(h, 1, h->cur_pic.qscale_table[mb_xy]);
- if (FRAME_MBAFF) {
+ if (FRAME_MBAFF(h)) {
ff_h264_filter_mb(h, mb_x, mb_y, dest_y, dest_cb, dest_cr,
linesize, uvlinesize);
} else {
}
h->slice_type = old_slice_type;
h->mb_x = end_x;
- h->mb_y = end_mb_y - FRAME_MBAFF;
+ h->mb_y = end_mb_y - FRAME_MBAFF(h);
h->chroma_qp[0] = get_chroma_qp(h, 0, h->qscale);
h->chroma_qp[1] = get_chroma_qp(h, 1, h->qscale);
}
{
int top = 16 * (h->mb_y >> FIELD_PICTURE);
int pic_height = 16 * h->mb_height >> FIELD_PICTURE;
- int height = 16 << FRAME_MBAFF;
- int deblock_border = (16 + 4) << FRAME_MBAFF;
+ int height = 16 << FRAME_MBAFF(h);
+ int deblock_border = (16 + 4) << FRAME_MBAFF(h);
if (h->deblocking_filter) {
if ((top + height) >= pic_height)
h->mb_skip_run = -1;
- h->is_complex = FRAME_MBAFF || h->picture_structure != PICT_FRAME ||
+ h->is_complex = FRAME_MBAFF(h) || h->picture_structure != PICT_FRAME ||
avctx->codec_id != AV_CODEC_ID_H264 ||
(CONFIG_GRAY && (h->flags & CODEC_FLAG_GRAY));
ff_h264_hl_decode_mb(h);
// FIXME optimal? or let mb_decode decode 16x32 ?
- if (ret >= 0 && FRAME_MBAFF) {
+ if (ret >= 0 && FRAME_MBAFF(h)) {
h->mb_y++;
ret = ff_h264_decode_mb_cabac(h);
++h->mb_y;
if (FIELD_OR_MBAFF_PICTURE) {
++h->mb_y;
- if (FRAME_MBAFF && h->mb_y < h->mb_height)
+ if (FRAME_MBAFF(h) && h->mb_y < h->mb_height)
predict_field_decoding_flag(h);
}
}
ff_h264_hl_decode_mb(h);
// FIXME optimal? or let mb_decode decode 16x32 ?
- if (ret >= 0 && FRAME_MBAFF) {
+ if (ret >= 0 && FRAME_MBAFF(h)) {
h->mb_y++;
ret = ff_h264_decode_mb_cavlc(h);
++h->mb_y;
if (FIELD_OR_MBAFF_PICTURE) {
++h->mb_y;
- if (FRAME_MBAFF && h->mb_y < h->mb_height)
+ if (FRAME_MBAFF(h) && h->mb_y < h->mb_height)
predict_field_decoding_flag(h);
}
if (h->mb_y >= h->mb_height) {
#ifdef ALLOW_INTERLACE
#define MB_MBAFF(h) h->mb_mbaff
#define MB_FIELD(h) h->mb_field_decoding_flag
-#define FRAME_MBAFF h->mb_aff_frame
+#define FRAME_MBAFF(h) h->mb_aff_frame
#define FIELD_PICTURE (h->picture_structure != PICT_FRAME)
#define LEFT_MBS 2
#define LTOP 0
#else
#define MB_MBAFF(h) 0
#define MB_FIELD(h) 0
-#define FRAME_MBAFF 0
+#define FRAME_MBAFF(h) 0
#define FIELD_PICTURE 0
#undef IS_INTERLACED
#define IS_INTERLACED(mb_type) 0
#define LBOT 0
#define LEFT(i) 0
#endif
-#define FIELD_OR_MBAFF_PICTURE (FRAME_MBAFF || FIELD_PICTURE)
+#define FIELD_OR_MBAFF_PICTURE (FRAME_MBAFF(h) || FIELD_PICTURE)
#ifndef CABAC
#define CABAC h->pps.cabac
int mba_xy, mbb_xy;
int ctx = 0;
- if(FRAME_MBAFF){ //FIXME merge with the stuff in fill_caches?
+ if (FRAME_MBAFF(h)) { //FIXME merge with the stuff in fill_caches?
int mb_xy = mb_x + (mb_y&~1)*h->mb_stride;
mba_xy = mb_xy - 1;
if( (mb_y&1)
if( h->slice_type_nos != AV_PICTURE_TYPE_I ) {
int skip;
/* a skipped mb needs the aff flag from the following mb */
- if( FRAME_MBAFF && (h->mb_y&1)==1 && h->prev_mb_skipped )
+ if (FRAME_MBAFF(h) && (h->mb_y & 1) == 1 && h->prev_mb_skipped)
skip = h->next_mb_skipped;
else
skip = decode_cabac_mb_skip( h, h->mb_x, h->mb_y );
/* read skip flags */
if( skip ) {
- if( FRAME_MBAFF && (h->mb_y&1)==0 ){
+ if (FRAME_MBAFF(h) && (h->mb_y & 1) == 0) {
h->cur_pic.mb_type[mb_xy] = MB_TYPE_SKIP;
h->next_mb_skipped = decode_cabac_mb_skip( h, h->mb_x, h->mb_y+1 );
if(!h->next_mb_skipped)
}
}
- if(FRAME_MBAFF){
+ if (FRAME_MBAFF(h)) {
if( (h->mb_y&1) == 0 )
h->mb_mbaff =
h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h);
h->mb_skip_run= get_ue_golomb(&h->gb);
if (h->mb_skip_run--) {
- if(FRAME_MBAFF && (h->mb_y&1) == 0){
+ if(FRAME_MBAFF(h) && (h->mb_y&1) == 0){
if(h->mb_skip_run==0)
h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&h->gb);
}
return 0;
}
}
- if(FRAME_MBAFF){
+ if (FRAME_MBAFF(h)) {
if( (h->mb_y&1) == 0 )
h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&h->gb);
}
const int poc1 = h->ref_list[1][0].poc;
int i, field;
- if (FRAME_MBAFF)
+ if (FRAME_MBAFF(h))
for (field = 0; field < 2; field++){
const int poc = h->cur_pic_ptr->field_poc[field];
const int poc1 = h->ref_list[1][0].field_poc[field];
memcpy(cur->ref_poc [1], cur->ref_poc [0], sizeof(cur->ref_poc [0]));
}
- cur->mbaff= FRAME_MBAFF;
+ cur->mbaff = FRAME_MBAFF(h);
h->col_fieldoff= 0;
if(h->picture_structure == PICT_FRAME){
for(list=0; list<2; list++){
fill_colmap(h, h->map_col_to_list0, list, sidx, ref1sidx, 0);
- if(FRAME_MBAFF)
+ if (FRAME_MBAFF(h))
for(field=0; field<2; field++)
fill_colmap(h, h->map_col_to_list0_field[field], list, field, field, 1);
}
const int *dist_scale_factor = h->dist_scale_factor;
int ref_offset;
- if(FRAME_MBAFF && IS_INTERLACED(*mb_type)){
+ if (FRAME_MBAFF(h) && IS_INTERLACED(*mb_type)) {
map_col_to_list0[0] = h->map_col_to_list0_field[h->mb_y&1][0];
map_col_to_list0[1] = h->map_col_to_list0_field[h->mb_y&1][1];
dist_scale_factor =h->dist_scale_factor_field[h->mb_y&1];
}
void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) {
- assert(!FRAME_MBAFF);
+ assert(!FRAME_MBAFF(h));
if(!h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) {
ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize);
return;
if(mbm_type && !first_vertical_edge_done){
- if (FRAME_MBAFF && (dir == 1) && ((mb_y&1) == 0)
+ if (FRAME_MBAFF(h) && (dir == 1) && ((mb_y&1) == 0)
&& IS_INTERLACED(mbm_type&~mb_type)
) {
// This is a special case in the norm where the filtering must
if( IS_INTRA(mb_type|mbm_type)) {
AV_WN64A(bS, 0x0003000300030003ULL);
if ( (!IS_INTERLACED(mb_type|mbm_type))
- || ((FRAME_MBAFF || (h->picture_structure != PICT_FRAME)) && (dir == 0))
+ || ((FRAME_MBAFF(h) || (h->picture_structure != PICT_FRAME)) && (dir == 0))
)
AV_WN64A(bS, 0x0004000400040004ULL);
} else {
int i;
int mv_done;
- if( dir && FRAME_MBAFF && IS_INTERLACED(mb_type ^ mbm_type)) {
+ if( dir && FRAME_MBAFF(h) && IS_INTERLACED(mb_type ^ mbm_type)) {
AV_WN64A(bS, 0x0001000100010001ULL);
mv_done = 1;
}
int a = h->slice_alpha_c0_offset - qp_bd_offset;
int b = h->slice_beta_offset - qp_bd_offset;
- if (FRAME_MBAFF
+ if (FRAME_MBAFF(h)
// and current and left pair do not have the same interlaced type
&& IS_INTERLACED(mb_type^h->left_type[LTOP])
// and left mb is in available to us
dest_cb -= h->uvlinesize * (block_h - 1);
dest_cr -= h->uvlinesize * (block_h - 1);
}
- if (FRAME_MBAFF) {
+ if (FRAME_MBAFF(h)) {
int list;
for (list = 0; list < h->list_count; list++) {
if (!USES_LIST(mb_type, list))
if (mb_y & 1) // FIXME move out of this function?
for (p = 0; p < 3; p++)
dest[p] -= h->linesize * 15;
- if (FRAME_MBAFF) {
+ if (FRAME_MBAFF(h)) {
int list;
for (list = 0; list < h->list_count; list++) {
if (!USES_LIST(mb_type, list))
/* there is no consistent mapping of mvs to neighboring locations that will
* make mbaff happy, so we can't move all this logic to fill_caches */
- if (FRAME_MBAFF) {
+ if (FRAME_MBAFF(h)) {
#define SET_DIAG_MV(MV_OP, REF_OP, XY, Y4) \
const int xy = XY, y4 = Y4; \
const int mb_type = mb_types[xy + (y4 >> 2) * h->mb_stride]; \
}
#define FIX_MV_MBAFF(type, refn, mvn, idx) \
- if (FRAME_MBAFF) { \
+ if (FRAME_MBAFF(h)) { \
if (MB_FIELD(h)) { \
if (!IS_INTERLACED(type)) { \
refn <<= 1; \
topright_xy = top_xy + 1;
left_xy[LBOT] = left_xy[LTOP] = mb_xy - 1;
h->left_block = left_block_options[0];
- if (FRAME_MBAFF) {
+ if (FRAME_MBAFF(h)) {
const int left_mb_field_flag = IS_INTERLACED(h->cur_pic.mb_type[mb_xy - 1]);
const int curr_mb_field_flag = IS_INTERLACED(mb_type);
if (h->mb_y & 1) {
}
}
- if ((mb_type & (MB_TYPE_SKIP | MB_TYPE_DIRECT2)) && !FRAME_MBAFF)
+ if ((mb_type & (MB_TYPE_SKIP | MB_TYPE_DIRECT2)) && !FRAME_MBAFF(h))
continue;
if (!(mb_type & (MB_TYPE_SKIP | MB_TYPE_DIRECT2))) {
MAP_F2F(scan8[0] - 1 + 2 * 8, left_type[LBOT]) \
MAP_F2F(scan8[0] - 1 + 3 * 8, left_type[LBOT])
- if (FRAME_MBAFF) {
+ if (FRAME_MBAFF(h)) {
if (MB_FIELD(h)) {
#define MAP_F2F(idx, mb_type) \