From patchwork Thu Dec 1 14:10:08 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: 1630 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.86 with SMTP id o83csp962247vsa; Thu, 1 Dec 2016 06:25:21 -0800 (PST) X-Received: by 10.194.37.6 with SMTP id u6mr38202645wjj.20.1480602320915; Thu, 01 Dec 2016 06:25:20 -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 b188si841950wme.154.2016.12.01.06.25.20; Thu, 01 Dec 2016 06:25:20 -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 157D8689DF7; Thu, 1 Dec 2016 16:25:11 +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 07011689D77 for ; Thu, 1 Dec 2016 16:25:04 +0200 (EET) Received: by mail-wj0-f195.google.com with SMTP id he10so12337724wjc.2 for ; Thu, 01 Dec 2016 06:25:12 -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:subject:date:message-id:in-reply-to :references; bh=6g8x6wLEtcAdbCSlwtryetM1IccEC6v1nkePR0rF4T8=; b=F6xY0ZMxJhesKRcU+PizI0VkiaL8Utd1W52P80MU3ApOG6QmxA8Jq8diwjeR8mudlm foQxJ7RP4h+TTkZqVjPUT3nQqy/aI6/yMW7PbfB4nqJnsFFRSgenmSh8cXtcgaXbtaup xquWQdjty9vVq0qIxiXuR04QBIvc/239ICUNby9QIXOoWaPcVyjlvYcLA6sRmJPnxLZW CLgf0/fUfF8KLvopHqdL+yDarAnLBN1sC1JtEkiFT3TXqiPAlju2L5QrX3m34F0FNBUo ruWOsy+OU6emr5QG8gOhY0/z1aCfZDVe7FcfKdrPZbkyIlLsz8MaLuqO6/7om/n7sme7 48uQ== X-Gm-Message-State: AKaTC03ErL5a8dBUh09KhOlkGIzYfZAEWcZJj1uu9wFvGZBMsKK4jxbFohIeUAJvMPp8DA== X-Received: by 10.194.246.170 with SMTP id xx10mr14154025wjc.174.1480601418105; Thu, 01 Dec 2016 06:10:18 -0800 (PST) Received: from localhost.localdomain (2a01cb0c000ea900bd66332c9cef1b23.ipv6.abo.wanadoo.fr. [2a01:cb0c:e:a900:bd66:332c:9cef:1b23]) by smtp.gmail.com with ESMTPSA id l6sm1123793wmd.5.2016.12.01.06.10.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Dec 2016 06:10:17 -0800 (PST) From: Steve Lhomme To: ffmpeg-devel@ffmpeg.org Date: Thu, 1 Dec 2016 15:10:08 +0100 Message-Id: <20161201141008.472-2-robux4@videolabs.io> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161201141008.472-1-robux4@videolabs.io> References: <20161201141008.472-1-robux4@videolabs.io> Subject: [FFmpeg-devel] [PATCH 2/2] 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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;