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