]> git.videolan.org Git - x264.git/commitdiff
Disable weightp offset=-1 dupes with high bit depth
authorJason Garrett-Glaser <darkshikari@gmail.com>
Mon, 1 Nov 2010 22:08:03 +0000 (15:08 -0700)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Wed, 10 Nov 2010 08:16:20 +0000 (00:16 -0800)
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.

encoder/encoder.c

index 2db633a1cc0e2ec858907ed706a8e0a253e433db..2b4fb0498d7c5563b6d52c62b346d50524d55d88 100644 (file)
@@ -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