1 |
/************************************************************************** |
/***************************************************************************** |
2 |
* |
* |
3 |
* Modifications: |
* XVID MPEG-4 VIDEO CODEC |
4 |
|
* - Motion estimation fuctions header file - |
5 |
* |
* |
6 |
* 26.03.2002 interlacing support |
* Copyright(C) 2002 Michael Militzer |
|
* 02.12.2001 motion estimation/compensation split |
|
|
* 16.11.2001 const/uint32_t changes to MBMotionEstComp() |
|
|
* 26.08.2001 added inter4v_mode parameter to MBMotionEstComp() |
|
7 |
* |
* |
8 |
* Michael Militzer <isibaar@videocoding.de> |
* 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 |
|
* $Id: mbfunctions.h,v 1.11 2002-09-05 21:13:22 edgomez Exp $ |
32 |
|
* |
33 |
|
****************************************************************************/ |
34 |
|
|
35 |
#ifndef _ENCORE_BLOCK_H |
#ifndef _MBFUNCTIONS_H |
36 |
#define _ENCORE_BLOCK_H |
#define _MBFUNCTIONS_H |
37 |
|
|
38 |
#include "../encoder.h" |
#include "../encoder.h" |
39 |
#include "../bitstream/bitstream.h" |
#include "../bitstream/bitstream.h" |
40 |
|
|
41 |
|
/***************************************************************************** |
42 |
|
* Prototypes |
43 |
|
****************************************************************************/ |
44 |
|
|
45 |
|
|
46 |
/** MotionEstimation **/ |
/* MotionEstimation */ |
47 |
|
|
48 |
bool MotionEstimation( |
bool MotionEstimation(MBParam * const pParam, |
49 |
MACROBLOCK * const pMBs, |
FRAMEINFO * const current, |
50 |
MBParam * const pParam, |
FRAMEINFO * const reference, |
51 |
const IMAGE * const pRef, |
const IMAGE * const pRefH, |
52 |
|
const IMAGE * const pRefV, |
53 |
|
const IMAGE * const pRefHV, |
54 |
|
const uint32_t iLimit); |
55 |
|
|
56 |
|
|
57 |
|
bool SMP_MotionEstimation(MBParam * const pParam, |
58 |
|
FRAMEINFO * const current, |
59 |
|
FRAMEINFO * const reference, |
60 |
const IMAGE * const pRefH, |
const IMAGE * const pRefH, |
61 |
const IMAGE * const pRefV, |
const IMAGE * const pRefV, |
62 |
const IMAGE * const pRefHV, |
const IMAGE * const pRefHV, |
|
IMAGE * const pCurrent, |
|
63 |
const uint32_t iLimit); |
const uint32_t iLimit); |
64 |
|
|
65 |
|
|
66 |
/** MBMotionCompensation **/ |
|
67 |
void MBMotionCompensation( |
/* MBMotionCompensation */ |
68 |
MACROBLOCK * const pMB, |
|
69 |
|
void MBMotionCompensation(MACROBLOCK * const pMB, |
70 |
const uint32_t j, |
const uint32_t j, |
71 |
const uint32_t i, |
const uint32_t i, |
72 |
const IMAGE * const pRef, |
const IMAGE * const pRef, |
74 |
const IMAGE * const pRefV, |
const IMAGE * const pRefV, |
75 |
const IMAGE * const pRefHV, |
const IMAGE * const pRefHV, |
76 |
IMAGE * const pCurrent, |
IMAGE * const pCurrent, |
77 |
int16_t dct_codes[][64], |
int16_t dct_codes[6 * 64], |
78 |
const uint32_t width, |
const uint32_t width, |
79 |
const uint32_t height, |
const uint32_t height, |
80 |
const uint32_t edged_width, |
const uint32_t edged_width, |
81 |
const uint32_t rounding); |
const uint32_t rounding); |
82 |
|
|
83 |
|
|
84 |
/** MBTransQuant.c **/ |
/* MBTransQuant.c */ |
|
|
|
85 |
|
|
86 |
void MBTransQuantIntra(const MBParam *pParam, |
void MBTransQuantIntra(const MBParam *pParam, |
87 |
|
FRAMEINFO * frame, |
88 |
MACROBLOCK * pMB, |
MACROBLOCK * pMB, |
89 |
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 */ |
90 |
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 */ |
91 |
int16_t data[][64], /* <-> the data of the MB to be coded */ |
int16_t data[6 * 64], /* <-> the data of the MB to be coded */ |
92 |
int16_t qcoeff[][64], /* <-> the quantized DCT coefficients */ |
int16_t qcoeff[6 * 64]); /* <-> the quantized DCT coefficients */ |
93 |
IMAGE * const pCurrent /* <-> the reconstructed image ( function will update one |
|
|
MB in it with data from data[] ) */ |
|
|
); |
|
94 |
|
|
95 |
|
|
96 |
uint8_t MBTransQuantInter(const MBParam *pParam, /* <-- the parameter for DCT transformation |
void MBTransQuantIntra2(const MBParam * pParam, |
97 |
and Quantization */ |
FRAMEINFO * frame, |
98 |
MACROBLOCK * pMB, |
MACROBLOCK * pMB, |
99 |
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 */ |
100 |
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 */ |
101 |
int16_t data[][64], /* <-> the data of the MB to be coded */ |
int16_t data[6 * 64], /* <-> the data of the MB to be coded */ |
102 |
int16_t qcoeff[][64], /* <-> the quantized DCT coefficients */ |
int16_t qcoeff[6 * 64]); /* <-> the quantized DCT coefficients */ |
103 |
IMAGE * const pCurrent /* <-> the reconstructed image ( function will |
|
104 |
update one MB in it with data from data[] ) */ |
|
105 |
); |
|
106 |
|
uint8_t MBTransQuantInter(const MBParam * pParam, |
107 |
|
FRAMEINFO * frame, |
108 |
|
MACROBLOCK * pMB, |
109 |
|
const uint32_t x_pos, |
110 |
|
const uint32_t y_pos, |
111 |
|
int16_t data[6 * 64], |
112 |
|
int16_t qcoeff[6 * 64]); |
113 |
|
|
114 |
|
|
115 |
|
uint8_t MBTransQuantInter2(const MBParam * pParam, |
116 |
|
FRAMEINFO * frame, |
117 |
|
MACROBLOCK * pMB, |
118 |
|
const uint32_t x_pos, |
119 |
|
const uint32_t y_pos, |
120 |
|
int16_t data[6 * 64], |
121 |
|
int16_t qcoeff[6 * 64]); |
122 |
|
|
123 |
|
uint8_t MBTransQuantInterBVOP(const MBParam * pParam, |
124 |
|
FRAMEINFO * frame, |
125 |
|
MACROBLOCK * pMB, |
126 |
|
int16_t data[6 * 64], |
127 |
|
int16_t qcoeff[6 * 64]); |
128 |
|
|
129 |
|
void MBTrans(const MBParam * pParam, |
130 |
|
FRAMEINFO * frame, |
131 |
|
MACROBLOCK * pMB, |
132 |
|
const uint32_t x_pos, |
133 |
|
const uint32_t y_pos, |
134 |
|
int16_t data[6 * 64]); |
135 |
|
|
136 |
|
void MBfDCT(const MBParam * pParam, |
137 |
|
FRAMEINFO * frame, |
138 |
|
MACROBLOCK * pMB, |
139 |
|
int16_t data[6 * 64]); |
140 |
|
|
141 |
|
uint8_t MBQuantInter(const MBParam * pParam, |
142 |
|
const int iQuant, |
143 |
|
int16_t data[6 * 64], |
144 |
|
int16_t qcoeff[6 * 64]); |
145 |
|
|
146 |
|
void MBQuantDeQuantIntra(const MBParam * pParam, |
147 |
|
FRAMEINFO * frame, |
148 |
|
MACROBLOCK *pMB, |
149 |
|
int16_t qcoeff[6 * 64], |
150 |
|
int16_t data[6*64]); |
151 |
|
|
152 |
|
void MBQuantIntra(const MBParam * pParam, |
153 |
|
FRAMEINFO * frame, |
154 |
|
MACROBLOCK *pMB, |
155 |
|
int16_t qcoeff[6 * 64], |
156 |
|
int16_t data[6*64]); |
157 |
|
|
158 |
|
void MBDeQuantIntra(const MBParam * pParam, |
159 |
|
const int iQuant, |
160 |
|
int16_t qcoeff[6 * 64], |
161 |
|
int16_t data[6*64]); |
162 |
|
|
163 |
|
void MBDeQuantInter(const MBParam * pParam, |
164 |
|
const int iQuant, |
165 |
|
int16_t data[6 * 64], |
166 |
|
int16_t qcoeff[6 * 64], |
167 |
|
const uint8_t cbp); |
168 |
|
|
169 |
|
|
170 |
|
void MBiDCT(nt16_t data[6 * 64], |
171 |
|
const uint8_t cbp); |
172 |
|
|
173 |
|
|
174 |
|
void MBTransAdd(const MBParam * pParam, |
175 |
|
FRAMEINFO * frame, |
176 |
|
MACROBLOCK * pMB, |
177 |
|
const uint32_t x_pos, |
178 |
|
const uint32_t y_pos, |
179 |
|
int16_t data[6 * 64], |
180 |
|
const uint8_t cbp); |
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
/* interlacing */ |
185 |
|
|
186 |
/** interlacing **/ |
uint32_t MBDecideFieldDCT(int16_t data[6 * 64]); /* <- decide whether to use field-based DCT for interlacing */ |
187 |
|
|
188 |
uint32_t MBDecideFieldDCT(int16_t data[][64]); /* <- decide whether to use field-based DCT |
void MBFrameToField(int16_t data[6 * 64]); /* de-interlace vertical Y blocks */ |
|
for interlacing */ |
|
189 |
|
|
|
void MBFrameToField(int16_t data[][64]); /* de-interlace vertical Y blocks */ |
|
190 |
|
|
191 |
void MBFieldToFrame(int16_t data[][64]); /* re-interlace vertical Y blocks */ |
/* MBCoding.c */ |
192 |
|
|
193 |
|
void MBSkip(Bitstream * bs); /* just the bitstream. Since MB is skipped, no info is needed */ |
194 |
|
|
|
/** MBCoding.c **/ |
|
195 |
|
|
196 |
void MBCoding(const MBParam *pParam, /* <-- the parameter for coding of the bitstream */ |
void MBCoding(const FRAMEINFO * frame, /* <-- the parameter for coding of the bitstream */ |
197 |
MACROBLOCK *pMB, /* <-- Info of the MB to be coded */ |
MACROBLOCK *pMB, /* <-- Info of the MB to be coded */ |
198 |
int16_t qcoeff[][64], /* <-- the quantized DCT coefficients */ |
int16_t qcoeff[6 * 64], /* <-- the quantized DCT coefficients */ |
199 |
Bitstream * bs, /* <-> the bitstream */ |
Bitstream * bs, /* <-> the bitstream */ |
200 |
Statistics * pStat /* <-> statistical data collected for current frame */ |
Statistics * pStat); /* <-> statistical data collected for current frame */ |
|
); |
|
201 |
|
|
202 |
#endif |
#endif |