From patchwork Wed Jun 26 23:12:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 50179 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:bc92:0:b0:482:c625:d099 with SMTP id p18csp132139vqy; Wed, 26 Jun 2024 16:13:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVf5YBA3SrbHh9a6hK0rZA1cIyL6Xx0D/0Mh18pMZYgz45ECBws04lONfMEHjbooRYnU/PNrpLpDpyH9T0A7ouGjny0vPTw+88i0g== X-Google-Smtp-Source: AGHT+IGRdJaJ7GcbUZ19+eE1z65TcdWF5cHP9JC39BzLXqVYx3U0YQjUMlX27Dhaj3gIb2KOk/rT X-Received: by 2002:a05:6512:2389:b0:52c:d617:f4da with SMTP id 2adb3069b0e04-52ce0620276mr12069207e87.41.1719443594288; Wed, 26 Jun 2024 16:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719443594; cv=none; d=google.com; s=arc-20160816; b=IJH8yMqOk78WuVZDZQZ73lvbvELoxmGh+NMQJPrlYGbq/PkG1VqDj0rhkgnrcds0uO wcbl5FwmyAUpPO5pKi8oUj4+XawYwJR2BHyEv5yXzANXR4K83s9OjD7+ZkWiA74G2s3q xf0e9wdpUj4P3dEnUw3kjLzJSoj6+LjNjZsPtR5ILpa8Pt8LvSgPVR2bWjAiPRnO5AmG jqkVBTMMyOtp6IHCraDr5SGiR+3rkep6NPXOJRpVymLNAXMEE+8zGkKFxOAPCN5Hd+2s O/gDeWRCHpL19wdt7eksEvV7tuj5pd4kuyjcd+V88Dfkcvpv8hG6wKypfY1/9dKtg/T9 L0Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=Q+jQF5nYW81ZLiuIdFnEFVrCSkqI/nEUEqxYNCm9vzc=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=YJ7uu82IKqoovNbHtL8yvIWrHjxDr9MpIalWR7kei4+CRRLsXmqONkHDRRDA/i9zT+ 8sarpVJdUXlhbsYfra3vNbmScLeiaZNUIMhCYsxiVDEd9oIvgO3iGzsNnrNy0fGaj38g yDGGin9f8bHWc7umzLdCnOyEAbXhSK965Nj6dlf9lKr0NLrilgBZaCxCxOCZok4gvDwQ QPRbn3Y9Xpg5n4VqZ7A/aq0sdpbzSkn7jHwCZdCjMkypS62cGOaBSNytZQnEzIbC6guL a0Y6Iwug2WcYYeEw3FKC7gDkjvx/eynDHzGAQ/wMdUZjQK8mdafFQ+FQiheoMZXkdXgK Ib2w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="BQbmF/ow"; 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 a640c23a62f3a-a729d82afbfsi1096366b.993.2024.06.26.16.13.13; Wed, 26 Jun 2024 16:13:14 -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=@gmail.com header.s=20230601 header.b="BQbmF/ow"; 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 68BC868D699; Thu, 27 Jun 2024 02:13:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 03CEA68CE0E for ; Thu, 27 Jun 2024 02:12:56 +0300 (EEST) Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1f480624d0fso58075625ad.1 for ; Wed, 26 Jun 2024 16:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719443573; x=1720048373; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=lLHv81AEnGkwECU4uLZq8QfOEslugkejr3sXxy06taU=; b=BQbmF/owdc0cyat3gUIWb60/V6q0FytEYRO8Av865KEaPUqO7+Z3rGYphHCeQrC7HZ tDscuQmmcJxQ/aMe6H9Cc+DFa5yXgRv02aEuWL2qi9t5Cgn9fEIsg+lfDgLV0bemqWz4 LVDzVApWCQ9GVmzJpKHbOSNt6DUHEhtriKOpSjkMSZGGw6oFqRGpHuLsXa8p9/LQwsez v0+OP+lgQxLHsBmk/l60ZpbmmT0MoGyqsZSylUdjiENvYKU/Ygpw0Tsb+XniA/2VETan vkSG9vPJpkfPyeJQ/HZNAtf3R0f0x25PbJA+DC1tTCCQhPrygrzv5JgE95SMfSHmhLlj NICg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719443573; x=1720048373; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lLHv81AEnGkwECU4uLZq8QfOEslugkejr3sXxy06taU=; b=wTgGz2eSqAy2hImImXqxPZmArb4k2QQLU7QlXk2t+8VqpUPBs4KiunHbEazW/OOBT4 S+HrJk7+hBOcGhilA3lZPaWMfsL4ps9YpFQyrm8hcEHlG/hxVno1qrGd9CwjIESGfdPn 6DB4pkhXXNzIoEol3BvU5jgPEBjp0KPLsbMhPCMLRtQmeD0UZOfsYwZzSsMYar+FEqSw Da3T15ix2Z6FUmfCFhUL/om7gvsOurx3/uVFIVgNMOTUmYRUYKmmWO6YHHliyeW+risJ 0na7MOOCOHc4cITYhro6swgsLcESsEaQIc3FiHjjNgYxYJbHoUXmbwLA9Ql0KNLJbUq2 Y2nw== X-Gm-Message-State: AOJu0Ywb/vl6AmdM+Zgce2mlKjE7je31N8HhfzfU4tqbWTkoMoEtJn+o vGMdJ/7WewBcSU3idUg3Yd69eQaD+7xbtRyiUFtPNxe9tGF43Iikd38HxA== X-Received: by 2002:a17:903:230b:b0:1f9:c289:7378 with SMTP id d9443c01a7336-1fa23fe27damr140945985ad.33.1719443573109; Wed, 26 Jun 2024 16:12:53 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1faac8f25a1sm384995ad.73.2024.06.26.16.12.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 16:12:52 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Wed, 26 Jun 2024 20:12:58 -0300 Message-ID: <20240626231259.10788-2-jamrial@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240626231259.10788-1-jamrial@gmail.com> References: <20240626231259.10788-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/cbs_h266: move decoded_picture_hash to CBS SEI 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: dlEABRIgdERx It's defined in H.274 as a common SEI message type and not in H.266 Signed-off-by: James Almer --- libavcodec/cbs_h2645.c | 12 ++++++------ libavcodec/cbs_h266.h | 10 ---------- libavcodec/cbs_h266_syntax_template.c | 28 --------------------------- libavcodec/cbs_sei.h | 10 ++++++++++ libavcodec/cbs_sei_syntax_template.c | 28 +++++++++++++++++++++++++++ 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index 283925f937..5ec781ddab 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -2134,6 +2134,12 @@ static const SEIMessageTypeDescriptor cbs_sei_common_types[] = { sizeof(SEIRawFramePackingArrangement), SEI_MESSAGE_RW(sei, frame_packing_arrangement), }, + { + SEI_TYPE_DECODED_PICTURE_HASH, + 0, 1, + sizeof(SEIRawDecodedPictureHash), + SEI_MESSAGE_RW(sei, decoded_picture_hash), + }, { SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME, 1, 0, @@ -2272,12 +2278,6 @@ static const SEIMessageTypeDescriptor cbs_sei_h265_types[] = { }; static const SEIMessageTypeDescriptor cbs_sei_h266_types[] = { - { - SEI_TYPE_DECODED_PICTURE_HASH, - 0, 1, - sizeof(H266RawSEIDecodedPictureHash), - SEI_MESSAGE_RW(h266, sei_decoded_picture_hash), - }, SEI_MESSAGE_TYPE_END }; diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 5f12915b65..d24a8e9313 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -848,16 +848,6 @@ typedef struct H266RawSlice { int data_bit_start; } H266RawSlice; -typedef struct H266RawSEIDecodedPictureHash { - uint8_t dph_sei_hash_type; - uint8_t dph_sei_single_component_flag; - uint8_t dph_sei_picture_md5[3][16]; - uint16_t dph_sei_picture_crc[3]; - uint32_t dph_sei_picture_checksum[3]; - - uint8_t dph_sei_reserved_zero_7bits; -} H266RawSEIDecodedPictureHash; - typedef struct H266RawSEI { H266RawNALUnitHeader nal_unit_header; SEIRawMessageList message_list; diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 34b766c7af..9c37996947 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3442,34 +3442,6 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, return 0; } -SEI_FUNC(sei_decoded_picture_hash, (CodedBitstreamContext *ctx, - RWContext *rw, - H266RawSEIDecodedPictureHash *current, - SEIMessageState *unused)) -{ - int err, c_idx, i; - - HEADER("Decoded Picture Hash"); - - u(8, dph_sei_hash_type, 0, 2); - flag(dph_sei_single_component_flag); - ub(7, dph_sei_reserved_zero_7bits); - - for (c_idx = 0; c_idx < (current->dph_sei_single_component_flag ? 1 : 3); - c_idx++) { - if (current->dph_sei_hash_type == 0) { - for (i = 0; i < 16; i++) - us(8, dph_sei_picture_md5[c_idx][i], 0x00, 0xff, 2, c_idx, i); - } else if (current->dph_sei_hash_type == 1) { - us(16, dph_sei_picture_crc[c_idx], 0x0000, 0xffff, 1, c_idx); - } else if (current->dph_sei_hash_type == 2) { - us(32, dph_sei_picture_checksum[c_idx], 0x00000000, 0xffffffff, 1, - c_idx); - } - } - return 0; -} - static int FUNC(sei) (CodedBitstreamContext *ctx, RWContext *rw, H266RawSEI *current, int prefix) { diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h index cc7d6f797d..15ef3415ab 100644 --- a/libavcodec/cbs_sei.h +++ b/libavcodec/cbs_sei.h @@ -63,6 +63,16 @@ typedef struct SEIRawFramePackingArrangement { uint8_t fp_upsampled_aspect_ratio_flag; } SEIRawFramePackingArrangement; +typedef struct SEIRawDecodedPictureHash { + uint8_t dph_sei_hash_type; + uint8_t dph_sei_single_component_flag; + uint8_t dph_sei_picture_md5[3][16]; + uint16_t dph_sei_picture_crc[3]; + uint32_t dph_sei_picture_checksum[3]; + + uint8_t dph_sei_reserved_zero_7bits; +} SEIRawDecodedPictureHash; + typedef struct SEIRawMasteringDisplayColourVolume { uint16_t display_primaries_x[3]; uint16_t display_primaries_y[3]; diff --git a/libavcodec/cbs_sei_syntax_template.c b/libavcodec/cbs_sei_syntax_template.c index 03ef9ab473..0205bb47aa 100644 --- a/libavcodec/cbs_sei_syntax_template.c +++ b/libavcodec/cbs_sei_syntax_template.c @@ -128,6 +128,34 @@ SEI_FUNC(frame_packing_arrangement, (CodedBitstreamContext *ctx, RWContext *rw, return 0; } +SEI_FUNC(decoded_picture_hash, (CodedBitstreamContext *ctx, + RWContext *rw, + SEIRawDecodedPictureHash *current, + SEIMessageState *unused)) +{ + int err, c_idx, i; + + HEADER("Decoded Picture Hash"); + + u(8, dph_sei_hash_type, 0, 2); + flag(dph_sei_single_component_flag); + ub(7, dph_sei_reserved_zero_7bits); + + for (c_idx = 0; c_idx < (current->dph_sei_single_component_flag ? 1 : 3); + c_idx++) { + if (current->dph_sei_hash_type == 0) { + for (i = 0; i < 16; i++) + us(8, dph_sei_picture_md5[c_idx][i], 0x00, 0xff, 2, c_idx, i); + } else if (current->dph_sei_hash_type == 1) { + us(16, dph_sei_picture_crc[c_idx], 0x0000, 0xffff, 1, c_idx); + } else if (current->dph_sei_hash_type == 2) { + us(32, dph_sei_picture_checksum[c_idx], 0x00000000, 0xffffffff, 1, + c_idx); + } + } + return 0; +} + SEI_FUNC(mastering_display_colour_volume, (CodedBitstreamContext *ctx, RWContext *rw, SEIRawMasteringDisplayColourVolume *current,