xref: /aosp_15_r20/external/libaom/aom_dsp/quantize.h (revision 77c1e3ccc04c968bd2bc212e87364f250e820521)
1 /*
2  * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
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 www.aomedia.org/license/software. 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 www.aomedia.org/license/patent.
10  */
11 
12 #ifndef AOM_AOM_DSP_QUANTIZE_H_
13 #define AOM_AOM_DSP_QUANTIZE_H_
14 
15 #include "config/aom_config.h"
16 
17 #include "aom_dsp/aom_dsp_common.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 #define EOB_FACTOR 325
24 #define SKIP_EOB_FACTOR_ADJUST 200
25 
26 void aom_quantize_b_adaptive_helper_c(
27     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
28     const int16_t *round_ptr, const int16_t *quant_ptr,
29     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
30     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
31     const int16_t *scan, const int16_t *iscan, const qm_val_t *qm_ptr,
32     const qm_val_t *iqm_ptr, const int log_scale);
33 
34 void aom_quantize_b_adaptive_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
35                                const int16_t *zbin_ptr,
36                                const int16_t *round_ptr,
37                                const int16_t *quant_ptr,
38                                const int16_t *quant_shift_ptr,
39                                tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
40                                const int16_t *dequant_ptr, uint16_t *eob_ptr,
41                                const int16_t *scan, const int16_t *iscan);
42 
43 void aom_quantize_b_32x32_adaptive_c(
44     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
45     const int16_t *round_ptr, const int16_t *quant_ptr,
46     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
47     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
48     const int16_t *scan, const int16_t *iscan);
49 
50 void aom_quantize_b_64x64_adaptive_c(
51     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
52     const int16_t *round_ptr, const int16_t *quant_ptr,
53     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
54     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
55     const int16_t *scan, const int16_t *iscan);
56 
57 #if CONFIG_AV1_HIGHBITDEPTH
58 void aom_highbd_quantize_b_adaptive_helper_c(
59     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
60     const int16_t *round_ptr, const int16_t *quant_ptr,
61     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
62     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
63     const int16_t *scan, const int16_t *iscan, const qm_val_t *qm_ptr,
64     const qm_val_t *iqm_ptr, const int log_scale);
65 
66 void aom_highbd_quantize_b_adaptive_c(
67     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
68     const int16_t *round_ptr, const int16_t *quant_ptr,
69     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
70     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
71     const int16_t *scan, const int16_t *iscan);
72 
73 void aom_highbd_quantize_b_32x32_adaptive_c(
74     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
75     const int16_t *round_ptr, const int16_t *quant_ptr,
76     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
77     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
78     const int16_t *scan, const int16_t *iscan);
79 
80 void aom_highbd_quantize_b_64x64_adaptive_c(
81     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
82     const int16_t *round_ptr, const int16_t *quant_ptr,
83     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
84     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
85     const int16_t *scan, const int16_t *iscan);
86 #endif  // CONFIG_AV1_HIGHBITDEPTH
87 
88 void aom_quantize_b_helper_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
89                              const int16_t *zbin_ptr, const int16_t *round_ptr,
90                              const int16_t *quant_ptr,
91                              const int16_t *quant_shift_ptr,
92                              tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
93                              const int16_t *dequant_ptr, uint16_t *eob_ptr,
94                              const int16_t *scan, const int16_t *iscan,
95                              const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr,
96                              const int log_scale);
97 
98 void aom_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
99                       const int16_t *zbin_ptr, const int16_t *round_ptr,
100                       const int16_t *quant_ptr, const int16_t *quant_shift_ptr,
101                       tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
102                       const int16_t *dequant_ptr, uint16_t *eob_ptr,
103                       const int16_t *scan, const int16_t *iscan);
104 
105 #if CONFIG_AV1_HIGHBITDEPTH
106 void aom_highbd_quantize_b_helper_c(
107     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
108     const int16_t *round_ptr, const int16_t *quant_ptr,
109     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
110     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
111     const int16_t *scan, const int16_t *iscan, const qm_val_t *qm_ptr,
112     const qm_val_t *iqm_ptr, const int log_scale);
113 
114 void aom_highbd_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
115                              const int16_t *zbin_ptr, const int16_t *round_ptr,
116                              const int16_t *quant_ptr,
117                              const int16_t *quant_shift_ptr,
118                              tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
119                              const int16_t *dequant_ptr, uint16_t *eob_ptr,
120                              const int16_t *scan, const int16_t *iscan);
121 #endif  // CONFIG_AV1_HIGHBITDEPTH
122 
123 #ifdef __cplusplus
124 }  // extern "C"
125 #endif
126 
127 #endif  // AOM_AOM_DSP_QUANTIZE_H_
128