[cvs] / xvidcore / src / encoder.h Repository:
ViewVC logotype

Annotation of /xvidcore/src/encoder.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (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 : suxen_drol 1.5 P_VOP = 1,
35 :     B_VOP = 2
36 : Isibaar 1.1 }
37 :     VOP_TYPE;
38 :    
39 :     /***********************************
40 :    
41 :     Encoding Parameters
42 :    
43 :     ************************************/
44 :    
45 :     typedef struct
46 :     {
47 :     uint32_t width;
48 :     uint32_t height;
49 :    
50 :     uint32_t edged_width;
51 :     uint32_t edged_height;
52 :     uint32_t mb_width;
53 :     uint32_t mb_height;
54 :    
55 :     /* rounding type; alternate 0-1 after each interframe */
56 :     /* 1 <= fixed_code <= 4
57 :     automatically adjusted using motion vector statistics inside
58 :     */
59 :    
60 : suxen_drol 1.5 /* vars that not "quite" frame independant */
61 :     uint32_t m_quant_type;
62 :     uint32_t m_rounding_type;
63 :     uint32_t m_fcode;
64 :    
65 :     HINTINFO * hint;
66 :    
67 :     } MBParam;
68 :    
69 :    
70 :     typedef struct
71 :     {
72 : Isibaar 1.1 uint32_t quant;
73 :     uint32_t motion_flags;
74 :     uint32_t global_flags;
75 : h 1.3
76 : suxen_drol 1.5 VOP_TYPE coding_type;
77 :     uint32_t rounding_type;
78 :     uint32_t fcode;
79 :     uint32_t bcode;
80 :    
81 :     uint32_t tick;
82 :    
83 :     IMAGE image;
84 :    
85 :     MACROBLOCK * mbs;
86 :    
87 :     } FRAMEINFO;
88 : Isibaar 1.1
89 :     typedef struct
90 :     {
91 :     int iTextBits;
92 :     float fMvPrevSigma;
93 :     int iMvSum;
94 :     int iMvCount;
95 :     int kblks;
96 :     int mblks;
97 :     int ublks;
98 :     }
99 :     Statistics;
100 :    
101 :    
102 :    
103 :     typedef struct
104 :     {
105 :     MBParam mbParam;
106 :    
107 :     int iFrameNum;
108 :     int iMaxKeyInterval;
109 :     int bitrate;
110 :    
111 :     // images
112 :    
113 : suxen_drol 1.5 FRAMEINFO * current;
114 :     FRAMEINFO * reference;
115 :    
116 : Isibaar 1.4 #ifdef _DEBUG
117 :     IMAGE sOriginal;
118 :     #endif
119 : Isibaar 1.1 IMAGE vInterH;
120 :     IMAGE vInterV;
121 : h 1.2 IMAGE vInterVf;
122 : Isibaar 1.1 IMAGE vInterHV;
123 : h 1.2 IMAGE vInterHVf;
124 : Isibaar 1.1
125 :     Statistics sStat;
126 :     }
127 :     Encoder;
128 :    
129 :    
130 :     // indicates no quantizer changes in INTRA_Q/INTER_Q modes
131 :     #define NO_CHANGE 64
132 :    
133 :     void init_encoder(uint32_t cpu_flags);
134 :    
135 :     int encoder_create(XVID_ENC_PARAM * pParam);
136 :     int encoder_destroy(Encoder * pEnc);
137 :     int encoder_encode(Encoder * pEnc, XVID_ENC_FRAME * pFrame, XVID_ENC_STATS * pResult);
138 :    
139 :     static __inline uint8_t get_fcode(uint16_t sr)
140 :     {
141 :     if (sr <= 16)
142 :     return 1;
143 :    
144 :     else if (sr <= 32)
145 :     return 2;
146 :    
147 :     else if (sr <= 64)
148 :     return 3;
149 :    
150 :     else if (sr <= 128)
151 :     return 4;
152 :    
153 :     else if (sr <= 256)
154 :     return 5;
155 :    
156 :     else if (sr <= 512)
157 :     return 6;
158 :    
159 :     else if (sr <= 1024)
160 :     return 7;
161 :    
162 :     else
163 :     return 0;
164 :     }
165 :    
166 :     #endif /* _ENCODER_H_ */

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4