[cvs] / xvidcore / src / image / interpolate8x8.h Repository:
ViewVC logotype

Annotation of /xvidcore/src/image/interpolate8x8.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (view) (download)

1 : Isibaar 1.1 #include "../utils/mem_transfer.h"
2 :    
3 : edgomez 1.3 typedef void (INTERPOLATE8X8) (uint8_t * const dst,
4 :     const uint8_t * const src,
5 :     const uint32_t stride,
6 :     const uint32_t rounding);
7 :     typedef INTERPOLATE8X8 *INTERPOLATE8X8_PTR;
8 : Isibaar 1.1
9 :     extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_h;
10 :     extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_v;
11 :     extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_hv;
12 :    
13 :     INTERPOLATE8X8 interpolate8x8_halfpel_h_c;
14 :     INTERPOLATE8X8 interpolate8x8_halfpel_v_c;
15 :     INTERPOLATE8X8 interpolate8x8_halfpel_hv_c;
16 :    
17 :     INTERPOLATE8X8 interpolate8x8_halfpel_h_mmx;
18 :     INTERPOLATE8X8 interpolate8x8_halfpel_v_mmx;
19 :     INTERPOLATE8X8 interpolate8x8_halfpel_hv_mmx;
20 :    
21 :     INTERPOLATE8X8 interpolate8x8_halfpel_h_xmm;
22 :     INTERPOLATE8X8 interpolate8x8_halfpel_v_xmm;
23 :     INTERPOLATE8X8 interpolate8x8_halfpel_hv_xmm;
24 :    
25 :     INTERPOLATE8X8 interpolate8x8_halfpel_h_3dn;
26 :     INTERPOLATE8X8 interpolate8x8_halfpel_v_3dn;
27 :     INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dn;
28 :    
29 : Isibaar 1.4 INTERPOLATE8X8 interpolate8x8_halfpel_h_ia64;
30 :     INTERPOLATE8X8 interpolate8x8_halfpel_v_ia64;
31 :     INTERPOLATE8X8 interpolate8x8_halfpel_hv_ia64;
32 :    
33 : Isibaar 1.5 void interpolate8x8_lowpass_h(uint8_t *dst, uint8_t *src, int32_t dst_stride, int32_t src_stride, int32_t rounding);
34 :     void interpolate8x8_lowpass_v(uint8_t *dst, uint8_t *src, int32_t dst_stride, int32_t src_stride, int32_t rounding);
35 :     void interpolate8x8_lowpass_hv(uint8_t *dst1, uint8_t *dst2, uint8_t *src, int32_t dst1_stride, int32_t dst2_stride, int32_t src_stride, int32_t rounding);
36 :     void interpolate8x8_bilinear2(uint8_t *dst, uint8_t *src1, uint8_t *src2, int32_t dst_stride, int32_t src_stride, int32_t rounding);
37 :     void interpolate8x8_bilinear4(uint8_t *dst, uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4, int32_t stride, int32_t rounding);
38 :    
39 :     void interpolate8x8_c(uint8_t * const dst,
40 :     const uint8_t * const src,
41 :     const uint32_t x,
42 :     const uint32_t y,
43 :     const uint32_t stride);
44 :    
45 : edgomez 1.3 static __inline void
46 :     interpolate8x8_switch(uint8_t * const cur,
47 :     const uint8_t * const refn,
48 :     const uint32_t x,
49 :     const uint32_t y,
50 :     const int32_t dx,
51 :     const int dy,
52 :     const uint32_t stride,
53 :     const uint32_t rounding)
54 : Isibaar 1.1 {
55 :     int32_t ddx, ddy;
56 :    
57 : edgomez 1.3 switch (((dx & 1) << 1) + (dy & 1)) // ((dx%2)?2:0)+((dy%2)?1:0)
58 :     {
59 :     case 0:
60 :     ddx = dx / 2;
61 :     ddy = dy / 2;
62 :     transfer8x8_copy(cur + y * stride + x,
63 : Isibaar 1.4 refn + (int)((y + ddy) * stride + x + ddx), stride);
64 : Isibaar 1.1 break;
65 :    
66 : edgomez 1.3 case 1:
67 :     ddx = dx / 2;
68 :     ddy = (dy - 1) / 2;
69 :     interpolate8x8_halfpel_v(cur + y * stride + x,
70 : Isibaar 1.4 refn + (int)((y + ddy) * stride + x + ddx), stride,
71 : edgomez 1.3 rounding);
72 : Isibaar 1.1 break;
73 :    
74 : edgomez 1.3 case 2:
75 :     ddx = (dx - 1) / 2;
76 :     ddy = dy / 2;
77 :     interpolate8x8_halfpel_h(cur + y * stride + x,
78 : Isibaar 1.4 refn + (int)((y + ddy) * stride + x + ddx), stride,
79 : edgomez 1.3 rounding);
80 : Isibaar 1.1 break;
81 :    
82 : edgomez 1.3 default:
83 :     ddx = (dx - 1) / 2;
84 :     ddy = (dy - 1) / 2;
85 :     interpolate8x8_halfpel_hv(cur + y * stride + x,
86 : Isibaar 1.4 refn + (int)((y + ddy) * stride + x + ddx), stride,
87 : edgomez 1.3 rounding);
88 : Isibaar 1.1 break;
89 : edgomez 1.3 }
90 : Isibaar 1.1 }
91 : chenm001 1.2
92 :    
93 : Isibaar 1.5 static __inline void interpolate8x8_quarterpel(uint8_t * const cur,
94 :     uint8_t * const refn,
95 :     const uint32_t x, const uint32_t y,
96 :     const int32_t dx, const int dy,
97 :     const uint32_t stride,
98 :     const uint32_t rounding)
99 :     {
100 :     const int32_t xRef = x*4 + dx;
101 :     const int32_t yRef = y*4 + dy;
102 :    
103 :     uint8_t *src, *dst;
104 :     int32_t x_int, y_int, x_frac, y_frac;
105 :    
106 :     uint8_t halfpel_h[72];
107 :     uint8_t halfpel_v[64];
108 :     uint8_t halfpel_hv[64];
109 :    
110 :     x_int = xRef/4;
111 :     if (xRef < 0 && xRef % 4)
112 :     x_int--;
113 :    
114 :     x_frac = xRef - (4*x_int);
115 :    
116 :     y_int = yRef/4;
117 :     if (yRef < 0 && yRef % 4)
118 :     y_int--;
119 :    
120 :     y_frac = yRef - (4*y_int);
121 :    
122 :     src = refn + y_int * stride + x_int;
123 :     dst = cur + y * stride + x;
124 :    
125 :     switch((y_frac << 2) | (x_frac)) {
126 :    
127 :     case 0:
128 :     transfer8x8_copy(dst, src, stride);
129 :     break;
130 :    
131 :     case 1:
132 :     interpolate8x8_lowpass_h(halfpel_h, src, 8, stride, rounding);
133 :     interpolate8x8_bilinear2(dst, src, halfpel_h, stride, stride, rounding);
134 :     break;
135 :    
136 :     case 2:
137 :     interpolate8x8_lowpass_h(dst, src, stride, stride, rounding);
138 :     break;
139 :    
140 :     case 3:
141 :     interpolate8x8_lowpass_h(halfpel_h, src, 8, stride, rounding);
142 :     interpolate8x8_bilinear2(dst, src+1, halfpel_h, stride, stride, rounding);
143 :     break;
144 :    
145 :     case 4:
146 :     interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding);
147 :     interpolate8x8_bilinear2(dst, src, halfpel_v, stride, stride, rounding);
148 :     break;
149 :    
150 :     case 5:
151 :     interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding);
152 :     interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);
153 :     interpolate8x8_bilinear4(dst, src, halfpel_h, halfpel_v, halfpel_hv, stride, rounding);
154 :     break;
155 :    
156 :     case 6:
157 :     interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);
158 :     interpolate8x8_bilinear2(dst, halfpel_h, halfpel_hv, stride, 8, 1-rounding);
159 :     break;
160 :    
161 :     case 7:
162 :     interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, 16-rounding);
163 :     interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);
164 :     interpolate8x8_bilinear4(dst, src+1, halfpel_h, halfpel_v, halfpel_hv, stride, rounding);
165 :     break;
166 :    
167 :     case 8:
168 :     interpolate8x8_lowpass_v(dst, src, stride, stride, rounding);
169 :     break;
170 :    
171 :     case 9:
172 :     interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, 16-rounding);
173 :     interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);
174 :     interpolate8x8_bilinear2(dst, halfpel_v, halfpel_hv, stride, 8, rounding);
175 :     break;
176 :    
177 :     case 10:
178 :     interpolate8x8_lowpass_hv(dst, halfpel_h, src, stride, 8, stride, rounding);
179 :     break;
180 :    
181 :     case 11:
182 :     interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, 16-rounding);
183 :     interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);
184 :     interpolate8x8_bilinear2(dst, halfpel_v, halfpel_hv, stride, 8, rounding);
185 :     break;
186 :    
187 :     case 12:
188 :     interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding);
189 :     interpolate8x8_bilinear2(dst, src+stride, halfpel_v, stride, stride, rounding);
190 :     break;
191 :    
192 :     case 13:
193 :     interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding);
194 :     interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);
195 :     interpolate8x8_bilinear4(dst, src+stride, halfpel_h+8, halfpel_v, halfpel_hv, stride, rounding);
196 :     break;
197 :    
198 :     case 14:
199 :     interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);
200 :     interpolate8x8_bilinear2(dst, halfpel_h+8, halfpel_hv, stride, 8, rounding);
201 :     break;
202 :    
203 :     case 15:
204 :     interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, rounding);
205 :     interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);
206 :     interpolate8x8_bilinear4(dst, src+stride+1, halfpel_h+8, halfpel_v, halfpel_hv, stride, rounding);
207 :     break;
208 :     }
209 :     }

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4