• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "aom_dsp/quantize.h"
13 #include "aom_mem/aom_mem.h"
14 
aom_quantize_b_adaptive_helper_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan,const qm_val_t * qm_ptr,const qm_val_t * iqm_ptr,const int log_scale)15 void aom_quantize_b_adaptive_helper_c(
16     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
17     const int16_t *round_ptr, const int16_t *quant_ptr,
18     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
19     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
20     const int16_t *scan, const int16_t *iscan, const qm_val_t *qm_ptr,
21     const qm_val_t *iqm_ptr, const int log_scale) {
22   const int zbins[2] = { ROUND_POWER_OF_TWO(zbin_ptr[0], log_scale),
23                          ROUND_POWER_OF_TWO(zbin_ptr[1], log_scale) };
24   const int nzbins[2] = { zbins[0] * -1, zbins[1] * -1 };
25   int i, non_zero_count = (int)n_coeffs, eob = -1;
26   (void)iscan;
27 
28   memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
29   memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
30 
31   int prescan_add[2];
32   for (i = 0; i < 2; ++i)
33     prescan_add[i] = ROUND_POWER_OF_TWO(dequant_ptr[i] * EOB_FACTOR, 7);
34 
35   // Pre-scan pass
36   for (i = (int)n_coeffs - 1; i >= 0; i--) {
37     const int rc = scan[i];
38     const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
39     const int coeff = coeff_ptr[rc] * wt;
40     const int prescan_add_val = prescan_add[rc != 0];
41     if (coeff < (zbins[rc != 0] * (1 << AOM_QM_BITS) + prescan_add_val) &&
42         coeff > (nzbins[rc != 0] * (1 << AOM_QM_BITS) - prescan_add_val))
43       non_zero_count--;
44     else
45       break;
46   }
47 
48   // Quantization pass: All coefficients with index >= zero_flag are
49   // skippable. Note: zero_flag can be zero.
50 #if SKIP_EOB_FACTOR_ADJUST
51   int first = -1;
52 #endif  // SKIP_EOB_FACTOR_ADJUST
53   for (i = 0; i < non_zero_count; i++) {
54     const int rc = scan[i];
55     const int coeff = coeff_ptr[rc];
56     const int coeff_sign = AOMSIGN(coeff);
57     const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
58     int tmp32;
59 
60     const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
61     if (abs_coeff * wt >= (zbins[rc != 0] << AOM_QM_BITS)) {
62       int64_t tmp =
63           clamp(abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], log_scale),
64                 INT16_MIN, INT16_MAX);
65       tmp *= wt;
66       tmp32 = (int)(((((tmp * quant_ptr[rc != 0]) >> 16) + tmp) *
67                      quant_shift_ptr[rc != 0]) >>
68                     (16 - log_scale + AOM_QM_BITS));  // quantization
69       qcoeff_ptr[rc] = (tmp32 ^ coeff_sign) - coeff_sign;
70       const int iwt = iqm_ptr != NULL ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
71       const int dequant =
72           (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
73           AOM_QM_BITS;
74       const tran_low_t abs_dqcoeff = (tmp32 * dequant) >> log_scale;
75       dqcoeff_ptr[rc] = (tran_low_t)((abs_dqcoeff ^ coeff_sign) - coeff_sign);
76 
77       if (tmp32) {
78         eob = i;
79 #if SKIP_EOB_FACTOR_ADJUST
80         if (first == -1) first = i;
81 #endif  // SKIP_EOB_FACTOR_ADJUST
82       }
83     }
84   }
85 #if SKIP_EOB_FACTOR_ADJUST
86   if (eob >= 0 && first == eob) {
87     const int rc = scan[eob];
88     if (qcoeff_ptr[rc] == 1 || qcoeff_ptr[rc] == -1) {
89       const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
90       const int coeff = coeff_ptr[rc] * wt;
91       const int factor = EOB_FACTOR + SKIP_EOB_FACTOR_ADJUST;
92       const int prescan_add_val =
93           ROUND_POWER_OF_TWO(dequant_ptr[rc != 0] * factor, 7);
94       if (coeff < (zbins[rc != 0] * (1 << AOM_QM_BITS) + prescan_add_val) &&
95           coeff > (nzbins[rc != 0] * (1 << AOM_QM_BITS) - prescan_add_val)) {
96         qcoeff_ptr[rc] = 0;
97         dqcoeff_ptr[rc] = 0;
98         eob = -1;
99       }
100     }
101   }
102 #endif  // SKIP_EOB_FACTOR_ADJUST
103   *eob_ptr = eob + 1;
104 }
105 
aom_quantize_b_helper_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan,const qm_val_t * qm_ptr,const qm_val_t * iqm_ptr,const int log_scale)106 void aom_quantize_b_helper_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
107                              const int16_t *zbin_ptr, const int16_t *round_ptr,
108                              const int16_t *quant_ptr,
109                              const int16_t *quant_shift_ptr,
110                              tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
111                              const int16_t *dequant_ptr, uint16_t *eob_ptr,
112                              const int16_t *scan, const int16_t *iscan,
113                              const qm_val_t *qm_ptr, const qm_val_t *iqm_ptr,
114                              const int log_scale) {
115   const int zbins[2] = { ROUND_POWER_OF_TWO(zbin_ptr[0], log_scale),
116                          ROUND_POWER_OF_TWO(zbin_ptr[1], log_scale) };
117   const int nzbins[2] = { zbins[0] * -1, zbins[1] * -1 };
118   int i, non_zero_count = (int)n_coeffs, eob = -1;
119   (void)iscan;
120 
121   memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
122   memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
123 
124   // Pre-scan pass
125   for (i = (int)n_coeffs - 1; i >= 0; i--) {
126     const int rc = scan[i];
127     const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
128     const int coeff = coeff_ptr[rc] * wt;
129 
130     if (coeff < (zbins[rc != 0] * (1 << AOM_QM_BITS)) &&
131         coeff > (nzbins[rc != 0] * (1 << AOM_QM_BITS)))
132       non_zero_count--;
133     else
134       break;
135   }
136 
137   // Quantization pass: All coefficients with index >= zero_flag are
138   // skippable. Note: zero_flag can be zero.
139   for (i = 0; i < non_zero_count; i++) {
140     const int rc = scan[i];
141     const int coeff = coeff_ptr[rc];
142     const int coeff_sign = AOMSIGN(coeff);
143     const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
144     int tmp32;
145 
146     const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
147     if (abs_coeff * wt >= (zbins[rc != 0] << AOM_QM_BITS)) {
148       int64_t tmp =
149           clamp(abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], log_scale),
150                 INT16_MIN, INT16_MAX);
151       tmp *= wt;
152       tmp32 = (int)(((((tmp * quant_ptr[rc != 0]) >> 16) + tmp) *
153                      quant_shift_ptr[rc != 0]) >>
154                     (16 - log_scale + AOM_QM_BITS));  // quantization
155       qcoeff_ptr[rc] = (tmp32 ^ coeff_sign) - coeff_sign;
156       const int iwt = iqm_ptr != NULL ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
157       const int dequant =
158           (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
159           AOM_QM_BITS;
160       const tran_low_t abs_dqcoeff = (tmp32 * dequant) >> log_scale;
161       dqcoeff_ptr[rc] = (tran_low_t)((abs_dqcoeff ^ coeff_sign) - coeff_sign);
162 
163       if (tmp32) eob = i;
164     }
165   }
166   *eob_ptr = eob + 1;
167 }
168 
169 #if CONFIG_AV1_HIGHBITDEPTH
aom_highbd_quantize_b_adaptive_helper_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan,const qm_val_t * qm_ptr,const qm_val_t * iqm_ptr,const int log_scale)170 void aom_highbd_quantize_b_adaptive_helper_c(
171     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
172     const int16_t *round_ptr, const int16_t *quant_ptr,
173     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
174     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
175     const int16_t *scan, const int16_t *iscan, const qm_val_t *qm_ptr,
176     const qm_val_t *iqm_ptr, const int log_scale) {
177   const int zbins[2] = { ROUND_POWER_OF_TWO(zbin_ptr[0], log_scale),
178                          ROUND_POWER_OF_TWO(zbin_ptr[1], log_scale) };
179   const int nzbins[2] = { zbins[0] * -1, zbins[1] * -1 };
180   (void)iscan;
181   int i, non_zero_count = (int)n_coeffs, eob = -1;
182 
183   memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
184   memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
185 
186   int prescan_add[2];
187   for (i = 0; i < 2; ++i)
188     prescan_add[i] = ROUND_POWER_OF_TWO(dequant_ptr[i] * EOB_FACTOR, 7);
189 
190   // Pre-scan pass
191   for (i = (int)n_coeffs - 1; i >= 0; i--) {
192     const int rc = scan[i];
193     const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
194     const int coeff = coeff_ptr[rc] * wt;
195     const int prescan_add_val = prescan_add[rc != 0];
196     if (coeff < (zbins[rc != 0] * (1 << AOM_QM_BITS) + prescan_add_val) &&
197         coeff > (nzbins[rc != 0] * (1 << AOM_QM_BITS) - prescan_add_val))
198       non_zero_count--;
199     else
200       break;
201   }
202 
203   // Quantization pass: All coefficients with index >= zero_flag are
204   // skippable. Note: zero_flag can be zero.
205 #if SKIP_EOB_FACTOR_ADJUST
206   int first = -1;
207 #endif  // SKIP_EOB_FACTOR_ADJUST
208   for (i = 0; i < non_zero_count; i++) {
209     const int rc = scan[i];
210     const int coeff = coeff_ptr[rc];
211     const int coeff_sign = AOMSIGN(coeff);
212     const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
213     const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
214     if (abs_coeff * wt >= (zbins[rc != 0] << AOM_QM_BITS)) {
215       const int64_t tmp1 =
216           abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], log_scale);
217       const int64_t tmpw = tmp1 * wt;
218       const int64_t tmp2 = ((tmpw * quant_ptr[rc != 0]) >> 16) + tmpw;
219       const int abs_qcoeff = (int)((tmp2 * quant_shift_ptr[rc != 0]) >>
220                                    (16 - log_scale + AOM_QM_BITS));
221       qcoeff_ptr[rc] = (tran_low_t)((abs_qcoeff ^ coeff_sign) - coeff_sign);
222       const qm_val_t iwt = iqm_ptr != NULL ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
223       const int dequant =
224           (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >>
225           AOM_QM_BITS;
226       const tran_low_t abs_dqcoeff = (abs_qcoeff * dequant) >> log_scale;
227       dqcoeff_ptr[rc] = (tran_low_t)((abs_dqcoeff ^ coeff_sign) - coeff_sign);
228       if (abs_qcoeff) {
229         eob = i;
230 #if SKIP_EOB_FACTOR_ADJUST
231         if (first == -1) first = eob;
232 #endif  // SKIP_EOB_FACTOR_ADJUST
233       }
234     }
235   }
236 #if SKIP_EOB_FACTOR_ADJUST
237   if (eob >= 0 && first == eob) {
238     const int rc = scan[eob];
239     if (qcoeff_ptr[rc] == 1 || qcoeff_ptr[rc] == -1) {
240       const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
241       const int coeff = coeff_ptr[rc] * wt;
242       const int factor = EOB_FACTOR + SKIP_EOB_FACTOR_ADJUST;
243       const int prescan_add_val =
244           ROUND_POWER_OF_TWO(dequant_ptr[rc != 0] * factor, 7);
245       if (coeff < (zbins[rc != 0] * (1 << AOM_QM_BITS) + prescan_add_val) &&
246           coeff > (nzbins[rc != 0] * (1 << AOM_QM_BITS) - prescan_add_val)) {
247         qcoeff_ptr[rc] = 0;
248         dqcoeff_ptr[rc] = 0;
249         eob = -1;
250       }
251     }
252   }
253 #endif  // SKIP_EOB_FACTOR_ADJUST
254   *eob_ptr = eob + 1;
255 }
256 
aom_highbd_quantize_b_helper_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan,const qm_val_t * qm_ptr,const qm_val_t * iqm_ptr,const int log_scale)257 void aom_highbd_quantize_b_helper_c(
258     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
259     const int16_t *round_ptr, const int16_t *quant_ptr,
260     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
261     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
262     const int16_t *scan, const int16_t *iscan, const qm_val_t *qm_ptr,
263     const qm_val_t *iqm_ptr, const int log_scale) {
264   int i, eob = -1;
265   const int zbins[2] = { ROUND_POWER_OF_TWO(zbin_ptr[0], log_scale),
266                          ROUND_POWER_OF_TWO(zbin_ptr[1], log_scale) };
267   const int nzbins[2] = { zbins[0] * -1, zbins[1] * -1 };
268   int dequant;
269   int idx_arr[4096];
270   (void)iscan;
271   int idx = 0;
272 
273   memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
274   memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
275 
276   // Pre-scan pass
277   for (i = 0; i < n_coeffs; i++) {
278     const int rc = scan[i];
279     const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
280     const int coeff = coeff_ptr[rc] * wt;
281 
282     // If the coefficient is out of the base ZBIN range, keep it for
283     // quantization.
284     if (coeff >= (zbins[rc != 0] * (1 << AOM_QM_BITS)) ||
285         coeff <= (nzbins[rc != 0] * (1 << AOM_QM_BITS)))
286       idx_arr[idx++] = i;
287   }
288 
289   // Quantization pass: only process the coefficients selected in
290   // pre-scan pass. Note: idx can be zero.
291   for (i = 0; i < idx; i++) {
292     const int rc = scan[idx_arr[i]];
293     const int coeff = coeff_ptr[rc];
294     const int coeff_sign = AOMSIGN(coeff);
295     const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
296     const qm_val_t iwt = iqm_ptr != NULL ? iqm_ptr[rc] : (1 << AOM_QM_BITS);
297     const int abs_coeff = (coeff ^ coeff_sign) - coeff_sign;
298     const int64_t tmp1 =
299         abs_coeff + ROUND_POWER_OF_TWO(round_ptr[rc != 0], log_scale);
300     const int64_t tmpw = tmp1 * wt;
301     const int64_t tmp2 = ((tmpw * quant_ptr[rc != 0]) >> 16) + tmpw;
302     const int abs_qcoeff = (int)((tmp2 * quant_shift_ptr[rc != 0]) >>
303                                  (16 - log_scale + AOM_QM_BITS));
304     qcoeff_ptr[rc] = (tran_low_t)((abs_qcoeff ^ coeff_sign) - coeff_sign);
305     dequant =
306         (dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS;
307     const tran_low_t abs_dqcoeff = (abs_qcoeff * dequant) >> log_scale;
308     dqcoeff_ptr[rc] = (tran_low_t)((abs_dqcoeff ^ coeff_sign) - coeff_sign);
309     if (abs_qcoeff) eob = idx_arr[i];
310   }
311   *eob_ptr = eob + 1;
312 }
313 #endif  // CONFIG_AV1_HIGHBITDEPTH
314 
315 /* These functions should only be called when quantisation matrices
316    are not used. */
aom_quantize_b_adaptive_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)317 void aom_quantize_b_adaptive_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
318                                const int16_t *zbin_ptr,
319                                const int16_t *round_ptr,
320                                const int16_t *quant_ptr,
321                                const int16_t *quant_shift_ptr,
322                                tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
323                                const int16_t *dequant_ptr, uint16_t *eob_ptr,
324                                const int16_t *scan, const int16_t *iscan) {
325   aom_quantize_b_adaptive_helper_c(coeff_ptr, n_coeffs, zbin_ptr, round_ptr,
326                                    quant_ptr, quant_shift_ptr, qcoeff_ptr,
327                                    dqcoeff_ptr, dequant_ptr, eob_ptr, scan,
328                                    iscan, NULL, NULL, 0);
329 }
330 
aom_quantize_b_32x32_adaptive_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)331 void aom_quantize_b_32x32_adaptive_c(
332     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
333     const int16_t *round_ptr, const int16_t *quant_ptr,
334     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
335     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
336     const int16_t *scan, const int16_t *iscan) {
337   aom_quantize_b_adaptive_helper_c(coeff_ptr, n_coeffs, zbin_ptr, round_ptr,
338                                    quant_ptr, quant_shift_ptr, qcoeff_ptr,
339                                    dqcoeff_ptr, dequant_ptr, eob_ptr, scan,
340                                    iscan, NULL, NULL, 1);
341 }
342 
aom_quantize_b_64x64_adaptive_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)343 void aom_quantize_b_64x64_adaptive_c(
344     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
345     const int16_t *round_ptr, const int16_t *quant_ptr,
346     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
347     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
348     const int16_t *scan, const int16_t *iscan) {
349   aom_quantize_b_adaptive_helper_c(coeff_ptr, n_coeffs, zbin_ptr, round_ptr,
350                                    quant_ptr, quant_shift_ptr, qcoeff_ptr,
351                                    dqcoeff_ptr, dequant_ptr, eob_ptr, scan,
352                                    iscan, NULL, NULL, 2);
353 }
354 
355 #if CONFIG_AV1_HIGHBITDEPTH
aom_highbd_quantize_b_adaptive_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)356 void aom_highbd_quantize_b_adaptive_c(
357     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
358     const int16_t *round_ptr, const int16_t *quant_ptr,
359     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
360     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
361     const int16_t *scan, const int16_t *iscan) {
362   aom_highbd_quantize_b_adaptive_helper_c(coeff_ptr, n_coeffs, zbin_ptr,
363                                           round_ptr, quant_ptr, quant_shift_ptr,
364                                           qcoeff_ptr, dqcoeff_ptr, dequant_ptr,
365                                           eob_ptr, scan, iscan, NULL, NULL, 0);
366 }
367 
aom_highbd_quantize_b_32x32_adaptive_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)368 void aom_highbd_quantize_b_32x32_adaptive_c(
369     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
370     const int16_t *round_ptr, const int16_t *quant_ptr,
371     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
372     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
373     const int16_t *scan, const int16_t *iscan) {
374   aom_highbd_quantize_b_adaptive_helper_c(coeff_ptr, n_coeffs, zbin_ptr,
375                                           round_ptr, quant_ptr, quant_shift_ptr,
376                                           qcoeff_ptr, dqcoeff_ptr, dequant_ptr,
377                                           eob_ptr, scan, iscan, NULL, NULL, 1);
378 }
379 
aom_highbd_quantize_b_64x64_adaptive_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)380 void aom_highbd_quantize_b_64x64_adaptive_c(
381     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
382     const int16_t *round_ptr, const int16_t *quant_ptr,
383     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
384     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
385     const int16_t *scan, const int16_t *iscan) {
386   aom_highbd_quantize_b_adaptive_helper_c(coeff_ptr, n_coeffs, zbin_ptr,
387                                           round_ptr, quant_ptr, quant_shift_ptr,
388                                           qcoeff_ptr, dqcoeff_ptr, dequant_ptr,
389                                           eob_ptr, scan, iscan, NULL, NULL, 2);
390 }
391 #endif  // CONFIG_AV1_HIGHBITDEPTH
392 
aom_quantize_b_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)393 void aom_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
394                       const int16_t *zbin_ptr, const int16_t *round_ptr,
395                       const int16_t *quant_ptr, const int16_t *quant_shift_ptr,
396                       tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
397                       const int16_t *dequant_ptr, uint16_t *eob_ptr,
398                       const int16_t *scan, const int16_t *iscan) {
399   aom_quantize_b_helper_c(coeff_ptr, n_coeffs, zbin_ptr, round_ptr, quant_ptr,
400                           quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr,
401                           eob_ptr, scan, iscan, NULL, NULL, 0);
402 }
403 
aom_quantize_b_32x32_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)404 void aom_quantize_b_32x32_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
405                             const int16_t *zbin_ptr, const int16_t *round_ptr,
406                             const int16_t *quant_ptr,
407                             const int16_t *quant_shift_ptr,
408                             tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
409                             const int16_t *dequant_ptr, uint16_t *eob_ptr,
410                             const int16_t *scan, const int16_t *iscan) {
411   aom_quantize_b_helper_c(coeff_ptr, n_coeffs, zbin_ptr, round_ptr, quant_ptr,
412                           quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr,
413                           eob_ptr, scan, iscan, NULL, NULL, 1);
414 }
415 
aom_quantize_b_64x64_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)416 void aom_quantize_b_64x64_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
417                             const int16_t *zbin_ptr, const int16_t *round_ptr,
418                             const int16_t *quant_ptr,
419                             const int16_t *quant_shift_ptr,
420                             tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
421                             const int16_t *dequant_ptr, uint16_t *eob_ptr,
422                             const int16_t *scan, const int16_t *iscan) {
423   aom_quantize_b_helper_c(coeff_ptr, n_coeffs, zbin_ptr, round_ptr, quant_ptr,
424                           quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr,
425                           eob_ptr, scan, iscan, NULL, NULL, 2);
426 }
427 
428 #if CONFIG_AV1_HIGHBITDEPTH
aom_highbd_quantize_b_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)429 void aom_highbd_quantize_b_c(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
430                              const int16_t *zbin_ptr, const int16_t *round_ptr,
431                              const int16_t *quant_ptr,
432                              const int16_t *quant_shift_ptr,
433                              tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
434                              const int16_t *dequant_ptr, uint16_t *eob_ptr,
435                              const int16_t *scan, const int16_t *iscan) {
436   aom_highbd_quantize_b_helper_c(coeff_ptr, n_coeffs, zbin_ptr, round_ptr,
437                                  quant_ptr, quant_shift_ptr, qcoeff_ptr,
438                                  dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan,
439                                  NULL, NULL, 0);
440 }
441 
aom_highbd_quantize_b_32x32_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)442 void aom_highbd_quantize_b_32x32_c(
443     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
444     const int16_t *round_ptr, const int16_t *quant_ptr,
445     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
446     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
447     const int16_t *scan, const int16_t *iscan) {
448   aom_highbd_quantize_b_helper_c(coeff_ptr, n_coeffs, zbin_ptr, round_ptr,
449                                  quant_ptr, quant_shift_ptr, qcoeff_ptr,
450                                  dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan,
451                                  NULL, NULL, 1);
452 }
453 
aom_highbd_quantize_b_64x64_c(const tran_low_t * coeff_ptr,intptr_t n_coeffs,const int16_t * zbin_ptr,const int16_t * round_ptr,const int16_t * quant_ptr,const int16_t * quant_shift_ptr,tran_low_t * qcoeff_ptr,tran_low_t * dqcoeff_ptr,const int16_t * dequant_ptr,uint16_t * eob_ptr,const int16_t * scan,const int16_t * iscan)454 void aom_highbd_quantize_b_64x64_c(
455     const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
456     const int16_t *round_ptr, const int16_t *quant_ptr,
457     const int16_t *quant_shift_ptr, tran_low_t *qcoeff_ptr,
458     tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr,
459     const int16_t *scan, const int16_t *iscan) {
460   aom_highbd_quantize_b_helper_c(coeff_ptr, n_coeffs, zbin_ptr, round_ptr,
461                                  quant_ptr, quant_shift_ptr, qcoeff_ptr,
462                                  dqcoeff_ptr, dequant_ptr, eob_ptr, scan, iscan,
463                                  NULL, NULL, 2);
464 }
465 #endif  // CONFIG_AV1_HIGHBITDEPTH
466