]> granicus.if.org Git - libvpx/commitdiff
Force the bit exactness in the first pass
authorYunqing Wang <yunqingwang@google.com>
Wed, 2 Aug 2017 22:47:09 +0000 (15:47 -0700)
committerYunqing Wang <yunqingwang@google.com>
Wed, 2 Aug 2017 22:58:39 +0000 (15:58 -0700)
Originally, for the purpose of keeping a fast first pass, the first-pass
stats between row_mt_mode = 0 and row_mt_mode = 1 are not bit exact, but
that difference is very small that doesn't cause a mismatch between the
final bitstreams. However, if the encoder changes, this minor difference
may cause a mismatch. Thus, this patch always forces the first pass to
be bit exact.

BUG=webm:1453

Change-Id: I2b67cf529dee81f660f9d9e7fe9a60ea3c7b12b8

test/vp9_ethread_test.cc
vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_speed_features.c

index 4e8d814c127d091bf07867ea4c731f2ae0f9977d..d4ee8aedd7215705237995fc0fd3073edb72a2e2 100644 (file)
@@ -340,8 +340,6 @@ TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
   ASSERT_EQ(single_thr_md5, multi_thr_md5);
 
   // Part 2: row_mt_mode_ = 0 vs row_mt_mode_ = 1 single thread bit exact test.
-  // The first-pass stats are not bit exact here, but that difference doesn't
-  // cause a mismatch between the final bitstreams.
   row_mt_mode_ = 1;
 
   // Encode using single thread
index c6e34117e0e90100a6b51df5b4b7b0b4b687892d..4888c20f4f1bc9136bf40ddb2d948e745fd0a377 100644 (file)
@@ -5589,7 +5589,7 @@ void vp9_set_row_mt(VP9_COMP *cpi) {
     cpi->row_mt = 1;
   }
 
-  if (cpi->row_mt && cpi->oxcf.max_threads > 1)
+  if (cpi->row_mt)
     cpi->row_mt_bit_exact = 1;
   else
     cpi->row_mt_bit_exact = 0;
index 5a374ff8894509fba570263c0a97d1ffc43f3d5d..43ef4254d229ba70eb76e68c42b4950c694fec06 100644 (file)
@@ -664,7 +664,8 @@ void vp9_set_speed_features_framesize_dependent(VP9_COMP *cpi) {
   // and multiple threads match.
   // It can be used in realtime when adaptive_rd_thresh_row_mt is enabled since
   // adaptive_rd_thresh is defined per-row for non-rd pickmode.
-  if (!sf->adaptive_rd_thresh_row_mt && cpi->row_mt_bit_exact)
+  if (!sf->adaptive_rd_thresh_row_mt && cpi->row_mt_bit_exact &&
+      oxcf->max_threads > 1)
     sf->adaptive_rd_thresh = 0;
 
   // This is only used in motion vector unit test.
@@ -820,7 +821,8 @@ void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) {
   // and multiple threads match.
   // It can be used in realtime when adaptive_rd_thresh_row_mt is enabled since
   // adaptive_rd_thresh is defined per-row for non-rd pickmode.
-  if (!sf->adaptive_rd_thresh_row_mt && cpi->row_mt_bit_exact)
+  if (!sf->adaptive_rd_thresh_row_mt && cpi->row_mt_bit_exact &&
+      oxcf->max_threads > 1)
     sf->adaptive_rd_thresh = 0;
 
   // This is only used in motion vector unit test.