media: aspeed: Fix incorrect color
Subsystems (2)
PATCH 1/1 media: aspeed: Fix incorrect color
Current settings for rgb-2-yuv is BT.601(studio swing), but JFIF uses BT.601(full swing).
--- drivers/media/platform/aspeed-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/aspeed-video.c +1 -1
@@ -1089,7 +1089,7 @@ static void aspeed_video_init_regs(struct aspeed_video *video)u32 comp_ctrl =VE_COMP_CTRL_RSVD |FIELD_PREP (VE_COMP_CTRL_DCT_LUM , video->jpeg_quality) |FIELD_PREP (VE_COMP_CTRL_DCT_CHR , video->jpeg_quality |0x10 ); -u32 ctrl =VE_CTRL_AUTO_OR_CURSOR ; +u32 ctrl =VE_CTRL_AUTO_OR_CURSOR |VE_CTRL_YUV ;u32 seq_ctrl = video->jpeg_mode;if (video->frame_rate)
Signature · 1 line
2.25.1
Dear Jammy,
Am 09.02.22 um 03:43 schrieb Jammy Huang:
Quoted 2 lines
Current settings for rgb-2-yuv is BT.601(studio swing), but JFIF uses BT.601(full swing).
Could you please describe the problem in a little more detail? On an attached monitor to the BMC (which one) what incorrect colors are seen?
Maybe use:
Quoted 12 lines
media: aspeed: Use full swing for JFIF to fix incorrect color
Signed-off-by Jammy Huang <[email protected]>--- drivers/media/platform/aspeed-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/aspeed-video.c +0
-0
drivers/media/platform/aspeed-video.c static void aspeed_video_init_regs(struct aspeed_video *video) · line 1092
Quoted 5 lines
drivers/media/platform/aspeed-video.c +1
-1@@ -1089,7 +1089,7 @@ static void aspeed_video_init_regs(struct aspeed_video *video)u32 comp_ctrl =VE_COMP_CTRL_RSVD |FIELD_PREP (VE_COMP_CTRL_DCT_LUM , video->jpeg_quality) |FIELD_PREP (VE_COMP_CTRL_DCT_CHR , video->jpeg_quality |0x10 ); -u32 ctrl =VE_CTRL_AUTO_OR_CURSOR ; +u32 ctrl =VE_CTRL_AUTO_OR_CURSOR |VE_CTRL_YUV ;
Excuse my ignorance, but reading [1][2] YUV can be represented by studio and full swing. How is the register/bit described in the datasheet, and can the macro name be improved?
drivers/media/platform/aspeed-video.c static void aspeed_video_init_regs(struct aspeed_video *video) · line 1095
Quoted 3 lines
drivers/media/platform/aspeed-video.c +0
-0u32 seq_ctrl = video->jpeg_mode;if (video->frame_rate)
Kind regards,
Paul
[1]: https://mymusing.co/bt601-yuv-to-rgb-conversion-color/
[2]: https://www.hisour.com/yuv-color-system-25916/
Dear Paul,
Thanks for your review and suggestion.
Quoted 8 lines · Paul Menzel
Dear Jammy,
Am 09.02.22 um 03:43 schrieb Jammy Huang:
Quoted 2 lines
Current settings for rgb-2-yuv is BT.601(studio swing), but JFIF uses BT.601(full swing).
Could you please describe the problem in a little more detail? On an attached monitor to the BMC (which one) what incorrect colors are seen?
Aspeed video 's input is gfx' output which is ARGB format. To generate jpg, video
engine will transform ARGB into YUV first. Previously, aspeed video's default
settings is studio swing (16~235), but jpg is full swing (0~255) as you can see in
'Conversion to and from RGB' of https://www.w3.org/Graphics/JPEG/jfif3.pdf.
This will lead to incorrect color. For example, a RGB color on gfx, blue(0, 0, 255) will
become (16, 16, 235) after we see the output jpg of aspeed video.
Quoted 3 lines
Maybe use:
Quoted 1 line
media: aspeed: Use full swing for JFIF to fix incorrect color
Thanks, I will update a more suitable subject for this patch.
Quoted 5 lines
Quoted 5 lines
Signed-off-by Jammy Huang <[email protected]>--- drivers/media/platform/aspeed-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
drivers/media/platform/aspeed-video.c static void aspeed_video_init_regs(struct aspeed_video *video) · line 1092
Quoted 10 lines
drivers/media/platform/aspeed-video.c +1
-1@@ -1089,7 +1089,7 @@ static void aspeed_video_init_regs(struct aspeed_video *video)u32 comp_ctrl =VE_COMP_CTRL_RSVD |FIELD_PREP (VE_COMP_CTRL_DCT_LUM , video->jpeg_quality) |FIELD_PREP (VE_COMP_CTRL_DCT_CHR , video->jpeg_quality |0x10 ); -u32 ctrl =VE_CTRL_AUTO_OR_CURSOR ; +u32 ctrl =VE_CTRL_AUTO_OR_CURSOR |VE_CTRL_YUV ;Excuse my ignorance, but reading [1][2] YUV can be represented by studio and full swing. How is the register/bit described in the datasheet, and can the macro name be improved?
VR008[7:6] will decide the data format for video capture:
00: CCIR601 studio swing compliant YUV format 01: CCIR601 full swing compliant YUV format
10: RGB format
11: Gray color mode
I will update this part as well.
Quoted 12 lines
drivers/media/platform/aspeed-video.c static void aspeed_video_init_regs(struct aspeed_video *video) · line 1095
Quoted 4 lines
drivers/media/platform/aspeed-video.c +0
-0u32 seq_ctrl = video->jpeg_mode;if (video->frame_rate)Kind regards,
Paul
[1]: https://mymusing.co/bt601-yuv-to-rgb-conversion-color/
[2]: https://www.hisour.com/yuv-color-system-25916/
Signature · 2 lines
Best Regards Jammy