[cvs] / xvidcore / doc / xvid-decoding.txt Repository:
ViewVC logotype

Annotation of /xvidcore/doc/xvid-decoding.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download)

1 : Isibaar 1.1 /*************************************************************
2 :     * Short explanation for the XviD data strutures and routines
3 :     *
4 :     * decoding part
5 :     *
6 :     * if you have further questions, visit http://www.xvid.org
7 :     *
8 :     **************************************************************/
9 :    
10 :     /* these are are structures/routines from xvid.h needed for decoding */
11 :    
12 :     --------------------------------------------------------------------------
13 :    
14 :     #define API_VERSION ((1 << 16) | (0))
15 :    
16 :     This is the revision of the xvid.h file that you have in front of you.
17 :     Check it against the
18 :     library's version.
19 :    
20 :     --------------------------------------------------------------------------
21 :    
22 :     typedef struct
23 :     {
24 :     int cpu_flags; [in/out]
25 :     int api_version; [out]
26 :     int core_build; [out]
27 :     } XVID_INIT_PARAM;
28 :    
29 :     This is filled by xvid_init with the correct CPU flags for initialization
30 :     (auto-detect), unless you pass flag to it (cpu_flags!=0). Do not use that
31 :     unless you really know what you are doing.
32 :     api_version can (should) be checked against API_VERSION, to see if you
33 :     have the right core library.
34 :    
35 :     Used in: xvid_init(NULL, 0, &xinit, NULL);
36 :    
37 :     --------------------------------------------------------------------------
38 :    
39 :     typedef struct
40 :     {
41 :     int width; [in] (should be a multiple of 16, max is )
42 :     int height; [in] (should be a multiple of 16, max is )
43 :     void *handle; [out]
44 :     } XVID_DEC_PARAM;
45 :    
46 :     When creating decoder, you have to provide it with height and width of the
47 :     image to decode (this is _not_ in the bytestream itself!).
48 :     In handle a unique handle is given back, that has to be used to identify
49 :     this instance of decoding.
50 :    
51 :     Used in: xerr = xvid_decore(NULL, XVID_DEC_CREATE, &xparam, NULL);
52 :    
53 :     --------------------------------------------------------------------------
54 :    
55 :     typedef struct
56 :     {
57 :     void * bitstream; [in]
58 :     int length; [in]
59 :    
60 :     void * image; [in]
61 :     int stride; [in]
62 :     int colorspace; [in]
63 :     } XVID_DEC_FRAME;
64 :    
65 :     This is the main structure for decoding itself. You provide the
66 :     MPEG4-bitstream and it's length,
67 :     image is the position where the decoded picture should be stored.
68 :     stride is the difference between the memory address of the first pixel of
69 :     a row in the image and the first pixel of the next row. If the image is
70 :     going to be one big block, then stride=width, but by making it larger you
71 :     can create an "edged" picture.
72 :     By colorspace the output format for the image is given, XVID_CSP_RGB24 or
73 :     XVID_CSP_YV12 might be might common.
74 :    
75 :     A special case is XVID_CSP_USER. If you use this, then *image will not
76 :     filled with the image but with a structure that contains pointers to the
77 :     decoder's internal representation of it. That's faster, because no memcopy
78 :     is involved, but don't use it, if you don't know what you're doing.
79 :    
80 :     Used in: xerr = xvid_decore(dechandle, XVID_DEC_DECODE, &xframe, NULL);
81 :    
82 :     --------------------------------------------------------------------------
83 :    
84 :     int xvid_decore(void * handle, [in/out]
85 :     int opt, [in]
86 :     void * param1, [in]
87 :     void * param2); [in]
88 :    
89 :    
90 :     XviD uses a single-function API, so everything you want to do is done by
91 :     this routine. The opt parameter chooses the behaviour of the routine:
92 :    
93 :     XVID_DEC_CREATE: create a new decoder, XVID_DEC_PARAM in param1,
94 :     a handle to the new decoder is returned in handle
95 :    
96 :     XVID_DEC_DECODE: decode one frame, XVID_DEC_FRAME-structure in param1
97 :    
98 :     XVID_DEC_DESTROY: shut down this decoder, do not use handle afterwards

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