[libcamera-devel] qcam: Fix YUV planar fragment shaders
diff mbox series

Message ID 20220930165731.9063-1-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel] qcam: Fix YUV planar fragment shaders
Related show

Commit Message

Laurent Pinchart Sept. 30, 2022, 4:57 p.m. UTC
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@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@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(-)

Comments

Kieran Bingham Sept. 30, 2022, 6:36 p.m. UTC | #1
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@ideasonboard.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

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

Tested-by: Kieran Bingham <kieran.bingham@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
>
Umang Jain Oct. 4, 2022, 6:36 a.m. UTC | #2
Hello,

On 10/1/22 12:06 AM, Kieran Bingham via libcamera-devel wrote:
> 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.

Yikes, got missed in review :(
>>
>> Fixes: 251f0534b74b ("qcam: viewfinder_gl: Take color space into account for YUV rendering")
>> Reported-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Wonderful, glorious GLES 30FPS returned to qcam on SGo2.
> Thank you.
>
> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Umang Jain <umang.jain@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
>>

Patch
diff mbox series

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);
 }