From patchwork Thu Oct 26 14:23:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 44365 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bf16:b0:15d:8365:d4b8 with SMTP id gc22csp671157pzb; Thu, 26 Oct 2023 07:24:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEE8USX0TDrsAJMwMwTa/gMOcH4fvFoDO9N+5yio8tJ4sAx/exrQ+4p/Yjeb+3/JT66ngS1 X-Received: by 2002:a17:906:dc89:b0:9bf:ad86:ece8 with SMTP id cs9-20020a170906dc8900b009bfad86ece8mr15973638ejc.25.1698330252428; Thu, 26 Oct 2023 07:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698330252; cv=none; d=google.com; s=arc-20160816; b=R8nNoEMV0fNA2Zt02GL2+vPq311JRPNlumxA2Yt/Pb70+xYRujiUhTwoVS+Nrij/xH lcUXxuZNG/A+ymEHnBneTg0ViLqSr3hQbUE50eCD2Q3IHYPajYWid0obygkpEbQ/pe3y ZdpLzFGpxiJ9bcw985gc0oalKb0ItMnjj1ykqPKJjbDvnT9Pn24062HoAwdL1Z8gZg7g 5wqkpGAMGVJPu7fCjJVkK2iI27SK3xuyEL+TcYBKcf3Mqtsfngq0O72+IfyPYwtYxMzN 90Df+h6yatYYS9nhE/lfTj92/YO3UjUcpdsAu9XH6L0/Ox0x7gQ2TnmCpGBxtlNGCRAj tQZA== 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:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=U/74G+PltOlT7HRhCCaqhLuher520kjJJKYszsqAw1I=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=mBn8LAPcSkYsFNTMsQxlbjy02W3TPCuG03oou/xfD1qlNlTINhJbdUzDYzvZFoovNS KCjMzS/QfAlg/lu2/PPsFW7tOoV4+EF9tpshF+dqWT0Ds5/ayFkNI0F5lIIi8dni0b3d kmCc2E0TgyjNyeZCsGt03xYP0hjv7gTQZZxeMrLdTJdplZLnn3P5smYQuh5p/wdZo6O/ XMbq6xFH6nqAP2YuSo+ri7l3SzMS+SG4hpfrPZ7OJ2ppEt2FgXXRz6X+nkn8kxmQfdv3 XSYViWL+5BaIaloZxP9g2blmgEYTC3iLlgp6Z+aDWP0qOGUy0+P1jEKWjO9BXofq0Aa+ TH6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=BP7e5s2X; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gs26-20020a170906f19a00b0099bcf1c07cbsi6640188ejb.883.2023.10.26.07.23.51; Thu, 26 Oct 2023 07:24: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=@haasn.xyz header.s=mail header.b=BP7e5s2X; 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 09F9F68CB30; Thu, 26 Oct 2023 17:23:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5F63368C6BF for ; Thu, 26 Oct 2023 17:23:33 +0300 (EEST) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 1AD334A521; Thu, 26 Oct 2023 16:23:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1698330213; bh=6OK91JKng39eW74dMUrtBisqhXThNYCN03Kt+CsSfRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BP7e5s2XiB9c1RxmFKxgQXlvQwKiElFJXZiDH0ndLmd4u5z2JDE1j7LBm1PWLc2IO aYxzBxdI7DMvdME1zb/uRa7dhwaezDwWAxN/b3l4M5QUTVOC2oZ+lRxM1+s2e0KitY faYFrRJMJHIo6Ka8D/fm7CXBitWAN2wvKtlAhBsA= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Thu, 26 Oct 2023 16:23:24 +0200 Message-ID: <20231026142327.52694-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231026142327.52694-1-ffmpeg@haasn.xyz> References: <20231026142327.52694-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/5] avutil/pixdesc: add AV_PIX_FMT_FLAG_XYZ 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: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: V6pYvGRwVRGF From: Niklas Haas There are already several places in the codebase that match desc->name against "xyz", and many downstream clients replicate this behavior. I have no idea why this is not just a flag. Motivated by my desire to add yet another check for XYZ to the codebase, and I'd rather not keep copy/pasting a string comparison hack. --- doc/APIchanges | 3 +++ libavutil/pixdesc.c | 6 +++--- libavutil/pixdesc.h | 5 +++++ libavutil/version.h | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 9b109e6fa7..c0d6ee0b29 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-10-26 - xxxxxxxxxx - lavu 58.28.100 - pixdesc.h + Add AV_PIX_FMT_FLAG_XYZ. + 2023-10-06 - xxxxxxxxxx - lavc 60.30.101 - avcodec.h AVCodecContext.coded_side_data may now be used during decoding, to be set by user before calling avcodec_open2() for initialization. diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 6ded9467b0..f2647d3d55 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1977,8 +1977,8 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { { 0, 6, 0, 4, 12 }, /* X */ { 0, 6, 2, 4, 12 }, /* Y */ { 0, 6, 4, 4, 12 }, /* Z */ - }, - /*.flags = -- not used*/ + }, + .flags = AV_PIX_FMT_FLAG_XYZ, }, [AV_PIX_FMT_XYZ12BE] = { .name = "xyz12be", @@ -1990,7 +1990,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { { 0, 6, 2, 4, 12 }, /* Y */ { 0, 6, 4, 4, 12 }, /* Z */ }, - .flags = AV_PIX_FMT_FLAG_BE, + .flags = AV_PIX_FMT_FLAG_XYZ | AV_PIX_FMT_FLAG_BE, }, #define BAYER8_DESC_COMMON \ diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h index 0df73e6efe..ba2f632814 100644 --- a/libavutil/pixdesc.h +++ b/libavutil/pixdesc.h @@ -157,6 +157,11 @@ typedef struct AVPixFmtDescriptor { */ #define AV_PIX_FMT_FLAG_FLOAT (1 << 9) +/** + * The pixel format contains XYZ-like data (as opposed to YUV/RGB/grayscale). + */ +#define AV_PIX_FMT_FLAG_XYZ (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 diff --git a/libavutil/version.h b/libavutil/version.h index 4c0c545d40..279e54c394 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 58 -#define LIBAVUTIL_VERSION_MINOR 27 +#define LIBAVUTIL_VERSION_MINOR 28 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \