1 |
/***************************************************************************** |
/************************************************************************** |
2 |
* |
* |
3 |
* XVID MPEG-4 VIDEO CODEC |
* Modifications: |
|
* - Motion estimation fuctions header file - |
|
4 |
* |
* |
5 |
* Copyright(C) 2002 Michael Militzer <isibaar@xvid.org> |
* 29.03.2002 removed MBFieldToFrame - no longer used (transfers instead) |
6 |
|
* 26.03.2002 interlacing support |
7 |
|
* 02.12.2001 motion estimation/compensation split |
8 |
|
* 16.11.2001 const/uint32_t changes to MBMotionEstComp() |
9 |
|
* 26.08.2001 added inter4v_mode parameter to MBMotionEstComp() |
10 |
* |
* |
11 |
* This file is part of XviD, a free MPEG-4 video encoder/decoder |
* Michael Militzer <isibaar@videocoding.de> |
12 |
* |
* |
13 |
* XviD is free software; you can redistribute it and/or modify it |
**************************************************************************/ |
|
* under the terms of the GNU General Public License as published by |
|
|
* the Free Software Foundation; either version 2 of the License, or |
|
|
* (at your option) any later version. |
|
|
* |
|
|
* This program is distributed in the hope that it will be useful, |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
* GNU General Public License for more details. |
|
|
* |
|
|
* You should have received a copy of the GNU General Public License |
|
|
* along with this program; if not, write to the Free Software |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
* |
|
|
* 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. |
|
|
* |
|
|
* $Id: mbfunctions.h,v 1.16 2002-11-28 07:27:37 suxen_drol Exp $ |
|
|
* |
|
|
****************************************************************************/ |
|
14 |
|
|
15 |
#ifndef _MBFUNCTIONS_H |
#ifndef _ENCORE_BLOCK_H |
16 |
#define _MBFUNCTIONS_H |
#define _ENCORE_BLOCK_H |
17 |
|
|
18 |
#include "../encoder.h" |
#include "../encoder.h" |
19 |
#include "../bitstream/bitstream.h" |
#include "../bitstream/bitstream.h" |
20 |
|
|
|
/***************************************************************************** |
|
|
* Prototypes |
|
|
****************************************************************************/ |
|
21 |
|
|
22 |
|
|
23 |
/* MotionEstimation */ |
/** MotionEstimation **/ |
24 |
|
|
25 |
bool MotionEstimation(MBParam * const pParam, |
bool MotionEstimation(MBParam * const pParam, |
26 |
FRAMEINFO * const current, |
FRAMEINFO * const current, |
31 |
const uint32_t iLimit); |
const uint32_t iLimit); |
32 |
|
|
33 |
|
|
34 |
|
bool SMP_MotionEstimation(MBParam * const pParam, |
35 |
|
FRAMEINFO * const current, |
36 |
|
FRAMEINFO * const reference, |
37 |
|
const IMAGE * const pRefH, |
38 |
|
const IMAGE * const pRefV, |
39 |
|
const IMAGE * const pRefHV, |
40 |
|
const uint32_t iLimit); |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
/* MBMotionCompensation */ |
/** MBMotionCompensation **/ |
45 |
|
|
46 |
void MBMotionCompensation(MACROBLOCK * const pMB, |
void |
47 |
const uint32_t j, |
MBMotionCompensation(MACROBLOCK * const mb, |
48 |
const uint32_t i, |
const uint32_t i, |
49 |
const IMAGE * const pRef, |
const uint32_t j, |
50 |
const IMAGE * const pRefH, |
const IMAGE * const ref, |
51 |
const IMAGE * const pRefV, |
const IMAGE * const refh, |
52 |
const IMAGE * const pRefHV, |
const IMAGE * const refv, |
53 |
IMAGE * const pCurrent, |
const IMAGE * const refhv, |
54 |
int16_t dct_codes[6 * 64], |
const IMAGE * const refGMC, |
55 |
|
IMAGE * const cur, |
56 |
|
int16_t * dct_codes, |
57 |
const uint32_t width, |
const uint32_t width, |
58 |
const uint32_t height, |
const uint32_t height, |
59 |
const uint32_t edged_width, |
const uint32_t edged_width, |
60 |
const uint32_t rounding); |
const int32_t quarterpel, |
61 |
|
const int reduced_resolution, |
62 |
|
const int32_t rounding); |
63 |
|
|
64 |
|
/** MBTransQuant.c **/ |
65 |
|
|
|
/* MBTransQuant.c */ |
|
66 |
|
|
67 |
void MBTransQuantIntra(const MBParam * pParam, |
void MBTransQuantIntra(const MBParam * pParam, |
68 |
FRAMEINFO * frame, |
FRAMEINFO * frame, |
69 |
MACROBLOCK * pMB, |
MACROBLOCK * pMB, |
70 |
const uint32_t x_pos, /* <-- The x position of the MB to be searched */ |
const uint32_t x_pos, /* <-- The x position of the MB to be searched */ |
71 |
|
|
72 |
const uint32_t y_pos, /* <-- The y position of the MB to be searched */ |
const uint32_t y_pos, /* <-- The y position of the MB to be searched */ |
73 |
|
|
74 |
int16_t data[6 * 64], /* <-> the data of the MB to be coded */ |
int16_t data[6 * 64], /* <-> the data of the MB to be coded */ |
|
int16_t qcoeff[6 * 64]); /* <-> the quantized DCT coefficients */ |
|
75 |
|
|
76 |
|
int16_t qcoeff[6 * 64] /* <-> the quantized DCT coefficients */ |
77 |
|
); |
78 |
|
|
79 |
|
|
80 |
void MBTransQuantIntra2(const MBParam * pParam, |
void MBTransQuantIntra2(const MBParam * pParam, |
81 |
FRAMEINFO * frame, |
FRAMEINFO * frame, |
82 |
MACROBLOCK * pMB, |
MACROBLOCK * pMB, |
83 |
const uint32_t x_pos, /* <-- The x position of the MB to be searched */ |
const uint32_t x_pos, /* <-- The x position of the MB to be searched */ |
84 |
|
|
85 |
const uint32_t y_pos, /* <-- The y position of the MB to be searched */ |
const uint32_t y_pos, /* <-- The y position of the MB to be searched */ |
86 |
|
|
87 |
int16_t data[6 * 64], /* <-> the data of the MB to be coded */ |
int16_t data[6 * 64], /* <-> the data of the MB to be coded */ |
|
int16_t qcoeff[6 * 64]); /* <-> the quantized DCT coefficients */ |
|
88 |
|
|
89 |
|
int16_t qcoeff[6 * 64] /* <-> the quantized DCT coefficients */ |
90 |
|
); |
91 |
|
|
92 |
|
|
93 |
uint8_t MBTransQuantInter(const MBParam * pParam, |
uint8_t MBTransQuantInter(const MBParam * pParam, |
139 |
void MBQuantIntra(const MBParam * pParam, |
void MBQuantIntra(const MBParam * pParam, |
140 |
FRAMEINFO * frame, |
FRAMEINFO * frame, |
141 |
MACROBLOCK *pMB, |
MACROBLOCK *pMB, |
142 |
int16_t data[6*64], |
int16_t qcoeff[6 * 64], |
143 |
int16_t qcoeff[6 * 64]); |
int16_t data[6*64]); |
144 |
|
|
145 |
void MBDeQuantIntra(const MBParam * pParam, |
void MBDeQuantIntra(const MBParam * pParam, |
146 |
const int iQuant, |
const int iQuant, |
168 |
|
|
169 |
|
|
170 |
|
|
171 |
/* interlacing */ |
/** interlacing **/ |
172 |
|
|
173 |
|
uint32_t MBDecideFieldDCT(int16_t data[6 * 64]); /* <- decide whether to use field-based DCT |
174 |
|
for interlacing */ |
175 |
|
|
176 |
|
typedef uint32_t (MBFIELDTEST) (int16_t data[6 * 64]); /* function pointer for field test */ |
177 |
|
typedef MBFIELDTEST *MBFIELDTEST_PTR; |
178 |
|
|
179 |
|
/* global field test pointer for xvid.c */ |
180 |
|
extern MBFIELDTEST_PTR MBFieldTest; |
181 |
|
|
182 |
uint32_t MBDecideFieldDCT(int16_t data[6 * 64]); /* <- decide whether to use field-based DCT for interlacing */ |
/* field test implementations */ |
183 |
|
MBFIELDTEST MBFieldTest_c; |
184 |
|
MBFIELDTEST MBFieldTest_mmx; |
185 |
|
|
186 |
void MBFrameToField(int16_t data[6 * 64]); /* de-interlace vertical Y blocks */ |
void MBFrameToField(int16_t data[6 * 64]); /* de-interlace vertical Y blocks */ |
187 |
|
|
188 |
|
|
189 |
/* MBCoding.c */ |
/** MBCoding.c **/ |
190 |
|
|
191 |
void MBSkip(Bitstream * bs); /* just the bitstream. Since MB is skipped, no info is needed */ |
/* void MBSkip(Bitstream * bs); just the bitstream. Since MB is skipped, no info is needed */ |
192 |
|
|
193 |
|
|
194 |
void MBCoding(const FRAMEINFO * frame, /* <-- the parameter for coding of the bitstream */ |
void MBCoding(const FRAMEINFO * const frame, /* <-- the parameter for coding of the bitstream */ |
195 |
|
|
196 |
MACROBLOCK * pMB, /* <-- Info of the MB to be coded */ |
MACROBLOCK * pMB, /* <-- Info of the MB to be coded */ |
197 |
|
|
198 |
int16_t qcoeff[6 * 64], /* <-- the quantized DCT coefficients */ |
int16_t qcoeff[6 * 64], /* <-- the quantized DCT coefficients */ |
199 |
|
|
200 |
Bitstream * bs, /* <-> the bitstream */ |
Bitstream * bs, /* <-> the bitstream */ |
201 |
Statistics * pStat); /* <-> statistical data collected for current frame */ |
|
202 |
|
Statistics * pStat /* <-> statistical data collected for current frame */ |
203 |
|
); |
204 |
|
|
205 |
#endif |
#endif |