xref: /aosp_15_r20/external/libavc/encoder/x86/ih264e_function_selector_sse42.c (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
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_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 *  - ih264e_init_function_ptr_sse42
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 "iv2.h"
54 #include "ive2.h"
55 
56 #include "ih264_error.h"
57 #include "ih264_defs.h"
58 #include "ih264_mem_fns.h"
59 #include "ih264_padding.h"
60 #include "ih264_structs.h"
61 #include "ih264_trans_quant_itrans_iquant.h"
62 #include "ih264_inter_pred_filters.h"
63 #include "ih264_intra_pred_filters.h"
64 #include "ih264_deblk_edge_filters.h"
65 #include "ih264_cavlc_tables.h"
66 #include "ih264_cabac_tables.h"
67 
68 #include "ime_defs.h"
69 #include "ime_distortion_metrics.h"
70 #include "ime_structs.h"
71 
72 #include "irc_cntrl_param.h"
73 #include "irc_frame_info_collector.h"
74 
75 #include "ih264e_error.h"
76 #include "ih264e_defs.h"
77 #include "ih264e_rate_control.h"
78 #include "ih264e_bitstream.h"
79 #include "ih264e_cabac_structs.h"
80 #include "ih264e_structs.h"
81 #include "ih264e_half_pel.h"
82 #include "ih264e_intra_modes_eval.h"
83 #include "ih264e_core_coding.h"
84 #include "ih264e_cavlc.h"
85 #include "ih264e_cabac.h"
86 #include "ih264e_fmt_conv.h"
87 #include "ih264e_platform_macros.h"
88 
89 
90 /*****************************************************************************/
91 /* Function Definitions                                                      */
92 /*****************************************************************************/
93 
94 /**
95 *******************************************************************************
96 *
97 * @brief Initialize the intra/inter/transform/deblk/entropy function pointers
98 *
99 * @par Description: the current routine initializes the function pointers of
100 * codec context basing on the architecture in use
101 *
102 * @param[in] ps_codec
103 *  Codec context pointer
104 *
105 * @returns  none
106 *
107 * @remarks none
108 *
109 *******************************************************************************
110 */
ih264e_init_function_ptr_sse42(codec_t * ps_codec)111 void ih264e_init_function_ptr_sse42(codec_t *ps_codec)
112 {
113     WORD32 i;
114 
115     /* Init luma forward transform fn ptr */
116     ps_codec->pf_resi_trans_quant_4x4 = ih264_resi_trans_quant_4x4_sse42;
117     ps_codec->pf_resi_trans_quant_chroma_4x4 = ih264_resi_trans_quant_chroma_4x4_sse42;
118     ps_codec->pf_hadamard_quant_4x4 = ih264_hadamard_quant_4x4_sse42;
119     ps_codec->pf_hadamard_quant_2x2_uv = ih264_hadamard_quant_2x2_uv_sse42;
120 
121     /* Init inverse transform fn ptr */
122     ps_codec->pf_iquant_itrans_recon_4x4 = ih264_iquant_itrans_recon_4x4_sse42;
123     ps_codec->pf_iquant_itrans_recon_chroma_4x4 = ih264_iquant_itrans_recon_chroma_4x4_sse42;
124     ps_codec->pf_ihadamard_scaling_4x4 = ih264_ihadamard_scaling_4x4_sse42;
125 
126     /* sad me level functions */
127     ps_codec->apf_compute_sad_16x16[0] = ime_compute_sad_16x16_sse42;
128     ps_codec->apf_compute_sad_16x16[1] = ime_compute_sad_16x16_fast_sse42;
129     ps_codec->pf_compute_sad_16x8 = ime_compute_sad_16x8_sse42;
130 
131     /* sad me level functions */
132     for(i = 0; i < (MAX_PROCESS_CTXT); i++)
133     {
134         process_ctxt_t *ps_proc = &ps_codec->as_process[i];
135         me_ctxt_t *ps_me_ctxt = &ps_proc->s_me_ctxt;
136 
137         ps_me_ctxt->pf_ime_compute_sad_16x16[0] = ime_compute_sad_16x16_sse42;
138         ps_me_ctxt->pf_ime_compute_sad_16x16[1] = ime_compute_sad_16x16_fast_sse42;
139         ps_me_ctxt->pf_ime_compute_sad_16x8 = ime_compute_sad_16x8_sse42;
140         ps_me_ctxt->pf_ime_compute_sad4_diamond = ime_calculate_sad4_prog_sse42;
141         ps_me_ctxt->pf_ime_sub_pel_compute_sad_16x16 = ime_sub_pel_compute_sad_16x16_sse42;
142         ps_me_ctxt->pf_ime_compute_sad_stat_luma_16x16 = ime_compute_satqd_16x16_lumainter_sse42;
143     }
144 }
145