use stride and elevation for output caps. It means final transoformed data's size... 38/169938/1
authorhj kim <backto.kim@samsung.com>
Mon, 12 Feb 2018 07:53:26 +0000 (16:53 +0900)
committerhj kim <backto.kim@samsung.com>
Mon, 12 Feb 2018 07:53:26 +0000 (16:53 +0900)
Change-Id: Ie4cf51e80500bb919f671265c6d3fd1ba0c4a6cb

gstcs/mm_util_gstcs.c

index 593e792..c14dd5b 100755 (executable)
@@ -272,8 +272,8 @@ _mm_set_image_input_format_s_capabilities(image_format_s* __format) /*_format_la
                        "format", G_TYPE_STRING, gst_video_format_to_string(videoFormat),
                        "framerate", GST_TYPE_FRACTION, 25, 1,
                        "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
-                       "width", G_TYPE_INT, __format->width,
-                       "height", G_TYPE_INT, __format->height,
+                       "width", G_TYPE_INT, __format->stride,
+                       "height", G_TYPE_INT, __format->elevation,
                        "framerate", GST_TYPE_FRACTION, 1, 1,
                        NULL);
        }
@@ -293,7 +293,7 @@ _mm_set_image_input_format_s_capabilities(image_format_s* __format) /*_format_la
                        "format", G_TYPE_STRING, gst_video_format_to_string(videoFormat),
                        "framerate", GST_TYPE_FRACTION, 25, 1,
                        "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
-                       "width", G_TYPE_INT, __format->width,
+                       "width", G_TYPE_INT, __format->stride,
                        "height", G_TYPE_INT, __format->elevation,
                        "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
        }
@@ -325,8 +325,8 @@ _mm_set_image_output_format_s_capabilities(image_format_s* __format) /*_format_l
                        "format", G_TYPE_STRING, gst_video_format_to_string(videoFormat),
                        "framerate", GST_TYPE_FRACTION, 25, 1,
                        "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
-                       "width", G_TYPE_INT, __format->width,
-                       "height", G_TYPE_INT, __format->height,
+                       "width", G_TYPE_INT, __format->stride,
+                       "height", G_TYPE_INT, __format->elevation,
                        "framerate", GST_TYPE_FRACTION, 1, 1,
                        NULL);
        }
@@ -336,8 +336,8 @@ _mm_set_image_output_format_s_capabilities(image_format_s* __format) /*_format_l
                        "format", G_TYPE_STRING, gst_video_format_to_string(videoFormat),
                        "framerate", GST_TYPE_FRACTION, 25, 1,
                        "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
-                       "width", G_TYPE_INT, __format->width,
-                       "height", G_TYPE_INT, __format->height,
+                       "width", G_TYPE_INT, __format->stride,
+                       "height", G_TYPE_INT, __format->elevation,
                        "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
        }
 
@@ -346,8 +346,8 @@ _mm_set_image_output_format_s_capabilities(image_format_s* __format) /*_format_l
                        "format", G_TYPE_STRING, gst_video_format_to_string(videoFormat),
                        "framerate", GST_TYPE_FRACTION, 25, 1,
                        "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
-                       "width", G_TYPE_INT, __format->width,
-                       "height", G_TYPE_INT, __format->height,
+                       "width", G_TYPE_INT, __format->elevation,
+                       "height", G_TYPE_INT, __format->elevation,
                        "framerate", GST_TYPE_FRACTION, 1, 1, NULL);
        }
 
@@ -420,8 +420,8 @@ static void
 _mm_round_up_input_image_widh_height(image_format_s* pFormat)
 {
        if (strcmp(pFormat->colorspace, "YUV") == 0) {
-               pFormat->stride = MM_UTIL_ROUND_UP_8(pFormat->width);
-               pFormat->elevation = MM_UTIL_ROUND_UP_2(pFormat->height);
+               pFormat->stride = pFormat->width;
+               pFormat->elevation = pFormat->height;
        } else if (strcmp(pFormat->colorspace, "RGB") == 0) {
                pFormat->stride = MM_UTIL_ROUND_UP_4(pFormat->width);
                pFormat->elevation = MM_UTIL_ROUND_UP_2(pFormat->height);
@@ -468,19 +468,14 @@ static void
 _mm_round_up_output_image_widh_height(image_format_s* pFormat, const image_format_s *input_format)
 {
        if (strcmp(pFormat->colorspace, "YUV") == 0) {
-               pFormat->stride = MM_UTIL_ROUND_UP_8(pFormat->width);
-               pFormat->elevation = MM_UTIL_ROUND_UP_2(pFormat->height);
+               pFormat->stride = pFormat->width;
+               pFormat->elevation = pFormat->height;
        } else if (strcmp(pFormat->colorspace, "RGB") == 0) {
                pFormat->stride = MM_UTIL_ROUND_UP_4(pFormat->width);
                pFormat->elevation = MM_UTIL_ROUND_UP_2(pFormat->height);
-               pFormat->width = pFormat->stride;
-               if (input_format->height != input_format->elevation)
-                       pFormat->height = pFormat->elevation;
        } else if ((strcmp(pFormat->colorspace, "RGBA") == 0) || (strcmp(pFormat->colorspace, "BGRX") == 0)) {
                pFormat->stride = pFormat->width;
                pFormat->elevation = MM_UTIL_ROUND_UP_2(pFormat->height);
-               if (input_format->height != input_format->elevation)
-                       pFormat->height = pFormat->elevation;
        }
        gstcs_debug("output_format stride: %d, elevation: %d", pFormat->stride, pFormat->elevation);
 }
@@ -675,10 +670,10 @@ _mm_imgp_gstcs_processing(gstreamer_s* pGstreamer_s, unsigned char *src, unsigne
                        gst_buffer_map(pGstreamer_s->output_buffer, &mapinfo, GST_MAP_READ);
                        int buffer_size = mapinfo.size;
                        int calc_buffer_size = 0;
-                       if (((pImgp_info->dst_width != (unsigned int)(output_format->width)) || (pImgp_info->dst_height != (unsigned int)(output_format->height))) &&
+                       if (((pImgp_info->dst_width != (unsigned int)(output_format->stride)) || (pImgp_info->dst_height != (unsigned int)(output_format->elevation))) &&
                                ((strcmp(input_format->colorspace, "RGB") == 0) || (strcmp(input_format->colorspace, "RGBA") == 0))) {
                                gstcs_debug("calculate image size with stride & elevation");
-                               calc_buffer_size = mm_setup_image_size(pImgp_info->output_format_label, output_format->width, output_format->height);
+                               calc_buffer_size = mm_setup_image_size(pImgp_info->output_format_label, output_format->stride, output_format->elevation);
                        } else {
                                calc_buffer_size = mm_setup_image_size(pImgp_info->output_format_label, pImgp_info->dst_width, pImgp_info->dst_height);
                        }