• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
23  *  ih264e_function_selector_generic.c
24  *
25  * @brief
26  *  Contains functions to initialize function pointers of codec context
27  *
28  * @author
29  *  Ittiam
30  *
31  * @par List of Functions:
32  *  - ih264e_init_function_ptr_generic
33  *
34  * @remarks
35  *  None
36  *
37  *******************************************************************************
38  */
39 
40 /*****************************************************************************/
41 /* File Includes                                                             */
42 /*****************************************************************************/
43 
44 /* System Include files */
45 #include <stdio.h>
46 #include <stddef.h>
47 #include <stdlib.h>
48 #include <string.h>
49 
50 /* User Include files */
51 #include "ih264_typedefs.h"
52 #include "iv.h"
53 #include "ivd.h"
54 #include "ih264_defs.h"
55 #include "ih264_size_defs.h"
56 #include "ih264_error.h"
57 #include "ih264_trans_quant_itrans_iquant.h"
58 #include "ih264_inter_pred_filters.h"
59 
60 #include "ih264d_structs.h"
61 #include "ih264d_function_selector.h"
62 
63 /**
64  *******************************************************************************
65  *
66  * @brief Initialize the intra/inter/transform/deblk function pointers of
67  * codec context
68  *
69  * @par Description: the current routine initializes the function pointers of
70  * codec context basing on the architecture in use
71  *
72  * @param[in] ps_codec
73  *  Codec context pointer
74  *
75  * @returns  none
76  *
77  * @remarks none
78  *
79  *******************************************************************************
80  */
ih264d_init_function_ptr_generic(dec_struct_t * ps_codec)81 void ih264d_init_function_ptr_generic(dec_struct_t *ps_codec)
82 {
83 
84     WORD32 i = 0;
85 
86     /* Init function pointers for intra pred leaf level functions luma
87      * Intra 16x16 */
88     ps_codec->apf_intra_pred_luma_16x16[0] =
89                     ih264_intra_pred_luma_16x16_mode_vert;
90     ps_codec->apf_intra_pred_luma_16x16[1] =
91                     ih264_intra_pred_luma_16x16_mode_horz;
92     ps_codec->apf_intra_pred_luma_16x16[2] =
93                     ih264_intra_pred_luma_16x16_mode_dc;
94     ps_codec->apf_intra_pred_luma_16x16[3] =
95                     ih264_intra_pred_luma_16x16_mode_plane;
96 
97     /* Init function pointers for intra pred leaf level functions luma
98      * Intra 4x4 */
99     ps_codec->apf_intra_pred_luma_4x4[0] = ih264_intra_pred_luma_4x4_mode_vert;
100     ps_codec->apf_intra_pred_luma_4x4[1] = ih264_intra_pred_luma_4x4_mode_horz;
101     ps_codec->apf_intra_pred_luma_4x4[2] = ih264_intra_pred_luma_4x4_mode_dc;
102     ps_codec->apf_intra_pred_luma_4x4[3] =
103                     ih264_intra_pred_luma_4x4_mode_diag_dl;
104     ps_codec->apf_intra_pred_luma_4x4[4] =
105                     ih264_intra_pred_luma_4x4_mode_diag_dr;
106     ps_codec->apf_intra_pred_luma_4x4[5] =
107                     ih264_intra_pred_luma_4x4_mode_vert_r;
108     ps_codec->apf_intra_pred_luma_4x4[6] =
109                     ih264_intra_pred_luma_4x4_mode_horz_d;
110     ps_codec->apf_intra_pred_luma_4x4[7] =
111                     ih264_intra_pred_luma_4x4_mode_vert_l;
112     ps_codec->apf_intra_pred_luma_4x4[8] =
113                     ih264_intra_pred_luma_4x4_mode_horz_u;
114 
115     /* Init function pointers for intra pred leaf level functions luma
116      * Intra 8x8 */
117     ps_codec->apf_intra_pred_luma_8x8[0] = ih264_intra_pred_luma_8x8_mode_vert;
118     ps_codec->apf_intra_pred_luma_8x8[1] = ih264_intra_pred_luma_8x8_mode_horz;
119     ps_codec->apf_intra_pred_luma_8x8[2] = ih264_intra_pred_luma_8x8_mode_dc;
120     ps_codec->apf_intra_pred_luma_8x8[3] =
121                     ih264_intra_pred_luma_8x8_mode_diag_dl;
122     ps_codec->apf_intra_pred_luma_8x8[4] =
123                     ih264_intra_pred_luma_8x8_mode_diag_dr;
124     ps_codec->apf_intra_pred_luma_8x8[5] =
125                     ih264_intra_pred_luma_8x8_mode_vert_r;
126     ps_codec->apf_intra_pred_luma_8x8[6] =
127                     ih264_intra_pred_luma_8x8_mode_horz_d;
128     ps_codec->apf_intra_pred_luma_8x8[7] =
129                     ih264_intra_pred_luma_8x8_mode_vert_l;
130     ps_codec->apf_intra_pred_luma_8x8[8] =
131                     ih264_intra_pred_luma_8x8_mode_horz_u;
132 
133     ps_codec->pf_intra_pred_ref_filtering =
134                     ih264_intra_pred_luma_8x8_mode_ref_filtering;
135 
136     /* Init function pointers for intra pred leaf level functions chroma
137      * Intra 8x8 */
138     ps_codec->apf_intra_pred_chroma[0] = ih264_intra_pred_chroma_8x8_mode_vert;
139     ps_codec->apf_intra_pred_chroma[1] = ih264_intra_pred_chroma_8x8_mode_horz;
140     ps_codec->apf_intra_pred_chroma[2] = ih264_intra_pred_chroma_8x8_mode_dc;
141     ps_codec->apf_intra_pred_chroma[3] = ih264_intra_pred_chroma_8x8_mode_plane;
142 
143     ps_codec->pf_default_weighted_pred_luma = ih264_default_weighted_pred_luma;
144     ps_codec->pf_default_weighted_pred_chroma =
145                     ih264_default_weighted_pred_chroma;
146     ps_codec->pf_weighted_pred_luma = ih264_weighted_pred_luma;
147     ps_codec->pf_weighted_pred_chroma = ih264_weighted_pred_chroma;
148     ps_codec->pf_weighted_bi_pred_luma = ih264_weighted_bi_pred_luma;
149     ps_codec->pf_weighted_bi_pred_chroma = ih264_weighted_bi_pred_chroma;
150 
151     /* Padding Functions */
152     ps_codec->pf_pad_top = ih264_pad_top;
153     ps_codec->pf_pad_bottom = ih264_pad_bottom;
154     ps_codec->pf_pad_left_luma = ih264_pad_left_luma;
155     ps_codec->pf_pad_left_chroma = ih264_pad_left_chroma;
156     ps_codec->pf_pad_right_luma = ih264_pad_right_luma;
157     ps_codec->pf_pad_right_chroma = ih264_pad_right_chroma;
158 
159     ps_codec->pf_iquant_itrans_recon_luma_4x4 = ih264_iquant_itrans_recon_4x4;
160     ps_codec->pf_iquant_itrans_recon_luma_4x4_dc =
161                     ih264_iquant_itrans_recon_4x4_dc;
162     ps_codec->pf_iquant_itrans_recon_luma_8x8 = ih264_iquant_itrans_recon_8x8;
163     ps_codec->pf_iquant_itrans_recon_luma_8x8_dc =
164                     ih264_iquant_itrans_recon_8x8_dc;
165     ps_codec->pf_iquant_itrans_recon_chroma_4x4 =
166                     ih264_iquant_itrans_recon_chroma_4x4;
167     ps_codec->pf_iquant_itrans_recon_chroma_4x4_dc =
168                     ih264_iquant_itrans_recon_chroma_4x4_dc;
169     ps_codec->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4;
170 
171     /* Init fn ptr luma deblocking */
172     ps_codec->pf_deblk_luma_vert_bs4 = ih264_deblk_luma_vert_bs4;
173     ps_codec->pf_deblk_luma_vert_bslt4 = ih264_deblk_luma_vert_bslt4;
174     ps_codec->pf_deblk_luma_vert_bs4_mbaff = ih264_deblk_luma_vert_bs4_mbaff;
175     ps_codec->pf_deblk_luma_vert_bslt4_mbaff =
176                     ih264_deblk_luma_vert_bslt4_mbaff;
177 
178     ps_codec->pf_deblk_luma_horz_bs4 = ih264_deblk_luma_horz_bs4;
179     ps_codec->pf_deblk_luma_horz_bslt4 = ih264_deblk_luma_horz_bslt4;
180 
181     /* Init fn ptr chroma deblocking */
182     ps_codec->pf_deblk_chroma_vert_bs4 = ih264_deblk_chroma_vert_bs4;
183     ps_codec->pf_deblk_chroma_vert_bslt4 = ih264_deblk_chroma_vert_bslt4;
184     ps_codec->pf_deblk_chroma_vert_bs4_mbaff =
185                     ih264_deblk_chroma_vert_bs4_mbaff;
186     ps_codec->pf_deblk_chroma_vert_bslt4_mbaff =
187                     ih264_deblk_chroma_vert_bslt4_mbaff;
188 
189     ps_codec->pf_deblk_chroma_horz_bs4 = ih264_deblk_chroma_horz_bs4;
190     ps_codec->pf_deblk_chroma_horz_bslt4 = ih264_deblk_chroma_horz_bslt4;
191 
192     /* Inter pred leaf level functions */
193     ps_codec->apf_inter_pred_luma[0] = ih264_inter_pred_luma_copy;
194     ps_codec->apf_inter_pred_luma[1] = ih264_inter_pred_luma_horz_qpel;
195     ps_codec->apf_inter_pred_luma[2] = ih264_inter_pred_luma_horz;
196     ps_codec->apf_inter_pred_luma[3] = ih264_inter_pred_luma_horz_qpel;
197     ps_codec->apf_inter_pred_luma[4] = ih264_inter_pred_luma_vert_qpel;
198     ps_codec->apf_inter_pred_luma[5] =
199                     ih264_inter_pred_luma_horz_qpel_vert_qpel;
200     ps_codec->apf_inter_pred_luma[6] =
201                     ih264_inter_pred_luma_horz_hpel_vert_qpel;
202     ps_codec->apf_inter_pred_luma[7] =
203                     ih264_inter_pred_luma_horz_qpel_vert_qpel;
204     ps_codec->apf_inter_pred_luma[8] = ih264_inter_pred_luma_vert;
205     ps_codec->apf_inter_pred_luma[9] =
206                     ih264_inter_pred_luma_horz_qpel_vert_hpel;
207     ps_codec->apf_inter_pred_luma[10] =
208                     ih264_inter_pred_luma_horz_hpel_vert_hpel;
209     ps_codec->apf_inter_pred_luma[11] =
210                     ih264_inter_pred_luma_horz_qpel_vert_hpel;
211     ps_codec->apf_inter_pred_luma[12] = ih264_inter_pred_luma_vert_qpel;
212     ps_codec->apf_inter_pred_luma[13] =
213                     ih264_inter_pred_luma_horz_qpel_vert_qpel;
214     ps_codec->apf_inter_pred_luma[14] =
215                     ih264_inter_pred_luma_horz_hpel_vert_qpel;
216     ps_codec->apf_inter_pred_luma[15] =
217                     ih264_inter_pred_luma_horz_qpel_vert_qpel;
218 
219     ps_codec->pf_inter_pred_chroma = ih264_inter_pred_chroma;
220 
221     return;
222 }
223