From f712521586d85c7f6ab03c7b5b79c460f044a109 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Thu, 6 Feb 2020 18:43:24 +0100 Subject: [PATCH] vp7: fix inter mode DC predictor --- nihav-duck/src/codecs/vp7.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nihav-duck/src/codecs/vp7.rs b/nihav-duck/src/codecs/vp7.rs index a4d361c..ea423ad 100644 --- a/nihav-duck/src/codecs/vp7.rs +++ b/nihav-duck/src/codecs/vp7.rs @@ -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 { -- 2.39.5