[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.8, Tue Nov 26 23:44:10 2002 UTC revision 1.10.2.2, Mon Jun 9 13:54:07 2003 UTC
# Line 1  Line 1 
1  /*****************************************************************************  /*****************************************************************************
2   *   *
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  - 8x8 block-based halfpel interpolation - headers   *  - Interpolation related header  -
5   *   *
6   *  Copyright(C) 2002 Peter Ross <pross@xvid.org>   *  Copyright(C) 2001-2003 Peter Ross <pross@xvid.org>
7   *   *
8   *  This file is part of XviD, a free MPEG-4 video encoder/decoder   *  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
  *  XviD is free software; you can redistribute it and/or modify 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   *  the Free Software Foundation; either version 2 of the License, or
11   *  (at your option) any later version.   *  (at your option) any later version.
12   *   *
# Line 21  Line 19 
19   *  along with this program; if not, write to the Free Software   *  along with this program; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21   *   *
  *  Under section 8 of the GNU General Public License, the copyright  
  *  holders of XVID explicitly forbid distribution in the following  
  *  countries:  
  *  
  *    - Japan  
  *    - United States of America  
  *  
  *  Linking XviD statically or dynamically with other modules is making a  
  *  combined work based on XviD.  Thus, the terms and conditions of the  
  *  GNU General Public License cover the whole combination.  
  *  
  *  As a special exception, the copyright holders of XviD give you  
  *  permission to link XviD with independent modules that communicate with  
  *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the  
  *  license terms of these independent modules, and to copy and distribute  
  *  the resulting combined work under terms of your choice, provided that  
  *  every copy of the combined work is accompanied by a complete copy of  
  *  the source code of XviD (the version of XviD used to produce the  
  *  combined work), being distributed under the terms of the GNU General  
  *  Public License plus this exception.  An independent module is a module  
  *  which is not derived from or based on XviD.  
  *  
  *  Note that people who make modified versions of XviD are not obligated  
  *  to grant this special exception for their modified versions; it is  
  *  their choice whether to do so.  The GNU General Public License gives  
  *  permission to release a modified version without this exception; this  
  *  exception also makes it possible to release a modified version which  
  *  carries forward this exception.  
  *  
22   * $Id$   * $Id$
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
26    #ifndef _INTERPOLATE8X8_H_
27    #define _INTERPOLATE8X8_H_
28    
29  #include "../utils/mem_transfer.h"  #include "../utils/mem_transfer.h"
30    
31  typedef void (INTERPOLATE8X8) (uint8_t * const dst,  typedef void (INTERPOLATE8X8) (uint8_t * const dst,
# Line 62  Line 34 
34                                                             const uint32_t rounding);                                                             const uint32_t rounding);
35  typedef INTERPOLATE8X8 *INTERPOLATE8X8_PTR;  typedef INTERPOLATE8X8 *INTERPOLATE8X8_PTR;
36    
37    typedef void (INTERPOLATE8X8_AVG2) (uint8_t *dst,
38                                                                            const uint8_t *src1,
39                                                                            const uint8_t *src2,
40                                                                            const uint32_t stride,
41                                                                            const uint32_t rounding,
42                                                                            const uint32_t height);
43    typedef INTERPOLATE8X8_AVG2 *INTERPOLATE8X8_AVG2_PTR;
44    
45    typedef void (INTERPOLATE8X8_AVG4) (uint8_t *dst,
46                                                                            const uint8_t *src1,
47                                                                            const uint8_t *src2,
48                                                                            const uint8_t *src3,
49                                                                            const uint8_t *src4,
50                                                                            const uint32_t stride,
51                                                                            const uint32_t rounding);
52    typedef INTERPOLATE8X8_AVG4 *INTERPOLATE8X8_AVG4_PTR;
53    
54    typedef void (INTERPOLATE_LOWPASS) (uint8_t *dst,
55                                                                               uint8_t *src,
56                                                                               int32_t stride,
57                                                                               int32_t rounding);
58    
59    typedef INTERPOLATE_LOWPASS *INTERPOLATE_LOWPASS_PTR;
60    
61    typedef void (INTERPOLATE_LOWPASS_HV) (uint8_t *dst1,
62                                                                                      uint8_t *dst2,
63                                                                                      uint8_t *src,
64                                                                                      int32_t stride,
65                                                                                      int32_t rounding);
66    
67    typedef INTERPOLATE_LOWPASS_HV *INTERPOLATE_LOWPASS_HV_PTR;
68    
69    typedef void (INTERPOLATE8X8_6TAP_LOWPASS) (uint8_t *dst,
70                                                                                    uint8_t *src,
71                                                                                    int32_t stride,
72                                                                                    int32_t rounding);
73    
74    typedef INTERPOLATE8X8_6TAP_LOWPASS *INTERPOLATE8X8_6TAP_LOWPASS_PTR;
75    
76  extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_h;  extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_h;
77  extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_v;  extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_v;
78  extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_hv;  extern INTERPOLATE8X8_PTR interpolate8x8_halfpel_hv;
79    
80    extern INTERPOLATE8X8_AVG2_PTR interpolate8x8_avg2;
81    extern INTERPOLATE8X8_AVG4_PTR interpolate8x8_avg4;
82    
83    extern INTERPOLATE_LOWPASS_PTR interpolate8x8_lowpass_h;
84    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 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;
93    extern INTERPOLATE8X8_6TAP_LOWPASS_PTR interpolate8x8_6tap_lowpass_v;
94    
95  INTERPOLATE8X8 interpolate8x8_halfpel_h_c;  INTERPOLATE8X8 interpolate8x8_halfpel_h_c;
96  INTERPOLATE8X8 interpolate8x8_halfpel_v_c;  INTERPOLATE8X8 interpolate8x8_halfpel_v_c;
97  INTERPOLATE8X8 interpolate8x8_halfpel_hv_c;  INTERPOLATE8X8 interpolate8x8_halfpel_hv_c;
# Line 82  Line 108 
108  INTERPOLATE8X8 interpolate8x8_halfpel_v_3dn;  INTERPOLATE8X8 interpolate8x8_halfpel_v_3dn;
109  INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dn;  INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dn;
110    
111    INTERPOLATE8X8 interpolate8x8_halfpel_h_3dne;
112    INTERPOLATE8X8 interpolate8x8_halfpel_v_3dne;
113    INTERPOLATE8X8 interpolate8x8_halfpel_hv_3dne;
114    
115  INTERPOLATE8X8 interpolate8x8_halfpel_h_ia64;  INTERPOLATE8X8 interpolate8x8_halfpel_h_ia64;
116  INTERPOLATE8X8 interpolate8x8_halfpel_v_ia64;  INTERPOLATE8X8 interpolate8x8_halfpel_v_ia64;
117  INTERPOLATE8X8 interpolate8x8_halfpel_hv_ia64;  INTERPOLATE8X8 interpolate8x8_halfpel_hv_ia64;
118    
119  void interpolate8x8_lowpass_h(uint8_t *dst, uint8_t *src, int32_t dst_stride, int32_t src_stride, int32_t rounding);  INTERPOLATE8X8_AVG2 interpolate8x8_avg2_c;
120  void interpolate8x8_lowpass_v(uint8_t *dst, uint8_t *src, int32_t dst_stride, int32_t src_stride, int32_t rounding);  INTERPOLATE8X8_AVG4 interpolate8x8_avg4_c;
 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);  
 void interpolate8x8_bilinear2(uint8_t *dst, uint8_t *src1, uint8_t *src2, int32_t dst_stride, int32_t src_stride, int32_t rounding);  
 void interpolate8x8_bilinear4(uint8_t *dst, uint8_t *src1, uint8_t *src2, uint8_t *src3, uint8_t *src4, int32_t stride, int32_t rounding);  
121    
122  void interpolate8x8_c(uint8_t * const dst,  INTERPOLATE8X8_AVG2 interpolate8x8_avg2_mmx;
123                                            const uint8_t * const src,  INTERPOLATE8X8_AVG4 interpolate8x8_avg4_mmx;
124                                            const uint32_t x,  
125                                            const uint32_t y,  INTERPOLATE_LOWPASS interpolate8x8_lowpass_h_c;
126                                            const uint32_t stride);  INTERPOLATE_LOWPASS interpolate8x8_lowpass_v_c;
127    
128    INTERPOLATE_LOWPASS interpolate16x16_lowpass_h_c;
129    INTERPOLATE_LOWPASS interpolate16x16_lowpass_v_c;
130    
131    INTERPOLATE_LOWPASS_HV interpolate8x8_lowpass_hv_c;
132    INTERPOLATE_LOWPASS_HV interpolate16x16_lowpass_hv_c;
133    
134    INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_c;
135    INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_c;
136    
137    INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_h_mmx;
138    INTERPOLATE8X8_6TAP_LOWPASS interpolate8x8_6tap_lowpass_v_mmx;
139    
140  static __inline void  static __inline void
141  interpolate8x8_switch(uint8_t * const cur,  interpolate8x8_switch(uint8_t * const cur,
# Line 146  Line 185 
185  }  }
186    
187    
188    static __inline void
189    interpolate16x16_switch(uint8_t * const cur,
190                                              const uint8_t * const refn,
191                                              const uint32_t x,
192                                              const uint32_t y,
193                                              const int32_t dx,
194                                              const int dy,
195                                              const uint32_t stride,
196                                              const uint32_t rounding)
197    {
198            interpolate8x8_switch(cur, refn, x,   y,   dx, dy, stride, rounding);
199            interpolate8x8_switch(cur, refn, x+8, y,   dx, dy, stride, rounding);
200            interpolate8x8_switch(cur, refn, x,   y+8, dx, dy, stride, rounding);
201            interpolate8x8_switch(cur, refn, x+8, y+8, dx, dy, stride, rounding);
202    }
203    
204    
205    static __inline void
206    interpolate32x32_switch(uint8_t * const cur,
207                                              const uint8_t * const refn,
208                                              const uint32_t x,
209                                              const uint32_t y,
210                                              const int32_t dx,
211                                              const int dy,
212                                              const uint32_t stride,
213                                              const uint32_t rounding)
214    {
215            interpolate16x16_switch(cur, refn, x,    y,    dx, dy, stride, rounding);
216            interpolate16x16_switch(cur, refn, x+16, y,    dx, dy, stride, rounding);
217            interpolate16x16_switch(cur, refn, x,    y+16, dx, dy, stride, rounding);
218            interpolate16x16_switch(cur, refn, x+16, y+16, dx, dy, stride, rounding);
219    }
220    
221    
222    static __inline uint8_t *
223    interpolate8x8_switch2(uint8_t * const buffer,
224                                              const uint8_t * const refn,
225                                              const uint32_t x,
226                                              const uint32_t y,
227                                              const int32_t dx,
228                                              const int dy,
229                                              const uint32_t stride,
230                                              const uint32_t rounding)
231    {
232            int32_t ddx, ddy;
233    
234            switch (((dx & 1) << 1) + (dy & 1))     /* ((dx%2)?2:0)+((dy%2)?1:0) */
235            {
236            case 0:
237                    return (uint8_t *)refn + (int)((y + dy/2) * stride + x + dx/2);
238    
239            case 1:
240                    ddx = dx / 2;
241                    ddy = (dy - 1) / 2;
242                    interpolate8x8_halfpel_v(buffer,
243                                                                     refn + (int)((y + ddy) * stride + x + ddx), stride,
244                                                                     rounding);
245                    break;
246    
247            case 2:
248                    ddx = (dx - 1) / 2;
249                    ddy = dy / 2;
250                    interpolate8x8_halfpel_h(buffer,
251                                                                     refn + (int)((y + ddy) * stride + x + ddx), stride,
252                                                                     rounding);
253                    break;
254    
255            default:
256                    ddx = (dx - 1) / 2;
257                    ddy = (dy - 1) / 2;
258                    interpolate8x8_halfpel_hv(buffer,
259                                                                     refn + (int)((y + ddy) * stride + x + ddx), stride,
260                                                                      rounding);
261                    break;
262            }
263            return buffer;
264    }
265    
266  static __inline void interpolate8x8_quarterpel(uint8_t * const cur,  static __inline void interpolate8x8_quarterpel(uint8_t * const cur,
267                                       uint8_t * const refn,                                       uint8_t * const refn,
268                                             uint8_t * const refh,
269                                             uint8_t * const refv,
270                                             uint8_t * const refhv,
271                                       const uint32_t x, const uint32_t y,                                       const uint32_t x, const uint32_t y,
272                                           const int32_t dx,  const int dy,                                           const int32_t dx,  const int dy,
273                                           const uint32_t stride,                                           const uint32_t stride,
# Line 157  Line 277 
277          const int32_t yRef = y*4 + dy;          const int32_t yRef = y*4 + dy;
278    
279          uint8_t *src, *dst;          uint8_t *src, *dst;
280            uint8_t *halfpel_h, *halfpel_v, *halfpel_hv;
281          int32_t x_int, y_int, x_frac, y_frac;          int32_t x_int, y_int, x_frac, y_frac;
282    
         uint8_t halfpel_h[72];  
         uint8_t halfpel_v[64];  
         uint8_t halfpel_hv[64];  
   
283          x_int = xRef/4;          x_int = xRef/4;
284          if (xRef < 0 && xRef % 4)          if (xRef < 0 && xRef % 4)
285                  x_int--;                  x_int--;
# Line 176  Line 293 
293          y_frac = yRef - (4*y_int);          y_frac = yRef - (4*y_int);
294    
295          src = refn + y_int * stride + x_int;          src = refn + y_int * stride + x_int;
296            halfpel_h = refh;
297            halfpel_v = refv;
298            halfpel_hv = refhv;
299    
300          dst = cur + y * stride + x;          dst = cur + y * stride + x;
301    
302          switch((y_frac << 2) | (x_frac)) {          switch((y_frac << 2) | (x_frac)) {
# Line 185  Line 306 
306                  break;                  break;
307    
308          case 1:          case 1:
309                  interpolate8x8_lowpass_h(halfpel_h, src, 8, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
310                  interpolate8x8_bilinear2(dst, src, halfpel_h, stride, stride, rounding);                  interpolate8x8_avg2(dst, src, halfpel_h, stride, rounding, 8);
311                  break;                  break;
312    
313          case 2:          case 2:
314              interpolate8x8_lowpass_h(dst, src, stride, stride, rounding);              interpolate8x8_lowpass_h(dst, src, stride, rounding);
315                  break;                  break;
316    
317          case 3:          case 3:
318                  interpolate8x8_lowpass_h(halfpel_h, src, 8, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
319                  interpolate8x8_bilinear2(dst, src+1, halfpel_h, stride, stride, rounding);                  interpolate8x8_avg2(dst, src + 1, halfpel_h, stride, rounding, 8);
320                  break;                  break;
321    
322          case 4:          case 4:
323                  interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_v, src, stride, rounding);
324                  interpolate8x8_bilinear2(dst, src, halfpel_v, stride, stride, rounding);                  interpolate8x8_avg2(dst, src, halfpel_v, stride, rounding, 8);
325                  break;                  break;
326    
327          case 5:          case 5:
328                  interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
329                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
330                  interpolate8x8_bilinear4(dst, src, halfpel_h, halfpel_v, halfpel_hv, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
331                    interpolate8x8_avg2(dst, halfpel_v, halfpel_hv, stride, rounding, 8);
332                  break;                  break;
333    
334          case 6:          case 6:
335                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);
336                  interpolate8x8_bilinear2(dst, halfpel_h, halfpel_hv, stride, 8, 1-rounding);                  interpolate8x8_avg2(dst, halfpel_h, halfpel_hv, stride, rounding, 8);
337                  break;                  break;
338    
339          case 7:          case 7:
340                  interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, 16-rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
341                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src + 1, halfpel_h, stride, rounding, 9);
342                  interpolate8x8_bilinear4(dst, src+1, halfpel_h, halfpel_v, halfpel_hv, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
343                    interpolate8x8_avg2(dst, halfpel_v, halfpel_hv, stride, rounding, 8);
344                  break;                  break;
345    
346          case 8:          case 8:
347              interpolate8x8_lowpass_v(dst, src, stride, stride, rounding);              interpolate8x8_lowpass_v(dst, src, stride, rounding);
348                  break;                  break;
349    
350          case 9:          case 9:
351                  interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, 16-rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
352                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
353                  interpolate8x8_bilinear2(dst, halfpel_v, halfpel_hv, stride, 8, rounding);                  interpolate8x8_lowpass_v(dst, halfpel_v, stride, rounding);
354                  break;                  break;
355    
356          case 10:          case 10:
357                  interpolate8x8_lowpass_hv(dst, halfpel_h, src, stride, 8, stride, rounding);                  interpolate8x8_lowpass_hv(dst, halfpel_h, src, stride, rounding);
358                  break;                  break;
359    
360          case 11:          case 11:
361                  interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, 16-rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
362                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src + 1, halfpel_h, stride, rounding, 9);
363                  interpolate8x8_bilinear2(dst, halfpel_v, halfpel_hv, stride, 8, rounding);                  interpolate8x8_lowpass_v(dst, halfpel_v, stride, rounding);
364                  break;                  break;
365    
366          case 12:          case 12:
367                  interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_v, src, stride, rounding);
368                  interpolate8x8_bilinear2(dst, src+stride, halfpel_v, stride, stride, rounding);                  interpolate8x8_avg2(dst, src+stride, halfpel_v, stride, rounding, 8);
369                  break;                  break;
370    
371          case 13:          case 13:
372                  interpolate8x8_lowpass_v(halfpel_v, src, 8, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
373                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
374                  interpolate8x8_bilinear4(dst, src+stride, halfpel_h+8, halfpel_v, halfpel_hv, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
375                    interpolate8x8_avg2(dst, halfpel_v+stride, halfpel_hv, stride, rounding, 8);
376                  break;                  break;
377    
378          case 14:          case 14:
379                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);
380                  interpolate8x8_bilinear2(dst, halfpel_h+8, halfpel_hv, stride, 8, rounding);                  interpolate8x8_avg2(dst, halfpel_h+stride, halfpel_hv, stride, rounding, 8);
381                  break;                  break;
382    
383          case 15:          case 15:
384                  interpolate8x8_lowpass_v(halfpel_v, src+1, 8, stride, rounding);                  interpolate8x8_lowpass_h(halfpel_h, src, stride, rounding);
385                  interpolate8x8_lowpass_hv(halfpel_hv, halfpel_h, src, 8, 8, stride, rounding);                  interpolate8x8_avg2(halfpel_v, src + 1, halfpel_h, stride, rounding, 9);
386                  interpolate8x8_bilinear4(dst, src+stride+1, halfpel_h+8, halfpel_v, halfpel_hv, stride, rounding);                  interpolate8x8_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
387                    interpolate8x8_avg2(dst, halfpel_hv, halfpel_v + stride, stride, rounding, 8);
388                  break;                  break;
389          }          }
390  }  }
391    
392    static __inline void interpolate16x16_quarterpel(uint8_t * const cur,
393                                         uint8_t * const refn,
394                                             uint8_t * const refh,
395                                             uint8_t * const refv,
396                                             uint8_t * const refhv,
397                                         const uint32_t x, const uint32_t y,
398                                             const int32_t dx,  const int dy,
399                                             const uint32_t stride,
400                                             const uint32_t rounding)
401    {
402            const int32_t xRef = x*4 + dx;
403            const int32_t yRef = y*4 + dy;
404    
405            uint8_t *src, *dst;
406            uint8_t *halfpel_h, *halfpel_v, *halfpel_hv;
407            int32_t x_int, y_int, x_frac, y_frac;
408    
409            x_int = xRef/4;
410            if (xRef < 0 && xRef % 4)
411                    x_int--;
412    
413            x_frac = xRef - (4*x_int);
414    
415            y_int  = yRef/4;
416            if (yRef < 0 && yRef % 4)
417                    y_int--;
418    
419            y_frac = yRef - (4*y_int);
420    
421            src = refn + y_int * stride + x_int;
422            halfpel_h = refh;
423            halfpel_v = refv;
424            halfpel_hv = refhv;
425    
426            dst = cur + y * stride + x;
427    
428            switch((y_frac << 2) | (x_frac)) {
429    
430            case 0:
431                    transfer16x16_copy(dst, src, stride);
432                    break;
433    
434            case 1:
435                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
436                    interpolate8x8_avg2(dst, src, halfpel_h, stride, rounding, 8);
437                    interpolate8x8_avg2(dst+8, src+8, halfpel_h+8, stride, rounding, 8);
438                    interpolate8x8_avg2(dst+8*stride, src+8*stride, halfpel_h+8*stride, stride, rounding, 8);
439                    interpolate8x8_avg2(dst+8*stride+8, src+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 8);
440                    break;
441    
442            case 2:
443                interpolate16x16_lowpass_h(dst, src, stride, rounding);
444                    break;
445    
446            case 3:
447                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
448                    interpolate8x8_avg2(dst, src + 1, halfpel_h, stride, rounding, 8);
449                    interpolate8x8_avg2(dst+8, src + 8 + 1, halfpel_h+8, stride, rounding, 8);
450                    interpolate8x8_avg2(dst+8*stride, src + 8*stride + 1, halfpel_h+8*stride, stride, rounding, 8);
451                    interpolate8x8_avg2(dst+8*stride+8, src+8*stride+8 + 1, halfpel_h+8*stride+8, stride, rounding, 8);
452                    break;
453    
454            case 4:
455                    interpolate16x16_lowpass_v(halfpel_v, src, stride, rounding);
456                    interpolate8x8_avg2(dst, src, halfpel_v, stride, rounding, 8);
457                    interpolate8x8_avg2(dst+8, src+8, halfpel_v+8, stride, rounding, 8);
458                    interpolate8x8_avg2(dst+8*stride, src+8*stride, halfpel_v+8*stride, stride, rounding, 8);
459                    interpolate8x8_avg2(dst+8*stride+8, src+8*stride+8, halfpel_v+8*stride+8, stride, rounding, 8);
460                    break;
461    
462            case 5:
463                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
464                    interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
465                    interpolate8x8_avg2(halfpel_v+8, src + 8, halfpel_h+8, stride, rounding, 9);
466                    interpolate8x8_avg2(halfpel_v+8*stride, src + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
467                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
468    
469                    interpolate16x16_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
470                    interpolate8x8_avg2(dst, halfpel_hv, halfpel_v, stride, rounding, 8);
471                    interpolate8x8_avg2(dst+8, halfpel_hv+8, halfpel_v+8, stride, rounding, 8);
472                    interpolate8x8_avg2(dst+8*stride, halfpel_hv+8*stride, halfpel_v+8*stride, stride, rounding, 8);
473                    interpolate8x8_avg2(dst+8*stride+8, halfpel_hv+8*stride+8, halfpel_v+8*stride+8, stride, rounding, 8);
474                    break;
475    
476            case 6:
477                    interpolate16x16_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);
478                    interpolate8x8_avg2(dst, halfpel_h, halfpel_hv, stride, rounding, 8);
479                    interpolate8x8_avg2(dst+8, halfpel_h+8, halfpel_hv+8, stride, rounding, 8);
480                    interpolate8x8_avg2(dst+8*stride, halfpel_h+8*stride, halfpel_hv+8*stride, stride, rounding, 8);
481                    interpolate8x8_avg2(dst+8*stride+8, halfpel_h+8*stride+8, halfpel_hv+8*stride+8, stride, rounding, 8);
482                    break;
483    
484            case 7:
485                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
486                    interpolate8x8_avg2(halfpel_v, src+1, halfpel_h, stride, rounding, 9);
487                    interpolate8x8_avg2(halfpel_v+8, src+1 + 8, halfpel_h+8, stride, rounding, 9);
488                    interpolate8x8_avg2(halfpel_v+8*stride, src+1 + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
489                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+1+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
490    
491                    interpolate16x16_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
492                    interpolate8x8_avg2(dst, halfpel_hv, halfpel_v, stride, rounding, 8);
493                    interpolate8x8_avg2(dst+8, halfpel_hv+8, halfpel_v+8, stride, rounding, 8);
494                    interpolate8x8_avg2(dst+8*stride, halfpel_hv+8*stride, halfpel_v+8*stride, stride, rounding, 8);
495                    interpolate8x8_avg2(dst+8*stride+8, halfpel_hv+8*stride+8, halfpel_v+8*stride+8, stride, rounding, 8);
496                    break;
497    
498            case 8:
499                interpolate16x16_lowpass_v(dst, src, stride, rounding);
500                    break;
501    
502            case 9:
503                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
504                    interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
505                    interpolate8x8_avg2(halfpel_v+8, src + 8, halfpel_h+8, stride, rounding, 9);
506                    interpolate8x8_avg2(halfpel_v+8*stride, src + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
507                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
508                    interpolate16x16_lowpass_v(dst, halfpel_v, stride, rounding);
509                    break;
510    
511            case 10:
512                    interpolate16x16_lowpass_hv(dst, halfpel_h, src, stride, rounding);
513                    break;
514    
515            case 11:
516                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
517                    interpolate8x8_avg2(halfpel_v, src+1, halfpel_h, stride, rounding, 9);
518                    interpolate8x8_avg2(halfpel_v+8, src+1 + 8, halfpel_h+8, stride, rounding, 9);
519                    interpolate8x8_avg2(halfpel_v+8*stride, src+1 + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
520                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+1+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
521                    interpolate16x16_lowpass_v(dst, halfpel_v, stride, rounding);
522                    break;
523    
524            case 12:
525                    interpolate16x16_lowpass_v(halfpel_v, src, stride, rounding);
526                    interpolate8x8_avg2(dst, src+stride, halfpel_v, stride, rounding, 8);
527                    interpolate8x8_avg2(dst+8, src+stride+8, halfpel_v+8, stride, rounding, 8);
528                    interpolate8x8_avg2(dst+8*stride, src+stride+8*stride, halfpel_v+8*stride, stride, rounding, 8);
529                    interpolate8x8_avg2(dst+8*stride+8, src+stride+8*stride+8, halfpel_v+8*stride+8, stride, rounding, 8);
530                    break;
531    
532            case 13:
533                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
534                    interpolate8x8_avg2(halfpel_v, src, halfpel_h, stride, rounding, 9);
535                    interpolate8x8_avg2(halfpel_v+8, src + 8, halfpel_h+8, stride, rounding, 9);
536                    interpolate8x8_avg2(halfpel_v+8*stride, src + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
537                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
538    
539                    interpolate16x16_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
540                    interpolate8x8_avg2(dst, halfpel_hv, halfpel_v+stride, stride, rounding, 8);
541                    interpolate8x8_avg2(dst+8, halfpel_hv+8, halfpel_v+stride+8, stride, rounding, 8);
542                    interpolate8x8_avg2(dst+8*stride, halfpel_hv+8*stride, halfpel_v+stride+8*stride, stride, rounding, 8);
543                    interpolate8x8_avg2(dst+8*stride+8, halfpel_hv+8*stride+8, halfpel_v+stride+8*stride+8, stride, rounding, 8);
544                    break;
545    
546            case 14:
547                    interpolate16x16_lowpass_hv(halfpel_hv, halfpel_h, src, stride, rounding);
548                    interpolate8x8_avg2(dst, halfpel_h+stride, halfpel_hv, stride, rounding, 8);
549                    interpolate8x8_avg2(dst+8, halfpel_h+stride+8, halfpel_hv+8, stride, rounding, 8);
550                    interpolate8x8_avg2(dst+8*stride, halfpel_h+stride+8*stride, halfpel_hv+8*stride, stride, rounding, 8);
551                    interpolate8x8_avg2(dst+8*stride+8, halfpel_h+stride+8*stride+8, halfpel_hv+8*stride+8, stride, rounding, 8);
552                    break;
553    
554            case 15:
555                    interpolate16x16_lowpass_h(halfpel_h, src, stride, rounding);
556                    interpolate8x8_avg2(halfpel_v, src+1, halfpel_h, stride, rounding, 9);
557                    interpolate8x8_avg2(halfpel_v+8, src+1 + 8, halfpel_h+8, stride, rounding, 9);
558                    interpolate8x8_avg2(halfpel_v+8*stride, src+1 + 8*stride, halfpel_h+8*stride, stride, rounding, 9);
559                    interpolate8x8_avg2(halfpel_v+8*stride+8, src+1+8*stride+8, halfpel_h+8*stride+8, stride, rounding, 9);
560    
561                    interpolate16x16_lowpass_v(halfpel_hv, halfpel_v, stride, rounding);
562                    interpolate8x8_avg2(dst, halfpel_hv, halfpel_v+stride, stride, rounding, 8);
563                    interpolate8x8_avg2(dst+8, halfpel_hv+8, halfpel_v+stride+8, stride, rounding, 8);
564                    interpolate8x8_avg2(dst+8*stride, halfpel_hv+8*stride, halfpel_v+stride+8*stride, stride, rounding, 8);
565                    interpolate8x8_avg2(dst+8*stride+8, halfpel_hv+8*stride+8, halfpel_v+stride+8*stride+8, stride, rounding, 8);
566                    break;
567            }
568    }
569    
570    #endif

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.10.2.2

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