ee0d0fa877f0a8cf7516048740c822f0b8508b02
[framework/multimedia/libmm-imgp-gstcs.git] / gstcs / include / mm_util_gstcs.h
1 /*
2  * libmm-imgp-gstcs
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: YoungHun Kim <yh8004.kim@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25
26 #define buf_size 9
27
28 typedef enum
29 {
30     MM_UTIL_ROTATE_0,               /**< Rotation 0 degree - no effect */
31     MM_UTIL_ROTATE_90,              /**< Rotation 90 degree */
32     MM_UTIL_ROTATE_180,             /**< Rotation 180 degree */
33     MM_UTIL_ROTATE_270,             /**< Rotation 270 degree */
34     MM_UTIL_ROTATE_FLIP_HORZ,       /**< Flip horizontal */
35     MM_UTIL_ROTATE_FLIP_VERT,       /**< Flip vertial */
36     MM_UTIL_ROTATE_NUM              /**< Number of rotation types */
37 } mm_util_img_rotate_type;
38
39 /* Enumerations */
40 typedef enum
41 {
42         IMGP_CSC = 0,
43         IMGP_RSZ,
44         IMGP_ROT,
45 } imgp_type;
46
47 typedef enum
48 {
49     /* YUV planar format */
50     MM_UTIL_IMG_FMT_YUV420 = 0x00,  /**< YUV420 format - planer */
51     MM_UTIL_IMG_FMT_YUV422,         /**< YUV422 format - planer */
52     MM_UTIL_IMG_FMT_I420,           /**< YUV420 format - planar */
53     MM_UTIL_IMG_FMT_NV12,           /**< NV12 format - planer */
54
55     /* YUV packed format */
56     MM_UTIL_IMG_FMT_UYVY,           /**< UYVY format - YUV packed format */
57     MM_UTIL_IMG_FMT_YUYV,           /**< YUYV format - YUV packed format */
58
59     /* RGB color */
60     MM_UTIL_IMG_FMT_RGB565,         /**< RGB565 pixel format */
61     MM_UTIL_IMG_FMT_RGB888,         /**< RGB888 pixel format */
62     MM_UTIL_IMG_FMT_ARGB8888,       /**< ARGB8888 pixel format */
63
64     //added by yh8004.kim
65     MM_UTIL_IMG_FMT_BGRA8888,      /**< BGRA8888 pixel format */
66     MM_UTIL_IMG_FMT_RGBA8888,      /**< RGBA8888 pixel format */
67     MM_UTIL_IMG_FMT_BGRX8888,      /**<BGRX8888 pixel format */
68     /* non-standard format */
69     MM_UTIL_IMG_FMT_NV12_TILED,     /**< Customized color format in s5pc110 */
70     MM_UTIL_IMG_FMT_NUM,            /**< Number of image formats */
71 } mm_util_img_format;
72
73 /**
74  * Image Process Info for dlopen
75  */
76 typedef struct _imgp_info
77 {
78         unsigned char *src;
79         char   input_format_label[buf_size];
80         mm_util_img_format src_format;
81         unsigned int src_width;
82         unsigned int src_height;
83         unsigned char *dst;
84         char  output_format_label[buf_size];
85         mm_util_img_format dst_format;
86         unsigned int dst_width;
87         unsigned int dst_height;
88         unsigned int output_stride;
89         unsigned int output_elevation;
90         mm_util_img_rotate_type angle;
91 } imgp_info;
92
93 /**
94  *
95  * @remark      image size
96  *
97  * @param       input_format_label                                                                       [in]           "filename.yuv" or  "filename,rgb" etc
98  * @param       input_width, input_height, output_width, output_height   [in]            int value
99  * @return      This function returns image size
100 */
101 static int
102 mm_setup_image_size(const char* image_format_label, int width, int height);
103
104 /**
105  *
106  * @remark      colorspace converter            I420, nv12 etc <-> RGB888 or ARGB8888 etc
107  *
108  * @remark      resize                                  if input_width != output_width or input_height != output_height
109  *
110  * @remark      rotate                                  flip the image
111  * @param        _imgp_type file                                                                         [in]           convert / resize / rotate
112  * @param       input_ file                                                                              [in]           "filename.yuv" or  "filename,rgb" etc
113  * @param       input_format_lable, output_format_lable                                  [in]            I420 or rgb888 etc
114  * @param       input_width, input_height, output_width, output_height   [in]            int value
115  * @param       output_stride, output_elevation                                                  [in]            output_width value or output_height  + padding (using  round_up function )
116
117  * @return      This function returns gstremer image processor result value
118  *              if the resule is -1, then do not execute when the colopsapce converter is not supported
119  *              else if  the resule is 0, then you can use output_image pointer(char** value)
120 */
121
122 int
123 mm_imgp(imgp_info* _imgp_info, imgp_type _imgp_type);