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