[Common] Support GRAY8, the 8-bit grayscale video format
authorWook Song <wook16.song@samsung.com>
Fri, 31 Aug 2018 07:30:21 +0000 (16:30 +0900)
committerMyungJoo Ham <myungjoo.ham@gmail.com>
Wed, 5 Sep 2018 02:43:38 +0000 (11:43 +0900)
This patch adds support for the 8-bit grayscale video format, GRAY8.

Signed-off-by: Wook Song <wook16.song@samsung.com>
common/tensor_common.c
include/tensor_common.h

index 2146c93..a8dd51f 100644 (file)
@@ -449,6 +449,9 @@ gst_tensor_config_from_tensor_structure (GstTensorConfig * config,
   if (config->tensor_media_type == _NNS_VIDEO) {
     if (config->type == _NNS_UINT8) {
       switch (config->dimension[0]) {
+        case 1:
+          config->tensor_media_format = GST_VIDEO_FORMAT_GRAY8;
+          break;
         case 3:
           config->tensor_media_format = GST_VIDEO_FORMAT_RGB;
           break;
@@ -584,6 +587,10 @@ gst_tensor_config_from_video_info (GstTensorConfig * config,
   config->rank = 3;
 
   switch (v_info->format) {
+    case GST_VIDEO_FORMAT_GRAY8:
+      config->type = _NNS_UINT8;
+      config->dimension[0] = 1;
+      break;
     case GST_VIDEO_FORMAT_RGB:
       config->type = _NNS_UINT8;
       config->dimension[0] = 3;
@@ -889,6 +896,7 @@ gst_tensor_video_stride_padding_per_row (GstVideoFormat format, gint width)
 {
   /** @todo The actual list is much longer. fill them (read https://gstreamer.freedesktop.org/documentation/design/mediatype-video-raw.html ) */
   switch (format) {
+    case GST_VIDEO_FORMAT_GRAY8:
     case GST_VIDEO_FORMAT_RGB:
     case GST_VIDEO_FORMAT_BGR:
     case GST_VIDEO_FORMAT_I420:
index 0177fc1..f52fcfd 100644 (file)
@@ -36,7 +36,7 @@
 G_BEGIN_DECLS
 
 #define GST_TENSOR_VIDEO_CAPS_STR \
-    GST_VIDEO_CAPS_MAKE ("{ RGB, BGRx }") \
+    GST_VIDEO_CAPS_MAKE ("{ RGB, BGRx, GRAY8 }") \
     ", views = (int) 1, interlace-mode = (string) progressive"
 
 #define GST_TENSOR_AUDIO_CAPS_STR \