[libcamera-devel] [PATCH] qcam: Fix YUV planar fragment shaders

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Sep 30 20:36:00 CEST 2022


Quoting Laurent Pinchart (2022-09-30 17:57:31)
> Commit 251f0534b74b ("qcam: viewfinder_gl: Take color space into account
> for YUV rendering") introduced compilation failures in the YUV
> semi-planar and planar fragment shaders due to a bad copy & paste. Fix
> it.
> 
> Fixes: 251f0534b74b ("qcam: viewfinder_gl: Take color space into account for YUV rendering")
> Reported-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Wonderful, glorious GLES 30FPS returned to qcam on SGo2.
Thank you.

Tested-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

> ---
> Kieran,
> 
> This should fix the issue you have reported. I haven't tested the patch
> yet, could you give it a try ?
> ---
>  src/qcam/assets/shader/YUV_2_planes.frag | 2 +-
>  src/qcam/assets/shader/YUV_3_planes.frag | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qcam/assets/shader/YUV_2_planes.frag b/src/qcam/assets/shader/YUV_2_planes.frag
> index da8dbcc5f801..1d5d1206248f 100644
> --- a/src/qcam/assets/shader/YUV_2_planes.frag
> +++ b/src/qcam/assets/shader/YUV_2_planes.frag
> @@ -36,7 +36,7 @@ void main(void)
>  #error Invalid pattern
>  #endif
>  
> -       vec3 rgb = yuv2rgb_matrix * (vec3(y, uv) - yuv2rgb_offset);
> +       vec3 rgb = yuv2rgb_matrix * (yuv - yuv2rgb_offset);
>  
>         gl_FragColor = vec4(rgb, 1.0);
>  }
> diff --git a/src/qcam/assets/shader/YUV_3_planes.frag b/src/qcam/assets/shader/YUV_3_planes.frag
> index e754129d74d1..8f788e90a6f8 100644
> --- a/src/qcam/assets/shader/YUV_3_planes.frag
> +++ b/src/qcam/assets/shader/YUV_3_planes.frag
> @@ -30,7 +30,7 @@ void main(void)
>         yuv.y = texture2D(tex_u, textureOut).r;
>         yuv.z = texture2D(tex_v, textureOut).r;
>  
> -       vec3 rgb = yuv2rgb_matrix * (vec3(y, uv) - yuv2rgb_offset);
> +       vec3 rgb = yuv2rgb_matrix * (yuv - yuv2rgb_offset);
>  
>         gl_FragColor = vec4(rgb, 1.0);
>  }
> -- 
> Regards,
> 
> Laurent Pinchart
>


More information about the libcamera-devel mailing list