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_a9q.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_a9q
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 
63 
64 /**
65 *******************************************************************************
66 *
67 * @brief Initialize the intra/inter/transform/deblk function pointers of
68 * codec context
69 *
70 * @par Description: the current routine initializes the function pointers of
71 * codec context basing on the architecture in use
72 *
73 * @param[in] ps_codec
74 *  Codec context pointer
75 *
76 * @returns  none
77 *
78 * @remarks none
79 *
80 *******************************************************************************
81 */
ih264d_init_function_ptr_a9q(dec_struct_t * ps_codec)82 void ih264d_init_function_ptr_a9q(dec_struct_t *ps_codec)
83 {
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_a9q;
88     ps_codec->apf_intra_pred_luma_16x16[1] = ih264_intra_pred_luma_16x16_mode_horz_a9q;
89     ps_codec->apf_intra_pred_luma_16x16[2] = ih264_intra_pred_luma_16x16_mode_dc_a9q;
90     ps_codec->apf_intra_pred_luma_16x16[3] = ih264_intra_pred_luma_16x16_mode_plane_a9q;
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_a9q;
95     ps_codec->apf_intra_pred_luma_4x4[1] = ih264_intra_pred_luma_4x4_mode_horz_a9q;
96     ps_codec->apf_intra_pred_luma_4x4[2] = ih264_intra_pred_luma_4x4_mode_dc_a9q;
97     ps_codec->apf_intra_pred_luma_4x4[3] = ih264_intra_pred_luma_4x4_mode_diag_dl_a9q;
98     ps_codec->apf_intra_pred_luma_4x4[4] = ih264_intra_pred_luma_4x4_mode_diag_dr_a9q;
99     ps_codec->apf_intra_pred_luma_4x4[5] = ih264_intra_pred_luma_4x4_mode_vert_r_a9q;
100     ps_codec->apf_intra_pred_luma_4x4[6] = ih264_intra_pred_luma_4x4_mode_horz_d_a9q;
101     ps_codec->apf_intra_pred_luma_4x4[7] = ih264_intra_pred_luma_4x4_mode_vert_l_a9q;
102     ps_codec->apf_intra_pred_luma_4x4[8] = ih264_intra_pred_luma_4x4_mode_horz_u_a9q;
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_a9q;
107     ps_codec->apf_intra_pred_luma_8x8[1] = ih264_intra_pred_luma_8x8_mode_horz_a9q;
108     ps_codec->apf_intra_pred_luma_8x8[2] = ih264_intra_pred_luma_8x8_mode_dc_a9q;
109     ps_codec->apf_intra_pred_luma_8x8[3] = ih264_intra_pred_luma_8x8_mode_diag_dl_a9q;
110     ps_codec->apf_intra_pred_luma_8x8[4] = ih264_intra_pred_luma_8x8_mode_diag_dr_a9q;
111     ps_codec->apf_intra_pred_luma_8x8[5] = ih264_intra_pred_luma_8x8_mode_vert_r_a9q;
112     ps_codec->apf_intra_pred_luma_8x8[6] = ih264_intra_pred_luma_8x8_mode_horz_d_a9q;
113     ps_codec->apf_intra_pred_luma_8x8[7] = ih264_intra_pred_luma_8x8_mode_vert_l_a9q;
114     ps_codec->apf_intra_pred_luma_8x8[8] = ih264_intra_pred_luma_8x8_mode_horz_u_a9q;
115 
116     /* ih264_intra_pred_luma_8x8_mode_ref_filtering_a9q does not handle all availibilities */
117     ps_codec->pf_intra_pred_ref_filtering = ih264_intra_pred_luma_8x8_mode_ref_filtering;
118 
119     /* Init function pointers for intra pred leaf level functions chroma
120      * Intra 8x8 */
121     ps_codec->apf_intra_pred_chroma[0] = ih264_intra_pred_chroma_8x8_mode_vert_a9q;
122     ps_codec->apf_intra_pred_chroma[1] = ih264_intra_pred_chroma_8x8_mode_horz_a9q;
123     /* ih264_intra_pred_chroma_8x8_mode_dc_a9q does not support interlaced clips, hence using C */
124     ps_codec->apf_intra_pred_chroma[2] = ih264_intra_pred_chroma_8x8_mode_dc;
125     ps_codec->apf_intra_pred_chroma[3] = ih264_intra_pred_chroma_8x8_mode_plane_a9q;
126 
127 
128     ps_codec->pf_default_weighted_pred_luma = ih264_default_weighted_pred_luma_a9q;
129     ps_codec->pf_default_weighted_pred_chroma = ih264_default_weighted_pred_chroma_a9q;
130     ps_codec->pf_weighted_pred_luma = ih264_weighted_pred_luma_a9q;
131     ps_codec->pf_weighted_pred_chroma = ih264_weighted_pred_chroma_a9q;
132     ps_codec->pf_weighted_bi_pred_luma = ih264_weighted_bi_pred_luma_a9q;
133     ps_codec->pf_weighted_bi_pred_chroma = ih264_weighted_bi_pred_chroma_a9q;
134 
135     /* Padding Functions */
136     ps_codec->pf_pad_top = ih264_pad_top_a9q;
137     ps_codec->pf_pad_bottom = ih264_pad_bottom;
138 
139     ps_codec->pf_pad_left_luma = ih264_pad_left_luma_a9q;
140     ps_codec->pf_pad_right_luma = ih264_pad_right_luma_a9q;
141     ps_codec->pf_pad_left_chroma = ih264_pad_left_chroma_a9q;
142     ps_codec->pf_pad_right_chroma = ih264_pad_right_chroma_a9q;
143 
144     ps_codec->pf_iquant_itrans_recon_luma_4x4 = ih264_iquant_itrans_recon_4x4_a9;
145     ps_codec->pf_iquant_itrans_recon_luma_4x4_dc = ih264_iquant_itrans_recon_4x4_dc_a9;
146     ps_codec->pf_iquant_itrans_recon_luma_8x8 = ih264_iquant_itrans_recon_8x8_a9;
147     ps_codec->pf_iquant_itrans_recon_luma_8x8_dc = ih264_iquant_itrans_recon_8x8_dc_a9;
148     ps_codec->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4_a9;
149 
150 
151     ps_codec->pf_iquant_itrans_recon_chroma_4x4 = ih264_iquant_itrans_recon_chroma_4x4_a9;
152     ps_codec->pf_iquant_itrans_recon_chroma_4x4_dc = ih264_iquant_itrans_recon_chroma_4x4_dc_a9;
153 
154     /* Init fn ptr luma deblocking */
155      ps_codec->pf_deblk_luma_vert_bs4 = ih264_deblk_luma_vert_bs4_a9;
156      ps_codec->pf_deblk_luma_vert_bslt4 = ih264_deblk_luma_vert_bslt4_a9;
157      ps_codec->pf_deblk_luma_vert_bs4_mbaff = ih264_deblk_luma_vert_bs4_mbaff_a9;
158      ps_codec->pf_deblk_luma_vert_bslt4_mbaff = ih264_deblk_luma_vert_bslt4_mbaff_a9;
159 
160      ps_codec->pf_deblk_luma_horz_bs4 = ih264_deblk_luma_horz_bs4_a9;
161      ps_codec->pf_deblk_luma_horz_bslt4 = ih264_deblk_luma_horz_bslt4_a9;
162 
163      /* Init fn ptr chroma deblocking */
164      ps_codec->pf_deblk_chroma_vert_bs4 = ih264_deblk_chroma_vert_bs4_a9;
165      ps_codec->pf_deblk_chroma_vert_bslt4 = ih264_deblk_chroma_vert_bslt4_a9;
166      ps_codec->pf_deblk_chroma_vert_bs4_mbaff = ih264_deblk_chroma_vert_bs4_mbaff_a9;
167      ps_codec->pf_deblk_chroma_vert_bslt4_mbaff = ih264_deblk_chroma_vert_bslt4_mbaff_a9;
168 
169      ps_codec->pf_deblk_chroma_horz_bs4 = ih264_deblk_chroma_horz_bs4_a9;
170      ps_codec->pf_deblk_chroma_horz_bslt4 = ih264_deblk_chroma_horz_bslt4_a9;
171 
172 
173     /* Inter pred leaf level functions */
174     ps_codec->apf_inter_pred_luma[0] = ih264_inter_pred_luma_copy_a9q;
175 
176     ps_codec->apf_inter_pred_luma[1] = ih264_inter_pred_luma_horz_qpel_a9q;
177     ps_codec->apf_inter_pred_luma[2] = ih264_inter_pred_luma_horz_a9q;
178     ps_codec->apf_inter_pred_luma[3] = ih264_inter_pred_luma_horz_qpel_a9q;
179     ps_codec->apf_inter_pred_luma[4] = ih264_inter_pred_luma_vert_qpel_a9q;
180 
181     ps_codec->apf_inter_pred_luma[5] = ih264_inter_pred_luma_horz_qpel_vert_qpel_a9q;
182 
183     ps_codec->apf_inter_pred_luma[6] = ih264_inter_pred_luma_horz_hpel_vert_qpel_a9q;
184 
185     ps_codec->apf_inter_pred_luma[7] = ih264_inter_pred_luma_horz_qpel_vert_qpel_a9q;
186 
187     ps_codec->apf_inter_pred_luma[8] = ih264_inter_pred_luma_vert_a9q;
188     ps_codec->apf_inter_pred_luma[9] = ih264_inter_pred_luma_horz_qpel_vert_hpel_a9q;
189     ps_codec->apf_inter_pred_luma[10] = ih264_inter_pred_luma_horz_hpel_vert_hpel_a9q;
190     ps_codec->apf_inter_pred_luma[11] = ih264_inter_pred_luma_horz_qpel_vert_hpel_a9q;
191     ps_codec->apf_inter_pred_luma[12] = ih264_inter_pred_luma_vert_qpel_a9q;
192     ps_codec->apf_inter_pred_luma[13] = ih264_inter_pred_luma_horz_qpel_vert_qpel_a9q;
193     ps_codec->apf_inter_pred_luma[14] = ih264_inter_pred_luma_horz_hpel_vert_qpel_a9q;
194     ps_codec->apf_inter_pred_luma[15] = ih264_inter_pred_luma_horz_qpel_vert_qpel_a9q;
195 
196     ps_codec->pf_inter_pred_chroma = ih264_inter_pred_chroma_a9q;
197 
198 
199     return;
200 }
201