From afd175ff93417cf3f49d790af1c7f9d4198fed2c Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Mon, 13 Jan 2020 19:03:43 +0100 Subject: [PATCH] vp3: VP30 should update golden frames on low quants --- nihav-duck/src/codecs/vp3.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nihav-duck/src/codecs/vp3.rs b/nihav-duck/src/codecs/vp3.rs index eace89e..17365ff 100644 --- a/nihav-duck/src/codecs/vp3.rs +++ b/nihav-duck/src/codecs/vp3.rs @@ -312,6 +312,7 @@ struct VP34Decoder { mb_h: usize, version: u8, is_intra: bool, + update_gf: bool, quant: usize, shuf: VPShuffler, codes: Codes, @@ -573,6 +574,7 @@ impl VP34Decoder { mb_h: 0, version, is_intra: true, + update_gf: false, quant: 0, shuf: VPShuffler::new(), codes: Codes::None, @@ -1266,6 +1268,9 @@ impl VP34Decoder { } let dc_quant = VP30_DC_SCALES[self.quant] * 10; let ac_quant = VP30_AC_SCALES[self.quant]; + + self.update_gf = ac_quant <= 50; + rescale_qmat(&mut self.qmat_y, VP3_QMAT_Y, dc_quant, ac_quant, 2); rescale_qmat(&mut self.qmat_c, VP3_QMAT_C, dc_quant, ac_quant, 2); rescale_qmat(&mut self.qmat_y_p, VP3_QMAT_INTER, dc_quant, ac_quant, 4); @@ -1835,7 +1840,7 @@ impl NADecoder for VP34Decoder { _ => return Err(DecoderError::Bug), } - if self.is_intra { + if self.is_intra || self.update_gf { self.shuf.add_golden_frame(buf.clone()); } self.shuf.add_frame(buf.clone()); -- 2.39.5