From patchwork Sat Nov 11 16:38:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 5937 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp284296jah; Sat, 11 Nov 2017 08:39:15 -0800 (PST) X-Google-Smtp-Source: AGs4zMabiqMaemegkBkfg3HmrX6khecFpxz5X1FxJ2BF2d/fbCai1Dm9Jb784yLjR7Bpy/zZSao1 X-Received: by 10.223.134.75 with SMTP id 11mr3359156wrw.37.1510418355131; Sat, 11 Nov 2017 08:39:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510418355; cv=none; d=google.com; s=arc-20160816; b=df7zsCI2pGN5HMcjRpKu7OWMluz0x/Ms+Qzj6BJ5Qb3vpuZPfv9aw4BugstFFlon9f 9RAzupOj3237m1TD+CHsRkkTdqRkC6Ocp1IyvrAzjllt6dRE+z7L/PXlwduDAUsXCCHG nKZUtWXC774GD3HArMFr/o3q4bpJe8AJNFatlFXyNJu/DMdgLR3tv76/c7X4TS4H/gvz a7khUwocR+SDih1ZofizSNOPVJfJIEnP3tGxhybNQGBa7lpL+5g3gAZyJ3h9mQ4zx6M4 thDpIQaiPX81dIA9PXGN9H2b9VqvMnx02wQfb3ZYusO95YsExjOfKAgsgowViwtqzU4W ltQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=Q63qdn3pPdWoX6hJqjRQAugafVlyPZQISFYFKFWsq8w=; b=zKG+TUsEGwLO3e9xFbxMmCnmg+J1XTdftchszGMqARmz7tl8VZJVNSt+/7/O5dHopd efWaMabudoaJcTqijAI52KAZ5WeGYpxZEfrbR1Et3e053vp6GNisPrgvKT/b2PmS/rPl ID7sKapltGikb+JeQQbr62cn0QZKVtLk/3T96VpVuYrq6gEFA/x6Xqxo7s9inkmXTUrN /J88d/q3KAMJw+nePB/un7vpgQni8jOxpeqkGRaWRWy/KJO8IpudDUfQIbZtFvz4dUoQ Hq8SMhcUBiaN2/S0pobN2ErxMRZve2eS0Wr+okLKXbTJ9yYe+aRB8KsBzhw0SipTcfHs Kiiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=BHPR4POS; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z66si3289041wmb.113.2017.11.11.08.39.14; Sat, 11 Nov 2017 08:39:15 -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; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=BHPR4POS; 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 773C3689C9C; Sat, 11 Nov 2017 18:38:59 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 81EF0689B96 for ; Sat, 11 Nov 2017 18:38:53 +0200 (EET) Received: from localhost.localdomain (unknown [IPv6:2a02:8109:43f:959c:ba97:5aff:fe10:ec69]) by btbn.de (Postfix) with ESMTPSA id B111A5F35F; Sat, 11 Nov 2017 17:39:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1510418346; bh=8cq1Wj6fYeolJ1ZZNRFfywimy63LOPXQYnVtKcrns18=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BHPR4POSf6JHXXI59mlOk7b9kdYn2lTjaKwYakXx4W8nUUWFJPN1SldYpB8YcQEMr 9az8JR79P+BiAvOHJMLDTF0VSxLIRGU7j4ZNLDq/Mh+Azm24gP/NhK5zyelFPY0WWY VPnG8JQhpk6WV85aNGcUB7eKex7uWMGD/kHVx57U= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 Nov 2017 17:38:59 +0100 Message-Id: <20171111163859.15122-1-timo@rothenpieler.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <42c621b2-8ad4-9b10-891d-77492ce48333@gmail.com> References: <42c621b2-8ad4-9b10-891d-77492ce48333@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/nvdec: correctly set output frame size 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: Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/nvdec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index db338accfa..894112a144 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -232,8 +232,8 @@ int ff_nvdec_decode_init(AVCodecContext *avctx, unsigned int dpb_size) frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; frames_ctx->format = AV_PIX_FMT_CUDA; - frames_ctx->width = avctx->coded_width; - frames_ctx->height = avctx->coded_height; + frames_ctx->width = (avctx->width + 1) & ~1; + frames_ctx->height = (avctx->height + 1) & ~1; frames_ctx->sw_format = AV_PIX_FMT_NV12; frames_ctx->sw_format = sw_desc->comp[0].depth > 8 ? AV_PIX_FMT_P010 : AV_PIX_FMT_NV12; @@ -249,8 +249,9 @@ int ff_nvdec_decode_init(AVCodecContext *avctx, unsigned int dpb_size) params.ulWidth = avctx->coded_width; params.ulHeight = avctx->coded_height; - params.ulTargetWidth = avctx->coded_width; - params.ulTargetHeight = avctx->coded_height; + params.display_area.top = params.display_area.left = 0; + params.ulTargetWidth = params.display_area.right = frames_ctx->width; + params.ulTargetHeight = params.display_area.bottom = frames_ctx->height; params.bitDepthMinus8 = sw_desc->comp[0].depth - 8; params.OutputFormat = params.bitDepthMinus8 ? cudaVideoSurfaceFormat_P016 : cudaVideoSurfaceFormat_NV12;