From patchwork Thu Jul 20 15:46:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vittorio Giovara X-Patchwork-Id: 4388 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp2309939vsb; Thu, 20 Jul 2017 08:47:12 -0700 (PDT) X-Received: by 10.28.84.86 with SMTP id p22mr2756146wmi.49.1500565632482; Thu, 20 Jul 2017 08:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500565632; cv=none; d=google.com; s=arc-20160816; b=fZwkuBM2gYu5ED6OuYMR8Nxd+/5k/Q72gOt4O593aDN76keEO9lUGzY+6I1sNE0r2Z WyiSRWbd/GTjkmc85a2XpJ2EYwKvhx/SylEodFlm6NQxnzIVgCo0n1MTnuHwYQB9wJMV IlVSOiXvv1ZEnOQ05H1d0sCZVtpRZeBdbIAGCcF1pJuxwgov+yqCp9wlZN0+2Z5udnjj 9LIiFfxqyrY2CulyZIlGcE490/6IPijqJBf4bPPf/sTv4hEfaC5ThoroNG5kLJTdhjo8 //u5U2jE7Rma1bOQ0h71LRS5N8dLnn7XDT6Mi3wPn3gk0rKCtr/d7wOLIOFt3QoGntCg 1N9Q== 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: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=+lrw6xhrUEUSr6tqpGgJioDX7Pl55fk2PPRlElN/Pkk=; b=w+Hd39c3JMN2ihRter6idz3GGdAgHfp+xbDxhrYWgRzhGT2W7G0TWXfM5Rw0kVVX+w EUCSGzyavRn4I6LTtttg1cZT3yDMjfMxsbIXLlhLiXOlDD3SvcFP0ODskDm0i8itwddM qjHULu1NIjoNq0ITljCJ9TVMEdi2hJyaIyv08hVQBuplpzfRr07Tu3sKJ2yGKM2n7rbr 4baIMinfDxLbYuDmQct9l0d3pMSe9S8pixP2QAU6ToFCnkDbPavBr75g4KxnwILx8TRx 7PHmSjxz/F7eEy0ysatjwc+bDPUYyVkwHmOPuGjF2VRMD4ztXw8842Qthz+8nS5/vJ6z nnWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.b=KQdE+nzn; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 34si6147081wrs.75.2017.07.20.08.47.11; Thu, 20 Jul 2017 08:47:12 -0700 (PDT) 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=@gmail.com header.b=KQdE+nzn; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6B741689975; Thu, 20 Jul 2017 18:47:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk0-f195.google.com (mail-qk0-f195.google.com [209.85.220.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 748176882C7 for ; Thu, 20 Jul 2017 18:46:55 +0300 (EEST) Received: by mail-qk0-f195.google.com with SMTP id t186so1856201qkf.2 for ; Thu, 20 Jul 2017 08:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=n5L7MaxYzwNrjhZwRZRdeKvT5N4wDyCdd84ascSVRsA=; b=KQdE+nznxbb0litKxktWiNqFl/z4ReRhFOT3UcwxrCGbYvxZwW5yARzwa529CKEd8w M0K410ANbv1wqmhN4Hs3jDwA28c7YEUPcEB2Lkn88x10sYyfJHKhMHoT/P/i7ZNEsMLw RaeU2/TXvRP4ww3uRv00DykXhUa5G9tsJShlk7wS70kh2PT0Z6OVGylt1l3GFDyX48uw G3tJrfJlw5UeLRORBGdKtPHCM8Rx/ORx5BsgfngfVhZoXJk4J5ShydfhhNQjQMeBuTJy rGgBfUROsy0yKSaGlqma3KA/0eLyinpYoFz5C/Qa8oCQ31qSeDa01wi/QogIrznR9y9x WA0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=n5L7MaxYzwNrjhZwRZRdeKvT5N4wDyCdd84ascSVRsA=; b=jCb0bg+OnCiXzXeX8ftAxI665g/OVtYA40GW6c74owA2VnCn5t4Cvg6UoTZ4kHkXJ3 9vaMT9bXhr1r6MoP2IInaYOiqqUb+wz9Qs+H9+0CGEoxoRdgZtiBHWrPlyqssp2rYGSx lEtY8OufDSBoO0Fkc5S7yIH/wVL+IcCyeFQ9sb1qknJijC+1mcn24ahwPdgFa7YZxuoQ wG7u/DmXMK3qrBnzZUq0f2VdbFL/aDc4h/6t5WGQWTVvCqlVgo4YD+4KTz6nPc4o43oM ZBcH14g8q1Cl0tlWmaONAD1ju9eIMvROPpq+WyEFpBBWQTNWxBrVjQJMvuDdGEw3S4o7 sFGQ== X-Gm-Message-State: AIVw1130+/g+lMqzp0/7/pDkPErB8hOH32EQLwubCvS/kWTKVxlYl1OE UCGS2D4rmIWCcmiF X-Received: by 10.55.157.135 with SMTP id g129mr5635745qke.241.1500565622123; Thu, 20 Jul 2017 08:47:02 -0700 (PDT) Received: from vimacbookpro.vimeo.iac.corp (93-40-167-184.ip39.fastwebnet.it. [93.40.167.184]) by smtp.gmail.com with ESMTPSA id i79sm1868765qke.3.2017.07.20.08.47.00 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 20 Jul 2017 08:47:01 -0700 (PDT) From: Vittorio Giovara To: ffmpeg-devel@ffmpeg.org Date: Thu, 20 Jul 2017 17:46:59 +0200 Message-Id: <20170720154659.29102-1-vittorio.giovara@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170718135015.52683-1-vittorio.giovara@gmail.com> References: <20170718135015.52683-1-vittorio.giovara@gmail.com> Subject: [FFmpeg-devel] [PATCH] Add YUV444 32bit floating point pixel format 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" With and without alpha. --- Updated with fate tests. Vittorio libavutil/pixdesc.c | 51 ++++++++++++++++++++++++++++++++++++++++ libavutil/pixdesc.h | 5 ++++ libavutil/pixfmt.h | 7 ++++++ libswscale/utils.c | 4 ++++ tests/ref/fate/sws-pixdesc-query | 16 +++++++++++++ 5 files changed, 83 insertions(+) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 1983ce9ef5..2175b9d799 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2162,6 +2162,57 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .name = "d3d11", .flags = AV_PIX_FMT_FLAG_HWACCEL, }, + [AV_PIX_FMT_YUV444F32LE] = { + .name = "yuv444f32le", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */ + { 1, 4, 0, 0, 32, 3, 31, 1 }, /* U */ + { 2, 4, 0, 0, 32, 3, 31, 1 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT, + }, + [AV_PIX_FMT_YUV444F32BE] = { + .name = "yuv444f32be", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */ + { 1, 4, 0, 0, 32, 3, 31, 1 }, /* U */ + { 2, 4, 0, 0, 32, 3, 31, 1 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT, + }, + [AV_PIX_FMT_YUVA444F32LE] = { + .name = "yuva444f32le", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */ + { 1, 4, 0, 0, 32, 3, 31, 1 }, /* U */ + { 2, 4, 0, 0, 32, 3, 31, 1 }, /* V */ + { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_YUVA444F32BE] = { + .name = "yuva444f32be", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 32, 3, 31, 1 }, /* Y */ + { 1, 4, 0, 0, 32, 3, 31, 1 }, /* U */ + { 2, 4, 0, 0, 32, 3, 31, 1 }, /* V */ + { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | + AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA, + }, }; #if FF_API_PLUS1_MINUS1 FF_ENABLE_DEPRECATION_WARNINGS diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h index c3a6f27f49..294555260a 100644 --- a/libavutil/pixdesc.h +++ b/libavutil/pixdesc.h @@ -178,6 +178,11 @@ typedef struct AVPixFmtDescriptor { #define AV_PIX_FMT_FLAG_BAYER (1 << 8) /** + * The pixel format contains IEEE-754 single precision floating point values. + */ +#define AV_PIX_FMT_FLAG_FLOAT (1 << 10) + +/** * Return the number of bits per pixel used by the pixel format * described by pixdesc. Note that this is not the same as the number * of bits per sample. diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index e1e4074bee..d6a874da15 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -326,6 +326,11 @@ enum AVPixelFormat { */ AV_PIX_FMT_D3D11, + AV_PIX_FMT_YUV444F32LE, ///< IEEE-754 single precision planar YUV 4:4:4, 96bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444F32BE, ///< IEEE-754 single precision planar YUV 4:4:4, 96bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUVA444F32LE, ///< IEEE-754 single precision planar YUV 4:4:4, 128bpp, (1 Cr & Cb sample per 1x1 Y & A sample), little-endian + AV_PIX_FMT_YUVA444F32BE, ///< IEEE-754 single precision planar YUV 4:4:4, 128bpp, (1 Cr & Cb sample per 1x1 Y & A sample), big-endian + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; @@ -389,6 +394,8 @@ enum AVPixelFormat { #define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE) #define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE) +#define AV_PIX_FMT_YUV444F32 AV_PIX_FMT_NE(YUV444F32BE, YUV444F32LE) +#define AV_PIX_FMT_YUVA444F32 AV_PIX_FMT_NE(YUVA444F32BE, YUVA444F32LE) #define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE) #define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE) diff --git a/libswscale/utils.c b/libswscale/utils.c index 17c996734a..892b219049 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -254,6 +254,10 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_P010BE] = { 1, 1 }, [AV_PIX_FMT_P016LE] = { 1, 0 }, [AV_PIX_FMT_P016BE] = { 1, 0 }, + [AV_PIX_FMT_YUV444F32LE] = { 0, 0 }, + [AV_PIX_FMT_YUV444F32BE] = { 0, 0 }, + [AV_PIX_FMT_YUVA444F32LE] = { 0, 0 }, + [AV_PIX_FMT_YUVA444F32BE] = { 0, 0 }, }; int sws_isSupportedInput(enum AVPixelFormat pix_fmt) diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index e262a0cabf..7f2fc557d6 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -154,6 +154,8 @@ isBE: gray12be gray10be p016be + yuv444f32be + yuva444f32be isYUV: yuv420p @@ -242,6 +244,10 @@ isYUV: p010be p016le p016be + yuv444f32le + yuv444f32be + yuva444f32le + yuva444f32be isPlanarYUV: yuv420p @@ -319,6 +325,10 @@ isPlanarYUV: p010be p016le p016be + yuv444f32le + yuv444f32be + yuva444f32le + yuva444f32be isRGB: rgb24 @@ -567,6 +577,8 @@ ALPHA: gbrap12le gbrap10be gbrap10le + yuva444f32le + yuva444f32be Packed: yuyv422 @@ -726,6 +738,10 @@ Planar: gbrap10le p016le p016be + yuv444f32le + yuv444f32be + yuva444f32le + yuva444f32be PackedRGB: rgb24