]> git.nihav.org Git - nihav.git/commitdiff
vp7: fix inter mode DC predictor
authorKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 6 Feb 2020 17:43:24 +0000 (18:43 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Thu, 6 Feb 2020 17:43:24 +0000 (18:43 +0100)
nihav-duck/src/codecs/vp7.rs

index a4d361c2664ea57eee9da55c4cb0d8e4579e4c5c..ea423ad26145b2070bd88df7c038eea9620b9a23 100644 (file)
@@ -544,11 +544,11 @@ impl VP7Decoder {
                     y2block[0] = dc;
                 }
                 if (pval == 0) || (dc == 0) || ((pval ^ dc) < 0) {
-                    self.dstate.pdc_pred_val    = dc;
                     self.dstate.pdc_pred_count  = 0;
                 } else if dc == pval {
                     self.dstate.pdc_pred_count += 1;
                 }
+                self.dstate.pdc_pred_val = dc;
             }
             if has_ac[24] {
                 idct4x4(y2block);
@@ -1246,8 +1246,10 @@ impl NADecoder for VP7Decoder {
 
         let mut mb_idx = 0;
         self.pcache.reset();
-        self.dstate.pdc_pred_val    = 0;
-        self.dstate.pdc_pred_count  = 0;
+        if self.dstate.is_intra || (self.dstate.version > 0) {
+            self.dstate.pdc_pred_val    = 0;
+            self.dstate.pdc_pred_count  = 0;
+        }
         let mut use_last = true;
         for mb_y in 0..self.mb_h {
             for mb_x in 0..self.mb_w {