1 |
/************************************************************************** |
/***************************************************************************** |
2 |
* |
* |
3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* 8x8 block-based halfpel interpolation |
* - 8x8 block-based halfpel interpolation - |
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 |
* 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 |
* it under the terms of the GNU General Public License as published by |
17 |
* |
* |
18 |
* You should have received a copy of the GNU General Public License |
* You should have received a copy of the GNU General Public License |
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., 675 Mass Ave, Cambridge, MA 02139, USA. |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
* |
|
|
*************************************************************************/ |
|
|
|
|
|
/************************************************************************** |
|
|
* |
|
|
* History: |
|
21 |
* |
* |
22 |
* 05.10.2002 new bilinear and qpel interpolation code - Isibaar |
* $Id: interpolate8x8.c,v 1.10.2.5 2003-10-01 23:23:01 edgomez Exp $ |
|
* 27.12.2001 modified "compensate_halfpel" |
|
|
* 05.11.2001 initial version; (c)2001 peter ross <pross@cs.rmit.edu.au> |
|
23 |
* |
* |
24 |
*************************************************************************/ |
****************************************************************************/ |
|
|
|
25 |
|
|
26 |
#include "../portab.h" |
#include "../portab.h" |
27 |
#include "../global.h" |
#include "../global.h" |
101 |
const uint32_t stride, |
const uint32_t stride, |
102 |
const uint32_t rounding) |
const uint32_t rounding) |
103 |
{ |
{ |
104 |
intptr_t j; |
uintptr_t j; |
105 |
|
|
106 |
if (rounding) |
if (rounding) |
107 |
for (j = 7*stride; j >= 0; j-=stride) |
for (j = 0; j < 8*stride; j+=stride) |
108 |
{ |
{ |
109 |
dst[j + 0] = (uint8_t)((src[j + 0] + src[j + 1] )>>1); |
dst[j + 0] = (uint8_t)((src[j + 0] + src[j + 1] )>>1); |
110 |
dst[j + 1] = (uint8_t)((src[j + 1] + src[j + 2] )>>1); |
dst[j + 1] = (uint8_t)((src[j + 1] + src[j + 2] )>>1); |
137 |
const uint32_t stride, |
const uint32_t stride, |
138 |
const uint32_t rounding) |
const uint32_t rounding) |
139 |
{ |
{ |
140 |
intptr_t j; |
uintptr_t j; |
141 |
|
|
142 |
|
|
143 |
if (rounding) |
if (rounding) |
173 |
const uint32_t stride, |
const uint32_t stride, |
174 |
const uint32_t rounding) |
const uint32_t rounding) |
175 |
{ |
{ |
176 |
intptr_t j; |
uintptr_t j; |
177 |
|
|
178 |
if (rounding) |
if (rounding) |
179 |
for (j = 7*stride; j >= 0; j-=stride) |
for (j = 0; j < 8*stride; j+=stride) |
180 |
{ |
{ |
181 |
dst[j + 0] = (uint8_t)((src[j+0] + src[j+1] + src[j+stride+0] + src[j+stride+1] +1)>>2); |
dst[j + 0] = (uint8_t)((src[j+0] + src[j+1] + src[j+stride+0] + src[j+stride+1] +1)>>2); |
182 |
dst[j + 1] = (uint8_t)((src[j+1] + src[j+2] + src[j+stride+1] + src[j+stride+2] +1)>>2); |
dst[j + 1] = (uint8_t)((src[j+1] + src[j+2] + src[j+stride+1] + src[j+stride+2] +1)>>2); |
188 |
dst[j + 7] = (uint8_t)((src[j+7] + src[j+8] + src[j+stride+7] + src[j+stride+8] +1)>>2); |
dst[j + 7] = (uint8_t)((src[j+7] + src[j+8] + src[j+stride+7] + src[j+stride+8] +1)>>2); |
189 |
} |
} |
190 |
else |
else |
191 |
for (j = 7*stride; j >= 0; j-=stride) |
for (j = 0; j < 8*stride; j+=stride) |
192 |
{ |
{ |
193 |
dst[j + 0] = (uint8_t)((src[j+0] + src[j+1] + src[j+stride+0] + src[j+stride+1] +2)>>2); |
dst[j + 0] = (uint8_t)((src[j+0] + src[j+1] + src[j+stride+0] + src[j+stride+1] +2)>>2); |
194 |
dst[j + 1] = (uint8_t)((src[j+1] + src[j+2] + src[j+stride+1] + src[j+stride+2] +2)>>2); |
dst[j + 1] = (uint8_t)((src[j+1] + src[j+2] + src[j+stride+1] + src[j+stride+2] +2)>>2); |