You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
3.5KB

  1. /*
  2. * DXVA2 HW acceleration
  3. *
  4. * copyright (c) 2010 Laurent Aimar
  5. *
  6. * This file is part of Libav.
  7. *
  8. * Libav is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * Libav is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with Libav; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #ifndef AVCODEC_DXVA_INTERNAL_H
  23. #define AVCODEC_DXVA_INTERNAL_H
  24. #define COBJMACROS
  25. #include "config.h"
  26. #include "dxva2.h"
  27. #include "d3d11va.h"
  28. #if HAVE_DXVA_H
  29. #include <dxva.h>
  30. #endif
  31. #include "avcodec.h"
  32. #include "mpegvideo.h"
  33. typedef void DECODER_BUFFER_DESC;
  34. typedef union {
  35. struct AVD3D11VAContext d3d11va;
  36. struct dxva_context dxva2;
  37. } AVDXVAContext;
  38. #define D3D11VA_CONTEXT(ctx) (&ctx->d3d11va)
  39. #define DXVA2_CONTEXT(ctx) (&ctx->dxva2)
  40. #define DXVA_CONTEXT_WORKAROUND(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.workaround : ctx->dxva2.workaround)
  41. #define DXVA_CONTEXT_COUNT(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.surface_count : ctx->dxva2.surface_count)
  42. #define DXVA_CONTEXT_SURFACE(avctx, ctx, i) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.surface[i] : ctx->dxva2.surface[i])
  43. #define DXVA_CONTEXT_DECODER(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.decoder : ctx->dxva2.decoder)
  44. #define DXVA_CONTEXT_REPORT_ID(avctx, ctx) (*(avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? &ctx->d3d11va.report_id : &ctx->dxva2.report_id))
  45. #define DXVA_CONTEXT_CFG(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg : ctx->dxva2.cfg)
  46. #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg->ConfigBitstreamRaw : ctx->dxva2.cfg->ConfigBitstreamRaw)
  47. #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg->ConfigIntraResidUnsigned : ctx->dxva2.cfg->ConfigIntraResidUnsigned)
  48. #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg->ConfigResidDiffAccelerator : ctx->dxva2.cfg->ConfigResidDiffAccelerator)
  49. void *ff_dxva2_get_surface(const AVFrame *frame);
  50. unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx,
  51. const AVDXVAContext *,
  52. const AVFrame *frame);
  53. int ff_dxva2_commit_buffer(AVCodecContext *, AVDXVAContext *,
  54. DECODER_BUFFER_DESC *,
  55. unsigned type, const void *data, unsigned size,
  56. unsigned mb_count);
  57. int ff_dxva2_common_end_frame(AVCodecContext *, AVFrame *,
  58. const void *pp, unsigned pp_size,
  59. const void *qm, unsigned qm_size,
  60. int (*commit_bs_si)(AVCodecContext *,
  61. DECODER_BUFFER_DESC *bs,
  62. DECODER_BUFFER_DESC *slice));
  63. #endif /* AVCODEC_DXVA_INTERNAL_H */