[x264-devel] commit: Disable weightp offset=-1 dupes with high bit depth ( Jason Garrett-Glaser )

git at videolan.org git at videolan.org
Wed Nov 10 10:12:33 CET 2010


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Mon Nov  1 15:08:03 2010 -0700| [e38c7fd2809dd0c9649cc5ebdd77aadefa5a7af5] | committer: Jason Garrett-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.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=e38c7fd2809dd0c9649cc5ebdd77aadefa5a7af5
---

 encoder/encoder.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/encoder/encoder.c b/encoder/encoder.c
index 2db633a..2b4fb04 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -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



More information about the x264-devel mailing list