From cee23b89da9b6c4903c640ba518eabf3939f5ba2 Mon Sep 17 00:00:00 2001 From: Pu Cheng Date: Fri, 20 Nov 2026 07:52:54 +0800 Subject: [PATCH] decoder: Clear the mismatch control flag in MPEG-1 inverse quantization The I, P and B picture reconstruction selects the IDCT with pf_idct_recon[idx * 2 + i4_last_value_one]. impeg2d_vld_inv_quant_mpeg2() sets i4_last_value_one for every block, but impeg2d_vld_inv_quant_mpeg1() never touches it, and neither IVD_CMD_CTL_RESET nor the MPEG-1 initialization clears it. After an MPEG-2 stream whose last block left it at 1, an MPEG-1 stream decoded after a reset was reconstructed with the mismatch control IDCT, and its pictures differed from those of a new decoder. MPEG-1 has no mismatch control, so set the flag to 0 in impeg2d_vld_inv_quant_mpeg1(). --- decoder/impeg2d_vld.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/decoder/impeg2d_vld.c b/decoder/impeg2d_vld.c index 95c8f08..be24772 100644 --- a/decoder/impeg2d_vld.c +++ b/decoder/impeg2d_vld.c @@ -320,6 +320,8 @@ IMPEG2D_ERROR_CODES_T impeg2d_vld_inv_quant_mpeg1( pu1_weighting_matrix = (u2_intra_flag == 1) ? ps_dec->au1_intra_quant_matrix: ps_dec->au1_inter_quant_matrix; + ps_dec->i4_last_value_one = 0; + IMPEG2D_IQNT_INP_STATISTICS(pi2_out_addr, ps_dec->u4_non_zero_cols, ps_dec->u4_non_zero_rows); /* Inverse Quantize the Output of VLD */ PROFILE_DISABLE_INVQUANT_IF0