• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3  *
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.
9  */
10 
11 
12 #include <math.h>
13 #include "vpx_mem/vpx_mem.h"
14 
15 #include "quantize.h"
16 #include "entropy.h"
17 #include "predictdc.h"
18 
19 DECLARE_ALIGNED(16, const short, vp8_rvsplus1_default_zig_zag1d[16]) =
20 {
21     1,  2,  6,  7,
22     3,  5,  8,  13,
23     4,  9,  12, 14,
24     10, 11, 15, 16,
25 };
26 
27 
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);
29 
vp8_fast_quantize_b_neon(BLOCK * b,BLOCKD * d)30 void vp8_fast_quantize_b_neon(BLOCK *b, BLOCKD *d)
31 {
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);
33 }
34 
35 /*
36 //neon code is written according to the following rewritten c code
37 void vp8_fast_quantize_b_neon(BLOCK *b,BLOCKD *d)
38 {
39     int i, rc, eob;
40     int zbin;
41     int x, x1, y, z, sz;
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];
49 
50     eob = 0;
51 
52     for(i=0;i<16;i++)
53     {
54         z    = coeff_ptr[i];
55         zbin = zbin_ptr[i] ;
56         x  = abs(z);                                    // x = abs(z)
57 
58         if(x>=zbin)
59         {
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
63 
64             qcoeff_ptr[i] = x1;                          // write to destination
65             dqcoeff_ptr[i] = x1 * dequant_ptr[i];         // dequantized value
66 
67             if(y)
68             {
69                 if(eob<vp8_rvsplus1_default_zig_zag1d[i])
70                     eob=(int)vp8_rvsplus1_default_zig_zag1d[i];         // last nonzero coeffs
71             }
72         }else
73         {
74             qcoeff_ptr[i] = 0;                          // write to destination
75             dqcoeff_ptr[i] = 0;         // dequantized value
76         }
77     }
78         d->eob = eob;
79 }
80 */
81