lin
2025-08-01 633231e833e21d5b8b1c00cb15aedb62b3b78e8f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/******************************************************************************
 *
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *****************************************************************************
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
/*!
******************************************************************************
* \file ihevce_tu_tree_selector.h
*
* \brief
*    This file contains definitions and declarations used for TU tree selection
*
* \date
*    20/04/2016
*
* \author
*    Ittiam
*
******************************************************************************
*/
 
#ifndef _TU_TREE_SELECTOR_
#define _TU_TREE_SELECTOR_
 
/*****************************************************************************/
/* Structures                                                                */
/*****************************************************************************/
typedef struct
{
    void *pv_src;
 
    void *pv_pred;
 
    void *pv_recon;
 
    WORD32 i4_src_stride;
 
    WORD32 i4_pred_stride;
 
    WORD32 i4_recon_stride;
 
} src_pred_rec_buf_t;
 
typedef struct
{
    src_pred_rec_buf_t s_src_pred_rec_buf_luma;
 
    src_pred_rec_buf_t s_src_pred_rec_buf_chroma;
 
    nbr_4x4_t *ps_nbr_data_buf;
 
    WORD16 *pi2_deq_data;
 
    WORD16 *pi2_deq_data_chroma;
 
    UWORD8 **ppu1_ecd;
 
    WORD32 i4_nbr_data_buf_stride;
 
    WORD32 i4_deq_data_stride;
 
    WORD32 i4_deq_data_stride_chroma;
 
} buffer_data_for_tu_t;
 
/*****************************************************************************/
/* Extern Function Declarations                                              */
/*****************************************************************************/
extern WORD32 ihevce_tu_tree_coverage_in_cu(tu_tree_node_t *ps_node);
 
extern UWORD16 ihevce_tu_tree_init(
    tu_tree_node_t *ps_root,
    UWORD8 u1_cu_size,
    UWORD8 u1_min_tree_depth,
    UWORD8 u1_max_tree_depth,
    UWORD8 u1_chroma_processing_enabled,
    UWORD8 u1_is_422);
#if !ENABLE_TOP_DOWN_TU_RECURSION
extern LWORD64 ihevce_tu_tree_selector(
    ihevce_enc_loop_ctxt_t *ps_ctxt,
    tu_tree_node_t *ps_node,
    buffer_data_for_tu_t *ps_buffer_data,
    UWORD8 *pu1_cabac_ctxt,
    WORD32 i4_pred_mode,
#if USE_NOISE_TERM_IN_ZERO_CODING_DECISION_ALGORITHMS
    WORD32 i4_alpha_stim_multiplier,
    UWORD8 u1_is_cu_noisy,
#endif
    UWORD8 u1_cur_depth,
    UWORD8 u1_max_depth,
    UWORD8 u1_part_type,
    UWORD8 u1_compute_spatial_ssd);
#endif
extern LWORD64 ihevce_topDown_tu_tree_selector(
    ihevce_enc_loop_ctxt_t *ps_ctxt,
    tu_tree_node_t *ps_node,
    buffer_data_for_tu_t *ps_buffer_data,
    UWORD8 *pu1_cabac_ctxt,
    WORD32 i4_pred_mode,
#if USE_NOISE_TERM_IN_ZERO_CODING_DECISION_ALGORITHMS
    WORD32 i4_alpha_stim_multiplier,
    UWORD8 u1_is_cu_noisy,
#endif
    UWORD8 u1_cur_depth,
    UWORD8 u1_max_depth,
    UWORD8 u1_part_type,
    UWORD8 u1_chroma_processing_enabled,
    UWORD8 u1_compute_spatial_ssd);
 
extern void ihevce_tu_selector_debriefer(
    tu_tree_node_t *ps_node,
    enc_loop_cu_final_prms_t *ps_final_prms,
    LWORD64 *pi8_total_cost,
    LWORD64 *pi8_total_non_coded_cost,
    WORD32 *pi4_num_bytes_used_for_ecd,
    WORD32 *pi4_num_bits_used_for_encoding,
    UWORD16 *pu2_tu_ctr,
    WORD32 i4_cu_qp,
    UWORD8 u1_cu_posx,
    UWORD8 u1_cu_posy,
    UWORD8 u1_chroma_processing_enabled,
    UWORD8 u1_is_422,
    TU_POS_T e_tu_pos);
 
extern void ihevce_tuSplitArray_to_tuTree_mapper(
    tu_tree_node_t *ps_root,
    WORD32 ai4_tuSplitArray[4],
    UWORD8 u1_cu_size,
    UWORD8 u1_tu_size,
    UWORD8 u1_min_tu_size,
    UWORD8 u1_max_tu_size,
    UWORD8 u1_is_skip);
 
#endif