From patchwork Sun Aug 7 20:14:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 37177 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:92a9:b0:8d:7f3b:94fc with SMTP id q41csp1454870pzg; Sun, 7 Aug 2022 13:14:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR4OZHfTTnECj36NienUYAzpqNCypzRDVK9L86IwP9hQ0cMAckh/3LHBfHSUBcmLvEbjrBbQ X-Received: by 2002:a17:907:3da7:b0:730:cae5:7f7d with SMTP id he39-20020a1709073da700b00730cae57f7dmr11643506ejc.711.1659903284627; Sun, 07 Aug 2022 13:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659903284; cv=none; d=google.com; s=arc-20160816; b=AUn/+e5Vb0qVrBMH9XBJLA7Q9GHPk5GCmcAMWqT2ZVUJ+vmkN2EIqtffqx4akgvk3b hFLc7H4ZWMgmxZaLbu1RdaGlX3lWFGPcqzp0ZZWScmUmfP1qnjpbUpLQ1uxRsJG+K/Af kGs7Mugl19Y/JapAuva1cVSR9vJ5DgktofdhPCKLHwQxNLo3d0sSwyUzfUY10v5EPMm0 02E9hlg4Mnj66+TNN2SYjOB4o0WiDSGG4iO3Fab5T/MjfvViJL77UVEY7cEuxlzm3nqI RRnqPuTPiKlpqSbKCsrniLWJ8evIQLdq4tv5/ubnDoAkvmgpEq8m1GZ+TlRFxbtfH4uB hTyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=7CxywYZsqxtB8yA/HRMQZ6zt1wfmqY1Y3EBieSS5zd4=; b=kSlJPxKLLs6UBXc5+ygDUUSfYdt5K3cKfWyuIm/o7RRf+sGE3rG2TZxUgYPjK5O5bg YUYHIoWQks+mzjswGBiewCMOyXGOTeCJSeQ+jLGPY71TvbC6ejXILKMvN78L3ITe+XLn iJSfZaxdgtq9JAdOUZS9ssEd5cqMVkknCpjs8ifxpeOyrASC9g4Gz9VRvZsgJIcvpVun +CnqFfijvQr+kj0eQghOUwrzbF+0xLkXXzCQ9DDl/Afq68IRLbcT1LNkUifAkztjvpYX 6pz+wvf/DONFsHdDvUiJbl/a/iSMbtHBXnIeoHMdbF4lS6KCxGskswIhzT8ql91d/58I OsBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org header.s=mail header.b=kT9OEqNA; 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=rothenpieler.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x10-20020a05640226ca00b0043d800168absi5407066edd.346.2022.08.07.13.14.44; Sun, 07 Aug 2022 13:14:44 -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=@rothenpieler.org header.s=mail header.b=kT9OEqNA; 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=rothenpieler.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 462FB68B44B; Sun, 7 Aug 2022 23:14:41 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [136.243.74.85]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9383568B4F5 for ; Sun, 7 Aug 2022 23:14:34 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id 370693529E3; Sun, 7 Aug 2022 22:14:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1659903274; bh=a9hV2rb1WlJgg3c+YboDyrziG45hZ1U3wXoOLkpDAqQ=; h=From:To:Cc:Subject:Date; b=kT9OEqNAEqchllPVugM7P/VmWIyyKvhWwvHbAGX8hgUayG2dmH9lBl6BIuw1nSgTj ip+wcjX6EsFy9oNgUfama5ru8FBhU4xGTutwLZWdnzzrFKnvlvw9J9H7Cf+DKV1IOy t8ohwfadSKfPileY3FKE2h+X2N8ZMKMX30ZMsJzjQYmpe/PYYzdf8XwXJdzKReJlMm Z6coz/ZDCG2Hk4rthUrVl6cxsSzuN+Lhe2vxXX5YJm+vx2p0uK7AEaLiTW3TlR22tv hWXDBzRJbC8E4JHLhRV4EhLIXeO9M70fnGwqVslzWQRYAwwQF7OXofCHvqfCXcVcJx /h11sA/5TNFHw== From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Sun, 7 Aug 2022 22:14:23 +0200 Message-Id: <20220807201423.9191-1-timo@rothenpieler.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavu/pixfmt: add packed RGBA float16 format 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: Timo Rothenpieler Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: mXDjLihPe1kO This is the default format of the Windows compositor and what DXGI Desktop Duplication will give you for any kind of HDR output. --- libavutil/pixdesc.c | 28 ++++++++++++++++++++++++++++ libavutil/pixfmt.h | 5 +++++ libavutil/version.h | 4 ++-- tests/ref/fate/imgutils | 2 ++ tests/ref/fate/sws-pixdesc-query | 13 +++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index e078fd5320..f7558ff8b9 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2504,6 +2504,34 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_ALPHA, }, + [AV_PIX_FMT_RGBAF16BE] = { + .name = "rgbaf16be", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 8, 0, 0, 16 }, /* R */ + { 0, 8, 2, 0, 16 }, /* G */ + { 0, 8, 4, 0, 16 }, /* B */ + { 0, 8, 6, 0, 16 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | + AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_FLOAT, + }, + [AV_PIX_FMT_RGBAF16LE] = { + .name = "rgbaf16le", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 8, 0, 0, 16 }, /* R */ + { 0, 8, 2, 0, 16 }, /* G */ + { 0, 8, 4, 0, 16 }, /* B */ + { 0, 8, 6, 0, 16 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA | + AV_PIX_FMT_FLAG_FLOAT, + }, }; static const char * const color_range_names[] = { diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 9d1fdaf82d..86c9bdefeb 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -369,6 +369,9 @@ enum AVPixelFormat { AV_PIX_FMT_VUYA, ///< packed VUYA 4:4:4, 32bpp, VUYAVUYA... + AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian + AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-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 }; @@ -466,6 +469,8 @@ enum AVPixelFormat { #define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE) #define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE) +#define AV_PIX_FMT_RGBAF16 AV_PIX_FMT_NE(RGBAF16BE, RGBAF16LE) + /** * Chromaticity coordinates of the source primaries. * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273. diff --git a/libavutil/version.h b/libavutil/version.h index ee43526dc6..f0a8b5c098 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,8 +79,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 57 -#define LIBAVUTIL_VERSION_MINOR 32 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MINOR 33 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index 4ec66febb8..01c9877de5 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -247,3 +247,5 @@ p216le planes: 2, linesizes: 128 128 0 0, plane_sizes: 6144 6144 p416be planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 p416le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 0 0, plane_offsets: 6144 0 0, total_size: 18432 vuya planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +rgbaf16be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +rgbaf16le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index bd0f1fcb82..f79d99e513 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -21,6 +21,8 @@ is16BPS: rgb48le rgba64be rgba64le + rgbaf16be + rgbaf16le ya16be ya16le yuv420p16be @@ -157,6 +159,7 @@ isBE: rgb555be rgb565be rgba64be + rgbaf16be x2bgr10be x2rgb10be xyz12be @@ -479,6 +482,8 @@ isRGB: rgb8 rgba64be rgba64le + rgbaf16be + rgbaf16le x2bgr10be x2bgr10le x2rgb10be @@ -629,6 +634,8 @@ AnyRGB: rgb8 rgba64be rgba64le + rgbaf16be + rgbaf16le x2bgr10be x2bgr10le x2rgb10be @@ -655,6 +662,8 @@ ALPHA: rgb32_1 rgba64be rgba64le + rgbaf16be + rgbaf16le vuya ya16be ya16le @@ -739,6 +748,8 @@ Packed: rgb8 rgba64be rgba64le + rgbaf16be + rgbaf16le uyvy422 uyyvyy411 vuya @@ -918,6 +929,8 @@ PackedRGB: rgb8 rgba64be rgba64le + rgbaf16be + rgbaf16le x2bgr10be x2bgr10le x2rgb10be