1 |
|
/***************************************************************************** |
2 |
|
* |
3 |
|
* XVID MPEG-4 VIDEO CODEC |
4 |
|
* - 8x8 block-based halfpel interpolation - headers |
5 |
|
* |
6 |
|
* Copyright(C) 2002 Peter Ross <pross@xvid.org> |
7 |
|
* |
8 |
|
* This program is an implementation of a part of one or more MPEG-4 |
9 |
|
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
10 |
|
* to use this software module in hardware or software products are |
11 |
|
* advised that its use may infringe existing patents or copyrights, and |
12 |
|
* any such use would be at such party's own risk. The original |
13 |
|
* developer of this software module and his/her company, and subsequent |
14 |
|
* editors and their companies, will have no liability for use of this |
15 |
|
* software or modifications or derivatives thereof. |
16 |
|
* |
17 |
|
* This program is free software; you can redistribute it and/or modify |
18 |
|
* it under the terms of the GNU General Public License as published by |
19 |
|
* the Free Software Foundation; either version 2 of the License, or |
20 |
|
* (at your option) any later version. |
21 |
|
* |
22 |
|
* This program is distributed in the hope that it will be useful, |
23 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
24 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
25 |
|
* GNU General Public License for more details. |
26 |
|
* |
27 |
|
* You should have received a copy of the GNU General Public License |
28 |
|
* along with this program; if not, write to the Free Software |
29 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
30 |
|
* |
31 |
|
****************************************************************************/ |
32 |
|
|
33 |
#include "../utils/mem_transfer.h" |
#include "../utils/mem_transfer.h" |
34 |
|
|
35 |
typedef void (INTERPOLATE8X8) (uint8_t * const dst, |
typedef void (INTERPOLATE8X8) (uint8_t * const dst, |
121 |
} |
} |
122 |
} |
} |
123 |
|
|
|
static __inline uint8_t * |
|
|
interpolate8x8_switch2(uint8_t * const buffer, |
|
|
const uint8_t * const refn, |
|
|
const uint32_t x, |
|
|
const uint32_t y, |
|
|
const int32_t dx, |
|
|
const int dy, |
|
|
const uint32_t stride, |
|
|
const uint32_t rounding) |
|
|
{ |
|
|
int32_t ddx, ddy; |
|
|
|
|
|
switch (((dx & 1) << 1) + (dy & 1)) // ((dx%2)?2:0)+((dy%2)?1:0) |
|
|
{ |
|
|
case 0: |
|
|
return (uint8_t *)refn + (int)((y + dy/2) * stride + x + dx/2); |
|
|
|
|
|
case 1: |
|
|
ddx = dx / 2; |
|
|
ddy = (dy - 1) / 2; |
|
|
interpolate8x8_halfpel_v(buffer, |
|
|
refn + (int)((y + ddy) * stride + x + ddx), stride, |
|
|
rounding); |
|
|
break; |
|
|
|
|
|
case 2: |
|
|
ddx = (dx - 1) / 2; |
|
|
ddy = dy / 2; |
|
|
interpolate8x8_halfpel_h(buffer, |
|
|
refn + (int)((y + ddy) * stride + x + ddx), stride, |
|
|
rounding); |
|
|
break; |
|
|
|
|
|
default: |
|
|
ddx = (dx - 1) / 2; |
|
|
ddy = (dy - 1) / 2; |
|
|
interpolate8x8_halfpel_hv(buffer, |
|
|
refn + (int)((y + ddy) * stride + x + ddx), stride, |
|
|
rounding); |
|
|
break; |
|
|
} |
|
|
return buffer; |
|
|
} |
|
|
|
|
|
|
|
124 |
|
|
125 |
static void |
static __inline void interpolate8x8_quarterpel(uint8_t * const cur, |
|
interpolate8x8_quarterpel(uint8_t * const cur, |
|
126 |
uint8_t * const refn, |
uint8_t * const refn, |
127 |
const uint32_t x, const uint32_t y, |
const uint32_t x, const uint32_t y, |
128 |
const int32_t dx, const int dy, |
const int32_t dx, const int dy, |