xvmc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003 Ivan Kalvachev
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVCODEC_XVMC_H
22 #define AVCODEC_XVMC_H
23 
24 /**
25  * @file
26  * @ingroup lavc_codec_hwaccel_xvmc
27  * Public libavcodec XvMC header.
28  */
29 
30 #include <X11/extensions/XvMC.h>
31 
32 #include "avcodec.h"
33 
34 /**
35  * @defgroup lavc_codec_hwaccel_xvmc XvMC
36  * @ingroup lavc_codec_hwaccel
37  *
38  * @{
39  */
40 
41 #define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct
42  the number is 1337 speak for the letters IDCT MCo (motion compensation) */
43 
44 struct xvmc_pix_fmt {
45  /** The field contains the special constant value AV_XVMC_ID.
46  It is used as a test that the application correctly uses the API,
47  and that there is no corruption caused by pixel routines.
48  - application - set during initialization
49  - libavcodec - unchanged
50  */
51  int xvmc_id;
52 
53  /** Pointer to the block array allocated by XvMCCreateBlocks().
54  The array has to be freed by XvMCDestroyBlocks().
55  Each group of 64 values represents one data block of differential
56  pixel information (in MoCo mode) or coefficients for IDCT.
57  - application - set the pointer during initialization
58  - libavcodec - fills coefficients/pixel data into the array
59  */
60  short* data_blocks;
61 
62  /** Pointer to the macroblock description array allocated by
63  XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
64  - application - set the pointer during initialization
65  - libavcodec - fills description data into the array
66  */
67  XvMCMacroBlock* mv_blocks;
68 
69  /** Number of macroblock descriptions that can be stored in the mv_blocks
70  array.
71  - application - set during initialization
72  - libavcodec - unchanged
73  */
75 
76  /** Number of blocks that can be stored at once in the data_blocks array.
77  - application - set during initialization
78  - libavcodec - unchanged
79  */
81 
82  /** Indicate that the hardware would interpret data_blocks as IDCT
83  coefficients and perform IDCT on them.
84  - application - set during initialization
85  - libavcodec - unchanged
86  */
87  int idct;
88 
89  /** In MoCo mode it indicates that intra macroblocks are assumed to be in
90  unsigned format; same as the XVMC_INTRA_UNSIGNED flag.
91  - application - set during initialization
92  - libavcodec - unchanged
93  */
94  int unsigned_intra;
95 
96  /** Pointer to the surface allocated by XvMCCreateSurface().
97  It has to be freed by XvMCDestroySurface() on application exit.
98  It identifies the frame and its state on the video hardware.
99  - application - set during initialization
100  - libavcodec - unchanged
101  */
102  XvMCSurface* p_surface;
104 /** Set by the decoder before calling ff_draw_horiz_band(),
105  needed by the XvMCRenderSurface function. */
106 //@{
107  /** Pointer to the surface used as past reference
108  - application - unchanged
109  - libavcodec - set
110  */
111  XvMCSurface* p_past_surface;
113  /** Pointer to the surface used as future reference
114  - application - unchanged
115  - libavcodec - set
116  */
117  XvMCSurface* p_future_surface;
119  /** top/bottom field or frame
120  - application - unchanged
121  - libavcodec - set
122  */
123  unsigned int picture_structure;
125  /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence
126  - application - unchanged
127  - libavcodec - set
128  */
129  unsigned int flags;
130 //}@
131 
132  /** Number of macroblock descriptions in the mv_blocks array
133  that have already been passed to the hardware.
134  - application - zeroes it on get_buffer().
135  A successful ff_draw_horiz_band() may increment it
136  with filled_mb_block_num or zero both.
137  - libavcodec - unchanged
138  */
141  /** Number of new macroblock descriptions in the mv_blocks array (after
142  start_mv_blocks_num) that are filled by libavcodec and have to be
143  passed to the hardware.
144  - application - zeroes it on get_buffer() or after successful
145  ff_draw_horiz_band().
146  - libavcodec - increment with one of each stored MB
147  */
150  /** Number of the next free data block; one data block consists of
151  64 short values in the data_blocks array.
152  All blocks before this one have already been claimed by placing their
153  position into the corresponding block description structure field,
154  that are part of the mv_blocks array.
155  - application - zeroes it on get_buffer().
156  A successful ff_draw_horiz_band() may zero it together
157  with start_mb_blocks_num.
158  - libavcodec - each decoded macroblock increases it by the number
159  of coded blocks it contains.
160  */
162 };
163 
164 /**
165  * @}
166  */
167 
168 #endif /* AVCODEC_XVMC_H */
int filled_mv_blocks_num
Number of new macroblock descriptions in the mv_blocks array (after start_mv_blocks_num) that are fil...
Definition: xvmc.h:149
int allocated_data_blocks
Number of blocks that can be stored at once in the data_blocks array.
Definition: xvmc.h:81
int allocated_mv_blocks
Number of macroblock descriptions that can be stored in the mv_blocks array.
Definition: xvmc.h:75
unsigned int flags
XVMC_SECOND_FIELD - 1st or 2nd field in the sequence.
Definition: xvmc.h:130
int next_free_data_block_num
Number of the next free data block; one data block consists of 64 short values in the data_blocks arr...
Definition: xvmc.h:162
unsigned int picture_structure
top/bottom field or frame
Definition: xvmc.h:124
external API header
int xvmc_id
The field contains the special constant value AV_XVMC_ID.
Definition: xvmc.h:52
XvMCMacroBlock * mv_blocks
Pointer to the macroblock description array allocated by XvMCCreateMacroBlocks() and freed by XvMCDes...
Definition: xvmc.h:68
int unsigned_intra
In MoCo mode it indicates that intra macroblocks are assumed to be in unsigned format; same as the XV...
Definition: xvmc.h:95
short * data_blocks
Pointer to the block array allocated by XvMCCreateBlocks().
Definition: xvmc.h:61
XvMCSurface * p_past_surface
Set by the decoder before calling ff_draw_horiz_band(), needed by the XvMCRenderSurface function...
Definition: xvmc.h:112
int start_mv_blocks_num
Number of macroblock descriptions in the mv_blocks array that have already been passed to the hardwar...
Definition: xvmc.h:140
int idct
Indicate that the hardware would interpret data_blocks as IDCT coefficients and perform IDCT on them...
Definition: xvmc.h:88
XvMCSurface * p_surface
Pointer to the surface allocated by XvMCCreateSurface().
Definition: xvmc.h:103
XvMCSurface * p_future_surface
Pointer to the surface used as future reference.
Definition: xvmc.h:118