xref: /aosp_15_r20/external/libavc/encoder/ih264e_fmt_conv.h (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
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 *******************************************************************************
23 * @file
24 *  ih264e_fmt_conv.h
25 *
26 * @brief
27 *  The file contains declarations of color space conversion routines
28 *
29 * @author
30 *  ittiam
31 *
32 * @remarks
33 *  none
34 *
35 *******************************************************************************
36 */
37 
38 #ifndef _IH264E_FMT_CONV_H_
39 #define _IH264E_FMT_CONV_H_
40 
41 /*****************************************************************************/
42 /* Constant Macros                                                           */
43 /*****************************************************************************/
44 
45 #define COEFF1          13073
46 #define COEFF2          -3207
47 #define COEFF3          -6664
48 #define COEFF4          16530
49 
50 /*****************************************************************************/
51 /* Function Declarations                                                     */
52 /*****************************************************************************/
53 
54 IH264E_ERROR_T ih264e_fmt_conv(codec_t *ps_codec,
55                                pic_buf_t *ps_pic,
56                                UWORD8 *pu1_y_dst,
57                                UWORD8 *pu1_u_dst,
58                                UWORD8 *pu1_v_dst,
59                                UWORD32 u4_dst_y_strd,
60                                UWORD32 u4_dst_uv_strd,
61                                WORD32 cur_row,
62                                WORD32 num_rows);
63 
64 typedef void ih264e_fmt_conv_420sp_to_rgba8888_ft(UWORD8 *pu1_y_src,
65                                                   UWORD8 *pu1_uv_src,
66                                                   UWORD32 *pu4_rgba_dst,
67                                                   WORD32 wd,
68                                                   WORD32 ht,
69                                                   WORD32 src_y_strd,
70                                                   WORD32 src_uv_strd,
71                                                   WORD32 dst_strd,
72                                                   WORD32 is_u_first);
73 
74 typedef void ih264e_fmt_conv_420sp_to_rgb565_ft(UWORD8 *pu1_y_src,
75                                                 UWORD8 *pu1_uv_src,
76                                                 UWORD16 *pu2_rgb_dst,
77                                                 WORD32 wd,
78                                                 WORD32 ht,
79                                                 WORD32 src_y_strd,
80                                                 WORD32 src_uv_strd,
81                                                 WORD32 dst_strd,
82                                                 WORD32 is_u_first);
83 
84 typedef void ih264e_fmt_conv_420sp_to_420sp_ft(UWORD8 *pu1_y_src,
85                                                UWORD8 *pu1_uv_src,
86                                                UWORD8 *pu1_y_dst,
87                                                UWORD8 *pu1_uv_dst,
88                                                WORD32 wd,
89                                                WORD32 ht,
90                                                WORD32 src_y_strd,
91                                                WORD32 src_uv_strd,
92                                                WORD32 dst_y_strd,
93                                                WORD32 dst_uv_strd);
94 
95 typedef void ih264e_fmt_conv_420sp_to_420p_ft(UWORD8 *pu1_y_src,
96                                               UWORD8 *pu1_uv_src,
97                                               UWORD8 *pu1_y_dst,
98                                               UWORD8 *pu1_u_dst,
99                                               UWORD8 *pu1_v_dst,
100                                               WORD32 wd,
101                                               WORD32 ht,
102                                               WORD32 src_y_strd,
103                                               WORD32 src_uv_strd,
104                                               WORD32 dst_y_strd,
105                                               WORD32 dst_uv_strd,
106                                               WORD32 is_u_first,
107                                               WORD32 disable_luma_copy);
108 
109 typedef void ih264e_fmt_conv_420p_to_420sp_ft(UWORD8 *pu1_y_src, UWORD8 *pu1_u_src, UWORD8 *pu1_v_src,
110                                               UWORD8 *pu1_y_dst, UWORD8 *pu1_uv_dst,
111                                               UWORD16 u2_height, UWORD16 u2_width, UWORD16 src_y_strd,
112                                               UWORD16 src_u_strd, UWORD16 src_v_strd,
113                                               UWORD16 dst_y_strd, UWORD16 dst_uv_strd,
114                                               UWORD32 convert_uv_only);
115 
116 typedef void ih264e_fmt_conv_422i_to_420sp_ft(UWORD8 *pu1_y_buf,UWORD8 *pu1_u_buf,UWORD8 *pu1_v_buf,
117                                               UWORD8 *pu1_422i_buf,
118                                               WORD32 u4_y_width,WORD32 u4_y_height,
119                                               WORD32 u4_y_stride,WORD32 u4_u_stride,WORD32 u4_v_stride,
120                                               WORD32 u4_422i_stride);
121 
122 
123 /* C function declarations */
124 ih264e_fmt_conv_420sp_to_rgba8888_ft ih264e_fmt_conv_420sp_to_rgba8888;
125 ih264e_fmt_conv_420sp_to_rgb565_ft ih264e_fmt_conv_420sp_to_rgb565;
126 ih264e_fmt_conv_420sp_to_420sp_ft ih264e_fmt_conv_420sp_to_420sp;
127 ih264e_fmt_conv_420sp_to_420p_ft ih264e_fmt_conv_420sp_to_420p;
128 ih264e_fmt_conv_420p_to_420sp_ft ih264e_fmt_conv_420p_to_420sp;
129 ih264e_fmt_conv_422i_to_420sp_ft ih264e_fmt_conv_422i_to_420sp;
130 
131 /* A9Q function declarations */
132 ih264e_fmt_conv_420sp_to_rgba8888_ft ih264e_fmt_conv_420sp_to_rgba8888_a9q;
133 ih264e_fmt_conv_420sp_to_420sp_ft ih264e_fmt_conv_420sp_to_420sp_a9q;
134 ih264e_fmt_conv_420sp_to_420p_ft ih264e_fmt_conv_420sp_to_420p_a9q;
135 ih264e_fmt_conv_420p_to_420sp_ft ih264e_fmt_conv_420p_to_420sp_a9q;
136 ih264e_fmt_conv_422i_to_420sp_ft ih264e_fmt_conv_422i_to_420sp_a9q;
137 
138 /* A9A function declarations */
139 ih264e_fmt_conv_420sp_to_rgba8888_ft ih264e_fmt_conv_420sp_to_rgba8888_a9a;
140 ih264e_fmt_conv_420sp_to_420sp_ft ih264e_fmt_conv_420sp_to_420sp_a9a;
141 ih264e_fmt_conv_420sp_to_420p_ft ih264e_fmt_conv_420sp_to_420p_a9a;
142 
143 /* SSSe31 function declarations */
144 ih264e_fmt_conv_420sp_to_420p_ft ih264e_fmt_conv_420sp_to_420p_ssse31;
145 
146 /* SSE4 function declarations */
147 ih264e_fmt_conv_420sp_to_420p_ft ih264e_fmt_conv_420sp_to_420p_sse42;
148 
149 #endif /* _IH264E_FMT_CONV_H_ */
150