xref: /aosp_15_r20/external/libavc/decoder/x86/svc/isvcd_function_selector_sse42.c (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
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 *  isvcd_function_selector_sse42.c
24 *
25 * @brief
26 *  Contains functions to initialize function pointers of codec context
27 *
28 * @author
29 *  Kishore
30 *
31 * @par List of Functions:
32 *  - isvcd_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 "isvcd_structs.h"
52 #include "ih264d_function_selector.h"
53 
54 /**
55  *******************************************************************************
56  *
57  * @brief Initialize the intra/inter/transform/deblk function pointers of
58  * codec context
59  *
60  * @par Description: the current routine initializes the function pointers of
61  * codec context based on x86_sse42 arch in use for svc
62  *
63  * @param[in] ps_svc_lyr_dec
64  *  svc dec layer context pointer
65  *
66  * @returns  none
67  *
68  * @remarks none
69  *
70  *******************************************************************************
71  */
isvcd_init_function_ptr_sse42(svc_dec_lyr_struct_t * ps_svc_lyr_dec)72 void isvcd_init_function_ptr_sse42(svc_dec_lyr_struct_t *ps_svc_lyr_dec)
73 {
74     dec_struct_t *ps_codec = &ps_svc_lyr_dec->s_dec;
75     residual_sampling_ctxt_t *ps_resd_samp_ctx;
76     intra_sampling_ctxt_t *ps_intra_samp_ctxt;
77     /* call default init func prt sse42 */
78     ih264d_init_function_ptr_sse42(ps_codec);
79 
80     ps_resd_samp_ctx = (residual_sampling_ctxt_t *) ps_svc_lyr_dec->pv_residual_sample_ctxt;
81     ps_intra_samp_ctxt = (intra_sampling_ctxt_t *) ps_svc_lyr_dec->pv_intra_sample_ctxt;
82 
83     ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_4x4 =
84         isvcd_iquant_itrans_residual_recon_4x4_sse42;
85     ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_4x4_dc =
86         isvcd_iquant_itrans_residual_recon_4x4_dc_sse42;
87     ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_8x8 =
88         isvcd_iquant_itrans_residual_recon_8x8_sse42;
89     ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_luma_8x8_dc =
90         isvcd_iquant_itrans_residual_recon_8x8_dc_sse42;
91     ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_chroma_4x4 =
92         isvcd_iquant_itrans_residual_recon_chroma_4x4_sse42;
93     ps_svc_lyr_dec->pf_iquant_itrans_residual_recon_chroma_4x4_dc =
94         isvcd_iquant_itrans_residual_recon_chroma_4x4_dc_sse42;
95 
96     ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_4x4 = isvcd_iquant_itrans_residual_4x4_sse42;
97     ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_4x4_dc =
98         isvcd_iquant_itrans_residual_4x4_dc_sse42;
99     ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_8x8 = isvcd_iquant_itrans_residual_8x8_sse42;
100     ps_svc_lyr_dec->pf_iquant_itrans_residual_luma_8x8_dc =
101         isvcd_iquant_itrans_residual_8x8_dc_sse42;
102     ps_svc_lyr_dec->pf_iquant_itrans_residual_chroma_4x4 =
103         isvcd_iquant_itrans_residual_chroma_4x4_sse42;
104     ps_svc_lyr_dec->pf_iquant_itrans_residual_chroma_4x4_dc =
105         isvcd_iquant_itrans_residual_chroma_4x4_dc_sse42;
106 
107     ps_svc_lyr_dec->pf_pred_residual_recon_luma_4x4 = isvcd_pred_residual_recon_4x4_sse42;
108     ps_svc_lyr_dec->pf_pred_residual_recon_luma_8x8 = isvcd_pred_residual_recon_8x8_sse42;
109     ps_svc_lyr_dec->pf_pred_residual_recon_luma_16x16 = isvcd_pred_residual_recon_16x16_sse42;
110     ps_svc_lyr_dec->pf_pred_residual_recon_chroma_4x4 = isvcd_pred_residual_recon_chroma_4x4_sse42;
111     ps_svc_lyr_dec->pf_pred_residual_recon_chroma_8x8 = isvcd_pred_residual_recon_chroma_8x8_sse42;
112 
113     ps_svc_lyr_dec->pf_residual_luma_4x4 = isvcd_residual_luma_4x4_sse42;
114     ps_svc_lyr_dec->pf_residual_luma_8x8 = isvcd_residual_luma_8x8_sse42;
115     ps_svc_lyr_dec->pf_residual_luma_16x16 = isvcd_residual_luma_16x16_sse42;
116     ps_svc_lyr_dec->pf_residual_chroma_cb_cr_8x8 = isvcd_residual_chroma_cb_cr_8x8_sse42;
117 
118     ps_svc_lyr_dec->pf_iquant_itrans_luma_4x4 = isvcd_iquant_itrans_4x4_sse42;
119     ps_svc_lyr_dec->pf_iquant_itrans_luma_4x4_dc = isvcd_iquant_itrans_4x4_dc_sse42;
120     ps_svc_lyr_dec->pf_iquant_itrans_luma_8x8 = isvcd_iquant_itrans_8x8_sse42;
121     ps_svc_lyr_dec->pf_iquant_itrans_luma_8x8_dc = isvcd_iquant_itrans_8x8_dc_sse42;
122     ps_svc_lyr_dec->pf_iquant_itrans_chroma_4x4 = isvcd_iquant_itrans_chroma_4x4_sse42;
123     ps_svc_lyr_dec->pf_iquant_itrans_chroma_4x4_dc = isvcd_iquant_itrans_chroma_4x4_dc_sse42;
124 
125     ps_intra_samp_ctxt->pf_interpolate_base_luma_dyadic = isvcd_interpolate_base_luma_dyadic_sse42;
126     ps_intra_samp_ctxt->pf_interpolate_intra_base = isvcd_interpolate_intra_base_sse42;
127 
128     ps_intra_samp_ctxt->pf_vert_chroma_interpol[0] = isvcd_vert_interpol_chroma_dyadic_1_sse42;
129     ps_intra_samp_ctxt->pf_vert_chroma_interpol[1] = isvcd_vert_interpol_chroma_dyadic_2_sse42;
130     ps_intra_samp_ctxt->pf_vert_chroma_interpol[2] = isvcd_vert_interpol_chroma_dyadic_3_sse42;
131 
132     ps_intra_samp_ctxt->pf_horz_chroma_interpol[0] = isvcd_horz_interpol_chroma_dyadic_1_sse42;
133     ps_intra_samp_ctxt->pf_horz_chroma_interpol[1] = isvcd_horz_interpol_chroma_dyadic_2_sse42;
134 
135     ps_resd_samp_ctx->pf_residual_luma_dyadic = isvcd_residual_luma_dyadic_sse42;
136     ps_resd_samp_ctx->pf_interpolate_residual = isvcd_interpolate_residual_sse42;
137     ps_resd_samp_ctx->pf_residual_reflayer_const_non_boundary_mb =
138         isvcd_residual_reflayer_const_non_boundary_mb_sse42;
139 
140     return;
141 }
142