• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright (C) 2018 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 ihevce_decomp_pre_intra_pass.h
23 *
24 * \brief
25 *    This file contains declarations related to frame decomposition done during
26 *    pre intra processing
27 *
28 * \date
29 *    18/09/2012
30 *
31 * \author
32 *    Ittiam
33 *
34 ******************************************************************************
35 */
36 
37 #ifndef _IHEVCE_DECOMP_PRE_INTRA_PASS_H_
38 #define _IHEVCE_DECOMP_PRE_INTRA_PASS_H_
39 
40 /*****************************************************************************/
41 /* Typedefs                                                                  */
42 /*****************************************************************************/
43 
44 /*****************************************************************************/
45 /* Globals                                                                   */
46 /*****************************************************************************/
47 extern WORD32 g_i4_ip_funcs[MAX_NUM_IP_MODES];
48 
49 /*****************************************************************************/
50 /* Constant Macros                                                           */
51 /*****************************************************************************/
52 #define POW_2_TO_1_BY_4 (1.1892)
53 #define POW_2_TO_3_BY_4 (1.6818)
54 
55 /*****************************************************************************/
56 /* Extern Function Declarations                                              */
57 /*****************************************************************************/
58 void ihevce_ed_4x4_find_best_modes(
59     UWORD8 *pu1_src,
60     WORD32 src_stride,
61     UWORD8 *pu1_nbr,
62     UWORD16 *pu2_mode_bits_cost,
63     UWORD8 *pu1_best_modes,
64     WORD32 *pu1_best_sad_costs,
65     WORD32 u1_low_resol,
66     FT_SAD_COMPUTER *pf_4x4_sad_computer);
67 
68 WORD32 ihevce_decomp_pre_intra_get_num_mem_recs(void);
69 
70 WORD32 ihevce_decomp_pre_intra_get_mem_recs(
71     iv_mem_rec_t *ps_mem_tab, WORD32 i4_num_proc_thrds, WORD32 i4_mem_space);
72 
73 void *ihevce_decomp_pre_intra_init(
74     iv_mem_rec_t *ps_mem_tab,
75     ihevce_static_cfg_params_t *ps_init_prms,
76     WORD32 i4_num_proc_thrds,
77     func_selector_t *ps_func_selector,
78     WORD32 i4_resolution_id,
79     UWORD8 u1_is_popcnt_available);
80 
81 void ihevce_decomp_pre_intra_process(
82     void *pv_ctxt,
83     ihevce_lap_output_params_t *ps_lap_out_prms,
84     frm_ctb_ctxt_t *ps_frm_ctb_prms,
85     void *pv_multi_thrd_ctxt,
86     WORD32 thrd_id,
87     WORD32 i4_ping_pong,
88     ihevce_8x8_L0_satd_t *ps_layer0_cur_satd,
89     ihevce_8x8_L0_mean_t *ps_layer0_cur_mean);
90 
91 void ihevce_decomp_pre_intra_frame_init(
92     void *pv_ctxt,
93     UWORD8 **ppu1_decomp_lyr_bufs,
94     WORD32 *pi4_lyr_buf_stride,
95     ihevce_ed_blk_t *ps_layer1_buf,
96     ihevce_ed_blk_t *ps_layer2_buf,
97     ihevce_ed_ctb_l1_t *ps_ed_ctb_l1,
98     WORD32 i4_ol_sad_lambda_qf,
99     WORD32 i4_slice_type,
100     ctb_analyse_t *ps_ctb_analyse);
101 
102 /* Calculate the average activitiies at 16*16 (8*8 in L1)
103 and 32*32  (8*8 in L2) block sizes */
104 void ihevce_decomp_pre_intra_curr_frame_pre_intra_deinit(
105     void *pv_pre_intra_ctxt,
106     pre_enc_me_ctxt_t *ps_curr_out,
107     WORD32 i4_is_last_thread,
108     frm_ctb_ctxt_t *ps_frm_ctb_prms,
109     WORD32 i4_temporal_lyr_id,
110     WORD32 i4_enable_noise_detection);
111 
112 void ihevce_scale_by_2(
113     UWORD8 *pu1_src,
114     WORD32 src_stride,
115     UWORD8 *pu1_dst,
116     WORD32 dst_stride,
117     WORD32 wd,
118     WORD32 ht,
119     UWORD8 *pu1_wkg_mem,
120     WORD32 ht_offset,
121     WORD32 block_ht,
122     WORD32 wd_offset,
123     WORD32 block_wd,
124     FT_COPY_2D *pf_copy_2d,
125     FT_SCALING_FILTER_BY_2 *pf_scaling_filter_mxn);
126 
127 void ihevce_ed_frame_init(void *pv_ed_ctxt, WORD32 i4_layer_no);
128 
129 void ihevce_intra_populate_mode_bits_cost(
130     WORD32 top_intra_mode,
131     WORD32 left_intra_mode,
132     WORD32 available_top,
133     WORD32 available_left,
134     WORD32 cu_pos_y,
135     UWORD16 *mode_bits_cost,
136     WORD32 lambda);
137 
138 WORD32 ihevce_cu_level_qp_mod(
139     WORD32 i4_qscale,
140     WORD32 i4_satd,
141     long double ld_curr_frame_log_avg,
142     float f_mod_strength,
143     WORD32 *pi4_8x8_act_factor,
144     WORD32 *pi4_qscale_mod,
145     rc_quant_t *ps_rc_quant_ctxt);
146 
147 /*return intra SATD of entire frame*/
148 LWORD64 ihevce_decomp_pre_intra_get_frame_satd(void *pv_ctxt, WORD32 *i4_width, WORD32 *i4_hieght);
149 
150 LWORD64 ihevce_decomp_pre_intra_get_frame_satd_squared(
151     void *pv_ctxt, WORD32 *i4_width, WORD32 *i4_hieght);
152 
153 #endif
154