1 /*
2 * Copyright(c) 2019 Intel Corporation
3 *
4 * This source code is subject to the terms of the BSD 2 Clause License and
5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 * was not distributed with this source code in the LICENSE file, you can
7 * obtain it at https://www.aomedia.org/license/software-license. If the Alliance for Open
8 * Media Patent License 1.0 was not distributed with this source code in the
9 * PATENTS file, you can obtain it at https://www.aomedia.org/license/patent-license.
10 */
11 
12 #ifndef EbFullLoop_h
13 #define EbFullLoop_h
14 
15 #include "EbModeDecisionProcess.h"
16 #include "EbCommonUtils.h"
17 #include "EbInvTransforms.h"
18 #include "EbTransforms.h"
19 #include "EbDefinitions.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 void full_loop_r(SuperBlock *sb_ptr, ModeDecisionCandidateBuffer *candidate_buffer,
26                  ModeDecisionContext *context_ptr, EbPictureBufferDesc *input_picture_ptr,
27                  PictureControlSet *pcs_ptr, uint32_t component_mask, uint32_t cb_qindex,
28                  uint32_t cr_qindex, uint32_t *cb_count_non_zero_coeffs,
29                  uint32_t *cr_count_non_zero_coeffs);
30 
31 void cu_full_distortion_fast_txb_mode_r(
32     SuperBlock *sb_ptr, ModeDecisionCandidateBuffer *candidate_buffer,
33     ModeDecisionContext *context_ptr, ModeDecisionCandidate *candidate_ptr,
34     PictureControlSet *pcs_ptr, EbPictureBufferDesc *input_picture_ptr,
35     uint64_t cb_full_distortion[DIST_CALC_TOTAL], uint64_t cr_full_distortion[DIST_CALC_TOTAL],
36     uint32_t count_non_zero_coeffs[3][MAX_NUM_OF_TU_PER_CU], COMPONENT_TYPE component_type,
37     uint64_t *cb_coeff_bits, uint64_t *cr_coeff_bits, EbBool is_full_loop);
38 
39 void inv_transform_recon_wrapper(uint8_t *pred_buffer, uint32_t pred_offset, uint32_t pred_stride,
40                                  uint8_t *rec_buffer, uint32_t rec_offset, uint32_t rec_stride,
41                                  int32_t *rec_coeff_buffer, uint32_t coeff_offset, EbBool hbd,
42                                  TxSize txsize, TxType transform_type, PlaneType component_type,
43                                  uint32_t eob);
44 
45 extern uint32_t d2_inter_depth_block_decision(SequenceControlSet* scs_ptr,
46                                               PictureControlSet* pcs_ptr,
47                                               ModeDecisionContext* context_ptr,
48                                               uint32_t blk_mds,
49                                               uint32_t sb_addr);
50 // compute the cost of curr depth, and the depth above
51 extern void compute_depth_costs_md_skip(ModeDecisionContext *    context_ptr,
52                                         SequenceControlSet *     scs_ptr,
53                                         PictureParentControlSet *pcs_ptr, uint32_t above_depth_mds,
54                                         uint32_t step, uint64_t *above_depth_cost,
55                                         uint64_t *curr_depth_cost);
56 uint64_t    d1_non_square_block_decision(ModeDecisionContext *context_ptr, uint32_t d1_block_itr);
57 
58 static const int av1_get_tx_scale_tab[TX_SIZES_ALL] = {
59     0, 0, 0, 1, 2, 0, 0, 0, 0, 1, 1, 2, 2, 0, 0, 0, 0, 1, 1};
60 
61 static const TxSize get_txsize_entropy_ctx_tab[TX_SIZES_ALL] = {
62     0, 1, 2, 3, 4, 1, 1, 2, 2, 3, 3, 4, 4, 1, 1, 2, 2, 3, 3};
63 
64 static const int get_txb_bwl_tab[TX_SIZES_ALL] = {
65     2, 3, 4, 5, 5, 2, 3, 3, 4, 4, 5, 5, 5, 2, 4, 3, 5, 4, 5};
66 
67 static const int get_txb_wide_tab[TX_SIZES_ALL] = {
68     4, 8, 16, 32, 32, 4, 8, 8, 16, 16, 32, 32, 32, 4, 16, 8, 32, 16, 32};
69 
70 static const int get_txb_high_tab[TX_SIZES_ALL] = {
71     4, 8, 16, 32, 32, 8, 4, 16, 8, 32, 16, 32, 32, 16, 4, 32, 8, 32, 16};
72 #ifdef __cplusplus
73 }
74 #endif
75 #endif // EbFullLoop_h
76