1 /******************************************************************************
2  *
3  * Copyright (C) 2015 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 /*****************************************************************************/
21 /*                                                                           */
22 /*  File Name         : impeg2_format_conv.h                                */
23 /*                                                                           */
24 /*  Description       : Contains coefficients and constant reqquired for     */
25 /*                      converting from rgb and gray color spaces to yuv422i */
26 /*                      color space                                          */
27 /*                                                                           */
28 /*  List of Functions : None                                                 */
29 /*                                                                           */
30 /*  Issues / Problems : None                                                 */
31 /*                                                                           */
32 /*  Revision History  :                                                      */
33 /*                                                                           */
34 /*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
35 /*         27 08 2007  Naveen Kumar T        Draft                           */
36 /*                                                                           */
37 /*****************************************************************************/
38 
39 #ifndef __IMPEG2_FORMAT_CONV_H__
40 #define __IMPEG2_FORMAT_CONV_H__
41 
42 /*****************************************************************************/
43 /* Typedefs                                                                  */
44 /*****************************************************************************/
45 
46 #define COEFF_0_Y       66
47 #define COEFF_1_Y       129
48 #define COEFF_2_Y       25
49 #define COEFF_0_U       -38
50 #define COEFF_1_U       -75
51 #define COEFF_2_U       112
52 #define COEFF_0_V       112
53 #define COEFF_1_V       -94
54 #define COEFF_2_V       -18
55 #define CONST_RGB_YUV1  4096
56 #define CONST_RGB_YUV2  32768
57 #define CONST_GRAY_YUV  128
58 #define COEF_2_V2_U  0xFFEE0070
59 
60 #define COF_2Y_0Y          0X00190042
61 #define COF_1U_0U          0XFFB5FFDA
62 #define COF_1V_0V          0XFFA20070
63 
64 /*****************************************************************************/
65 /* Enums */
66 /*****************************************************************************/
67 typedef enum {
68 GRAY_SCALE   = 0,
69 YUV444      = 1,
70 YUV420      = 2,
71 YUV422H     = 3,
72 YUV422V     = 4,
73 YUV411      = 5,
74 RGB24       = 6,
75 RGB24i      = 7
76 }input_format_t;
77 
78 /*****************************************************************************/
79 /* Function Declarations                                                     */
80 /*****************************************************************************/
81 typedef void pf_copy_yuv420p_buf_t(UWORD8 *pu1_src_y,
82                                    UWORD8 *pu1_src_u,
83                                    UWORD8 *pu1_src_v,
84                                    UWORD8 *pu1_dst_y,
85                                    UWORD8 *pu1_dst_u,
86                                    UWORD8 *pu1_dst_v,
87                                    UWORD32 u4_width,
88                                    UWORD32 u4_height,
89                                    UWORD32 u4_src_stride_y,
90                                    UWORD32 u4_src_stride_u,
91                                    UWORD32 u4_src_stride_v,
92                                    UWORD32 u4_dst_stride_y,
93                                    UWORD32 u4_dst_stride_u,
94                                    UWORD32 u4_dst_stride_v);
95 
96 typedef void pf_fmt_conv_yuv420p_to_yuv422ile_t(UWORD8 *pu1_y,
97                                                 UWORD8 *pu1_u,
98                                                 UWORD8 *pu1_v,
99                                                 void *pv_yuv422i,
100                                                 UWORD32 u4_width,
101                                                 UWORD32 u4_height,
102                                                 UWORD32 u4_stride_y,
103                                                 UWORD32 u4_stride_u,
104                                                 UWORD32 u4_stride_v,
105                                                 UWORD32 u4_stride_yuv422i);
106 
107 typedef void pf_fmt_conv_yuv420p_to_yuv420sp_t(UWORD8 *pu1_y,
108                                                UWORD8 *pu1_u,
109                                                UWORD8 *pu1_v,
110                                                UWORD8 *pu1_dest_y,
111                                                UWORD8 *pu1_dest_uv,
112                                                UWORD32 u2_height,
113                                                UWORD32 u2_width,
114                                                UWORD32 u2_stridey,
115                                                UWORD32 u2_strideu,
116                                                UWORD32 u2_stridev,
117                                                UWORD32 u2_dest_stride_y,
118                                                UWORD32 u2_dest_stride_uv,
119                                                UWORD32 convert_uv_only);
120 
121 pf_copy_yuv420p_buf_t impeg2_copy_frm_yuv420p;
122 pf_fmt_conv_yuv420p_to_yuv422ile_t impeg2_fmt_conv_yuv420p_to_yuv422ile;
123 pf_fmt_conv_yuv420p_to_yuv420sp_t impeg2_fmt_conv_yuv420p_to_yuv420sp_vu;
124 pf_fmt_conv_yuv420p_to_yuv420sp_t impeg2_fmt_conv_yuv420p_to_yuv420sp_uv;
125 
126 pf_fmt_conv_yuv420p_to_yuv420sp_t impeg2_fmt_conv_yuv420p_to_yuv420sp_uv_a9q;
127 pf_fmt_conv_yuv420p_to_yuv420sp_t impeg2_fmt_conv_yuv420p_to_yuv420sp_vu_a9q;
128 
129 pf_fmt_conv_yuv420p_to_yuv420sp_t impeg2_fmt_conv_yuv420p_to_yuv420sp_uv_av8;
130 pf_fmt_conv_yuv420p_to_yuv420sp_t impeg2_fmt_conv_yuv420p_to_yuv420sp_vu_av8;
131 
132 
133 #endif /* __IMPEG2_FORMAT_CONV_H__ */
134