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_ssse3.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_ssse3
33 *
34 * @remarks
35 *  None
36 *
37 *******************************************************************************
38 */
39 
40 
41 /*****************************************************************************/
42 /* File Includes                                                             */
43 /*****************************************************************************/
44 
45 
46 /* System Include files */
47 #include <stdio.h>
48 #include <stddef.h>
49 #include <stdlib.h>
50 #include <string.h>
51 
52 /* User Include files */
53 #include "ih264_typedefs.h"
54 #include "iv2.h"
55 #include "ive2.h"
56 #include "ih264_defs.h"
57 #include "ih264_size_defs.h"
58 #include "ih264e_defs.h"
59 #include "ih264e_error.h"
60 #include "ih264e_bitstream.h"
61 #include "ime_distortion_metrics.h"
62 #include "ime_defs.h"
63 #include "ime_structs.h"
64 #include "ih264_error.h"
65 #include "ih264_structs.h"
66 #include "ih264_trans_quant_itrans_iquant.h"
67 #include "ih264_inter_pred_filters.h"
68 #include "ih264_mem_fns.h"
69 #include "ih264_padding.h"
70 #include "ih264_intra_pred_filters.h"
71 #include "ih264_deblk_edge_filters.h"
72 #include "ih264_cabac_tables.h"
73 #include "irc_cntrl_param.h"
74 #include "irc_frame_info_collector.h"
75 #include "ih264e_rate_control.h"
76 #include "ih264e_cabac_structs.h"
77 #include "ih264e_structs.h"
78 #include "ih264e_platform_macros.h"
79 #include "ih264e_cabac.h"
80 #include "ih264e_core_coding.h"
81 #include "ih264_cavlc_tables.h"
82 #include "ih264e_cavlc.h"
83 #include "ih264e_intra_modes_eval.h"
84 #include "ih264e_fmt_conv.h"
85 #include "ih264e_half_pel.h"
86 
87 /**
88 *******************************************************************************
89 *
90 * @brief Initialize the intra/inter/transform/deblk function pointers of
91 * codec context
92 *
93 * @par Description: the current routine initializes the function pointers of
94 * codec context basing on the architecture in use
95 *
96 * @param[in] ps_codec
97 *  Codec context pointer
98 *
99 * @returns  none
100 *
101 * @remarks none
102 *
103 *******************************************************************************
104 */
ih264e_init_function_ptr_ssse3(codec_t * ps_codec)105 void ih264e_init_function_ptr_ssse3(codec_t *ps_codec)
106 {
107 
108     /* Init function pointers for intra pred leaf level functions luma
109       * Intra 16x16 */
110      ps_codec->apf_intra_pred_16_l[0] = ih264_intra_pred_luma_16x16_mode_vert_ssse3;
111      ps_codec->apf_intra_pred_16_l[1] = ih264_intra_pred_luma_16x16_mode_horz_ssse3;
112      ps_codec->apf_intra_pred_16_l[2] = ih264_intra_pred_luma_16x16_mode_dc_ssse3;
113      ps_codec->apf_intra_pred_16_l[3] = ih264_intra_pred_luma_16x16_mode_plane_ssse3;
114 
115      /* Init function pointers for intra pred leaf level functions luma
116       * Intra 4x4 */
117      ps_codec->apf_intra_pred_4_l[0] = ih264_intra_pred_luma_4x4_mode_vert_ssse3;
118      ps_codec->apf_intra_pred_4_l[1] = ih264_intra_pred_luma_4x4_mode_horz_ssse3;
119      ps_codec->apf_intra_pred_4_l[2] = ih264_intra_pred_luma_4x4_mode_dc_ssse3;
120      ps_codec->apf_intra_pred_4_l[3] = ih264_intra_pred_luma_4x4_mode_diag_dl_ssse3;
121      ps_codec->apf_intra_pred_4_l[4] = ih264_intra_pred_luma_4x4_mode_diag_dr_ssse3;
122      ps_codec->apf_intra_pred_4_l[5] = ih264_intra_pred_luma_4x4_mode_vert_r_ssse3;
123      ps_codec->apf_intra_pred_4_l[6] = ih264_intra_pred_luma_4x4_mode_horz_d_ssse3;
124      ps_codec->apf_intra_pred_4_l[7] = ih264_intra_pred_luma_4x4_mode_vert_l_ssse3;
125      ps_codec->apf_intra_pred_4_l[8] = ih264_intra_pred_luma_4x4_mode_horz_u_ssse3;
126 
127      /* Init function pointers for intra pred leaf level functions luma
128       * Intra 8x8 */
129      ps_codec->apf_intra_pred_8_l[0] = ih264_intra_pred_luma_8x8_mode_vert_ssse3;
130      ps_codec->apf_intra_pred_8_l[2] = ih264_intra_pred_luma_8x8_mode_dc_ssse3;
131      ps_codec->apf_intra_pred_8_l[3] = ih264_intra_pred_luma_8x8_mode_diag_dl_ssse3;
132      ps_codec->apf_intra_pred_8_l[4] = ih264_intra_pred_luma_8x8_mode_diag_dr_ssse3;
133      ps_codec->apf_intra_pred_8_l[5] = ih264_intra_pred_luma_8x8_mode_vert_r_ssse3;
134      ps_codec->apf_intra_pred_8_l[6] = ih264_intra_pred_luma_8x8_mode_horz_d_ssse3;
135      ps_codec->apf_intra_pred_8_l[7] = ih264_intra_pred_luma_8x8_mode_vert_l_ssse3;
136      ps_codec->apf_intra_pred_8_l[8] = ih264_intra_pred_luma_8x8_mode_horz_u_ssse3;
137 
138      /* Init function pointers for intra pred leaf level functions chroma
139       * Intra 8x8 */
140      ps_codec->apf_intra_pred_c[1] = ih264_intra_pred_chroma_8x8_mode_horz_ssse3;
141      ps_codec->apf_intra_pred_c[2] = ih264_intra_pred_chroma_8x8_mode_vert_ssse3;
142      ps_codec->apf_intra_pred_c[3] = ih264_intra_pred_chroma_8x8_mode_plane_ssse3;
143 
144     /* Init inverse transform fn ptr */
145     ps_codec->pf_iquant_itrans_recon_8x8 = ih264_iquant_itrans_recon_8x8_ssse3;
146     ps_codec->pf_iquant_itrans_recon_4x4_dc       = ih264_iquant_itrans_recon_4x4_dc_ssse3;
147     ps_codec->pf_iquant_itrans_recon_chroma_4x4_dc = ih264_iquant_itrans_recon_chroma_4x4_dc_ssse3;
148 
149     /* Init fn ptr luma deblocking */
150     ps_codec->pf_deblk_luma_vert_bs4 = ih264_deblk_luma_vert_bs4_ssse3;
151      ps_codec->pf_deblk_luma_vert_bslt4 = ih264_deblk_luma_vert_bslt4_ssse3;
152      ps_codec->pf_deblk_luma_horz_bs4 = ih264_deblk_luma_horz_bs4_ssse3;
153      ps_codec->pf_deblk_luma_horz_bslt4 = ih264_deblk_luma_horz_bslt4_ssse3;
154     /* Init fn ptr chroma deblocking */
155      ps_codec->pf_deblk_chroma_vert_bs4 = ih264_deblk_chroma_vert_bs4_ssse3;
156      ps_codec->pf_deblk_chroma_vert_bslt4 = ih264_deblk_chroma_vert_bslt4_ssse3;
157      ps_codec->pf_deblk_chroma_horz_bs4 = ih264_deblk_chroma_horz_bs4_ssse3;
158      ps_codec->pf_deblk_chroma_horz_bslt4 = ih264_deblk_chroma_horz_bslt4_ssse3;
159 
160      /* Padding Functions */
161      ps_codec->pf_pad_left_luma = ih264_pad_left_luma_ssse3;
162      ps_codec->pf_pad_left_chroma = ih264_pad_left_chroma_ssse3;
163      ps_codec->pf_pad_right_luma = ih264_pad_right_luma_ssse3;
164      ps_codec->pf_pad_right_chroma = ih264_pad_right_chroma_ssse3;
165 
166     /* Inter pred leaf level functions */
167     ps_codec->pf_inter_pred_luma_copy = ih264_inter_pred_luma_copy_ssse3;
168     ps_codec->pf_inter_pred_luma_horz = ih264_inter_pred_luma_horz_ssse3;
169     ps_codec->pf_inter_pred_luma_vert = ih264_inter_pred_luma_vert_ssse3;
170     ps_codec->pf_inter_pred_chroma = ih264_inter_pred_chroma_ssse3;
171 
172     /* memory handling operations */
173     ps_codec->pf_mem_cpy_mul8 = ih264_memcpy_mul_8_ssse3;
174     ps_codec->pf_mem_set_mul8 = ih264_memset_mul_8_ssse3;
175 
176     /*intra mode eval -encoder level function*/
177     ps_codec->pf_ih264e_evaluate_intra16x16_modes = ih264e_evaluate_intra16x16_modes_ssse3;
178     ps_codec->pf_ih264e_evaluate_intra_4x4_modes = ih264e_evaluate_intra_4x4_modes_ssse3;
179     ps_codec->pf_ih264e_evaluate_intra_chroma_modes = ih264e_evaluate_intra_chroma_modes_ssse3;
180 
181     /* Halp pel generation function - encoder level*/
182     ps_codec->pf_ih264e_sixtapfilter_horz = ih264e_sixtapfilter_horz_ssse3;
183     ps_codec->pf_ih264e_sixtap_filter_2dvh_vert = ih264e_sixtap_filter_2dvh_vert_ssse3;
184 }
185