From patchwork Mon Feb 14 23:44:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 34295 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:14aa:0:0:0:0 with SMTP id bz10csp5960234nkb; Mon, 14 Feb 2022 15:44:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/VXf5FXngOlMSIDZM2Cuwa5Ydx5sCJslYj48mfnqQkQMvaSLy0SydC06w6cTEgWUU6Pcu X-Received: by 2002:a17:907:ea0:: with SMTP id ho32mr892553ejc.147.1644882289721; Mon, 14 Feb 2022 15:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644882289; cv=none; d=google.com; s=arc-20160816; b=vFDxUy2TvJX/YpFiRf+HblisOAEmcwJB7Udr1jGFIehv/AJbTytJQPYjLTpv2Xw7dG Ny8kbRQ+orpyGfR9heJuIFfvTWfWbrz290IhnvsiSLM38hwZdM1ttTulEOxwOu08hYFi rqUcBMlACkTTtwCZzVqfDX5ipw6qng5pAuv1p6pTRlazNaFLe6BFLwyn3cUDYl/mQUd9 dFHBg0Vhdw716R+eH02ki3pxU7jqtDq6ZOvHcLcJsPbWDN9Pssc8aq7R+ddJzgspLFBx nL7vj+btFeOE+k4IUmUOaapSaL+9tvPail3l7PIEUC7UT5eYi80TpL0cLmbySN/uOJng HY0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=CFOHuAVPGaUrX8AuBl+pdpv3jL+HNYTnE5OZx8hWvnc=; b=TC/9J2vDNSkdnxMTE9bAusGsiozzJzn13X+ysInu1R5jAFWs8zLpBT+DnneFFR7o2L V54QM97eIJLstFHdTprGxcNWP38vmRa/yTXXdJ6tFePAWJKGHQ2xxIbeoCrj7v21KVcr rAWT0sb3/dnlnFOTXuIL0sB/Px0WjK8kwYA3y8ODmb0LKiCM2V1Vb+sfI9Hyxv8TTASh dFVxvC7hs38UOxuZ7aA6VRS/onXuQhGgj8vrf8ltmWIacGLCn+mKa+f8SNWgjdof4amx kE9g1OICTb+N3pDGrY8BA4j4rDRocaM9zgzMjxfe/jtrWYrTd/bCEqM+PmZ2HXC+jVqc t8NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=jZVjYrka; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r7si1832316edd.171.2022.02.14.15.44.49; Mon, 14 Feb 2022 15:44:49 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=jZVjYrka; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 422B068B1D4; Tue, 15 Feb 2022 01:44:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8BB0268AEDA for ; Tue, 15 Feb 2022 01:44:28 +0200 (EET) Received: by mail-pf1-f170.google.com with SMTP id l19so26103193pfu.2 for ; Mon, 14 Feb 2022 15:44:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z5To2RKiLWhoKESbOQdTp+91LE+b5R756qyG0F/4YbM=; b=jZVjYrkaxPB7WHbteu6Ygj/e01q4VkXFlwNljqhRe1gv1Yg6iGK/dT/EiCYWekb2A3 FGPFh+5m2O0QjhZH0nmZkb+hVoxmqwOQxUF1vMryAqSHMYFqQsqCsi6XFaPyWagLNTBG AjUfnzdt7r3B1ToMMSDfLsofH0vc4/damepQ5mQkzXwiyyUE4yC4ToxkNYl9n/9IpPOB lKqxr7Cw0ytigKuo6M3PO38N4UgV45PtMsUkfJVhGbqzJ5hGRtgG3Gyc8cyrwAzfFwLP kCsCfBSvSZCnqhBJ1W5zAxkypUfE2Yc6Orw3LMXT3GlsUB1x+x+9CtPuUjiHWbLZJJ5v z/ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z5To2RKiLWhoKESbOQdTp+91LE+b5R756qyG0F/4YbM=; b=TG9UyBY8K5Kjh5SuiZL2swtzRlX4U/nUaUct4mhzycjc/qZeqL1cAeO8taa012r0yq lDt1zguPDaYMSmVRFmpmsCfEQl+2rzAyJaamqrQ/8haO+Q8L4THdOBHxY34qO3s9j1Sd UdPxXMUfN+dyTZcL85WndLcVu9pXgda2zJJSajvXAZi7DFF386d7x4GRai/2lUmn0Xgw RacDNl5QrMs+DTdralYm4P+2x/hUezh9jhxbxwJFTcYcuaiJ4TbWLUhmKySKCc4inHQ9 DuX+xW9g+ALhFcV2TngwjKQk6FKMLJxxW1BQjyTVKpz3mMHsVtn8jbz5nwAQdqtqxdkR o6NQ== X-Gm-Message-State: AOAM531bDtUUXcaXXCuSkICyaDuETB6UitsACX4xYch9iDsZcxWDgMlg +PhvF7SiXOUDuNfY6k5KDY4+2kjnNKY= X-Received: by 2002:a63:6f45:: with SMTP id k66mr1205484pgc.511.1644882266532; Mon, 14 Feb 2022 15:44:26 -0800 (PST) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id mi7sm492304pjb.21.2022.02.14.15.44.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Feb 2022 15:44:26 -0800 (PST) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 15 Feb 2022 07:44:18 +0800 Message-Id: <1644882260-8559-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1644882260-8559-1-git-send-email-lance.lmwang@gmail.com> References: <1644882260-8559-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/4] avcodec: support for CUVA HDR Vivid metadata 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: SrcYjcfUmod3 From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/Makefile | 2 +- libavcodec/dynamic_hdr_vivid.c | 139 +++++++++++++++++++++++++++++++++++++++++ libavcodec/dynamic_hdr_vivid.h | 35 +++++++++++ libavcodec/hevc_sei.c | 48 +++++++++++++- libavcodec/hevc_sei.h | 5 ++ libavcodec/hevcdec.c | 15 +++++ 6 files changed, 241 insertions(+), 3 deletions(-) create mode 100644 libavcodec/dynamic_hdr_vivid.c create mode 100644 libavcodec/dynamic_hdr_vivid.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index cfc70a3..1910137 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -96,7 +96,7 @@ OBJS-$(CONFIG_H264PARSE) += h264_parse.o h2645_parse.o h264_ps.o OBJS-$(CONFIG_H264PRED) += h264pred.o OBJS-$(CONFIG_H264QPEL) += h264qpel.o OBJS-$(CONFIG_HEVCPARSE) += hevc_parse.o h2645_parse.o hevc_ps.o hevc_sei.o hevc_data.o \ - dynamic_hdr10_plus.o + dynamic_hdr10_plus.o dynamic_hdr_vivid.o OBJS-$(CONFIG_HPELDSP) += hpeldsp.o OBJS-$(CONFIG_HUFFMAN) += huffman.o OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o diff --git a/libavcodec/dynamic_hdr_vivid.c b/libavcodec/dynamic_hdr_vivid.c new file mode 100644 index 0000000..7d0bd43 --- /dev/null +++ b/libavcodec/dynamic_hdr_vivid.c @@ -0,0 +1,139 @@ +/* + * 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 "dynamic_hdr_vivid.h" +#include "get_bits.h" + +static const int32_t maxrgb_den = 4095; +static const int32_t color_saturation_gain_den = 128; +static const int32_t maximum_luminance_den = 4095; +static const int32_t base_param_m_p_den = 16383; +static const int32_t base_param_m_m_den = 10; +static const int32_t base_param_m_a_den = 1023; +static const int32_t base_param_m_b_den = 1023; +static const int32_t base_param_m_n_den = 10; +static const int32_t base_param_Delta_den = 127; + +int ff_parse_itu_t_t35_to_dynamic_hdr_vivid(AVDynamicHDRVivid *s, const uint8_t *data, + int size) +{ + GetBitContext gbc, *gb = &gbc; + int ret; + + if (!s) + return AVERROR(ENOMEM); + + ret = init_get_bits8(gb, data, size); + if (ret < 0) + return ret; + + if (get_bits_left(gb) < 8) + return AVERROR_INVALIDDATA; + + s->system_start_code = get_bits(gb, 8); + if (s->system_start_code == 0x01) { + s->num_windows = 1; + + if (get_bits_left(gb) < 12 * 4 * s->num_windows) + return AVERROR_INVALIDDATA; + for (int w = 0; w < s->num_windows; w++) { + AVHDRVividColorTransformParams *params = &s->params[w]; + + params->minimum_maxrgb = (AVRational){get_bits(gb, 12), maxrgb_den}; + params->average_maxrgb = (AVRational){get_bits(gb, 12), maxrgb_den}; + params->variance_maxrgb = (AVRational){get_bits(gb, 12), maxrgb_den}; + params->maximum_maxrgb = (AVRational){get_bits(gb, 12), maxrgb_den}; + } + + if (get_bits_left(gb) < 2 * s->num_windows) + return AVERROR_INVALIDDATA; + for (int w = 0; w < s->num_windows; w++) { + AVHDRVividColorTransformParams *params = &s->params[w]; + + params->tone_mapping_mode_flag = get_bits(gb, 1); + if (params->tone_mapping_mode_flag) { + if (get_bits_left(gb) < 1 ) + return AVERROR_INVALIDDATA; + params->tone_mapping_param_num = get_bits(gb, 1) + 1; + for (int i = 0; i < params->tone_mapping_param_num; i++) { + AVHDRVividColorToneMappingParams *tm_params = ¶ms->tm_params[i]; + + if (get_bits_left(gb) < 13) + return AVERROR_INVALIDDATA; + tm_params->targeted_system_display_maximum_luminance = (AVRational){get_bits(gb, 12), maximum_luminance_den}; + tm_params->base_enable_flag = get_bits(gb, 1); + if (tm_params->base_enable_flag) { + if (get_bits_left(gb) < (14 + 6 + 10 + 10 + 6 + 8 + 10)) + return AVERROR_INVALIDDATA; + tm_params->base_param_m_p = (AVRational){get_bits(gb, 14), base_param_m_p_den}; + tm_params->base_param_m_m = (AVRational){get_bits(gb, 6), base_param_m_m_den}; + tm_params->base_param_m_a = (AVRational){get_bits(gb, 10), base_param_m_a_den}; + tm_params->base_param_m_b = (AVRational){get_bits(gb, 10), base_param_m_b_den}; + tm_params->base_param_m_n = (AVRational){get_bits(gb, 6), base_param_m_n_den}; + tm_params->base_param_k1 = get_bits(gb, 2); + tm_params->base_param_k2 = get_bits(gb, 2); + tm_params->base_param_k3 = get_bits(gb, 4); + tm_params->base_param_Delta_enable_mode = get_bits(gb, 3); + if (tm_params->base_param_Delta_enable_mode == 2 || tm_params->base_param_Delta_enable_mode == 6) + tm_params->base_param_Delta = (AVRational){-get_bits(gb, 7), base_param_Delta_den}; + else + tm_params->base_param_Delta = (AVRational){get_bits(gb, 7), base_param_Delta_den}; + + if (get_bits_left(gb) < 1) + return AVERROR_INVALIDDATA; + tm_params->three_Spline_flag = get_bits(gb, 1); + if (tm_params->three_Spline_flag) { + if (get_bits_left(gb) < 1 + tm_params->three_Spline_num * (2 + 12 + 28 + 1)) + return AVERROR_INVALIDDATA; + tm_params->three_Spline_num = get_bits(gb, 1) + 1; + for (int j = 0; j < tm_params->three_Spline_num; j++) { + tm_params->three_Spline_TH_mode = get_bits(gb, 2); + if (tm_params->three_Spline_TH_mode == 0 || tm_params->three_Spline_TH_mode == 2) { + if (get_bits_left(gb) < 8) + return AVERROR_INVALIDDATA; + tm_params->three_Spline_TH_enable_MB = (AVRational){get_bits(gb, 8), 255}; + } + tm_params->three_Spline_TH = (AVRational){get_bits(gb, 12), 4095}; + tm_params->three_Spline_TH_Delta1 = (AVRational){get_bits(gb, 10), 1023}; + tm_params->three_Spline_TH_Delta2 = (AVRational){get_bits(gb, 10), 1023}; + tm_params->three_Spline_enable_Strength = (AVRational){get_bits(gb, 8), 255}; + } + } else { + tm_params->three_Spline_num = 1; + tm_params->three_Spline_TH_mode = 0; + } + + } + } + } + + params->color_saturation_mapping_flag = get_bits(gb, 1); + if (params->color_saturation_mapping_flag) { + if (get_bits_left(gb) < 3 + params->color_saturation_num * 8) + return AVERROR_INVALIDDATA; + + params->color_saturation_num = get_bits(gb, 3); + for (int i = 0; i < params->color_saturation_num; i++) { + params->color_saturation_gain[i] = (AVRational){get_bits(gb, 8), color_saturation_gain_den}; + } + } + } + } + + return 0; +} diff --git a/libavcodec/dynamic_hdr_vivid.h b/libavcodec/dynamic_hdr_vivid.h new file mode 100644 index 0000000..d521b3d --- /dev/null +++ b/libavcodec/dynamic_hdr_vivid.h @@ -0,0 +1,35 @@ +/* + * 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 AVCODEC_DYNAMIC_HDR_VIVID_H +#define AVCODEC_DYNAMIC_HDR_VIVID_H + +#include "libavutil/hdr_dynamic_vivid_metadata.h" + +/** + * Parse the user data registered ITU-T T.35 to AVbuffer (AVDynamicHDRVivid). + * @param s A pointer containing the decoded AVDynamicHDRVivid structure. + * @param data The byte array containing the raw ITU-T T.35 data. + * @param size Size of the data array in bytes. + * + * @return 0 if succeed. Otherwise, returns the appropriate AVERROR. + */ +int ff_parse_itu_t_t35_to_dynamic_hdr_vivid(AVDynamicHDRVivid *s, const uint8_t *data, + int size); + +#endif /* AVCODEC_DYNAMIC_HDR_VIVID_H */ diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index 7fd8226..ec3036f 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -24,6 +24,7 @@ #include "atsc_a53.h" #include "dynamic_hdr10_plus.h" +#include "dynamic_hdr_vivid.h" #include "golomb.h" #include "hevc_ps.h" #include "hevc_sei.h" @@ -245,6 +246,34 @@ static int decode_registered_user_data_dynamic_hdr_plus(HEVCSEIDynamicHDRPlus *s return 0; } +static int decode_registered_user_data_dynamic_hdr_vivid(HEVCSEIDynamicHDRVivid *s, + GetBitContext *gb, int size) +{ + size_t meta_size; + int err; + AVDynamicHDRVivid *metadata = av_dynamic_hdr_vivid_alloc(&meta_size); + if (!metadata) + return AVERROR(ENOMEM); + + err = ff_parse_itu_t_t35_to_dynamic_hdr_vivid(metadata, + gb->buffer + get_bits_count(gb) / 8, size); + if (err < 0) { + av_free(metadata); + return err; + } + + av_buffer_unref(&s->info); + s->info = av_buffer_create((uint8_t *)metadata, meta_size, NULL, NULL, 0); + if (!s->info) { + av_free(metadata); + return AVERROR(ENOMEM); + } + + skip_bits_long(gb, size * 8); + + return 0; +} + static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitContext *gb, void *logctx, int size) { @@ -263,9 +292,9 @@ static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte size--; } - if (country_code != 0xB5) { // usa_country_code + if (country_code != 0xB5 && country_code != 0x26) { // usa_country_code and cn_country_code av_log(logctx, AV_LOG_VERBOSE, - "Unsupported User Data Registered ITU-T T35 SEI message (country_code = %d)\n", + "Unsupported User Data Registered ITU-T T35 SEI message (country_code = 0x%x)\n", country_code); goto end; } @@ -273,6 +302,20 @@ static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte provider_code = get_bits(gb, 16); switch (provider_code) { + case 0x04: { // cuva_provider_code + const uint16_t cuva_provider_oriented_code = 0x0005; + uint16_t provider_oriented_code; + + if (size < 2) + return AVERROR_INVALIDDATA; + size -= 2; + + provider_oriented_code = get_bits(gb, 16); + if (provider_oriented_code == cuva_provider_oriented_code) { + return decode_registered_user_data_dynamic_hdr_vivid(&s->dynamic_hdr_vivid, gb, size); + } + break; + } case 0x3C: { // smpte_provider_code // A/341 Amendment - 2094-40 const uint16_t smpte2094_40_provider_oriented_code = 0x0001; @@ -559,4 +602,5 @@ void ff_hevc_reset_sei(HEVCSEI *s) s->unregistered.nb_buf_ref = 0; av_freep(&s->unregistered.buf_ref); av_buffer_unref(&s->dynamic_hdr_plus.info); + av_buffer_unref(&s->dynamic_hdr_vivid.info); } diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h index ac8c61c..f198402 100644 --- a/libavcodec/hevc_sei.h +++ b/libavcodec/hevc_sei.h @@ -78,6 +78,10 @@ typedef struct HEVCSEIDynamicHDRPlus { AVBufferRef *info; } HEVCSEIDynamicHDRPlus; +typedef struct HEVCSEIDynamicHDRVivid { + AVBufferRef *info; +} HEVCSEIDynamicHDRVivid; + typedef struct HEVCSEIContentLight { int present; uint16_t max_content_light_level; @@ -139,6 +143,7 @@ typedef struct HEVCSEI { HEVCSEIUnregistered unregistered; HEVCSEIMasteringDisplay mastering_display; HEVCSEIDynamicHDRPlus dynamic_hdr_plus; + HEVCSEIDynamicHDRVivid dynamic_hdr_vivid; HEVCSEIContentLight content_light; int active_seq_parameter_set_id; HEVCSEIAlternativeTransfer alternative_transfer; diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 1d4ad42..068750d 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2984,6 +2984,17 @@ static int set_side_data(HEVCContext *s) if ((ret = ff_dovi_attach_side_data(&s->dovi_ctx, out)) < 0) return ret; + if (s->sei.dynamic_hdr_vivid.info) { + AVBufferRef *info_ref = av_buffer_ref(s->sei.dynamic_hdr_vivid.info); + if (!info_ref) + return AVERROR(ENOMEM); + + if (!av_frame_new_side_data_from_buf(out, AV_FRAME_DATA_DYNAMIC_HDR_VIVID, info_ref)) { + av_buffer_unref(&info_ref); + return AVERROR(ENOMEM); + } + } + return 0; } @@ -3777,6 +3788,10 @@ static int hevc_update_thread_context(AVCodecContext *dst, if (ret < 0) return ret; + ret = av_buffer_replace(&s->sei.dynamic_hdr_vivid.info, s0->sei.dynamic_hdr_vivid.info); + if (ret < 0) + return ret; + s->sei.frame_packing = s0->sei.frame_packing; s->sei.display_orientation = s0->sei.display_orientation; s->sei.mastering_display = s0->sei.mastering_display;