From patchwork Sun Nov 20 22:35:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Langdale X-Patchwork-Id: 1502 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp1278392vsb; Sun, 20 Nov 2016 14:36:22 -0800 (PST) X-Received: by 10.195.30.165 with SMTP id kf5mr6896111wjd.41.1479681382043; Sun, 20 Nov 2016 14:36:22 -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 jo7si17059055wjb.157.2016.11.20.14.36.21; Sun, 20 Nov 2016 14:36:22 -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 C902168A06F; Mon, 21 Nov 2016 00:36:05 +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 3A8C8689D09 for ; Mon, 21 Nov 2016 00:35:57 +0200 (EET) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=overt.org; q=dns/txt; s=k1; t=1479681358; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=dfapco3bTXhuxe1SEeMjY7fM/w1jICtO6h2bWQS+VjE=; b=DIVUzWjbcX/wpmzrqmrSvZwxIPeQTsxQqSh52c2/3OUiwffWgn3TjX1A9AJmI19ZhtMvD6H0 x8SllW0loA9cWv3MjdUQ5qEtqBU2XS8oBib80FBFuRxzylKMT45Z2CeZQWnFWvQrVXINK5D9 ayIiFqxKYpHHY3gwqMGGT4jnObA= 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=sH/HGRabNgsm4ziFj9e/gnsKK/Ksr2Bcw8riDZ3YkhpUrZKcccEFdnygyzklI8r1c4fzmt VNyjr0fJRCY1qp9pFi+48Cp99OQWVSLCnIsg9M1qyWMdeZ21dJNHxNyxmysSgVFohkm0++ri bRCIH6mjKGrqBFv+UyPydbZxCnYpg= 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 5832254e.7f056d1c69d0-smtp-out-n02; Sun, 20 Nov 2016 22:35:58 -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 A6027681A3; Sun, 20 Nov 2016 22:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1479681357; bh=LUsfz28Jd0B5r9E7BWbZOfpA/XJFYY5jCuI75fd3qBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SgSzG0p3oQWmzTta5BiZLyJG49DgJ5jdQMCr+FmPA07LI4voV2RthPvKlBrHGrk52 Tk4h3Y670jci859P1ecv5JZy1begIv5aZXTcnnsthrvfzgJRyeCKkrMfamHVHJcv6w 24s7quEuvenrmeloiDEm/yK0DYY1Ndm3ICSQ8l2G8wl8RKtOoOhpbIVps2oiSf0h79 p6yhmt6+gXz0fO3P2gM02AJm2w1RVxbCsfH4k5fDR20i9YnodhIPAUG70F0GT6WHdh d+NfZG4hgDp+xpWrE9bfu9If4HdcqNDZOs9b1QWpV+X9y9+P1Ai1etQFinE0QR7aqR sEnG4HceJvC5g== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Sun, 20 Nov 2016 14:35:52 -0800 Message-Id: <20161120223552.16375-3-philipl@overt.org> In-Reply-To: <20161120223552.16375-1-philipl@overt.org> References: <20161120223552.16375-1-philipl@overt.org> Subject: [FFmpeg-devel] [PATCH 2/2] swscale: add P016 input support 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" Signed-off-by: Philip Langdale --- libswscale/input.c | 32 ++++++++++++++++++++++++++++++++ libswscale/utils.c | 2 ++ 2 files changed, 34 insertions(+) diff --git a/libswscale/input.c b/libswscale/input.c index 1f4ea18..8b5f348 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -719,6 +719,28 @@ static void p010BEToUV_c(uint8_t *dstU, uint8_t *dstV, } } +static void p016LEToUV_c(uint8_t *dstU, uint8_t *dstV, + const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, + int width, uint32_t *unused) +{ + int i; + for (i = 0; i < width; i++) { + AV_WN16(dstU + i * 2, AV_RL16(src1 + i * 4 + 0)); + AV_WN16(dstV + i * 2, AV_RL16(src1 + i * 4 + 2)); + } +} + +static void p016BEToUV_c(uint8_t *dstU, uint8_t *dstV, + const uint8_t *unused0, const uint8_t *src1, const uint8_t *src2, + int width, uint32_t *unused) +{ + int i; + for (i = 0; i < width; i++) { + AV_WN16(dstU + i * 2, AV_RB16(src1 + i * 4 + 0)); + AV_WN16(dstV + i * 2, AV_RB16(src1 + i * 4 + 2)); + } +} + #define input_pixel(pos) (isBE(origin) ? AV_RB16(pos) : AV_RL16(pos)) static void bgr24ToY_c(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1, const uint8_t *unused2, @@ -1085,6 +1107,12 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_P010BE: c->chrToYV12 = p010BEToUV_c; break; + case AV_PIX_FMT_P016LE: + c->chrToYV12 = p016LEToUV_c; + break; + case AV_PIX_FMT_P016BE: + c->chrToYV12 = p016BEToUV_c; + break; } if (c->chrSrcHSubSample) { switch (srcFormat) { @@ -1326,6 +1354,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_GRAY10LE: case AV_PIX_FMT_GRAY12LE: case AV_PIX_FMT_GRAY16LE: + + case AV_PIX_FMT_P016LE: c->lumToYV12 = bswap16Y_c; break; case AV_PIX_FMT_YUVA444P9LE: @@ -1362,6 +1392,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_GRAY10BE: case AV_PIX_FMT_GRAY12BE: case AV_PIX_FMT_GRAY16BE: + + case AV_PIX_FMT_P016BE: c->lumToYV12 = bswap16Y_c; break; case AV_PIX_FMT_YUVA444P9BE: diff --git a/libswscale/utils.c b/libswscale/utils.c index 15cc56d..88a22bd 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -252,6 +252,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_AYUV64LE] = { 1, 1}, [AV_PIX_FMT_P010LE] = { 1, 1 }, [AV_PIX_FMT_P010BE] = { 1, 1 }, + [AV_PIX_FMT_P016LE] = { 1, 0 }, + [AV_PIX_FMT_P016BE] = { 1, 0 }, }; int sws_isSupportedInput(enum AVPixelFormat pix_fmt)