Commit 506683ae authored by Fiona Glaser's avatar Fiona Glaser

Disable weightp offset=-1 dupes with high bit depth

They're a hack to compensate for crappy rounding, and thus not worth doing at high bit depth, which fixes most of the rounding issues.
parent 6cff5834
......@@ -760,9 +760,11 @@ static int x264_validate_parameters( x264_t *h )
h->param.analyse.i_mv_range = x264_clip3(h->param.analyse.i_mv_range, 32, 512 >> h->param.b_interlaced);
}
h->param.analyse.i_weighted_pred = x264_clip3( h->param.analyse.i_weighted_pred, 0, X264_WEIGHTP_SMART );
h->param.analyse.i_weighted_pred = x264_clip3( h->param.analyse.i_weighted_pred, X264_WEIGHTP_NONE, X264_WEIGHTP_SMART );
if( !h->param.analyse.i_weighted_pred && h->param.rc.b_mb_tree && h->param.analyse.b_psy && !h->param.b_interlaced )
h->param.analyse.i_weighted_pred = X264_WEIGHTP_FAKE;
if( h->param.analyse.i_weighted_pred == X264_WEIGHTP_BLIND && BIT_DEPTH > 8 )
h->param.analyse.i_weighted_pred = X264_WEIGHTP_NONE;
if( h->i_thread_frames > 1 )
{
......@@ -1419,6 +1421,12 @@ int x264_weighted_reference_duplicate( x264_t *h, int i_ref, const x264_weight_t
if( i <= 1 ) /* empty list, definitely can't duplicate frame */
return -1;
/* Duplication is a hack to compensate for crappy rounding in motion compensation.
* With high bit depth, it's not worth doing, so turn it off except in the case of
* unweighted dupes. */
if( BIT_DEPTH > 8 && w != weight_none )
return -1;
newframe = x264_frame_pop_blank_unused( h );
//FIXME: probably don't need to copy everything
......
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