• 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 #include "vpx_ports/config.h"
12 #include "idct.h"
13 #include "dequantize.h"
14 
15 
vp8_dequant_dc_idct_add_y_block_mips(short * q,short * dq,unsigned char * pre,unsigned char * dst,int stride,char * eobs,short * dc)16 void vp8_dequant_dc_idct_add_y_block_mips
17             (short *q, short *dq, unsigned char *pre,
18              unsigned char *dst, int stride, char *eobs, short *dc)
19 {
20     int i, j;
21     int higher = 4*stride - 12;
22 
23     /* unroll the loop */
24     for (i = 0; i < 4; i++)
25     {
26         if (*eobs++ > 1)
27             vp8_dequant_dc_idct_add_mips(q, dq, pre, dst, 16, stride, dc[0]);
28         else
29             vp8_dc_only_idct_add_mips(dc[0], pre, dst, 16, stride);
30 
31         q   += 16;
32         pre += 4;
33         dst += 4;
34 
35         if (*eobs++ > 1)
36             vp8_dequant_dc_idct_add_mips(q, dq, pre, dst, 16, stride, dc[1]);
37         else
38             vp8_dc_only_idct_add_mips(dc[1], pre, dst, 16, stride);
39 
40         q   += 16;
41         pre += 4;
42         dst += 4;
43 
44         if (*eobs++ > 1)
45             vp8_dequant_dc_idct_add_mips(q, dq, pre, dst, 16, stride, dc[2]);
46         else
47             vp8_dc_only_idct_add_mips(dc[2], pre, dst, 16, stride);
48 
49         q   += 16;
50         pre += 4;
51         dst += 4;
52 
53         if (*eobs++ > 1)
54             vp8_dequant_dc_idct_add_mips(q, dq, pre, dst, 16, stride, dc[3]);
55         else
56             vp8_dc_only_idct_add_mips(dc[3], pre, dst, 16, stride);
57 
58         q   += 16;
59         dc += 4;
60         pre += 52;
61         dst += higher;
62     }
63 }
64 
65 
vp8_dequant_idct_add_y_block_mips(short * q,short * dq,unsigned char * pre,unsigned char * dst,int stride,char * eobs)66 void vp8_dequant_idct_add_y_block_mips
67             (short *q, short *dq, unsigned char *pre,
68              unsigned char *dst, int stride, char *eobs)
69 {
70     int i, j;
71     int higher = 4*stride -12;
72 
73     /* unroll the loop */
74     for (i = 4; i--; )
75     {
76         if (*eobs++ > 1)
77             vp8_dequant_idct_add_mips(q, dq, pre, dst, 16, stride);
78         else
79         {
80             vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dst, 16, stride);
81             ((int *)q)[0] = 0;
82         }
83 
84         q   += 16;
85         pre += 4;
86         dst += 4;
87 
88         if (*eobs++ > 1)
89             vp8_dequant_idct_add_mips(q, dq, pre, dst, 16, stride);
90         else
91         {
92             vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dst, 16, stride);
93             ((int *)q)[0] = 0;
94         }
95 
96         q   += 16;
97         pre += 4;
98         dst += 4;
99 
100         if (*eobs++ > 1)
101             vp8_dequant_idct_add_mips(q, dq, pre, dst, 16, stride);
102         else
103         {
104             vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dst, 16, stride);
105             ((int *)q)[0] = 0;
106         }
107 
108         q   += 16;
109         pre += 4;
110         dst += 4;
111 
112         if (*eobs++ > 1)
113             vp8_dequant_idct_add_mips(q, dq, pre, dst, 16, stride);
114         else
115         {
116             vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dst, 16, stride);
117             ((int *)q)[0] = 0;
118         }
119 
120         q   += 16;
121         pre += 52;
122         dst += higher;
123     }
124 }
125 
126 
vp8_dequant_idct_add_uv_block_mips(short * q,short * dq,unsigned char * pre,unsigned char * dstu,unsigned char * dstv,int stride,char * eobs)127 void vp8_dequant_idct_add_uv_block_mips
128             (short *q, short *dq, unsigned char *pre,
129              unsigned char *dstu, unsigned char *dstv, int stride, char *eobs)
130 {
131     int i, j;
132     int higher = 4*stride -4;
133 
134     /* unroll the loops */
135     if (*eobs++ > 1)
136         vp8_dequant_idct_add_mips(q, dq, pre, dstu, 8, stride);
137     else
138     {
139         vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstu, 8, stride);
140         ((int *)q)[0] = 0;
141     }
142 
143     q    += 16;
144     pre  += 4;
145     dstu += 4;
146 
147     if (*eobs++ > 1)
148         vp8_dequant_idct_add_mips(q, dq, pre, dstu, 8, stride);
149     else
150     {
151         vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstu, 8, stride);
152         ((int *)q)[0] = 0;
153     }
154 
155     q    += 16;
156     pre  += 28;
157     dstu += higher;
158 
159     if (*eobs++ > 1)
160         vp8_dequant_idct_add_mips(q, dq, pre, dstu, 8, stride);
161     else
162     {
163         vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstu, 8, stride);
164         ((int *)q)[0] = 0;
165     }
166 
167     q    += 16;
168     pre  += 4;
169     dstu += 4;
170 
171     if (*eobs++ > 1)
172         vp8_dequant_idct_add_mips(q, dq, pre, dstu, 8, stride);
173     else
174     {
175         vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstu, 8, stride);
176         ((int *)q)[0] = 0;
177     }
178 
179     q    += 16;
180     pre  += 28;
181 
182     if (*eobs++ > 1)
183         vp8_dequant_idct_add_mips(q, dq, pre, dstv, 8, stride);
184     else
185     {
186         vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstv, 8, stride);
187         ((int *)q)[0] = 0;
188     }
189 
190     q    += 16;
191     pre  += 4;
192     dstv += 4;
193 
194     if (*eobs++ > 1)
195         vp8_dequant_idct_add_mips(q, dq, pre, dstv, 8, stride);
196     else
197     {
198         vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstv, 8, stride);
199         ((int *)q)[0] = 0;
200     }
201 
202     q    += 16;
203     pre  += 28;
204     dstv += higher;
205 
206     if (*eobs++ > 1)
207         vp8_dequant_idct_add_mips(q, dq, pre, dstv, 8, stride);
208     else
209     {
210         vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstv, 8, stride);
211         ((int *)q)[0] = 0;
212     }
213 
214     q    += 16;
215     pre  += 4;
216     dstv += 4;
217 
218     if (*eobs++ > 1)
219         vp8_dequant_idct_add_mips(q, dq, pre, dstv, 8, stride);
220     else
221     {
222         vp8_dc_only_idct_add_mips(q[0]*dq[0], pre, dstv, 8, stride);
223         ((int *)q)[0] = 0;
224     }
225 }