[Mesa-dev] [PATCH] nir/lower_tex: Fix the channel ordering during conversion of AYUV images

Vivek Kasireddy vivek.kasireddy at intel.com
Tue Jan 15 21:18:33 UTC 2019


On Tue, 15 Jan 2019 02:34:08 +0000
Lionel Landwerlin <lionel.g.landwerlin at intel.com> wrote:

> When writing this I used this page to figure the bytes' ordering : 
> https://docs.microsoft.com/en-us/windows/desktop/medfound/recommended-8-bit-yuv-formats-for-video-rendering#ayuv
> Of course endianess confuses everything :(
> 
> sunxi seems to support AYUV & VUYA : 
> https://github.com/allwinner-zh/linux-3.4-sunxi/blob/master/include/video/sunxi_display2.h#L40
> 
> Finally this patch (and its gstreamer comments) confuses me even
> more : https://patchwork.freedesktop.org/patch/255529/
> 
> I really don't know what's right or wrong here...
> 
> -
> Lionel
Hi Lionel,
I am in the same boat as you; however, I think you may be right. I was
looking at this page:
https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/pixfmt-packed-yuv.html

and assumed that the format it refers to as V4L2_PIX_FMT_YUV32 with
code YUV4 is the same as AYUV. I am guessing the best way to fix this
is to add a new AYUV format to V4L that reverses the channel ordering?

-Vivek

> 
> On 15/01/2019 00:49, Vivek Kasireddy wrote:
> > From: "Kasireddy, Vivek" <vivek.kasireddy at intel.com>
> >
> > The channel ordering should be 1230 instead of 2103.
> >
> > While displaying the packed YUV buffers generated by the Vivid
> > (Virtual Video) driver on Weston, it was observed that AYUV images
> > were not displayed correctly. Changing the ordering to 1230 makes
> > AYUV buffers display as expected.
> >
> > CC: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> > CC: Tapani Palli <tapani.palli at intel.com>
> > Signed-off-by: Vivek Kasireddy <vivek.kasireddy at intel.com>
> > ---
> >   src/compiler/nir/nir_lower_tex.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/compiler/nir/nir_lower_tex.c
> > b/src/compiler/nir/nir_lower_tex.c index a618b86b34c..7058c54f17c
> > 100644 --- a/src/compiler/nir/nir_lower_tex.c
> > +++ b/src/compiler/nir/nir_lower_tex.c
> > @@ -434,10 +434,10 @@ lower_ayuv_external(nir_builder *b,
> > nir_tex_instr *tex) nir_ssa_def *ayuv = sample_plane(b, tex, 0);
> >   
> >     convert_yuv_to_rgb(b, tex,
> > -                     nir_channel(b, ayuv, 2),
> >                        nir_channel(b, ayuv, 1),
> > -                     nir_channel(b, ayuv, 0),
> > -                     nir_channel(b, ayuv, 3));
> > +                     nir_channel(b, ayuv, 2),
> > +                     nir_channel(b, ayuv, 3),
> > +                     nir_channel(b, ayuv, 0));
> >   }
> >   
> >   /*  
> 
> 



More information about the mesa-dev mailing list