Commit 0ee8e84e authored by Fiona Glaser's avatar Fiona Glaser

Implement direct temporal + interlaced

This was much easier than I expected.
It will also be basically useless until TFF/BFF support gets in, since it requires delta_poc_bottom to be set correctly to work well.
parent 8a57269d
......@@ -654,11 +654,12 @@ struct x264_t
int i_chroma_lambda2_offset;
/* B_direct and weighted prediction */
int16_t dist_scale_factor[16][2];
int16_t dist_scale_factor_buf[2][16][2];
int16_t (*dist_scale_factor)[2];
int8_t bipred_weight_buf[2][32][4];
int8_t (*bipred_weight)[4];
/* maps fref1[0]'s ref indices into the current list0 */
#define map_col_to_list0(col) h->mb.map_col_to_list0[col+2]
#define map_col_to_list0(col) h->mb.map_col_to_list0[(col)+2]
int8_t map_col_to_list0[18];
int ref_blind_dupe; /* The index of the blind reference frame duplicate. */
} mb;
......
......@@ -190,7 +190,8 @@ static int x264_mb_predict_mv_direct16x16_temporal( x264_t *h )
const int x8 = i8%2;
const int y8 = i8/2;
const int i_part_8x8 = i_mb_8x8 + x8 + y8 * h->mb.i_b8_stride;
const int i_ref = map_col_to_list0(h->fref1[0]->ref[0][i_part_8x8]);
const int i_ref1_ref = h->fref1[0]->ref[0][i_part_8x8];
const int i_ref = (map_col_to_list0(i_ref1_ref>>h->sh.b_mbaff) << h->sh.b_mbaff) + (i_ref1_ref&h->sh.b_mbaff);
if( i_ref >= 0 )
{
......@@ -1238,6 +1239,7 @@ void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y )
if( h->sh.i_type == SLICE_TYPE_B )
{
h->mb.bipred_weight = h->mb.bipred_weight_buf[h->mb.b_interlaced&(i_mb_y&1)];
h->mb.dist_scale_factor = h->mb.dist_scale_factor_buf[h->mb.b_interlaced&(i_mb_y&1)];
if( h->param.b_cabac )
{
uint8_t skipbp;
......@@ -1477,9 +1479,7 @@ void x264_macroblock_bipred_init( x264_t *h )
dist_scale_factor = x264_clip3( (tb * tx + 32) >> 6, -1024, 1023 );
}
// FIXME: will need this if we ever do temporal MV pred with interlaced
if( !h->sh.b_mbaff )
h->mb.dist_scale_factor[i_ref0][i_ref1] = dist_scale_factor;
h->mb.dist_scale_factor_buf[field][i_ref0][i_ref1] = dist_scale_factor;
dist_scale_factor >>= 2;
if( h->param.analyse.b_weighted_bipred
......
......@@ -430,11 +430,6 @@ static int x264_validate_parameters( x264_t *h )
x264_log( h, X264_LOG_WARNING, "interlace + me=esa is not implemented\n" );
h->param.analyse.i_me_method = X264_ME_UMH;
}
if( h->param.analyse.i_direct_mv_pred > X264_DIRECT_PRED_SPATIAL )
{
x264_log( h, X264_LOG_WARNING, "interlace + direct=temporal is not implemented\n" );
h->param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL;
}
if( h->param.analyse.i_weighted_pred > 0 )
{
x264_log( h, X264_LOG_WARNING, "interlace + weightp is not implemented\n" );
......
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