blob: 98c656974f4996e02585a72c163246d850a36997 [file] [log] [blame]
Yaowu Xuc27fc142016-08-22 16:08:15 -07001/*
James Zernb7c05bd2024-06-11 19:15:10 -07002 * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
Yaowu Xuc27fc142016-08-22 16:08:15 -07003 *
Yaowu Xu9c01aa12016-09-01 14:32:49 -07004 * 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 Xuc27fc142016-08-22 16:08:15 -070010 */
11
James Zerne1cbb132018-08-22 14:10:36 -070012#ifndef AOM_AOM_DSP_QUANTIZE_H_
13#define AOM_AOM_DSP_QUANTIZE_H_
Yaowu Xuc27fc142016-08-22 16:08:15 -070014
Tom Finegan60e653d2018-05-22 11:34:58 -070015#include "config/aom_config.h"
16
Yaowu Xuf883b422016-08-30 14:01:10 -070017#include "aom_dsp/aom_dsp_common.h"
Yaowu Xuc27fc142016-08-22 16:08:15 -070018
19#ifdef __cplusplus
20extern "C" {
21#endif
22
Yaowu Xua6f54e02021-07-15 09:24:20 -070023#define EOB_FACTOR 325
24#define SKIP_EOB_FACTOR_ADJUST 200
25
Yaowu Xubbaa9662019-05-06 11:17:03 -070026void aom_quantize_b_adaptive_helper_c(
Sarah Parkere343b8c2019-01-22 15:11:32 -080027 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
34void 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
43void 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
50void 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 Jiangf8cc1c42019-08-02 16:34:32 -070057#if CONFIG_AV1_HIGHBITDEPTH
Yaowu Xubbaa9662019-05-06 11:17:03 -070058void aom_highbd_quantize_b_adaptive_helper_c(
Sarah Parkere343b8c2019-01-22 15:11:32 -080059 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
66void 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
73void 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
80void 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 Jiangf8cc1c42019-08-02 16:34:32 -070086#endif // CONFIG_AV1_HIGHBITDEPTH
Sarah Parkere343b8c2019-01-22 15:11:32 -080087
Yaowu Xubbaa9662019-05-06 11:17:03 -070088void 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 Daviesf3b5ee12017-07-18 15:16:43 +010097
Yaowu Xuf883b422016-08-30 14:01:10 -070098void aom_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
Peng Binf36be562018-09-07 15:28:46 +080099 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 Daviesf3b5ee12017-07-18 15:16:43 +0100104
Jerome Jiangf8cc1c42019-08-02 16:34:32 -0700105#if CONFIG_AV1_HIGHBITDEPTH
Yaowu Xubbaa9662019-05-06 11:17:03 -0700106void aom_highbd_quantize_b_helper_c(
Peng Bin6b971982018-09-07 15:21:40 +0800107 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 Davies181fc082017-08-09 14:26:53 +0100109 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 Daviesf3b5ee12017-07-18 15:16:43 +0100114void aom_highbd_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
Peng Bin6b971982018-09-07 15:21:40 +0800115 const int16_t *zbin_ptr, const int16_t *round_ptr,
116 const int16_t *quant_ptr,
Thomas Daviesf3b5ee12017-07-18 15:16:43 +0100117 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 Jiangf8cc1c42019-08-02 16:34:32 -0700121#endif // CONFIG_AV1_HIGHBITDEPTH
Thomas Daviesf3b5ee12017-07-18 15:16:43 +0100122
Yaowu Xuc27fc142016-08-22 16:08:15 -0700123#ifdef __cplusplus
124} // extern "C"
125#endif
126
James Zerne1cbb132018-08-22 14:10:36 -0700127#endif // AOM_AOM_DSP_QUANTIZE_H_