dxva2: get the slice number directly from the surface in D3D11VA

No need to loop through the known surfaces, we'll use the requested surface
anyway.

The loop is only done for DXVA2.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Steve Lhomme 2017-01-04 13:44:12 +01:00 committed by Anton Khirnov
parent 122de16dd8
commit f67235a28c
1 changed files with 7 additions and 7 deletions

View File

@ -41,19 +41,19 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx,
void *surface = get_surface(frame); void *surface = get_surface(frame);
unsigned i; unsigned i;
for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) {
#if CONFIG_D3D11VA #if CONFIG_D3D11VA
if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD && ctx->d3d11va.surface[i] == surface) { if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc; D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
ID3D11VideoDecoderOutputView_GetDesc(ctx->d3d11va.surface[i], &viewDesc); ID3D11VideoDecoderOutputView_GetDesc((ID3D11VideoDecoderOutputView*) surface, &viewDesc);
return viewDesc.Texture2D.ArraySlice; return viewDesc.Texture2D.ArraySlice;
} }
#endif #endif
#if CONFIG_DXVA2 #if CONFIG_DXVA2
for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) {
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD && ctx->dxva2.surface[i] == surface) if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD && ctx->dxva2.surface[i] == surface)
return i; return i;
#endif
} }
#endif
assert(0); assert(0);
return 0; return 0;