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_av8.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_av8
33 *
34 * @remarks
35 *  None
36 *
37 *******************************************************************************
38 */
39 
40 
41 /*****************************************************************************/
42 /* File Includes                                                             */
43 /*****************************************************************************/
44 
45 /* System Include files */
46 #include <stdio.h>
47 #include <stddef.h>
48 #include <stdlib.h>
49 #include <string.h>
50 
51 /* User Include files */
52 #include "ih264_typedefs.h"
53 #include "iv.h"
54 #include "ivd.h"
55 #include "ih264_defs.h"
56 #include "ih264_size_defs.h"
57 #include "ih264_error.h"
58 #include "ih264_trans_quant_itrans_iquant.h"
59 #include "ih264_inter_pred_filters.h"
60 
61 #include "ih264d_structs.h"
62 #include "ih264d_function_selector.h"
63 
64 
65 /**
66 *******************************************************************************
67 *
68 * @brief Initialize the intra/inter/transform/deblk function pointers of
69 * codec context
70 *
71 * @par Description: the current routine initializes the function pointers of
72 * codec context basing on the architecture in use
73 *
74 * @param[in] ps_codec
75 *  Codec context pointer
76 *
77 * @returns  none
78 *
79 * @remarks none
80 *
81 *******************************************************************************
82 */
ih264d_init_function_ptr_av8(dec_struct_t * ps_codec)83 void ih264d_init_function_ptr_av8(dec_struct_t *ps_codec)
84 {
85     /* Init function pointers for intra pred leaf level functions luma
86      * Intra 16x16 */
87     ps_codec->apf_intra_pred_luma_16x16[0] = ih264_intra_pred_luma_16x16_mode_vert_av8;
88     ps_codec->apf_intra_pred_luma_16x16[1] = ih264_intra_pred_luma_16x16_mode_horz_av8;
89     ps_codec->apf_intra_pred_luma_16x16[2] = ih264_intra_pred_luma_16x16_mode_dc_av8;
90     ps_codec->apf_intra_pred_luma_16x16[3] = ih264_intra_pred_luma_16x16_mode_plane_av8;
91 
92     /* Init function pointers for intra pred leaf level functions luma
93      * Intra 4x4 */
94     ps_codec->apf_intra_pred_luma_4x4[0] = ih264_intra_pred_luma_4x4_mode_vert_av8;
95     ps_codec->apf_intra_pred_luma_4x4[1] = ih264_intra_pred_luma_4x4_mode_horz_av8;
96     ps_codec->apf_intra_pred_luma_4x4[2] = ih264_intra_pred_luma_4x4_mode_dc_av8;
97     ps_codec->apf_intra_pred_luma_4x4[3] = ih264_intra_pred_luma_4x4_mode_diag_dl_av8;
98     ps_codec->apf_intra_pred_luma_4x4[4] = ih264_intra_pred_luma_4x4_mode_diag_dr_av8;
99     ps_codec->apf_intra_pred_luma_4x4[5] = ih264_intra_pred_luma_4x4_mode_vert_r_av8;
100     ps_codec->apf_intra_pred_luma_4x4[6] = ih264_intra_pred_luma_4x4_mode_horz_d_av8;
101     ps_codec->apf_intra_pred_luma_4x4[7] = ih264_intra_pred_luma_4x4_mode_vert_l_av8;
102     ps_codec->apf_intra_pred_luma_4x4[8] = ih264_intra_pred_luma_4x4_mode_horz_u_av8;
103 
104     /* Init function pointers for intra pred leaf level functions luma
105      * Intra 8x8 */
106     ps_codec->apf_intra_pred_luma_8x8[0] = ih264_intra_pred_luma_8x8_mode_vert_av8;
107     ps_codec->apf_intra_pred_luma_8x8[1] = ih264_intra_pred_luma_8x8_mode_horz_av8;
108     ps_codec->apf_intra_pred_luma_8x8[2] = ih264_intra_pred_luma_8x8_mode_dc_av8;
109     ps_codec->apf_intra_pred_luma_8x8[3] = ih264_intra_pred_luma_8x8_mode_diag_dl_av8;
110     ps_codec->apf_intra_pred_luma_8x8[4] = ih264_intra_pred_luma_8x8_mode_diag_dr_av8;
111     ps_codec->apf_intra_pred_luma_8x8[5] = ih264_intra_pred_luma_8x8_mode_vert_r_av8;
112     ps_codec->apf_intra_pred_luma_8x8[6] = ih264_intra_pred_luma_8x8_mode_horz_d_av8;
113     ps_codec->apf_intra_pred_luma_8x8[7] = ih264_intra_pred_luma_8x8_mode_vert_l_av8;
114     ps_codec->apf_intra_pred_luma_8x8[8] = ih264_intra_pred_luma_8x8_mode_horz_u_av8;
115 
116     ps_codec->pf_intra_pred_ref_filtering = ih264_intra_pred_luma_8x8_mode_ref_filtering;
117 
118     /* Init function pointers for intra pred leaf level functions chroma
119      * Intra 8x8 */
120     ps_codec->apf_intra_pred_chroma[0] = ih264_intra_pred_chroma_8x8_mode_vert_av8;
121     ps_codec->apf_intra_pred_chroma[1] = ih264_intra_pred_chroma_8x8_mode_horz_av8;
122     /* ih264_intra_pred_chroma_8x8_mode_dc_av8 does not support interlaced clips, hence using C */
123     ps_codec->apf_intra_pred_chroma[2] = ih264_intra_pred_chroma_8x8_mode_dc;
124     ps_codec->apf_intra_pred_chroma[3] = ih264_intra_pred_chroma_8x8_mode_plane_av8;
125 
126     ps_codec->pf_default_weighted_pred_luma = ih264_default_weighted_pred_luma_av8;
127     ps_codec->pf_default_weighted_pred_chroma = ih264_default_weighted_pred_chroma_av8;
128     ps_codec->pf_weighted_pred_luma = ih264_weighted_pred_luma_av8;
129     ps_codec->pf_weighted_pred_chroma = ih264_weighted_pred_chroma_av8;
130     ps_codec->pf_weighted_bi_pred_luma = ih264_weighted_bi_pred_luma_av8;
131     ps_codec->pf_weighted_bi_pred_chroma = ih264_weighted_bi_pred_chroma_av8;
132 
133     /* Padding Functions */
134     ps_codec->pf_pad_top = ih264_pad_top_av8;
135     ps_codec->pf_pad_bottom = ih264_pad_bottom;
136     ps_codec->pf_pad_left_luma = ih264_pad_left_luma_av8;
137     ps_codec->pf_pad_left_chroma = ih264_pad_left_chroma_av8;
138     ps_codec->pf_pad_right_luma = ih264_pad_right_luma_av8;
139     ps_codec->pf_pad_right_chroma = ih264_pad_right_chroma_av8;
140 
141 
142     ps_codec->pf_iquant_itrans_recon_luma_4x4 = ih264_iquant_itrans_recon_4x4_av8;
143     ps_codec->pf_iquant_itrans_recon_luma_4x4_dc = ih264_iquant_itrans_recon_4x4_dc_av8;
144     ps_codec->pf_iquant_itrans_recon_luma_8x8 = ih264_iquant_itrans_recon_8x8_av8;
145     ps_codec->pf_iquant_itrans_recon_luma_8x8_dc = ih264_iquant_itrans_recon_8x8_dc_av8;
146     ps_codec->pf_iquant_itrans_recon_chroma_4x4 = ih264_iquant_itrans_recon_chroma_4x4_av8;
147     ps_codec->pf_iquant_itrans_recon_chroma_4x4_dc = ih264_iquant_itrans_recon_chroma_4x4_dc_av8;
148     ps_codec->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4_av8;
149 
150 
151     /* Init fn ptr luma deblocking */
152     ps_codec->pf_deblk_luma_vert_bs4 = ih264_deblk_luma_vert_bs4_av8;
153     ps_codec->pf_deblk_luma_vert_bslt4 = ih264_deblk_luma_vert_bslt4_av8;
154     ps_codec->pf_deblk_luma_vert_bs4_mbaff = ih264_deblk_luma_vert_bs4_mbaff;
155     ps_codec->pf_deblk_luma_vert_bslt4_mbaff = ih264_deblk_luma_vert_bslt4_mbaff;
156 
157     ps_codec->pf_deblk_luma_horz_bs4 = ih264_deblk_luma_horz_bs4_av8;
158     ps_codec->pf_deblk_luma_horz_bslt4 = ih264_deblk_luma_horz_bslt4_av8;
159 
160     /* Init fn ptr chroma deblocking */
161     ps_codec->pf_deblk_chroma_vert_bs4 = ih264_deblk_chroma_vert_bs4_av8;
162     ps_codec->pf_deblk_chroma_vert_bslt4 = ih264_deblk_chroma_vert_bslt4_av8;
163     ps_codec->pf_deblk_chroma_vert_bs4_mbaff = ih264_deblk_chroma_vert_bs4_mbaff;
164     ps_codec->pf_deblk_chroma_vert_bslt4_mbaff = ih264_deblk_chroma_vert_bslt4_mbaff;
165 
166     ps_codec->pf_deblk_chroma_horz_bs4 = ih264_deblk_chroma_horz_bs4_av8;
167     ps_codec->pf_deblk_chroma_horz_bslt4 = ih264_deblk_chroma_horz_bslt4_av8;
168 
169     /* Inter pred leaf level functions */
170     ps_codec->apf_inter_pred_luma[0] = ih264_inter_pred_luma_copy_av8;
171     ps_codec->apf_inter_pred_luma[1] = ih264_inter_pred_luma_horz_qpel_av8;
172     ps_codec->apf_inter_pred_luma[2] = ih264_inter_pred_luma_horz_av8;
173     ps_codec->apf_inter_pred_luma[3] = ih264_inter_pred_luma_horz_qpel_av8;
174     ps_codec->apf_inter_pred_luma[4] = ih264_inter_pred_luma_vert_qpel_av8;
175     ps_codec->apf_inter_pred_luma[5] = ih264_inter_pred_luma_horz_qpel_vert_qpel_av8;
176     ps_codec->apf_inter_pred_luma[6] = ih264_inter_pred_luma_horz_hpel_vert_qpel_av8;
177     ps_codec->apf_inter_pred_luma[7] = ih264_inter_pred_luma_horz_qpel_vert_qpel_av8;
178     ps_codec->apf_inter_pred_luma[8] = ih264_inter_pred_luma_vert_av8;
179     ps_codec->apf_inter_pred_luma[9] = ih264_inter_pred_luma_horz_qpel_vert_hpel_av8;
180     ps_codec->apf_inter_pred_luma[10] = ih264_inter_pred_luma_horz_hpel_vert_hpel_av8;
181     ps_codec->apf_inter_pred_luma[11] = ih264_inter_pred_luma_horz_qpel_vert_hpel_av8;
182     ps_codec->apf_inter_pred_luma[12] = ih264_inter_pred_luma_vert_qpel_av8;
183     ps_codec->apf_inter_pred_luma[13] = ih264_inter_pred_luma_horz_qpel_vert_qpel_av8;
184     ps_codec->apf_inter_pred_luma[14] = ih264_inter_pred_luma_horz_hpel_vert_qpel_av8;
185     ps_codec->apf_inter_pred_luma[15] = ih264_inter_pred_luma_horz_qpel_vert_qpel_av8;
186 
187     ps_codec->pf_inter_pred_chroma = ih264_inter_pred_chroma_av8;
188 
189 
190     return;
191 }
192