Parent Directory | Revision Log
Revision 1.3 - (view) (download)
1 : | Isibaar | 1.1 | /************************************************************************** |
2 : | * | ||
3 : | * Modifications: | ||
4 : | * | ||
5 : | * 22.08.2001 added support for EXT_MODE encoding mode | ||
6 : | * support for EXTENDED API | ||
7 : | * 22.08.2001 fixed bug in iDQtab | ||
8 : | * | ||
9 : | * Michael Militzer <isibaar@videocoding.de> | ||
10 : | * | ||
11 : | **************************************************************************/ | ||
12 : | |||
13 : | #ifndef _ENCODER_H_ | ||
14 : | #define _ENCODER_H_ | ||
15 : | |||
16 : | |||
17 : | #include "xvid.h" | ||
18 : | |||
19 : | #include "portab.h" | ||
20 : | #include "global.h" | ||
21 : | #include "image/image.h" | ||
22 : | |||
23 : | |||
24 : | #define H263_QUANT 0 | ||
25 : | #define MPEG4_QUANT 1 | ||
26 : | |||
27 : | |||
28 : | typedef uint32_t bool; | ||
29 : | |||
30 : | |||
31 : | typedef enum | ||
32 : | { | ||
33 : | I_VOP = 0, | ||
34 : | P_VOP = 1 | ||
35 : | } | ||
36 : | VOP_TYPE; | ||
37 : | |||
38 : | /*********************************** | ||
39 : | |||
40 : | Encoding Parameters | ||
41 : | |||
42 : | ************************************/ | ||
43 : | |||
44 : | typedef struct | ||
45 : | { | ||
46 : | uint32_t width; | ||
47 : | uint32_t height; | ||
48 : | |||
49 : | uint32_t edged_width; | ||
50 : | uint32_t edged_height; | ||
51 : | uint32_t mb_width; | ||
52 : | uint32_t mb_height; | ||
53 : | |||
54 : | VOP_TYPE coding_type; | ||
55 : | |||
56 : | /* rounding type; alternate 0-1 after each interframe */ | ||
57 : | |||
58 : | uint32_t rounding_type; | ||
59 : | |||
60 : | /* 1 <= fixed_code <= 4 | ||
61 : | automatically adjusted using motion vector statistics inside | ||
62 : | */ | ||
63 : | |||
64 : | uint32_t fixed_code; | ||
65 : | uint32_t quant; | ||
66 : | uint32_t quant_type; | ||
67 : | uint32_t motion_flags; | ||
68 : | uint32_t global_flags; | ||
69 : | h | 1.3 | |
70 : | HINTINFO * hint; | ||
71 : | Isibaar | 1.1 | } MBParam; |
72 : | |||
73 : | typedef struct | ||
74 : | { | ||
75 : | int iTextBits; | ||
76 : | float fMvPrevSigma; | ||
77 : | int iMvSum; | ||
78 : | int iMvCount; | ||
79 : | int kblks; | ||
80 : | int mblks; | ||
81 : | int ublks; | ||
82 : | } | ||
83 : | Statistics; | ||
84 : | |||
85 : | |||
86 : | |||
87 : | typedef struct | ||
88 : | { | ||
89 : | MBParam mbParam; | ||
90 : | |||
91 : | int iFrameNum; | ||
92 : | int iMaxKeyInterval; | ||
93 : | int lum_masking; | ||
94 : | int bitrate; | ||
95 : | |||
96 : | // images | ||
97 : | |||
98 : | IMAGE sCurrent; | ||
99 : | IMAGE sReference; | ||
100 : | IMAGE vInterH; | ||
101 : | IMAGE vInterV; | ||
102 : | h | 1.2 | IMAGE vInterVf; |
103 : | Isibaar | 1.1 | IMAGE vInterHV; |
104 : | h | 1.2 | IMAGE vInterHVf; |
105 : | Isibaar | 1.1 | |
106 : | // macroblock | ||
107 : | |||
108 : | MACROBLOCK * pMBs; | ||
109 : | |||
110 : | Statistics sStat; | ||
111 : | } | ||
112 : | Encoder; | ||
113 : | |||
114 : | |||
115 : | // indicates no quantizer changes in INTRA_Q/INTER_Q modes | ||
116 : | #define NO_CHANGE 64 | ||
117 : | |||
118 : | void init_encoder(uint32_t cpu_flags); | ||
119 : | |||
120 : | int encoder_create(XVID_ENC_PARAM * pParam); | ||
121 : | int encoder_destroy(Encoder * pEnc); | ||
122 : | int encoder_encode(Encoder * pEnc, XVID_ENC_FRAME * pFrame, XVID_ENC_STATS * pResult); | ||
123 : | |||
124 : | static __inline uint8_t get_fcode(uint16_t sr) | ||
125 : | { | ||
126 : | if (sr <= 16) | ||
127 : | return 1; | ||
128 : | |||
129 : | else if (sr <= 32) | ||
130 : | return 2; | ||
131 : | |||
132 : | else if (sr <= 64) | ||
133 : | return 3; | ||
134 : | |||
135 : | else if (sr <= 128) | ||
136 : | return 4; | ||
137 : | |||
138 : | else if (sr <= 256) | ||
139 : | return 5; | ||
140 : | |||
141 : | else if (sr <= 512) | ||
142 : | return 6; | ||
143 : | |||
144 : | else if (sr <= 1024) | ||
145 : | return 7; | ||
146 : | |||
147 : | else | ||
148 : | return 0; | ||
149 : | } | ||
150 : | |||
151 : | #endif /* _ENCODER_H_ */ |
No admin address has been configured | ViewVC Help |
Powered by ViewVC 1.0.4 |