1 |
// 01.05.2002 updated MBMotionCompensationBVOP |
/***************************************************************************** |
2 |
// 14.04.2002 bframe compensation |
* |
3 |
|
* XVID MPEG-4 VIDEO CODEC |
4 |
|
* - Motion Compensation module - |
5 |
|
* |
6 |
|
* Copyright(C) 2002 Michael Militzer <michael@xvid.org> |
7 |
|
* Copyright(C) 2002 Edouard Gomez <ed.gomez@wanadoo.fr> |
8 |
|
* Copyright(C) 2002 Christoph Lampert <gruel@web.de> |
9 |
|
* |
10 |
|
* This program is an implementation of a part of one or more MPEG-4 |
11 |
|
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
12 |
|
* to use this software module in hardware or software products are |
13 |
|
* advised that its use may infringe existing patents or copyrights, and |
14 |
|
* any such use would be at such party's own risk. The original |
15 |
|
* developer of this software module and his/her company, and subsequent |
16 |
|
* editors and their companies, will have no liability for use of this |
17 |
|
* software or modifications or derivatives thereof. |
18 |
|
* |
19 |
|
* This program is free software; you can redistribute it and/or modify |
20 |
|
* it under the terms of the GNU General Public License as published by |
21 |
|
* the Free Software Foundation; either version 2 of the License, or |
22 |
|
* (at your option) any later version. |
23 |
|
* |
24 |
|
* This program is distributed in the hope that it will be useful, |
25 |
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
26 |
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
27 |
|
* GNU General Public License for more details. |
28 |
|
* |
29 |
|
* You should have received a copy of the GNU General Public License |
30 |
|
* along with this program; if not, write to the Free Software |
31 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
32 |
|
* |
33 |
|
*************************************************************************/ |
34 |
|
|
35 |
#include "../encoder.h" |
#include "../encoder.h" |
36 |
#include "../utils/mbfunctions.h" |
#include "../utils/mbfunctions.h" |
130 |
dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2; |
dy = (dy & 3) ? (dy >> 1) | 1 : dy / 2; |
131 |
|
|
132 |
/* uv-image-based compensation */ |
/* uv-image-based compensation */ |
133 |
|
/* Always do block-based compensation, until check for HALFPEL is possible |
134 |
#ifdef BFRAMES |
#ifdef BFRAMES |
135 |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, ref->u, refh->u, |
compensate8x8_halfpel(&dct_codes[4 * 64], cur->u, ref->u, refh->u, |
136 |
refv->u, refhv->u, 8 * i, 8 * j, dx, dy, |
refv->u, refhv->u, 8 * i, 8 * j, dx, dy, |
139 |
refv->v, refhv->v, 8 * i, 8 * j, dx, dy, |
refv->v, refhv->v, 8 * i, 8 * j, dx, dy, |
140 |
edged_width / 2); |
edged_width / 2); |
141 |
#else |
#else |
142 |
|
*/ |
143 |
/* uv-block-based compensation */ |
/* uv-block-based compensation */ |
144 |
interpolate8x8_switch(refv->u, ref->u, 8 * i, 8 * j, dx, dy, |
interpolate8x8_switch(refv->u, ref->u, 8 * i, 8 * j, dx, dy, |
145 |
edged_width / 2, rounding); |
edged_width / 2, rounding); |
154 |
cur->v + 8 * j * edged_width / 2 + 8 * i, |
cur->v + 8 * j * edged_width / 2 + 8 * i, |
155 |
refv->v + 8 * j * edged_width / 2 + 8 * i, |
refv->v + 8 * j * edged_width / 2 + 8 * i, |
156 |
edged_width / 2); |
edged_width / 2); |
157 |
|
/* |
158 |
#endif |
#endif |
159 |
|
*/ |
160 |
} else // mode == MODE_INTER4V |
} else // mode == MODE_INTER4V |
161 |
{ |
{ |
162 |
int32_t sum, dx, dy; |
int32_t sum, dx, dy; |