xvmc.h 5.9 KB

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