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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5.2.2, Sat Oct 5 21:30:50 2002 UTC revision 1.10.2.5, Mon Aug 18 19:02:50 2003 UTC
# Line 1  Line 1 
1    /*****************************************************************************
2     *
3     *  XVID MPEG-4 VIDEO CODEC
4     *  - Interpolation related header  -
5     *
6     *  Copyright(C) 2001-2003 Peter Ross <pross@xvid.org>
7     *
8     *  This program is free software ; you can redistribute it and/or modify
9     *  it under the terms of the GNU General Public License as published by
10     *  the Free Software Foundation ; either version 2 of the License, or
11     *  (at your option) any later version.
12     *
13     *  This program is distributed in the hope that it will be useful,
14     *  but WITHOUT ANY WARRANTY ; without even the implied warranty of
15     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     *  GNU General Public License for more details.
17     *
18     *  You should have received a copy of the GNU General Public License
19     *  along with this program ; if not, write to the Free Software
20     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21     *
22     * $Id$
23     *
24     ****************************************************************************/
25    
26  #ifndef _INTERPOLATE8X8_H_  #ifndef _INTERPOLATE8X8_H_
27  #define _INTERPOLATE8X8_H_  #define _INTERPOLATE8X8_H_
28    
# Line 13  Line 38 
38                                                                          const uint8_t *src1,                                                                          const uint8_t *src1,
39                                                                          const uint8_t *src2,                                                                          const uint8_t *src2,
40                                                                          const uint32_t stride,                                                                          const uint32_t stride,
41                                                                          const uint32_t rounding);                                                                          const uint32_t rounding,
42                                                                            const uint32_t height);
43  typedef INTERPOLATE8X8_AVG2 *INTERPOLATE8X8_AVG2_PTR;  typedef INTERPOLATE8X8_AVG2 *INTERPOLATE8X8_AVG2_PTR;
44    
45  typedef void (INTERPOLATE8X8_AVG4) (uint8_t *dst,  typedef void (INTERPOLATE8X8_AVG4) (uint8_t *dst,
# Line 25  Line 51 
51                                                                          const uint32_t rounding);                                                                          const uint32_t rounding);
52  typedef INTERPOLATE8X8_AVG4 *INTERPOLATE8X8_AVG4_PTR;  typedef INTERPOLATE8X8_AVG4 *INTERPOLATE8X8_AVG4_PTR;
53    
54  typedef void (INTERPOLATE8X8_LOWPASS) (uint8_t *dst,  typedef void (INTERPOLATE_LOWPASS) (uint8_t *dst,
55                                                                             uint8_t *src,                                                                             uint8_t *src,
56                                                                             int32_t stride,                                                                             int32_t stride,
57                                                                             int32_t rounding);                                                                             int32_t rounding);
58    
59  typedef INTERPOLATE8X8_LOWPASS *INTERPOLATE8X8_LOWPASS_PTR;  typedef INTERPOLATE_LOWPASS *INTERPOLATE_LOWPASS_PTR;
60    
61  typedef void (INTERPOLATE8X8_LOWPASS_HV) (uint8_t *dst1,  typedef void (INTERPOLATE_LOWPASS_HV) (uint8_t *dst1,
62                                                                                    uint8_t *dst2,                                                                                    uint8_t *dst2,
63                                                                                    uint8_t *src,                                                                                    uint8_t *src,
64                                                                                    int32_t stride,                                                                                    int32_t stride,
65                                                                                    int32_t rounding);                                                                                    int32_t rounding);
66    
67  typedef INTERPOLATE8X8_LOWPASS_HV *INTERPOLATE8X8_LOWPASS_HV_PTR;  typedef INTERPOLATE_LOWPASS_HV *INTERPOLATE_LOWPASS_HV_PTR;
68    
69  typedef void (INTERPOLATE8X8_6TAP_LOWPASS) (uint8_t *dst,  typedef void (INTERPOLATE8X8_6TAP_LOWPASS) (uint8_t *dst,
70                                                                                  uint8_t *src,                                                                                  uint8_t *src,
# Line 54  Line 80 
80  extern INTERPOLATE8X8_AVG2_PTR interpolate8x8_avg2;  extern INTERPOLATE8X8_AVG2_PTR interpolate8x8_avg2;
81  extern INTERPOLATE8X8_AVG4_PTR interpolate8x8_avg4;  extern INTERPOLATE8X8_AVG4_PTR interpolate8x8_avg4;
82    
83  extern INTERPOLATE8X8_LOWPASS_PTR interpolate8x8_lowpass_h;  extern INTERPOLATE_LOWPASS_PTR interpolate8x8_lowpass_h;
84  extern INTERPOLATE8X8_LOWPASS_PTR interpolate8x8_lowpass_v;  extern INTERPOLATE_LOWPASS_PTR interpolate8x8_lowpass_v;
85    
86    extern INTERPOLATE_LOWPASS_PTR interpolate16x16_lowpass_h;
87    extern INTERPOLATE_LOWPASS_PTR interpolate16x16_lowpass_v;
88    
89  extern INTERPOLATE8X8_LOWPASS_HV_PTR interpolate8x8_lowpass_hv;  extern INTERPOLATE_LOWPASS_HV_PTR interpolate8x8_lowpass_hv;
90    extern INTERPOLATE_LOWPASS_HV_PTR interpolate16x16_lowpass_hv;
91    
92  extern INTERPOLATE8X8_6TAP_LOWPASS_PTR interpolate8x8_6tap_lowpass_h;  extern INTERPOLATE8X8_6TAP_LOWPASS_PTR interpolate8x8_6tap_lowpass_h;
93  extern INTERPOLATE8X8_6TAP_LOWPASS_PTR interpolate8x8_6tap_lowpass_v;  extern INTERPOLATE8X8_6TAP_LOWPASS_PTR interpolate8x8_6tap_lowpass_v;
# Line 66  Line 96 
96  INTERPOLATE8X8 interpolate8x8_halfpel_v_c;  INTERPOLATE8X8 interpolate8x8_halfpel_v_c;
97  INTERPOLATE8X8 interpolate8x8_halfpel_hv_c;  INTERPOLATE8X8 interpolate8x8_halfpel_hv_c;
98    
99    #ifdef ARCH_IS_IA32
100  INTERPOLATE8X8 interpolate8x8_halfpel_h_mmx;  INTERPOLATE8X8 interpolate8x8_halfpel_h_mmx;
101  INTERPOLATE8X8 interpolate8x8_halfpel_v_mmx;  INTERPOLATE8X8 interpolate8x8_halfpel_v_mmx;
102  INTERPOLATE8X8 interpolate8x8_halfpel_hv_mmx;  INTERPOLATE8X8 interpolate8x8_halfpel_hv_mmx;
# Line 78  Line 109 
109  INTERPOLATE8X8 interpolate8x8_halfpel_v_3dn;  INTERPOLATE8X8 interpolate8x8_halfpel_v_3dn;
110  INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dn;  INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dn;
111    
112    INTERPOLATE8X8 interpolate8x8_halfpel_h_3dne;
113    INTERPOLATE8X8 interpolate8x8_halfpel_v_3dne;
114    INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dne;
115    #endif
116    
117    #ifdef ARCH_IS_IA64
118  INTERPOLATE8X8 interpolate8x8_halfpel_h_ia64;  INTERPOLATE8X8 interpolate8x8_halfpel_h_ia64;
119  INTERPOLATE8X8 interpolate8x8_halfpel_v_ia64;  INTERPOLATE8X8 interpolate8x8_halfpel_v_ia64;
120  INTERPOLATE8X8 interpolate8x8_halfpel_hv_ia64;  INTERPOLATE8X8 interpolate8x8_halfpel_hv_ia64;
121    #endif
122    
123  INTERPOLATE8X8_AVG2 interpolate8x8_avg2_c;  INTERPOLATE8X8_AVG2 interpolate8x8_avg2_c;
124  INTERPOLATE8X8_AVG4 interpolate8x8_avg4_c;  INTERPOLATE8X8_AVG4 interpolate8x8_avg4_c;
125    
126    #ifdef ARCH_IS_IA32
127  INTERPOLATE8X8_AVG2 interpolate8x8_avg2_mmx;  INTERPOLATE8X8_AVG2 interpolate8x8_avg2_mmx;
128  INTERPOLATE8X8_AVG4 interpolate8x8_avg4_mmx;  INTERPOLATE8X8_AVG4 interpolate8x8_avg4_mmx;
129    #endif
130    
131    INTERPOLATE_LOWPASS interpolate8x8_lowpass_h_c;
132    INTERPOLATE_LOWPASS interpolate8x8_lowpass_v_c;
133    
134  INTERPOLATE8X8_LOWPASS interpolate8x8_lowpass_h_c;  INTERPOLATE_LOWPASS interpolate16x16_lowpass_h_c;
135  INTERPOLATE8X8_LOWPASS interpolate8x8_lowpass_v_c;  INTERPOLATE_LOWPASS interpolate16x16_lowpass_v_c;
136  INTERPOLATE8X8_LOWPASS_HV interpolate8x8_lowpass_hv_c;  
137    INTERPOLATE_LOWPASS_HV interpolate8x8_lowpass_hv_c;
138    INTERPOLATE_LOWPASS_HV interpolate16x16_lowpass_hv_c;
139    
140  INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_c;  INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_c;
141  INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_c;  INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_c;
142    
143    #ifdef ARCH_IS_IA32
144  INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_mmx;  INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_mmx;
145  INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_mmx;  INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_mmx;
146    #endif
147    
148  static __inline void  static __inline void
149  interpolate8x8_switch(uint8_t * const cur,  interpolate8x8_switch(uint8_t * const cur,
# Line 108  Line 155 
155                                            const uint32_t stride,                                            const uint32_t stride,
156                                            const uint32_t rounding)                                            const uint32_t rounding)
157  {  {
         int32_t ddx, ddy;  
158    
159          switch (((dx & 1) << 1) + (dy & 1))     // ((dx%2)?2:0)+((dy%2)?1:0)          const uint8_t * const src = refn + (int)((y + (dy>>1)) * stride + x + (dx>>1));
160          {          uint8_t * const dst = cur + (int)(y * stride + x);
161    
162            switch (((dx & 1) << 1) + (dy & 1))     { /* ((dx%2)?2:0)+((dy%2)?1:0) */
163          case 0:          case 0:
164                  ddx = dx / 2;                  transfer8x8_copy(dst, src, stride);
                 ddy = dy / 2;  
                 transfer8x8_copy(cur + y * stride + x,  
                                                  refn + (int)((y + ddy) * stride + x + ddx), stride);  
165                  break;                  break;
   
166          case 1:          case 1:
167                  ddx = dx / 2;                  interpolate8x8_halfpel_v(dst, src, stride, rounding);
                 ddy = (dy - 1) / 2;  
                 interpolate8x8_halfpel_v(cur + y * stride + x,  
                                                                  refn + (int)((y + ddy) * stride + x + ddx), stride,  
                                                                  rounding);  
168                  break;                  break;
   
169          case 2:          case 2:
170                  ddx = (dx - 1) / 2;                  interpolate8x8_halfpel_h(dst, src, stride, rounding);
                 ddy = dy / 2;  
                 interpolate8x8_halfpel_h(cur + y * stride + x,  
                                                                  refn + (int)((y + ddy) * stride + x + ddx), stride,  
                                                                  rounding);  
171                  break;                  break;
   
172          default:          default:
173                  ddx = (dx - 1) / 2;                  interpolate8x8_halfpel_hv(dst, src, stride, rounding);
                 ddy = (dy - 1) / 2;  
                 interpolate8x8_halfpel_hv(cur + y * stride + x,  
                                                                  refn + (int)((y + ddy) * stride + x + ddx), stride,  
                                                                   rounding);  
174                  break;                  break;
175          }          }
176  }  }
177    
178  static __inline uint8_t *  
179  interpolate8x8_switch2(uint8_t * const buffer,  static __inline void
180    interpolate16x16_switch(uint8_t * const cur,
181                                            const uint8_t * const refn,                                            const uint8_t * const refn,
182                                            const uint32_t x,                                            const uint32_t x,
183                                            const uint32_t y,                                            const uint32_t y,
# Line 155  Line 186 
186                                            const uint32_t stride,                                            const uint32_t stride,
187                                            const uint32_t rounding)                                            const uint32_t rounding)
188  {  {
189          int32_t ddx, ddy;          interpolate8x8_switch(cur, refn, x,   y,   dx, dy, stride, rounding);
190            interpolate8x8_switch(cur, refn, x+8, y,   dx, dy, stride, rounding);
191            interpolate8x8_switch(cur, refn, x,   y+8, dx, dy, stride, rounding);
192            interpolate8x8_switch(cur, refn, x+8, y+8, dx, dy, stride, rounding);
193    }
194    
195    
196          switch (((dx & 1) << 1) + (dy & 1))     // ((dx%2)?2:0)+((dy%2)?1:0)  static __inline void
197    interpolate32x32_switch(uint8_t * const cur,
198                                              const uint8_t * const refn,
199                                              const uint32_t x,
200                                              const uint32_t y,
201                                              const int32_t dx,
202                                              const int dy,
203                                              const uint32_t stride,
204                                              const uint32_t rounding)
205          {          {
206          case 0:          interpolate16x16_switch(cur, refn, x,    y,    dx, dy, stride, rounding);
207                  return (uint8_t *)refn + (int)((y + dy/2) * stride + x + dx/2);          interpolate16x16_switch(cur, refn, x+16, y,    dx, dy, stride, rounding);
208            interpolate16x16_switch(cur, refn, x,    y+16, dx, dy, stride, rounding);
209            interpolate16x16_switch(cur, refn, x+16, y+16, dx, dy, stride, rounding);
210    }
211    
212    
213    static __inline uint8_t *
214    interpolate8x8_switch2(uint8_t * const buffer,
215                                              const uint8_t * const refn,
216                                              const int x,
217                                              const int y,
218                                              const int dx,
219                                              const int dy,
220                                              const uint32_t stride,
221                                              const uint32_t rounding)
222    {
223    
224            const uint8_t * const src = refn + (int)((y + (dy>>1)) * stride + x + (dx>>1));
225    
226            switch (((dx & 1) << 1) + (dy & 1))     { /* ((dx%2)?2:0)+((dy%2)?1:0) */
227            case 0:
228                    return (uint8_t *)src;
229          case 1:          case 1:
230                  ddx = dx / 2;                  interpolate8x8_halfpel_v(buffer, src, stride, rounding);
                 ddy = (dy - 1) / 2;  
                 interpolate8x8_halfpel_v(buffer,  
                                                                  refn + (int)((y + ddy) * stride + x + ddx), stride,  
                                                                  rounding);  
231                  break;                  break;
   
232          case 2:          case 2:
233                  ddx = (dx - 1) / 2;                  interpolate8x8_halfpel_h(buffer, src, stride, rounding);
                 ddy = dy / 2;  
                 interpolate8x8_halfpel_h(buffer,  
                                                                  refn + (int)((y + ddy) * stride + x + ddx), stride,  
                                                                  rounding);  
234                  break;                  break;
   
235          default:          default:
236                  ddx = (dx - 1) / 2;                  interpolate8x8_halfpel_hv(buffer, src, stride, rounding);
                 ddy = (dy - 1) / 2;  
                 interpolate8x8_halfpel_hv(buffer,  
                                                                  refn + (int)((y + ddy) * stride + x + ddx), stride,  
                                                                   rounding);  
237                  break;                  break;
238          }          }
239          return buffer;          return buffer;
240  }  }
241    
   
242  static __inline void interpolate8x8_quarterpel(uint8_t * const cur,  static __inline void interpolate8x8_quarterpel(uint8_t * const cur,
243                                       uint8_t * const refn,                                       uint8_t * const refn,
244                                           uint8_t * const refh,                                           uint8_t * const refh,
# Line 234  Line 283 
283    
284          case 1:          case 1:
285                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
286                  interpolate8x8_avg2(dst, src, halfpel_h, stride, rounding);                  interpolate8x8_avg2(dst, src, halfpel_h, stride, rounding, 8);
287                  break;                  break;
288    
289          case 2:          case 2:
# Line 243  Line 292 
292    
293          case 3:          case 3:
294                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
295                  interpolate8x8_avg2(dst, src + 1, halfpel_h, stride, rounding);                  interpolate8x8_avg2(dst, src + 1, halfpel_h, stride, rounding, 8);
296                  break;                  break;
297    
298          case 4:          case 4:
299                  interpolate8x8_lowpass_v(halfpel_v, src, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_v, src, stride, rounding);
300                  interpolate8x8_avg2(dst, src, halfpel_v, stride, rounding);                  interpolate8x8_avg2(dst, src, halfpel_v, stride, rounding, 8);
301                  break;                  break;
302    
303          case 5:          case 5:
304                  interpolate8x8_lowpass_v(halfpel_v, src, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
305                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
306                  interpolate8x8_avg4(dst, src, halfpel_h, halfpel_v, halfpel_hv, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
307                    interpolate8x8_avg2(dst, halfpel_v, halfpel_hv, stride, rounding, 8);
308                  break;                  break;
309    
310          case 6:          case 6:
311                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);
312                  interpolate8x8_avg2(dst, halfpel_h, halfpel_hv, stride, rounding);                  interpolate8x8_avg2(dst, halfpel_h, halfpel_hv, stride, rounding, 8);
313                  break;                  break;
314    
315          case 7:          case 7:
316                  interpolate8x8_lowpass_v(halfpel_v, src+1, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
317                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src + 1, halfpel_h, stride, rounding, 9);
318                  interpolate8x8_avg4(dst, src+1, halfpel_h, halfpel_v, halfpel_hv, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
319                    interpolate8x8_avg2(dst, halfpel_v, halfpel_hv, stride, rounding, 8);
320                  break;                  break;
321    
322          case 8:          case 8:
# Line 273  Line 324 
324                  break;                  break;
325    
326          case 9:          case 9:
327                  interpolate8x8_lowpass_v(halfpel_v, src, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
328                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
329                  interpolate8x8_avg2(dst, halfpel_v, halfpel_hv, stride, rounding);                  interpolate8x8_lowpass_v(dst, halfpel_v, stride, rounding);
330                  break;                  break;
331    
332          case 10:          case 10:
# Line 283  Line 334 
334                  break;                  break;
335    
336          case 11:          case 11:
337                  interpolate8x8_lowpass_v(halfpel_v, src+1, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
338                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src + 1, halfpel_h, stride, rounding, 9);
339                  interpolate8x8_avg2(dst, halfpel_v, halfpel_hv, stride, rounding);                  interpolate8x8_lowpass_v(dst, halfpel_v, stride, rounding);
340                  break;                  break;
341    
342          case 12:          case 12:
343                  interpolate8x8_lowpass_v(halfpel_v, src, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_v, src, stride, rounding);
344                  interpolate8x8_avg2(dst, src+stride, halfpel_v, stride, rounding);                  interpolate8x8_avg2(dst, src+stride, halfpel_v, stride, rounding, 8);
345                  break;                  break;
346    
347          case 13:          case 13:
348                  interpolate8x8_lowpass_v(halfpel_v, src, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
349                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
350                  interpolate8x8_avg4(dst, src+stride, halfpel_h+stride, halfpel_v, halfpel_hv, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
351                    interpolate8x8_avg2(dst, halfpel_v+stride, halfpel_hv, stride, rounding, 8);
352                  break;                  break;
353    
354          case 14:          case 14:
355                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);
356                  interpolate8x8_avg2(dst, halfpel_h+stride, halfpel_hv, stride, rounding);                  interpolate8x8_avg2(dst, halfpel_h+stride, halfpel_hv, stride, rounding, 8);
357                  break;                  break;
358    
359          case 15:          case 15:
360                  interpolate8x8_lowpass_v(halfpel_v, src+1, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
361                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src + 1, halfpel_h, stride, rounding, 9);
362                  interpolate8x8_avg4(dst, src+stride+1, halfpel_h+stride, halfpel_v, halfpel_hv, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
363                    interpolate8x8_avg2(dst, halfpel_hv, halfpel_v + stride, stride, rounding, 8);
364                    break;
365            }
366    }
367    
368    static __inline void interpolate16x16_quarterpel(uint8_t * const cur,
369                                         uint8_t * const refn,
370                                             uint8_t * const refh,
371                                             uint8_t * const refv,
372                                             uint8_t * const refhv,
373                                         const uint32_t x, const uint32_t y,
374                                             const int32_t dx,  const int dy,
375                                             const uint32_t stride,
376                                             const uint32_t rounding)
377    {
378            const int32_t xRef = x*4 + dx;
379            const int32_t yRef = y*4 + dy;
380    
381            uint8_t *src, *dst;
382            uint8_t *halfpel_h, *halfpel_v, *halfpel_hv;
383            int32_t x_int, y_int, x_frac, y_frac;
384    
385            x_int = xRef/4;
386            if (xRef < 0 && xRef % 4)
387                    x_int--;
388    
389            x_frac = xRef - (4*x_int);
390    
391            y_int  = yRef/4;
392            if (yRef < 0 && yRef % 4)
393                    y_int--;
394    
395            y_frac = yRef - (4*y_int);
396    
397            src = refn + y_int * stride + x_int;
398            halfpel_h = refh;
399            halfpel_v = refv;
400            halfpel_hv = refhv;
401    
402            dst = cur + y * stride + x;
403    
404            switch((y_frac << 2) | (x_frac)) {
405    
406            case 0:
407                    transfer16x16_copy(dst, src, stride);
408                    break;
409    
410            case 1:
411                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
412                    interpolate8x8_avg2(dst, src, halfpel_h, stride, rounding, 8);
413                    interpolate8x8_avg2(dst+8, src+8, halfpel_h+8, stride, rounding, 8);
414                    interpolate8x8_avg2(dst+8*stride, src+8*stride, halfpel_h+8*stride, stride, rounding, 8);
415                    interpolate8x8_avg2(dst+8*stride+8, src+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 8);
416                    break;
417    
418            case 2:
419                interpolate16x16_lowpass_h(dst, src, stride, rounding);
420                    break;
421    
422            case 3:
423                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
424                    interpolate8x8_avg2(dst, src + 1, halfpel_h, stride, rounding, 8);
425                    interpolate8x8_avg2(dst+8, src + 8 + 1, halfpel_h+8, stride, rounding, 8);
426                    interpolate8x8_avg2(dst+8*stride, src + 8*stride + 1, halfpel_h+8*stride, stride, rounding, 8);
427                    interpolate8x8_avg2(dst+8*stride+8, src+8*stride+8 + 1, halfpel_h+8*stride+8, stride, rounding, 8);
428                    break;
429    
430            case 4:
431                    interpolate16x16_lowpass_v(halfpel_v, src, stride, rounding);
432                    interpolate8x8_avg2(dst, src, halfpel_v, stride, rounding, 8);
433                    interpolate8x8_avg2(dst+8, src+8, halfpel_v+8, stride, rounding, 8);
434                    interpolate8x8_avg2(dst+8*stride, src+8*stride, halfpel_v+8*stride, stride, rounding, 8);
435                    interpolate8x8_avg2(dst+8*stride+8, src+8*stride+8, halfpel_v+8*stride+8, stride, rounding, 8);
436                    break;
437    
438            case 5:
439                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
440                    interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
441                    interpolate8x8_avg2(halfpel_v+8, src + 8, halfpel_h+8, stride, rounding, 9);
442                    interpolate8x8_avg2(halfpel_v+8*stride, src + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
443                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
444    
445                    interpolate16x16_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
446                    interpolate8x8_avg2(dst, halfpel_hv, halfpel_v, stride, rounding, 8);
447                    interpolate8x8_avg2(dst+8, halfpel_hv+8, halfpel_v+8, stride, rounding, 8);
448                    interpolate8x8_avg2(dst+8*stride, halfpel_hv+8*stride, halfpel_v+8*stride, stride, rounding, 8);
449                    interpolate8x8_avg2(dst+8*stride+8, halfpel_hv+8*stride+8, halfpel_v+8*stride+8, stride, rounding, 8);
450                    break;
451    
452            case 6:
453                    interpolate16x16_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);
454                    interpolate8x8_avg2(dst, halfpel_h, halfpel_hv, stride, rounding, 8);
455                    interpolate8x8_avg2(dst+8, halfpel_h+8, halfpel_hv+8, stride, rounding, 8);
456                    interpolate8x8_avg2(dst+8*stride, halfpel_h+8*stride, halfpel_hv+8*stride, stride, rounding, 8);
457                    interpolate8x8_avg2(dst+8*stride+8, halfpel_h+8*stride+8, halfpel_hv+8*stride+8, stride, rounding, 8);
458                    break;
459    
460            case 7:
461                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
462                    interpolate8x8_avg2(halfpel_v, src+1, halfpel_h, stride, rounding, 9);
463                    interpolate8x8_avg2(halfpel_v+8, src+1 + 8, halfpel_h+8, stride, rounding, 9);
464                    interpolate8x8_avg2(halfpel_v+8*stride, src+1 + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
465                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+1+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
466    
467                    interpolate16x16_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
468                    interpolate8x8_avg2(dst, halfpel_hv, halfpel_v, stride, rounding, 8);
469                    interpolate8x8_avg2(dst+8, halfpel_hv+8, halfpel_v+8, stride, rounding, 8);
470                    interpolate8x8_avg2(dst+8*stride, halfpel_hv+8*stride, halfpel_v+8*stride, stride, rounding, 8);
471                    interpolate8x8_avg2(dst+8*stride+8, halfpel_hv+8*stride+8, halfpel_v+8*stride+8, stride, rounding, 8);
472                    break;
473    
474            case 8:
475                interpolate16x16_lowpass_v(dst, src, stride, rounding);
476                    break;
477    
478            case 9:
479                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
480                    interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
481                    interpolate8x8_avg2(halfpel_v+8, src + 8, halfpel_h+8, stride, rounding, 9);
482                    interpolate8x8_avg2(halfpel_v+8*stride, src + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
483                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
484                    interpolate16x16_lowpass_v(dst, halfpel_v, stride, rounding);
485                    break;
486    
487            case 10:
488                    interpolate16x16_lowpass_hv(dst, halfpel_h, src, stride, rounding);
489                    break;
490    
491            case 11:
492                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
493                    interpolate8x8_avg2(halfpel_v, src+1, halfpel_h, stride, rounding, 9);
494                    interpolate8x8_avg2(halfpel_v+8, src+1 + 8, halfpel_h+8, stride, rounding, 9);
495                    interpolate8x8_avg2(halfpel_v+8*stride, src+1 + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
496                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+1+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
497                    interpolate16x16_lowpass_v(dst, halfpel_v, stride, rounding);
498                    break;
499    
500            case 12:
501                    interpolate16x16_lowpass_v(halfpel_v, src, stride, rounding);
502                    interpolate8x8_avg2(dst, src+stride, halfpel_v, stride, rounding, 8);
503                    interpolate8x8_avg2(dst+8, src+stride+8, halfpel_v+8, stride, rounding, 8);
504                    interpolate8x8_avg2(dst+8*stride, src+stride+8*stride, halfpel_v+8*stride, stride, rounding, 8);
505                    interpolate8x8_avg2(dst+8*stride+8, src+stride+8*stride+8, halfpel_v+8*stride+8, stride, rounding, 8);
506                    break;
507    
508            case 13:
509                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
510                    interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
511                    interpolate8x8_avg2(halfpel_v+8, src + 8, halfpel_h+8, stride, rounding, 9);
512                    interpolate8x8_avg2(halfpel_v+8*stride, src + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
513                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
514    
515                    interpolate16x16_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
516                    interpolate8x8_avg2(dst, halfpel_hv, halfpel_v+stride, stride, rounding, 8);
517                    interpolate8x8_avg2(dst+8, halfpel_hv+8, halfpel_v+stride+8, stride, rounding, 8);
518                    interpolate8x8_avg2(dst+8*stride, halfpel_hv+8*stride, halfpel_v+stride+8*stride, stride, rounding, 8);
519                    interpolate8x8_avg2(dst+8*stride+8, halfpel_hv+8*stride+8, halfpel_v+stride+8*stride+8, stride, rounding, 8);
520                    break;
521    
522            case 14:
523                    interpolate16x16_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);
524                    interpolate8x8_avg2(dst, halfpel_h+stride, halfpel_hv, stride, rounding, 8);
525                    interpolate8x8_avg2(dst+8, halfpel_h+stride+8, halfpel_hv+8, stride, rounding, 8);
526                    interpolate8x8_avg2(dst+8*stride, halfpel_h+stride+8*stride, halfpel_hv+8*stride, stride, rounding, 8);
527                    interpolate8x8_avg2(dst+8*stride+8, halfpel_h+stride+8*stride+8, halfpel_hv+8*stride+8, stride, rounding, 8);
528                    break;
529    
530            case 15:
531                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
532                    interpolate8x8_avg2(halfpel_v, src+1, halfpel_h, stride, rounding, 9);
533                    interpolate8x8_avg2(halfpel_v+8, src+1 + 8, halfpel_h+8, stride, rounding, 9);
534                    interpolate8x8_avg2(halfpel_v+8*stride, src+1 + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
535                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+1+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
536    
537                    interpolate16x16_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
538                    interpolate8x8_avg2(dst, halfpel_hv, halfpel_v+stride, stride, rounding, 8);
539                    interpolate8x8_avg2(dst+8, halfpel_hv+8, halfpel_v+stride+8, stride, rounding, 8);
540                    interpolate8x8_avg2(dst+8*stride, halfpel_hv+8*stride, halfpel_v+stride+8*stride, stride, rounding, 8);
541                    interpolate8x8_avg2(dst+8*stride+8, halfpel_hv+8*stride+8, halfpel_v+stride+8*stride+8, stride, rounding, 8);
542                  break;                  break;
543          }          }
544  }  }

Legend:
Removed from v.1.5.2.2  
changed lines
  Added in v.1.10.2.5

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