2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
13 #include "vpx_mem/vpx_mem.h"
17 #include "predictdc.h"
19 DECLARE_ALIGNED(16, const short, vp8_rvsplus1_default_zig_zag1d[16]) =
28 extern int vp8_fast_quantize_b_neon_func(short *coeff_ptr, short *zbin_ptr, short *qcoeff_ptr, short *dqcoeff_ptr, short *dequant_ptr, const short *scan_mask, short *round_ptr, short *quant_ptr);
30 void vp8_fast_quantize_b_neon(BLOCK *b, BLOCKD *d)
32 d->eob = vp8_fast_quantize_b_neon_func(b->coeff, b->zbin, d->qcoeff, d->dqcoeff, d->dequant, vp8_rvsplus1_default_zig_zag1d, b->round, b->quant);
36 //neon code is written according to the following rewritten c code
37 void vp8_fast_quantize_b_neon(BLOCK *b,BLOCKD *d)
42 short *coeff_ptr = &b->Coeff[0];
43 short *zbin_ptr = &b->Zbin[0][0];
44 short *round_ptr = &b->Round[0][0];
45 short *quant_ptr = &b->Quant[0][0];
46 short *qcoeff_ptr = d->qcoeff;
47 short *dqcoeff_ptr= d->dqcoeff;
48 short *dequant_ptr= &d->Dequant[0][0];
56 x = abs(z); // x = abs(z)
60 sz = (z>>31); // sign of z
61 y = ((x+round_ptr[i])*quant_ptr[i])>>16; // quantize (x)
62 x1 = (y^sz) - sz; // get the sign back
64 qcoeff_ptr[i] = x1; // write to destination
65 dqcoeff_ptr[i] = x1 * dequant_ptr[i]; // dequantized value
69 if(eob<vp8_rvsplus1_default_zig_zag1d[i])
70 eob=(int)vp8_rvsplus1_default_zig_zag1d[i]; // last nonzero coeffs
74 qcoeff_ptr[i] = 0; // write to destination
75 dqcoeff_ptr[i] = 0; // dequantized value