media: verisilicon: av1: Fix the reference scale register order
Subsystems (4)
PATCH 1/1 media: verisilicon: av1: Fix the reference scale register order
The horizontal scale field is bits 16-31 and the vertical one bits 0-15. The driver wrote the width ratio into the vertical field and the height ratio into the horizontal one, so references whose width and height ratios differ were scaled with the wrong factors.
---
Tested on RK3588 with five libaom streams whose references scale differently in x and y: bit-exact with libdav1d, wrong before.
Developed with Claude (Anthropic), which wrote the code and the commit message. I reviewed every change.
--- .../verisilicon/rockchip_vpu981_hw_av1_dec.c | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c +14 -14
@@ -86,44 +86,44 @@ rockchip_vpu981_av1_dec_set_ref(struct hantro_ctx *ctx, int ref, int idx,case 0 :hantro_reg_write (vpu, &av1_ref0_height, height);hantro_reg_write (vpu, &av1_ref0_width, width); -hantro_reg_write (vpu, &av1_ref0_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref0_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref0_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref0_ver_scale, scale_height);break ;case 1 :hantro_reg_write (vpu, &av1_ref1_height, height);hantro_reg_write (vpu, &av1_ref1_width, width); -hantro_reg_write (vpu, &av1_ref1_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref1_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref1_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref1_ver_scale, scale_height);break ;case 2 :hantro_reg_write (vpu, &av1_ref2_height, height);hantro_reg_write (vpu, &av1_ref2_width, width); -hantro_reg_write (vpu, &av1_ref2_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref2_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref2_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref2_ver_scale, scale_height);break ;case 3 :hantro_reg_write (vpu, &av1_ref3_height, height);hantro_reg_write (vpu, &av1_ref3_width, width); -hantro_reg_write (vpu, &av1_ref3_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref3_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref3_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref3_ver_scale, scale_height);break ;case 4 :hantro_reg_write (vpu, &av1_ref4_height, height);hantro_reg_write (vpu, &av1_ref4_width, width); -hantro_reg_write (vpu, &av1_ref4_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref4_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref4_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref4_ver_scale, scale_height);break ;case 5 :hantro_reg_write (vpu, &av1_ref5_height, height);hantro_reg_write (vpu, &av1_ref5_width, width); -hantro_reg_write (vpu, &av1_ref5_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref5_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref5_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref5_ver_scale, scale_height);break ;case 6 :hantro_reg_write (vpu, &av1_ref6_height, height);hantro_reg_write (vpu, &av1_ref6_width, width); -hantro_reg_write (vpu, &av1_ref6_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref6_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref6_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref6_ver_scale, scale_height);break ;default :pr_warn ("AV1 invalid reference frame index\n" );
---
base-commit: 95c189b26efb07257888ccf9d873a5c366aafbc6
change-id: 20261201-av1-ref-scale-3d240f01b6db
Best regards,
Signature · 1 line
Arun Iyengar <[email protected]>
Le 01/12/2026 à 08:28, Arun Iyengar via B4 Relay a écrit :
Quoted 10 lines
From: Arun Iyengar <[email protected]>
The horizontal scale field is bits 16-31 and the vertical one bits 0-15. The driver wrote the width ratio into the vertical field and the height ratio into the horizontal one, so references whose width and height ratios differ were scaled with the wrong factors.
Fixes 727a400686a2 ("media: verisilicon: Add Rockchip AV1 decoder")Signed-off-by Arun Iyengar <[email protected]>
Quoted 78 lines
---
Tested on RK3588 with five libaom streams whose references scale differently in x and y: bit-exact with libdav1d, wrong before.Developed with Claude (Anthropic), which wrote the code and the commit message. I reviewed every change.
--- .../verisilicon/rockchip_vpu981_hw_av1_dec.c | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-)drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c +14
-15@@ -86,44 +86,44 @@ rockchip_vpu981_av1_dec_set_ref(struct hantro_ctx *ctx, int ref, int idx,case 0 :hantro_reg_write (vpu, &av1_ref0_height, height);hantro_reg_write (vpu, &av1_ref0_width, width); -hantro_reg_write (vpu, &av1_ref0_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref0_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref0_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref0_ver_scale, scale_height);break ;case 1 :hantro_reg_write (vpu, &av1_ref1_height, height);hantro_reg_write (vpu, &av1_ref1_width, width); -hantro_reg_write (vpu, &av1_ref1_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref1_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref1_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref1_ver_scale, scale_height);break ;case 2 :hantro_reg_write (vpu, &av1_ref2_height, height);hantro_reg_write (vpu, &av1_ref2_width, width); -hantro_reg_write (vpu, &av1_ref2_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref2_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref2_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref2_ver_scale, scale_height);break ;case 3 :hantro_reg_write (vpu, &av1_ref3_height, height);hantro_reg_write (vpu, &av1_ref3_width, width); -hantro_reg_write (vpu, &av1_ref3_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref3_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref3_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref3_ver_scale, scale_height);break ;case 4 :hantro_reg_write (vpu, &av1_ref4_height, height);hantro_reg_write (vpu, &av1_ref4_width, width); -hantro_reg_write (vpu, &av1_ref4_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref4_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref4_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref4_ver_scale, scale_height);break ;case 5 :hantro_reg_write (vpu, &av1_ref5_height, height);hantro_reg_write (vpu, &av1_ref5_width, width); -hantro_reg_write (vpu, &av1_ref5_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref5_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref5_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref5_ver_scale, scale_height);break ;case 6 :hantro_reg_write (vpu, &av1_ref6_height, height);hantro_reg_write (vpu, &av1_ref6_width, width); -hantro_reg_write (vpu, &av1_ref6_ver_scale, scale_width); -hantro_reg_write (vpu, &av1_ref6_hor_scale, scale_height); +hantro_reg_write (vpu, &av1_ref6_hor_scale, scale_width); +hantro_reg_write (vpu, &av1_ref6_ver_scale, scale_height);break ;default :pr_warn ("AV1 invalid reference frame index\n" ); ---base-commit:
95c189b26efb07257888ccf9d873a5c366aafbc6
change-id: 20261201-av1-ref-scale-3d240f01b6db
Quoted 3 lines
Best regards,
--
Arun Iyengar <[email protected]>
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip