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 #pragma message("XvMC is no longer supported; this header is deprecated and will be removed")
31 
32 #include <X11/extensions/XvMC.h>
33 
34 #include "libavutil/attributes.h"
35 #include "avcodec.h"
36 
37 /**
38  * @defgroup lavc_codec_hwaccel_xvmc XvMC
39  * @ingroup lavc_codec_hwaccel
40  *
41  * @{
42  */
43 
44 #define AV_XVMC_ID                    0x1DC711C0  /**< special value to ensure that regular pixel routines haven't corrupted the struct
45                                                        the number is 1337 speak for the letters IDCT MCo (motion compensation) */
46 
47 struct attribute_deprecated xvmc_pix_fmt {
48     /** The field contains the special constant value AV_XVMC_ID.
49         It is used as a test that the application correctly uses the API,
50         and that there is no corruption caused by pixel routines.
51         - application - set during initialization
52         - libavcodec  - unchanged
53     */
54     int             xvmc_id;
55 
56     /** Pointer to the block array allocated by XvMCCreateBlocks().
57         The array has to be freed by XvMCDestroyBlocks().
58         Each group of 64 values represents one data block of differential
59         pixel information (in MoCo mode) or coefficients for IDCT.
60         - application - set the pointer during initialization
61         - libavcodec  - fills coefficients/pixel data into the array
62     */
63     short*          data_blocks;
64 
65     /** Pointer to the macroblock description array allocated by
66         XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks().
67         - application - set the pointer during initialization
68         - libavcodec  - fills description data into the array
69     */
70     XvMCMacroBlock* mv_blocks;
71 
72     /** Number of macroblock descriptions that can be stored in the mv_blocks
73         array.
74         - application - set during initialization
75         - libavcodec  - unchanged
76     */
77     int             allocated_mv_blocks;
78 
79     /** Number of blocks that can be stored at once in the data_blocks array.
80         - application - set during initialization
81         - libavcodec  - unchanged
82     */
83     int             allocated_data_blocks;
84 
85     /** Indicate that the hardware would interpret data_blocks as IDCT
86         coefficients and perform IDCT on them.
87         - application - set during initialization
88         - libavcodec  - unchanged
89     */
90     int             idct;
91 
92     /** In MoCo mode it indicates that intra macroblocks are assumed to be in
93         unsigned format; same as the XVMC_INTRA_UNSIGNED flag.
94         - application - set during initialization
95         - libavcodec  - unchanged
96     */
97     int             unsigned_intra;
98 
99     /** Pointer to the surface allocated by XvMCCreateSurface().
100         It has to be freed by XvMCDestroySurface() on application exit.
101         It identifies the frame and its state on the video hardware.
102         - application - set during initialization
103         - libavcodec  - unchanged
104     */
105     XvMCSurface*    p_surface;
106 
107 /** Set by the decoder before calling ff_draw_horiz_band(),
108     needed by the XvMCRenderSurface function. */
109 //@{
110     /** Pointer to the surface used as past reference
111         - application - unchanged
112         - libavcodec  - set
113     */
114     XvMCSurface*    p_past_surface;
115 
116     /** Pointer to the surface used as future reference
117         - application - unchanged
118         - libavcodec  - set
119     */
120     XvMCSurface*    p_future_surface;
121 
122     /** top/bottom field or frame
123         - application - unchanged
124         - libavcodec  - set
125     */
126     unsigned int    picture_structure;
127 
128     /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence
129         - application - unchanged
130         - libavcodec  - set
131     */
132     unsigned int    flags;
133 //}@
134 
135     /** Number of macroblock descriptions in the mv_blocks array
136         that have already been passed to the hardware.
137         - application - zeroes it on get_buffer().
138                         A successful ff_draw_horiz_band() may increment it
139                         with filled_mb_block_num or zero both.
140         - libavcodec  - unchanged
141     */
142     int             start_mv_blocks_num;
143 
144     /** Number of new macroblock descriptions in the mv_blocks array (after
145         start_mv_blocks_num) that are filled by libavcodec and have to be
146         passed to the hardware.
147         - application - zeroes it on get_buffer() or after successful
148                         ff_draw_horiz_band().
149         - libavcodec  - increment with one of each stored MB
150     */
151     int             filled_mv_blocks_num;
152 
153     /** Number of the next free data block; one data block consists of
154         64 short values in the data_blocks array.
155         All blocks before this one have already been claimed by placing their
156         position into the corresponding block description structure field,
157         that are part of the mv_blocks array.
158         - application - zeroes it on get_buffer().
159                         A successful ff_draw_horiz_band() may zero it together
160                         with start_mb_blocks_num.
161         - libavcodec  - each decoded macroblock increases it by the number
162                         of coded blocks it contains.
163     */
164     int             next_free_data_block_num;
165 };
166 
167 /**
168  * @}
169  */
170 
171 #endif /* AVCODEC_XVMC_H */
172