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