dxgi_fmt: set chroma sampling information
authorSteve Lhomme <robUx4@videolabs.io>
Fri, 29 Jul 2016 12:55:22 +0000 (14:55 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 1 Aug 2016 07:54:36 +0000 (09:54 +0200)
so we can pick the best candidate based on the source

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/video_chroma/dxgi_fmt.c
modules/video_chroma/dxgi_fmt.h

index a8a9d41..27e989c 100644 (file)
@@ -58,28 +58,28 @@ static const dxgi_format_t dxgi_formats[] = {
 };
 
 static const d3d_format_t d3d_formats[] = {
-    { "NV12",     DXGI_FORMAT_NV12,           VLC_CODEC_NV12,              8, DXGI_FORMAT_R8_UNORM,       DXGI_FORMAT_R8G8_UNORM },
-    { "VA_NV12",  DXGI_FORMAT_NV12,           VLC_CODEC_D3D11_OPAQUE,      8, DXGI_FORMAT_R8_UNORM,       DXGI_FORMAT_R8G8_UNORM },
-    { "P010",     DXGI_FORMAT_P010,           VLC_CODEC_P010,             10, DXGI_FORMAT_R16_UNORM,      DXGI_FORMAT_R16G16_UNORM },
-    { "VA_P010",  DXGI_FORMAT_P010,           VLC_CODEC_D3D11_OPAQUE_10B, 10, DXGI_FORMAT_R16_UNORM,      DXGI_FORMAT_R16G16_UNORM },
-    { "YUY2",     DXGI_FORMAT_YUY2,           VLC_CODEC_YUYV,              8, DXGI_FORMAT_R8G8B8A8_UNORM, 0 },
+    { "NV12",     DXGI_FORMAT_NV12,           VLC_CODEC_NV12,              8, 2, 2, DXGI_FORMAT_R8_UNORM,       DXGI_FORMAT_R8G8_UNORM },
+    { "VA_NV12",  DXGI_FORMAT_NV12,           VLC_CODEC_D3D11_OPAQUE,      8, 2, 2, DXGI_FORMAT_R8_UNORM,       DXGI_FORMAT_R8G8_UNORM },
+    { "P010",     DXGI_FORMAT_P010,           VLC_CODEC_P010,             10, 2, 2, DXGI_FORMAT_R16_UNORM,      DXGI_FORMAT_R16G16_UNORM },
+    { "VA_P010",  DXGI_FORMAT_P010,           VLC_CODEC_D3D11_OPAQUE_10B, 10, 2, 2, DXGI_FORMAT_R16_UNORM,      DXGI_FORMAT_R16G16_UNORM },
+    { "YUY2",     DXGI_FORMAT_YUY2,           VLC_CODEC_YUYV,              8, 2, 2, DXGI_FORMAT_R8G8B8A8_UNORM, 0 },
 #ifdef BROKEN_PIXEL
-    { "AYUV",     DXGI_FORMAT_AYUV,           VLC_CODEC_YUVA,          8, DXGI_FORMAT_R8G8B8A8_UNORM,     0 },
-    { "Y416",     DXGI_FORMAT_Y416,           VLC_CODEC_I444_16L,     16, DXGI_FORMAT_R16G16B16A16_UINT,  0 },
+    { "AYUV",     DXGI_FORMAT_AYUV,           VLC_CODEC_YUVA,          8, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM,     0 },
+    { "Y416",     DXGI_FORMAT_Y416,           VLC_CODEC_I444_16L,     16, 1, 1, DXGI_FORMAT_R16G16B16A16_UINT,  0 },
 #endif
 #ifdef UNTESTED
-    { "Y210",     DXGI_FORMAT_Y210,           VLC_CODEC_I422_10L,     10, DXGI_FORMAT_R16G16B16A16_UNORM, 0 },
-    { "Y410",     DXGI_FORMAT_Y410,           VLC_CODEC_I444,         10, DXGI_FORMAT_R10G10B10A2_UNORM,  0 },
-    { "NV11",     DXGI_FORMAT_NV11,           VLC_CODEC_I411,          8, DXGI_FORMAT_R8_UNORM,           DXGI_FORMAT_R8G8_UNORM },
+    { "Y210",     DXGI_FORMAT_Y210,           VLC_CODEC_I422_10L,     10, 2, 1, DXGI_FORMAT_R16G16B16A16_UNORM, 0 },
+    { "Y410",     DXGI_FORMAT_Y410,           VLC_CODEC_I444,         10, 1, 1, DXGI_FORMAT_R10G10B10A2_UNORM,  0 },
+    { "NV11",     DXGI_FORMAT_NV11,           VLC_CODEC_I411,          8, 4, 1, DXGI_FORMAT_R8_UNORM,           DXGI_FORMAT_R8G8_UNORM },
 #endif
-    { "R8G8B8A8", DXGI_FORMAT_R8G8B8A8_UNORM, VLC_CODEC_RGBA,          8, DXGI_FORMAT_R8G8B8A8_UNORM,     0 },
-    { "VA_RGBA",  DXGI_FORMAT_R8G8B8A8_UNORM, VLC_CODEC_D3D11_OPAQUE,  8, DXGI_FORMAT_R8G8B8A8_UNORM,     0 },
-    { "B8G8R8A8", DXGI_FORMAT_B8G8R8A8_UNORM, VLC_CODEC_BGRA,          8, DXGI_FORMAT_B8G8R8A8_UNORM,     0 },
-    { "VA_BGRA",  DXGI_FORMAT_B8G8R8A8_UNORM, VLC_CODEC_D3D11_OPAQUE,  8, DXGI_FORMAT_B8G8R8A8_UNORM,     0 },
-    { "R8G8B8X8", DXGI_FORMAT_B8G8R8X8_UNORM, VLC_CODEC_RGB32,         8, DXGI_FORMAT_B8G8R8X8_UNORM,     0 },
-    { "B5G6R5",   DXGI_FORMAT_B5G6R5_UNORM,   VLC_CODEC_RGB16,         5, DXGI_FORMAT_B5G6R5_UNORM,       0 },
+    { "R8G8B8A8", DXGI_FORMAT_R8G8B8A8_UNORM, VLC_CODEC_RGBA,          8, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM,     0 },
+    { "VA_RGBA",  DXGI_FORMAT_R8G8B8A8_UNORM, VLC_CODEC_D3D11_OPAQUE,  8, 1, 1, DXGI_FORMAT_R8G8B8A8_UNORM,     0 },
+    { "B8G8R8A8", DXGI_FORMAT_B8G8R8A8_UNORM, VLC_CODEC_BGRA,          8, 1, 1, DXGI_FORMAT_B8G8R8A8_UNORM,     0 },
+    { "VA_BGRA",  DXGI_FORMAT_B8G8R8A8_UNORM, VLC_CODEC_D3D11_OPAQUE,  8, 1, 1, DXGI_FORMAT_B8G8R8A8_UNORM,     0 },
+    { "R8G8B8X8", DXGI_FORMAT_B8G8R8X8_UNORM, VLC_CODEC_RGB32,         8, 1, 1, DXGI_FORMAT_B8G8R8X8_UNORM,     0 },
+    { "B5G6R5",   DXGI_FORMAT_B5G6R5_UNORM,   VLC_CODEC_RGB16,         5, 1, 1, DXGI_FORMAT_B5G6R5_UNORM,       0 },
 
-    { NULL, 0, 0, 0, 0, 0}
+    { NULL, 0, 0, 0, 0, 0, 0, 0}
 };
 
 const char *DxgiFormatToStr(DXGI_FORMAT format)
index a70274f..a95af63 100644 (file)
@@ -34,6 +34,8 @@ typedef struct
     DXGI_FORMAT  formatTexture;
     vlc_fourcc_t fourcc;
     uint8_t      bitsPerChannel;
+    uint8_t      widthDenominator;
+    uint8_t      heightDenominator;
     DXGI_FORMAT  formatY;
     DXGI_FORMAT  formatUV;
 } d3d_format_t;