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

Annotation of /xvidcore/src/divx4.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (view) (download)

1 : Isibaar 1.1 #ifndef _DIVX4_H_
2 :     #define _DIVX4_H_
3 :    
4 :     #ifdef __cplusplus
5 : edgomez 1.2 extern "C"
6 :     {
7 :     #endif
8 : Isibaar 1.1
9 :     /*********************************************************************************
10 :     * Decoder part *
11 :     *********************************************************************************/
12 :    
13 :     /* decore commands */
14 :     #define DEC_OPT_MEMORY_REQS 0
15 :     #define DEC_OPT_INIT 1
16 :     #define DEC_OPT_RELEASE 2
17 : edgomez 1.2 #define DEC_OPT_SETPP 3
18 :     #define DEC_OPT_SETOUT 4
19 : Isibaar 1.1 #define DEC_OPT_FRAME 5
20 :     #define DEC_OPT_FRAME_311 6
21 :     #define DEC_OPT_SETPP2 7
22 :     #define DEC_OPT_VERSION 8
23 :    
24 :     /* return values */
25 :     #define DEC_OK 0
26 :     #define DEC_MEMORY 1
27 :     #define DEC_BAD_FORMAT 2
28 :     #define DEC_EXIT 3
29 :    
30 :     /* yuv colour formats */
31 :     #define DEC_YUY2 1
32 :     #define DEC_YUV2 DEC_YUY2
33 :     #define DEC_UYVY 2
34 :     #define DEC_420 3
35 :     #define DEC_YV12 13
36 :    
37 :     /* rgb colour formats */
38 : edgomez 1.2 #define DEC_RGB32 4
39 :     #define DEC_RGB24 5
40 :     #define DEC_RGB555 6
41 :     #define DEC_RGB565 7
42 : Isibaar 1.1
43 :     #define DEC_RGB32_INV 8
44 :     #define DEC_RGB24_INV 9
45 :     #define DEC_RGB555_INV 10
46 :     #define DEC_RGB565_INV 11
47 :    
48 :     /* return pointers to initial buffers
49 : edgomez 1.2 equivalent to XVID_CSP_USER */
50 : Isibaar 1.1 #define DEC_USER 12
51 :    
52 :     /* output structure for DEC_USER */
53 : edgomez 1.2 typedef struct
54 :     {
55 :     void *y;
56 :     void *u;
57 :     void *v;
58 :     int stride_y;
59 :     int stride_uv;
60 :     }
61 :     DEC_PICTURE;
62 :    
63 :     typedef struct
64 :     {
65 :     unsigned long mp4_edged_ref_buffers_size;
66 :     unsigned long mp4_edged_for_buffers_size;
67 :     unsigned long mp4_edged_back_buffers_size;
68 :     unsigned long mp4_display_buffers_size;
69 :     unsigned long mp4_state_size;
70 :     unsigned long mp4_tables_size;
71 :     unsigned long mp4_stream_size;
72 :     unsigned long mp4_reference_size;
73 :     }
74 :     DEC_MEM_REQS;
75 :    
76 :     typedef struct
77 :     {
78 :     void *mp4_edged_ref_buffers;
79 :     void *mp4_edged_for_buffers;
80 :     void *mp4_edged_back_buffers;
81 :     void *mp4_display_buffers;
82 :     void *mp4_state;
83 :     void *mp4_tables;
84 :     void *mp4_stream;
85 :     void *mp4_reference;
86 :     }
87 :     DEC_BUFFERS;
88 :    
89 :     typedef struct
90 :     {
91 :     int x_dim; /* frame width */
92 :     int y_dim; /* frame height */
93 :     int output_format;
94 :     int time_incr;
95 :     DEC_BUFFERS buffers;
96 :     }
97 :     DEC_PARAM;
98 :    
99 :     typedef struct
100 :     {
101 :     void *bmp; /* pointer to output buffer */
102 :     void *bitstream; /* input bit stream */
103 :     long length; /* length of bitstream */
104 :     int render_flag;
105 :     unsigned int stride;
106 :     }
107 :     DEC_FRAME;
108 :    
109 :     typedef struct
110 :     {
111 :     int intra;
112 :     int *quant_store;
113 :     int quant_stride;
114 :     }
115 :     DEC_FRAME_INFO;
116 : Isibaar 1.1
117 :     /* configure postprocessing */
118 : edgomez 1.2 typedef struct
119 :     {
120 :     int postproc_level; /* ranging from 0 to 100 */
121 :     }
122 :     DEC_SET;
123 :    
124 :     int decore(unsigned long handle,
125 :     unsigned long dec_opt,
126 :     void *param1,
127 :     void *param2);
128 : Isibaar 1.1
129 :    
130 :    
131 :     /*********************************************************************************
132 :     * Encoder part *
133 :     *********************************************************************************/
134 :    
135 :     /**
136 :     Structure passed as an argument when creating encoder.
137 :     You have to initialize at least x_dim and y_dim ( valid range:
138 :     0<x_dim<=1920, 0<y_dim<=1280, both dimensions should be even ).
139 :     You can set all other values to 0, in which case they'll be initialized
140 :     to default values, or specify them directly.
141 :     On success 'handle' member will contain non-zero handle to initialized
142 :     encoder.
143 :     **/
144 : edgomez 1.2 typedef struct _ENC_PARAM_
145 :     {
146 : edgomez 1.4 int x_dim; /* the x dimension of the frames to be encoded */
147 :     int y_dim; /* the y dimension of the frames to be encoded */
148 :     float framerate; /* the frame rate of the sequence to be encoded, in frames/second */
149 :     int bitrate; /* the bitrate of the target encoded stream, in bits/second */
150 :     int rc_period; /* the intended rate control averaging period */
151 :     int rc_reaction_period; /* the reaction period for rate control */
152 :     int rc_reaction_ratio; /* the ratio for down/up rate control */
153 :     int max_quantizer; /* the upper limit of the quantizer */
154 :     int min_quantizer; /* the lower limit of the quantizer */
155 :     int max_key_interval; /* the maximum interval between key frames */
156 :     int use_bidirect; /* use bidirectional coding */
157 :     int deinterlace; /* fast deinterlace */
158 :     int quality; /* the quality of compression ( 1 - fastest, 5 - best ) */
159 :     int obmc; /* flag to enable overlapped block motion compensation mode */
160 :     void *handle; /* will be filled by encore */
161 : edgomez 1.2 }
162 :     ENC_PARAM;
163 : Isibaar 1.1
164 :    
165 : edgomez 1.4 /* encore2 */
166 : Isibaar 1.1
167 :    
168 :     /**
169 :     Structure passed as a first argument when encoding a frame.
170 :     Both pointers should be non-NULL. You are responsible for allocation
171 :     of bitstream buffer, its size should be large enough to hold a frame.
172 :     Checks for buffer overflow are too expensive and it will be almost
173 :     impossible to recover from such overflow. Thus, no checks for buffer
174 :     overflow will be done.
175 :     Theoretical upper limit of frame size is around 6 bytes/pixel
176 :     or 2.5 Mb for 720x576 frame.
177 :     On success 'length' will contain number of bytes written into the stream.
178 :     **/
179 : edgomez 1.2 typedef struct _ENC_FRAME_
180 :     {
181 : edgomez 1.4 void *image; /* the image frame to be encoded */
182 :     void *bitstream; /* the buffer for encoded bitstream */
183 :     int length; /* the length of the encoded bitstream */
184 :     int colorspace; /* the format of image frame */
185 :     int quant; /* quantizer for this frame; only used in VBR modes */
186 :     int intra; /* force this frame to be intra/inter; only used in VBR 2-pass */
187 :     void *mvs; /* optional pointer to array of motion vectors */
188 : edgomez 1.2 }
189 :     ENC_FRAME;
190 : Isibaar 1.1
191 :     /**
192 :     Structure passed as a second optional argument when encoding a frame.
193 :     On successful return its members are filled with parameters of encoded
194 :     stream.
195 :     **/
196 : edgomez 1.2 typedef struct _ENC_RESULT_
197 :     {
198 : edgomez 1.4 int is_key_frame; /* the current frame is encoded as a key frame */
199 :     int quantizer; /* the quantizer used for this frame */
200 :     int texture_bits; /* amount of bits spent on coding DCT coeffs */
201 :     int motion_bits; /* amount of bits spend on coding motion */
202 :     int total_bits; /* sum of two previous fields */
203 : edgomez 1.2 }
204 :     ENC_RESULT;
205 : Isibaar 1.1
206 : edgomez 1.4 /* the prototype of the encore() - main encode engine entrance */
207 :     int encore(void *handle, /* handle - the handle of the calling entity, must be unique */
208 : edgomez 1.2
209 : edgomez 1.4 int enc_opt, /* enc_opt - the option for encoding, see below */
210 : edgomez 1.2
211 : edgomez 1.4 void *param1, /* param1 - the parameter 1 (its actually meaning depends on enc_opt */
212 : edgomez 1.2
213 : edgomez 1.4 void *param2); /* param2 - the parameter 2 (its actually meaning depends on enc_opt */
214 : Isibaar 1.1
215 : edgomez 1.4 /* encore options (the enc_opt parameter of encore()) */
216 :     #define ENC_OPT_INIT 0 /* initialize the encoder, return a handle */
217 :     #define ENC_OPT_RELEASE 1 /* release all the resource associated with the handle */
218 :     #define ENC_OPT_ENCODE 2 /* encode a single frame */
219 :     #define ENC_OPT_ENCODE_VBR 3 /* encode a single frame, not using internal rate control algorithm */
220 : Isibaar 1.1 #define ENC_OPT_VERSION 4
221 :    
222 :     #define ENCORE_VERSION 20010807
223 : edgomez 1.2
224 :    
225 : Isibaar 1.1
226 : edgomez 1.4 /* return code of encore() */
227 : Isibaar 1.1 #define ENC_FAIL -1
228 :     #define ENC_OK 0
229 :     #define ENC_MEMORY 1
230 :     #define ENC_BAD_FORMAT 2
231 :    
232 :     /** Common 24-bit RGB, order of components b-g-r **/
233 :     #define ENC_CSP_RGB24 0
234 :    
235 :     /** Planar YUV, U & V subsampled by 2 in both directions,
236 :     average 12 bit per pixel; order of components y-v-u **/
237 :     #define ENC_CSP_YV12 1
238 :    
239 :     /** Packed YUV, U and V subsampled by 2 horizontally,
240 :     average 16 bit per pixel; order of components y-u-y-v **/
241 :     #define ENC_CSP_YUY2 2
242 :    
243 :     /** Same as above, but order of components is u-y-v-y **/
244 :     #define ENC_CSP_UYVY 3
245 :    
246 :     /** Same as ENC_CSP_YV12, but chroma components are swapped ( order y-u-v ) **/
247 :     #define ENC_CSP_I420 4
248 :    
249 :     /** Same as above **/
250 :     #define ENC_CSP_IYUV ENC_CSP_I420
251 :    
252 :     #ifdef __cplusplus
253 :     }
254 : edgomez 1.2 #endif
255 : Isibaar 1.1
256 : edgomez 1.4 #endif /* _DIVX4_H_ */

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