1 |
/***************************************************************************** |
/************************************************************************** |
2 |
* |
* |
3 |
* XVID MPEG-4 VIDEO CODEC |
* Modifications: |
|
* - Motion estimation fuctions header file - |
|
4 |
* |
* |
5 |
* Copyright(C) 2002 Michael Militzer |
* 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 program is an implementation of a part of one or more MPEG-4 |
* Michael Militzer <isibaar@videocoding.de> |
|
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
|
|
* to use this software module in hardware or software products are |
|
|
* advised that its use may infringe existing patents or copyrights, and |
|
|
* any such use would be at such party's own risk. The original |
|
|
* developer of this software module and his/her company, and subsequent |
|
|
* editors and their companies, will have no liability for use of this |
|
|
* software or modifications or derivatives thereof. |
|
12 |
* |
* |
13 |
* This program 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 |
|
|
* |
|
|
* $Id: mbfunctions.h,v 1.13 2002-10-07 08:11:06 chl 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, |
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 |
uint32_t MBDecideFieldDCT(int16_t data[6 * 64]); /* <- decide whether to use field-based DCT for interlacing */ |
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 |
|
/* 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 */ |
192 |
|
|
|
void MBSkip(Bitstream * bs); /* just the bitstream. Since MB is skipped, no info is needed */ |
|
193 |
|
|
194 |
|
void MBCoding(const FRAMEINFO * const frame, /* <-- the parameter for coding of the bitstream */ |
195 |
|
|
|
void MBCoding(const FRAMEINFO * frame, /* <-- the parameter for coding of the bitstream */ |
|
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 |