d3d11colorconverter: Handle P016_LE format
authorSeungha Yang <seungha.yang@navercorp.com>
Thu, 9 Jan 2020 10:39:59 +0000 (19:39 +0900)
committerSeungha Yang <seungha.yang@navercorp.com>
Thu, 9 Jan 2020 16:29:47 +0000 (16:29 +0000)
P016 format is no different than P010. Not much things to add code.

sys/d3d11/gstd3d11colorconverter.c
sys/d3d11/gstd3d11format.c
sys/d3d11/gstd3d11format.h

index 2a8b035..77f82f8 100644 (file)
@@ -560,6 +560,7 @@ setup_convert_info_yuv_to_rgb (GstD3D11ColorConverter * self,
       break;
     case GST_VIDEO_FORMAT_NV12:
     case GST_VIDEO_FORMAT_P010_10LE:
       break;
     case GST_VIDEO_FORMAT_NV12:
     case GST_VIDEO_FORMAT_P010_10LE:
+    case GST_VIDEO_FORMAT_P016_LE:
       info->ps_body[0] = g_strdup_printf (templ_SEMI_PLANAR_to_RGB_BODY);
       break;
     default:
       info->ps_body[0] = g_strdup_printf (templ_SEMI_PLANAR_to_RGB_BODY);
       break;
     default:
@@ -586,6 +587,7 @@ setup_convert_info_rgb_to_yuv (GstD3D11ColorConverter * self,
       break;
     case GST_VIDEO_FORMAT_NV12:
     case GST_VIDEO_FORMAT_P010_10LE:
       break;
     case GST_VIDEO_FORMAT_NV12:
     case GST_VIDEO_FORMAT_P010_10LE:
+    case GST_VIDEO_FORMAT_P016_LE:
       info->ps_body[0] = g_strdup_printf (templ_RGB_to_LUMA_BODY, 1);
       info->ps_body[1] = g_strdup_printf (templ_RGB_to_SEMI_PLANAR_CHROMA_BODY);
       break;
       info->ps_body[0] = g_strdup_printf (templ_RGB_to_LUMA_BODY, 1);
       info->ps_body[1] = g_strdup_printf (templ_RGB_to_SEMI_PLANAR_CHROMA_BODY);
       break;
@@ -1265,6 +1267,7 @@ gst_d3d11_color_converter_update_rect (GstD3D11ColorConverter * converter,
   switch (GST_VIDEO_INFO_FORMAT (&converter->out_info)) {
     case GST_VIDEO_FORMAT_NV12:
     case GST_VIDEO_FORMAT_P010_10LE:
   switch (GST_VIDEO_INFO_FORMAT (&converter->out_info)) {
     case GST_VIDEO_FORMAT_NV12:
     case GST_VIDEO_FORMAT_P010_10LE:
+    case GST_VIDEO_FORMAT_P016_LE:
     case GST_VIDEO_FORMAT_I420:
     case GST_VIDEO_FORMAT_I420_10LE:{
       gint i;
     case GST_VIDEO_FORMAT_I420:
     case GST_VIDEO_FORMAT_I420_10LE:{
       gint i;
index 4bfc23a..2362a10 100644 (file)
@@ -33,6 +33,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_format_debug);
  * DXGI_FORMAT_AYUV
  * DXGI_FORMAT_NV12
  * DXGI_FORMAT_P010
  * DXGI_FORMAT_AYUV
  * DXGI_FORMAT_NV12
  * DXGI_FORMAT_P010
+ * DXGI_FORMAT_P016
  * ...
  */
 static const GstD3D11Format legacy_d3d11_formats[] = {
  * ...
  */
 static const GstD3D11Format legacy_d3d11_formats[] = {
@@ -53,6 +54,8 @@ static const GstD3D11Format legacy_d3d11_formats[] = {
       {DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM}},
   {GST_VIDEO_FORMAT_P010_10LE, DXGI_FORMAT_UNKNOWN,
       {DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM}},
       {DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM}},
   {GST_VIDEO_FORMAT_P010_10LE, DXGI_FORMAT_UNKNOWN,
       {DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM}},
+  {GST_VIDEO_FORMAT_P016_LE, DXGI_FORMAT_UNKNOWN,
+      {DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM}},
 
   /* YUV planner */
   {GST_VIDEO_FORMAT_I420, DXGI_FORMAT_UNKNOWN,
 
   /* YUV planner */
   {GST_VIDEO_FORMAT_I420, DXGI_FORMAT_UNKNOWN,
@@ -82,6 +85,8 @@ static const GstD3D11Format d3d11_formats[] = {
       {DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM}},
   {GST_VIDEO_FORMAT_P010_10LE, DXGI_FORMAT_P010,
       {DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM}},
       {DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8G8_UNORM}},
   {GST_VIDEO_FORMAT_P010_10LE, DXGI_FORMAT_P010,
       {DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM}},
+  {GST_VIDEO_FORMAT_P016_LE, DXGI_FORMAT_P016,
+      {DXGI_FORMAT_R16_UNORM, DXGI_FORMAT_R16G16_UNORM}},
 
   /* YUV planner */
   {GST_VIDEO_FORMAT_I420, DXGI_FORMAT_UNKNOWN,
 
   /* YUV planner */
   {GST_VIDEO_FORMAT_I420, DXGI_FORMAT_UNKNOWN,
@@ -145,6 +150,7 @@ gst_d3d11_dxgi_format_n_planes (DXGI_FORMAT format)
       return 1;
     case DXGI_FORMAT_NV12:
     case DXGI_FORMAT_P010:
       return 1;
     case DXGI_FORMAT_NV12:
     case DXGI_FORMAT_P010:
+    case DXGI_FORMAT_P016:
       return 2;
     default:
       break;
       return 2;
     default:
       break;
@@ -175,6 +181,7 @@ gst_d3d11_dxgi_format_get_size (DXGI_FORMAT format, guint width, guint height,
       break;
     case DXGI_FORMAT_NV12:
     case DXGI_FORMAT_P010:
       break;
     case DXGI_FORMAT_NV12:
     case DXGI_FORMAT_P010:
+    case DXGI_FORMAT_P016:
       offset[0] = 0;
       stride[0] = pitch;
       offset[1] = offset[0] + stride[0] * height;
       offset[0] = 0;
       stride[0] = pitch;
       offset[1] = offset[0] + stride[0] * height;
index 261e58d..61ef5bf 100644 (file)
@@ -26,7 +26,7 @@
 #include "gstd3d11_fwd.h"
 
 #define GST_D3D11_FORMATS \
 #include "gstd3d11_fwd.h"
 
 #define GST_D3D11_FORMATS \
-    "{ BGRA, RGBA, RGB10A2_LE, VUYA, NV12, P010_10LE, I420, I420_10LE }"
+    "{ BGRA, RGBA, RGB10A2_LE, VUYA, NV12, P010_10LE, P016_LE, I420, I420_10LE }"
 
 G_BEGIN_DECLS
 
 
 G_BEGIN_DECLS