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 8688B405DF for ; Sun, 27 Mar 2022 23:30:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 476AD68B27A; Mon, 28 Mar 2022 02:30:35 +0300 (EEST) Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C0C7F68AF91 for ; Mon, 28 Mar 2022 02:30:29 +0300 (EEST) Received: by mail-ot1-f46.google.com with SMTP id k18-20020a9d7012000000b005cdb11186f2so8358210otj.9 for ; Sun, 27 Mar 2022 16:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=JpxguvXn2vba0860MQ16rGYgc2sdw/YJkse0YpXOTyk=; b=ASxne4067a288AKpqoVnUSuEqkQJpb3iANeDr4mhwGd1WTVkV/V7geomnHI5d0qp+0 S1Y9F5vkrsek2DwT5sFIyT00ObpDmygW+K2oDNpmAvpavVHo4/jsjIBzZDX5TQGGiV98 SoGfG7k4dIDvGNggccjnneSKYkAY0runNzB0MoaHyupFzQzuG3Y0wG/yYwmVPx0K2xHU /fu/y/NYj/ZTWdL8jwdJGNnS1K9xRT6wwBR5skaTVEUQ9pIM816h2HsM8ravpMK9mg65 0NJC36qP+9nwRUO2aEnDA9D98BOeo0YJHppiqegNyr8R9oOYI5rXsJccg46GoqOUmzdk 9oCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=JpxguvXn2vba0860MQ16rGYgc2sdw/YJkse0YpXOTyk=; b=WlLaQhSWeGQzP1nrQU8GygGcYNkqHKuACfoL0Mj5NCgLM3bZCQSHRmqtCQBaTv0nJO gMWRJBAcdRMarIncCjOvUzT6KGSx8s64nxcx6ji+6+lSLholtpgF6acH3UF40UMPvVyT Svqs1tsfWKNcWVZU3QfW9ohxTM68nWiQCeIN/oCKx3SgxT231S0cM8TGALBQck/KEYz7 F4H0LLRZvNfJYD3wsAuzSj5WsVxqu/NiHjGw71j+rLPbD0uqmVI0IKGios8ijsHbbfNz XmxmpxEyOfFgGKUOq9Urm9h0P5C5NmPGml+pbZ8TBxoKtMsTsoo0jh/MHYg0FR/l9w0D 1xUw== X-Gm-Message-State: AOAM530+vfHh779GnZrpxJlEU2K2FbVfAUUn+FRXGLl5qWWhidIz360O kvlsKqgq8GPLsOr2qpVTN40spfW0HTfQIg== X-Google-Smtp-Source: ABdhPJw2OxbojVFdqOBUFaLAYzNQVqgFw2jyxK/DN1trYzWRb1+usCFa0b7M6vQIGMONdZqjvY1WHQ== X-Received: by 2002:a9d:426:0:b0:5cb:5837:bfc0 with SMTP id 35-20020a9d0426000000b005cb5837bfc0mr8975406otc.305.1648423827955; Sun, 27 Mar 2022 16:30:27 -0700 (PDT) Received: from [192.168.0.12] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id c26-20020a4ae25a000000b0031c268c5436sm6043293oot.16.2022.03.27.16.30.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Mar 2022 16:30:27 -0700 (PDT) Message-ID: <69260dcc-5881-a3c5-c438-83919710d9f2@gmail.com> Date: Sun, 27 Mar 2022 20:30:30 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <1648423513-21261-1-git-send-email-lance.lmwang@gmail.com> From: James Almer In-Reply-To: <1648423513-21261-1-git-send-email-lance.lmwang@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH 1/4] avutil: add ambient viewing environment metadata side data 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 3/27/2022 8:25 PM, lance.lmwang@gmail.com wrote: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavutil/Makefile | 2 + > libavutil/ambient_viewing_env_metadata.c | 47 +++++++++++++++++++++ > libavutil/ambient_viewing_env_metadata.h | 72 ++++++++++++++++++++++++++++++++ > libavutil/frame.c | 1 + > libavutil/frame.h | 6 +++ > 5 files changed, 128 insertions(+) > create mode 100644 libavutil/ambient_viewing_env_metadata.c > create mode 100644 libavutil/ambient_viewing_env_metadata.h > > diff --git a/libavutil/Makefile b/libavutil/Makefile > index 81df3b0..e388d33 100644 > --- a/libavutil/Makefile > +++ b/libavutil/Makefile > @@ -26,6 +26,7 @@ HEADERS = adler32.h \ > display.h \ > dovi_meta.h \ > downmix_info.h \ > + ambient_viewing_env_metadata.h \ > encryption_info.h \ > error.h \ > eval.h \ > @@ -119,6 +120,7 @@ OBJS = adler32.o \ > display.o \ > dovi_meta.o \ > downmix_info.o \ > + ambient_viewing_env_metadata.o \ > encryption_info.o \ > error.o \ > eval.o \ > diff --git a/libavutil/ambient_viewing_env_metadata.c b/libavutil/ambient_viewing_env_metadata.c > new file mode 100644 > index 0000000..7006b64 > --- /dev/null > +++ b/libavutil/ambient_viewing_env_metadata.c > @@ -0,0 +1,47 @@ > +/** > + * Copyright (c) 2022 Limin Wang > + * > + * 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 > + */ > + > +#include > +#include > +#include "ambient_viewing_env_metadata.h" > +#include "mem.h" > + > +AVAmbientViewingEnvMetadata *av_ambient_viewing_env_metadata_alloc(size_t *size) > +{ > + AVAmbientViewingEnvMetadata *metadata = av_mallocz(sizeof(*metadata)); > + > + if (size) > + *size = sizeof(*metadata); > + > + return metadata; > +} > + > +AVAmbientViewingEnvMetadata *av_ambient_viewing_env_metadata_create_side_data(AVFrame *frame) > +{ > + AVFrameSideData *side_data = av_frame_new_side_data(frame, > + AV_FRAME_DATA_AMBIENT_VIEWING_ENV, > + sizeof(AVAmbientViewingEnvMetadata)); > + if (!side_data) > + return NULL; > + > + memset(side_data->data, 0, sizeof(AVAmbientViewingEnvMetadata)); > + > + return (AVAmbientViewingEnvMetadata *)side_data->data; > +} > diff --git a/libavutil/ambient_viewing_env_metadata.h b/libavutil/ambient_viewing_env_metadata.h > new file mode 100644 > index 0000000..b0fbcd0 > --- /dev/null > +++ b/libavutil/ambient_viewing_env_metadata.h > @@ -0,0 +1,72 @@ > +/* > + * Copyright (c) 2022 Limin Wang > + * > + * 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_AMBIENT_VIEWING_ENV_METADATA_H > +#define AVUTIL_AMBIENT_VIEWING_ENV_METADATA_H > + > +#include "frame.h" > + > + > +/** > + * The characteristics of the nominal ambient viewing environment for > + * the display of the associated video content. > + * To be used as payload of a AVFrameSideData the appropriate type. > + * > + * @note The struct should be allocated with av_ambient_viewing_env_metadata_alloc() > + * and its size is not a part of the public ABI. > + */ > +typedef struct AVAmbientViewingEnvMetadata { > + /** > + * specifies the environmental illuminance of the ambient viewing > + * environment in units of 0.0001 lux. > + * ambient_illuminance shall not be equal to 0. > + */ > + uint32_t ambient_illuminance; > + /** > + * specify the normalized x and y chromaticity coordinates, respectively, > + * of the environmental ambient light in the nominal viewing environment, > + * according to the CIE 1931 definition of x and y as specified in ISO > + * 11664-1 (see also ISO 11664-3 and CIE 15), in normalized increments of > + * 0.00002. The values of ambient_light_x and ambient_light_y shall be in > + * the range of 0 to 50 000 > + */ > + uint16_t ambient_light_x; > + uint16_t ambient_light_y; > +} AVAmbientViewingEnvMetadata; We don't need a new header for this. Just add it to mastering_display_metadata.h. The other structs there are based on other entries from the same spec (H.274) and have similar purposes. > + > +/** > + * Allocate an AVAmbientViewingEnvMetadata structure and set its fields to > + * default values. The resulting struct can be freed using av_freep(). > + * > + * @return An AVAmbientViewingEnvMetadata filled with default values or NULL > + * on failure. > + */ > +AVAmbientViewingEnvMetadata *av_ambient_viewing_env_metadata_alloc(size_t *size); > + > +/** > + * Allocate a complete AVAmbientViewingEnvMetadata and add it to the frame. > + * > + * @param frame The frame which side data is added to. > + * > + * @return The AVAmbientViewingEnvMetadata structure to be filled by caller. > + */ > +AVAmbientViewingEnvMetadata *av_ambient_viewing_env_metadata_create_side_data(AVFrame *frame); > + > +#endif /* AVUTIL_AMBIENT_VIEWING_ENV_METADATA_H */ > diff --git a/libavutil/frame.c b/libavutil/frame.c > index fbb869f..8882da2 100644 > --- a/libavutil/frame.c > +++ b/libavutil/frame.c > @@ -815,6 +815,7 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type) > case AV_FRAME_DATA_DETECTION_BBOXES: return "Bounding boxes for object detection and classification"; > case AV_FRAME_DATA_DOVI_RPU_BUFFER: return "Dolby Vision RPU Data"; > case AV_FRAME_DATA_DOVI_METADATA: return "Dolby Vision Metadata"; > + case AV_FRAME_DATA_AMBIENT_VIEWING_ENV: return "Ambient Viewing Environment"; > } > return NULL; > } > diff --git a/libavutil/frame.h b/libavutil/frame.h > index 33fac20..f7b1d4e 100644 > --- a/libavutil/frame.h > +++ b/libavutil/frame.h > @@ -209,6 +209,12 @@ enum AVFrameSideDataType { > * volume transform - CUVA 005.1-2021. > */ > AV_FRAME_DATA_DYNAMIC_HDR_VIVID, > + > + /** > + * ambient viewing environment for a video frame, as described by > + * the AVAmbientViewingEnvMetadata. > + */ > + AV_FRAME_DATA_AMBIENT_VIEWING_ENV, > }; > > enum AVActiveFormatDescription { _______________________________________________ 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".