• 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_tu_tree_selector.h
23 *
24 * \brief
25 *    This file contains definitions and declarations used for TU tree selection
26 *
27 * \date
28 *    20/04/2016
29 *
30 * \author
31 *    Ittiam
32 *
33 ******************************************************************************
34 */
35 
36 #ifndef _TU_TREE_SELECTOR_
37 #define _TU_TREE_SELECTOR_
38 
39 /*****************************************************************************/
40 /* Structures                                                                */
41 /*****************************************************************************/
42 typedef struct
43 {
44     void *pv_src;
45 
46     void *pv_pred;
47 
48     void *pv_recon;
49 
50     WORD32 i4_src_stride;
51 
52     WORD32 i4_pred_stride;
53 
54     WORD32 i4_recon_stride;
55 
56 } src_pred_rec_buf_t;
57 
58 typedef struct
59 {
60     src_pred_rec_buf_t s_src_pred_rec_buf_luma;
61 
62     src_pred_rec_buf_t s_src_pred_rec_buf_chroma;
63 
64     nbr_4x4_t *ps_nbr_data_buf;
65 
66     WORD16 *pi2_deq_data;
67 
68     WORD16 *pi2_deq_data_chroma;
69 
70     UWORD8 **ppu1_ecd;
71 
72     WORD32 i4_nbr_data_buf_stride;
73 
74     WORD32 i4_deq_data_stride;
75 
76     WORD32 i4_deq_data_stride_chroma;
77 
78 } buffer_data_for_tu_t;
79 
80 /*****************************************************************************/
81 /* Extern Function Declarations                                              */
82 /*****************************************************************************/
83 extern WORD32 ihevce_tu_tree_coverage_in_cu(tu_tree_node_t *ps_node);
84 
85 extern UWORD16 ihevce_tu_tree_init(
86     tu_tree_node_t *ps_root,
87     UWORD8 u1_cu_size,
88     UWORD8 u1_min_tree_depth,
89     UWORD8 u1_max_tree_depth,
90     UWORD8 u1_chroma_processing_enabled,
91     UWORD8 u1_is_422);
92 #if !ENABLE_TOP_DOWN_TU_RECURSION
93 extern LWORD64 ihevce_tu_tree_selector(
94     ihevce_enc_loop_ctxt_t *ps_ctxt,
95     tu_tree_node_t *ps_node,
96     buffer_data_for_tu_t *ps_buffer_data,
97     UWORD8 *pu1_cabac_ctxt,
98     WORD32 i4_pred_mode,
99 #if USE_NOISE_TERM_IN_ZERO_CODING_DECISION_ALGORITHMS
100     WORD32 i4_alpha_stim_multiplier,
101     UWORD8 u1_is_cu_noisy,
102 #endif
103     UWORD8 u1_cur_depth,
104     UWORD8 u1_max_depth,
105     UWORD8 u1_part_type,
106     UWORD8 u1_compute_spatial_ssd);
107 #endif
108 extern LWORD64 ihevce_topDown_tu_tree_selector(
109     ihevce_enc_loop_ctxt_t *ps_ctxt,
110     tu_tree_node_t *ps_node,
111     buffer_data_for_tu_t *ps_buffer_data,
112     UWORD8 *pu1_cabac_ctxt,
113     WORD32 i4_pred_mode,
114 #if USE_NOISE_TERM_IN_ZERO_CODING_DECISION_ALGORITHMS
115     WORD32 i4_alpha_stim_multiplier,
116     UWORD8 u1_is_cu_noisy,
117 #endif
118     UWORD8 u1_cur_depth,
119     UWORD8 u1_max_depth,
120     UWORD8 u1_part_type,
121     UWORD8 u1_chroma_processing_enabled,
122     UWORD8 u1_compute_spatial_ssd);
123 
124 extern void ihevce_tu_selector_debriefer(
125     tu_tree_node_t *ps_node,
126     enc_loop_cu_final_prms_t *ps_final_prms,
127     LWORD64 *pi8_total_cost,
128     LWORD64 *pi8_total_non_coded_cost,
129     WORD32 *pi4_num_bytes_used_for_ecd,
130     WORD32 *pi4_num_bits_used_for_encoding,
131     UWORD16 *pu2_tu_ctr,
132     WORD32 i4_cu_qp,
133     UWORD8 u1_cu_posx,
134     UWORD8 u1_cu_posy,
135     UWORD8 u1_chroma_processing_enabled,
136     UWORD8 u1_is_422,
137     TU_POS_T e_tu_pos);
138 
139 extern void ihevce_tuSplitArray_to_tuTree_mapper(
140     tu_tree_node_t *ps_root,
141     WORD32 ai4_tuSplitArray[4],
142     UWORD8 u1_cu_size,
143     UWORD8 u1_tu_size,
144     UWORD8 u1_min_tu_size,
145     UWORD8 u1_max_tu_size,
146     UWORD8 u1_is_skip);
147 
148 #endif
149