const macroblock_plane *const mb_plane,
tran_low_t *qcoeff, tran_low_t *dqcoeff,
const int16_t *dequant, uint16_t *eob,
- const struct scan_order *const scan_order);
+ const int16_t *scan, const int16_t *iscan);
typedef std::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t,
int /*max_size*/, bool /*is_fp*/>
QuantizeParam;
void QuantWrapper(const tran_low_t *coeff, intptr_t count,
const macroblock_plane *const mb_plane, tran_low_t *qcoeff,
tran_low_t *dqcoeff, const int16_t *dequant, uint16_t *eob,
- const struct scan_order *const scan_order) {
+ const int16_t *scan, const int16_t *iscan) {
fn(coeff, count, mb_plane->zbin, mb_plane->round, mb_plane->quant,
- mb_plane->quant_shift, qcoeff, dqcoeff, dequant, eob, scan_order->scan,
- scan_order->iscan);
+ mb_plane->quant_shift, qcoeff, dqcoeff, dequant, eob, scan, iscan);
}
// Wrapper for 32x32 version which does not use count
const macroblock_plane *const mb_plane,
tran_low_t *qcoeff, tran_low_t *dqcoeff,
const int16_t *dequant, uint16_t *eob,
- const struct scan_order *const scan_order);
+ const int16_t *scan, const int16_t *iscan);
template <Quantize32x32Func fn>
void Quant32x32Wrapper(const tran_low_t *coeff, intptr_t count,
const macroblock_plane *const mb_plane,
tran_low_t *qcoeff, tran_low_t *dqcoeff,
const int16_t *dequant, uint16_t *eob,
- const struct scan_order *const scan_order) {
+ const int16_t *scan, const int16_t *iscan) {
(void)count;
- fn(coeff, mb_plane, qcoeff, dqcoeff, dequant, eob, scan_order);
+ fn(coeff, mb_plane, qcoeff, dqcoeff, dequant, eob, scan, iscan);
}
// Wrapper for FP version which does not use zbin or quant_shift.
void QuantFPWrapper(const tran_low_t *coeff, intptr_t count,
const macroblock_plane *const mb_plane, tran_low_t *qcoeff,
tran_low_t *dqcoeff, const int16_t *dequant, uint16_t *eob,
- const struct scan_order *const scan_order) {
+ const int16_t *scan, const int16_t *iscan) {
fn(coeff, count, mb_plane->round_fp, mb_plane->quant_fp, qcoeff, dqcoeff,
- dequant, eob, scan_order->scan, scan_order->iscan);
+ dequant, eob, scan, iscan);
}
void GenerateHelperArrays(ACMRandom *rnd, int16_t *zbin, int16_t *round,
void VP9QuantizeTest::Run() {
quantize_op_(coeff_.TopLeftPixel(), count_, &mb_plane_,
qcoeff_.TopLeftPixel(), dqcoeff_.TopLeftPixel(), dequant_ptr_,
- &eob_, scan_);
+ &eob_, scan_->scan, scan_->iscan);
}
void VP9QuantizeTest::Speed(bool is_median) {
ref_quantize_op_(coeff_.TopLeftPixel(), count_, &mb_plane_,
ref_qcoeff.TopLeftPixel(),
ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob,
- scan_);
+ scan_->scan, scan_->iscan);
}
vpx_usec_timer_mark(&timer);
for (int n = 0; n < kNumTests; ++n) {
quantize_op_(coeff_.TopLeftPixel(), count_, &mb_plane_,
qcoeff_.TopLeftPixel(), dqcoeff_.TopLeftPixel(),
- dequant_ptr_, &eob_, scan_);
+ dequant_ptr_, &eob_, scan_->scan, scan_->iscan);
}
vpx_usec_timer_mark(&simd_timer);
quant_fp_ptr_);
ref_quantize_op_(coeff_.TopLeftPixel(), count_, &mb_plane_,
ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(),
- dequant_ptr_, &ref_eob, scan_);
+ dequant_ptr_, &ref_eob, scan_->scan, scan_->iscan);
- ASM_REGISTER_STATE_CHECK(quantize_op_(
- coeff_.TopLeftPixel(), count_, &mb_plane_, qcoeff_.TopLeftPixel(),
- dqcoeff_.TopLeftPixel(), dequant_ptr_, &eob_, scan_));
+ ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_.TopLeftPixel(), count_,
+ &mb_plane_, qcoeff_.TopLeftPixel(),
+ dqcoeff_.TopLeftPixel(), dequant_ptr_,
+ &eob_, scan_->scan, scan_->iscan));
EXPECT_TRUE(qcoeff_.CheckValues(ref_qcoeff));
EXPECT_TRUE(dqcoeff_.CheckValues(ref_dqcoeff));
quant_fp_ptr_);
ref_quantize_op_(coeff_.TopLeftPixel(), count_, &mb_plane_,
ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(),
- dequant_ptr_, &ref_eob, scan_);
+ dequant_ptr_, &ref_eob, scan_->scan, scan_->iscan);
- ASM_REGISTER_STATE_CHECK(quantize_op_(
- coeff_.TopLeftPixel(), count_, &mb_plane_, qcoeff_.TopLeftPixel(),
- dqcoeff_.TopLeftPixel(), dequant_ptr_, &eob_, scan_));
+ ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_.TopLeftPixel(), count_,
+ &mb_plane_, qcoeff_.TopLeftPixel(),
+ dqcoeff_.TopLeftPixel(), dequant_ptr_,
+ &eob_, scan_->scan, scan_->iscan));
EXPECT_TRUE(qcoeff_.CheckValues(ref_qcoeff));
EXPECT_TRUE(dqcoeff_.CheckValues(ref_dqcoeff));
#define MAX_NEIGHBORS 2
-typedef struct scan_order {
+typedef struct {
const int16_t *scan;
const int16_t *iscan;
const int16_t *neighbors;
case TX_32X32:
highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
vpx_highbd_quantize_b_32x32(coeff, p, qcoeff, dqcoeff, pd->dequant, eob,
- scan_order);
+ scan_order->scan, scan_order->iscan);
break;
case TX_16X16:
vpx_highbd_fdct16x16(src_diff, coeff, diff_stride);
case TX_32X32:
fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
vpx_quantize_b_32x32(coeff, p, qcoeff, dqcoeff, pd->dequant, eob,
- scan_order);
+ scan_order->scan, scan_order->iscan);
break;
case TX_16X16:
vpx_fdct16x16(src_diff, coeff, diff_stride);
src_stride, dst, dst_stride, xd->bd);
highbd_fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
vpx_highbd_quantize_b_32x32(coeff, p, qcoeff, dqcoeff, pd->dequant,
- eob, scan_order);
+ eob, scan_order->scan, scan_order->iscan);
}
if (args->enable_coeff_opt && !x->skip_recode) {
*a = *l = vp9_optimize_b(x, plane, block, tx_size, entropy_ctx) > 0;
dst_stride);
fdct32x32(x->use_lp32x32fdct, src_diff, coeff, diff_stride);
vpx_quantize_b_32x32(coeff, p, qcoeff, dqcoeff, pd->dequant, eob,
- scan_order);
+ scan_order->scan, scan_order->iscan);
}
if (args->enable_coeff_opt && !x->skip_recode) {
*a = *l = vp9_optimize_b(x, plane, block, tx_size, entropy_ctx) > 0;
#include "./vpx_config.h"
#include "./vpx_dsp_rtcd.h"
#include "vpx_dsp/arm/mem_neon.h"
-#include "vp9/common/vp9_scan.h"
#include "vp9/encoder/vp9_block.h"
static VPX_FORCE_INLINE void highbd_calculate_dqcoeff_and_store(
void vpx_highbd_quantize_b_32x32_neon(
const tran_low_t *coeff_ptr, const struct macroblock_plane *const mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr,
- uint16_t *eob_ptr, const struct scan_order *const scan_order) {
+ uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan) {
const int16x8_t neg_one = vdupq_n_s16(-1);
uint16x8_t eob_max;
int i;
- const int16_t *iscan = scan_order->iscan;
// Only the first element of each vector is DC.
// High half has identical elements, but we can reconstruct it from the low
vst1_lane_u16(eob_ptr, eob_max_2, 0);
}
#endif // __aarch64__
+ // Need this here, else the compiler complains about mixing declarations and
+ // code in C90
+ (void)scan;
}
#include "./vpx_config.h"
#include "./vpx_dsp_rtcd.h"
#include "vpx_dsp/arm/mem_neon.h"
-#include "vp9/common/vp9_scan.h"
#include "vp9/encoder/vp9_block.h"
static INLINE void calculate_dqcoeff_and_store(const int16x8_t qcoeff,
const struct macroblock_plane *const mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
const int16_t *dequant_ptr, uint16_t *eob_ptr,
- const struct scan_order *const scan_order) {
+ const int16_t *scan, const int16_t *iscan) {
const int16x8_t neg_one = vdupq_n_s16(-1);
uint16x8_t eob_max;
int i;
- const int16_t *iscan = scan_order->iscan;
// Only the first element of each vector is DC.
int16x8_t zbin = vrshrq_n_s16(vld1q_s16(mb_plane->zbin), 1);
vst1_lane_u16(eob_ptr, eob_max_2, 0);
}
#endif // __aarch64__
+ // Need these here, else the compiler complains about mixing declarations and
+ // code in C90
+ (void)scan;
}
#include "vpx_dsp/quantize.h"
#include "vpx_dsp/vpx_dsp_common.h"
#include "vpx_mem/vpx_mem.h"
-#include "vp9/common/vp9_scan.h"
#include "vp9/encoder/vp9_block.h"
void vpx_quantize_dc(const tran_low_t *coeff_ptr, int n_coeffs,
const struct macroblock_plane *const mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
const int16_t *dequant_ptr, uint16_t *eob_ptr,
- const struct scan_order *const scan_order) {
+ const int16_t *scan, const int16_t *iscan) {
const int n_coeffs = 32 * 32;
const int zbins[2] = { ROUND_POWER_OF_TWO(mb_plane->zbin[0], 1),
ROUND_POWER_OF_TWO(mb_plane->zbin[1], 1) };
const int16_t *round_ptr = mb_plane->round;
const int16_t *quant_ptr = mb_plane->quant;
const int16_t *quant_shift_ptr = mb_plane->quant_shift;
- const int16_t *scan = scan_order->scan;
int idx = 0;
int idx_arr[32 * 32 /* n_coeffs */];
int i, eob = -1;
+ (void)iscan;
memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
void vpx_highbd_quantize_b_32x32_c(
const tran_low_t *coeff_ptr, const struct macroblock_plane *const mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr,
- uint16_t *eob_ptr, const struct scan_order *const scan_order) {
+ uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan) {
const intptr_t n_coeffs = 32 * 32;
const int zbins[2] = { ROUND_POWER_OF_TWO(mb_plane->zbin[0], 1),
ROUND_POWER_OF_TWO(mb_plane->zbin[1], 1) };
const int16_t *round_ptr = mb_plane->round;
const int16_t *quant_ptr = mb_plane->quant;
const int16_t *quant_shift_ptr = mb_plane->quant_shift;
- const int16_t *scan = scan_order->scan;
int idx = 0;
int idx_arr[1024];
int i, eob = -1;
+ (void)iscan;
memset(qcoeff_ptr, 0, n_coeffs * sizeof(*qcoeff_ptr));
memset(dqcoeff_ptr, 0, n_coeffs * sizeof(*dqcoeff_ptr));
#include "vpx_dsp/vpx_filter.h"
#if CONFIG_VP9_ENCODER
struct macroblock_plane;
- struct scan_order;
#endif
EOF
add_proto qw/void vpx_quantize_b/, "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";
specialize qw/vpx_quantize_b neon sse2 ssse3 avx avx2 vsx lsx/;
- add_proto qw/void vpx_quantize_b_32x32/, "const tran_low_t *coeff_ptr, const struct macroblock_plane * const mb_plane, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const struct scan_order *const scan_order";
+ add_proto qw/void vpx_quantize_b_32x32/, "const tran_low_t *coeff_ptr, const struct macroblock_plane * const mb_plane, 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";
specialize qw/vpx_quantize_b_32x32 neon ssse3 avx avx2 vsx lsx/;
if (vpx_config("CONFIG_VP9_HIGHBITDEPTH") eq "yes") {
add_proto qw/void vpx_highbd_quantize_b/, "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";
specialize qw/vpx_highbd_quantize_b neon sse2 avx2/;
- add_proto qw/void vpx_highbd_quantize_b_32x32/, "const tran_low_t *coeff_ptr, const struct macroblock_plane * const mb_plane, tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr, uint16_t *eob_ptr, const struct scan_order *const scan_order";
+ add_proto qw/void vpx_highbd_quantize_b_32x32/, "const tran_low_t *coeff_ptr, const struct macroblock_plane * const mb_plane, 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";
specialize qw/vpx_highbd_quantize_b_32x32 neon sse2 avx2/;
} # CONFIG_VP9_HIGHBITDEPTH
} # CONFIG_VP9_ENCODER
#include <immintrin.h>
#include "./vpx_dsp_rtcd.h"
-#include "vp9/common/vp9_scan.h"
#include "vp9/encoder/vp9_block.h"
static VPX_FORCE_INLINE void init_one_qp(const __m128i *p, __m256i *qp) {
void vpx_highbd_quantize_b_32x32_avx2(
const tran_low_t *coeff_ptr, const struct macroblock_plane *const mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr,
- uint16_t *eob_ptr, const struct scan_order *const scan_order) {
+ uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan) {
const unsigned int step = 8;
intptr_t n_coeffs = 32 * 32;
- const int16_t *iscan = scan_order->iscan;
__m256i eob = _mm256_setzero_si256();
__m256i qp[5];
+ (void)scan;
init_qp(mb_plane->zbin, mb_plane->round, mb_plane->quant, dequant_ptr,
mb_plane->quant_shift, qp, 1);
#include "vpx_dsp/vpx_dsp_common.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem.h"
-#include "vp9/common/vp9_scan.h"
#include "vp9/encoder/vp9_block.h"
#if CONFIG_VP9_HIGHBITDEPTH
void vpx_highbd_quantize_b_32x32_sse2(
const tran_low_t *coeff_ptr, const struct macroblock_plane *const mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr, const int16_t *dequant_ptr,
- uint16_t *eob_ptr, const struct scan_order *const scan_order) {
+ uint16_t *eob_ptr, const int16_t *scan, const int16_t *iscan) {
__m128i zbins[2];
__m128i nzbins[2];
int idx = 0;
int idx_arr[1024];
int i, eob = 0;
const intptr_t n_coeffs = 32 * 32;
- const int16_t *iscan = scan_order->iscan;
const int zbin0_tmp = ROUND_POWER_OF_TWO(mb_plane->zbin[0], 1);
const int zbin1_tmp = ROUND_POWER_OF_TWO(mb_plane->zbin[1], 1);
+ (void)scan;
zbins[0] = _mm_set_epi32(zbin1_tmp, zbin1_tmp, zbin1_tmp, zbin0_tmp);
zbins[1] = _mm_set1_epi32(zbin1_tmp);
#include "vpx_dsp/x86/bitdepth_conversion_sse2.h"
#include "vpx_dsp/x86/quantize_sse2.h"
#include "vpx_dsp/x86/quantize_ssse3.h"
-#include "vp9/common/vp9_scan.h"
-#include "vp9/encoder/vp9_block.h"
void vpx_quantize_b_avx(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
const int16_t *zbin_ptr, const int16_t *round_ptr,
const struct macroblock_plane *const mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
const int16_t *dequant_ptr, uint16_t *eob_ptr,
- const struct scan_order *const scan_order) {
+ const int16_t *scan, const int16_t *iscan) {
const __m128i zero = _mm_setzero_si128();
const __m256i big_zero = _mm256_setzero_si256();
int index;
- const int16_t *iscan = scan_order->iscan;
__m128i zbin, round, quant, dequant, shift;
__m128i coeff0, coeff1;
__m128i all_zero;
__m128i eob = zero, eob0;
+ (void)scan;
+
load_b_values32x32(mb_plane, &zbin, &round, &quant, dequant_ptr, &dequant,
&shift);
#include "./vpx_dsp_rtcd.h"
#include "vpx/vpx_integer.h"
-#include "vp9/common/vp9_scan.h"
#include "vp9/encoder/vp9_block.h"
static VPX_FORCE_INLINE void load_b_values_avx2(
const struct macroblock_plane *const mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
const int16_t *dequant_ptr, uint16_t *eob_ptr,
- const struct scan_order *const scan_order) {
+ const int16_t *scan, const int16_t *iscan) {
__m256i v_zbin, v_round, v_quant, v_dequant, v_quant_shift;
__m256i v_eobmax = _mm256_setzero_si256();
intptr_t count;
- const int16_t *iscan = scan_order->iscan;
+ (void)scan;
load_b_values_avx2(mb_plane->zbin, &v_zbin, mb_plane->round, &v_round,
mb_plane->quant, &v_quant, dequant_ptr, &v_dequant,
#include "vpx_dsp/x86/bitdepth_conversion_sse2.h"
#include "vpx_dsp/x86/quantize_sse2.h"
#include "vpx_dsp/x86/quantize_ssse3.h"
-#include "vp9/common/vp9_scan.h"
#include "vp9/encoder/vp9_block.h"
void vpx_quantize_b_ssse3(const tran_low_t *coeff_ptr, intptr_t n_coeffs,
const struct macroblock_plane *const mb_plane,
tran_low_t *qcoeff_ptr, tran_low_t *dqcoeff_ptr,
const int16_t *dequant_ptr, uint16_t *eob_ptr,
- const struct scan_order *const scan_order) {
+ const int16_t *scan, const int16_t *iscan) {
const __m128i zero = _mm_setzero_si128();
int index;
- const int16_t *iscan = scan_order->iscan;
__m128i zbin, round, quant, dequant, shift;
__m128i coeff0, coeff1;
__m128i all_zero;
__m128i eob = zero, eob0;
+ (void)scan;
+
load_b_values32x32(mb_plane, &zbin, &round, &quant, dequant_ptr, &dequant,
&shift);