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.
12 /****************************************************************************
15 * This implementation makes use of 16 bit fixed point verio of two multiply
17 * 1. sqrt(2) * cos (pi/8)
18 * 2. sqrt(2) * sin (pi/8)
19 * Becuase the first constant is bigger than 1, to maintain the same 16 bit
20 * fixed point precision as the second one, we use a trick of
23 * x * sqrt(2) * cos (pi/8) = x + x * (sqrt(2) *cos(pi/8)-1).
24 **************************************************************************/
25 static const int cospi8sqrt2minus1
= 20091;
26 static const int sinpi8sqrt2
= 35468;
27 static const int rounding
= 0;
28 void vp8_short_idct4x4llm_c(short *input
, short *output
, int pitch
)
36 int shortpitch
= pitch
>> 1;
38 for (i
= 0; i
< 4; i
++)
43 temp1
= (ip
[4] * sinpi8sqrt2
+ rounding
) >> 16;
44 temp2
= ip
[12] + ((ip
[12] * cospi8sqrt2minus1
+ rounding
) >> 16);
47 temp1
= ip
[4] + ((ip
[4] * cospi8sqrt2minus1
+ rounding
) >> 16);
48 temp2
= (ip
[12] * sinpi8sqrt2
+ rounding
) >> 16;
51 op
[shortpitch
*0] = a1
+ d1
;
52 op
[shortpitch
*3] = a1
- d1
;
54 op
[shortpitch
*1] = b1
+ c1
;
55 op
[shortpitch
*2] = b1
- c1
;
64 for (i
= 0; i
< 4; i
++)
69 temp1
= (ip
[1] * sinpi8sqrt2
+ rounding
) >> 16;
70 temp2
= ip
[3] + ((ip
[3] * cospi8sqrt2minus1
+ rounding
) >> 16);
73 temp1
= ip
[1] + ((ip
[1] * cospi8sqrt2minus1
+ rounding
) >> 16);
74 temp2
= (ip
[3] * sinpi8sqrt2
+ rounding
) >> 16;
78 op
[0] = (a1
+ d1
+ 4) >> 3;
79 op
[3] = (a1
- d1
+ 4) >> 3;
81 op
[1] = (b1
+ c1
+ 4) >> 3;
82 op
[2] = (b1
- c1
+ 4) >> 3;
89 void vp8_short_idct4x4llm_1_c(short *input
, short *output
, int pitch
)
94 int shortpitch
= pitch
>> 1;
95 a1
= ((input
[0] + 4) >> 3);
97 for (i
= 0; i
< 4; i
++)
107 void vp8_dc_only_idct_add_c(short input_dc
, unsigned char *pred_ptr
, unsigned char *dst_ptr
, int pitch
, int stride
)
109 int a1
= ((input_dc
+ 4) >> 3);
112 for (r
= 0; r
< 4; r
++)
114 for (c
= 0; c
< 4; c
++)
116 int a
= a1
+ pred_ptr
[c
] ;
124 dst_ptr
[c
] = (unsigned char) a
;
133 void vp8_short_inv_walsh4x4_c(short *input
, short *output
)
141 for (i
= 0; i
< 4; i
++)
159 for (i
= 0; i
< 4; i
++)
171 op
[0] = (a2
+ 3) >> 3;
172 op
[1] = (b2
+ 3) >> 3;
173 op
[2] = (c2
+ 3) >> 3;
174 op
[3] = (d2
+ 3) >> 3;
181 void vp8_short_inv_walsh4x4_1_c(short *input
, short *output
)
187 a1
= ((input
[0] + 3) >> 3);
189 for (i
= 0; i
< 4; i
++)