19 |
#include "portab.h" |
#include "portab.h" |
20 |
#include "global.h" |
#include "global.h" |
21 |
#include "image/image.h" |
#include "image/image.h" |
22 |
|
#include "utils/ratecontrol.h" |
23 |
|
|
24 |
#define H263_QUANT 0 |
#define H263_QUANT 0 |
25 |
#define MPEG4_QUANT 1 |
#define MPEG4_QUANT 1 |
31 |
typedef enum |
typedef enum |
32 |
{ |
{ |
33 |
I_VOP = 0, |
I_VOP = 0, |
34 |
P_VOP = 1 |
P_VOP = 1, |
35 |
|
B_VOP = 2 |
36 |
} |
} |
37 |
VOP_TYPE; |
VOP_TYPE; |
38 |
|
|
52 |
uint32_t mb_width; |
uint32_t mb_width; |
53 |
uint32_t mb_height; |
uint32_t mb_height; |
54 |
|
|
55 |
VOP_TYPE coding_type; |
/* frame rate increment & base */ |
56 |
|
uint32_t fincr; |
57 |
|
uint32_t fbase; |
58 |
|
|
59 |
|
#ifdef BFRAMES |
60 |
|
int max_bframes; |
61 |
|
#endif |
62 |
|
|
63 |
/* rounding type; alternate 0-1 after each interframe */ |
/* rounding type; alternate 0-1 after each interframe */ |
|
|
|
|
uint32_t rounding_type; |
|
|
|
|
64 |
/* 1 <= fixed_code <= 4 |
/* 1 <= fixed_code <= 4 |
65 |
automatically adjusted using motion vector statistics inside |
automatically adjusted using motion vector statistics inside |
66 |
*/ |
*/ |
67 |
|
|
68 |
uint32_t fixed_code; |
/* vars that not "quite" frame independant */ |
69 |
|
uint32_t m_quant_type; |
70 |
|
uint32_t m_rounding_type; |
71 |
|
uint32_t m_fcode; |
72 |
|
|
73 |
|
HINTINFO * hint; |
74 |
|
|
75 |
|
#ifdef BFRAMES |
76 |
|
uint32_t m_seconds; |
77 |
|
uint32_t m_ticks; |
78 |
|
#endif |
79 |
|
|
80 |
|
} MBParam; |
81 |
|
|
82 |
|
|
83 |
|
typedef struct |
84 |
|
{ |
85 |
uint32_t quant; |
uint32_t quant; |
|
uint32_t quant_type; |
|
86 |
uint32_t motion_flags; |
uint32_t motion_flags; |
87 |
uint32_t global_flags; |
uint32_t global_flags; |
88 |
} MBParam; |
|
89 |
|
VOP_TYPE coding_type; |
90 |
|
uint32_t rounding_type; |
91 |
|
uint32_t fcode; |
92 |
|
uint32_t bcode; |
93 |
|
|
94 |
|
#ifdef BFRAMES |
95 |
|
uint32_t seconds; |
96 |
|
uint32_t ticks; |
97 |
|
#endif |
98 |
|
|
99 |
|
IMAGE image; |
100 |
|
|
101 |
|
MACROBLOCK * mbs; |
102 |
|
|
103 |
|
} FRAMEINFO; |
104 |
|
|
105 |
typedef struct |
typedef struct |
106 |
{ |
{ |
122 |
|
|
123 |
int iFrameNum; |
int iFrameNum; |
124 |
int iMaxKeyInterval; |
int iMaxKeyInterval; |
|
int lum_masking; |
|
125 |
int bitrate; |
int bitrate; |
126 |
|
|
127 |
// images |
// images |
128 |
|
|
129 |
IMAGE sCurrent; |
FRAMEINFO * current; |
130 |
IMAGE sReference; |
FRAMEINFO * reference; |
131 |
|
|
132 |
|
#ifdef _DEBUG |
133 |
|
IMAGE sOriginal; |
134 |
|
#endif |
135 |
IMAGE vInterH; |
IMAGE vInterH; |
136 |
IMAGE vInterV; |
IMAGE vInterV; |
137 |
|
IMAGE vInterVf; |
138 |
IMAGE vInterHV; |
IMAGE vInterHV; |
139 |
|
IMAGE vInterHVf; |
140 |
|
|
141 |
// macroblock |
#ifdef BFRAMES |
142 |
|
/* constants */ |
143 |
MACROBLOCK * pMBs; |
int bquant_ratio; |
144 |
|
/* vars */ |
145 |
|
int bframenum_head; |
146 |
|
int bframenum_tail; |
147 |
|
int flush_bframes; |
148 |
|
|
149 |
|
FRAMEINFO ** bframes; |
150 |
|
IMAGE f_refh; |
151 |
|
IMAGE f_refv; |
152 |
|
IMAGE f_refhv; |
153 |
|
#endif |
154 |
Statistics sStat; |
Statistics sStat; |
155 |
|
RateControl rate_control; |
156 |
} |
} |
157 |
Encoder; |
Encoder; |
158 |
|
|