[vlc-commits] d3d11va: only store the ID3D11VideoDecoderOutputView in the decoder picture_sys
Steve Lhomme
git at videolan.org
Wed Oct 23 15:37:44 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jul 8 14:34:00 2019 +0200| [6bf69a6819947cb3fcaf7f0c955fc7632d5443bc] | committer: Steve Lhomme
d3d11va: only store the ID3D11VideoDecoderOutputView in the decoder picture_sys
The other D3D11 picture_sys don't need to know about it.
We only need to keep it
+avoid a goto and remove duplicate variable set
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6bf69a6819947cb3fcaf7f0c955fc7632d5443bc
---
modules/codec/avcodec/d3d11va.c | 7 +------
modules/hw/d3d11/d3d11_surface.c | 21 ++-------------------
modules/video_chroma/d3d11_fmt.c | 4 ----
modules/video_chroma/d3d11_fmt.h | 1 -
4 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 2188fa5d44..a157c4c1e1 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -167,7 +167,6 @@ static picture_context_t *d3d11va_pic_context_copy(picture_context_t *ctx)
}
static struct d3d11va_pic_context *CreatePicContext(
- ID3D11VideoDecoderOutputView *decoderSurface,
ID3D11Resource *p_resource,
ID3D11DeviceContext *context,
UINT slice,
@@ -175,7 +174,7 @@ static struct d3d11va_pic_context *CreatePicContext(
{
struct d3d11va_pic_context *pic_ctx = calloc(1, sizeof(*pic_ctx));
if (unlikely(pic_ctx==NULL))
- goto done;
+ return NULL;
pic_ctx->ctx.s = (picture_context_t) {
d3d11va_pic_context_destroy, d3d11va_pic_context_copy,
};
@@ -186,15 +185,12 @@ static struct d3d11va_pic_context *CreatePicContext(
pic_ctx->ctx.picsys.formatTexture = txDesc.Format;
pic_ctx->ctx.picsys.context = context;
pic_ctx->ctx.picsys.slice_index = slice;
- pic_ctx->ctx.picsys.decoder = decoderSurface;
for (int i=0;i<D3D11_MAX_SHADER_VIEW; i++)
{
pic_ctx->ctx.picsys.resource[i] = p_resource;
pic_ctx->ctx.picsys.renderSrc[i] = renderSrc[i];
}
AcquireD3D11PictureSys(&pic_ctx->ctx.picsys);
- pic_ctx->ctx.picsys.context = context;
-done:
return pic_ctx;
}
@@ -213,7 +209,6 @@ static picture_context_t* NewSurfacePicContext(vlc_va_t *va, vlc_va_surface_t *v
resourceView[i] = sys->renderSrc[viewDesc.Texture2D.ArraySlice*D3D11_MAX_SHADER_VIEW + i];
struct d3d11va_pic_context *pic_ctx = CreatePicContext(
- surface,
p_resource,
sys->d3d_dev.d3dcontext,
viewDesc.Texture2D.ArraySlice,
diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index 5fb048ed14..3989a0a37b 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -247,22 +247,13 @@ static void D3D11_YUY2(filter_t *p_filter, picture_t *src, picture_t *dst)
return;
}
- UINT srcSlice;
- D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
- if (p_sys->decoder)
- {
- ID3D11VideoDecoderOutputView_GetDesc( p_sys->decoder, &viewDesc );
- srcSlice = viewDesc.Texture2D.ArraySlice;
- }
- else
- srcSlice = 0;
+ UINT srcSlice = p_sys->slice_index;
ID3D11Resource *srcResource = p_sys->resource[KNOWN_DXGI_INDEX];
#if CAN_PROCESSOR
if (sys->d3d_proc.procEnumerator)
{
HRESULT hr;
- assert(p_sys->slice_index == viewDesc.Texture2D.ArraySlice);
if (FAILED( D3D11_Assert_ProcessorInput(p_filter, &sys->d3d_proc, p_sys) ))
return;
@@ -376,15 +367,7 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
return;
}
- UINT srcSlice;
- if (!p_sys->decoder)
- srcSlice = p_sys->slice_index;
- else
- {
- D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
- ID3D11VideoDecoderOutputView_GetDesc( p_sys->decoder, &viewDesc );
- srcSlice = viewDesc.Texture2D.ArraySlice;
- }
+ UINT srcSlice = p_sys->slice_index;
ID3D11Resource *srcResource = p_sys->resource[KNOWN_DXGI_INDEX];
#if CAN_PROCESSOR
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index e171a44ec9..77156f509b 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -60,8 +60,6 @@ void AcquireD3D11PictureSys(picture_sys_d3d11_t *p_sys)
}
if (p_sys->context)
ID3D11DeviceContext_AddRef(p_sys->context);
- if (p_sys->decoder)
- ID3D11VideoDecoderOutputView_AddRef(p_sys->decoder);
if (p_sys->processorInput)
ID3D11VideoProcessorInputView_AddRef(p_sys->processorInput);
if (p_sys->processorOutput)
@@ -78,8 +76,6 @@ void ReleaseD3D11PictureSys(picture_sys_d3d11_t *p_sys)
}
if (p_sys->context)
ID3D11DeviceContext_Release(p_sys->context);
- if (p_sys->decoder)
- ID3D11VideoDecoderOutputView_Release(p_sys->decoder);
if (p_sys->processorInput)
ID3D11VideoProcessorInputView_Release(p_sys->processorInput);
if (p_sys->processorOutput)
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index 048436fe76..b7452a2287 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -68,7 +68,6 @@ typedef struct
/* owned by the vout for VLC_CODEC_D3D11_OPAQUE */
typedef struct
{
- ID3D11VideoDecoderOutputView *decoder; /* may be NULL for pictures from the pool */
union {
ID3D11Texture2D *texture[D3D11_MAX_SHADER_VIEW];
ID3D11Resource *resource[D3D11_MAX_SHADER_VIEW];
More information about the vlc-commits
mailing list