| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 | 11 |
| 12 #include <math.h> | 12 #include <math.h> |
| 13 #include "vpx_mem/vpx_mem.h" | 13 #include "vpx_mem/vpx_mem.h" |
| 14 | 14 |
| 15 #include "vp8/encoder/quantize.h" | 15 #include "vp8/encoder/quantize.h" |
| 16 #include "vp8/common/entropy.h" | 16 #include "vp8/common/entropy.h" |
| 17 | 17 |
| 18 DECLARE_ALIGNED(16, const short, vp8_rvsplus1_default_zig_zag1d[16]) = | 18 |
| 19 #if HAVE_ARMV7 |
| 20 |
| 21 /* vp8_quantize_mbX functions here differs from corresponding ones in |
| 22 * quantize.c only by using quantize_b_pair function pointer instead of |
| 23 * the regular quantize_b function pointer */ |
| 24 void vp8_quantize_mby_neon(MACROBLOCK *x) |
| 19 { | 25 { |
| 20 1, 2, 6, 7, | 26 int i; |
| 21 3, 5, 8, 13, | 27 int has_2nd_order = (x->e_mbd.mode_info_context->mbmi.mode != B_PRED |
| 22 4, 9, 12, 14, | 28 && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV); |
| 23 10, 11, 15, 16, | 29 |
| 24 }; | 30 for (i = 0; i < 16; i+=2) |
| 31 x->quantize_b_pair(&x->block[i], &x->block[i+1], |
| 32 &x->e_mbd.block[i], &x->e_mbd.block[i+1]); |
| 33 |
| 34 if(has_2nd_order) |
| 35 x->quantize_b(&x->block[24], &x->e_mbd.block[24]); |
| 36 } |
| 37 |
| 38 void vp8_quantize_mb_neon(MACROBLOCK *x) |
| 39 { |
| 40 int i; |
| 41 int has_2nd_order=(x->e_mbd.mode_info_context->mbmi.mode != B_PRED |
| 42 && x->e_mbd.mode_info_context->mbmi.mode != SPLITMV); |
| 43 |
| 44 for (i = 0; i < 24; i+=2) |
| 45 x->quantize_b_pair(&x->block[i], &x->block[i+1], |
| 46 &x->e_mbd.block[i], &x->e_mbd.block[i+1]); |
| 47 |
| 48 if (has_2nd_order) |
| 49 x->quantize_b(&x->block[i], &x->e_mbd.block[i]); |
| 50 } |
| 25 | 51 |
| 26 | 52 |
| 27 extern int vp8_fast_quantize_b_neon_func(short *coeff_ptr, short *zbin_ptr, shor
t *qcoeff_ptr, short *dqcoeff_ptr, short *dequant_ptr, const short *scan_mask, s
hort *round_ptr, short *quant_ptr); | 53 void vp8_quantize_mbuv_neon(MACROBLOCK *x) |
| 54 { |
| 55 int i; |
| 28 | 56 |
| 29 void vp8_fast_quantize_b_neon(BLOCK *b, BLOCKD *d) | 57 for (i = 16; i < 24; i+=2) |
| 30 { | 58 x->quantize_b_pair(&x->block[i], &x->block[i+1], |
| 31 d->eob = vp8_fast_quantize_b_neon_func(b->coeff, b->zbin, d->qcoeff, d->dqco
eff, d->dequant, vp8_rvsplus1_default_zig_zag1d, b->round, b->quant_fast); | 59 &x->e_mbd.block[i], &x->e_mbd.block[i+1]); |
| 32 } | 60 } |
| 33 | 61 |
| 34 /* | 62 #endif /* HAVE_ARMV7 */ |
| 35 //neon code is written according to the following rewritten c code | |
| 36 void vp8_fast_quantize_b_neon(BLOCK *b,BLOCKD *d) | |
| 37 { | |
| 38 int i, rc, eob; | |
| 39 int zbin; | |
| 40 int x, x1, y, z, sz; | |
| 41 short *coeff_ptr = &b->Coeff[0]; | |
| 42 short *zbin_ptr = &b->Zbin[0][0]; | |
| 43 short *round_ptr = &b->Round[0][0]; | |
| 44 short *quant_ptr = &b->Quant[0][0]; | |
| 45 short *qcoeff_ptr = d->qcoeff; | |
| 46 short *dqcoeff_ptr= d->dqcoeff; | |
| 47 short *dequant_ptr= &d->Dequant[0][0]; | |
| 48 | |
| 49 eob = 0; | |
| 50 | |
| 51 for(i=0;i<16;i++) | |
| 52 { | |
| 53 z = coeff_ptr[i]; | |
| 54 zbin = zbin_ptr[i] ; | |
| 55 x = abs(z); // x = abs(z) | |
| 56 | |
| 57 if(x>=zbin) | |
| 58 { | |
| 59 sz = (z>>31); // sign of z | |
| 60 y = ((x+round_ptr[i])*quant_ptr[i])>>16; // quantize (x) | |
| 61 x1 = (y^sz) - sz; // get the sign back | |
| 62 | |
| 63 qcoeff_ptr[i] = x1; // write to destination | |
| 64 dqcoeff_ptr[i] = x1 * dequant_ptr[i]; // dequantized value | |
| 65 | |
| 66 if(y) | |
| 67 { | |
| 68 if(eob<vp8_rvsplus1_default_zig_zag1d[i]) | |
| 69 eob=(int)vp8_rvsplus1_default_zig_zag1d[i]; // last
nonzero coeffs | |
| 70 } | |
| 71 }else | |
| 72 { | |
| 73 qcoeff_ptr[i] = 0; // write to destination | |
| 74 dqcoeff_ptr[i] = 0; // dequantized value | |
| 75 } | |
| 76 } | |
| 77 d->eob = eob; | |
| 78 } | |
| 79 */ | |
| OLD | NEW |