• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright (C) 2022 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 *  isvce_function_selector_sse42.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 *  - isvce_init_function_ptr_sse42
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 "iv2.h"
53 #include "ive2.h"
54 #include "isvc_defs.h"
55 #include "ih264_size_defs.h"
56 #include "isvce_defs.h"
57 #include "ih264e_error.h"
58 #include "ih264e_bitstream.h"
59 #include "ime_distortion_metrics.h"
60 #include "ime_defs.h"
61 #include "ime_structs.h"
62 #include "ih264_error.h"
63 #include "isvc_structs.h"
64 #include "isvc_trans_quant_itrans_iquant.h"
65 #include "isvc_inter_pred_filters.h"
66 #include "isvc_mem_fns.h"
67 #include "ih264_padding.h"
68 #include "ih264_intra_pred_filters.h"
69 #include "ih264_deblk_edge_filters.h"
70 #include "isvc_cabac_tables.h"
71 #include "irc_cntrl_param.h"
72 #include "irc_frame_info_collector.h"
73 #include "isvce_rate_control.h"
74 #include "isvce_cabac_structs.h"
75 #include "isvce_structs.h"
76 #include "isvce_cabac.h"
77 #include "ih264e_platform_macros.h"
78 #include "isvce_core_coding.h"
79 #include "ih264_cavlc_tables.h"
80 #include "isvce_cavlc.h"
81 #include "ih264e_intra_modes_eval.h"
82 #include "ih264e_fmt_conv.h"
83 #include "ih264e_half_pel.h"
84 
85 /**
86 *******************************************************************************
87 *
88 * @brief Initialize the intra/inter/transform/deblk function pointers of
89 * codec context
90 *
91 * @par Description: the current routine initializes the function pointers of
92 * codec context basing on the architecture in use
93 *
94 * @param[in] ps_codec
95 *  Codec context pointer
96 *
97 * @returns  none
98 *
99 * @remarks none
100 *
101 *******************************************************************************
102 */
isvce_init_function_ptr_sse42(isvce_codec_t * ps_codec)103 void isvce_init_function_ptr_sse42(isvce_codec_t *ps_codec)
104 {
105     WORD32 i;
106     isvce_process_ctxt_t *ps_proc = NULL;
107     isvce_me_ctxt_t *ps_me_ctxt = NULL;
108     isa_dependent_fxns_t *ps_isa_dependent_fxns = &ps_codec->s_isa_dependent_fxns;
109     enc_loop_fxns_t *ps_enc_loop_fxns = &ps_isa_dependent_fxns->s_enc_loop_fxns;
110     mem_fxns_t *ps_mem_fxns = &ps_isa_dependent_fxns->s_mem_fxns;
111 
112     ps_enc_loop_fxns->pf_hadamard_quant_4x4 = isvc_hadamard_quant_4x4_sse42;
113     ps_enc_loop_fxns->pf_hadamard_quant_2x2_uv = isvc_hadamard_quant_2x2_uv_sse42;
114 
115     ps_enc_loop_fxns->apf_resi_trans_quant_4x4[0] = isvc_resi_trans_quant_4x4_sse42;
116     ps_enc_loop_fxns->apf_resi_trans_quant_4x4[1] = isvc_resi_trans_quant_4x4_with_res_pred_sse42;
117 
118     ps_enc_loop_fxns->apf_resi_trans_quant_chroma_4x4[0] = isvc_resi_trans_quant_chroma_4x4_sse42;
119     ps_enc_loop_fxns->apf_resi_trans_quant_chroma_4x4[1] =
120         isvc_resi_trans_quant_chroma_4x4_with_res_pred_sse42;
121 
122     ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4[0] = isvc_iquant_itrans_recon_res_4x4_sse42;
123     ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4[1] =
124         isvc_iquant_itrans_recon_res_4x4_with_res_acc_sse42;
125     ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4[2] = isvc_iquant_itrans_recon_4x4_sse42;
126 
127     ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[0] =
128         isvc_iquant_itrans_recon_res_chroma_4x4_sse42;
129     ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[1] =
130         isvc_iquant_itrans_recon_res_chroma_4x4_with_res_acc_sse42;
131     ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4[2] =
132         isvc_iquant_itrans_recon_chroma_4x4_sse42;
133 
134     ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[0] = isvc_iquant_itrans_recon_res_dc_4x4_sse42;
135     ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[1] =
136         isvc_iquant_itrans_recon_res_dc_with_res_acc_4x4_sse42;
137     ps_enc_loop_fxns->apf_iquant_itrans_recon_4x4_dc[2] = isvc_iquant_itrans_recon_dc_4x4_sse42;
138 
139     ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[0] =
140         isvc_iquant_itrans_recon_res_chroma_4x4_dc_sse42;
141     ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[1] =
142         isvc_iquant_itrans_recon_res_chroma_4x4_dc_with_res_acc_sse42;
143     ps_enc_loop_fxns->apf_iquant_itrans_recon_chroma_4x4_dc[2] =
144         isvc_iquant_itrans_recon_chroma_4x4_dc_sse42;
145 
146     ps_enc_loop_fxns->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4_sse42;
147 
148     /* sad me level functions */
149     ps_codec->apf_compute_sad_16x16[0] = ime_compute_sad_16x16_sse42;
150     ps_codec->apf_compute_sad_16x16[1] = ime_compute_sad_16x16_fast_sse42;
151     ps_codec->pf_compute_sad_16x8 = ime_compute_sad_16x8_sse42;
152 
153     ps_mem_fxns->pf_copy_2d = isvc_copy_2d_ssse3;
154     ps_mem_fxns->pf_memset_2d = isvc_memset_2d_sse42;
155 
156     /* sad me level functions */
157     for(i = 0; i < (MAX_PROCESS_CTXT); i++)
158     {
159         ps_proc = &ps_codec->as_process[i];
160 
161         ps_me_ctxt = &ps_proc->s_me_ctxt;
162         ps_me_ctxt->pf_ime_compute_sad_16x16[0] = ime_compute_sad_16x16_sse42;
163         ps_me_ctxt->pf_ime_compute_sad_16x16[1] = ime_compute_sad_16x16_fast_sse42;
164         ps_me_ctxt->pf_ime_compute_sad_16x8 = ime_compute_sad_16x8_sse42;
165         ps_me_ctxt->pf_ime_compute_sad4_diamond = ime_calculate_sad4_prog_sse42;
166         ps_me_ctxt->pf_ime_sub_pel_compute_sad_16x16 = ime_sub_pel_compute_sad_16x16_sse42;
167         ps_me_ctxt->pf_ime_compute_sad_stat_luma_16x16 = ime_compute_satqd_16x16_lumainter_sse42;
168     }
169 }
170