FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dxva2_internal.h
Go to the documentation of this file.
1 /*
2  * DXVA2 HW acceleration
3  *
4  * copyright (c) 2010 Laurent Aimar
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg 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  * FFmpeg 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 FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #ifndef AVCODEC_DXVA_INTERNAL_H
24 #define AVCODEC_DXVA_INTERNAL_H
25 
26 #define COBJMACROS
27 
28 #include "config.h"
29 
30 #if CONFIG_DXVA2
31 #include "dxva2.h"
32 #endif
33 #if CONFIG_D3D11VA
34 #include "d3d11va.h"
35 #endif
36 
37 #if HAVE_DXVA_H
38 #include <dxva.h>
39 #endif
40 
41 #include "avcodec.h"
42 #include "mpegvideo.h"
43 
44 typedef void DECODER_BUFFER_DESC;
45 
46 typedef union {
47 #if CONFIG_D3D11VA
48  struct AVD3D11VAContext d3d11va;
49 #endif
50 #if CONFIG_DXVA2
51  struct dxva_context dxva2;
52 #endif
54 
55 #if CONFIG_D3D11VA
56 #define D3D11VA_CONTEXT(ctx) (&ctx->d3d11va)
57 #endif
58 #if CONFIG_DXVA2
59 #define DXVA2_CONTEXT(ctx) (&ctx->dxva2)
60 #endif
61 
62 #if CONFIG_D3D11VA && CONFIG_DXVA2
63 #define DXVA_CONTEXT_WORKAROUND(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.workaround : ctx->dxva2.workaround)
64 #define DXVA_CONTEXT_COUNT(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.surface_count : ctx->dxva2.surface_count)
65 #define DXVA_CONTEXT_SURFACE(avctx, ctx, i) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.surface[i] : ctx->dxva2.surface[i])
66 #define DXVA_CONTEXT_DECODER(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.decoder : ctx->dxva2.decoder)
67 #define DXVA_CONTEXT_REPORT_ID(avctx, ctx) (*(avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? &ctx->d3d11va.report_id : &ctx->dxva2.report_id))
68 #define DXVA_CONTEXT_CFG(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg : ctx->dxva2.cfg)
69 #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg->ConfigBitstreamRaw : ctx->dxva2.cfg->ConfigBitstreamRaw)
70 #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg->ConfigIntraResidUnsigned : ctx->dxva2.cfg->ConfigIntraResidUnsigned)
71 #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD ? ctx->d3d11va.cfg->ConfigResidDiffAccelerator : ctx->dxva2.cfg->ConfigResidDiffAccelerator)
72 #elif CONFIG_DXVA2
73 #define DXVA_CONTEXT_WORKAROUND(avctx, ctx) (ctx->dxva2.workaround)
74 #define DXVA_CONTEXT_COUNT(avctx, ctx) (ctx->dxva2.surface_count)
75 #define DXVA_CONTEXT_SURFACE(avctx, ctx, i) (ctx->dxva2.surface[i])
76 #define DXVA_CONTEXT_DECODER(avctx, ctx) (ctx->dxva2.decoder)
77 #define DXVA_CONTEXT_REPORT_ID(avctx, ctx) (*(&ctx->dxva2.report_id))
78 #define DXVA_CONTEXT_CFG(avctx, ctx) (ctx->dxva2.cfg)
79 #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) (ctx->dxva2.cfg->ConfigBitstreamRaw)
80 #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (ctx->dxva2.cfg->ConfigIntraResidUnsigned)
81 #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (ctx->dxva2.cfg->ConfigResidDiffAccelerator)
82 #elif CONFIG_D3D11VA
83 #define DXVA_CONTEXT_WORKAROUND(avctx, ctx) (ctx->d3d11va.workaround)
84 #define DXVA_CONTEXT_COUNT(avctx, ctx) (ctx->d3d11va.surface_count)
85 #define DXVA_CONTEXT_SURFACE(avctx, ctx, i) (ctx->d3d11va.surface[i])
86 #define DXVA_CONTEXT_DECODER(avctx, ctx) (ctx->d3d11va.decoder)
87 #define DXVA_CONTEXT_REPORT_ID(avctx, ctx) (*(&ctx->d3d11va.report_id))
88 #define DXVA_CONTEXT_CFG(avctx, ctx) (ctx->d3d11va.cfg)
89 #define DXVA_CONTEXT_CFG_BITSTREAM(avctx, ctx) (ctx->d3d11va.cfg->ConfigBitstreamRaw)
90 #define DXVA_CONTEXT_CFG_INTRARESID(avctx, ctx) (ctx->d3d11va.cfg->ConfigIntraResidUnsigned)
91 #define DXVA_CONTEXT_CFG_RESIDACCEL(avctx, ctx) (ctx->d3d11va.cfg->ConfigResidDiffAccelerator)
92 #endif
93 
94 void *ff_dxva2_get_surface(const AVFrame *frame);
95 
96 unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx,
97  const AVDXVAContext *,
98  const AVFrame *frame);
99 
102  unsigned type, const void *data, unsigned size,
103  unsigned mb_count);
104 
105 
107  const void *pp, unsigned pp_size,
108  const void *qm, unsigned qm_size,
109  int (*commit_bs_si)(AVCodecContext *,
111  DECODER_BUFFER_DESC *slice));
112 
113 #endif /* AVCODEC_DXVA_INTERNAL_H */
This structure is used to provides the necessary configurations and data to the Direct3D11 FFmpeg HWA...
Definition: d3d11va.h:57
This structure describes decoded (raw) audio or video data.
Definition: frame.h:171
int ff_dxva2_commit_buffer(AVCodecContext *, AVDXVAContext *, DECODER_BUFFER_DESC *, unsigned type, const void *data, unsigned size, unsigned mb_count)
Definition: dxva2.c:53
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
mpegvideo header.
Public libavcodec D3D11VA header.
unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, const AVDXVAContext *, const AVFrame *frame)
Definition: dxva2.c:38
int ff_dxva2_common_end_frame(AVCodecContext *, AVFrame *, const void *pp, unsigned pp_size, const void *qm, unsigned qm_size, int(*commit_bs_si)(AVCodecContext *, DECODER_BUFFER_DESC *bs, DECODER_BUFFER_DESC *slice))
Definition: dxva2.c:126
static AVFrame * frame
void * ff_dxva2_get_surface(const AVFrame *frame)
Definition: dxva2.c:33
ptrdiff_t size
Definition: opengl_enc.c:101
Libavcodec external API header.
Public libavcodec DXVA2 header.
main external API structure.
Definition: avcodec.h:1241
GLint GLenum type
Definition: opengl_enc.c:105
void DECODER_BUFFER_DESC
This structure is used to provides the necessary configurations and data to the DXVA2 FFmpeg HWAccel ...
Definition: dxva2.h:57