[vlc-devel] [PATCH] direct3d11: support YV12 which works better with DXVA2

Steve Lhomme robux4 at videolabs.io
Wed Apr 1 12:56:07 CEST 2015


Yes, this is why they have the exact same mapping. In msw/commons.c
the planes are inverted for one of the variants.

When you select NV12 in DXVA2 (the default), dxva2 converts it to YV12
internally (not I420) on output. And so D3D11 doesn't know about YV12
and thus swscale is involved.

http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/avcodec/dxva2.c;h=f9e7c405dee03d372f18efa44a7f125e3c21b739;hb=HEAD#l1030

I'm working on getting rid of this unnecessary conversion and use NV12
all the way through. This is the preferred DXVA format and also the
only 4:2:0 format supported in D3D11.

This patch is still valid in any case.


On Wed, Apr 1, 2015 at 12:19 PM, Jean-Baptiste Kempf <jb at videolan.org> wrote:
> On 01 Apr, Steve Lhomme wrote :
>> --
>> swscale won't be needed between DXVA2 and D3D11
>
> This cannot be right.
>
> U and V are inverted between I420 and YV12.
>
>> ---
>>  modules/video_output/msw/direct3d11.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/modules/video_output/msw/direct3d11.c b/modules/video_output/msw/direct3d11.c
>> index 8ce639d..d9a140f 100644
>> --- a/modules/video_output/msw/direct3d11.c
>> +++ b/modules/video_output/msw/direct3d11.c
>> @@ -74,6 +74,7 @@ typedef struct
>>
>>  static const d3d_format_t d3d_formats[] = {
>>      { "I420",     DXGI_FORMAT_NV12,           VLC_CODEC_I420,     DXGI_FORMAT_R8_UNORM,           DXGI_FORMAT_R8G8_UNORM },
>> +    { "YV12",     DXGI_FORMAT_NV12,           VLC_CODEC_YV12,     DXGI_FORMAT_R8_UNORM,           DXGI_FORMAT_R8G8_UNORM },
>>      { "NV12",     DXGI_FORMAT_NV12,           VLC_CODEC_NV12,     DXGI_FORMAT_R8_UNORM,           DXGI_FORMAT_R8G8_UNORM },
>>  #ifdef BROKEN_PIXEL
>>      { "YUY2",     DXGI_FORMAT_YUY2,           VLC_CODEC_I422,     DXGI_FORMAT_R8G8B8A8_UNORM,     0 },
>> @@ -749,6 +750,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
>>          else
>>              sys->d3dPxShader = globPixelShaderBiplanarYUV_BT601_2RGB;
>>          break;
>> +    case VLC_CODEC_YV12:
>>      case VLC_CODEC_I420:
>>          if( fmt->i_height > 576 )
>>              sys->d3dPxShader = globPixelShaderBiplanarI420_BT709_2RGB;
>> --
>> 2.3.0
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>
> --
> With my kindest regards,
>
> --
> Jean-Baptiste Kempf
> http://www.jbkempf.com/ - +33 672 704 734
> Sent from my Electronic Device
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list