3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - Encoder header - |
* - Encoder header - |
5 |
* |
* |
6 |
|
* Copyright(C) 2002 Michael Militzer |
7 |
|
* |
8 |
* This program is an implementation of a part of one or more MPEG-4 |
* 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 |
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
10 |
* to use this software module in hardware or software products are |
* to use this software module in hardware or software products are |
29 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
30 |
* |
* |
31 |
****************************************************************************/ |
****************************************************************************/ |
|
/***************************************************************************** |
|
|
* |
|
|
* History |
|
|
* |
|
|
* - 13.06.2002 Added legal header |
|
|
* - 22.08.2001 Added support for EXT_MODE encoding mode |
|
|
* support for EXTENDED API |
|
|
* - 22.08.2001 fixed bug in iDQtab |
|
|
* |
|
|
* $Id$ |
|
|
* |
|
|
****************************************************************************/ |
|
32 |
|
|
33 |
#ifndef _ENCODER_H_ |
#ifndef _ENCODER_H_ |
34 |
#define _ENCODER_H_ |
#define _ENCODER_H_ |
36 |
#include "xvid.h" |
#include "xvid.h" |
37 |
#include "portab.h" |
#include "portab.h" |
38 |
#include "global.h" |
#include "global.h" |
39 |
|
#include "image/image.h" |
40 |
#include "utils/ratecontrol.h" |
#include "utils/ratecontrol.h" |
41 |
|
|
42 |
/***************************************************************************** |
/***************************************************************************** |
60 |
{ |
{ |
61 |
I_VOP = 0, |
I_VOP = 0, |
62 |
P_VOP = 1, |
P_VOP = 1, |
63 |
B_VOP = 2, |
B_VOP = 2 |
|
S_VOP = 3 |
|
64 |
} |
} |
65 |
VOP_TYPE; |
VOP_TYPE; |
66 |
|
|
82 |
uint32_t fincr; |
uint32_t fincr; |
83 |
uint32_t fbase; |
uint32_t fbase; |
84 |
|
|
85 |
/* constants */ |
#ifdef _SMP |
86 |
int global; |
int num_threads; |
87 |
int bquant_ratio; |
#endif |
|
int bquant_offset; |
|
|
int frame_drop_ratio; |
|
|
|
|
|
int iMaxKeyInterval; |
|
|
int max_bframes; |
|
88 |
|
|
89 |
/* rounding type; alternate 0-1 after each interframe */ |
/* rounding type; alternate 0-1 after each interframe */ |
90 |
/* 1 <= fixed_code <= 4 |
/* 1 <= fixed_code <= 4 |
95 |
uint32_t m_quant_type; |
uint32_t m_quant_type; |
96 |
uint32_t m_rounding_type; |
uint32_t m_rounding_type; |
97 |
uint32_t m_fcode; |
uint32_t m_fcode; |
|
uint32_t m_quarterpel; |
|
|
int m_reduced_resolution; /* reduced_resolution_enable */ |
|
98 |
|
|
99 |
HINTINFO *hint; |
HINTINFO *hint; |
100 |
|
|
101 |
int64_t m_stamp; |
uint32_t m_seconds; |
102 |
} |
uint32_t m_ticks; |
|
MBParam; |
|
103 |
|
|
|
|
|
|
typedef struct |
|
|
{ |
|
|
int iTextBits; |
|
|
int iMvSum; |
|
|
int iMvCount; |
|
|
int kblks; |
|
|
int mblks; |
|
|
int ublks; |
|
|
int gblks; |
|
104 |
} |
} |
105 |
Statistics; |
MBParam; |
106 |
|
|
107 |
|
|
108 |
typedef struct |
typedef struct |
113 |
|
|
114 |
VOP_TYPE coding_type; |
VOP_TYPE coding_type; |
115 |
uint32_t rounding_type; |
uint32_t rounding_type; |
|
uint32_t quarterpel; |
|
116 |
uint32_t fcode; |
uint32_t fcode; |
117 |
uint32_t bcode; |
uint32_t bcode; |
118 |
|
|
119 |
uint32_t seconds; |
uint32_t seconds; |
120 |
uint32_t ticks; |
uint32_t ticks; |
|
int64_t stamp; |
|
121 |
|
|
122 |
IMAGE image; |
IMAGE image; |
123 |
|
|
124 |
MACROBLOCK *mbs; |
MACROBLOCK *mbs; |
125 |
|
|
|
WARPPOINTS warp; // as in bitstream |
|
|
GMC_DATA gmc_data; // common data for all MBs |
|
|
|
|
|
Statistics sStat; |
|
126 |
} |
} |
127 |
FRAMEINFO; |
FRAMEINFO; |
128 |
|
|
129 |
|
typedef struct |
130 |
|
{ |
131 |
|
int iTextBits; |
132 |
|
float fMvPrevSigma; |
133 |
|
int iMvSum; |
134 |
|
int iMvCount; |
135 |
|
int kblks; |
136 |
|
int mblks; |
137 |
|
int ublks; |
138 |
|
} |
139 |
|
Statistics; |
140 |
|
|
141 |
|
|
142 |
|
|
143 |
typedef struct |
typedef struct |
144 |
{ |
{ |
145 |
MBParam mbParam; |
MBParam mbParam; |
146 |
|
|
147 |
int iFrameNum; |
int iFrameNum; |
148 |
|
int iMaxKeyInterval; |
149 |
int bitrate; |
int bitrate; |
150 |
|
|
151 |
// images |
// images |
162 |
IMAGE vInterHV; |
IMAGE vInterHV; |
163 |
IMAGE vInterHVf; |
IMAGE vInterHVf; |
164 |
|
|
165 |
IMAGE vGMC; |
Statistics sStat; |
|
|
|
|
/* image queue */ |
|
|
int queue_head; |
|
|
int queue_tail; |
|
|
int queue_size; |
|
|
IMAGE *queue; |
|
|
|
|
|
/* bframe buffer */ |
|
|
int bframenum_head; |
|
|
int bframenum_tail; |
|
|
int flush_bframes; |
|
|
|
|
|
FRAMEINFO **bframes; |
|
|
IMAGE f_refh; |
|
|
IMAGE f_refv; |
|
|
IMAGE f_refhv; |
|
|
int bframenum_dx50bvop; |
|
|
|
|
|
int m_framenum; /* debug frame num counter; unlike iFrameNum, does not reset at ivop */ |
|
|
|
|
166 |
RateControl rate_control; |
RateControl rate_control; |
|
|
|
|
float fMvPrevSigma; |
|
167 |
} |
} |
168 |
Encoder; |
Encoder; |
169 |
|
|