Path: blob/master/dep/ffmpeg/include/libavutil/hdr_dynamic_vivid_metadata.h
4216 views
/*1* Copyright (c) 2021 Limin Wang <lance.lmwang at gmail.com>2*3* This file is part of FFmpeg.4*5* FFmpeg is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public7* License as published by the Free Software Foundation; either8* version 2.1 of the License, or (at your option) any later version.9*10* FFmpeg is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public16* License along with FFmpeg; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/1920#ifndef AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H21#define AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H2223#include "frame.h"24#include "rational.h"2526/**27* HDR Vivid three spline params.28*/29typedef struct AVHDRVivid3SplineParams {30/**31* The mode of three Spline. the value shall be in the range32* of 0 to 3, inclusive.33*/34int th_mode;3536/**37* three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive38* and in multiples of 1.0/255.39*40*/41AVRational th_enable_mb;4243/**44* 3Spline_TH_enable of three Spline.45* The value shall be in the range of 0.0 to 1.0, inclusive.46* and in multiples of 1.0/4095.47*/48AVRational th_enable;4950/**51* 3Spline_TH_Delta1 of three Spline.52* The value shall be in the range of 0.0 to 0.25, inclusive,53* and in multiples of 0.25/1023.54*/55AVRational th_delta1;5657/**58* 3Spline_TH_Delta2 of three Spline.59* The value shall be in the range of 0.0 to 0.25, inclusive,60* and in multiples of 0.25/1023.61*/62AVRational th_delta2;6364/**65* 3Spline_enable_Strength of three Spline.66* The value shall be in the range of 0.0 to 1.0, inclusive,67* and in multiples of 1.0/255.68*/69AVRational enable_strength;70} AVHDRVivid3SplineParams;7172/**73* Color tone mapping parameters at a processing window in a dynamic metadata for74* CUVA 005.1:2021.75*/76typedef struct AVHDRVividColorToneMappingParams {77/**78* The nominal maximum display luminance of the targeted system display,79* in multiples of 1.0/4095 candelas per square metre. The value shall be in80* the range of 0.0 to 1.0, inclusive.81*/82AVRational targeted_system_display_maximum_luminance;8384/**85* This flag indicates that transfer the base paramter(for value of 1)86*/87int base_enable_flag;8889/**90* base_param_m_p in the base parameter,91* in multiples of 1.0/16383. The value shall be in92* the range of 0.0 to 1.0, inclusive.93*/94AVRational base_param_m_p;9596/**97* base_param_m_m in the base parameter,98* in multiples of 1.0/10. The value shall be in99* the range of 0.0 to 6.3, inclusive.100*/101AVRational base_param_m_m;102103/**104* base_param_m_a in the base parameter,105* in multiples of 1.0/1023. The value shall be in106* the range of 0.0 to 1.0 inclusive.107*/108AVRational base_param_m_a;109110/**111* base_param_m_b in the base parameter,112* in multiples of 1/1023. The value shall be in113* the range of 0.0 to 1.0, inclusive.114*/115AVRational base_param_m_b;116117/**118* base_param_m_n in the base parameter,119* in multiples of 1.0/10. The value shall be in120* the range of 0.0 to 6.3, inclusive.121*/122AVRational base_param_m_n;123124/**125* indicates k1_0 in the base parameter,126* base_param_k1 <= 1: k1_0 = base_param_k1127* base_param_k1 > 1: reserved128*/129int base_param_k1;130131/**132* indicates k2_0 in the base parameter,133* base_param_k2 <= 1: k2_0 = base_param_k2134* base_param_k2 > 1: reserved135*/136int base_param_k2;137138/**139* indicates k3_0 in the base parameter,140* base_param_k3 == 1: k3_0 = base_param_k3141* base_param_k3 == 2: k3_0 = maximum_maxrgb142* base_param_k3 > 2: reserved143*/144int base_param_k3;145146/**147* This flag indicates that delta mode of base paramter(for value of 1)148*/149int base_param_Delta_enable_mode;150151/**152* base_param_Delta in the base parameter,153* in multiples of 1.0/127. The value shall be in154* the range of 0.0 to 1.0, inclusive.155*/156AVRational base_param_Delta;157158/**159* indicates 3Spline_enable_flag in the base parameter,160* This flag indicates that transfer three Spline of base paramter(for value of 1)161*/162int three_Spline_enable_flag;163164/**165* The number of three Spline. The value shall be in the range166* of 1 to 2, inclusive.167*/168int three_Spline_num;169170#if FF_API_HDR_VIVID_THREE_SPLINE171/**172* The mode of three Spline. the value shall be in the range173* of 0 to 3, inclusive.174* @deprecated Use three_spline instead175*/176attribute_deprecated177int three_Spline_TH_mode;178179/**180* three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive181* and in multiples of 1.0/255.182* @deprecated Use three_spline instead183*/184attribute_deprecated185AVRational three_Spline_TH_enable_MB;186187/**188* 3Spline_TH_enable of three Spline.189* The value shall be in the range of 0.0 to 1.0, inclusive.190* and in multiples of 1.0/4095.191* @deprecated Use three_spline instead192*/193attribute_deprecated194AVRational three_Spline_TH_enable;195196/**197* 3Spline_TH_Delta1 of three Spline.198* The value shall be in the range of 0.0 to 0.25, inclusive,199* and in multiples of 0.25/1023.200* @deprecated Use three_spline instead201*/202attribute_deprecated203AVRational three_Spline_TH_Delta1;204205/**206* 3Spline_TH_Delta2 of three Spline.207* The value shall be in the range of 0.0 to 0.25, inclusive,208* and in multiples of 0.25/1023.209* @deprecated Use three_spline instead210*/211attribute_deprecated212AVRational three_Spline_TH_Delta2;213214/**215* 3Spline_enable_Strength of three Spline.216* The value shall be in the range of 0.0 to 1.0, inclusive,217* and in multiples of 1.0/255.218* @deprecated Use three_spline instead219*/220attribute_deprecated221AVRational three_Spline_enable_Strength;222#endif223224AVHDRVivid3SplineParams three_spline[2];225} AVHDRVividColorToneMappingParams;226227228/**229* Color transform parameters at a processing window in a dynamic metadata for230* CUVA 005.1:2021.231*/232typedef struct AVHDRVividColorTransformParams {233/**234* Indicates the minimum brightness of the displayed content.235* The values should be in the range of 0.0 to 1.0,236* inclusive and in multiples of 1/4095.237*/238AVRational minimum_maxrgb;239240/**241* Indicates the average brightness of the displayed content.242* The values should be in the range of 0.0 to 1.0,243* inclusive and in multiples of 1/4095.244*/245AVRational average_maxrgb;246247/**248* Indicates the variance brightness of the displayed content.249* The values should be in the range of 0.0 to 1.0,250* inclusive and in multiples of 1/4095.251*/252AVRational variance_maxrgb;253254/**255* Indicates the maximum brightness of the displayed content.256* The values should be in the range of 0.0 to 1.0, inclusive257* and in multiples of 1/4095.258*/259AVRational maximum_maxrgb;260261/**262* This flag indicates that the metadata for the tone mapping function in263* the processing window is present (for value of 1).264*/265int tone_mapping_mode_flag;266267/**268* The number of tone mapping param. The value shall be in the range269* of 1 to 2, inclusive.270*/271int tone_mapping_param_num;272273/**274* The color tone mapping parameters.275*/276AVHDRVividColorToneMappingParams tm_params[2];277278/**279* This flag indicates that the metadata for the color saturation mapping in280* the processing window is present (for value of 1).281*/282int color_saturation_mapping_flag;283284/**285* The number of color saturation param. The value shall be in the range286* of 0 to 7, inclusive.287*/288int color_saturation_num;289290/**291* Indicates the color correction strength parameter.292* The values should be in the range of 0.0 to 2.0, inclusive293* and in multiples of 1/128.294*/295AVRational color_saturation_gain[8];296} AVHDRVividColorTransformParams;297298/**299* This struct represents dynamic metadata for color volume transform -300* CUVA 005.1:2021 standard301*302* To be used as payload of a AVFrameSideData or AVPacketSideData with the303* appropriate type.304*305* @note The struct should be allocated with306* av_dynamic_hdr_vivid_alloc() and its size is not a part of307* the public ABI.308*/309typedef struct AVDynamicHDRVivid {310/**311* The system start code. The value shall be set to 0x01.312*/313uint8_t system_start_code;314315/**316* The number of processing windows. The value shall be set to 0x01317* if the system_start_code is 0x01.318*/319uint8_t num_windows;320321/**322* The color transform parameters for every processing window.323*/324AVHDRVividColorTransformParams params[3];325} AVDynamicHDRVivid;326327/**328* Allocate an AVDynamicHDRVivid structure and set its fields to329* default values. The resulting struct can be freed using av_freep().330*331* @return An AVDynamicHDRVivid filled with default values or NULL332* on failure.333*/334AVDynamicHDRVivid *av_dynamic_hdr_vivid_alloc(size_t *size);335336/**337* Allocate a complete AVDynamicHDRVivid and add it to the frame.338* @param frame The frame which side data is added to.339*340* @return The AVDynamicHDRVivid structure to be filled by caller or NULL341* on failure.342*/343AVDynamicHDRVivid *av_dynamic_hdr_vivid_create_side_data(AVFrame *frame);344345#endif /* AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H */346347348