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

Annotation of /trunk/xvidcore/src/divx4.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (view) (download)

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

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