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 #include "vpx_ports/config.h"
12 #include "idct.h"
13 #include "dequantize.h"
14
15 void idct_dequant_dc_0_2x_sse2
16 (short *q, short *dq, unsigned char *pre,
17 unsigned char *dst, int dst_stride, short *dc);
18 void idct_dequant_dc_full_2x_sse2
19 (short *q, short *dq, unsigned char *pre,
20 unsigned char *dst, int dst_stride, short *dc);
21
22 void idct_dequant_0_2x_sse2
23 (short *q, short *dq ,unsigned char *pre,
24 unsigned char *dst, int dst_stride, int blk_stride);
25 void idct_dequant_full_2x_sse2
26 (short *q, short *dq ,unsigned char *pre,
27 unsigned char *dst, int dst_stride, int blk_stride);
28
vp8_dequant_dc_idct_add_y_block_sse2(short * q,short * dq,unsigned char * pre,unsigned char * dst,int stride,char * eobs,short * dc)29 void vp8_dequant_dc_idct_add_y_block_sse2
30 (short *q, short *dq, unsigned char *pre,
31 unsigned char *dst, int stride, char *eobs, short *dc)
32 {
33 int i;
34
35 for (i = 0; i < 4; i++)
36 {
37 if (((short *)(eobs))[0] & 0xfefe)
38 idct_dequant_dc_full_2x_sse2 (q, dq, pre, dst, stride, dc);
39 else
40 idct_dequant_dc_0_2x_sse2 (q, dq, pre, dst, stride, dc);
41
42 if (((short *)(eobs))[1] & 0xfefe)
43 idct_dequant_dc_full_2x_sse2 (q+32, dq, pre+8, dst+8, stride, dc+2);
44 else
45 idct_dequant_dc_0_2x_sse2 (q+32, dq, pre+8, dst+8, stride, dc+2);
46
47 q += 64;
48 dc += 4;
49 pre += 64;
50 dst += stride*4;
51 eobs += 4;
52 }
53 }
54
vp8_dequant_idct_add_y_block_sse2(short * q,short * dq,unsigned char * pre,unsigned char * dst,int stride,char * eobs)55 void vp8_dequant_idct_add_y_block_sse2
56 (short *q, short *dq, unsigned char *pre,
57 unsigned char *dst, int stride, char *eobs)
58 {
59 int i;
60
61 for (i = 0; i < 4; i++)
62 {
63 if (((short *)(eobs))[0] & 0xfefe)
64 idct_dequant_full_2x_sse2 (q, dq, pre, dst, stride, 16);
65 else
66 idct_dequant_0_2x_sse2 (q, dq, pre, dst, stride, 16);
67
68 if (((short *)(eobs))[1] & 0xfefe)
69 idct_dequant_full_2x_sse2 (q+32, dq, pre+8, dst+8, stride, 16);
70 else
71 idct_dequant_0_2x_sse2 (q+32, dq, pre+8, dst+8, stride, 16);
72
73 q += 64;
74 pre += 64;
75 dst += stride*4;
76 eobs += 4;
77 }
78 }
79
vp8_dequant_idct_add_uv_block_sse2(short * q,short * dq,unsigned char * pre,unsigned char * dstu,unsigned char * dstv,int stride,char * eobs)80 void vp8_dequant_idct_add_uv_block_sse2
81 (short *q, short *dq, unsigned char *pre,
82 unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
83 {
84 if (((short *)(eobs))[0] & 0xfefe)
85 idct_dequant_full_2x_sse2 (q, dq, pre, dstu, stride, 8);
86 else
87 idct_dequant_0_2x_sse2 (q, dq, pre, dstu, stride, 8);
88
89 q += 32;
90 pre += 32;
91 dstu += stride*4;
92
93 if (((short *)(eobs))[1] & 0xfefe)
94 idct_dequant_full_2x_sse2 (q, dq, pre, dstu, stride, 8);
95 else
96 idct_dequant_0_2x_sse2 (q, dq, pre, dstu, stride, 8);
97
98 q += 32;
99 pre += 32;
100
101 if (((short *)(eobs))[2] & 0xfefe)
102 idct_dequant_full_2x_sse2 (q, dq, pre, dstv, stride, 8);
103 else
104 idct_dequant_0_2x_sse2 (q, dq, pre, dstv, stride, 8);
105
106 q += 32;
107 pre += 32;
108 dstv += stride*4;
109
110 if (((short *)(eobs))[3] & 0xfefe)
111 idct_dequant_full_2x_sse2 (q, dq, pre, dstv, stride, 8);
112 else
113 idct_dequant_0_2x_sse2 (q, dq, pre, dstv, stride, 8);
114 }
115