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 3331B431CE for ; Tue, 24 May 2022 20:56:25 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 88E2268B583; Tue, 24 May 2022 23:56:24 +0300 (EEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075044.outbound.protection.outlook.com [40.92.75.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 18B7168B575 for ; Tue, 24 May 2022 23:56:18 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VmXhychxfTceAoCyGrWYU4GmMRVktBL0frRECYI7gdmQvL+xRUu+Ls0CXI+EDkULJEfPLR5amLOb3GJf1ogkiq/1PxIAA+nC3DN1hbLMy+UJWjfeMxJo1+iM2k0RBFq0h6krd3HurTcgVc7/qAe9cW2wv/PYx+EWskfrh/UauLUhCKcUvVZES2zjAI5/CWs/tEu41hSpUWRXKUx5IUMPhBZn13+kjhIg3Kwmb81b9MMCpxBwqQx1Fm+bpDfR3FWb+I2tlFYQq9y3MsGb8FjT5O1uVjzC4KaKxtDJh0yxSq7h4cTdNid4+RZ7/XXNRXOXWLy0ozd09FjU1Rf8NG3jcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FSbklODxxgZ1y06u65mDdcWZ5W/wyFMuyT0QLMAexfk=; b=Y9Mp2UYzC4ncZA+2sdnuHM5aA58n3hrwbNyUNkSyeazwsxHHCvorM4GzPys6u7nos7QquJ91s9okKSnVdmChKbn8Tax3o8ICNZk/w/cUlzkpO/PiwgMm2Pc9KhoeWevCz7CDUdypYJDazqsUpdJ3AAr4a7J8kJBiuKFGBXniQZqHTwGmdGOi339D0K5d+gLeeyoxkOVA/EPSajnUY1lPiH4FITWDK5/9LzympvGMKOOHXo+83FCuue25L545iM1FWhCYJeEQ3wf8fUr+s+/oVZM4ZtZfbM4jzGCQAnDYlf6z18N0u+p0MWLpaKSbOltRjo9lxCpORyFMgQxmnn96yA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FSbklODxxgZ1y06u65mDdcWZ5W/wyFMuyT0QLMAexfk=; b=UVlazutRkoohbyU/cIbQY7lB2ZYjZfUc06oB7pg+rdzejj45yJEQX4yv9Dd1fXPKe3qlWiSUFBEAvSLiF40UxxFElPWPB1WVBENrJTkgSnipzJEI84mdhZMzYxKIgJuVsLHor4AAq7T2jq23s1ThSN3AvswPn/2K0NI+/MWkSs/etBNEluDg696o0eP+5KKb4CxByACfuVwHfAeWFc3FoAGIs2RagVciLeX8bWyw5G1GsuwubVCHy7wxLafmlrfmabXxNkeIzDfbiGL+4WCAaPAHYHxxMQl4kxWBsS+4y/TFABuSSa3l+DsUxHi2UeEU9bysfpxC/bOJYJkliSV5SA== Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) by DBAPR01MB7126.eurprd01.prod.exchangelabs.com (2603:10a6:10:197::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.15; Tue, 24 May 2022 20:56:16 +0000 Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::60b9:9f29:40cc:f01c]) by DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::60b9:9f29:40cc:f01c%10]) with mapi id 15.20.5273.023; Tue, 24 May 2022 20:56:16 +0000 Message-ID: Date: Tue, 24 May 2022 22:56:14 +0200 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220524163001.55360-1-leo.izen@gmail.com> <20220524163001.55360-2-leo.izen@gmail.com> From: Andreas Rheinhardt In-Reply-To: <20220524163001.55360-2-leo.izen@gmail.com> X-TMN: [FOZaDNT9LpvxjhhA0G3W6PK0+uMVnZXb] X-ClientProxiedBy: ZR0P278CA0157.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:41::22) To DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4fc5fc9b-3b8f-4c78-2b18-08da3dc7d803 X-MS-TrafficTypeDiagnostic: DBAPR01MB7126:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2f2oBovZyHUuvHhZXvnN6xIg7Mkqvfi4/dCyOHsp2i7nDH3k1VtQFtRm2Dj1yr3QCUEfbw6/YhWDycG6COwWNpgClTgGer7GzxPEOTjt64fV+iBZjn9k5OHfBl57LQdDsOOKggbiADkcEy7J34CkXSTXxA+Ic8vODzC92OPdVbx7zk56lhB1yplsAhOe58/ngu8iR/yD/YEgPTIc4GYu4DhRYNG/PNnS241iFsV7WXwBoPriaLznNM4Bt//YyB9sfUiXGATJP84lql32mwvGLpStPzPuXEoQZnw7SvGGWOchwskkqFU52q2/S1BcBXSU0lAIy+UZFLnOMenbSjptECsImaoSxJ+YiBI0OXOR9rxX+uLJflvld22uVI8l3EKAHzftthhSj3W2049HdiINmeqoxB9N4Ry8Cwo596so/U3D4an9bxRhXhMk0O4u+pYwu2pQ8o9oGBIR+wk4/V03tzsAcnsicX4as81iFEJd/gsPKxCFLci8IP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TdGckNuV2pRVWdmZGFZ?= =?utf-8?B?aGdUUTM3MGRSWHNsZ1c4b0h0b0ZrbGdROXB5akJSd2d1UEd3bk5xVlR2R0c3?= =?utf-8?B?ckJSWFpuM3daK0VYT2UwYlZiRVc3UE9kUXpINWo1YnRjVGhSQ3BvbEkxb1VB?= =?utf-8?B?Q09KVlc5TitHRHl4RVkzMVVwY3lZdWFVQkQ3cVBZL1p1b0M0OUtTaUxWMVBR?= =?utf-8?B?YlVpQTUzU2RhVFV2MW9KR3FDZlhqZ3ZINnNqbTlDd0V2N0tzSExIL2FRNUJt?= =?utf-8?B?KzRDUVlxek44THRaSmM5UzBFcTdsTXJneDNoQ0JiVEFRclJCQnF5aWRzajMw?= =?utf-8?B?MjFOUmpMQWl3PT0=?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4fc5fc9b-3b8f-4c78-2b18-08da3dc7d803 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0101MB2214.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2022 20:56:16.0875 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR01MB7126 Subject: Re: [FFmpeg-devel] [PATCH v5 1/1] avutil/csp: create public API for colorspace structs 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 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: Leo Izen: > This commit moves some of the functionality from avfilter/colorspace > into avutil/csp and exposes it as a public API so it can be used by > libavcodec and/or libavformat. It also converts those structs from > double values to AVRational to make regression testing easier and > more consistent. > --- > libavfilter/colorspace.c | 143 ++++++++---------------------------- > libavfilter/colorspace.h | 31 +------- > libavfilter/fflcms2.c | 33 +++++---- > libavfilter/fflcms2.h | 4 +- > libavfilter/vf_colorspace.c | 37 +++++----- > libavfilter/vf_iccdetect.c | 5 +- > libavfilter/vf_tonemap.c | 17 +---- > libavutil/Makefile | 2 + > libavutil/csp.c | 128 ++++++++++++++++++++++++++++++++ > libavutil/csp.h | 115 +++++++++++++++++++++++++++++ > libavutil/version.h | 2 +- > 11 files changed, 326 insertions(+), 191 deletions(-) > create mode 100644 libavutil/csp.c > create mode 100644 libavutil/csp.h > > diff --git a/libavutil/csp.h b/libavutil/csp.h > new file mode 100644 > index 0000000000..57a615c678 > --- /dev/null > +++ b/libavutil/csp.h > @@ -0,0 +1,115 @@ > +/* > + * Copyright (c) 2016 Ronald S. Bultje > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + */ > + > +#ifndef AVUTIL_CSP_H > +#define AVUTIL_CSP_H > + > +#include "pixfmt.h" > +#include "rational.h" > + > +/** > + * @file Colorspace value utility functions for libavutil. > + * @author Ronald S. Bultje > + * @author Leo Izen > + * @defgroup lavu_math_csp Colorspace Utility > + * @ingroup lavu_math > + * @{ > + */ > + > +/** > + * This denominator should be used when converting float or double values to > + * AVRational so they can work with this API, because it provides significant > + * enough precision to be visually identical to the floating point values. > + * @see av_d2q() > + */ > +#define AVUTIL_CSP_DENOM 100000 Why not 300000 given that the denominator of one of the constants has a factor of three? (Sorry if this has already been answered before.) > + > +/** > + * Struct containing luma coefficients to be used for RGB to YUV calculations, > + * or YUV to RGB. > + */ > +typedef struct AVLumaCoefficients { > + AVRational cr, cg, cb; > +} AVLumaCoefficients; > + > +/** > + * Struct containing chromaticity x and y values for the standard CIE 1931 > + * chromaticity definition. > + */ > +typedef struct AVCIExy { > + AVRational x, y; > +} AVCIExy; > + > +/** > + * Struct defining the red, green, and blue primary locations in terms of CIE > + * 1931 chromaticity x and y. > + */ > +typedef struct AVPrimaryCoefficients { > + AVCIExy r, g, b; > +} AVPrimaryCoefficients; > + > +/** > + * Struct defining white point location in terms of CIE 1931 chromaticity x > + * and y. > + */ > +typedef AVCIExy AVWhitepointCoefficients; > + > +/** > + * Struct that contains both white point location and primaries location, providing > + * the complete description of a color gamut. > + */ > +typedef struct AVColorPrimariesDesc { > + AVWhitepointCoefficients wp; > + AVPrimaryCoefficients prim; > +} AVColorPrimariesDesc; > + > + > +/** > + * Detects which enum AVColorPrimaries constant corresponds to the given complete > + * gamut description. > + * @see enum AVColorPrimaries > + * @param prm A description of the colorspace gamut > + * @return The enum constant associated with this gamut, or > + * AVCOL_PRI_UNSPECIFIED if no clear match can be idenitified. > + */ > +enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *prm); > + > +/** > + * Retrieves a complete gamut description from an enum constant describing the > + * color primaries. > + * @param prm An enum constant indicating primaries > + * @return A description of the colorspace gamut associated with that enum > + * constant, or NULL if the constant is unknown to libavutil. > + */ > +const AVColorPrimariesDesc *av_csp_primaries_desc_from_id(enum AVColorPrimaries prm); > + > +/** > + * Retrieves the Luma coefficients necessary to construct a conversion matrix > + * from an enum constant describing the YUV colorspace. > + * @param csp An enum constant indicating YUV colorspace. > + * @return The Luma coefficients associated with that YUV colorspace, or NULL > + * if the constant is unknown to libavutil. > + */ > +const AVLumaCoefficients *av_csp_luma_coeffs_from_avcsp(enum AVColorSpace csp); > + > +/** > + * @} > + */ > + > +#endif /* AVUTIL_CSP_H */ > diff --git a/libavutil/version.h b/libavutil/version.h > index 1b4b41d81f..2c7f4f6b37 100644 > --- a/libavutil/version.h > +++ b/libavutil/version.h > @@ -79,7 +79,7 @@ > */ > > #define LIBAVUTIL_VERSION_MAJOR 57 > -#define LIBAVUTIL_VERSION_MINOR 25 > +#define LIBAVUTIL_VERSION_MINOR 26 > #define LIBAVUTIL_VERSION_MICRO 100 > > #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ _______________________________________________ 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".