From patchwork Fri May 17 13:42:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 48950 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a48:b0:1af:fc2d:ff5a with SMTP id zu8csp2886780pzb; Fri, 17 May 2024 06:43:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWtj/UU7f8g4a2zJ8F+bW51seOyKfCg7Vv+MMiUm3CkC9Ih+/UqmACZYcwImPdWbCAvuQ+3vHfCaptAXXWN1jHCdPao4+i/PtS4AQ== X-Google-Smtp-Source: AGHT+IFAd18gw118eeRb9pYsvZ2jqXTc2g8YCGUyboxmMSzG+mmqDZtfTugavJNsTOz2mi76466e X-Received: by 2002:a17:907:1b28:b0:a5a:5f31:7663 with SMTP id a640c23a62f3a-a5a5f31777bmr1329422566b.56.1715953412465; Fri, 17 May 2024 06:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715953412; cv=none; d=google.com; s=arc-20160816; b=ej1hpU5b8py6RPzg3k4w8LLpwdEnKkAR+czU8+tF3e/5WY84gtis2BO5VDNqiU5YD5 SDFwIidx2itrpngmuA5cwlj05NZKwgK8rXzIvA+f02RzxRjdLGL23XrZndc/HmONQN3b w/hwBKm5foIvOPU9tfrLg7+iDBJ5l5/uxIcDn5jUN+oqec1bXHiH2JO5NFiDjJuy014H ehzl1xmBzIoTv6tnqP7vA0ZvmNgsuiNdDhcBMF02X45JcgUuJiKpDMTN+VfP3pmODjur d0p9t02RU0o7KjcEnxDFQ9Jf7QmQ/o+oSFZ9+/DsEgaMkswPGSIpyYappfxCSAj3Jmkd +60A== 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=+tbVXcWnHwoWMegZJrRZSFxDBW9y7GiPGS+LdDG6dps=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=gAgjir/kXCF4t3rcLPG3O7r0ZFE7QmrveKK+o+Gw1L4Yvbp9VDLvyjcGGE5bCzYQL0 llCsdZTIaa9okz0qQ/viZfK8nygLTOcdJBSHOgHUQ9MWGeTgahpOQc0cnPdHQydJaH5P HfuryOgYaOV88ks89VVZctHg8pJawsnbUnusknKrtxJHfPCYd8wsvJhYIHxwk91Sc7Nu /EYlE1ummiAt/Sa7kzMYNWz9zLTimfo6jWIe127cs5Ac/xPSGCs23zStuE9G1SxsESV1 IcNNSs735ECbg05kOV+4A6tSxbP3oJznZYGiZ5qAnbdj9AVSyekUE5710AdQ4qorQiEN 0Y/w==; 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=RU4FiThQ; 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-a5a1b602bcbsi983702166b.489.2024.05.17.06.43.32; Fri, 17 May 2024 06:43:32 -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=RU4FiThQ; 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 61B6D68D306; Fri, 17 May 2024 16:43:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C14C668D1C4 for ; Fri, 17 May 2024 16:43:11 +0300 (EEST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1ed012c1afbso4895905ad.1 for ; Fri, 17 May 2024 06:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715953389; x=1716558189; 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=DaETZOxei8smchKrH3w5q3mVO+rUiSeBadcPAMIAe+s=; b=RU4FiThQ2pRUN89+vhkSHMTO4WFsgzIPTpAjOLLMFXSXT+kdHIA85Gpfm1u0AiifjX QfY1TKhIW89b9dmD7dE9NpMurH3FaM/46+oPUo/x85CrZVTNSOv3I/v6a3SxEMo/2NxB gfW0Bleb7iXmZorjSIdrjteB2+JnlGf2FkxCM5EdqRgD8MNnZLHEVW1kVM8NHIRy5BL6 E7xDndfwwLyCjljJoAYaRE1rjbALs0tZOQrhcVUJzJ0UxI7BJ5QWNb+10nv72wz6bFuU y1Iywmj5qQ//cIcLAB8Pea85ZpRwLRn7tLanxxAzp4rRYRf7xPycT9vFYzJ8tCha9n+O MyTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715953389; x=1716558189; 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=DaETZOxei8smchKrH3w5q3mVO+rUiSeBadcPAMIAe+s=; b=YLn2u6tSmsRhnOJrycgQVWUFagSU/pCpxOMjPfr3q1gSA3RwKQDb7dexHIm11tWiiV oCtLsCg5ksmgme6T33Dw7gu9+Ap5cRUzvGPYzNM5x3lBl+aAlTdF1rJFzck/PbbYmBMF 5P1D63VThWQn4a1bkXuKSrwN+ZrYejDBjiH8Op/rtiHem7tUrlZD3QkywECtlxGNRpRj jJl1Y91VxUmHlxP44UmNeh5eZXqQkTyuK8Cu9tkMYFwYGzZbURe8OUd3hhsSeLWcwwbS Gby1dVAzjgFZUzQeolkOrC+ii39MNmg5L4ndtSYPzBcql6aSGnbXKRWw6MZ4DaLRumNU gULQ== X-Gm-Message-State: AOJu0YxBzrvFBhyty3A6b0JHrCIaxRz/Eq1xpJah1VhnTq03C2wCpAWj CZQ/Y9QvPvgdfbkSoxaP8iHuFPTNHS+VMJS0Jy3cmakB2zkuMD5x3af8JQ== X-Received: by 2002:a17:903:2442:b0:1f0:9994:ff5f with SMTP id d9443c01a7336-1f09995037emr75776565ad.12.1715953389436; Fri, 17 May 2024 06:43:09 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0b9d15dfsm157145935ad.62.2024.05.17.06.43.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 06:43:08 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Fri, 17 May 2024 10:42:27 -0300 Message-ID: <20240517134228.288-2-jamrial@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240517134228.288-1-jamrial@gmail.com> References: <20240517134228.288-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avformat/vvc: include additional bits in general_constraint_info 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: Ihl/Nr0x6afT Based on code from cbs_h266. Signed-off-by: James Almer --- libavformat/vvc.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/libavformat/vvc.c b/libavformat/vvc.c index 98177a7ad8..e8301d4247 100644 --- a/libavformat/vvc.c +++ b/libavformat/vvc.c @@ -46,7 +46,7 @@ typedef struct VVCPTLRecord { uint8_t general_level_idc; uint8_t ptl_frame_only_constraint_flag; uint8_t ptl_multilayer_enabled_flag; - uint8_t general_constraint_info[9]; + uint8_t general_constraint_info[10]; uint8_t ptl_sublayer_level_present_flag[VVC_MAX_SUBLAYERS - 1]; uint8_t sublayer_level_idc[VVC_MAX_SUBLAYERS - 1]; uint8_t ptl_num_sub_profiles; @@ -77,8 +77,8 @@ typedef struct VVCCProfileTierLevel { uint8_t ptl_multilayer_enabled_flag; // general_constraint_info uint8_t gci_present_flag; - uint8_t gci_general_constraints[9]; - uint8_t gci_num_reserved_bits; + uint8_t gci_general_constraints[10]; + uint8_t num_bytes_constraint_info; // end general_constraint_info uint8_t ptl_sublayer_level_present_flag[VVC_MAX_SUBLAYERS - 1]; uint8_t sublayer_level_idc[VVC_MAX_SUBLAYERS - 1]; @@ -135,13 +135,12 @@ static void vvcc_update_ptl(VVCDecoderConfigurationRecord *vvcc, /* * Constraints Info */ + vvcc->ptl.num_bytes_constraint_info = ptl->num_bytes_constraint_info; if (ptl->gci_present_flag) { - vvcc->ptl.num_bytes_constraint_info = 9; memcpy(&vvcc->ptl.general_constraint_info[0], - &ptl->gci_general_constraints[0], sizeof(uint8_t) * 9); + &ptl->gci_general_constraints[0], ptl->num_bytes_constraint_info); } else { - vvcc->ptl.num_bytes_constraint_info = 0; - memset(&vvcc->ptl.general_constraint_info[0], 0, sizeof(uint8_t) * 9); + memset(&vvcc->ptl.general_constraint_info[0], 0, sizeof(vvcc->ptl.general_constraint_info)); } /* @@ -186,7 +185,6 @@ static void vvcc_parse_ptl(GetBitContext *gb, unsigned int max_sub_layers_minus1) { VVCCProfileTierLevel general_ptl = { 0 }; - int j; if (profileTierPresentFlag) { general_ptl.profile_idc = get_bits(gb, 7); @@ -199,12 +197,20 @@ static void vvcc_parse_ptl(GetBitContext *gb, if (profileTierPresentFlag) { // parse constraint info general_ptl.gci_present_flag = get_bits1(gb); if (general_ptl.gci_present_flag) { + int gci_num_reserved_bits, j; for (j = 0; j < 8; j++) general_ptl.gci_general_constraints[j] = get_bits(gb, 8); - general_ptl.gci_general_constraints[8] = get_bits(gb, 7); - - general_ptl.gci_num_reserved_bits = get_bits(gb, 8); - skip_bits(gb, general_ptl.gci_num_reserved_bits); + general_ptl.gci_general_constraints[j++] = get_bits(gb, 7); + + gci_num_reserved_bits = get_bits(gb, 8); + if (gci_num_reserved_bits > 5) { + general_ptl.gci_general_constraints[8] = + (general_ptl.gci_general_constraints[8] << 1) | get_bits1(gb); + general_ptl.gci_general_constraints[j++] = get_bits(gb, 5); + gci_num_reserved_bits -= 6; + } + general_ptl.num_bytes_constraint_info = j; + skip_bits(gb, gci_num_reserved_bits); } while (gb->index % 8 != 0) skip_bits1(gb);