From patchwork Mon Nov 21 15:28:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 1514 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp1660223vsb; Mon, 21 Nov 2016 07:28:44 -0800 (PST) X-Received: by 10.28.188.87 with SMTP id m84mr15110850wmf.14.1479742124598; Mon, 21 Nov 2016 07:28:44 -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 n4si7977686wmn.72.2016.11.21.07.28.44; Mon, 21 Nov 2016 07:28:44 -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=@overt.org; dkim=neutral (body hash did not verify) header.i=@overt.org; 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 82EDD689B06; Mon, 21 Nov 2016 17:28:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from so254-29.mailgun.net (so254-29.mailgun.net [198.61.254.29]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B8B08689BD5 for ; Mon, 21 Nov 2016 17:28:15 +0200 (EET) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=overt.org; q=dns/txt; s=k1; t=1479742097; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=QyT5YcU9n0wCUusmGqV2bKY68UgVQgsk/hT9cdgQWTU=; b=Nn2ADIKoa5LSIdfu1gxTPsCdreg7UQHiHbZezF5bJ4dIFxILGWcIVjVVAyHKO1HPin5ddzlD DqbDhK2yOigyJhrhifvQEd5KL9u6/hXmXUHI+yqZgvUpQDsPBDd/M3yQa2QSc9YJmoOPkrDW CJMs1occh3bF9XY5nok1wu+ZTcs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=overt.org; s=k1; q=dns; h=Sender: From: To: Cc: Subject: Date: Message-Id: In-Reply-To: References; b=VmDPUiH6fVC4ZOAv+3B1qYaNo0+9Rm8pBpySQitu7cA30wj/+yTbafAeZ3brM4TVzCcOHq tt5gb5GEpIFUVpPUpS5LnN/An69QotgSu5TyrGMJXc3hMhTz/urtohJT39QiObj96OOk8S4K 4SNkfpUVV9Izf/7tPytoj7AGF+r64= X-Mailgun-Sending-Ip: 198.61.254.29 X-Mailgun-Sid: WyIyM2Q3MCIsICJmZm1wZWctZGV2ZWxAZmZtcGVnLm9yZyIsICI0YTg5NjEiXQ== Received: from mail.overt.org (155.208.178.107.bc.googleusercontent.com [107.178.208.155]) by mxa.mailgun.org with ESMTP id 5833128d.7ff2286f1458-smtp-out-n02; Mon, 21 Nov 2016 15:28:13 -0000 (UTC) Received: from authenticated-user (mail.overt.org [107.178.208.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id F06D1681A3; Mon, 21 Nov 2016 15:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1479742092; bh=L57Axr8KoOK6c2x6ocZrbpjQqCvO8gElO2z95KsDxVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X7+VhokVBoJv4LHqRjD8rS/J092XuGULBUvtzU3g8GVGR+nSJhqkh/NWsXOb1OBMU nHlIjMrxsvtzLZY5Dk++fjl+tSgME5vhyrOz0702EMa+JIubmP/xWd2jkZulzpFCWU DboF/yufjEQt7MsVDru6x4CtoHNF0vYhhtRbAwIWP+89hhKLpS4JcYru3GNT9BWjxu SHX5ElGAO/k1A3XaXyZuwoCZMPIXNI8x2qLV2qTCE98ePIO0/w5bgUd81ufjiMohUk 5pO/0Dexyl3clkMrW7p6OI/ufwlJO5T0ytuTomNhvKjEMGWkb1Cmil5kYlRFcioQOc 7KXOFYqhCU/MA== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Nov 2016 07:28:04 -0800 Message-Id: <20161121152804.5605-3-philipl@overt.org> In-Reply-To: <20161121152804.5605-1-philipl@overt.org> References: <20161121152804.5605-1-philipl@overt.org> Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/nvenc: Accept P016 content 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: Philip Langdale MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" nvenc doesn't officially support P016 input, but at the same time, cuvid only outputs P016, technically (it uses the same format for both 10 and 12 bit output). As it's safe to pass P016 when P010 is expected, let's just allow it; it's wasteful to force content through swscale. After this change, both cuvid and nvenc support P016, but the ffmpeg_cuvid transcoding logic will need more work to connect the two together. Similarly, the scale_npp filter still only works with 8bit surfaces. Signed-off-by: Philip Langdale --- libavcodec/nvenc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index d71a445..ba8fdfd 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -39,6 +39,7 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NV12, AV_PIX_FMT_P010, + AV_PIX_FMT_P016, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P16, AV_PIX_FMT_0RGB32, @@ -48,6 +49,7 @@ const enum AVPixelFormat ff_nvenc_pix_fmts[] = { }; #define IS_10BIT(pix_fmt) (pix_fmt == AV_PIX_FMT_P010 || \ + pix_fmt == AV_PIX_FMT_P016 || \ pix_fmt == AV_PIX_FMT_YUV444P16) #define IS_YUV444(pix_fmt) (pix_fmt == AV_PIX_FMT_YUV444P || \ @@ -1018,6 +1020,7 @@ static av_cold int nvenc_alloc_surface(AVCodecContext *avctx, int idx) break; case AV_PIX_FMT_P010: + case AV_PIX_FMT_P016: ctx->surfaces[idx].format = NV_ENC_BUFFER_FORMAT_YUV420_10BIT; break;