From patchwork Thu Dec 1 16:22:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?St=C3=A8ve_Lhomme?= X-Patchwork-Id: 1633 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.86 with SMTP id o83csp1025238vsa; Thu, 1 Dec 2016 08:23:04 -0800 (PST) X-Received: by 10.28.236.83 with SMTP id k80mr32717620wmh.0.1480609384752; Thu, 01 Dec 2016 08:23:04 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g204si1290418wmf.34.2016.12.01.08.23.04; Thu, 01 Dec 2016 08:23:04 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 45C2B689E53; Thu, 1 Dec 2016 18:22:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wj0-f195.google.com (mail-wj0-f195.google.com [209.85.210.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9F4B2689D9E for ; Thu, 1 Dec 2016 18:22:31 +0200 (EET) Received: by mail-wj0-f195.google.com with SMTP id kp2so27000159wjc.0 for ; Thu, 01 Dec 2016 08:22:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8Bsyd5xo0KnNyTjPJVzN1z4i66xzcx+5YenD82SZ+Rc=; b=j7FU4PiWsYb4UVac27W4l5WxSmbBmVCdyCvCxL2tdfzZbaITvfKcxTANNQx/k/lbXJ mBurGs7j+mNeBPpBlgB/djCJDcyOVWd3F01Hsx6qFbtDo/n0yQGK+VdF5Q3fj5QrFg6r xXGowR78uRL1nzuipt988f1HqH94PlAybMHtLE/geuSfCb+q0L6q/e2bvC+aHw2KtTml HtRWStZ9im1S6Bv2lG2DYPZdAP4qynX4Vu/VquWvIKQHFNhZ6zafYgQyXBaIeUuRDTWn iBaArS9dEiDKHr0MSYz66iH4LYTnro52wlyB50gp6P3hWEZ7L9f4+um8yJXyHVv/Gdm0 mtxQ== X-Gm-Message-State: AKaTC02dbjObnDIMwxPr7IqLOkBlxtmmFoj19g3lyGCs7rYw399re9QmS+6RdAWSuV0jug== X-Received: by 10.194.103.100 with SMTP id fv4mr34322946wjb.102.1480609358894; Thu, 01 Dec 2016 08:22:38 -0800 (PST) Received: from localhost.localdomain (2a01cb0c000ea90021f51a7b7fa51aff.ipv6.abo.wanadoo.fr. [2a01:cb0c:e:a900:21f5:1a7b:7fa5:1aff]) by smtp.gmail.com with ESMTPSA id yj10sm1066807wjb.3.2016.12.01.08.22.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Dec 2016 08:22:37 -0800 (PST) From: Steve Lhomme To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Dec 2016 17:22:27 +0100 Message-Id: <20161201162228.3524-3-robux4@videolabs.io> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161201162228.3524-1-robux4@videolabs.io> References: <20161201162228.3524-1-robux4@videolabs.io> Subject: [FFmpeg-devel] [PATCH 3/4] dxva2: get the slice number directly from the surface in D3D11VA X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steve Lhomme MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Steve Lhomme No need to loop through the known surfaces, we'll use it anyway. The loop is only done for DXVA2 --- libavcodec/dxva2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c index a64b1b5..459e267 100644 --- a/libavcodec/dxva2.c +++ b/libavcodec/dxva2.c @@ -41,20 +41,20 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx, void *surface = ff_dxva2_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;