Update latest
[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 #ifndef __MM_UTIL_GSTCS_H__
23 #define __MM_UTIL_GSTCS_H__
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32
33 #define IMAGE_FORMAT_LABEL_BUFFER_SIZE 9
34
35 typedef enum
36 {
37         MM_UTIL_ROTATE_0,               /**< Rotation 0 degree - no effect */
38         MM_UTIL_ROTATE_90,              /**< Rotation 90 degree */
39         MM_UTIL_ROTATE_180,             /**< Rotation 180 degree */
40         MM_UTIL_ROTATE_270,             /**< Rotation 270 degree */
41         MM_UTIL_ROTATE_FLIP_HORZ,       /**< Flip horizontal */
42         MM_UTIL_ROTATE_FLIP_VERT,       /**< Flip vertial */
43         MM_UTIL_ROTATE_NUM              /**< Number of rotation types */
44 } mm_util_img_rotate_type_e;
45
46 /* Enumerations */
47 typedef enum
48 {
49         IMGP_CSC = 0,
50         IMGP_RSZ,
51         IMGP_ROT,
52 } imgp_type_e;
53
54 typedef enum
55 {
56         /* YUV planar format */
57         MM_UTIL_IMG_FMT_YUV420 = 0x00,  /**< YUV420 format - planer */
58         MM_UTIL_IMG_FMT_YUV422,         /**< YUV422 format - planer */
59         MM_UTIL_IMG_FMT_I420,           /**< YUV420 format - planar */
60         MM_UTIL_IMG_FMT_NV12,           /**< NV12 format - planer */
61
62         /* YUV packed format */
63         MM_UTIL_IMG_FMT_UYVY,           /**< UYVY format - YUV packed format */
64         MM_UTIL_IMG_FMT_YUYV,           /**< YUYV format - YUV packed format */
65
66         /* RGB color */
67         MM_UTIL_IMG_FMT_RGB565,         /**< RGB565 pixel format */
68         MM_UTIL_IMG_FMT_RGB888,         /**< RGB888 pixel format */
69         MM_UTIL_IMG_FMT_ARGB8888,       /**< ARGB8888 pixel format */
70
71         //added by yh8004.kim
72         MM_UTIL_IMG_FMT_BGRA8888,      /**< BGRA8888 pixel format */
73         MM_UTIL_IMG_FMT_RGBA8888,      /**< RGBA8888 pixel format */
74         MM_UTIL_IMG_FMT_BGRX8888,      /**<BGRX8888 pixel format */
75         /* non-standard format */
76         MM_UTIL_IMG_FMT_NV12_TILED,     /**< Customized color format in s5pc110 */
77         MM_UTIL_IMG_FMT_NUM,            /**< Number of image formats */
78 } mm_util_img_format_e;
79
80 /**
81  * Image Process Info for dlopen
82  */
83 typedef struct _imgp_info_s
84 {
85         unsigned char *src;
86         char   input_format_label[IMAGE_FORMAT_LABEL_BUFFER_SIZE];
87         mm_util_img_format_e src_format;
88         unsigned int src_width;
89         unsigned int src_height;
90         unsigned char *dst;
91         char  output_format_label[IMAGE_FORMAT_LABEL_BUFFER_SIZE];
92         mm_util_img_format_e dst_format;
93         unsigned int dst_width;
94         unsigned int dst_height;
95         unsigned int output_stride;
96         unsigned int output_elevation;
97         mm_util_img_rotate_type_e angle;
98 } imgp_info_s;
99
100 /**
101  *
102  * @remark      image size
103  *
104  * @param       input_format_label                                                                       [in]           "filename.yuv" or  "filename,rgb" etc
105  * @param       input_width, input_height, output_width, output_height   [in]            int value
106  * @return      This function returns image size
107 */
108 static int
109 mm_setup_image_size(const char* image_format_label, int width, int height);
110
111 /**
112  *
113  * @remark      colorspace converter            I420, nv12 etc <-> RGB888 or ARGB8888 etc
114  *
115  * @remark      resize                                  if input_width != output_width or input_height != output_height
116  *
117  * @remark      rotate                                  flip the image
118  * @param        _imgp_type_e file                                                                       [in]           convert / resize / rotate
119  * @param       input_ file                                                                              [in]           "filename.yuv" or  "filename,rgb" etc
120  * @param       input_format_lable, output_format_lable                                  [in]            I420 or rgb888 etc
121  * @param       input_width, input_height, output_width, output_height   [in]            int value
122  * @param       output_stride, output_elevation                                                  [in]            output_width value or output_height  + padding (using  round_up function )
123
124  * @return      This function returns gstremer image processor result value
125  *              if the resule is -1, then do not execute when the colopsapce converter is not supported
126  *              else if  the resule is 0, then you can use output_image pointer(char** value)
127 */
128
129 int
130 mm_imgp(imgp_info_s* pImgp_info, imgp_type_e _imgp_type_e);
131
132 #ifdef __cplusplus__
133 };
134 #endif
135
136 #endif  /*__MM_UTIL_GSTCS_H__*/