Main Page   Modules   Data Structures   File List   Data Fields   Related Pages  

xvid.h

00001 /*****************************************************************************
00002  *
00003  *  XVID MPEG-4 VIDEO CODEC
00004  *  - XviD Main header file -
00005  *
00006  *  This file is part of XviD, a free MPEG-4 video encoder/decoder
00007  *
00008  *  XviD is free software; you can redistribute it and/or modify it
00009  *  under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program; if not, write to the Free Software
00020  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00021  *
00022  *  Under section 8 of the GNU General Public License, the copyright
00023  *  holders of XVID explicitly forbid distribution in the following
00024  *  countries:
00025  *
00026  *    - Japan
00027  *    - United States of America
00028  *
00029  *  Linking XviD statically or dynamically with other modules is making a
00030  *  combined work based on XviD.  Thus, the terms and conditions of the
00031  *  GNU General Public License cover the whole combination.
00032  *
00033  *  As a special exception, the copyright holders of XviD give you
00034  *  permission to link XviD with independent modules that communicate with
00035  *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the
00036  *  license terms of these independent modules, and to copy and distribute
00037  *  the resulting combined work under terms of your choice, provided that
00038  *  every copy of the combined work is accompanied by a complete copy of
00039  *  the source code of XviD (the version of XviD used to produce the
00040  *  combined work), being distributed under the terms of the GNU General
00041  *  Public License plus this exception.  An independent module is a module
00042  *  which is not derived from or based on XviD.
00043  *
00044  *  Note that people who make modified versions of XviD are not obligated
00045  *  to grant this special exception for their modified versions; it is
00046  *  their choice whether to do so.  The GNU General Public License gives
00047  *  permission to release a modified version without this exception; this
00048  *  exception also makes it possible to release a modified version which
00049  *  carries forward this exception.
00050  *
00051  * $Id: xvid.h,v 1.24 2002/11/26 23:44:10 edgomez Exp $
00052  *
00053  *****************************************************************************/
00054 
00055 #ifndef _XVID_H_
00056 #define _XVID_H_
00057 
00058 #ifdef __cplusplus
00059 extern "C" {
00060 #endif
00061 
00062 
00070 /*****************************************************************************
00071  *  API version number
00072  ****************************************************************************/
00073 
00079 #define API_VERSION ((2 << 16) | (1))
00092 /*****************************************************************************
00093  *  Error codes
00094  ****************************************************************************/
00095 
00096 
00102 #define XVID_ERR_FAIL   -1 
00118 #define XVID_ERR_OK      0 
00124 #define XVID_ERR_MEMORY  1 
00129 #define XVID_ERR_FORMAT  2 
00137 /*****************************************************************************
00138  *  Color space constants
00139  ****************************************************************************/
00140 
00141 
00147 #define XVID_CSP_RGB24  0  
00148 #define XVID_CSP_YV12   1  
00149 #define XVID_CSP_YUY2   2  
00150 #define XVID_CSP_UYVY   3  
00151 #define XVID_CSP_I420   4  
00152 #define XVID_CSP_RGB555 10 
00153 #define XVID_CSP_RGB565 11 
00154 #define XVID_CSP_USER   12 
00161 #define XVID_CSP_EXTERN 1004 
00168 #define XVID_CSP_YVYU   1002 
00169 #define XVID_CSP_RGB32  1000 
00170 #define XVID_CSP_NULL   9999 
00172 #define XVID_CSP_VFLIP  0x80000000 
00188 /*****************************************************************************
00189  *  CPU flags
00190  ****************************************************************************/
00191 
00192 
00207 #define XVID_CPU_MMX      0x00000001 
00208 #define XVID_CPU_MMXEXT   0x00000002 
00209 #define XVID_CPU_SSE      0x00000004 
00210 #define XVID_CPU_SSE2     0x00000008 
00211 #define XVID_CPU_3DNOW    0x00000010 
00212 #define XVID_CPU_3DNOWEXT 0x00000020 
00213 #define XVID_CPU_TSC      0x00000040 
00222 #define XVID_CPU_IA64     0x00000080 
00236 #define XVID_CPU_CHKONLY  0x40000000 
00243 #define XVID_CPU_FORCE    0x80000000 
00253 /*****************************************************************************
00254  *  Initialization structures
00255  ****************************************************************************/
00256 
00258     typedef struct
00259     {
00260         int cpu_flags;   
00265         int api_version; 
00271         int core_build;  
00274     }
00275     XVID_INIT_PARAM;
00276 
00277 /*****************************************************************************
00278  *  Initialization entry point
00279  ****************************************************************************/
00280 
00298     int xvid_init(void *handle,
00299               int opt,
00300               void *param1,
00301               void *param2);
00302 
00307 /*****************************************************************************
00308  * Decoder constant
00309  ****************************************************************************/
00310 
00328 #define XVID_QUICK_DECODE       0x00000010
00329 
00330 
00335 /*****************************************************************************
00336  * Decoder structures
00337  ****************************************************************************/
00338 
00339     typedef struct
00340     {
00341         int width;
00342         int height;
00343         void *handle;
00344     }
00345     XVID_DEC_PARAM;
00346 
00347 
00348     typedef struct
00349     {
00350         int general;
00351         void *bitstream;
00352         int length;
00353 
00354         void *image;
00355         int stride;
00356         int colorspace;
00357     }
00358     XVID_DEC_FRAME;
00359 
00360 
00361     /* This struct is used for per slice rendering */
00362     typedef struct 
00363     {
00364         void *y,*u,*v;
00365         int stride_y, stride_u,stride_v;
00366     } XVID_DEC_PICTURE;
00367 
00368 
00369 /*****************************************************************************
00370  * Decoder entry point
00371  ****************************************************************************/
00372 
00381 #define XVID_DEC_DECODE     0 
00387 #define XVID_DEC_CREATE     1 
00394 #define XVID_DEC_DESTROY    2 
00422     int xvid_decore(void *handle,
00423             int opt,
00424             void *param1,
00425             void *param2);
00426 
00437 /*****************************************************************************
00438  * Encoder constants
00439  ****************************************************************************/
00440 
00446 #define XVID_VALID_FLAGS        0x80000000 
00448 #define XVID_CUSTOM_QMATRIX     0x00000004 
00452 #define XVID_H263QUANT          0x00000010 
00455 #define XVID_MPEGQUANT          0x00000020 
00458 #define XVID_HALFPEL            0x00000040 
00461 #define XVID_ADAPTIVEQUANT      0x00000080
00465 #define XVID_LUMIMASKING        0x00000100
00468 #define XVID_LATEINTRA          0x00000200
00471 #define XVID_INTERLACING        0x00000400
00474 #define XVID_TOPFIELDFIRST      0x00000800
00477 #define XVID_ALTERNATESCAN      0x00001000
00480 #define XVID_HINTEDME_GET       0x00002000
00484 #define XVID_HINTEDME_SET       0x00004000
00488 #define XVID_INTER4V            0x00008000
00493 #define XVID_ME_ZERO            0x00010000
00496 #define XVID_ME_LOGARITHMIC     0x00020000
00499 #define XVID_ME_FULLSEARCH      0x00040000
00502 #define XVID_ME_PMVFAST         0x00080000
00505 #define XVID_ME_EPZS            0x00100000
00508 #define XVID_GREYSCALE          0x01000000
00512 #define XVID_GRAYSCALE          XVID_GREYSCALE 
00523 #define PMV_ADVANCEDDIAMOND8    0x00004000
00527 #define PMV_ADVANCEDDIAMOND16   0x00008000
00530 #define PMV_HALFPELDIAMOND16    0x00010000
00534 #define PMV_HALFPELREFINE16     0x00020000
00539 #define PMV_EXTSEARCH16         0x00040000
00545 #define PMV_EARLYSTOP16         0x00080000
00551 #define PMV_QUICKSTOP16         0x00100000
00556 #define PMV_UNRESTRICTED16      0x00200000
00561 #define PMV_OVERLAPPING16       0x00400000
00565 #define PMV_USESQUARES16        0x00800000
00569 #define PMV_HALFPELDIAMOND8     0x01000000
00572 #define PMV_HALFPELREFINE8      0x02000000
00575 #define PMV_EXTSEARCH8          0x04000000
00578 #define PMV_EARLYSTOP8          0x08000000
00581 #define PMV_QUICKSTOP8          0x10000000
00584 #define PMV_UNRESTRICTED8       0x20000000
00587 #define PMV_OVERLAPPING8        0x40000000
00590 #define PMV_USESQUARES8         0x80000000
00596 /*****************************************************************************
00597  * Encoder structures
00598  ****************************************************************************/
00599 
00601     typedef struct
00602     {
00603         int width;                    
00606         int height;                   
00609         int fincr;                    
00612         int fbase;                    
00615         int rc_bitrate;               
00618         int rc_reaction_delay_factor; 
00621         int rc_averaging_period;      
00624         int rc_buffer;                
00627         int max_quantizer;            
00630         int min_quantizer;            
00633         int max_key_interval;         
00636         void *handle;                 
00639     }
00640     XVID_ENC_PARAM;
00641 
00642     typedef struct
00643     {
00644         int x;
00645         int y;
00646     }
00647     VECTOR;
00648 
00649     typedef struct
00650     {
00651         int mode;               /* macroblock mode */
00652         VECTOR mvs[4];
00653     }
00654     MVBLOCKHINT;
00655 
00656     typedef struct
00657     {
00658         int intra;              /* frame intra choice */
00659         int fcode;              /* frame fcode */
00660         MVBLOCKHINT *block;     /* caller-allocated array of block hints (mb_width * mb_height) */
00661     }
00662     MVFRAMEHINT;
00663 
00664     typedef struct
00665     {
00666         int rawhints;           /* if set, use MVFRAMEHINT, else use compressed buffer */
00667 
00668         MVFRAMEHINT mvhint;
00669         void *hintstream;       /* compressed hint buffer */
00670         int hintlength;         /* length of buffer (bytes) */
00671     }
00672     HINTINFO;
00673 
00675     typedef struct
00676     {
00677         int general;                       
00680         int motion;                        
00683         void *bitstream;                   
00686         int length;                        
00689         void *image;                       
00692         int colorspace;                    
00695         unsigned char *quant_intra_matrix; 
00698         unsigned char *quant_inter_matrix; 
00701         int quant;                         
00713         int intra;                         
00730         HINTINFO hint;                     
00734     }
00735     XVID_ENC_FRAME;
00736 
00737 
00739     typedef struct
00740     {
00741         int quant;               
00744         int hlength;             
00747         int kblks;               
00750         int mblks;               
00753         int ublks;               
00756     }
00757     XVID_ENC_STATS;
00758 
00759 
00760 /*****************************************************************************
00761  * Encoder entry point
00762  ****************************************************************************/
00763 
00772 #define XVID_ENC_ENCODE     0 
00778 #define XVID_ENC_CREATE     1 
00784 #define XVID_ENC_DESTROY    2 
00810     int xvid_encore(void *handle,
00811                     int opt,
00812                     void *param1,
00813                     void *param2);
00814 
00819 #ifdef __cplusplus
00820 }
00821 #endif
00822 
00823 #endif



Author : XviD team <xvid-devel@xvid.org> Date : 2003-02-13