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 */ 74 int allocated_mv_blocks; 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 */ 80 int allocated_data_blocks; 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; 103 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; 112 113 /** Pointer to the surface used as future reference 114 - application - unchanged 115 - libavcodec - set 116 */ 117 XvMCSurface* p_future_surface; 118 119 /** top/bottom field or frame 120 - application - unchanged 121 - libavcodec - set 122 */ 123 unsigned int picture_structure; 124 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 */ 139 int start_mv_blocks_num; 140 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 */ 148 int filled_mv_blocks_num; 149 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 */ 161 int next_free_data_block_num; 162 }; 163 164 /** 165 * @} 166 */ 167 168 #endif /* AVCODEC_XVMC_H */ 169