aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Lhomme <robux4@gmail.com>2017-01-13 14:01:06 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-01-16 02:54:04 +0100
commit153b36fc62849e0e1540a43829794e0503994ebb (patch)
treeed4d8132520f32dfd7ad518361b7a7fcaeb31b22
parent77742c75c5503c848447814a96f16abc6b9aa5f4 (diff)
downloadffmpeg-153b36fc62849e0e1540a43829794e0503994ebb.tar.gz
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: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/dxva2.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index 2ac3f3e6cb..c782f1cdc3 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -41,20 +41,19 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx,
void *surface = get_surface(frame);
unsigned i;
- for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) {
#if CONFIG_D3D11VA
- if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD && ctx->d3d11va.surface[i] == surface)
- {
- D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
- ID3D11VideoDecoderOutputView_GetDesc(ctx->d3d11va.surface[i], &viewDesc);
- return viewDesc.Texture2D.ArraySlice;
- }
+ if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
+ D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
+ ID3D11VideoDecoderOutputView_GetDesc((ID3D11VideoDecoderOutputView*) surface, &viewDesc);
+ return viewDesc.Texture2D.ArraySlice;
+ }
#endif
#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)
return i;
-#endif
}
+#endif
assert(0);
return 0;