Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
James Zern | b7c05bd | 2024-06-11 19:15:10 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved. |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 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. |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 12 | #ifndef AOM_AOM_DSP_QUANTIZE_H_ |
| 13 | #define AOM_AOM_DSP_QUANTIZE_H_ |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 14 | |
Tom Finegan | 60e653d | 2018-05-22 11:34:58 -0700 | [diff] [blame] | 15 | #include "config/aom_config.h" |
| 16 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 17 | #include "aom_dsp/aom_dsp_common.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
Yaowu Xu | a6f54e0 | 2021-07-15 09:24:20 -0700 | [diff] [blame] | 23 | #define EOB_FACTOR 325 |
| 24 | #define SKIP_EOB_FACTOR_ADJUST 200 |
| 25 | |
Yaowu Xu | bbaa966 | 2019-05-06 11:17:03 -0700 | [diff] [blame] | 26 | void aom_quantize_b_adaptive_helper_c( |
Sarah Parker | e343b8c | 2019-01-22 15:11:32 -0800 | [diff] [blame] | 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 | |
Jerome Jiang | f8cc1c4 | 2019-08-02 16:34:32 -0700 | [diff] [blame] | 57 | #if CONFIG_AV1_HIGHBITDEPTH |
Yaowu Xu | bbaa966 | 2019-05-06 11:17:03 -0700 | [diff] [blame] | 58 | void aom_highbd_quantize_b_adaptive_helper_c( |
Sarah Parker | e343b8c | 2019-01-22 15:11:32 -0800 | [diff] [blame] | 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); |
Jerome Jiang | f8cc1c4 | 2019-08-02 16:34:32 -0700 | [diff] [blame] | 86 | #endif // CONFIG_AV1_HIGHBITDEPTH |
Sarah Parker | e343b8c | 2019-01-22 15:11:32 -0800 | [diff] [blame] | 87 | |
Yaowu Xu | bbaa966 | 2019-05-06 11:17:03 -0700 | [diff] [blame] | 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); |
Thomas Davies | f3b5ee1 | 2017-07-18 15:16:43 +0100 | [diff] [blame] | 97 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 98 | void aom_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, |
Peng Bin | f36be56 | 2018-09-07 15:28:46 +0800 | [diff] [blame] | 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); |
Thomas Davies | f3b5ee1 | 2017-07-18 15:16:43 +0100 | [diff] [blame] | 104 | |
Jerome Jiang | f8cc1c4 | 2019-08-02 16:34:32 -0700 | [diff] [blame] | 105 | #if CONFIG_AV1_HIGHBITDEPTH |
Yaowu Xu | bbaa966 | 2019-05-06 11:17:03 -0700 | [diff] [blame] | 106 | void aom_highbd_quantize_b_helper_c( |
Peng Bin | 6b97198 | 2018-09-07 15:21:40 +0800 | [diff] [blame] | 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, |
Thomas Davies | 181fc08 | 2017-08-09 14:26:53 +0100 | [diff] [blame] | 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 | |
Thomas Davies | f3b5ee1 | 2017-07-18 15:16:43 +0100 | [diff] [blame] | 114 | void aom_highbd_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs, |
Peng Bin | 6b97198 | 2018-09-07 15:21:40 +0800 | [diff] [blame] | 115 | const int16_t *zbin_ptr, const int16_t *round_ptr, |
| 116 | const int16_t *quant_ptr, |
Thomas Davies | f3b5ee1 | 2017-07-18 15:16:43 +0100 | [diff] [blame] | 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); |
Jerome Jiang | f8cc1c4 | 2019-08-02 16:34:32 -0700 | [diff] [blame] | 121 | #endif // CONFIG_AV1_HIGHBITDEPTH |
Thomas Davies | f3b5ee1 | 2017-07-18 15:16:43 +0100 | [diff] [blame] | 122 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 123 | #ifdef __cplusplus |
| 124 | } // extern "C" |
| 125 | #endif |
| 126 | |
James Zern | e1cbb13 | 2018-08-22 14:10:36 -0700 | [diff] [blame] | 127 | #endif // AOM_AOM_DSP_QUANTIZE_H_ |