From patchwork Wed Jan 15 06:59:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 17351 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 07E0044A3F3 for ; Wed, 15 Jan 2020 08:59:37 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E585368B0D1; Wed, 15 Jan 2020 08:59:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2F39568B0D0 for ; Wed, 15 Jan 2020 08:59:29 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2020 22:59:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,321,1574150400"; d="scan'208";a="225473658" Received: from unknown (HELO icl-dev.sh.intel.com) ([10.239.158.73]) by orsmga003.jf.intel.com with ESMTP; 14 Jan 2020 22:59:26 -0800 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Jan 2020 14:59:34 +0800 Message-Id: <1579071574-11806-1-git-send-email-linjie.fu@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input support for Y210LE 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: Linjie Fu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Add swscale input support for Y210LE, output support and fate test could be added later if there is requirement for software CSC to this packed format. Signed-off-by: Linjie Fu --- libswscale/input.c | 24 ++++++++++++++++++++++++ libswscale/utils.c | 1 + 2 files changed, 25 insertions(+) diff --git a/libswscale/input.c b/libswscale/input.c index 064f8da..02e87f0 100644 --- a/libswscale/input.c +++ b/libswscale/input.c @@ -552,6 +552,24 @@ 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) +{ + 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); + } +} + +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) +{ + int i; + for (i = 0; i < width; i++) + AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> 6); +} + static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width, uint32_t *unused) { @@ -1154,6 +1172,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) case AV_PIX_FMT_P016BE: c->chrToYV12 = p016BEToUV_c; break; + case AV_PIX_FMT_Y210LE: + c->chrToYV12 = y210le_UV_c; + break; } if (c->chrSrcHSubSample) { switch (srcFormat) { @@ -1586,6 +1607,9 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c) c->lumToYV12 = grayf32ToY16_bswap_c; #endif break; + case AV_PIX_FMT_Y210LE: + c->lumToYV12 = y210le_Y_c; + break; } if (c->needAlpha) { if (is16BPS(srcFormat) || isNBPS(srcFormat)) { diff --git a/libswscale/utils.c b/libswscale/utils.c index 57c4fd2..0ba312a 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -266,6 +266,7 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_YUVA444P12LE] = { 1, 1 }, [AV_PIX_FMT_NV24] = { 1, 1 }, [AV_PIX_FMT_NV42] = { 1, 1 }, + [AV_PIX_FMT_Y210LE] = { 1, 0 }, }; int sws_isSupportedInput(enum AVPixelFormat pix_fmt)