Index: libvpx/source/libvpx/vp8/encoder/arm/quantize_arm.c |
diff --git a/libvpx/source/libvpx/vp8/encoder/arm/quantize_arm.c b/libvpx/source/libvpx/vp8/encoder/arm/quantize_arm.c |
index 52d84013e8c130d65b064fc11fe86ec491d62393..0e3334ac7e21499b35c5a2283b8fa1c146525fb6 100644 |
--- a/libvpx/source/libvpx/vp8/encoder/arm/quantize_arm.c |
+++ b/libvpx/source/libvpx/vp8/encoder/arm/quantize_arm.c |
@@ -15,48 +15,65 @@ |
#include "vp8/encoder/quantize.h" |
#include "vp8/common/entropy.h" |
- |
-#if HAVE_ARMV7 |
- |
-/* vp8_quantize_mbX functions here differs from corresponding ones in |
- * quantize.c only by using quantize_b_pair function pointer instead of |
- * the regular quantize_b function pointer */ |
-void vp8_quantize_mby_neon(MACROBLOCK *x) |
+DECLARE_ALIGNED(16, const short, vp8_rvsplus1_default_zig_zag1d[16]) = |
{ |
- int i; |
- int has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED |
- && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV); |
+ 1, 2, 6, 7, |
+ 3, 5, 8, 13, |
+ 4, 9, 12, 14, |
+ 10, 11, 15, 16, |
+}; |
- for (i = 0; i < 16; i+=2) |
- x->quantize_b_pair(&x->block[i], &x->block[i+1], |
- &x->e_mbd.block[i], &x->e_mbd.block[i+1]); |
- if(has_2nd_order) |
- x->quantize_b(&x->block[24], &x->e_mbd.block[24]); |
+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); |
+ |
+void vp8_fast_quantize_b_neon(BLOCK *b, BLOCKD *d) |
+{ |
+ 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_fast); |
} |
-void vp8_quantize_mb_neon(MACROBLOCK *x) |
+/* |
+//neon code is written according to the following rewritten c code |
+void vp8_fast_quantize_b_neon(BLOCK *b,BLOCKD *d) |
{ |
- int i; |
- int has_2nd_order=(x->e_mbd.mode_info_context->mbmi.mode != B_PRED |
- && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV); |
+ int i, rc, eob; |
+ int zbin; |
+ int x, x1, y, z, sz; |
+ short *coeff_ptr = &b->Coeff[0]; |
+ short *zbin_ptr = &b->Zbin[0][0]; |
+ short *round_ptr = &b->Round[0][0]; |
+ short *quant_ptr = &b->Quant[0][0]; |
+ short *qcoeff_ptr = d->qcoeff; |
+ short *dqcoeff_ptr= d->dqcoeff; |
+ short *dequant_ptr= &d->Dequant[0][0]; |
- for (i = 0; i < 24; i+=2) |
- x->quantize_b_pair(&x->block[i], &x->block[i+1], |
- &x->e_mbd.block[i], &x->e_mbd.block[i+1]); |
+ eob = 0; |
- if (has_2nd_order) |
- x->quantize_b(&x->block[i], &x->e_mbd.block[i]); |
-} |
+ for(i=0;i<16;i++) |
+ { |
+ z = coeff_ptr[i]; |
+ zbin = zbin_ptr[i] ; |
+ x = abs(z); // x = abs(z) |
+ if(x>=zbin) |
+ { |
+ sz = (z>>31); // sign of z |
+ y = ((x+round_ptr[i])*quant_ptr[i])>>16; // quantize (x) |
+ x1 = (y^sz) - sz; // get the sign back |
-void vp8_quantize_mbuv_neon(MACROBLOCK *x) |
-{ |
- int i; |
+ qcoeff_ptr[i] = x1; // write to destination |
+ dqcoeff_ptr[i] = x1 * dequant_ptr[i]; // dequantized value |
- for (i = 16; i < 24; i+=2) |
- x->quantize_b_pair(&x->block[i], &x->block[i+1], |
- &x->e_mbd.block[i], &x->e_mbd.block[i+1]); |
+ if(y) |
+ { |
+ if(eob<vp8_rvsplus1_default_zig_zag1d[i]) |
+ eob=(int)vp8_rvsplus1_default_zig_zag1d[i]; // last nonzero coeffs |
+ } |
+ }else |
+ { |
+ qcoeff_ptr[i] = 0; // write to destination |
+ dqcoeff_ptr[i] = 0; // dequantized value |
+ } |
+ } |
+ d->eob = eob; |
} |
- |
-#endif /* HAVE_ARMV7 */ |
+*/ |