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         : ih264d_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 _IH264D_FORMAT_CONV_H_
40 #define _IH264D_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 void ih264d_fmt_conv_420sp_to_420p(UWORD8 *pu1_y_src,
65                                    UWORD8 *pu1_uv_src,
66                                    UWORD8 *pu1_y_dst,
67                                    UWORD8 *pu1_u_dst,
68                                    UWORD8 *pu1_v_dst,
69                                    WORD32 wd,
70                                    WORD32 ht,
71                                    WORD32 src_y_strd,
72                                    WORD32 src_uv_strd,
73                                    WORD32 dst_y_strd,
74                                    WORD32 dst_uv_strd,
75                                    WORD32 is_u_first,
76                                    WORD32 disable_luma_copy);
77 
78 void ih264d_fmt_conv_420sp_to_420sp_swap_uv(UWORD8 *pu1_y_src,
79                                             UWORD8 *pu1_uv_src,
80                                             UWORD8 *pu1_y_dst,
81                                             UWORD8 *pu1_uv_dst,
82                                             WORD32 wd,
83                                             WORD32 ht,
84                                             WORD32 src_y_strd,
85                                             WORD32 src_uv_strd,
86                                             WORD32 dst_y_strd,
87                                             WORD32 dst_uv_strd);
88 
89 void ih264d_fmt_conv_420sp_to_420sp(UWORD8 *pu1_y_src,
90                                     UWORD8 *pu1_uv_src,
91                                     UWORD8 *pu1_y_dst,
92                                     UWORD8 *pu1_uv_dst,
93                                     WORD32 wd,
94                                     WORD32 ht,
95                                     WORD32 src_y_strd,
96                                     WORD32 src_uv_strd,
97                                     WORD32 dst_y_strd,
98                                     WORD32 dst_uv_strd);
99 
100 void ih264d_fmt_conv_420sp_to_rgb565(UWORD8 *pu1_y_src,
101                                      UWORD8 *pu1_uv_src,
102                                      UWORD16 *pu2_rgb_dst,
103                                      WORD32 wd,
104                                      WORD32 ht,
105                                      WORD32 src_y_strd,
106                                      WORD32 src_uv_strd,
107                                      WORD32 dst_strd,
108                                      WORD32 is_u_first);
109 #define COEFF1          13073
110 #define COEFF2          -3207
111 #define COEFF3          -6664
112 #define COEFF4          16530
113 
114 void ih264d_format_convert(dec_struct_t *ps_dec,
115                            ivd_get_display_frame_op_t *pv_disp_op,
116                            UWORD32 u4_start_y,
117                            UWORD32 u4_num_rows_y);
118 
119 
120 #endif /* _IH264D_FORMAT_CONV_H_ */
121