From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 068E4442D6 for ; Mon, 5 Sep 2022 05:15:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5EB8B68B9B3; Mon, 5 Sep 2022 08:14:54 +0300 (EEST) Received: from mail.overt.org (mail.overt.org [157.230.92.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3CA7D68B6F0 for ; Mon, 5 Sep 2022 08:14:46 +0300 (EEST) Received: from authenticated-user (mail.overt.org [157.230.92.47]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id C61D13F7FE; Mon, 5 Sep 2022 00:14:44 -0500 (CDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=overt.org; s=mail; t=1662354885; bh=aiwUwU5pjfJK///kyLOyN9gyA2xGkelJsZxvUhClXxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cTq0qJsNsbjTnpPriOU08Qxm5r9povVIFerSQK0uSwMpLXKWW4uNeKXNr01W2d96y uhzqebKlXHaeB0n/2PyCaDmeYERcRFwWRApYJgMHh3TF802rSyECc0N3NyYbxb9f/Y JIWAxHNDdoKh6qIHEaUljUy15uu7GO8tLaKaNGDu1e5/+4SNJ/cpJ3YGHW8tJUlN0a AHxYXLQKdcoQUDKvlBuEWlkYxp/+IZ5Hp3A64BhbhKQufKyHNysUy6IRxCjgL3iRkm q4wwtDdBscPu/17tnq7gG/afprVVla3Dpj9LaVknMkakFEIvHUAnQBxLBl5l9a+DzG 9dBwYBIyFgbMA== From: Philip Langdale To: ffmpeg-devel@ffmpeg.org Date: Sun, 4 Sep 2022 22:14:30 -0700 Message-Id: <20220905051430.218289-5-philipl@overt.org> In-Reply-To: <20220905051430.218289-1-philipl@overt.org> References: <20220905051430.218289-1-philipl@overt.org> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] swscale/input: add support for Y212LE X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: Philip Langdale --- libswscale/input.c | 45 ++++++++++++++++++++++++++++++--------------- libswscale/utils.c | 1 + 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/libswscale/input.c b/libswscale/input.c index f4f08c8f72..be8f3940e1 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -559,23 +559,32 @@ static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, con av_assert1(src1 == src2); } -static void y210le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src, - const uint8_t *unused1, int width, uint32_t *unused2, void *opq) -{ - int i; - for (i = 0; i < width; i++) { - AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> 6); - AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> 6); +#define y21xle_wrapper(bits, shift) \ + static void y2 ## bits ## le_UV_c(uint8_t *dstU, uint8_t *dstV, \ + const uint8_t *unused0, \ + const uint8_t *src, \ + const uint8_t *unused1, int width, \ + uint32_t *unused2, void *opq) \ + { \ + int i; \ + for (i = 0; i < width; i++) { \ + AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> shift); \ + AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> shift); \ + } \ + } \ + \ + static void y2 ## bits ## le_Y_c(uint8_t *dst, const uint8_t *src, \ + const uint8_t *unused0, \ + const uint8_t *unused1, int width, \ + uint32_t *unused2, void *opq) \ + { \ + int i; \ + for (i = 0; i < width; i++) \ + AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> shift); \ } -} -static void y210le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0, - const uint8_t *unused1, int width, uint32_t *unused2, void *opq) -{ - int i; - for (i = 0; i < width; i++) - AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> 6); -} +y21xle_wrapper(10, 6); +y21xle_wrapper(12, 4); static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused, void *opq) @@ -1447,6 +1456,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_Y210LE: c->chrToYV12 = y210le_UV_c; break; + case AV_PIX_FMT_Y212LE: + c->chrToYV12 = y212le_UV_c; + break; } if (c->chrSrcHSubSample) { switch (srcFormat) { @@ -1932,6 +1944,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_Y210LE: c->lumToYV12 = y210le_Y_c; break; + case AV_PIX_FMT_Y212LE: + c->lumToYV12 = y212le_Y_c; + break; case AV_PIX_FMT_X2RGB10LE: c->lumToYV12 = rgb30leToY_c; break; diff --git a/libswscale/utils.c b/libswscale/utils.c index ab86037cd4..a5a9bc589a 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -249,6 +249,7 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_NV24] = { 1, 1 }, [AV_PIX_FMT_NV42] = { 1, 1 }, [AV_PIX_FMT_Y210LE] = { 1, 0 }, + [AV_PIX_FMT_Y212LE] = { 1, 0 }, [AV_PIX_FMT_X2RGB10LE] = { 1, 1 }, [AV_PIX_FMT_X2BGR10LE] = { 1, 1 }, [AV_PIX_FMT_P210BE] = { 1, 1 }, -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".