mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-14 03:07:31 +09:00
update libaom to rev 5bdd95475e07ac8641114cb139105b8d734a1b60 (without moz.build and aom_ports/aom_once.h)
This commit is contained in:
parent
402c27b560
commit
fb515ea77b
177 changed files with 21088 additions and 11681 deletions
78
third_party/aom/aom_dsp/quantize.c
vendored
78
third_party/aom/aom_dsp/quantize.c
vendored
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "aom_dsp/quantize.h"
|
||||
#include "aom_mem/aom_mem.h"
|
||||
#include "av1/encoder/av1_quantize.h"
|
||||
|
||||
void quantize_b_adaptive_helper_c(
|
||||
const tran_low_t *coeff_ptr, intptr_t n_coeffs, const int16_t *zbin_ptr,
|
||||
|
|
@ -28,15 +29,18 @@ void quantize_b_adaptive_helper_c(
|
|||
memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
|
||||
memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
|
||||
|
||||
int prescan_add[2];
|
||||
for (i = 0; i < 2; ++i)
|
||||
prescan_add[i] = ROUND_POWER_OF_TWO(dequant_ptr[i] * EOB_FACTOR, 7);
|
||||
|
||||
// Pre-scan pass
|
||||
for (i = (int)n_coeffs - 1; i >= 0; i--) {
|
||||
const int rc = scan[i];
|
||||
const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
|
||||
const int coeff = coeff_ptr[rc] * wt;
|
||||
|
||||
int prescan_add = ROUND_POWER_OF_TWO(dequant_ptr[rc != 0] * 325, 7);
|
||||
if (coeff < (zbins[rc != 0] * (1 << AOM_QM_BITS) + prescan_add) &&
|
||||
coeff > (nzbins[rc != 0] * (1 << AOM_QM_BITS) - prescan_add))
|
||||
const int prescan_add_val = prescan_add[rc != 0];
|
||||
if (coeff < (zbins[rc != 0] * (1 << AOM_QM_BITS) + prescan_add_val) &&
|
||||
coeff > (nzbins[rc != 0] * (1 << AOM_QM_BITS) - prescan_add_val))
|
||||
non_zero_count--;
|
||||
else
|
||||
break;
|
||||
|
|
@ -44,6 +48,9 @@ void quantize_b_adaptive_helper_c(
|
|||
|
||||
// Quantization pass: All coefficients with index >= zero_flag are
|
||||
// skippable. Note: zero_flag can be zero.
|
||||
#if SKIP_EOB_FACTOR_ADJUST
|
||||
int first = -1;
|
||||
#endif // SKIP_EOB_FACTOR_ADJUST
|
||||
for (i = 0; i < non_zero_count; i++) {
|
||||
const int rc = scan[i];
|
||||
const int coeff = coeff_ptr[rc];
|
||||
|
|
@ -68,9 +75,32 @@ void quantize_b_adaptive_helper_c(
|
|||
const tran_low_t abs_dqcoeff = (tmp32 * dequant) >> log_scale;
|
||||
dqcoeff_ptr[rc] = (tran_low_t)((abs_dqcoeff ^ coeff_sign) - coeff_sign);
|
||||
|
||||
if (tmp32) eob = i;
|
||||
if (tmp32) {
|
||||
eob = i;
|
||||
#if SKIP_EOB_FACTOR_ADJUST
|
||||
if (first == -1) first = i;
|
||||
#endif // SKIP_EOB_FACTOR_ADJUST
|
||||
}
|
||||
}
|
||||
}
|
||||
#if SKIP_EOB_FACTOR_ADJUST
|
||||
if (eob >= 0 && first == eob) {
|
||||
const int rc = scan[eob];
|
||||
if (qcoeff_ptr[rc] == 1 || qcoeff_ptr[rc] == -1) {
|
||||
const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
|
||||
const int coeff = coeff_ptr[rc] * wt;
|
||||
const int factor = EOB_FACTOR + SKIP_EOB_FACTOR_ADJUST;
|
||||
const int prescan_add_val =
|
||||
ROUND_POWER_OF_TWO(dequant_ptr[rc != 0] * factor, 7);
|
||||
if (coeff < (zbins[rc != 0] * (1 << AOM_QM_BITS) + prescan_add_val) &&
|
||||
coeff > (nzbins[rc != 0] * (1 << AOM_QM_BITS) - prescan_add_val)) {
|
||||
qcoeff_ptr[rc] = 0;
|
||||
dqcoeff_ptr[rc] = 0;
|
||||
eob = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // SKIP_EOB_FACTOR_ADJUST
|
||||
*eob_ptr = eob + 1;
|
||||
}
|
||||
|
||||
|
|
@ -155,6 +185,10 @@ void highbd_quantize_b_adaptive_helper_c(
|
|||
memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
|
||||
memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
|
||||
|
||||
int prescan_add[2];
|
||||
for (i = 0; i < 2; ++i)
|
||||
prescan_add[i] = ROUND_POWER_OF_TWO(dequant_ptr[i] * EOB_FACTOR, 7);
|
||||
|
||||
// Pre-scan pass
|
||||
for (i = 0; i < n_coeffs; i++) {
|
||||
const int rc = scan[i];
|
||||
|
|
@ -163,14 +197,17 @@ void highbd_quantize_b_adaptive_helper_c(
|
|||
|
||||
// If the coefficient is out of the base ZBIN range, keep it for
|
||||
// quantization.
|
||||
int prescan_add = ROUND_POWER_OF_TWO(dequant_ptr[rc != 0] * 325, 7);
|
||||
if (coeff >= (zbins[rc != 0] * (1 << AOM_QM_BITS) + prescan_add) &&
|
||||
coeff <= (nzbins[rc != 0] * (1 << AOM_QM_BITS) - prescan_add))
|
||||
const int prescan_add_val = prescan_add[rc != 0];
|
||||
if (coeff >= (zbins[rc != 0] * (1 << AOM_QM_BITS) + prescan_add_val) &&
|
||||
coeff <= (nzbins[rc != 0] * (1 << AOM_QM_BITS) - prescan_add_val))
|
||||
idx_arr[idx++] = i;
|
||||
}
|
||||
|
||||
// Quantization pass: only process the coefficients selected in
|
||||
// pre-scan pass. Note: idx can be zero.
|
||||
#if SKIP_EOB_FACTOR_ADJUST
|
||||
int first = -1;
|
||||
#endif // SKIP_EOB_FACTOR_ADJUST
|
||||
for (i = 0; i < idx; i++) {
|
||||
const int rc = scan[idx_arr[i]];
|
||||
const int coeff = coeff_ptr[rc];
|
||||
|
|
@ -189,8 +226,31 @@ void highbd_quantize_b_adaptive_helper_c(
|
|||
(dequant_ptr[rc != 0] * iwt + (1 << (AOM_QM_BITS - 1))) >> AOM_QM_BITS;
|
||||
const tran_low_t abs_dqcoeff = (abs_qcoeff * dequant) >> log_scale;
|
||||
dqcoeff_ptr[rc] = (tran_low_t)((abs_dqcoeff ^ coeff_sign) - coeff_sign);
|
||||
if (abs_qcoeff) eob = idx_arr[i];
|
||||
if (abs_qcoeff) {
|
||||
eob = idx_arr[i];
|
||||
#if SKIP_EOB_FACTOR_ADJUST
|
||||
if (first == -1) first = eob;
|
||||
#endif // SKIP_EOB_FACTOR_ADJUST
|
||||
}
|
||||
}
|
||||
#if SKIP_EOB_FACTOR_ADJUST
|
||||
if (eob >= 0 && first == eob) {
|
||||
const int rc = scan[eob];
|
||||
if (qcoeff_ptr[rc] == 1 || qcoeff_ptr[rc] == -1) {
|
||||
const qm_val_t wt = qm_ptr != NULL ? qm_ptr[rc] : (1 << AOM_QM_BITS);
|
||||
const int coeff = coeff_ptr[rc] * wt;
|
||||
const int factor = EOB_FACTOR + SKIP_EOB_FACTOR_ADJUST;
|
||||
const int prescan_add_val =
|
||||
ROUND_POWER_OF_TWO(dequant_ptr[rc != 0] * factor, 7);
|
||||
if (coeff < (zbins[rc != 0] * (1 << AOM_QM_BITS) + prescan_add_val) &&
|
||||
coeff > (nzbins[rc != 0] * (1 << AOM_QM_BITS) - prescan_add_val)) {
|
||||
qcoeff_ptr[rc] = 0;
|
||||
dqcoeff_ptr[rc] = 0;
|
||||
eob = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // SKIP_EOB_FACTOR_ADJUST
|
||||
*eob_ptr = eob + 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue