Skip to content

gallium/auxiliary/vl: RGB to YUV compute shader + other fixes

David Rosca requested to merge nowrep/mesa:vl-csrgbyuv into main

What does this MR do and why?

  • Add RGB to YUV compute shader - uses chroma location and fixes wrong color at right/bottom edge when scaling
  • Use chroma location in YUV to RGB weave shader
  • Fix YUV to RGB bob deinterlacing
  • Avoid mapping shader constants buffer twice

Tested with

# rgb -> yuv
ffmpeg -vaapi_device /dev/dri/renderD128 -f lavfi -i testsrc=s=1080x1080 -vf format=rgba,hwupload,scale_vaapi=format=nv12:w=1440:h=1440,hwdownload,format=nv12,format=rgba -vframes 1 -f image2 -y /tmp/out%03d.png

# yuv -> rgb bob deinterlace
gst-launch-1.0 filesrc location=interlaced.mkv ! matroskademux ! h264parse ! vaapih264dec ! vaapipostproc deinterlace-method=bob ! video/x-raw,format=RGBA ! vaapisink

This should be the last set of fixes as I'm not aware of any more issues here. The compute shaders now produce equal (and in some cases better) output as the graphics shaders.

Note: This adds new tgsi shader and recently I've seen commits moving from tgsi to nir in other places, so if preferred I can try to write the new shader in nir instead.

Merge request reports