Coverage Report

Created: 2025-06-22 08:04

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