From 3be2add934398e307d27a063be546bf39ccb2d7e Mon Sep 17 00:00:00 2001 From: ZhiChao Yu Date: Wed, 21 Jan 2015 11:39:12 +0800 Subject: [PATCH] CHROMIUM: [media] rk3288-vpu: Fix VP8 decode corruption The QP value wasn't correctly clamped by calling function clamp() with wrong order of arguments. Fix this by passing the arguments correctly. BUG=chrome-os-partner:35606 TEST=Open Chrome and navigate to: http://video.webmfiles.org/elephants-dream.webm Signed-off-by: ZhiChao Yu [tfiga: Moved back to clamp(), but fixed argument order.] Signed-off-by: Tomasz Figa Reviewed-on: https://chromium-review.googlesource.com/242171 Reviewed-by: Kuang-che Wu Reviewed-by: Pawel Osciak Change-Id: I415e19e6cdfb125b281d205bcdf93ae9911655f4 Signed-off-by: Jeffy Chen Signed-off-by: Yakir Yang --- drivers/media/platform/rk3288-vpu/rk3288_vpu_hw_vp8d.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rk3288-vpu/rk3288_vpu_hw_vp8d.c b/drivers/media/platform/rk3288-vpu/rk3288_vpu_hw_vp8d.c index ef9fd0cbb929..60cdc7e12a3e 100644 --- a/drivers/media/platform/rk3288-vpu/rk3288_vpu_hw_vp8d.c +++ b/drivers/media/platform/rk3288-vpu/rk3288_vpu_hw_vp8d.c @@ -356,8 +356,8 @@ static void rk3288_vp8d_cfg_lf(struct rk3288_vpu_ctx *ctx) /* delta mode */ for (i = 0; i < 4; i++) vp8d_reg_write(vpu, &vp8d_lf_level[i], - clamp(0, 63, hdr->lf_hdr.level - + hdr->sgmnt_hdr.lf_update[i])); + clamp(hdr->lf_hdr.level + + hdr->sgmnt_hdr.lf_update[i], 0, 63)); } reg = VDPU_REG_REF_PIC_FILT_SHARPNESS(hdr->lf_hdr.sharpness_level); @@ -395,8 +395,9 @@ static void rk3288_vp8d_cfg_qp(struct rk3288_vpu_ctx *ctx) /* delta mode */ for (i = 0; i < 4; i++) vp8d_reg_write(vpu, &vp8d_quant[i], - clamp(0, 127, hdr->quant_hdr.y_ac_qi - + hdr->sgmnt_hdr.quant_update[i])); + clamp(hdr->quant_hdr.y_ac_qi + + hdr->sgmnt_hdr.quant_update[i], + 0, 127)); } vp8d_reg_write(vpu, &vp8d_quant_delta[0], hdr->quant_hdr.y_dc_delta); -- 2.34.1