From patchwork Sun May 21 13:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 41761 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ba91:b0:105:feb:71f2 with SMTP id fb17csp1090512pzb; Sun, 21 May 2023 06:04:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6pSXrG3vuXIRd+b1LSp60krY27VPRz8CpdjabfgV/KZzCZcIPUY1Kh8NTMdq88qPDAjqKb X-Received: by 2002:a17:906:85c1:b0:965:66dd:78f8 with SMTP id i1-20020a17090685c100b0096566dd78f8mr5381646ejy.56.1684674258716; Sun, 21 May 2023 06:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684674258; cv=none; d=google.com; s=arc-20160816; b=xdiNo/rYn2J8O0fGVkkBUdl/Sb4uJiXLogAfrWZOfKlJPN0ALAj9ObEQE57qSoM6qY bIcv8T4Y7Czw6vEc1LcM27WHO/6Wt0WC59ObXkbfKrE81M7QtXkbz5fD44/CDZRx5fgZ Tv7r/3AxQ2ShNTBPEcKtPBfjBCr0K4h5lnH4BB+WkkytSPIlSRdK+wzqbxH3LHhiiI/w bbEQlh+glxohBPIrD4lY45vslXLM01J2bL83bLJHEIJFkga6cjX3Yw5fhlPI0LA1l4Ya z0lwfLt3qwkzwfbKDypy6Dh8VsINV2OF1/TjewpHI+/YazRC7qvMm7EzuufnjzlZF+y+ 1czw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=PDUdJkRGuWL60XJqu6hGM+QS4IkVncxE8jTQBjZbKBI=; b=cA4zTVwuN/qSLMbwbFR6HIzvlBJCvfq1Mo/+M7P+CM15lvoMa1sXtyawoSLMxYWvMZ 63mzZFUgHe8pzVZfUZx5W5uGaMVx2KHrdyVSBBO031Y6aoeKikBnbAlWD6dogG+BOzsu dri2FYP0GiRHie8Vh84mcoyEXVRe8uFg+XFi2wY1qUtQNemijfJfesO4SBl5DqXQtueG ps0Xg7TW8L4KLB1FDGZ1NCo0JxO8vewlgHQRof+TjYksyuAwbFs/CDKlKZm2TxNBxKSw cAPBELM8IRWb+HFxH83dj/oW6c06MDx1zMYecQtF0xRxxqMo7f9aolgfcudAt/ufYxIY ZEBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20221208 header.b=aZgJa6qg; 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 ez22-20020a1709070bd600b00965f2c24247si698480ejc.950.2023.05.21.06.04.17; Sun, 21 May 2023 06:04:18 -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=20221208 header.b=aZgJa6qg; 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 B969968C13E; Sun, 21 May 2023 16:03:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5C3CB68C122 for ; Sun, 21 May 2023 16:03:37 +0300 (EEST) Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-64d3fdcadb8so1271048b3a.3 for ; Sun, 21 May 2023 06:03:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684674215; x=1687266215; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cP3Tb+fSNb4fbht+JU0aNFCT3ohJNOiJCiPxMOW3LmE=; b=aZgJa6qgFDFxDtoty1/xNlb5roXhHMwe5XMuVTR7TK8UD3jE/dPW/EZEn0/fSKcbRW AS/YeIJXGa8oRo+BC5ZwZeZlg5XwQx+siZyvfL351OqfbbVmkwDPazESx76T8h3ekwRa bxiALgt3JTxI3Cr+UBO3OVp3VK9fbEGFRPQVjqJN+3vxlfY8+/r/qtekF1ETp0rWKM0B 4HjHu6lSatTnFKFHILtHQ5hOH4dPbbm1Bj3Q/iZP/kH0sTJL0KGBnAMUbsOO+tMY5N8Y PNz7iBjhdDn3fptS/Kn7Kf5vGnkK3kTDWK0Yf7Kdtr6zwk5kZiNbB1+7/tfcXBXbCanA CpoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684674215; x=1687266215; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cP3Tb+fSNb4fbht+JU0aNFCT3ohJNOiJCiPxMOW3LmE=; b=X+5QbUuROJ0gHTuGubA2jwxDWg7aA8m6yld7aSRYlgUNr+KJEHaN/k4eirQCQFVIBW ymGmPlxw3Vp9zbcTerbKx8jCTZtSE0wraJmOQDBR+ggNIsgVDwgkp7Zrtf50hoJ6Rpm6 XWqda77dLRp7Qmv6JOhybgPQ0Ympd1LNZRaB0U20GHJM95/P2bldidN4qLbPuWr9sCfK 5GzMBJynIzqVVCnTiiKge22ZXUXzdt77Trb8UYPtzu0wjcfLfEMh9VxiJV4tqo0QqJXR JDohVFf4LEgbreJDEzHoYf74wIER/cDb/uVOIJNdjnUjn8dcxvrVDblWHWlX7TaX44ak D8gQ== X-Gm-Message-State: AC+VfDxePgce0X66vS14CRgYGFgwq8dVLLPwjG51E/NqypUthRPXygf3 b+dIF3mPxJNPJgI/4B/oUF/PsYxMhMMBsw== X-Received: by 2002:a05:6a00:2e9a:b0:63d:260d:f9dd with SMTP id fd26-20020a056a002e9a00b0063d260df9ddmr11046621pfb.33.1684674212610; Sun, 21 May 2023 06:03:32 -0700 (PDT) Received: from NuoMi.localdomain ([112.64.8.97]) by smtp.gmail.com with ESMTPSA id t9-20020aa79389000000b0064d45eea573sm1671872pfe.41.2023.05.21.06.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 May 2023 06:03:31 -0700 (PDT) From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Sun, 21 May 2023 21:03:08 +0800 Message-Id: <20230521130319.13813-4-nuomi2021@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230521130319.13813-1-nuomi2021@gmail.com> References: <20230521130319.13813-1-nuomi2021@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/14] vvcdec: add sps, pps, sh parser 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: Nuo Mi Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6vAWvhnBZmiy --- libavcodec/vvc/Makefile | 4 +- libavcodec/vvc/vvc_data.c | 3295 ++++++++++++++++++++++++++++++++++++ libavcodec/vvc/vvc_data.h | 69 + libavcodec/vvc/vvc_ps.c | 3379 +++++++++++++++++++++++++++++++++++++ libavcodec/vvc/vvc_ps.h | 811 +++++++++ libavcodec/vvc/vvcdec.h | 3 + 6 files changed, 7560 insertions(+), 1 deletion(-) create mode 100644 libavcodec/vvc/vvc_data.c create mode 100644 libavcodec/vvc/vvc_data.h create mode 100644 libavcodec/vvc/vvc_ps.c create mode 100644 libavcodec/vvc/vvc_ps.h diff --git a/libavcodec/vvc/Makefile b/libavcodec/vvc/Makefile index 06d611ca6d..3dbfb70407 100644 --- a/libavcodec/vvc/Makefile +++ b/libavcodec/vvc/Makefile @@ -2,4 +2,6 @@ clean:: $(RM) $(CLEANSUFFIXES:%=libavcodec/vvc/%) OBJS-$(CONFIG_VVC_DECODER) += vvc/vvcdec.o \ - vvc/vvc_executor.o + vvc/vvc_executor.o \ + vvc/vvc_ps.o \ + vvc/vvc_data.o \ diff --git a/libavcodec/vvc/vvc_data.c b/libavcodec/vvc/vvc_data.c new file mode 100644 index 0000000000..b44c0fb595 --- /dev/null +++ b/libavcodec/vvc/vvc_data.c @@ -0,0 +1,3295 @@ +/* + * VVC shared tables + * + * 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 "libavutil/avassert.h" + +#include "vvc_data.h" + +const uint8_t ff_vvc_diag_scan_x[5][5][16*16] = { + { + //1x1 + { 0, }, + //1x2 + { 0, 0, }, + //1x4 + { 0, 0, 0, 0, }, + //1x8 + { 0, 0, 0, 0, 0, 0, 0, 0, }, + //1x16 + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, + }, + { + //2x1 + { 0, 1, }, + //2x2 + { 0, 0, 1, 1, }, + //2x4 + { 0, 0, 1, 0, 1, 0, 1, 1, }, + //2x8 + { 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, }, + //2x16 + { + 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, + 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, + }, + }, + { + //4x1 + { 0, 1, 2, 3, }, + //4x2 + { 0, 0, 1, 1, 2, 2, 3, 3, }, + //4x4 + { 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 3, 2, 3, 3, }, + //4x8 + { + 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, + 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 2, 3, 3, + }, + //4x16 + { + 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, + 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, + 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, + 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 2, 3, 3, + }, + }, + { + //8x1 + { 0, 1, 2, 3, 4, 5, 6, 7, }, + //8x2 + { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, }, + //8x4 + { + 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 1, 2, 3, 4, 2, 3, + 4, 5, 3, 4, 5, 6, 4, 5, 6, 7, 5, 6, 7, 6, 7, 7, + }, + //8x8 + { + 0, 0, 1, 0, 1, 2, 0, 1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 4, 5, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, + 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, + 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9, 10, 4, 5, 6, 7, + 8, 9, 10, 11, 5, 6, 7, 8, 9, 10, 11, 12, 6, 7, 8, 9, + 10, 11, 12, 13, 7, 8, 9, 10, 11, 12, 13, 14, 8, 9, 10, 11, + 12, 13, 14, 15, 9, 10, 11, 12, 13, 14, 15, 10, 11, 12, 13, 14, + 15, 11, 12, 13, 14, 15, 12, 13, 14, 15, 13, 14, 15, 14, 15, 15, + }, + //16x16 + { + 0, 0, 1, 0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4, 0, + 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, + 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, + 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 7, 8, 9, 10, 11, 12, 13, 14, 15, 8, 9, 10, 11, + 12, 13, 14, 15, 9, 10, 11, 12, 13, 14, 15, 10, 11, 12, 13, 14, + 15, 11, 12, 13, 14, 15, 12, 13, 14, 15, 13, 14, 15, 14, 15, 15, + }, + }, +}; + +const uint8_t ff_vvc_diag_scan_y[5][5][16*16] = { + { + //1x1 + { 0, }, + //1x2 + { 0, 1, }, + //1x4 + { 0, 1, 2, 3, }, + //1x8 + { 0, 1, 2, 3, 4, 5, 6, 7, }, + //1x16 + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, }, + }, + { + //2x1 + { 0, 0, }, + //2x2 + { 0, 1, 0, 1, }, + //2x4 + { 0, 1, 0, 2, 1, 3, 2, 3, }, + //2x8 + { 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 7, }, + //2x16 + { + 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, + 7, 9, 8, 10, 9, 11, 10, 12, 11, 13, 12, 14, 13, 15, 14, 15, + }, + }, + { + //4x1 + { 0, 0, 0, 0, }, + //4x2 + { 0, 1, 0, 1, 0, 1, 0, 1, }, + //4x4 + { 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 3, 2, 3, }, + //4x8 + { + 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 4, 3, 2, 1, 5, 4, + 3, 2, 6, 5, 4, 3, 7, 6, 5, 4, 7, 6, 5, 7, 6, 7, + }, + //4x16 + { + 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 4, 3, 2, 1, 5, 4, + 3, 2, 6, 5, 4, 3, 7, 6, 5, 4, 8, 7, 6, 5, 9, 8, + 7, 6, 10, 9, 8, 7, 11, 10, 9, 8, 12, 11, 10, 9, 13, 12, + 11, 10, 14, 13, 12, 11, 15, 14, 13, 12, 15, 14, 13, 15, 14, 15, + }, + }, + { + //8x1 + { 0, 0, 0, 0, 0, 0, 0, 0, }, + //8x2 + { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, }, + //8x4 + { + 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, + 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 3, 2, 3, + }, + //8x8 + { + 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 4, 3, 2, 1, 0, 5, + 4, 3, 2, 1, 0, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, + 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, + 2, 7, 6, 5, 4, 3, 7, 6, 5, 4, 7, 6, 5, 7, 6, 7, + }, + //8x16 + { + 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 4, 3, 2, 1, 0, 5, + 4, 3, 2, 1, 0, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, + 3, 2, 1, 0, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, + 5, 4, 3, 2, 10, 9, 8, 7, 6, 5, 4, 3, 11, 10, 9, 8, + 7, 6, 5, 4, 12, 11, 10, 9, 8, 7, 6, 5, 13, 12, 11, 10, + 9, 8, 7, 6, 14, 13, 12, 11, 10, 9, 8, 7, 15, 14, 13, 12, + 11, 10, 9, 8, 15, 14, 13, 12, 11, 10, 9, 15, 14, 13, 12, 11, + 10, 15, 14, 13, 12, 11, 15, 14, 13, 12, 15, 14, 13, 15, 14, 15, + }, + }, + { + //16x1 + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, + //16x2 + { + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, + }, + //16x4 + { + 0, 1, 0, 2, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3, 2, + 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 3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, 4, 3, 2, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, + 4, 3, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 15, 14, + 13, 12, 11, 10, 9, 8, 7, 6, 5, 15, 14, 13, 12, 11, 10, 9, + 8, 7, 6, 15, 14, 13, 12, 11, 10, 9, 8, 7, 15, 14, 13, 12, + 11, 10, 9, 8, 15, 14, 13, 12, 11, 10, 9, 15, 14, 13, 12, 11, + 10, 15, 14, 13, 12, 11, 15, 14, 13, 12, 15, 14, 13, 15, 14, 15, + }, + }, +}; + +const uint8_t ff_vvc_scaling_pred_8[8 * 8] = { + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, +}; + +const uint8_t ff_vvc_scaling_pred_16[8 * 8] = { + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, + 16, 16, 16, 16, 16, 16, 16, 16, +}; + +const int ff_vvc_scaling_list0[8 * 8] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static const uint8_t mip_matrix_4x4[16][16][4] = { + { + { 32, 30, 90, 28 }, + { 32, 32, 72, 28 }, + { 34, 77, 53, 30 }, + { 51, 124, 36, 37 }, + { 31, 31, 95, 37 }, + { 33, 31, 70, 50 }, + { 52, 80, 25, 60 }, + { 78, 107, 1, 65 }, + { 31, 29, 37, 95 }, + { 38, 34, 19, 101 }, + { 73, 85, 0, 81 }, + { 92, 99, 0, 65 }, + { 34, 29, 14, 111 }, + { 48, 48, 7, 100 }, + { 80, 91, 0, 74 }, + { 89, 97, 0, 64 } + }, + { + { 31, 23, 34, 29 }, + { 31, 43, 34, 31 }, + { 30, 95, 34, 32 }, + { 29, 100, 35, 33 }, + { 31, 23, 34, 29 }, + { 31, 43, 34, 31 }, + { 30, 95, 34, 32 }, + { 29, 99, 35, 33 }, + { 31, 24, 35, 29 }, + { 31, 44, 34, 31 }, + { 30, 95, 35, 32 }, + { 29, 99, 35, 33 }, + { 31, 24, 35, 30 }, + { 31, 44, 35, 31 }, + { 30, 95, 35, 32 }, + { 29, 99, 35, 33 } + }, + { + { 32, 32, 36, 58 }, + { 32, 29, 26, 66 }, + { 36, 37, 23, 61 }, + { 79, 84, 3, 37 }, + { 32, 32, 30, 69 }, + { 33, 29, 24, 71 }, + { 44, 16, 21, 70 }, + { 96, 18, 0, 57 }, + { 32, 31, 24, 74 }, + { 33, 30, 23, 71 }, + { 36, 24, 24, 71 }, + { 59, 9, 16, 68 }, + { 32, 32, 23, 75 }, + { 33, 30, 24, 70 }, + { 32, 30, 25, 71 }, + { 36, 26, 25, 70 } + }, + { + { 32, 33, 34, 32 }, + { 32, 30, 22, 38 }, + { 29, 46, 25, 38 }, + { 53, 123, 28, 22 }, + { 32, 33, 30, 37 }, + { 32, 30, 21, 38 }, + { 32, 40, 24, 38 }, + { 64, 116, 26, 17 }, + { 32, 32, 23, 49 }, + { 32, 30, 21, 39 }, + { 34, 39, 24, 37 }, + { 72, 109, 23, 16 }, + { 33, 31, 17, 60 }, + { 32, 31, 21, 39 }, + { 35, 41, 24, 37 }, + { 72, 106, 22, 18 } + }, + { + { 34, 25, 89, 20 }, + { 38, 32, 47, 24 }, + { 40, 86, 29, 27 }, + { 38, 98, 32, 29 }, + { 34, 31, 94, 40 }, + { 44, 25, 83, 27 }, + { 54, 72, 43, 16 }, + { 47, 94, 33, 22 }, + { 33, 31, 36, 94 }, + { 43, 23, 51, 76 }, + { 62, 55, 64, 25 }, + { 57, 89, 38, 15 }, + { 32, 32, 28, 101 }, + { 38, 26, 33, 94 }, + { 55, 38, 68, 47 }, + { 59, 80, 52, 16 } + }, + { + { 28, 30, 68, 29 }, + { 23, 48, 23, 48 }, + { 39, 98, 16, 42 }, + { 84, 86, 20, 17 }, + { 25, 31, 52, 74 }, + { 38, 68, 5, 70 }, + { 95, 78, 7, 21 }, + { 127, 54, 12, 0 }, + { 30, 47, 14, 107 }, + { 79, 76, 0, 53 }, + { 127, 59, 7, 1 }, + { 127, 51, 9, 0 }, + { 50, 71, 1, 96 }, + { 109, 69, 7, 25 }, + { 127, 56, 9, 0 }, + { 123, 53, 13, 0 } + }, + { + { 40, 20, 72, 18 }, + { 48, 29, 44, 18 }, + { 53, 81, 35, 18 }, + { 48, 96, 33, 22 }, + { 45, 23, 79, 49 }, + { 61, 21, 56, 49 }, + { 72, 52, 32, 48 }, + { 65, 69, 20, 50 }, + { 41, 27, 29, 96 }, + { 49, 22, 28, 94 }, + { 52, 22, 28, 93 }, + { 49, 27, 27, 92 }, + { 37, 29, 26, 98 }, + { 39, 28, 28, 97 }, + { 38, 28, 30, 97 }, + { 38, 29, 30, 95 } + }, + { + { 33, 27, 43, 27 }, + { 32, 29, 31, 31 }, + { 31, 73, 33, 31 }, + { 35, 104, 34, 28 }, + { 32, 30, 63, 22 }, + { 33, 26, 33, 29 }, + { 33, 57, 33, 30 }, + { 37, 100, 35, 27 }, + { 32, 31, 85, 25 }, + { 34, 25, 39, 25 }, + { 35, 39, 32, 28 }, + { 40, 91, 35, 25 }, + { 32, 30, 77, 50 }, + { 34, 26, 54, 22 }, + { 37, 31, 34, 27 }, + { 45, 75, 34, 23 } + }, + { + { 34, 25, 77, 19 }, + { 36, 34, 56, 24 }, + { 41, 83, 39, 30 }, + { 47, 96, 28, 35 }, + { 34, 31, 70, 65 }, + { 38, 29, 53, 77 }, + { 43, 36, 37, 83 }, + { 48, 39, 28, 83 }, + { 33, 31, 31, 98 }, + { 33, 31, 30, 99 }, + { 34, 30, 31, 98 }, + { 36, 29, 31, 96 }, + { 32, 32, 30, 97 }, + { 32, 32, 31, 96 }, + { 31, 33, 33, 96 }, + { 32, 33, 34, 94 } + }, + { + { 30, 30, 93, 19 }, + { 31, 59, 67, 34 }, + { 31, 79, 36, 59 }, + { 30, 67, 17, 79 }, + { 30, 38, 68, 69 }, + { 29, 40, 43, 91 }, + { 26, 35, 32, 101 }, + { 23, 32, 30, 101 }, + { 26, 34, 30, 101 }, + { 23, 33, 30, 102 }, + { 20, 32, 31, 102 }, + { 18, 33, 32, 102 }, + { 23, 33, 31, 100 }, + { 20, 34, 32, 100 }, + { 18, 35, 33, 100 }, + { 18, 35, 33, 100 } + }, + { + { 31, 54, 90, 26 }, + { 32, 60, 53, 61 }, + { 34, 49, 37, 84 }, + { 34, 39, 35, 89 }, + { 35, 38, 41, 88 }, + { 35, 35, 32, 96 }, + { 35, 31, 33, 96 }, + { 35, 32, 35, 94 }, + { 34, 34, 30, 97 }, + { 35, 32, 33, 95 }, + { 35, 32, 34, 94 }, + { 35, 34, 34, 93 }, + { 34, 34, 34, 93 }, + { 35, 34, 34, 93 }, + { 35, 34, 34, 92 }, + { 36, 34, 35, 91 } + }, + { + { 32, 29, 54, 24 }, + { 31, 32, 34, 29 }, + { 31, 43, 34, 29 }, + { 32, 67, 36, 28 }, + { 31, 34, 69, 37 }, + { 31, 35, 46, 33 }, + { 30, 35, 39, 33 }, + { 30, 42, 39, 36 }, + { 31, 35, 39, 88 }, + { 30, 38, 41, 84 }, + { 30, 39, 40, 81 }, + { 39, 46, 38, 78 }, + { 31, 36, 34, 96 }, + { 34, 38, 37, 93 }, + { 55, 42, 38, 82 }, + { 89, 53, 38, 65 } + }, + { + { 32, 33, 43, 29 }, + { 32, 30, 29, 33 }, + { 31, 47, 31, 33 }, + { 33, 100, 31, 31 }, + { 32, 33, 74, 25 }, + { 32, 32, 34, 31 }, + { 32, 33, 30, 33 }, + { 32, 68, 30, 32 }, + { 32, 31, 91, 40 }, + { 32, 32, 58, 26 }, + { 31, 31, 30, 32 }, + { 31, 42, 30, 33 }, + { 32, 31, 49, 85 }, + { 32, 31, 83, 35 }, + { 31, 33, 48, 29 }, + { 31, 36, 32, 33 } + }, + { + { 31, 29, 81, 35 }, + { 32, 28, 34, 50 }, + { 31, 75, 16, 43 }, + { 34, 103, 29, 32 }, + { 32, 32, 53, 78 }, + { 31, 28, 36, 88 }, + { 30, 52, 18, 73 }, + { 52, 88, 17, 35 }, + { 32, 32, 35, 94 }, + { 30, 31, 35, 95 }, + { 36, 29, 31, 92 }, + { 100, 43, 16, 40 }, + { 32, 32, 35, 93 }, + { 30, 32, 38, 93 }, + { 55, 18, 37, 83 }, + { 127, 0, 30, 40 } + }, + { + { 31, 22, 47, 30 }, + { 31, 48, 25, 34 }, + { 30, 95, 31, 32 }, + { 32, 103, 33, 32 }, + { 30, 24, 57, 31 }, + { 30, 47, 26, 34 }, + { 31, 95, 31, 32 }, + { 43, 97, 35, 25 }, + { 29, 26, 44, 63 }, + { 37, 38, 24, 47 }, + { 74, 63, 28, 20 }, + { 110, 58, 34, 3 }, + { 46, 22, 5, 108 }, + { 93, 5, 9, 77 }, + { 127, 0, 17, 52 }, + { 127, 0, 15, 50 } + }, + { + { 32, 27, 68, 24 }, + { 35, 23, 35, 28 }, + { 35, 64, 29, 29 }, + { 37, 104, 33, 28 }, + { 32, 32, 91, 40 }, + { 36, 23, 67, 36 }, + { 49, 23, 39, 28 }, + { 60, 67, 30, 20 }, + { 32, 32, 36, 95 }, + { 35, 29, 38, 93 }, + { 50, 16, 30, 84 }, + { 72, 16, 15, 65 }, + { 32, 32, 27, 100 }, + { 33, 32, 29, 100 }, + { 37, 29, 30, 98 }, + { 48, 21, 29, 90 } + } +}; + +static const uint8_t mip_matrix_8x8[8][16][8] = { + { + { 30, 63, 46, 37, 25, 33, 33, 34 }, + { 30, 60, 66, 38, 32, 31, 32, 33 }, + { 29, 45, 74, 42, 32, 32, 32, 33 }, + { 30, 39, 62, 58, 32, 33, 32, 33 }, + { 30, 66, 55, 39, 32, 30, 30, 36 }, + { 29, 54, 69, 40, 33, 31, 31, 33 }, + { 28, 48, 71, 43, 32, 33, 32, 33 }, + { 28, 41, 72, 46, 32, 34, 32, 33 }, + { 30, 66, 56, 40, 32, 33, 28, 33 }, + { 29, 55, 69, 39, 33, 33, 30, 32 }, + { 27, 46, 72, 43, 33, 33, 32, 33 }, + { 27, 42, 69, 48, 32, 34, 32, 33 }, + { 30, 63, 55, 40, 32, 33, 35, 30 }, + { 29, 56, 66, 40, 33, 33, 33, 30 }, + { 27, 47, 69, 44, 33, 33, 33, 32 }, + { 27, 42, 65, 50, 32, 34, 32, 33 } + }, + { + { 32, 33, 30, 31, 74, 30, 31, 32 }, + { 33, 56, 28, 30, 41, 29, 32, 32 }, + { 33, 77, 52, 26, 29, 34, 30, 32 }, + { 33, 37, 80, 41, 31, 34, 30, 32 }, + { 32, 32, 33, 31, 59, 76, 28, 31 }, + { 33, 31, 31, 30, 78, 40, 28, 32 }, + { 33, 47, 28, 29, 53, 27, 31, 31 }, + { 33, 61, 44, 28, 34, 32, 31, 31 }, + { 32, 31, 34, 30, 26, 64, 76, 27 }, + { 32, 31, 34, 29, 45, 86, 36, 29 }, + { 33, 27, 34, 29, 73, 55, 25, 32 }, + { 33, 33, 34, 30, 62, 33, 30, 31 }, + { 32, 31, 34, 30, 30, 29, 58, 74 }, + { 32, 31, 35, 29, 27, 53, 77, 35 }, + { 32, 30, 36, 29, 40, 80, 44, 31 }, + { 33, 28, 37, 30, 58, 60, 31, 33 } + }, + { + { 32, 51, 27, 32, 27, 50, 29, 32 }, + { 32, 95, 42, 29, 29, 42, 30, 32 }, + { 32, 27, 99, 34, 31, 41, 29, 32 }, + { 32, 34, 21, 104, 31, 42, 30, 32 }, + { 32, 45, 30, 32, 9, 88, 40, 30 }, + { 32, 77, 38, 30, 9, 76, 38, 30 }, + { 32, 38, 78, 33, 14, 67, 37, 30 }, + { 32, 30, 30, 87, 20, 59, 38, 31 }, + { 33, 37, 32, 32, 27, 18, 106, 34 }, + { 34, 44, 34, 31, 25, 17, 108, 31 }, + { 36, 39, 45, 31, 24, 15, 108, 30 }, + { 37, 31, 31, 54, 25, 14, 101, 32 }, + { 36, 33, 32, 30, 29, 37, 13, 110 }, + { 39, 32, 32, 29, 27, 37, 15, 108 }, + { 44, 33, 31, 27, 25, 37, 16, 106 }, + { 47, 30, 31, 32, 25, 34, 19, 102 } + }, + { + { 32, 48, 35, 35, 47, 68, 31, 31 }, + { 32, 33, 59, 40, 27, 71, 33, 30 }, + { 32, 29, 47, 65, 24, 62, 37, 30 }, + { 33, 33, 31, 81, 26, 50, 42, 32 }, + { 32, 30, 40, 38, 30, 70, 55, 31 }, + { 32, 20, 46, 50, 26, 55, 64, 31 }, + { 33, 30, 29, 66, 25, 41, 72, 33 }, + { 36, 34, 27, 69, 26, 31, 67, 39 }, + { 33, 28, 36, 40, 30, 26, 85, 47 }, + { 36, 27, 33, 50, 31, 20, 79, 53 }, + { 43, 30, 26, 57, 28, 17, 67, 62 }, + { 51, 27, 28, 55, 22, 23, 49, 70 }, + { 38, 29, 32, 39, 28, 30, 22, 104 }, + { 51, 31, 28, 43, 24, 31, 17, 102 }, + { 69, 23, 30, 40, 15, 38, 10, 95 }, + { 77, 13, 35, 38, 8, 43, 8, 90 } + }, + { + { 32, 38, 32, 33, 101, 40, 29, 32 }, + { 32, 40, 37, 32, 100, 36, 30, 32 }, + { 32, 37, 46, 35, 94, 33, 30, 31 }, + { 33, 34, 30, 62, 81, 35, 30, 31 }, + { 32, 32, 33, 32, 22, 102, 39, 29 }, + { 32, 31, 33, 33, 26, 104, 34, 28 }, + { 33, 33, 33, 33, 31, 103, 32, 28 }, + { 33, 32, 34, 36, 37, 94, 33, 28 }, + { 32, 33, 32, 32, 34, 24, 99, 36 }, + { 32, 34, 33, 33, 33, 30, 98, 32 }, + { 33, 33, 34, 33, 31, 37, 95, 29 }, + { 33, 33, 33, 36, 30, 46, 85, 31 }, + { 32, 33, 32, 33, 30, 34, 23, 104 }, + { 32, 34, 33, 33, 31, 32, 30, 98 }, + { 32, 33, 34, 34, 31, 29, 39, 91 }, + { 33, 33, 32, 37, 32, 30, 47, 82 } + }, + { + { 32, 52, 48, 31, 38, 76, 26, 32 }, + { 33, 19, 62, 50, 25, 50, 51, 31 }, + { 33, 30, 20, 74, 29, 29, 54, 51 }, + { 34, 35, 23, 56, 31, 25, 41, 76 }, + { 33, 25, 38, 39, 28, 39, 83, 35 }, + { 35, 28, 25, 47, 31, 23, 57, 74 }, + { 37, 35, 22, 38, 31, 27, 30, 101 }, + { 38, 32, 33, 29, 30, 31, 27, 103 }, + { 34, 32, 27, 37, 32, 25, 41, 92 }, + { 38, 33, 28, 32, 30, 31, 18, 111 }, + { 40, 32, 33, 27, 29, 33, 18, 111 }, + { 40, 32, 34, 27, 28, 33, 23, 105 }, + { 35, 32, 30, 33, 31, 33, 20, 107 }, + { 38, 31, 33, 30, 29, 33, 21, 106 }, + { 40, 32, 33, 29, 29, 34, 22, 105 }, + { 40, 32, 33, 30, 29, 34, 24, 101 } + }, + { + { 32, 28, 31, 33, 92, 33, 30, 31 }, + { 33, 30, 28, 33, 71, 26, 32, 30 }, + { 33, 60, 26, 33, 47, 28, 33, 30 }, + { 33, 63, 44, 36, 37, 31, 33, 30 }, + { 33, 30, 31, 33, 43, 90, 33, 29 }, + { 33, 28, 29, 34, 71, 71, 26, 30 }, + { 33, 30, 26, 33, 86, 45, 28, 30 }, + { 33, 38, 29, 32, 74, 32, 33, 29 }, + { 33, 32, 30, 32, 29, 41, 95, 27 }, + { 34, 31, 29, 33, 26, 71, 73, 22 }, + { 34, 31, 29, 33, 37, 88, 46, 25 }, + { 33, 32, 28, 34, 55, 75, 36, 28 }, + { 34, 31, 30, 32, 33, 27, 43, 89 }, + { 35, 32, 28, 33, 33, 23, 77, 59 }, + { 34, 33, 28, 33, 30, 35, 91, 37 }, + { 34, 34, 28, 34, 33, 53, 74, 31 } + }, + { + { 33, 49, 26, 32, 26, 52, 28, 31 }, + { 33, 71, 72, 24, 30, 32, 34, 31 }, + { 32, 23, 70, 68, 32, 32, 32, 32 }, + { 31, 33, 21, 106, 33, 32, 32, 33 }, + { 34, 47, 32, 29, 5, 86, 44, 26 }, + { 34, 44, 89, 28, 28, 37, 33, 30 }, + { 32, 27, 46, 89, 33, 31, 31, 32 }, + { 30, 33, 20, 107, 33, 33, 32, 33 }, + { 35, 39, 42, 27, 26, 24, 92, 35 }, + { 34, 27, 87, 43, 30, 34, 38, 31 }, + { 31, 31, 32, 100, 32, 33, 30, 32 }, + { 29, 32, 22, 106, 33, 33, 32, 33 }, + { 35, 29, 47, 32, 32, 32, 17, 100 }, + { 34, 24, 69, 60, 34, 33, 28, 44 }, + { 31, 33, 31, 99, 32, 33, 32, 31 }, + { 29, 33, 25, 103, 33, 33, 32, 35 } + } +}; + +static const uint8_t mip_matrix_16x16[6][64][7] = { + { + { 42, 37, 33, 27, 44, 33, 35 }, + { 71, 39, 34, 24, 36, 35, 36 }, + { 77, 46, 35, 33, 30, 34, 36 }, + { 64, 60, 35, 33, 31, 32, 36 }, + { 49, 71, 38, 32, 32, 31, 36 }, + { 42, 66, 50, 33, 31, 32, 36 }, + { 40, 52, 67, 33, 31, 32, 35 }, + { 38, 43, 75, 33, 32, 32, 35 }, + { 56, 40, 33, 26, 43, 38, 36 }, + { 70, 49, 34, 30, 28, 38, 38 }, + { 65, 57, 36, 34, 28, 33, 39 }, + { 59, 60, 39, 33, 30, 31, 38 }, + { 55, 60, 43, 33, 30, 31, 38 }, + { 51, 61, 47, 33, 30, 32, 37 }, + { 46, 62, 51, 34, 30, 32, 37 }, + { 42, 60, 55, 33, 31, 32, 37 }, + { 60, 42, 34, 30, 37, 43, 38 }, + { 68, 52, 35, 35, 22, 37, 40 }, + { 62, 58, 37, 34, 28, 31, 40 }, + { 58, 59, 41, 33, 30, 30, 39 }, + { 56, 59, 44, 34, 30, 31, 38 }, + { 53, 60, 45, 33, 30, 31, 38 }, + { 49, 65, 45, 33, 30, 31, 38 }, + { 45, 64, 47, 33, 31, 32, 38 }, + { 59, 44, 35, 31, 34, 43, 41 }, + { 66, 53, 36, 35, 25, 31, 43 }, + { 61, 58, 38, 34, 29, 30, 40 }, + { 59, 57, 41, 33, 30, 31, 39 }, + { 57, 58, 43, 33, 30, 31, 39 }, + { 54, 61, 43, 33, 31, 31, 39 }, + { 51, 64, 43, 33, 31, 31, 39 }, + { 48, 64, 45, 33, 32, 31, 39 }, + { 57, 45, 35, 30, 35, 40, 44 }, + { 65, 54, 37, 33, 33, 24, 44 }, + { 63, 56, 38, 34, 30, 29, 39 }, + { 61, 56, 41, 34, 30, 32, 39 }, + { 58, 58, 42, 33, 31, 31, 39 }, + { 54, 62, 41, 33, 31, 31, 39 }, + { 51, 65, 42, 33, 31, 31, 39 }, + { 48, 63, 43, 33, 32, 31, 39 }, + { 55, 46, 35, 30, 36, 38, 47 }, + { 65, 53, 37, 32, 36, 26, 40 }, + { 65, 54, 38, 33, 31, 30, 38 }, + { 63, 55, 39, 33, 30, 32, 38 }, + { 59, 58, 40, 33, 31, 31, 39 }, + { 54, 64, 40, 33, 31, 30, 40 }, + { 49, 66, 40, 32, 32, 30, 41 }, + { 48, 64, 42, 32, 32, 30, 41 }, + { 54, 46, 35, 30, 34, 39, 49 }, + { 64, 52, 36, 32, 34, 34, 35 }, + { 65, 53, 37, 33, 32, 32, 37 }, + { 63, 55, 38, 33, 31, 31, 39 }, + { 59, 60, 38, 33, 31, 31, 40 }, + { 54, 64, 38, 33, 32, 30, 40 }, + { 49, 66, 39, 33, 32, 29, 41 }, + { 47, 64, 42, 32, 33, 29, 42 }, + { 51, 46, 35, 31, 33, 37, 54 }, + { 61, 51, 36, 32, 33, 38, 36 }, + { 63, 53, 37, 32, 32, 34, 37 }, + { 62, 55, 37, 33, 32, 32, 39 }, + { 58, 59, 37, 33, 32, 31, 40 }, + { 53, 63, 38, 33, 32, 31, 40 }, + { 49, 64, 40, 33, 33, 30, 41 }, + { 46, 62, 42, 33, 33, 30, 42 } + }, + { + { 39, 34, 33, 58, 44, 31, 32 }, + { 60, 38, 32, 40, 51, 30, 31 }, + { 73, 49, 31, 39, 48, 32, 31 }, + { 60, 73, 30, 39, 46, 33, 32 }, + { 43, 87, 35, 38, 45, 33, 32 }, + { 35, 78, 54, 36, 45, 33, 32 }, + { 33, 47, 86, 35, 44, 33, 32 }, + { 31, 17, 114, 34, 44, 34, 33 }, + { 43, 37, 32, 53, 70, 30, 31 }, + { 53, 50, 30, 42, 72, 31, 30 }, + { 52, 66, 30, 39, 70, 32, 30 }, + { 46, 78, 35, 37, 68, 34, 30 }, + { 43, 75, 48, 37, 66, 34, 30 }, + { 40, 62, 68, 35, 65, 35, 30 }, + { 33, 37, 97, 33, 62, 37, 31 }, + { 26, 14, 122, 32, 59, 38, 33 }, + { 40, 39, 33, 34, 87, 37, 30 }, + { 45, 54, 32, 34, 84, 41, 29 }, + { 41, 70, 35, 33, 83, 40, 29 }, + { 37, 73, 44, 32, 82, 40, 30 }, + { 37, 65, 60, 31, 81, 41, 29 }, + { 35, 48, 82, 30, 79, 43, 29 }, + { 28, 27, 108, 28, 76, 45, 30 }, + { 19, 11, 127, 27, 70, 46, 32 }, + { 38, 40, 34, 27, 73, 62, 28 }, + { 39, 54, 35, 30, 73, 62, 28 }, + { 33, 65, 41, 29, 75, 59, 28 }, + { 30, 65, 53, 27, 76, 58, 29 }, + { 29, 53, 72, 26, 77, 58, 29 }, + { 27, 35, 95, 24, 77, 60, 28 }, + { 19, 19, 117, 23, 74, 61, 30 }, + { 9, 16, 127, 23, 68, 60, 34 }, + { 35, 40, 35, 29, 44, 89, 30 }, + { 33, 51, 39, 29, 49, 86, 30 }, + { 28, 57, 49, 28, 53, 83, 30 }, + { 24, 52, 65, 26, 56, 82, 30 }, + { 22, 39, 86, 24, 58, 82, 30 }, + { 18, 22, 108, 23, 59, 82, 31 }, + { 10, 13, 125, 22, 58, 80, 33 }, + { 0, 19, 127, 22, 56, 74, 40 }, + { 33, 40, 36, 31, 28, 90, 45 }, + { 29, 46, 44, 29, 31, 92, 43 }, + { 24, 45, 58, 28, 34, 91, 43 }, + { 19, 37, 78, 26, 37, 91, 43 }, + { 15, 22, 99, 25, 38, 91, 42 }, + { 11, 11, 118, 24, 39, 90, 44 }, + { 2, 11, 127, 23, 41, 85, 48 }, + { 0, 17, 127, 23, 43, 75, 55 }, + { 31, 37, 39, 30, 28, 54, 82 }, + { 27, 37, 52, 28, 30, 58, 79 }, + { 22, 30, 70, 27, 32, 58, 79 }, + { 15, 19, 91, 26, 33, 58, 79 }, + { 10, 8, 111, 25, 34, 58, 79 }, + { 5, 2, 125, 25, 35, 57, 80 }, + { 0, 9, 127, 25, 36, 53, 84 }, + { 0, 13, 127, 25, 39, 47, 88 }, + { 28, 29, 46, 28, 39, 2, 123 }, + { 24, 24, 62, 27, 41, 1, 125 }, + { 19, 14, 81, 25, 43, 0, 126 }, + { 13, 4, 101, 24, 44, 0, 127 }, + { 6, 0, 116, 23, 45, 0, 127 }, + { 0, 0, 126, 23, 45, 1, 127 }, + { 0, 4, 127, 25, 44, 2, 127 }, + { 0, 9, 127, 25, 44, 3, 127 } + }, + { + { 30, 32, 32, 42, 34, 32, 32 }, + { 63, 26, 34, 16, 38, 32, 32 }, + { 98, 26, 34, 25, 34, 33, 32 }, + { 75, 61, 30, 31, 32, 33, 32 }, + { 36, 94, 32, 30, 33, 32, 32 }, + { 26, 76, 58, 30, 33, 32, 32 }, + { 30, 39, 91, 31, 32, 33, 31 }, + { 32, 23, 105, 32, 32, 32, 32 }, + { 34, 30, 33, 31, 52, 29, 32 }, + { 66, 24, 34, 11, 41, 33, 32 }, + { 97, 28, 34, 24, 34, 33, 32 }, + { 71, 65, 30, 30, 32, 33, 32 }, + { 34, 92, 35, 30, 33, 32, 32 }, + { 26, 70, 64, 29, 34, 32, 32 }, + { 30, 37, 94, 30, 33, 32, 31 }, + { 32, 23, 105, 31, 33, 33, 31 }, + { 37, 29, 33, 8, 79, 27, 32 }, + { 71, 22, 35, 5, 50, 32, 32 }, + { 98, 29, 34, 23, 34, 34, 32 }, + { 66, 70, 30, 31, 31, 33, 32 }, + { 31, 92, 38, 30, 33, 32, 32 }, + { 26, 66, 68, 29, 34, 32, 31 }, + { 30, 34, 97, 30, 34, 33, 31 }, + { 31, 22, 106, 30, 34, 33, 31 }, + { 40, 28, 34, 0, 76, 46, 28 }, + { 76, 21, 35, 0, 55, 35, 32 }, + { 97, 32, 34, 21, 37, 33, 33 }, + { 61, 75, 29, 30, 32, 32, 32 }, + { 29, 92, 40, 29, 33, 32, 32 }, + { 26, 62, 73, 29, 34, 32, 31 }, + { 29, 32, 99, 30, 34, 33, 30 }, + { 31, 22, 107, 30, 34, 33, 31 }, + { 42, 27, 34, 1, 48, 79, 25 }, + { 80, 20, 35, 0, 48, 47, 31 }, + { 94, 36, 32, 17, 40, 33, 33 }, + { 55, 80, 29, 27, 35, 31, 32 }, + { 27, 90, 43, 28, 34, 32, 31 }, + { 26, 58, 76, 29, 33, 33, 30 }, + { 29, 30, 101, 29, 34, 34, 30 }, + { 31, 21, 108, 29, 35, 34, 30 }, + { 44, 26, 34, 6, 30, 80, 40 }, + { 81, 21, 35, 0, 41, 52, 35 }, + { 90, 41, 31, 14, 41, 35, 33 }, + { 51, 82, 29, 24, 37, 32, 32 }, + { 27, 87, 47, 27, 35, 32, 31 }, + { 26, 54, 79, 29, 34, 33, 30 }, + { 29, 29, 102, 28, 34, 33, 30 }, + { 31, 21, 108, 28, 35, 33, 31 }, + { 47, 26, 34, 7, 34, 44, 75 }, + { 80, 24, 34, 0, 41, 41, 50 }, + { 84, 45, 31, 12, 40, 36, 36 }, + { 49, 81, 31, 22, 37, 33, 32 }, + { 28, 81, 51, 26, 35, 33, 31 }, + { 28, 51, 81, 28, 34, 33, 30 }, + { 29, 30, 101, 28, 35, 33, 31 }, + { 31, 22, 107, 28, 35, 33, 32 }, + { 48, 27, 34, 10, 40, 16, 97 }, + { 75, 27, 34, 3, 42, 26, 66 }, + { 77, 47, 33, 12, 40, 32, 43 }, + { 49, 75, 36, 21, 37, 33, 35 }, + { 32, 72, 55, 25, 36, 33, 32 }, + { 30, 49, 81, 27, 35, 33, 31 }, + { 30, 32, 98, 28, 35, 32, 32 }, + { 31, 24, 104, 28, 35, 32, 33 } + }, + { + { 36, 29, 33, 43, 47, 29, 31 }, + { 74, 20, 35, 19, 47, 34, 32 }, + { 92, 35, 32, 29, 31, 40, 34 }, + { 53, 80, 26, 33, 28, 36, 37 }, + { 24, 91, 41, 31, 31, 31, 38 }, + { 25, 57, 74, 31, 32, 30, 37 }, + { 32, 28, 99, 32, 32, 29, 36 }, + { 34, 20, 105, 33, 32, 30, 35 }, + { 50, 26, 34, 33, 74, 30, 31 }, + { 75, 28, 33, 23, 46, 47, 33 }, + { 64, 58, 29, 30, 26, 46, 40 }, + { 31, 85, 37, 31, 27, 33, 44 }, + { 22, 67, 64, 30, 31, 28, 42 }, + { 29, 35, 93, 31, 32, 27, 40 }, + { 33, 20, 105, 32, 33, 27, 37 }, + { 34, 19, 106, 33, 32, 29, 36 }, + { 51, 29, 33, 25, 72, 51, 30 }, + { 61, 42, 31, 30, 31, 60, 39 }, + { 40, 70, 34, 32, 24, 41, 50 }, + { 22, 72, 54, 30, 31, 27, 50 }, + { 25, 44, 83, 30, 33, 25, 44 }, + { 32, 23, 102, 32, 33, 26, 40 }, + { 34, 18, 107, 32, 33, 28, 37 }, + { 34, 19, 105, 33, 32, 30, 35 }, + { 45, 35, 32, 30, 39, 79, 33 }, + { 43, 53, 33, 35, 24, 53, 55 }, + { 27, 67, 45, 32, 29, 27, 61 }, + { 22, 53, 72, 30, 33, 22, 52 }, + { 28, 31, 95, 31, 33, 25, 43 }, + { 32, 20, 105, 32, 33, 27, 38 }, + { 34, 18, 107, 32, 32, 29, 36 }, + { 34, 20, 105, 33, 31, 31, 35 }, + { 38, 40, 32, 35, 23, 72, 54 }, + { 31, 55, 39, 34, 29, 32, 73 }, + { 22, 57, 60, 31, 35, 18, 64 }, + { 25, 39, 86, 31, 35, 22, 49 }, + { 30, 24, 101, 32, 33, 27, 40 }, + { 33, 19, 106, 32, 32, 30, 36 }, + { 34, 18, 107, 33, 31, 31, 35 }, + { 34, 20, 104, 33, 31, 32, 34 }, + { 33, 42, 35, 34, 28, 39, 82 }, + { 26, 51, 50, 33, 34, 18, 80 }, + { 23, 46, 74, 31, 35, 20, 59 }, + { 27, 32, 93, 32, 34, 26, 44 }, + { 31, 22, 103, 32, 32, 30, 37 }, + { 33, 19, 106, 33, 31, 31, 35 }, + { 34, 19, 106, 33, 31, 32, 34 }, + { 35, 21, 103, 34, 31, 32, 34 }, + { 29, 41, 41, 33, 34, 20, 92 }, + { 24, 44, 62, 34, 35, 18, 73 }, + { 24, 37, 83, 34, 33, 25, 52 }, + { 28, 28, 97, 33, 32, 30, 40 }, + { 32, 23, 103, 33, 31, 32, 36 }, + { 34, 20, 105, 34, 30, 33, 34 }, + { 35, 20, 104, 34, 30, 33, 33 }, + { 35, 22, 102, 34, 30, 33, 34 }, + { 27, 38, 51, 34, 34, 20, 86 }, + { 26, 37, 71, 35, 34, 24, 64 }, + { 27, 33, 87, 35, 32, 30, 47 }, + { 30, 28, 96, 34, 31, 32, 39 }, + { 32, 24, 100, 35, 30, 32, 36 }, + { 34, 23, 101, 34, 30, 33, 34 }, + { 35, 23, 101, 34, 30, 32, 34 }, + { 34, 24, 99, 35, 30, 33, 34 } + }, + { + { 39, 30, 31, 67, 33, 34, 31 }, + { 72, 21, 32, 43, 39, 33, 31 }, + { 100, 23, 32, 35, 39, 34, 31 }, + { 75, 63, 24, 32, 38, 34, 32 }, + { 32, 98, 26, 29, 37, 35, 32 }, + { 22, 77, 55, 29, 36, 35, 31 }, + { 31, 37, 90, 31, 35, 35, 32 }, + { 35, 22, 100, 33, 33, 36, 33 }, + { 47, 29, 32, 74, 54, 32, 31 }, + { 71, 24, 32, 60, 50, 36, 30 }, + { 86, 31, 30, 46, 48, 37, 30 }, + { 65, 63, 25, 34, 46, 39, 30 }, + { 33, 85, 32, 28, 43, 40, 30 }, + { 26, 64, 60, 27, 39, 41, 30 }, + { 33, 33, 87, 29, 35, 41, 31 }, + { 37, 23, 93, 32, 33, 41, 32 }, + { 41, 32, 32, 45, 84, 32, 32 }, + { 55, 31, 32, 50, 70, 40, 30 }, + { 62, 37, 31, 45, 61, 45, 29 }, + { 53, 55, 31, 36, 55, 48, 29 }, + { 38, 63, 40, 29, 48, 50, 28 }, + { 34, 49, 60, 27, 43, 51, 29 }, + { 38, 30, 78, 28, 38, 50, 31 }, + { 40, 24, 83, 30, 36, 48, 33 }, + { 35, 33, 33, 29, 75, 58, 29 }, + { 39, 35, 33, 34, 68, 59, 29 }, + { 41, 39, 34, 36, 61, 62, 29 }, + { 41, 43, 37, 33, 54, 64, 28 }, + { 41, 43, 45, 30, 48, 65, 29 }, + { 42, 36, 56, 27, 44, 63, 30 }, + { 42, 30, 65, 27, 41, 60, 33 }, + { 42, 28, 68, 28, 37, 56, 36 }, + { 33, 34, 33, 31, 42, 88, 30 }, + { 31, 36, 34, 31, 44, 84, 31 }, + { 31, 37, 35, 32, 43, 83, 31 }, + { 35, 35, 39, 32, 40, 82, 31 }, + { 40, 32, 44, 31, 38, 81, 31 }, + { 44, 30, 48, 30, 37, 78, 33 }, + { 44, 30, 52, 28, 37, 72, 36 }, + { 43, 30, 55, 29, 35, 66, 40 }, + { 32, 33, 33, 34, 25, 85, 48 }, + { 30, 34, 34, 33, 25, 88, 44 }, + { 30, 34, 36, 34, 25, 90, 41 }, + { 33, 32, 38, 34, 25, 90, 40 }, + { 38, 29, 41, 34, 26, 88, 40 }, + { 42, 29, 41, 33, 27, 85, 41 }, + { 43, 30, 42, 31, 28, 80, 43 }, + { 42, 31, 45, 31, 30, 72, 47 }, + { 32, 33, 33, 33, 26, 54, 79 }, + { 31, 32, 34, 35, 20, 68, 68 }, + { 32, 32, 35, 36, 17, 76, 62 }, + { 34, 31, 36, 36, 17, 79, 59 }, + { 37, 29, 37, 36, 18, 78, 58 }, + { 39, 29, 37, 35, 20, 77, 58 }, + { 41, 30, 37, 34, 22, 74, 58 }, + { 40, 31, 40, 32, 26, 68, 59 }, + { 33, 31, 34, 33, 29, 31, 98 }, + { 34, 30, 34, 35, 23, 45, 88 }, + { 34, 31, 34, 36, 20, 54, 82 }, + { 35, 31, 34, 36, 18, 59, 78 }, + { 36, 31, 34, 37, 19, 60, 76 }, + { 38, 30, 34, 36, 20, 61, 74 }, + { 39, 31, 35, 35, 22, 60, 73 }, + { 39, 31, 37, 34, 24, 59, 71 } + }, + { + { 30, 33, 32, 55, 32, 32, 32 }, + { 47, 30, 31, 29, 36, 32, 32 }, + { 81, 28, 32, 28, 34, 32, 32 }, + { 85, 46, 29, 32, 32, 33, 32 }, + { 54, 82, 26, 32, 32, 33, 32 }, + { 30, 90, 38, 31, 32, 33, 32 }, + { 30, 56, 73, 31, 33, 32, 32 }, + { 37, 21, 102, 32, 32, 32, 32 }, + { 33, 32, 31, 68, 39, 31, 31 }, + { 38, 32, 31, 43, 34, 33, 31 }, + { 63, 30, 31, 29, 34, 32, 32 }, + { 82, 37, 30, 29, 33, 32, 32 }, + { 71, 63, 27, 31, 32, 33, 32 }, + { 44, 86, 30, 30, 33, 33, 32 }, + { 33, 72, 55, 30, 32, 32, 31 }, + { 37, 37, 86, 31, 32, 33, 31 }, + { 34, 33, 32, 60, 61, 29, 32 }, + { 36, 33, 31, 56, 38, 32, 31 }, + { 51, 30, 31, 38, 33, 33, 32 }, + { 75, 31, 31, 30, 33, 33, 32 }, + { 80, 47, 29, 30, 32, 33, 31 }, + { 60, 73, 27, 30, 33, 33, 31 }, + { 41, 78, 41, 30, 33, 32, 31 }, + { 38, 53, 68, 30, 32, 33, 31 }, + { 33, 33, 32, 43, 77, 35, 30 }, + { 35, 33, 31, 55, 54, 29, 32 }, + { 43, 32, 31, 46, 39, 31, 32 }, + { 64, 30, 31, 35, 34, 33, 32 }, + { 79, 37, 30, 31, 32, 33, 31 }, + { 73, 57, 28, 30, 32, 33, 31 }, + { 54, 73, 33, 30, 32, 33, 31 }, + { 43, 64, 52, 30, 32, 33, 31 }, + { 33, 33, 32, 34, 68, 58, 28 }, + { 34, 33, 31, 45, 70, 33, 31 }, + { 38, 33, 31, 48, 52, 29, 32 }, + { 54, 31, 31, 40, 39, 31, 32 }, + { 73, 32, 31, 34, 34, 33, 31 }, + { 77, 45, 29, 31, 32, 32, 32 }, + { 65, 63, 30, 31, 31, 33, 31 }, + { 51, 66, 42, 30, 32, 33, 31 }, + { 33, 32, 32, 34, 44, 81, 31 }, + { 34, 33, 31, 38, 66, 52, 28 }, + { 36, 33, 30, 44, 62, 34, 31 }, + { 47, 31, 31, 43, 48, 30, 32 }, + { 64, 31, 31, 38, 38, 32, 32 }, + { 75, 38, 30, 33, 34, 32, 32 }, + { 71, 53, 30, 31, 32, 33, 32 }, + { 59, 61, 37, 30, 32, 33, 32 }, + { 33, 32, 31, 35, 31, 71, 54 }, + { 34, 33, 31, 37, 49, 70, 33 }, + { 36, 33, 31, 41, 60, 48, 30 }, + { 43, 32, 31, 43, 54, 35, 31 }, + { 56, 31, 31, 40, 44, 32, 32 }, + { 68, 35, 30, 36, 37, 32, 32 }, + { 70, 45, 30, 33, 34, 33, 32 }, + { 63, 55, 35, 31, 33, 33, 32 }, + { 33, 32, 31, 33, 34, 36, 87 }, + { 34, 32, 31, 36, 38, 62, 52 }, + { 36, 33, 31, 39, 50, 57, 36 }, + { 41, 33, 31, 41, 53, 43, 33 }, + { 50, 33, 31, 41, 48, 36, 32 }, + { 59, 35, 31, 37, 41, 34, 32 }, + { 65, 42, 31, 35, 36, 33, 32 }, + { 62, 49, 35, 33, 34, 34, 33 } + } +}; + +const uint8_t* ff_vvc_get_mip_matrix(const int size_id, const int mode_id) +{ + av_assert0(size_id < 3); + if (size_id == 0) + return &mip_matrix_4x4[mode_id][0][0]; + if (size_id == 1) + return &mip_matrix_8x8[mode_id][0][0]; + return &mip_matrix_16x16[mode_id][0][0]; +} + +// DCT-8 +#define DEFINE_DCT8_P4_MATRIX(a,b,c,d) \ +{ \ + { a, b, c, d }, \ + { b, 0, -b, -b }, \ + { c, -b, -d, a }, \ + { d, -b, a, -c }, \ +} + +#define DEFINE_DCT8_P8_MATRIX(a,b,c,d,e,f,g,h) \ +{ \ + { a, b, c, d, e, f, g, h }, \ + { b, e, h, -g, -d, -a, -c, -f }, \ + { c, h, -e, -a, -f, g, b, d }, \ + { d, -g, -a, -h, c, e, -f, -b }, \ + { e, -d, -f, c, g, -b, -h, a }, \ + { f, -a, g, e, -b, h, d, -c }, \ + { g, -c, b, -f, -h, d, -a, e }, \ + { h, -f, d, -b, a, -c, e, -g }, \ +} + +#define DEFINE_DCT8_P16_MATRIX(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \ +{ \ + { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p }, \ + { b, e, h, k, n, 0, -n, -k, -h, -e, -b, -b, -e, -h, -k, -n }, \ + { c, h, m, -p, -k, -f, -a, -e, -j, -o, n, i, d, b, g, l }, \ + { d, k, -p, -i, -b, -f, -m, n, g, a, h, o, -l, -e, -c, -j }, \ + { e, n, -k, -b, -h, 0, h, b, k, -n, -e, -e, -n, k, b, h }, \ + { f, 0, -f, -f, 0, f, f, 0, -f, -f, 0, f, f, 0, -f, -f }, \ + { g, -n, -a, -m, h, f, -o, -b, -l, i, e, -p, -c, -k, j, d }, \ + { h, -k, -e, n, b, 0, -b, -n, e, k, -h, -h, k, e, -n, -b }, \ + { i, -h, -j, g, k, -f, -l, e, m, -d, -n, c, o, -b, -p, a }, \ + { j, -e, -o, a, -n, -f, i, k, -d, -p, b, -m, -g, h, l, -c }, \ + { k, -b, n, h, -e, 0, e, -h, -n, b, -k, -k, b, -n, -h, e }, \ + { l, -b, i, o, -e, f, -p, -h, c, -m, -k, a, -j, -n, d, -g }, \ + { m, -e, d, -l, -n, f, -c, k, o, -g, b, -j, -p, h, -a, i }, \ + { n, -h, b, -e, k, 0, -k, e, -b, h, -n, -n, h, -b, e, -k }, \ + { o, -k, g, -c, b, -f, j, -n, -p, l, -h, d, -a, e, -i, m }, \ + { p, -n, l, -j, h, -f, d, -b, a, -c, e, -g, i, -k, m, -o }, \ +} + +#define DEFINE_DCT8_P32_MATRIX(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F) \ +{ \ + { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F }, \ + { b, e, h, k, n, q, t, w, z, C, F, -E, -B, -y, -v, -s, -p, -m, -j, -g, -d, -a, -c, -f, -i, -l, -o, -r, -u, -x, -A, -D }, \ + { c, h, m, r, w, B, 0, -B, -w, -r, -m, -h, -c, -c, -h, -m, -r, -w, -B, 0, B, w, r, m, h, c, c, h, m, r, w, B }, \ + { d, k, r, y, F, -A, -t, -m, -f, -b, -i, -p, -w, -D, C, v, o, h, a, g, n, u, B, -E, -x, -q, -j, -c, -e, -l, -s, -z }, \ + { e, n, w, F, -y, -p, -g, -c, -l, -u, -D, A, r, i, a, j, s, B, -C, -t, -k, -b, -h, -q, -z, E, v, m, d, f, o, x }, \ + { f, q, B, -A, -p, -e, -g, -r, -C, z, o, d, h, s, D, -y, -n, -c, -i, -t, -E, x, m, b, j, u, F, -w, -l, -a, -k, -v }, \ + { g, t, 0, -t, -g, -g, -t, 0, t, g, g, t, 0, -t, -g, -g, -t, 0, t, g, g, t, 0, -t, -g, -g, -t, 0, t, g, g, t }, \ + { h, w, -B, -m, -c, -r, 0, r, c, m, B, -w, -h, -h, -w, B, m, c, r, 0, -r, -c, -m, -B, w, h, h, w, -B, -m, -c, -r }, \ + { i, z, -w, -f, -l, -C, t, c, o, F, -q, -a, -r, E, n, d, u, -B, -k, -g, -x, y, h, j, A, -v, -e, -m, -D, s, b, p }, \ + { j, C, -r, -b, -u, z, g, m, F, -o, -e, -x, w, d, p, -E, -l, -h, -A, t, a, s, -B, -i, -k, -D, q, c, v, -y, -f, -n }, \ + { k, F, -m, -i, -D, o, g, B, -q, -e, -z, s, c, x, -u, -a, -v, w, b, t, -y, -d, -r, A, f, p, -C, -h, -n, E, j, l }, \ + { l, -E, -h, -p, A, d, t, -w, -a, -x, s, e, B, -o, -i, -F, k, m, -D, -g, -q, z, c, u, -v, -b, -y, r, f, C, -n, -j }, \ + { m, -B, -c, -w, r, h, 0, -h, -r, w, c, B, -m, -m, B, c, w, -r, -h, 0, h, r, -w, -c, -B, m, m, -B, -c, -w, r, h }, \ + { n, -y, -c, -D, i, s, -t, -h, E, d, x, -o, -m, z, b, C, -j, -r, u, g, -F, -e, -w, p, l, -A, -a, -B, k, q, -v, -f }, \ + { o, -v, -h, C, a, D, -g, -w, n, p, -u, -i, B, b, E, -f, -x, m, q, -t, -j, A, c, F, -e, -y, l, r, -s, -k, z, d }, \ + { p, -s, -m, v, j, -y, -g, B, d, -E, -a, -F, c, C, -f, -z, i, w, -l, -t, o, q, -r, -n, u, k, -x, -h, A, e, -D, -b }, \ + { q, -p, -r, o, s, -n, -t, m, u, -l, -v, k, w, -j, -x, i, y, -h, -z, g, A, -f, -B, e, C, -d, -D, c, E, -b, -F, a }, \ + { r, -m, -w, h, B, -c, 0, c, -B, -h, w, m, -r, -r, m, w, -h, -B, c, 0, -c, B, h, -w, -m, r, r, -m, -w, h, B, -c }, \ + { s, -j, -B, a, -C, -i, t, r, -k, -A, b, -D, -h, u, q, -l, -z, c, -E, -g, v, p, -m, -y, d, -F, -f, w, o, -n, -x, e }, \ + { t, -g, 0, g, -t, -t, g, 0, -g, t, t, -g, 0, g, -t, -t, g, 0, -g, t, t, -g, 0, g, -t, -t, g, 0, -g, t, t, -g }, \ + { u, -d, B, n, -k, -E, g, -r, -x, a, -y, -q, h, -F, -j, o, A, -c, v, t, -e, C, m, -l, -D, f, -s, -w, b, -z, -p, i }, \ + { v, -a, w, u, -b, x, t, -c, y, s, -d, z, r, -e, A, q, -f, B, p, -g, C, o, -h, D, n, -i, E, m, -j, F, l, -k }, \ + { w, -c, r, B, -h, m, 0, -m, h, -B, -r, c, -w, -w, c, -r, -B, h, -m, 0, m, -h, B, r, -c, w, w, -c, r, B, -h, m }, \ + { x, -f, m, -E, -q, b, -t, -B, j, -i, A, u, -c, p, F, -n, e, -w, -y, g, -l, D, r, -a, s, C, -k, h, -z, -v, d, -o }, \ + { y, -i, h, -x, -z, j, -g, w, A, -k, f, -v, -B, l, -e, u, C, -m, d, -t, -D, n, -c, s, E, -o, b, -r, -F, p, -a, q }, \ + { z, -l, c, -q, E, u, -g, h, -v, -D, p, -b, m, -A, -y, k, -d, r, -F, -t, f, -i, w, C, -o, a, -n, B, x, -j, e, -s }, \ + { A, -o, c, -j, v, F, -t, h, -e, q, -C, -y, m, -a, l, -x, -D, r, -f, g, -s, E, w, -k, b, -n, z, B, -p, d, -i, u }, \ + { B, -r, h, -c, m, -w, 0, w, -m, c, -h, r, -B, -B, r, -h, c, -m, w, 0, -w, m, -c, h, -r, B, B, -r, h, -c, m, -w }, \ + { C, -u, m, -e, d, -l, t, -B, -D, v, -n, f, -c, k, -s, A, E, -w, o, -g, b, -j, r, -z, -F, x, -p, h, -a, i, -q, y }, \ + { D, -x, r, -l, f, -a, g, -m, s, -y, E, C, -w, q, -k, e, -b, h, -n, t, -z, F, B, -v, p, -j, d, -c, i, -o, u, -A }, \ + { E, -A, w, -s, o, -k, g, -c, b, -f, j, -n, r, -v, z, -D, -F, B, -x, t, -p, l, -h, d, -a, e, -i, m, -q, u, -y, C }, \ + { F, -D, B, -z, x, -v, t, -r, p, -n, l, -j, h, -f, d, -b, a, -c, e, -g, i, -k, m, -o, q, -s, u, -w, y, -A, C, -E }, \ +} + +const int8_t ff_vvc_dct8_4x4[4][4] = DEFINE_DCT8_P4_MATRIX(84, 74, 55, 29); +const int8_t ff_vvc_dct8_8x8[8][8] = DEFINE_DCT8_P8_MATRIX(86, 85, 78, 71, 60, 46, 32, 17); +const int8_t ff_vvc_dct8_16x16[16][16] = DEFINE_DCT8_P16_MATRIX(88, 88, 87, 85, 81, 77, 73, 68, 62, 55, 48, 40, 33, 25, 17, 8); +const int8_t ff_vvc_dct8_32x32[32][32] = DEFINE_DCT8_P32_MATRIX(90, 90, 89, 88, 87, 86, 85, 84, 82, 80, 78, 77, 74, 72, 68, 66, 63, 60, 56, 53, 50, 46, 42, 38, 34, 30, 26, 21, 17, 13, 9, 4); + +// DST-7 +#define DEFINE_DST7_P4_MATRIX(a,b,c,d) \ +{ \ + { a, b, c, d }, \ + { c, c, 0, -c }, \ + { d, -a, -c, b }, \ + { b, -d, c, -a }, \ +} + +#define DEFINE_DST7_P8_MATRIX(a,b,c,d,e,f,g,h) \ +{ \ + { a, b, c, d, e, f, g, h }, \ + { c, f, h, e, b, -a, -d, -g }, \ + { e, g, b, -c, -h, -d, a, f }, \ + { g, c, -d, -f, a, h, b, -e }, \ + { h, -a, -g, b, f, -c, -e, d }, \ + { f, -e, -a, g, -d, -b, h, -c }, \ + { d, -h, e, -a, -c, g, -f, b }, \ + { b, -d, f, -h, g, -e, c, -a }, \ +} + +#define DEFINE_DST7_P16_MATRIX(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \ +{ \ + { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p }, \ + { c, f, i, l, o, o, l, i, f, c, 0, -c, -f, -i, -l, -o }, \ + { e, j, o, m, h, c, -b, -g, -l, -p, -k, -f, -a, d, i, n }, \ + { g, n, l, e, -b, -i, -p, -j, -c, d, k, o, h, a, -f, -m }, \ + { i, o, f, -c, -l, -l, -c, f, o, i, 0, -i, -o, -f, c, l }, \ + { k, k, 0, -k, -k, 0, k, k, 0, -k, -k, 0, k, k, 0, -k }, \ + { m, g, -f, -n, -a, l, h, -e, -o, -b, k, i, -d, -p, -c, j }, \ + { o, c, -l, -f, i, i, -f, -l, c, o, 0, -o, -c, l, f, -i }, \ + { p, -a, -o, b, n, -c, -m, d, l, -e, -k, f, j, -g, -i, h }, \ + { n, -e, -i, j, d, -o, a, m, -f, -h, k, c, -p, b, l, -g }, \ + { l, -i, -c, o, -f, -f, o, -c, -i, l, 0, -l, i, c, -o, f }, \ + { j, -m, c, g, -p, f, d, -n, i, a, -k, l, -b, -h, o, -e }, \ + { h, -p, i, -a, -g, o, -j, b, f, -n, k, -c, -e, m, -l, d }, \ + { f, -l, o, -i, c, c, -i, o, -l, f, 0, -f, l, -o, i, -c }, \ + { d, -h, l, -p, m, -i, e, -a, -c, g, -k, o, -n, j, -f, b }, \ + { b, -d, f, -h, j, -l, n, -p, o, -m, k, -i, g, -e, c, -a }, \ +} + +#define DEFINE_DST7_P32_MATRIX(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F) \ +{ \ + { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F }, \ + { c, f, i, l, o, r, u, x, A, D, F, C, z, w, t, q, n, k, h, e, b, -a, -d, -g, -j, -m, -p, -s, -v, -y, -B, -E }, \ + { e, j, o, t, y, D, D, y, t, o, j, e, 0, -e, -j, -o, -t, -y, -D, -D, -y, -t, -o, -j, -e, 0, e, j, o, t, y, D }, \ + { g, n, u, B, D, w, p, i, b, -e, -l, -s, -z, -F, -y, -r, -k, -d, c, j, q, x, E, A, t, m, f, -a, -h, -o, -v, -C }, \ + { i, r, A, C, t, k, b, -g, -p, -y, -E, -v, -m, -d, e, n, w, F, x, o, f, -c, -l, -u, -D, -z, -q, -h, a, j, s, B }, \ + { k, v, F, u, j, -a, -l, -w, -E, -t, -i, b, m, x, D, s, h, -c, -n, -y, -C, -r, -g, d, o, z, B, q, f, -e, -p, -A }, \ + { m, z, z, m, 0, -m, -z, -z, -m, 0, m, z, z, m, 0, -m, -z, -z, -m, 0, m, z, z, m, 0, -m, -z, -z, -m, 0, m, z }, \ + { o, D, t, e, -j, -y, -y, -j, e, t, D, o, 0, -o, -D, -t, -e, j, y, y, j, -e, -t, -D, -o, 0, o, D, t, e, -j, -y }, \ + { q, E, n, -c, -t, -B, -k, f, w, y, h, -i, -z, -v, -e, l, C, s, b, -o, -F, -p, a, r, D, m, -d, -u, -A, -j, g, x }, \ + { s, A, h, -k, -D, -p, c, v, x, e, -n, -F, -m, f, y, u, b, -q, -C, -j, i, B, r, -a, -t, -z, -g, l, E, o, -d, -w }, \ + { u, w, b, -s, -y, -d, q, A, f, -o, -C, -h, m, E, j, -k, -F, -l, i, D, n, -g, -B, -p, e, z, r, -c, -x, -t, a, v }, \ + { w, s, -d, -A, -o, h, E, k, -l, -D, -g, p, z, c, -t, -v, a, x, r, -e, -B, -n, i, F, j, -m, -C, -f, q, y, b, -u }, \ + { y, o, -j, -D, -e, t, t, -e, -D, -j, o, y, 0, -y, -o, j, D, e, -t, -t, e, D, j, -o, -y, 0, y, o, -j, -D, -e, t }, \ + { A, k, -p, -v, e, F, f, -u, -q, j, B, a, -z, -l, o, w, -d, -E, -g, t, r, -i, -C, -b, y, m, -n, -x, c, D, h, -s }, \ + { C, g, -v, -n, o, u, -h, -B, a, D, f, -w, -m, p, t, -i, -A, b, E, e, -x, -l, q, s, -j, -z, c, F, d, -y, -k, r }, \ + { E, c, -B, -f, y, i, -v, -l, s, o, -p, -r, m, u, -j, -x, g, A, -d, -D, a, F, b, -C, -e, z, h, -w, -k, t, n, -q }, \ + { F, -a, -E, b, D, -c, -C, d, B, -e, -A, f, z, -g, -y, h, x, -i, -w, j, v, -k, -u, l, t, -m, -s, n, r, -o, -q, p }, \ + { D, -e, -y, j, t, -o, -o, t, j, -y, -e, D, 0, -D, e, y, -j, -t, o, o, -t, -j, y, e, -D, 0, D, -e, -y, j, t, -o }, \ + { B, -i, -s, r, j, -A, -a, C, -h, -t, q, k, -z, -b, D, -g, -u, p, l, -y, -c, E, -f, -v, o, m, -x, -d, F, -e, -w, n }, \ + { z, -m, -m, z, 0, -z, m, m, -z, 0, z, -m, -m, z, 0, -z, m, m, -z, 0, z, -m, -m, z, 0, -z, m, m, -z, 0, z, -m }, \ + { x, -q, -g, E, -j, -n, A, -c, -u, t, d, -B, m, k, -D, f, r, -w, -a, y, -p, -h, F, -i, -o, z, -b, -v, s, e, -C, l }, \ + { v, -u, -a, w, -t, -b, x, -s, -c, y, -r, -d, z, -q, -e, A, -p, -f, B, -o, -g, C, -n, -h, D, -m, -i, E, -l, -j, F, -k }, \ + { t, -y, e, o, -D, j, j, -D, o, e, -y, t, 0, -t, y, -e, -o, D, -j, -j, D, -o, -e, y, -t, 0, t, -y, e, o, -D, j }, \ + { r, -C, k, g, -y, v, -d, -n, F, -o, -c, u, -z, h, j, -B, s, -a, -q, D, -l, -f, x, -w, e, m, -E, p, b, -t, A, -i }, \ + { p, -F, q, -a, -o, E, -r, b, n, -D, s, -c, -m, C, -t, d, l, -B, u, -e, -k, A, -v, f, j, -z, w, -g, -i, y, -x, h }, \ + { n, -B, w, -i, -e, s, -F, r, -d, -j, x, -A, m, a, -o, C, -v, h, f, -t, E, -q, c, k, -y, z, -l, -b, p, -D, u, -g }, \ + { l, -x, C, -q, e, g, -s, E, -v, j, b, -n, z, -A, o, -c, -i, u, -F, t, -h, -d, p, -B, y, -m, a, k, -w, D, -r, f }, \ + { j, -t, D, -y, o, -e, -e, o, -y, D, -t, j, 0, -j, t, -D, y, -o, e, e, -o, y, -D, t, -j, 0, j, -t, D, -y, o, -e }, \ + { h, -p, x, -F, y, -q, i, -a, -g, o, -w, E, -z, r, -j, b, f, -n, v, -D, A, -s, k, -c, -e, m, -u, C, -B, t, -l, d }, \ + { f, -l, r, -x, D, -C, w, -q, k, -e, -a, g, -m, s, -y, E, -B, v, -p, j, -d, -b, h, -n, t, -z, F, -A, u, -o, i, -c }, \ + { d, -h, l, -p, t, -x, B, -F, C, -y, u, -q, m, -i, e, -a, -c, g, -k, o, -s, w, -A, E, -D, z, -v, r, -n, j, -f, b }, \ + { b, -d, f, -h, j, -l, n, -p, r, -t, v, -x, z, -B, D, -F, E, -C, A, -y, w, -u, s, -q, o, -m, k, -i, g, -e, c, -a }, \ +} + +const int8_t ff_vvc_dst7_4x4[4][4] = DEFINE_DST7_P4_MATRIX (29, 55, 74, 84); +const int8_t ff_vvc_dst7_8x8[8][8] = DEFINE_DST7_P8_MATRIX (17, 32, 46, 60, 71, 78, 85, 86); +const int8_t ff_vvc_dst7_16x16[16][16] = DEFINE_DST7_P16_MATRIX( 8, 17, 25, 33, 40, 48, 55, 62, 68, 73, 77, 81, 85, 87, 88, 88); +const int8_t ff_vvc_dst7_32x32[32][32] = DEFINE_DST7_P32_MATRIX( 4, 9, 13, 17, 21, 26, 30, 34, 38, 42, 46, 50, 53, 56, 60, 63, 66, 68, 72, 74, 77, 78, 80, 82, 84, 85, 86, 87, 88, 89, 90, 90); + +const int8_t ff_vvc_lfnst_8x8[4][2][16][48] = { + { //0 + { + { -117, 28, 18, 2, 4, 1, 2, 1, 32, -18, -2, 0, -1, 0, 0, 0, 14, -1, -3, 0, -1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, -1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 }, + { -29, -91, 47, 1, 9, 0, 3, 0, -54, 26, -8, 3, 0, 1, 0, 0, 33, 5, -9, -1, -2, 0, -1, 0, -3, 3, 0, 0, 0, 0, 0, 0, 7, 2, -2, 0, -1, 1, 0, 0, 2, 1, -1, 0, 0, 0, 0, 0 }, + { -10, 62, -11, -8, -2, -2, -1, -1, -95, 3, 32, 0, 4, 0, 2, 0, 32, -30, -4, 4, -1, 1, 0, 0, 6, 2, -5, 0, 0, 0, 0, 0, 6, -3, 0, 0, 2, 0, -1, 0, 2, -1, 0, 0, 1, 0, 0, 0 }, + { -15, 15, -10, -2, 1, 0, 1, 0, 10, 112, -20, -17, -4, -4, -1, -2, -20, -26, 31, 1, 0, 0, 0, 0, 2, -16, -1, 6, 0, 1, 0, 0, 1, -4, 0, 0, 0, -3, 0, 1, 0, -1, 0, 0, 0, -2, 0, 0 }, + { 32, 39, 92, -44, 4, -10, 1, -4, 26, 12, -15, 13, -5, 2, -2, 0, 29, -16, -22, 8, 0, 1, 0, 1, -20, 6, 4, -3, 1, 0, 0, 0, 1, -4, -3, 2, -4, 1, 0, 0, 1, -1, -2, 1, -2, 0, 0, 0 }, + { -10, 1, 50, -15, 2, -3, 1, -1, -28, -15, 14, 6, 1, 1, 1, 0, -99, -4, 9, 5, 5, 2, 2, 1, 44, -10, -11, 1, -2, 0, -1, 0, -5, 4, -3, 0, 8, -1, -2, 0, -2, 1, -1, 0, 4, 0, -1, 0 }, + { 1, -33, -11, -14, 7, -2, 2, 0, 29, -12, 37, -7, -4, 0, -1, 0, 6, -99, 3, 26, -1, 5, 0, 2, 14, 30, -27, -2, 1, -1, 0, -1, -6, 6, 6, -3, 1, 3, -3, 0, -1, 1, 1, 0, 0, 1, -1, 0 }, + { 0, 6, -6, 21, -4, 2, 0, 0, -20, -24, -104, 30, 5, 5, 1, 2, -7, -46, 10, -14, 7, 0, 1, 0, 9, 21, 7, -6, -2, -1, 0, -1, 2, 2, 5, -2, 0, 3, 4, -1, 0, 0, 1, 0, 0, 1, 2, -1 }, + { -13, -13, -37, -101, 29, -11, 8, -3, -12, -15, -20, 2, -11, 5, -2, 1, -12, 10, 26, 12, -6, 0, -1, 0, -32, -2, 11, 3, 3, -1, 1, 0, 11, -5, -1, 6, -4, 2, 1, 0, 3, -1, 1, 2, -1, 0, 0, 0 }, + { 6, 1, -14, -36, 9, -3, 2, 0, 10, 9, -18, -1, -3, 1, 0, 0, 38, 26, -13, -1, -5, -1, -1, 0, 102, 3, -14, -1, -5, -1, -2, 0, -29, 10, 10, 0, 10, -4, -1, 1, -7, 1, 2, 1, 2, -1, 0, 0 }, + { -12, -2, -26, -12, -9, 2, -1, 1, -3, 30, 4, 34, -4, 0, -1, 0, -30, 3, -92, 14, 19, 0, 3, 0, -11, 34, 21, -33, 1, -2, 0, -1, -9, -4, 18, 3, 2, 0, 0, -2, -1, -1, 3, 0, 0, 0, 0, -1 }, + { 0, -3, 0, -4, -15, 6, -3, 1, -7, -15, -28, -86, 19, -5, 4, -1, -5, -17, -41, 42, -6, 2, -1, 1, -1, -40, 37, 13, -4, 2, -1, 1, -10, 13, -1, -4, 4, -4, 3, 4, -2, 2, -1, -1, 1, -1, 1, 2 }, + { -1, 9, 13, 5, 14, -2, 2, -1, -8, 3, -4, -62, 4, 1, 1, 0, -12, 23, 16, -11, -17, 0, -1, 0, -11, 97, -3, -3, 0, -6, 0, -2, -21, -5, 23, 0, 2, -2, -1, 6, -3, -3, 1, 0, 0, 0, 0, 2 }, + { 6, 2, -3, 2, 10, -1, 2, 0, 8, 3, -1, -20, 0, 1, 0, 0, -4, 4, -16, 0, -2, 0, 1, 0, 34, 23, 6, -7, -4, -2, -1, 0, 108, -5, -30, 6, -27, 10, 7, -2, 11, -3, -1, 1, -4, 1, 0, 1 }, + { 6, 9, -2, 35, 110, -22, 11, -4, -2, 0, -3, 1, -18, 12, -3, 2, -5, -4, -22, 8, -25, 3, 0, 0, -3, -21, 2, -3, 9, -2, 1, 0, -7, 1, 3, -5, 3, 0, -1, 0, 0, 1, 0, -1, 1, 0, 0, 0 }, + { -1, 7, -2, 9, -11, 5, -1, 1, -7, 2, -22, 4, -13, 0, -1, 0, 0, 28, 0, 76, 4, -6, 0, -2, -13, 5, -76, -4, 33, -1, 3, 0, 9, 18, -3, -35, -4, -1, 6, 1, 1, 2, 0, -3, -1, 0, 2, 0 }, + }, + { + { -108, 48, 9, 1, 1, 1, 0, 0, 44, -6, -9, -1, -1, 0, -1, 0, 9, -9, -1, 1, 0, 0, 0, 0, 3, -1, 1, 0, 0, 0, 0, 0, 1, -1, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0 }, + { 55, 66, -37, -5, -6, -1, -2, 0, 67, -30, -20, 4, -2, 0, -1, 0, -31, -19, 14, 4, 1, 1, 1, 0, -6, 3, 5, -2, 0, 0, 0, 0, -7, -1, 1, 0, -1, 1, 1, 0, -2, -1, 1, 0, 0, 0, 0, 0 }, + { 2, 86, -21, -13, -4, -2, -1, -1, -88, 5, 6, 4, 5, 1, 1, 0, 14, -5, 0, 3, 0, 0, 0, 0, 10, -5, -2, 0, -1, 0, 0, 0, 6, -5, 0, 1, 2, -1, 0, 0, 1, -1, 0, 0, 1, 0, 0, 0 }, + { -24, -21, -38, 19, 0, 4, -1, 2, -23, -89, 31, 20, 2, 3, 1, 1, -30, 26, 36, -8, -2, -2, 0, -1, 14, 18, -7, -9, -1, -1, 0, 0, 1, 3, -2, -1, 3, 2, -2, -1, 0, 1, 0, 0, 1, 1, -1, 0 }, + { 9, 20, 98, -26, -3, -5, 0, -2, -9, -26, 15, -16, 2, 0, 1, 0, -61, -3, -2, 3, 7, 1, 1, 0, 12, 16, -6, -1, 0, -1, 0, 0, 2, 0, -8, 1, 3, 1, -1, 1, 0, -1, -2, 0, 1, 0, -1, 0 }, + { -21, -7, -37, 10, 2, 2, -1, 1, -10, 69, -5, -7, -2, -2, 0, -1, -93, 2, 19, 0, 3, 0, 2, 0, 17, 4, 0, 0, -1, 0, 0, 0, 5, -4, -2, 0, 4, -2, 0, 1, 0, 0, 0, 0, 2, -1, 0, 0 }, + { -10, -25, 4, -17, 8, -2, 2, -1, -27, -17, -71, 25, 8, 2, 1, 1, -4, -66, 28, 36, -5, 3, 0, 1, -10, 20, 33, -13, -8, 0, 0, -1, 3, 6, -3, -7, -1, 3, 3, -1, 1, 0, -1, 0, 0, 1, 1, -1 }, + { 2, 5, 10, 64, -9, 4, -3, 1, -4, 8, 62, 3, -17, 1, -2, 0, -3, -75, 5, -14, 1, 4, 0, 1, -36, 3, 18, -4, 4, 0, 1, 0, 1, 14, -2, -8, -2, 1, -3, 0, 2, 2, -1, -2, 0, 1, -1, 0 }, + { -11, -15, -28, -97, 6, -1, 4, -1, 7, 3, 57, -15, 10, -2, 0, -1, -1, -27, 13, 6, 1, -1, 0, 0, -34, -6, 0, 3, 4, 1, 2, 0, -2, 8, 1, 5, -2, 0, -3, 1, 1, 1, 0, 2, -1, 0, -1, 0 }, + { 9, 13, 24, -6, 7, -2, 1, -1, 16, 39, 20, 47, -2, -2, -2, 0, 28, 23, 76, -5, -25, -3, -3, -1, 6, 36, -7, -39, -4, -1, 0, -1, 2, -4, -18, -3, -1, -1, -2, -2, 1, -2, -2, 0, 0, 0, -1, -1 }, + { -7, 11, 12, 7, 2, -1, 0, -1, -14, -1, -24, 11, 2, 0, 0, 0, -20, 48, 11, -13, -5, -2, 0, -1, -105, -19, 17, 0, 6, 2, 3, 0, -14, 8, 8, 2, 1, 2, -1, -2, 3, 0, -1, 0, 0, 0, 0, 0 }, + { 0, 0, 7, -6, 23, -3, 3, -1, 5, 1, 18, 96, 13, -9, -1, -1, -21, -7, -42, 14, -24, -3, 0, 0, 11, -47, -7, 3, -5, 9, 1, 2, 0, -1, 19, -1, 1, 0, -1, -6, -1, 1, 2, 0, 1, 0, 0, -2 }, + { -2, -6, -1, -10, 0, 1, 1, 0, -7, -2, -28, 20, -15, 4, -3, 1, -2, -32, -2, -66, 3, 7, 1, 2, -11, 13, -70, 5, 43, -2, 3, 0, 8, -14, -3, 43, -1, 2, 7, -1, 1, -2, 1, 3, -1, 1, 1, 0 }, + { -1, 6, -16, 0, 24, -3, 1, -1, 2, 6, 6, 16, 18, -7, 1, -1, -3, 11, -63, 9, 4, -5, 2, -1, -22, 94, -4, -6, -4, -4, 1, -2, 10, 23, -19, -5, 0, -6, -4, 6, 3, -2, 1, 1, 0, -1, 0, 0 }, + { -5, -6, -3, -19, -104, 18, -4, 3, 0, 6, 0, 35, -41, 20, -2, 2, -2, 10, -18, 16, 21, 3, -2, 0, -2, 11, 6, -10, 6, -3, -1, 0, -1, 5, -1, -6, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, -1 }, + { -1, -2, 0, 23, -9, 0, -2, 0, 1, 1, 8, -1, 29, 1, 1, 0, 3, -6, 13, 76, 30, -11, -1, -2, -26, -8, -69, 7, -9, -7, 3, -1, -10, -34, -25, 13, -1, 0, 11, 5, 1, -1, 1, -2, 0, 0, 2, 0 }, + } + }, + { //1 + { + { 110, -49, -3, -4, -1, -1, 0, -1, -38, -1, 10, 0, 2, 0, 1, 0, -9, 13, 1, -2, 0, 0, 0, 0, -4, 2, -3, 0, 0, 0, 0, 0, -2, 2, 0, 1, -1, 1, 0, 0, -1, 1, 0, 0, -1, 0, 0, 0 }, + { -43, -19, 17, -1, 3, 0, 1, 0, -98, 46, 14, -1, 2, 0, 1, 0, 26, 26, -15, -3, -2, -1, -1, 0, 11, -7, -9, 2, 0, 0, 0, 0, 9, -3, -1, 2, 3, -3, 0, 0, 4, -1, 0, 0, 2, -1, 0, 0 }, + { -19, 17, -7, 3, -2, 1, -1, 0, -32, -59, 29, 3, 4, 0, 2, 0, -72, 43, 34, -9, 3, -2, 1, -1, 13, 36, -18, -10, 0, -2, 0, -1, 3, 0, -12, 3, 6, 1, -3, 2, 1, -1, -2, 0, 3, 1, -1, 1 }, + { -35, -103, 39, 1, 7, 0, 2, 0, 38, -13, 25, -6, 1, -1, 0, 0, -1, 7, 6, -7, 1, -1, 0, 0, -13, 14, 2, -4, 2, -1, 0, 0, -2, 11, -6, -2, -2, 4, -3, 0, 0, 3, -2, 0, -1, 1, -1, 0 }, + { 9, 5, -6, -1, -1, 0, -1, 0, 42, 4, 21, -11, 1, -3, 1, -1, 21, 70, -32, -21, 0, -4, -1, -1, 34, -26, -57, 11, 4, 2, 0, 1, -4, -32, 5, 24, 1, -6, 12, 4, -3, -2, 4, -2, 0, -1, 0, 0 }, + { -5, -5, -28, 9, -3, 2, -1, 1, -20, -78, 22, 16, 1, 3, 0, 1, 80, -6, 25, -5, -4, -1, -1, 0, 6, -24, 7, -9, 0, 0, 0, 0, -7, 3, 13, -4, -3, 5, 1, -5, -2, 3, 1, -2, -1, 2, -1, -2 }, + { 14, 17, 27, -12, 1, -3, 1, -1, 8, 19, -13, 4, -2, 1, -1, 0, 48, -1, 48, -15, -4, -2, -1, -1, 1, 60, -28, -42, 5, -6, 1, -2, 11, -11, -51, 11, -2, -10, -2, 13, 2, -6, -4, 4, -2, -3, 2, 2 }, + { 7, 35, 17, -4, -1, 0, 0, 0, 3, 8, 54, -17, 1, -2, 1, -1, 10, 14, -11, -34, 4, -4, 1, -1, -80, -7, -6, 2, 15, 0, 3, 0, -16, 46, 1, 3, 2, 7, -24, 0, 2, -2, -5, 8, 1, -1, -2, 2 }, + { -13, -27, -101, 24, -8, 6, -3, 2, 11, 43, 6, 28, -6, 3, -1, 1, -3, 14, 21, -12, -7, -2, -1, -1, -23, 10, -4, -12, 3, 0, 1, 0, 2, 9, -10, 0, 1, -5, -4, 4, 2, -2, 2, 2, 0, -2, 1, 0 }, + { -11, -13, -3, -10, 3, -1, 1, 0, -19, -19, -37, 8, 4, 2, 0, 1, -12, -30, 3, -9, 5, 0, 1, 0, -56, -9, -47, 8, 21, 1, 4, 1, -11, -30, 10, 59, -2, 8, 41, 8, 2, 5, 6, -7, -1, 3, 5, -2 }, + { -4, -10, -24, -11, 3, -2, 0, -1, -6, -37, -45, -17, 8, -2, 2, -1, 17, 14, -58, 14, 15, 0, 2, 0, -10, 34, -7, 28, 4, -1, 1, 0, 23, 34, -31, 4, 10, -22, -30, 22, 4, -15, 9, 20, 2, -5, 9, 4 }, + { -2, 1, 13, -17, 3, -5, 1, -2, 3, 0, -55, 22, 6, 1, 1, 0, 8, 74, 21, 40, -14, 0, -2, 0, -36, -8, 11, -13, -23, 1, -3, 0, -36, 6, 16, -14, 2, 19, -4, -12, -1, 0, -7, -3, 0, 2, -2, -1 }, + { 3, 1, 5, -15, 1, -2, 1, -1, 7, 4, -7, 29, -1, 2, -1, 1, 8, 3, 12, -14, -9, -1, -1, 0, 4, 29, -15, 31, 10, 4, 1, 1, 61, 22, 55, 14, 13, 3, -9, -65, 1, -11, -21, -7, 0, 0, -1, 3 }, + { -4, -8, -1, -50, 6, -4, 2, -2, -1, 5, -22, 20, 6, 1, 0, 0, -16, -15, 18, -29, -11, 2, -2, 1, 40, -45, -19, -22, 31, 2, 4, 1, -25, 41, 0, 12, 9, 7, -42, 12, -3, -14, 2, 28, 5, 1, 6, 2 }, + { 5, -1, 26, 102, -13, 12, -4, 4, -4, -2, -40, -7, -23, 3, -5, 1, -1, 5, 8, -23, 7, 2, 1, 1, 10, -11, -13, -3, 12, -3, 2, 0, -9, 23, 4, 9, 14, 9, -14, -4, 0, -12, -7, 6, 3, 0, 6, 3 }, + { -5, -6, -27, -22, -12, 0, -3, 0, -5, 8, -20, -83, 0, 0, 0, 0, 9, 7, 24, -20, 41, 3, 6, 1, 15, 20, 12, 11, 17, -9, 1, -2, -26, -1, 18, -1, -12, 32, 3, -18, -5, 10, -25, -5, -2, 1, -8, 10 }, + }, + { + { 80, -49, 6, -4, 1, -1, 1, -1, -72, 36, 4, 0, 1, 0, 0, 0, 26, 0, -12, 2, -2, 1, -1, 0, -7, -9, 6, 1, 0, 0, 0, 0, 3, 5, -1, -2, -2, -2, -1, 1, 1, 1, 0, 0, -1, -1, 0, 0 }, + { -72, -6, 17, 0, 3, 0, 1, 0, -23, 58, -21, 2, -3, 1, -1, 0, 55, -46, -1, 6, -2, 1, -1, 0, -22, 7, 17, -7, 2, -1, 1, 0, 9, 5, -12, 1, -3, -4, 4, 2, 4, 1, -2, -1, -1, -1, 1, 0 }, + { -50, 19, -15, 4, -1, 1, -1, 1, -58, -2, 30, -3, 4, -1, 2, 0, 6, 57, -34, 0, -2, 0, -1, 0, 34, -48, -2, 14, -4, 3, -1, 1, -10, 7, 21, -10, 6, 1, -11, 0, -1, -1, 4, 2, 3, 0, -2, -1 }, + { -33, -43, 28, -7, 4, -2, 2, -1, -38, 11, -8, 4, 1, 1, 0, 0, -55, 24, 26, -5, 2, -1, 1, 0, 15, 46, -40, -1, -1, 0, -1, 0, 17, -38, 1, 17, -3, 11, 15, -11, 3, -1, -10, 1, 0, 1, 3, 2 }, + { 10, 66, -21, -3, -3, 0, -1, 0, -53, -41, -2, 16, -1, 4, -1, 1, 36, -5, 41, -20, 3, -3, 1, -1, -30, 26, -32, -3, 7, -2, 2, -1, 15, -8, 1, 17, -1, -2, 4, -8, 2, 0, -1, 3, 0, 0, 0, -1 }, + { 18, 14, 13, -9, 2, -2, 1, -1, 34, 32, -31, 12, -5, 2, -2, 1, 40, 4, -4, -9, -3, -2, -1, -1, 27, -31, -43, 19, -2, 3, -1, 1, 7, -49, 52, 10, -11, 22, 7, -26, -1, -6, -9, 6, -2, 2, 4, -2 }, + { 21, 66, -1, 9, -4, 2, -1, 1, -21, 41, -30, -10, 0, -2, 0, -1, -35, -17, -3, 26, -6, 5, -2, 2, 56, 3, 18, -25, -1, -2, -1, -1, -15, -13, -27, 9, 9, -6, 20, 5, -3, 2, -6, -9, 3, -3, 1, 5 }, + { 1, -6, -24, 17, -5, 3, -2, 1, 24, 10, 39, -21, 5, -4, 2, -1, 33, 32, -30, 4, -3, -1, -1, 0, -4, 13, -16, -10, 0, -1, 0, 0, 24, -26, -37, 33, 5, -32, 55, -5, -7, 22, -14, -22, 1, -9, -3, 13 }, + { 9, 33, -24, 1, 4, 0, 1, 0, 6, 50, 26, 1, -10, 0, -2, 0, -27, 1, -28, -21, 16, -5, 3, -2, -23, 36, -2, 40, -17, 4, -3, 1, 43, -13, 4, -41, -19, -2, -24, 17, 11, -4, 8, 4, -3, -3, -3, -3 }, + { -7, -9, -32, 14, -3, 3, -1, 1, -23, -28, 0, -5, -1, 0, 0, 0, -36, -59, -24, 14, 4, 2, 1, 1, -23, -26, 23, 26, -3, 5, 0, 2, 10, -26, 38, 7, -12, 11, 42, -22, -5, 20, -14, -15, -1, -2, 1, 6 }, + { 6, 30, 69, -18, 5, -4, 3, -1, -3, -11, -34, -16, 9, -4, 2, -1, -16, 35, -35, 30, -9, 3, -2, 1, -57, -13, 6, 4, -5, 5, -1, 1, 28, 10, 4, 7, 0, -15, 7, -10, -1, 7, -2, 2, 1, -3, 0, 0 }, + { 1, -8, 24, -3, 7, -2, 2, -1, -6, -51, -6, -4, -5, 0, -1, 0, 38, -1, 0, 25, 6, 2, 1, 1, 47, 20, 35, 1, -27, 1, -5, 0, 37, -37, -9, -47, -28, 5, 0, 18, 8, 6, 0, -8, -4, -3, -3, 1 }, + { 4, 10, 4, 17, -9, 4, -2, 1, 5, 14, 32, -15, 9, -3, 2, -1, 7, 13, 19, 15, -8, 1, -1, 0, 3, 25, 30, -18, 1, -2, 0, -1, 11, 24, 22, -11, -3, 37, -13, -58, -5, 12, -63, 26, 9, -15, 11, 8 }, + { -3, -9, -23, 10, -10, 3, -3, 1, -5, -14, -16, -27, 13, -5, 2, -1, -1, -13, -30, 11, -5, 2, -1, 0, -5, -8, -22, -16, 10, 0, 1, 0, 0, -29, -27, 6, -27, -10, -30, 9, -3, -10, -7, 77, 9, -13, 45, -8 }, + { 2, 11, 22, 2, 9, -2, 2, 0, -6, -7, 20, -32, -3, -4, 0, -1, 13, -5, -28, 6, 18, -4, 3, -1, -26, 27, -14, 6, -20, 0, -2, 0, -76, -26, -4, -7, 12, 51, 5, 24, 7, -17, -16, -12, -5, 4, 2, 13 }, + { 2, -3, 8, 14, -5, 3, -1, 1, -2, -11, 5, -18, 8, -3, 2, -1, 12, -23, -19, 22, 2, 0, 1, 0, 23, 41, -7, 35, -10, 4, -1, 1, 5, 7, 23, 5, 69, -38, -8, -32, -15, -31, 24, 11, 2, 18, 11, -15 }, + } + }, + { //2 + { + { -121, 33, 4, 4, 1, 2, 0, 1, -1, -1, 1, 0, 0, 0, 0, 0, 24, -5, -1, -1, 0, 0, 0, 0, 5, -1, 0, 0, 0, 0, 0, 0, 3, -1, 0, 0, 2, -1, 0, 0, 2, -1, 0, 0, 1, 0, 0, 0 }, + { 0, -2, 0, 0, 0, 0, 0, 0, 121, -23, -7, -3, -2, -1, -1, 0, 17, 1, -2, 0, 0, 0, 0, 0, -27, 4, 2, 0, 0, 0, 0, 0, -12, 2, 1, 0, -5, 1, 0, 0, -1, 0, 0, 0, -2, 0, 0, 0 }, + { -20, 19, -5, 2, -1, 1, 0, 0, 16, 3, -2, 0, 0, 0, 0, 0, -120, 14, 8, 1, 3, 1, 1, 0, -18, -2, 3, 0, 1, 0, 0, 0, 17, -3, -1, 0, 6, -1, -1, 0, 2, 0, 0, 0, 2, 0, 0, 0 }, + { 32, 108, -43, 10, -9, 3, -3, 1, 4, 19, -7, 1, -1, 0, 0, 0, 11, -30, 9, -2, 1, -1, 0, 0, 0, -8, 2, 0, 0, 0, 0, 0, -7, -1, 2, 0, -3, -1, 1, 0, -2, -2, 1, 0, 0, 0, 0, 0 }, + { -3, 0, -1, 0, 0, 0, 0, 0, -29, 11, -2, 1, 0, 0, 0, 0, 12, 7, -1, 0, 0, 0, 0, 0, -117, 12, 9, 1, 3, 0, 1, 0, -32, -3, 3, 0, 12, -2, -1, 0, 7, 0, 0, 0, 1, 0, 0, 0 }, + { -4, -12, -3, 1, -1, 0, 0, 0, 19, 105, -31, 7, -6, 1, -2, 0, 9, 46, -6, 0, 0, 0, 0, 0, 8, -29, 9, -3, 1, 0, 0, 0, -3, -19, 3, 0, -4, -6, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0 }, + { 7, 1, 2, 0, 0, 0, 0, 0, 4, 3, -2, 0, 0, 0, 0, 0, 22, -8, 1, -1, 0, 0, 0, 0, -28, -9, 4, 0, 1, 0, 0, 0, 117, -10, -8, 0, 32, 1, -4, 0, 3, 1, -1, 0, -3, 1, 0, 0 }, + { -8, -31, 14, -4, 3, -1, 1, 0, 9, 43, 0, 1, -1, 0, 0, 0, -13, -105, 17, -2, 2, 0, 0, 0, -8, -25, -3, 0, 0, 0, 0, 0, -7, 32, -5, 1, -1, 4, 0, 0, 2, -1, 0, 0, 1, 0, -1, 0 }, + { -15, -43, -100, 23, -12, 6, -4, 2, -6, -17, -48, 10, -5, 2, -1, 1, 1, -5, 19, -6, 3, -1, 1, 0, 2, 7, 15, -3, 1, -1, 0, 0, 4, 10, 5, -1, 0, 3, 1, 0, -2, 1, 2, 0, -1, 1, 1, 0 }, + { -3, 1, 2, 0, 0, 0, 0, 0, -6, 3, 1, 0, 0, 0, 0, 0, 0, 3, -2, 0, 0, 0, 0, 0, -20, 8, -2, 0, 0, 0, 0, 0, 30, 13, -3, 0, -116, 6, 10, 0, -35, -5, 4, 0, -3, -1, 0, 0 }, + { -1, -6, -3, 2, -1, 0, 0, 0, -6, -35, 9, 0, 2, 0, 0, 0, 1, -6, 11, -2, 2, 0, 1, 0, -9, -100, 17, -1, 1, 0, 0, 0, -10, -63, 1, 2, -17, 3, -4, 0, -1, 9, -1, 0, 3, 4, -1, 0 }, + { -5, -14, -48, 2, -5, 1, -2, 0, 10, 24, 99, -17, 10, -4, 3, -1, 4, 14, 32, 0, 2, 0, 1, 0, -4, 0, -39, 6, -4, 1, -1, 0, 2, -3, -4, 0, 2, -2, -2, 0, 0, 0, -1, 0, 0, -1, -1, 0 }, + { -2, 0, 2, 0, 0, 0, 0, 0, -2, 0, 1, 0, 0, 0, 0, 0, -1, -1, 1, -1, 0, 0, 0, 0, -1, -4, 2, 0, 0, 0, 0, 0, -8, -2, -1, 1, 30, 4, -4, 1, -102, 4, 8, -1, -69, -2, 6, -1 }, + { -2, -10, -4, 0, 0, 0, 0, 0, 3, 11, -1, -1, 0, 0, 0, 0, -6, -40, -15, 6, -2, 1, 0, 0, 5, 57, -6, 2, 0, 0, 0, 0, 1, -95, 18, -6, -10, -34, -2, 0, -4, 17, -2, 0, 0, 2, 1, 0 }, + { -2, -3, -25, -2, -3, 0, -1, 0, -1, -3, -1, 4, -2, 2, 0, 1, -7, -8, -97, 17, -9, 3, -3, 1, -8, -26, -61, -1, -3, -1, -1, -1, 2, 10, 24, -7, 5, 9, 19, -1, 0, 1, 4, 0, -2, 0, 1, 0 }, + { 4, -4, 28, 103, -42, 24, -9, 7, 1, 2, 4, 0, 3, -1, 0, 0, -1, 0, -9, -42, 17, -9, 3, -2, -1, 1, -14, 6, -4, 2, -1, 0, -1, -2, -4, 4, 0, 3, 1, -1, 0, 2, 0, -2, 2, 0, 0, 0 }, + }, + { + { 87, -41, 3, -4, 1, -1, 0, -1, -73, 28, 2, 1, 1, 1, 0, 0, 30, -5, -6, 1, -1, 0, 0, 0, -8, -3, 3, 0, 0, 0, 0, 0, 3, 2, -1, 0, -2, -1, 0, 0, 1, 1, 0, 0, -1, 0, 0, 0 }, + { -75, 4, 7, 0, 2, 0, 1, 0, -41, 36, -7, 3, -1, 1, 0, 0, 72, -29, -2, 0, -1, 0, -1, 0, -37, 6, 7, -2, 1, 0, 0, 0, 12, 3, -4, 0, -3, -2, 1, 0, 4, 0, 0, 0, -1, 0, 0, 0 }, + { 26, -44, 22, -6, 4, -2, 1, -1, 77, 24, -22, 2, -4, 0, -1, 0, 7, -38, 10, 0, 1, 0, 0, 0, -51, 27, 4, -3, 2, -1, 1, 0, 31, -5, -8, 3, -14, 0, 5, -1, 6, 1, -3, 0, -4, -1, 1, 0 }, + { -39, -68, 37, -7, 6, -2, 2, 0, -9, 56, -21, 1, -2, 0, -1, 0, -45, 4, -3, 6, -1, 2, 0, 1, 49, -13, 3, -3, -1, 0, 0, 0, -19, 2, 0, 0, 5, 1, 1, 0, -2, 0, -1, 0, 1, 0, 0, 0 }, + { 10, -20, 2, 0, 1, 0, 0, 0, 50, -1, 8, -5, 1, -1, 0, 0, 66, 17, -24, 4, -3, 1, -1, 0, 13, -49, 15, 1, 0, 0, 0, 0, -53, 34, 6, -5, 30, -7, -11, 3, -11, -2, 5, 1, 4, 2, -1, -1 }, + { -21, -45, 8, -2, 3, -1, 1, 0, -7, -30, 26, -8, 3, -1, 1, -1, -9, 69, -33, 5, -2, 0, -1, 0, -44, -31, 10, 7, -2, 2, 0, 1, 49, 7, 2, -6, -23, -3, -2, 2, 9, 4, 0, 0, -2, -1, -1, 0 }, + { -4, -2, -55, 28, -8, 5, -3, 2, -2, 37, 43, -19, 1, -2, 1, -1, -47, -34, -27, 5, 4, -1, 1, 0, -39, -2, 27, 4, -2, 1, 0, 0, -11, 32, -8, -7, 27, -12, -6, 6, -13, 0, 4, -3, 3, -1, -2, 1 }, + { 2, 19, 47, -23, 6, -4, 2, -1, -23, -22, -44, 17, -2, 2, -1, 0, -33, 3, 22, -2, -4, 1, -1, 0, -58, -17, 6, -6, 7, -1, 1, 0, -23, 40, -2, 5, 43, -11, -8, -1, -18, -4, 5, 2, 4, 3, 0, -1 }, + { -19, -62, -9, 3, 0, 0, 0, 0, -12, -56, 27, -7, 3, -1, 1, 0, 7, -8, 16, -6, 4, -2, 1, -1, -15, 54, -23, 2, -1, 0, 0, 0, -42, -25, 4, 6, 34, 8, 2, -2, -15, -1, 0, -1, 3, 2, 0, 1 }, + { 1, 9, -5, 0, -1, 0, 0, 0, 0, 22, -1, 2, 0, 1, 0, 0, -13, 17, 0, -2, 0, -1, 0, 0, -46, -10, -10, 4, -1, 1, 0, 0, -80, -27, 20, -4, -66, 23, -2, -2, 20, -3, -2, 3, -14, 2, 3, -1 }, + { 5, 17, -9, 0, -2, 1, 0, 0, 13, 54, -2, 7, -1, 1, 0, 0, 4, 51, -3, -6, -1, -1, 0, 0, -20, 6, -34, 9, -2, 2, -1, 0, 16, -52, 28, 1, 59, 15, -8, -5, -28, -7, 2, 2, 10, 3, 0, -1 }, + { 7, 27, 56, -2, 10, -3, 3, -1, -2, -6, 8, -28, 3, -4, 1, -1, -1, -4, -68, 35, -5, 5, -2, 1, 0, 35, 43, -4, -6, 1, -1, 0, -14, -38, -12, -10, 9, 5, 7, 6, -9, 7, -4, -3, 4, -4, 0, 3 }, + { 0, 0, 19, -4, 3, -2, 2, -1, -3, -13, 10, -4, 1, 0, 0, 0, -6, -37, -18, -5, 2, -2, 1, -1, 6, -6, -7, 25, -6, 4, -1, 1, 16, 10, 55, -24, 15, 46, -52, 1, 35, -43, 10, 12, -23, 13, 5, -8 }, + { -3, 0, -27, -80, 40, -16, 6, -4, 4, 3, 31, 61, -22, 7, -1, 1, -4, -7, -26, -6, -10, 6, -4, 1, 3, 8, 14, -18, 15, -5, 2, -1, -2, -4, -1, 13, 0, 2, -4, -3, 3, -1, 2, 1, -2, 0, -2, -1 }, + { 1, 2, -8, 6, -1, 1, 0, 0, 2, 8, -5, -1, 0, 0, 0, 0, 1, 24, 3, 5, -1, 1, 0, 0, -3, 12, 6, -10, 1, -1, 0, 0, -9, -1, -25, 10, 45, -11, 18, 2, 86, 1, -13, -4, -65, -6, 7, 2 }, + { -4, -18, -57, 8, -8, 1, -3, 0, -5, -20, -69, 7, -6, 2, -2, 1, 1, 4, 0, 33, -7, 5, -2, 1, 0, -9, 53, -22, 3, -1, 0, 0, 4, -27, -2, -9, 5, 36, -13, 5, -7, -17, 1, 2, 4, 6, 4, -1 }, + } + }, + { //3 + { + { -115, 37, 9, 2, 2, 1, 1, 0, 10, -29, 8, 0, 1, 0, 1, 0, 23, -8, -8, 1, -1, 0, 0, 0, 3, 3, -2, -1, 0, 0, 0, 0, 4, 0, 0, -1, 1, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0 }, + { 15, 51, -18, 0, -3, 0, -1, 0, -95, 7, 34, -3, 5, -1, 2, 0, 23, -47, 1, 6, 0, 1, 0, 1, 8, 5, -12, 0, -1, 0, 0, 0, 3, -3, 1, -1, 2, 1, -2, 0, 1, -1, 0, 0, 1, 1, -1, 0 }, + { 29, -22, 16, -6, 3, -2, 1, -1, -4, -80, 12, 15, 0, 3, 0, 1, 45, 7, -59, 7, -2, 1, -1, 0, -15, 41, -3, -16, 2, -3, 0, -1, 1, 0, 7, -2, -3, 6, 1, -2, 0, 0, 1, 0, -1, 2, 0, -1 }, + { -36, -98, 25, 5, 4, 1, 2, 1, -59, 11, -17, 1, 1, 1, 0, 0, 6, -13, 7, -3, 0, 0, 0, 0, 14, -4, -14, 3, -1, 0, 0, 0, 2, 8, -3, -5, 2, 0, 0, 0, 0, 3, 0, -1, 1, 0, 0, 0 }, + { -6, 18, 3, -3, -1, 0, 0, 0, -50, -5, -38, 12, 0, 2, 0, 1, 3, 67, -7, -40, 3, -6, 1, -3, -12, -13, 65, -3, -10, 0, -1, 0, 9, -20, -5, 22, -2, 0, 0, -1, 2, -3, -2, 3, -1, 0, 1, 0 }, + { 4, 15, 52, -13, 5, -3, 2, -1, -17, -45, 16, 24, -2, 4, -1, 2, -87, -8, -14, 7, 8, 1, 2, 0, 23, -35, -6, -3, 1, 1, 0, 0, 2, 5, -17, 0, 3, -1, -1, -5, 0, 1, -4, 0, 1, 0, 0, -2 }, + { -20, -7, -43, 4, 0, 1, -1, 1, -7, 35, 0, 12, -4, 1, -1, 0, -51, -2, -57, 5, 15, 0, 4, 0, 7, 39, 5, -55, 1, -7, 1, -3, 1, -10, 41, 2, 4, -3, -2, 3, -1, -2, 7, 1, 1, -1, -1, 0 }, + { 4, 29, 1, 26, -5, 4, -2, 1, -17, -7, -73, 6, 6, 2, 1, 1, -5, 21, -3, 5, -1, -3, 0, -1, -11, 2, -52, -3, 27, -2, 5, 0, 0, 27, 8, -58, 2, -5, 25, 3, 0, 3, 0, -5, 0, -2, 7, 0 }, + { 12, 13, 10, 2, -1, 3, -1, 1, 17, -2, -46, 12, 7, 0, 2, 0, 16, -45, -9, -53, 6, 1, 1, 0, 70, 16, 8, -4, -37, 1, -7, 0, -12, 29, 3, 21, 4, 0, 5, -1, -3, 4, 1, 4, 2, 0, 1, 0 }, + { 5, 20, 90, -17, 4, -3, 2, -1, 6, 66, 8, 28, -7, 3, -1, 1, 29, 5, -19, 12, 9, -1, 1, 0, -10, 14, -1, -13, 7, 0, 1, 0, 0, -6, 13, -4, 0, -4, 1, 5, 0, -1, -1, 1, 0, -1, 0, 0 }, + { -3, -4, -34, -12, 2, -1, -1, 0, 5, 25, 11, 43, -10, 4, -2, 1, 23, 20, -40, 12, 21, -3, 4, -1, 25, -28, -10, 5, 8, 6, 0, 2, -4, 21, -64, -8, -5, 19, 10, -48, 3, -1, 10, -3, 0, 4, 3, -6 }, + { -1, -3, 2, 19, -2, 4, -1, 2, 9, 3, -35, 22, 11, 1, 2, 0, -7, -65, -19, -22, 11, 4, 2, 1, -75, -18, 3, -1, -10, 2, 0, 1, 2, -35, -27, 4, 1, 8, -17, -19, 3, 0, 3, -6, 0, 2, -1, -2 }, + { 10, -4, -6, 12, 5, 1, 1, 0, 11, -9, -12, -2, -7, 0, -1, 0, 33, -10, -4, 18, 18, -4, 4, -1, 28, -72, 1, -49, 15, 2, 2, 1, 56, -23, 22, -1, 4, -1, -15, 26, 6, 4, -10, 0, 0, 2, -3, 2 }, + { 4, 6, 14, 53, -4, 4, 0, 2, 0, -1, -20, -13, 3, 2, -1, 1, -3, 1, -5, 35, -16, -6, -1, -2, 46, 29, 13, 21, 37, -5, 4, -1, -10, -53, -18, 8, 9, 12, -41, -25, -2, 2, 13, -16, 4, 1, -5, 1 }, + { 2, 9, 13, 37, 19, 6, 2, 2, -9, -3, -9, -28, -20, -4, -3, -1, 1, 18, 9, 28, 24, 6, 2, 2, -20, -5, -25, -33, -36, 9, -2, 2, -13, 42, 1, 57, -22, -2, -25, -28, 5, 6, 19, -12, -5, -3, -2, 4 }, + { 3, -3, 12, 84, -12, 8, -2, 3, 6, 13, 50, -1, 45, 1, 7, 0, -2, 18, -22, -37, -13, 14, 0, 3, 1, -12, -3, 2, -15, -8, 1, -1, 19, 14, -4, -12, -4, 5, 17, 8, 2, -4, -4, 4, -2, 2, 1, 0 }, + }, + { + { 109, -26, -8, -3, -2, -1, -1, 0, -50, 28, 2, 1, 0, 0, 0, 0, -18, -8, 6, 0, 1, 0, 1, 0, 6, -2, -3, 0, 0, 0, 0, 0, -3, 2, 1, -1, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0 }, + { -39, 31, -5, 2, -1, 1, 0, 0, -95, 6, 18, 0, 4, 0, 1, 0, 32, -49, 5, 1, 1, 0, 0, 0, 27, -1, -14, 2, -2, 1, -1, 0, 3, 5, -3, -2, 4, 1, -1, -1, 2, 0, 0, 0, 2, 0, 0, 0 }, + { 29, -3, -2, -2, 0, 0, 0, 0, 0, -41, 9, 0, 2, 0, 1, 0, 86, 4, -33, 2, -6, 1, -2, 0, -32, 58, 1, -7, 0, -2, 0, -1, -14, -8, 20, 0, -2, -3, 0, 4, -1, -1, 0, 0, -1, 1, 0, 0 }, + { 18, 96, -23, 2, -5, 1, -2, 0, -10, 6, 10, -2, 1, -1, 1, 0, -14, 26, 2, -4, 1, -1, 0, 0, -43, -9, 35, -2, 4, -1, 1, 0, 14, -40, 1, 10, 2, 1, -10, 1, 2, -4, -1, -1, 0, 0, -1, 0 }, + { -29, -60, 16, -2, 3, -1, 1, 0, -52, 9, -17, 5, -2, 1, -1, 1, 13, 56, -2, -9, 0, -2, 0, -1, -34, -18, 41, 0, 3, 0, 1, 0, 19, -36, -10, 13, 3, 6, -14, -1, 3, 1, -1, -3, 1, 1, -1, -1 }, + { -23, -5, -15, 5, -2, 1, -1, 1, 2, 79, -13, -4, -2, -1, -1, 0, -9, 1, 5, -1, 1, 0, 0, 0, -4, 49, 2, -14, 1, -3, 0, -1, -31, -14, 56, -1, 13, -37, -4, 20, -2, 2, -10, 0, 2, -4, 0, -1 }, + { -7, -3, 12, -3, 3, -1, 1, 0, -31, -62, 8, 7, 0, 2, 0, 1, -75, 9, -45, 5, -1, 1, -1, 0, 14, 35, 0, -23, 2, -5, 1, -2, 1, -8, 32, -1, 7, -12, -4, 10, 0, 2, -6, -1, 2, 0, 0, -2 }, + { 1, -26, 5, 0, 1, 0, 1, 0, 24, -3, 43, -6, 4, -2, 1, -1, -7, -64, 9, 14, 0, 3, 0, 1, -12, -4, 5, 3, -1, 1, 0, 0, 8, -59, -3, 26, 14, 6, -58, 6, -5, 17, -7, -18, 3, 3, -1, -5 }, + { 11, 14, 6, -3, 1, -1, 1, 0, 10, -7, -9, 3, -2, 1, -1, 0, 22, 21, 1, -21, 2, -4, 1, -2, 92, 1, 53, 0, -9, 1, -2, 0, -21, -11, 1, 40, -5, -4, -24, 5, -4, 5, -6, -5, 0, 0, 0, -3 }, + { -10, -11, -47, 3, -4, 1, -1, 0, 5, 28, 11, -2, -1, 0, 0, 0, -12, -2, -38, 2, 0, 1, 0, 0, 16, 38, 11, -16, -1, -3, 0, -2, 12, -9, -22, 7, -8, 60, 4, -36, -6, -15, 54, 7, 3, -7, -8, 14 }, + { -8, -24, -99, 11, -10, 3, -4, 1, -5, -36, 19, -26, 4, -5, 1, -2, 0, 25, 41, 5, -3, 1, 0, 0, 10, -5, -7, 12, 2, 1, 0, 0, -1, 1, 9, -3, -3, -14, -3, 12, 2, 4, -13, -2, -1, 3, 2, -4 }, + { -5, 1, -1, 0, 1, 0, 0, 0, -10, -14, -6, 8, 0, 1, 0, 0, -17, -2, 7, -5, 3, -1, 0, 0, -16, 13, 3, 31, -1, 6, 0, 2, -93, -15, -46, -3, 23, -19, 0, -47, 8, 4, 8, 3, 2, 3, 0, 0 }, + { 1, 12, -20, 21, -4, 5, -2, 2, -5, -2, -75, 9, -1, 2, -1, 1, -1, -2, -16, -4, 0, -1, 0, 0, -7, 7, -31, 0, 3, 0, 0, 0, 4, 11, -12, 4, -12, 14, -50, -1, -8, 32, -4, -54, 2, 0, 30, -15 }, + { 2, -9, -18, 8, -3, 3, -1, 1, 3, -25, -62, -6, 0, -2, 0, -1, -6, -61, 14, -51, 2, -6, 0, -2, -19, 0, 40, -7, -17, 0, -3, 0, 13, -4, 11, 9, 17, 0, 24, 5, 1, -12, 4, 28, 0, 0, -15, 8 }, + { 4, 9, 39, 18, 0, 2, 0, 1, -6, -16, -22, -37, 5, -5, 1, -2, -5, 15, 63, 9, -16, 0, -3, 0, 18, 42, -18, 27, 15, 1, 3, 1, 12, -34, 9, -24, 4, 28, -2, 4, -11, -4, 30, 2, 5, -13, -4, 18 }, + { -7, -2, 15, -6, 1, -1, 1, -1, -11, -3, 22, -14, 0, -2, 1, -1, -18, -7, 30, -9, -4, 0, -1, 0, -35, 23, 23, 10, -17, 1, -3, 0, -19, 53, 6, 48, -65, 12, -12, 11, -8, -16, 10, -21, -2, -12, 6, 2 }, + } + } +}; + +const int8_t ff_vvc_lfnst_4x4[4][2][16][16] = { + { //0 + { + { 108, -44, -15, 1, -44, 19, 7, -1, -11, 6, 2, -1, 0, -1, -1, 0 }, + { -40, -97, 56, 12, -11, 29, -12, -3, 18, 18, -15, -3, -1, -3, 2, 1 }, + { 25, -31, -1, 7, 100, -16, -29, 1, -54, 21, 14, -4, -7, 2, 4, 0 }, + { -32, -39, -92, 51, -6, -16, 36, -8, 3, 22, 18, -15, 4, 1, -5, 2 }, + { 8, -9, 33, -8, -16, -102, 36, 23, -4, 38, -27, -5, 5, 16, -8, -6 }, + { -25, 5, 16, -3, -38, 14, 11, -3, -97, 7, 26, 1, 55, -10, -19, 3 }, + { 8, 9, 16, 1, 37, 36, 94, -38, -7, 3, -47, 11, -6, -13, -17, 10 }, + { 2, 34, -5, 1, -7, 24, -25, -3, 8, 99, -28, -29, 6, -43, 21, 11 }, + { -16, -27, -39, -109, 6, 10, 16, 24, 3, 19, 10, 24, -4, -7, -2, -3 }, + { -9, -10, -34, 4, -9, -5, -29, 5, -33, -26, -96, 33, 14, 4, 39, -14 }, + { -13, 1, 4, -9, -30, -17, -3, -64, -35, 11, 17, 19, -86, 6, 36, 14 }, + { 8, -7, -5, -15, 7, -30, -28, -87, 31, 4, 4, 33, 61, -5, -17, 22 }, + { -2, 13, -6, -4, -2, 28, -13, -14, -3, 37, -15, -3, -2, 107, -36, -24 }, + { 4, 9, 11, 31, 4, 9, 16, 19, 12, 33, 32, 94, 12, 0, 34, -45 }, + { 2, -2, 8, -16, 8, 5, 28, -17, 6, -7, 18, -45, 40, 36, 97, -8 }, + { 0, -2, 0, -10, -1, -7, -3, -35, -1, -7, -2, -32, -6, -33, -16, -112 }, + }, + { + { 119, -30, -22, -3, -23, -2, 3, 2, -16, 3, 6, 0, -3, 2, 1, 0 }, + { -27, -101, 31, 17, -47, 2, 22, 3, 19, 30, -7, -9, 5, 3, -5, -1 }, + { 0, 58, 22, -15, -102, 2, 38, 2, 10, -13, -5, 4, 14, -1, -9, 0 }, + { 23, 4, 66, -11, 22, 89, -2, -26, 13, -8, -38, -1, -9, -20, -2, 8 }, + { -19, -5, -89, 2, -26, 76, -11, -17, 20, 13, 18, -4, 1, -15, 3, 5 }, + { -10, -1, -1, 6, 23, 25, 87, -7, -74, 4, 39, -5, 0, -1, -20, -1 }, + { -17, -28, 12, -8, -32, 14, -53, -6, -68, -67, 17, 29, 2, 6, 25, 4 }, + { 1, -24, -23, 1, 17, -7, 52, 9, 50, -92, -15, 27, -15, -10, -6, 3 }, + { -6, -17, -2, -111, 7, -17, 8, -42, 9, 18, 16, 25, -4, 2, -1, 11 }, + { 9, 5, 35, 0, 6, 21, -9, 34, 44, -3, 102, 11, -7, 13, 11, -20 }, + { 4, -5, -5, -10, 15, 19, -2, 6, 6, -12, -13, 6, 95, 69, -29, -24 }, + { -6, -4, -9, -39, 1, 22, 0, 102, -19, 19, -32, 30, -16, -14, -8, -23 }, + { 4, -4, 7, 8, 4, -13, -18, 5, 0, 0, 21, 22, 58, -88, -54, 28 }, + { -4, -7, 0, -24, -7, 0, -25, 3, -3, -30, 8, -76, -34, 4, -80, -26 }, + { 0, 6, 0, 30, -6, 1, -13, -23, 1, 20, -2, 80, -44, 37, -68, 1 }, + { 0, 0, -1, 5, -1, -7, 1, -34, -2, 3, -6, 19, 5, -38, 11, -115 }, + } + }, + { //1 + { + { -111, 39, 4, 3, 44, 11, -12, -1, 7, -16, -5, 2, 3, -1, 4, 2 }, + { -47, -27, 15, -1, -92, 43, 20, -2, 20, 39, -16, -5, 10, -5, -13, 2 }, + { -35, -23, 4, 4, -17, -72, 32, 6, -59, 18, 50, -6, 0, 40, 0, -13 }, + { 13, 93, -27, -4, -48, 13, -34, 4, -52, 11, 1, 10, 3, 16, -3, 1 }, + { -11, -27, 1, 2, -47, -4, -36, 10, -2, -85, 14, 29, -20, -2, 57, 4 }, + { 0, -35, 32, -2, 26, 60, -3, -17, -82, 1, -30, 0, -37, 21, 3, 12 }, + { -17, -46, -92, 14, 7, -10, -39, 29, -17, 27, -28, 17, 1, -15, -13, 17 }, + { 4, -10, -23, 4, 16, 58, -17, 26, 30, 21, 67, 2, -13, 59, 13, -40 }, + { 5, -20, 32, -5, 8, -3, -46, -7, -4, 2, -15, 24, 100, 44, 0, 5 }, + { -4, -1, 38, -18, -7, -42, -63, -6, 33, 34, -23, 15, -65, 33, -20, 2 }, + { -2, -10, 35, -19, 5, 8, -44, 14, -25, 25, 58, 17, 7, -84, -16, -18 }, + { 5, 13, 18, 34, 11, -4, 18, 18, 5, 58, -3, 42, -2, -10, 85, 38 }, + { -5, -7, -34, -83, 2, -1, -4, -73, 4, 20, 15, -12, 4, -3, 44, 12 }, + { 0, 4, -2, -60, 5, 9, 42, 34, 5, -14, 9, 80, -5, 13, -38, 37 }, + { -1, 2, 7, -57, 3, -7, 9, 68, -9, 6, -49, -20, 6, -4, 36, -64 }, + { -1, 0, -12, 23, 1, -4, 17, -53, -3, 4, -21, 72, -4, -8, -3, -83 }, + }, + { + { 88, -55, 6, -3, -66, 27, 9, -2, 11, 11, -13, 1, -2, -7, 1, 2 }, + { -58, -20, 27, -2, -27, 75, -29, 0, 47, -42, -11, 11, -9, -3, 19, -4 }, + { -51, 23, -22, 5, -63, 3, 37, -5, 1, 64, -35, -4, 29, -31, -11, 13 }, + { -27, -76, 49, -2, 40, 14, 9, -17, -56, 36, -25, 6, 14, 3, -6, 8 }, + { 19, -4, -36, 22, 52, 7, 36, -23, 28, -17, -64, 15, -5, -44, 48, 9 }, + { 29, 50, 13, -10, 1, 34, -59, 1, -51, 4, -16, 30, 52, -33, 24, -5 }, + { -12, -21, -74, 43, -13, 39, 18, -5, -58, -35, 27, -5, 19, 26, 6, -5 }, + { 19, 38, -10, -5, 28, 66, 0, -5, -4, 19, -30, -26, -40, 28, -60, 37 }, + { -6, 27, 18, -5, -37, -18, 12, -25, -44, -10, -38, 37, -66, 45, 40, -7 }, + { -13, -28, -45, -39, 0, -5, -39, 69, -23, 16, -12, -18, -50, -31, 24, 13 }, + { -1, 8, 24, -51, -15, -9, 44, 10, -28, -70, -12, -39, 24, -18, -4, 51 }, + { -8, -22, -17, 33, -18, -45, -57, -27, 0, -31, -30, 29, -2, -13, -53, 49 }, + { 1, 12, 32, 51, -8, 8, -2, -31, -22, 4, 46, -39, -49, -67, 14, 17 }, + { 4, 5, 24, 60, -5, -14, -23, 38, 9, 8, -34, -59, 24, 47, 42, 28 }, + { -1, -5, -20, -34, 4, 4, -15, -46, 18, 31, 42, 10, 10, 27, 49, 78 }, + { -3, -7, -22, -34, -5, -11, -36, -69, -1, -3, -25, -73, 5, 4, 4, -49 }, + } + }, + { //2 + { + { -112, 47, -2, 2, -34, 13, 2, 0, 15, -7, 1, 0, 8, -3, -1, 0 }, + { 29, -7, 1, -1, -108, 40, 2, 0, -45, 13, 4, -1, 8, -5, 1, 0 }, + { -36, -87, 69, -10, -17, -33, 26, -2, 7, 14, -11, 2, 6, 8, -7, 0 }, + { 28, -5, 2, -2, -29, 13, -2, 0, 103, -36, -4, 1, 48, -16, -4, 1 }, + { -12, -24, 15, -3, 26, 80, -61, 9, 15, 54, -36, 2, 0, -4, 6, -2 }, + { 18, 53, 69, -74, 14, 24, 28, -30, -6, -7, -11, 12, -5, -7, -6, 8 }, + { 5, -1, 2, 0, -26, 6, 0, 1, 45, -9, -1, 0, -113, 28, 8, -1 }, + { -13, -32, 18, -2, 15, 34, -27, 7, -25, -80, 47, -1, -16, -50, 28, 2 }, + { -4, -13, -10, 19, 18, 46, 60, -48, 16, 33, 60, -48, 1, 0, 5, -2 }, + { 15, 33, 63, 89, 8, 15, 25, 40, -4, -8, -15, -8, -2, -6, -9, -7 }, + { -8, -24, -27, 15, 12, 41, 26, -29, -17, -50, -39, 27, 0, 35, -67, 26 }, + { -2, -6, -24, 13, -1, -8, 37, -22, 3, 18, -51, 22, -23, -95, 17, 17 }, + { -3, -7, -16, -21, 10, 24, 46, 75, 8, 20, 38, 72, 1, 2, 1, 7 }, + { 2, 6, 10, -3, -5, -16, -31, 12, 7, 24, 41, -16, -16, -41, -89, 49 }, + { 4, 8, 21, 40, -4, -11, -28, -57, 5, 14, 31, 70, 7, 18, 32, 52 }, + { 0, 1, 4, 11, -2, -4, -13, -34, 3, 7, 20, 47, -6, -19, -42, -101 }, + }, + { + { -99, 39, -1, 2, 65, -20, -5, 0, -15, -2, 5, -1, 0, 3, -1, 0 }, + { 58, 42, -33, 3, 33, -63, 23, -1, -55, 32, 3, -5, 21, -2, -8, 3 }, + { -15, 71, -44, 5, -58, -29, 25, 3, 62, -7, -4, -4, -19, 4, 0, 1 }, + { 46, 5, 4, -6, 71, -12, -15, 5, 52, -38, 13, -2, -63, 23, 3, -3 }, + { -14, -54, -29, 29, 25, -9, 61, -29, 27, 44, -48, 5, -27, -21, 12, 7 }, + { -3, 3, 69, -42, -11, -50, -26, 26, 24, 63, -19, -5, -18, -22, 12, 0 }, + { 17, 16, -2, 1, 38, 18, -12, 0, 62, 1, -14, 5, 89, -42, 8, -2 }, + { 15, 54, -8, 6, 6, 60, -26, -8, -30, 17, -38, 22, -43, -45, 42, -7 }, + { -6, -17, -55, -28, 9, 30, -8, 58, 4, 34, 41, -52, -16, -36, -20, 16 }, + { -2, -1, -9, -79, 7, 11, 48, 44, -13, -34, -55, 6, 12, 23, 20, -11 }, + { 7, 29, 14, -6, 12, 53, 10, -11, 14, 59, -15, -3, 5, 71, -54, 13 }, + { -5, -24, -53, 15, -3, -15, -61, 26, 6, 30, -16, 23, 13, 56, 44, -35 }, + { 4, 8, 21, 52, -1, -1, -5, 29, -7, -17, -44, -84, 8, 20, 31, 39 }, + { -2, -11, -25, -4, -4, -21, -53, 2, -5, -26, -64, 19, -8, -19, -73, 39 }, + { -3, -5, -23, -57, -2, -4, -24, -75, 1, 3, 9, -25, 6, 15, 41, 61 }, + { 1, 1, 7, 18, 1, 2, 16, 47, 2, 5, 24, 67, 3, 9, 25, 88 }, + } + }, + { //3 + { + { -114, 37, 3, 2, -22, -23, 14, 0, 21, -17, -5, 2, 5, 2, -4, -1 }, + { -19, -41, 19, -2, 85, -60, -11, 7, 17, 31, -34, 2, -11, 19, 2, -8 }, + { 36, -25, 18, -2, -42, -53, 35, 5, 46, -60, -25, 19, 8, 21, -33, -1 }, + { -27, -80, 44, -3, -58, 1, -29, 19, -41, 18, -12, -7, 12, -17, 7, -6 }, + { -11, -21, 37, -10, 44, -4, 47, -12, -37, -41, 58, 18, 10, -46, -16, 31 }, + { 15, 47, 10, -6, -16, -44, 42, 10, -80, 25, -40, 21, -23, -2, 3, -14 }, + { 13, 25, 79, -39, -13, 10, 31, -4, 49, 45, 12, -8, 3, -1, 43, 7 }, + { 16, 11, -26, 13, -13, -74, -20, -1, 5, -6, 29, -47, 26, -49, 54, 2 }, + { -8, -34, -26, 7, -26, -19, 29, -37, 1, 22, 46, -9, -81, 37, 14, 20 }, + { -6, -30, -42, -12, -3, 5, 57, -52, -2, 37, -12, 6, 74, 10, 6, -15 }, + { 5, 9, -6, 42, -15, -18, -9, 26, 15, 58, 14, 43, 23, -10, -37, 75 }, + { -5, -23, -23, 36, 3, 22, 36, 40, 27, -4, -16, 56, -25, -46, 56, -24 }, + { 1, 3, 23, 73, 8, 5, 34, 46, -12, 2, 35, -38, 26, 52, 2, -31 }, + { -3, -2, -21, -52, 1, -10, -17, 44, -19, -20, 30, 45, 27, 61, 49, 21 }, + { -2, -7, -33, -56, -4, -6, 21, 63, 15, 31, 32, -22, -10, -26, -52, -38 }, + { -5, -12, -18, -12, 8, 22, 38, 36, -5, -15, -51, -63, -5, 0, 15, 73 }, + }, + { + { -102, 22, 7, 2, 66, -25, -6, -1, -15, 14, 1, -1, 2, -2, 1, 0 }, + { 12, 93, -27, -6, -27, -64, 36, 6, 13, 5, -23, 0, -2, 6, 5, -3 }, + { -59, -24, 17, 1, -62, -2, -3, 2, 83, -12, -17, -2, -24, 14, 7, -2 }, + { -33, 23, -36, 11, -21, 50, 35, -16, -23, -78, 16, 19, 22, 15, -30, -5 }, + { 0, -38, -81, 30, 27, 5, 51, -32, 24, 36, -16, 12, -24, -8, 9, 1 }, + { 28, 38, 8, -9, 62, 32, -13, 2, 51, -32, 15, 5, -66, 28, 0, -1 }, + { 11, -35, 21, -17, 30, -18, 31, 18, -11, -36, -80, 12, 16, 49, 13, -32 }, + { -13, 23, 22, -36, -12, 64, 39, 25, -19, 23, -36, 9, -30, -58, 33, -7 }, + { -9, -20, -55, -83, 3, -2, 1, 62, 8, 2, 27, -28, 7, 15, -11, 5 }, + { -6, 24, -38, 23, -8, 40, -49, 0, -7, 9, -25, -44, 23, 39, 70, -3 }, + { 12, 17, 17, 0, 32, 27, 21, 2, 67, 11, -6, -10, 89, -22, -12, 16 }, + { 2, -9, 8, 45, 7, -8, 27, 35, -9, -31, -17, -87, -23, -22, -19, 44 }, + { -1, -9, 28, -24, -1, -10, 49, -30, -8, -7, 40, 1, 4, 33, 65, 67 }, + { 5, -12, -24, -17, 13, -34, -32, -16, 14, -67, -7, 9, 7, -74, 49, 1 }, + { 2, -6, 11, 45, 3, -10, 33, 55, 8, -5, 59, 4, 7, -4, 44, -66 }, + { -1, 1, -14, 36, -1, 2, -20, 69, 0, 0, -15, 72, 3, 4, 5, 65 }, + } + } +}; + +const uint8_t ff_vvc_lfnst_tr_set_index[95] = +{ + 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 +}; + +uint8_t ff_vvc_default_scale_m[64 * 64]; + +//< AlfFixFiltCoeff +const int8_t ff_vvc_alf_fix_filt_coeff[64][12] = { + { 0, 0, 2, -3, 1, -4, 1, 7, -1, 1, -1, 5 }, + { 0, 0, 0, 0, 0, -1, 0, 1, 0, 0, -1, 2 }, + { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1 }, + { 2, 2, -7, -3, 0, -5, 13, 22, 12, -3, -3, 17 }, + { -1, 0, 6, -8, 1, -5, 1, 23, 0, 2, -5, 10 }, + { 0, 0, -1, -1, 0, -1, 2, 1, 0, 0, -1, 4 }, + { 0, 0, 3, -11, 1, 0, -1, 35, 5, 2, -9, 9 }, + { 0, 0, 8, -8, -2, -7, 4, 4, 2, 1, -1, 25 }, + { 0, 0, 1, -1, 0, -3, 1, 3, -1, 1, -1, 3 }, + { 0, 0, 3, -3, 0, -6, 5, -1, 2, 1, -4, 21 }, + { -7, 1, 5, 4, -3, 5, 11, 13, 12, -8, 11, 12 }, + { -5, -3, 6, -2, -3, 8, 14, 15, 2, -7, 11, 16 }, + { 2, -1, -6, -5, -2, -2, 20, 14, -4, 0, -3, 25 }, + { 3, 1, -8, -4, 0, -8, 22, 5, -3, 2, -10, 29 }, + { 2, 1, -7, -1, 2, -11, 23, -5, 0, 2, -10, 29 }, + { -6, -3, 8, 9, -4, 8, 9, 7, 14, -2, 8, 9 }, + { 2, 1, -4, -7, 0, -8, 17, 22, 1, -1, -4, 23 }, + { 3, 0, -5, -7, 0, -7, 15, 18, -5, 0, -5, 27 }, + { 2, 0, 0, -7, 1, -10, 13, 13, -4, 2, -7, 24 }, + { 3, 3, -13, 4, -2, -5, 9, 21, 25, -2, -3, 12 }, + { -5, -2, 7, -3, -7, 9, 8, 9, 16, -2, 15, 12 }, + { 0, -1, 0, -7, -5, 4, 11, 11, 8, -6, 12, 21 }, + { 3, -2, -3, -8, -4, -1, 16, 15, -2, -3, 3, 26 }, + { 2, 1, -5, -4, -1, -8, 16, 4, -2, 1, -7, 33 }, + { 2, 1, -4, -2, 1, -10, 17, -2, 0, 2, -11, 33 }, + { 1, -2, 7, -15, -16, 10, 8, 8, 20, 11, 14, 11 }, + { 2, 2, 3, -13, -13, 4, 8, 12, 2, -3, 16, 24 }, + { 1, 4, 0, -7, -8, -4, 9, 9, -2, -2, 8, 29 }, + { 1, 1, 2, -4, -1, -6, 6, 3, -1, -1, -3, 30 }, + { -7, 3, 2, 10, -2, 3, 7, 11, 19, -7, 8, 10 }, + { 0, -2, -5, -3, -2, 4, 20, 15, -1, -3, -1, 22 }, + { 3, -1, -8, -4, -1, -4, 22, 8, -4, 2, -8, 28 }, + { 0, 3, -14, 3, 0, 1, 19, 17, 8, -3, -7, 20 }, + { 0, 2, -1, -8, 3, -6, 5, 21, 1, 1, -9, 13 }, + { -4, -2, 8, 20, -2, 2, 3, 5, 21, 4, 6, 1 }, + { 2, -2, -3, -9, -4, 2, 14, 16, 3, -6, 8, 24 }, + { 2, 1, 5, -16, -7, 2, 3, 11, 15, -3, 11, 22 }, + { 1, 2, 3, -11, -2, -5, 4, 8, 9, -3, -2, 26 }, + { 0, -1, 10, -9, -1, -8, 2, 3, 4, 0, 0, 29 }, + { 1, 2, 0, -5, 1, -9, 9, 3, 0, 1, -7, 20 }, + { -2, 8, -6, -4, 3, -9, -8, 45, 14, 2, -13, 7 }, + { 1, -1, 16, -19, -8, -4, -3, 2, 19, 0, 4, 30 }, + { 1, 1, -3, 0, 2, -11, 15, -5, 1, 2, -9, 24 }, + { 0, 1, -2, 0, 1, -4, 4, 0, 0, 1, -4, 7 }, + { 0, 1, 2, -5, 1, -6, 4, 10, -2, 1, -4, 10 }, + { 3, 0, -3, -6, -2, -6, 14, 8, -1, -1, -3, 31 }, + { 0, 1, 0, -2, 1, -6, 5, 1, 0, 1, -5, 13 }, + { 3, 1, 9, -19, -21, 9, 7, 6, 13, 5, 15, 21 }, + { 2, 4, 3, -12, -13, 1, 7, 8, 3, 0, 12, 26 }, + { 3, 1, -8, -2, 0, -6, 18, 2, -2, 3, -10, 23 }, + { 1, 1, -4, -1, 1, -5, 8, 1, -1, 2, -5, 10 }, + { 0, 1, -1, 0, 0, -2, 2, 0, 0, 1, -2, 3 }, + { 1, 1, -2, -7, 1, -7, 14, 18, 0, 0, -7, 21 }, + { 0, 1, 0, -2, 0, -7, 8, 1, -2, 0, -3, 24 }, + { 0, 1, 1, -2, 2, -10, 10, 0, -2, 1, -7, 23 }, + { 0, 2, 2, -11, 2, -4, -3, 39, 7, 1, -10, 9 }, + { 1, 0, 13, -16, -5, -6, -1, 8, 6, 0, 6, 29 }, + { 1, 3, 1, -6, -4, -7, 9, 6, -3, -2, 3, 33 }, + { 4, 0, -17, -1, -1, 5, 26, 8, -2, 3, -15, 30 }, + { 0, 1, -2, 0, 2, -8, 12, -6, 1, 1, -6, 16 }, + { 0, 0, 0, -1, 1, -4, 4, 0, 0, 0, -3, 11 }, + { 0, 1, 2, -8, 2, -6, 5, 15, 0, 2, -7, 9 }, + { 1, -1, 12, -15, -7, -2, 3, 6, 6, -1, 7, 30 }, +}; + +//< AlfClassToFiltMap +const uint8_t ff_vvc_alf_class_to_filt_map[16][25] = { + { 8, 2, 2, 2, 3, 4, 53, 9, 9, 52, 4, 4, 5, 9, 2, 8, 10, 9, 1, 3, 39, 39, 10, 9, 52 }, + { 11, 12, 13, 14, 15, 30, 11, 17, 18, 19, 16, 20, 20, 4, 53, 21, 22, 23, 14, 25, 26, 26, 27, 28, 10 }, + { 16, 12, 31, 32, 14, 16, 30, 33, 53, 34, 35, 16, 20, 4, 7, 16, 21, 36, 18, 19, 21, 26, 37, 38, 39 }, + { 35, 11, 13, 14, 43, 35, 16, 4, 34, 62, 35, 35, 30, 56, 7, 35, 21, 38, 24, 40, 16, 21, 48, 57, 39 }, + { 11, 31, 32, 43, 44, 16, 4, 17, 34, 45, 30, 20, 20, 7, 5, 21, 22, 46, 40, 47, 26, 48, 63, 58, 10 }, + { 12, 13, 50, 51, 52, 11, 17, 53, 45, 9, 30, 4, 53, 19, 0, 22, 23, 25, 43, 44, 37, 27, 28, 10, 55 }, + { 30, 33, 62, 51, 44, 20, 41, 56, 34, 45, 20, 41, 41, 56, 5, 30, 56, 38, 40, 47, 11, 37, 42, 57, 8 }, + { 35, 11, 23, 32, 14, 35, 20, 4, 17, 18, 21, 20, 20, 20, 4, 16, 21, 36, 46, 25, 41, 26, 48, 49, 58 }, + { 12, 31, 59, 59, 3, 33, 33, 59, 59, 52, 4, 33, 17, 59, 55, 22, 36, 59, 59, 60, 22, 36, 59, 25, 55 }, + { 31, 25, 15, 60, 60, 22, 17, 19, 55, 55, 20, 20, 53, 19, 55, 22, 46, 25, 43, 60, 37, 28, 10, 55, 52 }, + { 12, 31, 32, 50, 51, 11, 33, 53, 19, 45, 16, 4, 4, 53, 5, 22, 36, 18, 25, 43, 26, 27, 27, 28, 10 }, + { 5, 2, 44, 52, 3, 4, 53, 45, 9, 3, 4, 56, 5, 0, 2, 5, 10, 47, 52, 3, 63, 39, 10, 9, 52 }, + { 12, 34, 44, 44, 3, 56, 56, 62, 45, 9, 56, 56, 7, 5, 0, 22, 38, 40, 47, 52, 48, 57, 39, 10, 9 }, + { 35, 11, 23, 14, 51, 35, 20, 41, 56, 62, 16, 20, 41, 56, 7, 16, 21, 38, 24, 40, 26, 26, 42, 57, 39 }, + { 33, 34, 51, 51, 52, 41, 41, 34, 62, 0, 41, 41, 56, 7, 5, 56, 38, 38, 40, 44, 37, 42, 57, 39, 10 }, + { 16, 31, 32, 15, 60, 30, 4, 17, 19, 25, 22, 20, 4, 53, 19, 21, 22, 46, 25, 55, 26, 48, 63, 58, 55 }, +}; + +const uint8_t ff_vvc_alf_aps_class_to_filt_map[25] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, +}; + +const int8_t ff_vvc_filter_c[NUM_INTRA_LUMA_FACTS][NUM_INTRA_LUMA_TAPS] = +{ + { 0, 64, 0, 0 }, + { -1, 63, 2, 0 }, + { -2, 62, 4, 0 }, + { -2, 60, 7, -1 }, + { -2, 58, 10, -2 }, + { -3, 57, 12, -2 }, + { -4, 56, 14, -2 }, + { -4, 55, 15, -2 }, + { -4, 54, 16, -2 }, + { -5, 53, 18, -2 }, + { -6, 52, 20, -2 }, + { -6, 49, 24, -3 }, + { -6, 46, 28, -4 }, + { -5, 44, 29, -4 }, + { -4, 42, 30, -4 }, + { -4, 39, 33, -4 }, + { -4, 36, 36, -4 }, + { -4, 33, 39, -4 }, + { -4, 30, 42, -4 }, + { -4, 29, 44, -5 }, + { -4, 28, 46, -6 }, + { -3, 24, 49, -6 }, + { -2, 20, 52, -6 }, + { -2, 18, 53, -5 }, + { -2, 16, 54, -4 }, + { -2, 15, 55, -4 }, + { -2, 14, 56, -4 }, + { -2, 12, 57, -3 }, + { -2, 10, 58, -2 }, + { -1, 7, 60, -2 }, + { 0, 4, 62, -2 }, + { 0, 2, 63, -1 }, +}; + +#define FILTER_G(fact) { 16 - (fact >> 1), 32 - (fact >> 1), 16 + (fact >> 1), fact >> 1} +const int8_t ff_vvc_filter_g[NUM_INTRA_LUMA_FACTS][NUM_INTRA_LUMA_TAPS] = { + FILTER_G(0), + FILTER_G(1), + FILTER_G(2), + FILTER_G(3), + FILTER_G(4), + FILTER_G(5), + FILTER_G(6), + FILTER_G(7), + FILTER_G(8), + FILTER_G(9), + FILTER_G(10), + FILTER_G(11), + FILTER_G(12), + FILTER_G(13), + FILTER_G(14), + FILTER_G(15), + FILTER_G(16), + FILTER_G(17), + FILTER_G(18), + FILTER_G(19), + FILTER_G(20), + FILTER_G(21), + FILTER_G(22), + FILTER_G(23), + FILTER_G(24), + FILTER_G(25), + FILTER_G(26), + FILTER_G(27), + FILTER_G(28), + FILTER_G(29), + FILTER_G(30), + FILTER_G(31), +}; + +const uint8_t ff_vvc_gpm_angle_idx[VVC_GPM_NUM_PARTITION] = { + 0, 0, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, + 5, 5, 8, 8, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, + 14, 14, 14, 14, 16, 16, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, + 21, 21, 24, 24, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, +}; + +const uint8_t ff_vvc_gpm_distance_idx[VVC_GPM_NUM_PARTITION] = { + 1, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, + 2, 3, 1, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, + 0, 1, 2, 3, 1, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, + 2, 3, 1, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, +}; + +const int8_t ff_vvc_gpm_distance_lut[VVC_GPM_NUM_ANGLES] = { + 8, 8, 8, 8, 4, 4, 2, 1, 0, -1, -2, -4, -4, -8, -8, -8, -8, -8, -8, -8, -4, -4, -2, -1, 0, 1, 2, 4, 4, 8, 8, 8, +}; + +const uint8_t ff_vvc_gpm_angle_to_mirror[VVC_GPM_NUM_ANGLES] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, +}; + +#define INV -1 +const uint8_t ff_vvc_gpm_angle_to_weights_idx[32] = { + 0, INV, 1, 2, 3, 4, INV, INV, 5, INV, INV, 4, 3, 2, 1, INV, + 0, INV, 1, 2, 3, 4, INV, INV, 5, INV, INV, 4, 3, 2, 1, INV, +}; +#undef INV + +const uint8_t ff_vvc_gpm_weights_offset_x[VVC_GPM_NUM_PARTITION][4][4] = { + { + { 53, 50, 44, 32 }, + { 53, 50, 44, 32 }, + { 53, 50, 44, 32 }, + { 53, 50, 44, 32 }, + }, + { + { 55, 54, 52, 48 }, + { 55, 54, 52, 48 }, + { 55, 54, 52, 48 }, + { 55, 54, 52, 48 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 50, 44, 32 }, + { 52, 48, 44, 32 }, + { 52, 48, 40, 32 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 52, 48, 40 }, + { 52, 48, 48, 40 }, + { 52, 48, 40, 40 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 54, 52, 48 }, + { 52, 48, 52, 48 }, + { 52, 48, 40, 48 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 50, 44, 32 }, + { 52, 48, 44, 32 }, + { 52, 48, 40, 32 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 52, 48, 40 }, + { 52, 48, 48, 40 }, + { 52, 48, 40, 40 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 54, 52, 48 }, + { 52, 48, 52, 48 }, + { 52, 48, 40, 48 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 50, 44, 32 }, + { 52, 48, 44, 32 }, + { 52, 48, 40, 32 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 52, 48, 40 }, + { 52, 48, 48, 40 }, + { 52, 48, 40, 40 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 54, 52, 48 }, + { 52, 48, 52, 48 }, + { 52, 48, 40, 48 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 50, 44, 32 }, + { 52, 48, 44, 32 }, + { 52, 48, 40, 32 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 52, 48, 40 }, + { 52, 48, 48, 40 }, + { 52, 48, 40, 40 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 54, 52, 48 }, + { 52, 48, 52, 48 }, + { 52, 48, 40, 48 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 50, 44, 32 }, + { 52, 48, 44, 32 }, + { 52, 48, 40, 32 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 52, 48, 40 }, + { 52, 48, 48, 40 }, + { 52, 48, 40, 40 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 54, 52, 48 }, + { 52, 48, 52, 48 }, + { 52, 48, 40, 48 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 50, 44, 32 }, + { 52, 48, 44, 32 }, + { 52, 48, 40, 32 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 52, 48, 40 }, + { 52, 48, 48, 40 }, + { 52, 48, 40, 40 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 54, 52, 48 }, + { 52, 48, 52, 48 }, + { 52, 48, 40, 48 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 50, 44, 32 }, + { 52, 48, 44, 32 }, + { 52, 48, 40, 32 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 52, 48, 40 }, + { 52, 48, 48, 40 }, + { 52, 48, 40, 40 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 54, 52, 48 }, + { 52, 48, 52, 48 }, + { 52, 48, 40, 48 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 50, 44, 32 }, + { 52, 48, 44, 32 }, + { 52, 48, 40, 32 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 52, 48, 40 }, + { 52, 48, 48, 40 }, + { 52, 48, 40, 40 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 54, 52, 48 }, + { 52, 48, 52, 48 }, + { 52, 48, 40, 48 }, + { 52, 48, 40, 24 }, + }, + { + { 51, 46, 36, 16 }, + { 51, 46, 36, 16 }, + { 51, 46, 36, 16 }, + { 51, 46, 36, 16 }, + }, + { + { 49, 42, 28, 0 }, + { 49, 42, 28, 0 }, + { 49, 42, 28, 0 }, + { 49, 42, 28, 0 }, + }, + { + { 52, 46, 36, 16 }, + { 52, 48, 36, 16 }, + { 52, 48, 40, 16 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 44, 32, 8 }, + { 52, 48, 32, 8 }, + { 52, 48, 40, 8 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 42, 28, 0 }, + { 52, 48, 28, 0 }, + { 52, 48, 40, 0 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 46, 36, 16 }, + { 52, 48, 36, 16 }, + { 52, 48, 40, 16 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 44, 32, 8 }, + { 52, 48, 32, 8 }, + { 52, 48, 40, 8 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 42, 28, 0 }, + { 52, 48, 28, 0 }, + { 52, 48, 40, 0 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 46, 36, 16 }, + { 52, 48, 36, 16 }, + { 52, 48, 40, 16 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 44, 32, 8 }, + { 52, 48, 32, 8 }, + { 52, 48, 40, 8 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 42, 28, 0 }, + { 52, 48, 28, 0 }, + { 52, 48, 40, 0 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 46, 36, 16 }, + { 52, 48, 36, 16 }, + { 52, 48, 40, 16 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 44, 32, 8 }, + { 52, 48, 32, 8 }, + { 52, 48, 40, 8 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 42, 28, 0 }, + { 52, 48, 28, 0 }, + { 52, 48, 40, 0 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 46, 36, 16 }, + { 52, 48, 36, 16 }, + { 52, 48, 40, 16 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 44, 32, 8 }, + { 52, 48, 32, 8 }, + { 52, 48, 40, 8 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 42, 28, 0 }, + { 52, 48, 28, 0 }, + { 52, 48, 40, 0 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 46, 36, 16 }, + { 52, 48, 36, 16 }, + { 52, 48, 40, 16 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 44, 32, 8 }, + { 52, 48, 32, 8 }, + { 52, 48, 40, 8 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 42, 28, 0 }, + { 52, 48, 28, 0 }, + { 52, 48, 40, 0 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 46, 36, 16 }, + { 52, 48, 36, 16 }, + { 52, 48, 40, 16 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 44, 32, 8 }, + { 52, 48, 32, 8 }, + { 52, 48, 40, 8 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 42, 28, 0 }, + { 52, 48, 28, 0 }, + { 52, 48, 40, 0 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 46, 36, 16 }, + { 52, 48, 36, 16 }, + { 52, 48, 40, 16 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 44, 32, 8 }, + { 52, 48, 32, 8 }, + { 52, 48, 40, 8 }, + { 52, 48, 40, 24 }, + }, + { + { 52, 42, 28, 0 }, + { 52, 48, 28, 0 }, + { 52, 48, 40, 0 }, + { 52, 48, 40, 24 }, + }, +}; + +const uint8_t ff_vvc_gpm_weights_offset_y[VVC_GPM_NUM_PARTITION][4][4] = { + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 53, 52, 52, 52 }, + { 50, 50, 48, 48 }, + { 44, 44, 44, 40 }, + { 32, 32, 32, 32 }, + }, + { + { 54, 52, 52, 52 }, + { 52, 52, 48, 48 }, + { 48, 48, 48, 40 }, + { 40, 40, 40, 40 }, + }, + { + { 55, 52, 52, 52 }, + { 54, 54, 48, 48 }, + { 52, 52, 52, 40 }, + { 48, 48, 48, 48 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 53, 52, 52, 52 }, + { 50, 50, 48, 48 }, + { 44, 44, 44, 40 }, + { 32, 32, 32, 32 }, + }, + { + { 54, 52, 52, 52 }, + { 52, 52, 48, 48 }, + { 48, 48, 48, 40 }, + { 40, 40, 40, 40 }, + }, + { + { 55, 52, 52, 52 }, + { 54, 54, 48, 48 }, + { 52, 52, 52, 40 }, + { 48, 48, 48, 48 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 53, 52, 52, 52 }, + { 50, 50, 48, 48 }, + { 44, 44, 44, 40 }, + { 32, 32, 32, 32 }, + }, + { + { 54, 52, 52, 52 }, + { 52, 52, 48, 48 }, + { 48, 48, 48, 40 }, + { 40, 40, 40, 40 }, + }, + { + { 55, 52, 52, 52 }, + { 54, 54, 48, 48 }, + { 52, 52, 52, 40 }, + { 48, 48, 48, 48 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 53, 52, 52, 52 }, + { 50, 50, 48, 48 }, + { 44, 44, 44, 40 }, + { 32, 32, 32, 32 }, + }, + { + { 54, 52, 52, 52 }, + { 52, 52, 48, 48 }, + { 48, 48, 48, 40 }, + { 40, 40, 40, 40 }, + }, + { + { 55, 52, 52, 52 }, + { 54, 54, 48, 48 }, + { 52, 52, 52, 40 }, + { 48, 48, 48, 48 }, + }, + { + { 53, 53, 53, 53 }, + { 50, 50, 50, 50 }, + { 44, 44, 44, 44 }, + { 32, 32, 32, 32 }, + }, + { + { 55, 55, 55, 55 }, + { 54, 54, 54, 54 }, + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 53, 52, 52, 52 }, + { 50, 50, 48, 48 }, + { 44, 44, 44, 40 }, + { 32, 32, 32, 32 }, + }, + { + { 54, 52, 52, 52 }, + { 52, 52, 48, 48 }, + { 48, 48, 48, 40 }, + { 40, 40, 40, 40 }, + }, + { + { 55, 52, 52, 52 }, + { 54, 54, 48, 48 }, + { 52, 52, 52, 40 }, + { 48, 48, 48, 48 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 53, 52, 52, 52 }, + { 50, 50, 48, 48 }, + { 44, 44, 44, 40 }, + { 32, 32, 32, 32 }, + }, + { + { 54, 52, 52, 52 }, + { 52, 52, 48, 48 }, + { 48, 48, 48, 40 }, + { 40, 40, 40, 40 }, + }, + { + { 55, 52, 52, 52 }, + { 54, 54, 48, 48 }, + { 52, 52, 52, 40 }, + { 48, 48, 48, 48 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 53, 52, 52, 52 }, + { 50, 50, 48, 48 }, + { 44, 44, 44, 40 }, + { 32, 32, 32, 32 }, + }, + { + { 54, 52, 52, 52 }, + { 52, 52, 48, 48 }, + { 48, 48, 48, 40 }, + { 40, 40, 40, 40 }, + }, + { + { 55, 52, 52, 52 }, + { 54, 54, 48, 48 }, + { 52, 52, 52, 40 }, + { 48, 48, 48, 48 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 53, 52, 52, 52 }, + { 50, 50, 48, 48 }, + { 44, 44, 44, 40 }, + { 32, 32, 32, 32 }, + }, + { + { 54, 52, 52, 52 }, + { 52, 52, 48, 48 }, + { 48, 48, 48, 40 }, + { 40, 40, 40, 40 }, + }, + { + { 55, 52, 52, 52 }, + { 54, 54, 48, 48 }, + { 52, 52, 52, 40 }, + { 48, 48, 48, 48 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 52, 52, 52, 52 }, + { 48, 48, 48, 48 }, + { 40, 40, 40, 40 }, + { 24, 24, 24, 24 }, + }, + { + { 51, 52, 52, 52 }, + { 46, 46, 48, 48 }, + { 36, 36, 36, 40 }, + { 16, 16, 16, 16 }, + }, + { + { 50, 52, 52, 52 }, + { 44, 44, 48, 48 }, + { 32, 32, 32, 40 }, + { 8, 8, 8, 8 }, + }, + { + { 49, 52, 52, 52 }, + { 42, 42, 48, 48 }, + { 28, 28, 28, 40 }, + { 0, 0, 0, 0 }, + }, + { + { 51, 52, 52, 52 }, + { 46, 46, 48, 48 }, + { 36, 36, 36, 40 }, + { 16, 16, 16, 16 }, + }, + { + { 50, 52, 52, 52 }, + { 44, 44, 48, 48 }, + { 32, 32, 32, 40 }, + { 8, 8, 8, 8 }, + }, + { + { 49, 52, 52, 52 }, + { 42, 42, 48, 48 }, + { 28, 28, 28, 40 }, + { 0, 0, 0, 0 }, + }, + { + { 51, 52, 52, 52 }, + { 46, 46, 48, 48 }, + { 36, 36, 36, 40 }, + { 16, 16, 16, 16 }, + }, + { + { 50, 52, 52, 52 }, + { 44, 44, 48, 48 }, + { 32, 32, 32, 40 }, + { 8, 8, 8, 8 }, + }, + { + { 49, 52, 52, 52 }, + { 42, 42, 48, 48 }, + { 28, 28, 28, 40 }, + { 0, 0, 0, 0 }, + }, + { + { 51, 52, 52, 52 }, + { 46, 46, 48, 48 }, + { 36, 36, 36, 40 }, + { 16, 16, 16, 16 }, + }, + { + { 50, 52, 52, 52 }, + { 44, 44, 48, 48 }, + { 32, 32, 32, 40 }, + { 8, 8, 8, 8 }, + }, + { + { 49, 52, 52, 52 }, + { 42, 42, 48, 48 }, + { 28, 28, 28, 40 }, + { 0, 0, 0, 0 }, + }, + { + { 51, 51, 51, 51 }, + { 46, 46, 46, 46 }, + { 36, 36, 36, 36 }, + { 16, 16, 16, 16 }, + }, + { + { 49, 49, 49, 49 }, + { 42, 42, 42, 42 }, + { 28, 28, 28, 28 }, + { 0, 0, 0, 0 }, + }, + { + { 51, 52, 52, 52 }, + { 46, 46, 48, 48 }, + { 36, 36, 36, 40 }, + { 16, 16, 16, 16 }, + }, + { + { 50, 52, 52, 52 }, + { 44, 44, 48, 48 }, + { 32, 32, 32, 40 }, + { 8, 8, 8, 8 }, + }, + { + { 49, 52, 52, 52 }, + { 42, 42, 48, 48 }, + { 28, 28, 28, 40 }, + { 0, 0, 0, 0 }, + }, + { + { 51, 52, 52, 52 }, + { 46, 46, 48, 48 }, + { 36, 36, 36, 40 }, + { 16, 16, 16, 16 }, + }, + { + { 50, 52, 52, 52 }, + { 44, 44, 48, 48 }, + { 32, 32, 32, 40 }, + { 8, 8, 8, 8 }, + }, + { + { 49, 52, 52, 52 }, + { 42, 42, 48, 48 }, + { 28, 28, 28, 40 }, + { 0, 0, 0, 0 }, + }, + { + { 51, 52, 52, 52 }, + { 46, 46, 48, 48 }, + { 36, 36, 36, 40 }, + { 16, 16, 16, 16 }, + }, + { + { 50, 52, 52, 52 }, + { 44, 44, 48, 48 }, + { 32, 32, 32, 40 }, + { 8, 8, 8, 8 }, + }, + { + { 49, 52, 52, 52 }, + { 42, 42, 48, 48 }, + { 28, 28, 28, 40 }, + { 0, 0, 0, 0 }, + }, + { + { 51, 52, 52, 52 }, + { 46, 46, 48, 48 }, + { 36, 36, 36, 40 }, + { 16, 16, 16, 16 }, + }, + { + { 50, 52, 52, 52 }, + { 44, 44, 48, 48 }, + { 32, 32, 32, 40 }, + { 8, 8, 8, 8 }, + }, + { + { 49, 52, 52, 52 }, + { 42, 42, 48, 48 }, + { 28, 28, 28, 40 }, + { 0, 0, 0, 0 }, + }, +}; + +const uint8_t ff_vvc_gpm_weights[6][VVC_GPM_WEIGHT_SIZE * VVC_GPM_WEIGHT_SIZE] = { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 5, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,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mode 100644 index 0000000000..8955498e21 --- /dev/null +++ b/libavcodec/vvc/vvc_data.h @@ -0,0 +1,69 @@ +/* + * VVC shared tables + * + * 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_VVC_DATA_H +#define AVCODEC_VVC_DATA_H + +#include + +extern const uint8_t ff_vvc_diag_scan_x[5][5][16 * 16]; +extern const uint8_t ff_vvc_diag_scan_y[5][5][16 * 16]; + +extern const uint8_t ff_vvc_scaling_pred_8[8 * 8]; +extern const uint8_t ff_vvc_scaling_pred_16[8 * 8]; +extern const int ff_vvc_scaling_list0[8 * 8]; + +extern const int8_t ff_vvc_dct8_4x4[4][4]; +extern const int8_t ff_vvc_dct8_8x8[8][8]; +extern const int8_t ff_vvc_dct8_16x16[16][16]; +extern const int8_t ff_vvc_dct8_32x32[32][32]; +extern const int8_t ff_vvc_dst7_4x4[4][4]; +extern const int8_t ff_vvc_dst7_8x8[8][8]; +extern const int8_t ff_vvc_dst7_16x16[16][16]; +extern const int8_t ff_vvc_dst7_32x32[32][32]; +extern const int8_t ff_vvc_lfnst_4x4[4][2][16][16]; +extern const int8_t ff_vvc_lfnst_8x8[4][2][16][48]; +extern const uint8_t ff_vvc_lfnst_tr_set_index[95]; +extern uint8_t ff_vvc_default_scale_m[64 * 64]; + +#define NUM_INTRA_LUMA_TAPS 4 +#define NUM_INTRA_LUMA_FACTS 32 +extern const int8_t ff_vvc_filter_c[NUM_INTRA_LUMA_FACTS][NUM_INTRA_LUMA_TAPS]; +extern const int8_t ff_vvc_filter_g[NUM_INTRA_LUMA_FACTS][NUM_INTRA_LUMA_TAPS]; + +#define VVC_GPM_NUM_PARTITION 64 +#define VVC_GPM_NUM_ANGLES 32 +#define VVC_GPM_WEIGHT_SIZE 112 +extern const uint8_t ff_vvc_gpm_angle_idx[VVC_GPM_NUM_PARTITION]; +extern const uint8_t ff_vvc_gpm_distance_idx[VVC_GPM_NUM_PARTITION]; +extern const int8_t ff_vvc_gpm_distance_lut[VVC_GPM_NUM_ANGLES]; +extern const uint8_t ff_vvc_gpm_angle_to_mirror[VVC_GPM_NUM_ANGLES]; +extern const uint8_t ff_vvc_gpm_angle_to_weights_idx[VVC_GPM_NUM_ANGLES]; +extern const uint8_t ff_vvc_gpm_weights_offset_x[VVC_GPM_NUM_PARTITION][4][4]; +extern const uint8_t ff_vvc_gpm_weights_offset_y[VVC_GPM_NUM_PARTITION][4][4]; +extern const uint8_t ff_vvc_gpm_weights[6][VVC_GPM_WEIGHT_SIZE * VVC_GPM_WEIGHT_SIZE]; + +extern const int8_t ff_vvc_alf_fix_filt_coeff[64][12]; +extern const uint8_t ff_vvc_alf_class_to_filt_map[16][25]; +extern const uint8_t ff_vvc_alf_aps_class_to_filt_map[25]; + +const uint8_t* ff_vvc_get_mip_matrix(const int size_id, const int mode_idx); + +#endif /* AVCODEC_VVC_DATA_H */ diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c new file mode 100644 index 0000000000..cf16712b1b --- /dev/null +++ b/libavcodec/vvc/vvc_ps.c @@ -0,0 +1,3379 @@ +/* + * VVC parameter set parser + * + * Copyright (C) 2023 Nuo Mi + * Copyright (C) 2022 Xu Mu + * + * 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 "libavcodec/avcodec.h" +#include "libavcodec/golomb.h" + +#include "libavutil/imgutils.h" + +#include "vvc_data.h" +#include "vvc_ps.h" +#include "vvcdec.h" + +#define u(b, f, min, max) do { \ + f = get_bits(gb, b); \ + if ((f < (min)) || (f > (max))) { \ + av_log(log_ctx, AV_LOG_ERROR, \ + #f " %d should in range [%d, %d]", f, (min), (max)); \ + }\ +} while (0) + +#define uep(f, plus, min, max) do { \ + f = get_ue_golomb_long(gb) + plus; \ + if (((f) < (min)) || ((f) > (max))) {\ + av_log(log_ctx, AV_LOG_ERROR, \ + #f " %d should in range [%d, %d]", f, (min), (max)); \ + return AVERROR_INVALIDDATA; \ + } \ +} while (0) + +#define ue(f, max) do { \ + f = get_ue_golomb_long(gb); \ + if ((f) > (max)) {\ + av_log(log_ctx, AV_LOG_ERROR, \ + #f " %d should < %d", f, (max)); \ + return AVERROR_INVALIDDATA; \ + } \ +} while (0) + +#define sep(f, plus, min, max) do {\ + f = get_se_golomb(gb) + plus; \ + if ((f < (min)) || (f > (max))) {\ + av_log(log_ctx, AV_LOG_ERROR, \ + #f " %d should in range [%d, %d]", f, (min), (max)); \ + return AVERROR_INVALIDDATA; \ + } \ +} while (0) + +#define se(f, min, max) do {\ + f = get_se_golomb(gb); \ + if ((f < (min)) || (f > (max))) {\ + av_log(log_ctx, AV_LOG_ERROR, \ + #f " %d should in range [%d, %d]", f, (min), (max)); \ + return AVERROR_INVALIDDATA; \ + } \ +} while (0) + +typedef struct VVCLMCS { + int min_bin_idx; + int max_bin_idx; + int delta_cw[LMCS_MAX_BIN_SIZE]; + int delta_crs; +} VVCLMCS; + +static av_always_inline unsigned int vvc_ceil(unsigned int v, unsigned int align) +{ + return (((v) + (align) - 1) / (align)); +} + +static void remove_pps(VVCParamSets *s, int id) +{ + av_buffer_unref(&s->pps_list[id]); +} + +static void remove_sps(VVCParamSets *s, int id) +{ + if (s->sps_list[id]) { + /* drop all PPS that depend on this SPS */ + for (int i = 0; i < FF_ARRAY_ELEMS(s->pps_list); i++) + if (s->pps_list[i] && ((VVCPPS*)s->pps_list[i]->data)->seq_parameter_set_id == id) + remove_pps(s, i); + } + av_buffer_unref(&s->sps_list[id]); +} + +static int gci_parse(GeneralConstraintsInfo *gci, GetBitContext *gb, void *log_ctx) +{ + int i; + + gci->present_flag = get_bits1(gb); + if (gci->present_flag) { + unsigned int num_reserved_bits; + /* general */ + gci->intra_only_constraint_flag = get_bits1(gb); + gci->all_layers_independent_constraint_flag = get_bits1(gb); + gci->one_au_only_constraint_flag = get_bits1(gb); + + /* picture format */ + gci->sixteen_minus_max_bitdepth_constraint_idc = get_bits(gb, 4); + if (gci->sixteen_minus_max_bitdepth_constraint_idc > 8U) { + av_log(log_ctx, AV_LOG_ERROR, + "sixteen_minus_max_bitdepth_constraint_idc %d is invalid\n", + gci->sixteen_minus_max_bitdepth_constraint_idc); + return AVERROR_INVALIDDATA; + } + gci-> three_minus_max_chroma_format_constraint_idc = get_bits(gb, 2); + + /* NAL unit type related */ + gci->no_mixed_nalu_types_in_pic_constraint_flag = get_bits1(gb); + gci->no_trail_constraint_flag = get_bits1(gb); + gci->no_stsa_constraint_flag = get_bits1(gb); + gci->no_rasl_constraint_flag = get_bits1(gb); + gci->no_radl_constraint_flag = get_bits1(gb); + gci->no_idr_constraint_flag = get_bits1(gb); + gci->no_cra_constraint_flag = get_bits1(gb); + gci->no_gdr_constraint_flag = get_bits1(gb); + gci->no_aps_constraint_flag = get_bits1(gb); + gci->no_idr_rpl_constraint_flag = get_bits1(gb); + + /* tile, slice, subpicture partitioning */ + gci->one_tile_per_pic_constraint_flag = get_bits1(gb); + gci->pic_header_in_slice_header_constraint_flag = get_bits1(gb); + gci->one_slice_per_pic_constraint_flag = get_bits1(gb); + gci->no_rectangular_slice_constraint_flag = get_bits1(gb); + gci->one_slice_per_subpic_constraint_flag = get_bits1(gb); + gci->no_subpic_info_constraint_flag = get_bits1(gb); + + /* CTU and block partitioning */ + gci->three_minus_max_log2_ctu_size_constraint_idc = get_bits(gb, 2); + gci->no_partition_constraints_override_constraint_flag = get_bits1(gb); + gci->no_mtt_constraint_flag = get_bits1(gb); + gci->no_qtbtt_dual_tree_intra_constraint_flag = get_bits1(gb); + + /* intra */ + gci->no_palette_constraint_flag = get_bits1(gb); + gci->no_ibc_constraint_flag = get_bits1(gb); + gci->no_isp_constraint_flag = get_bits1(gb); + gci->no_mrl_constraint_flag = get_bits1(gb); + gci->no_mip_constraint_flag = get_bits1(gb); + gci->no_cclm_constraint_flag = get_bits1(gb); + + /* inter */ + gci->no_ref_pic_resampling_constraint_flag = get_bits1(gb); + gci->no_res_change_in_clvs_constraint_flag = get_bits1(gb); + gci->no_weighted_prediction_constraint_flag = get_bits1(gb); + gci->no_ref_wraparound_constraint_flag = get_bits1(gb); + gci->no_temporal_mvp_constraint_flag = get_bits1(gb); + gci->no_sbtmvp_constraint_flag = get_bits1(gb); + gci->no_amvr_constraint_flag = get_bits1(gb); + gci->no_bdof_constraint_flag = get_bits1(gb); + gci->no_smvd_constraint_flag = get_bits1(gb); + gci->no_dmvr_constraint_flag = get_bits1(gb); + gci->no_mmvd_constraint_flag = get_bits1(gb); + gci->no_affine_motion_constraint_flag = get_bits1(gb); + gci->no_prof_constraint_flag = get_bits1(gb); + gci->no_bcw_constraint_flag = get_bits1(gb); + gci->no_ciip_constraint_flag = get_bits1(gb); + gci->no_gpm_constraint_flag = get_bits1(gb); + + /* transform, quantization, residual */ + gci->no_luma_transform_size_64_constraint_flag = get_bits1(gb); + gci->no_transform_skip_constraint_flag = get_bits1(gb); + gci->no_bdpcm_constraint_flag = get_bits1(gb); + gci->no_mts_constraint_flag = get_bits1(gb); + gci->no_lfnst_constraint_flag = get_bits1(gb); + gci->no_joint_cbcr_constraint_flag = get_bits1(gb); + gci->no_sbt_constraint_flag = get_bits1(gb); + gci->no_act_constraint_flag = get_bits1(gb); + gci->no_explicit_scaling_list_constraint_flag = get_bits1(gb); + gci->no_dep_quant_constraint_flag = get_bits1(gb); + gci->no_sign_data_hiding_constraint_flag = get_bits1(gb); + gci->no_cu_qp_delta_constraint_flag = get_bits1(gb); + gci->no_chroma_qp_offset_constraint_flag = get_bits1(gb); + + /* loop filter */ + gci->no_sao_constraint_flag = get_bits1(gb); + gci->no_alf_constraint_flag = get_bits1(gb); + gci->no_ccalf_constraint_flag = get_bits1(gb); + gci->no_lmcs_constraint_flag = get_bits1(gb); + gci->no_ladf_constraint_flag = get_bits1(gb); + gci->no_virtual_boundaries_constraint_flag = get_bits1(gb); + num_reserved_bits = get_bits(gb, 8); + for (i = 0; i < num_reserved_bits; i++) { + skip_bits1(gb); //reserved_zero_bit[i] + } + } + align_get_bits(gb); + return 0; +} + +static int ptl_parse(PTL *ptl, const int profile_tier_present_flag, + const int max_num_sub_layers_minus1, GetBitContext *gb, void *log_ctx) +{ + int ret, i; + + if (profile_tier_present_flag) { + ptl->general_profile_idc = get_bits(gb, 7); + ptl->general_tier_flag = get_bits1(gb); + } + ptl->general_level_idc = get_bits(gb, 8); + ptl->frame_only_constraint_flag = get_bits1(gb); + ptl->multilayer_enabled_flag = get_bits1(gb); + if (profile_tier_present_flag) { + ret = gci_parse(&ptl->gci, gb, log_ctx); + if (ret < 0) + return ret; + } + + for (i = max_num_sub_layers_minus1 - 1; i >= 0; i--) + ptl->sublayer_level_present_flag[i] = get_bits1(gb); + + align_get_bits(gb); + + for (i = max_num_sub_layers_minus1 - 1; i >= 0; i--) { + if (ptl->sublayer_level_present_flag[i]) + ptl->sublayer_level_idc[i] = get_bits(gb, 8); + } + + if (profile_tier_present_flag) { + ptl->num_sub_profiles = get_bits(gb, 8); + for (i = 0; i < ptl->num_sub_profiles; i++) + ptl->general_sub_profile_idc[i] = get_bits(gb, 32); + } + return 0; +} + +static int map_pixel_format(VVCSPS *sps, void *log_ctx) +{ + const AVPixFmtDescriptor *desc; + switch (sps->bit_depth) { + case 8: + if (sps->chroma_format_idc == 0) sps->pix_fmt = AV_PIX_FMT_GRAY8; + if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P; + if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P; + if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P; + break; + case 10: + if (sps->chroma_format_idc == 0) sps->pix_fmt = AV_PIX_FMT_GRAY10; + if (sps->chroma_format_idc == 1) sps->pix_fmt = AV_PIX_FMT_YUV420P10; + if (sps->chroma_format_idc == 2) sps->pix_fmt = AV_PIX_FMT_YUV422P10; + if (sps->chroma_format_idc == 3) sps->pix_fmt = AV_PIX_FMT_YUV444P10; + break; + default: + av_log(log_ctx, AV_LOG_ERROR, + "The following bit-depths are currently specified: 8, 10 bits, " + "chroma_format_idc is %d, depth is %d\n", + sps->chroma_format_idc, sps->bit_depth); + return AVERROR_INVALIDDATA; + } + + desc = av_pix_fmt_desc_get(sps->pix_fmt); + if (!desc) + return AVERROR(EINVAL); + + sps->hshift[0] = sps->vshift[0] = 0; + sps->hshift[2] = sps->hshift[1] = desc->log2_chroma_w; + sps->vshift[2] = sps->vshift[1] = desc->log2_chroma_h; + + sps->pixel_shift = sps->bit_depth > 8; + + return 0; +} + +static int sps_parse_pic_resampling(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + sps->ref_pic_resampling_enabled_flag = get_bits1(gb); + if (sps->ref_pic_resampling_enabled_flag) + sps->res_change_in_clvs_allowed_flag = get_bits1(gb); + if (sps->res_change_in_clvs_allowed_flag) { + avpriv_request_sample(log_ctx, "res_change_in_clvs_allowed_flag"); + return AVERROR_PATCHWELCOME; + } + + return 0; +} + +static void win_parse(VVCWindow* win, const VVCSPS *sps, GetBitContext *gb) +{ + win->left_offset = get_ue_golomb_long(gb) << sps->hshift[1]; + win->right_offset = get_ue_golomb_long(gb) << sps->hshift[1]; + win->top_offset = get_ue_golomb_long(gb) << sps->vshift[1]; + win->bottom_offset = get_ue_golomb_long(gb) << sps->vshift[1]; +} + +static void sps_parse_conf_win(VVCSPS *sps, GetBitContext *gb, AVCodecContext *avctx) +{ + if (get_bits1(gb)) { // sps_conformance_window_flag + win_parse(&sps->conf_win, sps, gb); + + if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { + av_log(avctx, AV_LOG_DEBUG, + "discarding sps conformance window, " + "original values are l:%u r:%u t:%u b:%u\n", + sps->conf_win.left_offset, + sps->conf_win.right_offset, + sps->conf_win.top_offset, + sps->conf_win.bottom_offset); + + sps->conf_win.left_offset = + sps->conf_win.right_offset = + sps->conf_win.top_offset = + sps->conf_win.bottom_offset = 0; + } + sps->output_window = sps->conf_win; + } +} + +static void pps_parse_conf_win(VVCPPS *pps, const VVCSPS *sps, GetBitContext *gb) +{ + if (get_bits1(gb)) { // pps_conformance_window_flag + win_parse(&pps->conf_win, sps, gb); + } else if (pps->width == sps->width && pps->height == sps->height) { + pps->conf_win = sps->conf_win; + } +} + +static void scaling_win_parse(VVCWindow* win, const VVCSPS *sps, GetBitContext *gb) +{ + win->left_offset = get_se_golomb(gb) << sps->hshift[1]; + win->right_offset = get_se_golomb(gb) << sps->hshift[1]; + win->top_offset = get_se_golomb(gb) << sps->vshift[1]; + win->bottom_offset = get_se_golomb(gb) << sps->vshift[1]; +} + +static int pps_scaling_win_parse(VVCPPS *pps, const VVCSPS *sps, + GetBitContext *gb, void *log_ctx) +{ + if (get_bits1(gb)) { //pps_scaling_window_explicit_signalling_flag + if (!sps->ref_pic_resampling_enabled_flag) { + av_log(log_ctx, AV_LOG_ERROR, + "Invalid data: sps_ref_pic_resampling_enabled_flag is false, " + "but pps_scaling_window_explicit_signalling_flag is true.\n"); + return AVERROR_INVALIDDATA; + } + scaling_win_parse(&pps->scaling_win, sps, gb); + } else { + pps->scaling_win = pps->conf_win; + } + return 0; +} + +static int sps_parse_subpic(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + int i; + unsigned int ctb_size_y = sps->ctb_size_y; + unsigned int tmp_width_val = + vvc_ceil(sps->width, ctb_size_y); + unsigned int tmp_height_val = + vvc_ceil(sps->height, ctb_size_y); + + sps->subpic_info_present_flag = get_bits1(gb); + if (sps->subpic_info_present_flag) { + sps->num_subpics = get_ue_golomb_long(gb) + 1; + if (sps->num_subpics > VVC_MAX_SLICES) { + av_log(log_ctx, AV_LOG_ERROR, "num_subpics out of range: %d\n", + sps->num_subpics); + return AVERROR_INVALIDDATA; + } + if (sps->num_subpics > 1) { + const int wlen = av_ceil_log2(tmp_width_val); + const int hlen = av_ceil_log2(tmp_height_val); + int sps_subpic_same_size_flag; + + sps->independent_subpics_flag = get_bits1(gb); + sps_subpic_same_size_flag = get_bits1(gb); + if (sps->width > ctb_size_y) + sps->subpic_width[0] = get_bits(gb, wlen) + 1; + else + sps->subpic_width[0] = tmp_width_val; + if (sps->height > ctb_size_y) + sps->subpic_height[0] = get_bits(gb, hlen) + 1; + else + sps->subpic_height[0] = tmp_height_val; + if (!sps->independent_subpics_flag) { + sps->subpic_treated_as_pic_flag[0] = get_bits1(gb); + sps->loop_filter_across_subpic_enabled_flag[0] = get_bits1(gb); + } else { + sps->subpic_treated_as_pic_flag[0] = 1; + sps->loop_filter_across_subpic_enabled_flag[0] = 1; + } + for (i = 1; i < sps->num_subpics; i++) { + if (!sps_subpic_same_size_flag) { + if (sps->width > ctb_size_y) + sps->subpic_ctu_top_left_x[i] = get_bits(gb, wlen); + if (sps->height > ctb_size_y) + sps->subpic_ctu_top_left_y[i] = get_bits(gb, hlen); + if (i < sps->num_subpics - 1 && + sps->width > ctb_size_y) { + sps->subpic_width[i] = get_bits(gb, wlen) + 1; + } else { + sps->subpic_width[i] = + tmp_width_val - sps->subpic_ctu_top_left_x[i]; + } + if (i < sps->num_subpics - 1 && + sps->height > ctb_size_y) { + sps->subpic_height[i] = get_bits(gb, hlen) + 1; + } else { + sps->subpic_height[i] = + tmp_height_val - sps->subpic_ctu_top_left_y[i]; + } + } else { + int num_subpic_cols = + tmp_width_val / sps->subpic_width[0]; + sps->subpic_ctu_top_left_x[i] = + (i % num_subpic_cols) * sps->subpic_width[0]; + sps->subpic_ctu_top_left_y[i] = + (i / num_subpic_cols) * sps->subpic_height[0]; + sps->subpic_width[i] = sps->subpic_width[0]; + sps->subpic_height[i] = sps->subpic_height[0]; + } + if (!sps->independent_subpics_flag) { + sps->subpic_treated_as_pic_flag[i] = get_bits1(gb); + sps->loop_filter_across_subpic_enabled_flag[i] = get_bits1(gb); + } else { + sps->subpic_treated_as_pic_flag[i] = 1; + } + } + sps->subpic_id_len = get_ue_golomb_long(gb) + 1; + + if (sps->subpic_id_len > 16U || + ((1 << sps->subpic_id_len) < sps->num_subpics)) { + av_log(log_ctx, AV_LOG_ERROR, + "subpic_id_len(%d) is invalid\n", + sps->subpic_id_len); + return AVERROR_INVALIDDATA; + } + sps->subpic_id_mapping_explicitly_signalled_flag = get_bits1(gb); + if (sps->subpic_id_mapping_explicitly_signalled_flag) { + sps->subpic_id_mapping_present_flag = get_bits1(gb); + if (sps->subpic_id_mapping_present_flag) { + for (i = 0; i < sps->num_subpics; i++) { + sps->subpic_id[i] = get_bits(gb, sps->subpic_id_len); + } + } + } + } else { + sps->subpic_ctu_top_left_x[0] = 0; + sps->subpic_ctu_top_left_y[0] = 0; + sps->subpic_width[0] = tmp_width_val; + sps->subpic_height[0] = tmp_height_val; + } + } else { + sps->num_subpics = 1; + sps->independent_subpics_flag = 1; + sps->subpic_width[0] = tmp_width_val; + sps->subpic_height[0] = tmp_height_val; + } + + return 0; +} + +static int sps_parse_bit_depth(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + sps->bit_depth = get_ue_golomb_long(gb) + 8; + if (sps->bit_depth > 10) { + avpriv_report_missing_feature(log_ctx, "%d bits", sps->bit_depth); + return AVERROR_PATCHWELCOME; + } + + sps->qp_bd_offset = 6 * (sps->bit_depth - 8); + return map_pixel_format(sps, log_ctx); +} + +static int sps_parse_poc(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + sps->log2_max_pic_order_cnt_lsb = get_bits(gb, 4) + 4; + if (sps->log2_max_pic_order_cnt_lsb > 16U) { + av_log(log_ctx, AV_LOG_ERROR, + "log2_max_pic_order_cnt_lsb %d > 16 is invalid", + sps->log2_max_pic_order_cnt_lsb); + return AVERROR_INVALIDDATA; + } + sps->max_pic_order_cnt_lsb = 1 << sps->log2_max_pic_order_cnt_lsb; + + sps->poc_msb_cycle_flag = get_bits1(gb); + if (sps->poc_msb_cycle_flag) + uep(sps->poc_msb_cycle_len, 1, 1, 32 - sps->log2_max_pic_order_cnt_lsb); + + return 0; +} + +static int sps_parse_extra_bytes(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + u(2, sps->num_extra_ph_bytes, 0, 2); + for (int i = 0; i < (sps->num_extra_ph_bytes * 8); i++) + sps->extra_ph_bit_present_flag[i] = get_bits1(gb); + + u(2, sps->num_extra_sh_bytes, 0, 2); + for (int i = 0; i < (sps->num_extra_sh_bytes * 8); i++) + sps->extra_sh_bit_present_flag[i] = get_bits1(gb); + + return 0; +} + +static void dpb_parameters_parse(DpbParameters *dpb, const uint8_t max_sublayers_minus1, + const uint8_t sublayer_info_flag, GetBitContext *gb) +{ + int i = (sublayer_info_flag ? 0 : max_sublayers_minus1); + for (/* nothing */; i <= max_sublayers_minus1; i++) { + dpb->max_dec_pic_buffering[i] = get_ue_golomb_long(gb) + 1; + dpb->max_num_reorder_pics[i] = get_ue_golomb_long(gb); + dpb->max_latency_increase[i] = get_ue_golomb_long(gb) - 1; + } +} + +static int partition_constraints_parse(PartitionConstraints *pc, const VVCSPS *sps, + GetBitContext *gb, void *log_ctx) +{ + const int max = FFMIN(6, sps->ctb_log2_size_y); + + ue(pc->log2_diff_min_qt_min_cb, max - sps->min_cb_log2_size_y); + ue(pc->max_mtt_hierarchy_depth, 2 * (sps->ctb_log2_size_y - sps->min_cb_log2_size_y)); + if (pc->max_mtt_hierarchy_depth) { + const int min_qt_log2_size = pc->log2_diff_min_qt_min_cb + sps->min_cb_log2_size_y; + ue(pc->log2_diff_max_bt_min_qt, sps->ctb_log2_size_y - min_qt_log2_size); + ue(pc->log2_diff_max_tt_min_qt, FFMIN(6, sps->ctb_log2_size_y) - min_qt_log2_size); + } + + return 0; +} + +static int sps_parse_partition_constraints(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + int ret = 0; + + sps->partition_constraints_override_enabled_flag = get_bits1(gb); + + ret = partition_constraints_parse(&sps->intra_slice_luma, sps, gb, log_ctx); + if (ret < 0) + return ret; + + if (sps->chroma_format_idc != 0) { + sps->qtbtt_dual_tree_intra_flag = get_bits1(gb); + if (sps->qtbtt_dual_tree_intra_flag) { + ret = partition_constraints_parse(&sps->intra_slice_chroma, sps, gb, log_ctx); + if (ret < 0) + return ret; + } + } + + ret = partition_constraints_parse(&sps->inter_slice, sps, gb, log_ctx); + if (ret < 0) + return ret; + + return ret; +} + +static int rpls_parse(VVCRefPicListStruct *rpls, GetBitContext *gb, + const uint8_t list_idx, const uint8_t rpls_idx, const VVCSPS *sps, void *log_ctx) +{ + int i, j; + + rpls->num_ltrp_entries = 0; + ue(rpls->num_ref_entries, VVC_MAX_REF_ENTRIES); + if (sps->long_term_ref_pics_flag && + rpls_idx < sps->num_ref_pic_lists[list_idx] && + rpls->num_ref_entries > 0) + rpls->ltrp_in_header_flag = get_bits1(gb); + if (sps->long_term_ref_pics_flag && + rpls_idx == sps->num_ref_pic_lists[list_idx]) + rpls->ltrp_in_header_flag = 1; + for (i = 0, j = 0; i < rpls->num_ref_entries; i++) { + VVCRefPicListStructEntry *entry = &rpls->entries[i]; + if (sps->inter_layer_prediction_enabled_flag) + entry->inter_layer_ref_pic_flag = get_bits1(gb); + + if (!entry->inter_layer_ref_pic_flag) { + if (sps->long_term_ref_pics_flag) + entry->st_ref_pic_flag = get_bits1(gb); + else + entry->st_ref_pic_flag = 1; + if (entry->st_ref_pic_flag) { + int abs_delta_poc_st, strp_entry_sign_flag = 0; + ue(abs_delta_poc_st, (1<<15) - 1); + if (!((sps->weighted_pred_flag || + sps->weighted_bipred_flag) && i != 0)) + abs_delta_poc_st++; + if (abs_delta_poc_st > 0) + strp_entry_sign_flag = get_bits1(gb); + entry->delta_poc_val_st = (1 - 2 * strp_entry_sign_flag) * abs_delta_poc_st; + } else { + if (!rpls->ltrp_in_header_flag) { + uint8_t bits = sps->log2_max_pic_order_cnt_lsb; + entry->lt_poc = get_bits(gb, bits); + j++; + } + rpls->num_ltrp_entries++; + } + } else { + avpriv_request_sample(log_ctx, "Inter layer ref"); + return AVERROR_PATCHWELCOME; + } + } + + return 0; +} + +static int sps_parse_chroma_qp_table(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + const int sps_same_qp_table_for_chroma_flag = get_bits1(gb); + const int num_qp_tables = sps_same_qp_table_for_chroma_flag ? + 1 : (sps->joint_cbcr_enabled_flag ? 3 : 2); + + for (int i = 0; i < num_qp_tables; i++) { + int qp_table_start_minus26, num_points_in_qp_table_minus1; + int num_points_in_qp_table; + int qp_in[VVC_MAX_POINTS_IN_QP_TABLE], qp_out[VVC_MAX_POINTS_IN_QP_TABLE]; + unsigned int delta_qp_in[VVC_MAX_POINTS_IN_QP_TABLE]; + int off = sps->qp_bd_offset; + + se(qp_table_start_minus26, -26 - sps->qp_bd_offset, 36); + ue(num_points_in_qp_table_minus1, 36 - qp_table_start_minus26); + num_points_in_qp_table = num_points_in_qp_table_minus1 + 1; + + qp_out[0] = qp_in[0] = qp_table_start_minus26 + 26; + for (int j = 0; j < num_points_in_qp_table; j++ ) { + const uint8_t max = 0xff; + unsigned int delta_qp_diff_val, delta_qp_in_val_minus1; + + ue(delta_qp_in_val_minus1, max); + ue(delta_qp_diff_val, max); + delta_qp_in[j] = delta_qp_in_val_minus1 + 1; + qp_in[j+1] = qp_in[j] + delta_qp_in[j]; + qp_out[j+1] = qp_out[j] + (delta_qp_in_val_minus1 ^ delta_qp_diff_val); + } + sps->chroma_qp_table[i][qp_in[0] + off] = qp_out[0]; + for (int k = qp_in[0] - 1 + off; k >= 0; k--) + sps->chroma_qp_table[i][k] = av_clip(sps->chroma_qp_table[i][k+1]-1, -off, 63); + + for (int j = 0; j < num_points_in_qp_table; j++) { + int sh = delta_qp_in[j] >> 1; + for (int k = qp_in[j] + 1 + off, m = 1; k <= qp_in[j+1] + off; k++, m++) { + sps->chroma_qp_table[i][k] = sps->chroma_qp_table[i][qp_in[j] + off] + + ((qp_out[j+1] - qp_out[j]) * m + sh) / delta_qp_in[j]; + } + } + for (int k = qp_in[num_points_in_qp_table] + 1 + off; k <= 63 + off; k++) + sps->chroma_qp_table[i][k] = av_clip(sps->chroma_qp_table[i][k-1] + 1, -sps->qp_bd_offset, 63); + } + if (sps_same_qp_table_for_chroma_flag) { + memcpy(&sps->chroma_qp_table[1], &sps->chroma_qp_table[0], sizeof(sps->chroma_qp_table[0])); + memcpy(&sps->chroma_qp_table[2], &sps->chroma_qp_table[0], sizeof(sps->chroma_qp_table[0])); + } + + return 0; +} + +static int sps_parse_transform(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + int ret = 0; + + sps->transform_skip_enabled_flag = get_bits1(gb); + if (sps->transform_skip_enabled_flag) { + sps->max_ts_size = 1 << (get_ue_golomb_long(gb) + 2); + if (sps->max_ts_size > 32) { + av_log(log_ctx, AV_LOG_ERROR, + "sps_log2_transform_skip_max_size_minus2 > 3 is invalid"); + return AVERROR_INVALIDDATA; + } + sps->bdpcm_enabled_flag = get_bits1(gb); + } + + sps->mts_enabled_flag = get_bits1(gb); + if (sps->mts_enabled_flag) { + sps->explicit_mts_intra_enabled_flag = get_bits1(gb); + sps->explicit_mts_inter_enabled_flag = get_bits1(gb); + } + + sps->lfnst_enabled_flag = get_bits1(gb); + + if (sps->chroma_format_idc != 0) { + sps->joint_cbcr_enabled_flag = get_bits1(gb); + ret = sps_parse_chroma_qp_table(sps, gb, log_ctx); + if (ret < 0) + return ret; + } + + return ret; +} + +static void sps_parse_filter(VVCSPS *sps, GetBitContext *gb) +{ + sps->sao_enabled_flag = get_bits1(gb); + + sps->alf_enabled_flag = get_bits1(gb); + if (sps->alf_enabled_flag && sps->chroma_format_idc) + sps->ccalf_enabled_flag = get_bits1(gb); + + sps->lmcs_enabled_flag = get_bits1(gb); +} + +static int sps_parse_rpls(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + int sps_rpl1_same_as_rpl0_flag; + + sps->idr_rpl_present_flag = get_bits1(gb); + sps_rpl1_same_as_rpl0_flag = get_bits1(gb); + for (int i = 0; i < (sps_rpl1_same_as_rpl0_flag ? 1 : 2); i++) { + ue(sps->num_ref_pic_lists[i], VVC_MAX_REF_PIC_LISTS); + for (int j = 0; j < sps->num_ref_pic_lists[i]; j++) { + int ret = rpls_parse(&sps->ref_pic_list_struct[i][j], gb, i, j, sps, log_ctx); + if (ret < 0) + return ret; + } + } + + if (sps_rpl1_same_as_rpl0_flag) { + sps->num_ref_pic_lists[1] = sps->num_ref_pic_lists[0]; + for (int j = 0; j < sps->num_ref_pic_lists[0]; j++) + memcpy(&sps->ref_pic_list_struct[1][j], + &sps->ref_pic_list_struct[0][j], + sizeof(sps->ref_pic_list_struct[0][j])); + } + + return 0; +} + +static int sps_parse_max_num_gpm_merge_cand(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + sps->max_num_gpm_merge_cand = 0; + if (sps->max_num_merge_cand >= 2) { + sps->gpm_enabled_flag = get_bits1(gb); + if (sps->gpm_enabled_flag) { + sps->max_num_gpm_merge_cand = 2; + if (sps->max_num_merge_cand >= 3) { + uint8_t sps_max_num_merge_cand_minus_max_num_gpm_cand; + ue(sps_max_num_merge_cand_minus_max_num_gpm_cand, sps->max_num_merge_cand - 2); + sps->max_num_gpm_merge_cand = sps->max_num_merge_cand - sps_max_num_merge_cand_minus_max_num_gpm_cand; + } + } + } + + return 0; +} + +static int sps_parse_inter(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + int ret, sps_six_minus_max_num_merge_cand; + + sps->weighted_pred_flag = get_bits1(gb); + sps->weighted_bipred_flag = get_bits1(gb); + sps->long_term_ref_pics_flag = get_bits1(gb); + if (sps->video_parameter_set_id > 0) + sps->inter_layer_prediction_enabled_flag = get_bits1(gb); + + ret = sps_parse_rpls(sps, gb, log_ctx); + if (ret < 0) + return ret; + + sps->ref_wraparound_enabled_flag = get_bits1(gb); + + sps->temporal_mvp_enabled_flag = get_bits1(gb); + if (sps->temporal_mvp_enabled_flag) + sps->sbtmvp_enabled_flag = get_bits1(gb); + + sps->amvr_enabled_flag = get_bits1(gb); + sps->bdof_enabled_flag = get_bits1(gb); + if (sps->bdof_enabled_flag) + sps->bdof_control_present_in_ph_flag = get_bits1(gb); + + sps->smvd_enabled_flag = get_bits1(gb); + sps->dmvr_enabled_flag = get_bits1(gb); + if (sps->dmvr_enabled_flag) + sps->dmvr_control_present_in_ph_flag = get_bits1(gb); + + sps->mmvd_enabled_flag = get_bits1(gb); + if (sps->mmvd_enabled_flag) + sps->mmvd_fullpel_only_enabled_flag = get_bits1(gb); + + ue(sps_six_minus_max_num_merge_cand, 5); + sps->max_num_merge_cand = 6 - sps_six_minus_max_num_merge_cand; + + sps->sbt_enabled_flag = get_bits1(gb); + + sps->affine_enabled_flag = get_bits1(gb); + if (sps->affine_enabled_flag) { + ue(sps->five_minus_max_num_subblock_merge_cand, + 5 - sps->sbtmvp_enabled_flag); + sps->six_param_affine_enabled_flag = get_bits1(gb); + if (sps->amvr_enabled_flag) + sps->affine_amvr_enabled_flag = get_bits1(gb); + sps->affine_prof_enabled_flag = get_bits1(gb); + if (sps->affine_prof_enabled_flag) + sps->prof_control_present_in_ph_flag = get_bits1(gb); + } + + sps->bcw_enabled_flag = get_bits1(gb); + sps->ciip_enabled_flag = get_bits1(gb); + + ret = sps_parse_max_num_gpm_merge_cand(sps, gb, log_ctx); + if (ret < 0) + return ret; + + uep(sps->log2_parallel_merge_level, 2, 2, sps->ctb_log2_size_y); + + return 0; +} + +static int sps_parse_intra(VVCSPS *sps, const int sps_max_luma_transform_size_64_flag, + GetBitContext *gb, void *log_ctx) +{ + sps->isp_enabled_flag = get_bits1(gb); + sps->mrl_enabled_flag = get_bits1(gb); + sps->mip_enabled_flag = get_bits1(gb); + + if (sps->chroma_format_idc != 0) + sps->cclm_enabled_flag = get_bits1(gb); + if (sps->chroma_format_idc == 1) { + sps->chroma_horizontal_collocated_flag = get_bits1(gb); + sps->chroma_vertical_collocated_flag = get_bits1(gb); + } else { + sps->chroma_horizontal_collocated_flag = 1; + sps->chroma_vertical_collocated_flag = 1; + } + + sps->palette_enabled_flag = get_bits1(gb); + if (sps->chroma_format_idc == 3 && + !sps_max_luma_transform_size_64_flag) + sps->act_enabled_flag = get_bits1(gb); + if (sps->transform_skip_enabled_flag || sps->palette_enabled_flag) + ue(sps->min_qp_prime_ts, 8); + + sps->ibc_enabled_flag = get_bits1(gb); + if (sps->ibc_enabled_flag) { + uint8_t six_minus_max_num_ibc_merge_cand; + ue(six_minus_max_num_ibc_merge_cand, 5); + sps->max_num_ibc_merge_cand = 6 - six_minus_max_num_ibc_merge_cand; + } + + return 0; +} + +static int sps_parse_ladf(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + sps->ladf_enabled_flag = get_bits1(gb); + if (sps->ladf_enabled_flag) { + sps->num_ladf_intervals = get_bits(gb, 2) + 2; + se(sps->ladf_lowest_interval_qp_offset, -63, 63); + + sps->ladf_interval_lower_bound[0] = 0; + for (int i = 0; i < sps->num_ladf_intervals - 1; i++) { + int sps_ladf_delta_threshold_minus1; + + se(sps->ladf_qp_offset[i], -63, 63); + + ue(sps_ladf_delta_threshold_minus1, (2 << sps->bit_depth) - 3); + sps->ladf_interval_lower_bound[i + 1] = sps->ladf_interval_lower_bound[i] + sps_ladf_delta_threshold_minus1 + 1; + } + } + + return 0; +} + +static void sps_parse_dequant(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + sps->explicit_scaling_list_enabled_flag = get_bits1(gb); + if (sps->lfnst_enabled_flag && sps->explicit_scaling_list_enabled_flag) + sps->scaling_matrix_for_lfnst_disabled_flag = get_bits1(gb); + + if (sps->act_enabled_flag && sps->explicit_scaling_list_enabled_flag) + sps->scaling_matrix_for_alternative_colour_space_disabled_flag = get_bits1(gb); + + if (sps->scaling_matrix_for_alternative_colour_space_disabled_flag) + sps->scaling_matrix_designated_colour_space_flag = get_bits1(gb); + + sps->dep_quant_enabled_flag = get_bits1(gb); + sps->sign_data_hiding_enabled_flag = get_bits1(gb); +} + +static int virtual_boundaries_parse(VirtualBoundaries *vbs, const int width, const int height, + GetBitContext *gb, void *log_ctx) +{ + vbs->virtual_boundaries_present_flag = get_bits1(gb); + if (vbs->virtual_boundaries_present_flag) { + ue(vbs->num_ver_virtual_boundaries, width <= 8 ? 0 : 3); + for (int i = 0; i < vbs->num_ver_virtual_boundaries; i++) + ue(vbs->virtual_boundary_pos_x_minus1[i], (width + 7) / 8 - 2); + ue(vbs->num_hor_virtual_boundaries, height <= 8 ? 0 : 3); + for (int i = 0; i < vbs->num_hor_virtual_boundaries; i++) + ue(vbs->virtual_boundary_pos_y_minus1[i], (height + 7) / 8 - 2); + } + + return 0; +} + +static int sps_parse_virtual_boundaries(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + sps->virtual_boundaries_enabled_flag = get_bits1(gb); + if (sps->virtual_boundaries_enabled_flag) { + const int ret = virtual_boundaries_parse(&sps->vbs, sps->width, sps->height, gb, log_ctx); + if (ret < 0) + return ret; + } + + return 0; +} + +// 7.3.5.1 General timing and HRD parameters syntax +static int general_timing_hrd_parameters_parse(GeneralTimingHrdParameters *hrd, GetBitContext *gb, void *log_ctx) +{ + skip_bits_long(gb, 32); ///< num_units_in_tick + skip_bits_long(gb, 32); ///< time_scale + hrd->general_nal_hrd_params_present_flag = get_bits1(gb); + hrd->general_vcl_hrd_params_present_flag = get_bits1(gb); + if (hrd->general_nal_hrd_params_present_flag || hrd->general_vcl_hrd_params_present_flag) { + skip_bits1(gb); ///< general_same_pic_timing_in_all_ols_flag + hrd->general_du_hrd_params_present_flag = get_bits1(gb); + if (hrd->general_du_hrd_params_present_flag) + skip_bits(gb, 8); ///< tick_divisor_minus2 + skip_bits(gb, 4); ///< bit_rate_scale + skip_bits(gb, 4); ///< cpb_size_scale + if (hrd->general_du_hrd_params_present_flag) + skip_bits(gb, 4); ///< cpb_size_du_scale + uep(hrd->hrd_cpb_cnt, 1, 1, 32); + } + return 0; +} + +static int ols_timing_hrd_parameters_parse(const GeneralTimingHrdParameters *hrd, + const uint8_t first_sublayer, const uint8_t last_sublayer, GetBitContext *gb, void *log_ctx) +{ + const int hrd_params_present_flag = hrd->general_nal_hrd_params_present_flag || + hrd->general_vcl_hrd_params_present_flag; + int elemental_duration_in_tc_minus1; + for (uint8_t i = first_sublayer; i < last_sublayer; i++) { + int fixed_pic_rate_within_cvs_flag = 0; + if (!get_bits1(gb)) ///< fixed_pic_rate_general_flag + fixed_pic_rate_within_cvs_flag = get_bits1(gb); + if (fixed_pic_rate_within_cvs_flag) + ue(elemental_duration_in_tc_minus1, 2047); + else if (hrd_params_present_flag && hrd->hrd_cpb_cnt == 1) + skip_bits1(gb); ///< low_delay_hrd_flag + + if (hrd_params_present_flag) { + int bit_rate_value_minus1, cpb_size_value_minus1; + int cpb_size_du_value_minus1, bit_rate_du_value_minus1; + for (int j = 0; j < hrd->hrd_cpb_cnt; j++) { + ue(bit_rate_value_minus1, UINT32_MAX - 1); + ue(cpb_size_value_minus1, UINT32_MAX - 1); + if (hrd->general_du_hrd_params_present_flag) { + ue(cpb_size_du_value_minus1, UINT32_MAX - 1); + ue(bit_rate_du_value_minus1, UINT32_MAX - 1); + } + skip_bits1(gb); ///< cbr_flag + } + } + } + return 0; +} + +static int sps_parse_hrd(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + int ret; + sps->timing_hrd_params_present_flag = get_bits1(gb); + if (sps->timing_hrd_params_present_flag) { + uint8_t first_sublayer = 0 ; + GeneralTimingHrdParameters *hrd = &sps->general_timing_hrd_parameters; + ret = general_timing_hrd_parameters_parse(hrd, gb, log_ctx); + if (ret < 0) + return ret; + if (sps->max_sublayers > 1 && get_bits1(gb)) ///< sps_sublayer_cpb_params_present_flag + first_sublayer = sps->max_sublayers - 1; + ret = ols_timing_hrd_parameters_parse(hrd, first_sublayer, sps->max_sublayers, gb, log_ctx); + if (ret < 0) + return ret; + } + return 0; +} + +static int sps_parse_vui(VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + VUI *vui = &sps->vui; + + if (get_bits1(gb)) { //vui_parameters_present_flag + uep(vui->payload_size, 1, 1, 1024); + align_get_bits(gb); + //fixme + } else { + vui->colour_primaries = 2; + vui->transfer_characteristics = 2; + vui->matrix_coeffs = 2; + vui->chroma_sample_loc_type_frame = 6; + vui->chroma_sample_loc_type_top_field = 6; + vui->chroma_sample_loc_type_bottom_field = 6; + } + + return 0; +} + +static int sps_parse(VVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, + int apply_defdispwin, AVBufferRef **vps_list, AVCodecContext *avctx, int nuh_layer_id) +{ + int sps_ptl_dpb_hrd_params_present_flag; + int ret = 0, sps_max_luma_transform_size_64_flag = 0; + const VVCVPS *vps; + void *log_ctx = avctx; + + // Coded parameters + + *sps_id = get_bits(gb, 4); + + sps->video_parameter_set_id = get_bits(gb, 4); + if (vps_list && !vps_list[sps->video_parameter_set_id]) { + if (!sps->video_parameter_set_id) { + VVCVPS *vps0; + AVBufferRef* buf = av_buffer_allocz(sizeof(*vps)); + if (!buf) + return AVERROR(ENOMEM); + vps_list[0] = buf; + vps0 = (VVCVPS *)buf->data; + vps0->max_layers = 1; + vps0->independent_layer_flag[0] = 1; + vps0->layer_id[0] = nuh_layer_id; + } else { + av_log(log_ctx, AV_LOG_ERROR, "VPS %d does not exist\n", + sps->video_parameter_set_id); + return AVERROR_INVALIDDATA; + } + } + vps = (VVCVPS*)vps_list[sps->video_parameter_set_id]->data; + + sps->max_sublayers = get_bits(gb, 3) + 1; + if (sps->max_sublayers > VVC_MAX_SUBLAYERS) { + av_log(log_ctx, AV_LOG_ERROR, "sps_max_sublayers out of range: %d\n", + sps->max_sublayers); + return AVERROR_INVALIDDATA; + } + + sps->chroma_format_idc = get_bits(gb, 2); + + sps->ctb_log2_size_y = get_bits(gb, 2) + 5; + if (sps->ctb_log2_size_y == 8) { + av_log(log_ctx, AV_LOG_ERROR, "sps_log2_ctu_size_minus5 can't be 3\n"); + return AVERROR_INVALIDDATA; + } + sps->ctb_size_y = 1 << sps->ctb_log2_size_y; + + sps_ptl_dpb_hrd_params_present_flag = get_bits1(gb); + if (sps_ptl_dpb_hrd_params_present_flag) { + ret = ptl_parse(&sps->ptl, 1, sps->max_sublayers - 1, gb, log_ctx); + if (ret < 0) + return ret; + } + skip_bits1(gb); ///< sps_gdr_enabled_flag + + ret = sps_parse_pic_resampling(sps, gb, log_ctx); + if (ret < 0) + return ret; + + ue(sps->width, VVC_MAX_WIDTH); + ue(sps->height, VVC_MAX_HEIGHT); + if (!sps->width || !sps->height) + return AVERROR_INVALIDDATA; + + sps_parse_conf_win(sps, gb, avctx); + + ret = sps_parse_subpic(sps, gb, log_ctx); + if (ret < 0) + return ret; + + ret = sps_parse_bit_depth(sps, gb, log_ctx); + if (ret < 0) + return ret; + + sps->entropy_coding_sync_enabled_flag = get_bits1(gb); + sps->entry_point_offsets_present_flag = get_bits1(gb); + + ret = sps_parse_poc(sps, gb, log_ctx); + if (ret < 0) + return ret; + + ret = sps_parse_extra_bytes(sps, gb, log_ctx); + if (ret < 0) + return ret; + + if (sps_ptl_dpb_hrd_params_present_flag) { + const int sps_sublayer_dpb_params_flag = sps->max_sublayers > 1 ? get_bits1(gb) : 0; + dpb_parameters_parse(&sps->dpb, sps->max_sublayers - 1, sps_sublayer_dpb_params_flag, gb); + } + + uep(sps->min_cb_log2_size_y, 2, 2, FFMIN(6, sps->ctb_log2_size_y)); + sps->min_cb_size_y = 1 << sps->min_cb_log2_size_y; + + ret = sps_parse_partition_constraints(sps, gb, log_ctx); + if (ret < 0) + return ret; + + if (sps->ctb_size_y > 32) + sps_max_luma_transform_size_64_flag = get_bits1(gb); + sps->max_tb_size_y = 1 << (sps_max_luma_transform_size_64_flag ? 6 : 5); + + ret = sps_parse_transform(sps, gb, log_ctx); + if (ret < 0) + return ret; + + sps_parse_filter(sps, gb); + + ret = sps_parse_inter(sps, gb, log_ctx); + if (ret < 0) + return ret; + + ret = sps_parse_intra(sps, sps_max_luma_transform_size_64_flag, gb, log_ctx); + if (ret < 0) + return ret; + + ret = sps_parse_ladf(sps, gb, log_ctx); + if (ret < 0) + return ret; + + sps_parse_dequant(sps, gb, log_ctx); + + ret = sps_parse_virtual_boundaries(sps, gb, log_ctx); + if (ret < 0) + return ret; + + if (sps_ptl_dpb_hrd_params_present_flag) { + ret = sps_parse_hrd(sps, gb, log_ctx); + if (ret < 0) + return ret; + } + + sps->field_seq_flag = get_bits1(gb); + + ret = sps_parse_vui(sps, gb, log_ctx); + if (ret < 0) + return ret; + + skip_bits1(gb); ///< sps_extension_flag + + if (get_bits_left(gb) < 0) { + av_log(log_ctx, AV_LOG_ERROR, + "Overread SPS by %d bits\n", -get_bits_left(gb)); + return AVERROR_INVALIDDATA; + } + + return 0; +} + +int ff_vvc_decode_sps(VVCParamSets *ps, GetBitContext *gb, + int apply_defdispwin, int nuh_layer_id, AVCodecContext *avctx) +{ + VVCSPS *sps; + AVBufferRef *sps_buf = av_buffer_allocz(sizeof(*sps)); + unsigned int sps_id; + int ret; + ptrdiff_t nal_size; + + if (!sps_buf) + return AVERROR(ENOMEM); + sps = (VVCSPS*)sps_buf->data; + + av_log(avctx, AV_LOG_DEBUG, "Decoding SPS\n"); + + nal_size = gb->buffer_end - gb->buffer; + if (nal_size > sizeof(sps->data)) { + av_log(avctx, AV_LOG_WARNING, "Truncating likely oversized SPS " + "(%"PTRDIFF_SPECIFIER" > %"SIZE_SPECIFIER")\n", + nal_size, sizeof(sps->data)); + sps->data_size = sizeof(sps->data); + } else { + sps->data_size = nal_size; + } + memcpy(sps->data, gb->buffer, sps->data_size); + + ret = sps_parse(sps, gb, &sps_id, apply_defdispwin, ps->vps_list, avctx, nuh_layer_id); + if (ret < 0) { + av_buffer_unref(&sps_buf); + return ret; + } + + if (avctx->debug & FF_DEBUG_BITSTREAM) { + av_log(avctx, AV_LOG_DEBUG, + "Parsed SPS: id %d; coded wxh: %dx%d; " + "cropped wxh: %dx%d; pix_fmt: %s.\n", + sps_id, sps->width, sps->height, + sps->width - (sps->output_window.left_offset + sps->output_window.right_offset), + sps->height - (sps->output_window.top_offset + sps->output_window.bottom_offset), + av_get_pix_fmt_name(sps->pix_fmt)); + } + + /* check if this is a repeat of an already parsed SPS, then keep the + * original one. + * otherwise drop all PPSes that depend on it */ + if (ps->sps_list[sps_id] && + !memcmp(ps->sps_list[sps_id]->data, sps_buf->data, sps_buf->size)) { + av_buffer_unref(&sps_buf); + } else { + remove_sps(ps, sps_id); + ps->sps_list[sps_id] = sps_buf; + } + return 0; +} + +static void vvc_pps_free(void *opaque, uint8_t *data) +{ + VVCPPS *pps = (VVCPPS *)data; + + av_freep(&pps->column_width); + av_freep(&pps->row_height); + av_freep(&pps->col_bd); + av_freep(&pps->row_bd); + av_freep(&pps->ctb_to_col_bd); + av_freep(&pps->ctb_to_row_bd); + av_freep(&pps->ctb_addr_in_slice); + av_freep(&pps); +} + +static int pps_parse_width_height(VVCPPS *pps, const VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + const int divisor = FFMAX(sps->min_cb_size_y, 8); + + ue(pps->width, sps->width); + ue(pps->height, sps->height); + + if (!pps->width || !pps->height) + return AVERROR_INVALIDDATA; + + if (pps->width % divisor || pps->height % divisor) { + av_log(log_ctx, AV_LOG_ERROR, + "Invalid dimensions: %ux%u not divisible " + "by %u, MinCbSizeY = %u.\n", pps->width, + pps->height, divisor, sps->min_cb_size_y); + return AVERROR_INVALIDDATA; + } + if (!sps->res_change_in_clvs_allowed_flag && + (pps->width != sps->width || pps->height != sps->height)) { + av_log(log_ctx, AV_LOG_ERROR, + "Resoltuion change is not allowed, " + "in max resolution (%ux%u) mismatched with pps(%ux%u).\n", + sps->width, sps->height, + pps->width, pps->height); + return AVERROR_INVALIDDATA; + } + return 0; +} + +static unsigned int* pps_parse_tile_sizes(uint16_t *num, unsigned int num_exp, + unsigned int max_num, unsigned int max_size, GetBitContext *gb, void *log_ctx) +{ + unsigned int i, exp_tile_size = 0; + unsigned int unified_size, remaining_size; + unsigned int *sizes, *p; + sizes = av_malloc_array(num_exp, sizeof(*sizes)); + if (!sizes) + return NULL; + for (i = 0; i < num_exp; i++) { + sizes[i] = get_ue_golomb_long(gb) + 1; + if (exp_tile_size + sizes[i] > max_size) { + goto err; + } + exp_tile_size += sizes[i]; + } + remaining_size = max_size - exp_tile_size; + unified_size = (i == 0 ? max_size : sizes[i-1]); + *num = i + vvc_ceil(remaining_size, unified_size); + if (*num > max_num) { + av_log(log_ctx, AV_LOG_ERROR, "num(%d) large than %d.\n", *num, max_num); + goto err; + } + p = av_realloc_array(sizes, *num, sizeof(*sizes)); + if (!p) + goto err; + sizes = p; + while (remaining_size > unified_size) { + sizes[i] = unified_size; + remaining_size -= unified_size; + i++; + } + if (remaining_size > 0) { + sizes[i] = remaining_size; + } + return sizes; +err: + av_free(sizes); + return NULL; +} + +static inline unsigned int* pps_setup_bd(unsigned int *sizes, int num_sizes) +{ + unsigned int *bd = av_malloc_array(num_sizes + 1, sizeof(*bd)); + if (!bd) + return NULL; + *bd= 0; + for (int i = 0; i < num_sizes; i++) { + bd[i+1] = bd[i] + sizes[i]; + } + return bd; +} + +static int pps_setup(VVCPPS *pps, const VVCSPS *sps) +{ + int ret = AVERROR(ENOMEM), tile_x = 0, tile_y = 0; + + pps->ctb_to_col_bd = av_calloc(pps->ctb_width + 1, sizeof(*pps->ctb_to_col_bd)); + pps->ctb_to_row_bd = av_calloc(pps->ctb_height + 1, sizeof(*pps->ctb_to_col_bd)); + if (!pps->ctb_to_col_bd || !pps->ctb_to_row_bd) + goto err; + + for (int ctb_addr_x = 0; ctb_addr_x < pps->ctb_width; ctb_addr_x++) { + if (ctb_addr_x == pps->col_bd[tile_x + 1]) + tile_x++; + pps->ctb_to_col_bd[ctb_addr_x] = pps->col_bd[tile_x]; + } + pps->ctb_to_col_bd[pps->ctb_width] = pps->ctb_width; + + for (int ctb_addr_y = 0; ctb_addr_y < pps->ctb_height; ctb_addr_y++) { + if (ctb_addr_y == pps->row_bd[tile_y + 1]) + tile_y++; + pps->ctb_to_row_bd[ctb_addr_y] = pps->row_bd[tile_y]; + } + pps->ctb_to_row_bd[pps->ctb_height] = pps->ctb_height; + + return 0; +err: + return ret; +} + +static int pps_parse_subpic_id(VVCPPS *pps, const VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + int pps_subpic_id_mapping_present_flag; + uint8_t subpic_id_len; + + pps->no_pic_partition_flag = get_bits1(gb); + if (sps->num_subpics > 1 || pps->mixed_nalu_types_in_pic_flag) { + if (pps->no_pic_partition_flag) { + av_log(log_ctx, AV_LOG_ERROR, + "no_pic_partition_flag should not true"); + return AVERROR_INVALIDDATA; + } + } + + pps_subpic_id_mapping_present_flag = get_bits1(gb); + if (pps_subpic_id_mapping_present_flag) { + if (!pps->no_pic_partition_flag) { + const uint16_t num_subpics = get_ue_golomb_long(gb) + 1; + if (num_subpics != sps->num_subpics) { + av_log(log_ctx, AV_LOG_ERROR, + "pps_num_subpics %u should equals to " + "sps_num_subpics %u .\n", num_subpics, sps->num_subpics); + return AVERROR_INVALIDDATA; + } + } + + subpic_id_len = get_ue_golomb_long(gb) + 1; + if (subpic_id_len != sps->subpic_id_len) { + av_log(log_ctx, AV_LOG_ERROR, + "pps_subpic_id_len %u should equals to " + "sps_subpic_id_len %u .\n", subpic_id_len, sps->subpic_id_len); + return AVERROR_INVALIDDATA; + } + + } + for (int i = 0; i < sps->num_subpics; i++) { + if (sps->subpic_id_mapping_explicitly_signalled_flag) { + if (pps_subpic_id_mapping_present_flag) + pps->subpic_id[i] = get_bits(gb, sps->subpic_id_len); + else + pps->subpic_id[i] = sps->subpic_id[i]; + } else { + pps->subpic_id[i] = i; + } + } + return 0; +} + +static int pps_parse_chroma_tool_offsets(VVCPPS *pps, GetBitContext *gb, void *log_ctx) +{ + uint8_t pps_joint_cbcr_qp_offset_present_flag; + + pps->chroma_tool_offsets_present_flag = get_bits1(gb); + if (!pps->chroma_tool_offsets_present_flag) + return 0; + + se(pps->chroma_qp_offset[CB - 1], -12, 12); + se(pps->chroma_qp_offset[CR - 1], -12, 12); + + pps_joint_cbcr_qp_offset_present_flag = get_bits1(gb); + if (pps_joint_cbcr_qp_offset_present_flag) + se(pps->chroma_qp_offset[JCBCR - 1], -12, 12); + pps->slice_chroma_qp_offsets_present_flag = get_bits1(gb); + pps->cu_chroma_qp_offset_list_enabled_flag = get_bits1(gb); + if (pps->cu_chroma_qp_offset_list_enabled_flag) { + ue(pps->chroma_qp_offset_list_len_minus1, 5); + for (int i = 0; i <= pps->chroma_qp_offset_list_len_minus1; i++) { + for (int j = CB - 1; j < CR + pps_joint_cbcr_qp_offset_present_flag; j++) + se(pps->chroma_qp_offset_list[i][j], -12, 12); + } + } + return 0; +} + +static int deblock_parse(DBParams *deblock, const VVCPPS *pps, GetBitContext *gb, void *log_ctx) +{ + int beta_offset_div2, tc_offset_div2; + for (int c_idx = 0; c_idx < VVC_MAX_SAMPLE_ARRAYS; c_idx++) { + if (!c_idx || pps->chroma_tool_offsets_present_flag) { + se(beta_offset_div2, -12, 12); + se(tc_offset_div2, -12, 12); + } + deblock->beta_offset[c_idx] = beta_offset_div2 << 1; + deblock->tc_offset[c_idx] = tc_offset_div2 << 1; + } + return 0; +} +static int pps_parse_deblocking_control(VVCPPS *pps, GetBitContext *gb, void *log_ctx) +{ + if (get_bits1(gb)) { //pps_deblocking_filter_control_present_flag + pps->deblocking_filter_override_enabled_flag = get_bits1(gb); + pps->deblocking_filter_disabled_flag = get_bits1(gb); + if (!pps->no_pic_partition_flag && + pps->deblocking_filter_override_enabled_flag) + pps->dbf_info_in_ph_flag = get_bits1(gb); + if (!pps->deblocking_filter_disabled_flag) + return deblock_parse(&pps->deblock, pps, gb, log_ctx); + } + return 0; +} + +static int pps_parse_num_tiles_in_pic(VVCPPS *pps, GetBitContext *gb, void *log_ctx) +{ + unsigned int num_exp_tile_columns, num_exp_tile_rows; + + uep(num_exp_tile_columns, 1, 1, + FFMIN(pps->ctb_width, VVC_MAX_TILE_COLUMNS)); + uep(num_exp_tile_rows, 1, 1, + FFMIN(pps->ctb_height, VVC_MAX_TILE_ROWS)); + + pps->column_width = pps_parse_tile_sizes(&pps->num_tile_columns, + num_exp_tile_columns, VVC_MAX_TILE_COLUMNS, pps->ctb_width, + gb, log_ctx); + if (!pps->column_width) + return AVERROR(ENOMEM); + + pps->row_height = pps_parse_tile_sizes(&pps->num_tile_rows, + num_exp_tile_rows, VVC_MAX_TILE_ROWS, pps->ctb_height, + gb, log_ctx); + if (!pps->row_height) + return AVERROR(ENOMEM); + + pps->num_tiles_in_pic = + pps->num_tile_columns * pps->num_tile_rows; + if (pps->num_tiles_in_pic > VVC_MAX_TILES_PER_AU) { + av_log(log_ctx, AV_LOG_ERROR, + "NumTilesInPic(%d) large than %d.\n", + pps->num_tiles_in_pic, VVC_MAX_TILES_PER_AU); + return AVERROR_INVALIDDATA; + } + + pps->col_bd = pps_setup_bd(pps->column_width, pps->num_tile_columns); + pps->row_bd = pps_setup_bd(pps->row_height, pps->num_tile_rows); + if (!pps->col_bd || !pps->row_bd) + return AVERROR(ENOMEM); + + return 0; +} + +static int pps_parse_slice_width_height_in_tiles(VVCPPS *pps, const int i, + const int tile_x, const int tile_y, const int pps_tile_idx_delta_present_flag, + GetBitContext *gb, void *log_ctx, + int *slice_width_in_tiles, int *slice_height_in_tiles) +{ + *slice_width_in_tiles = 1; + if (tile_x != pps->num_tile_columns - 1) { + uep(*slice_width_in_tiles, 1, 1, pps->num_tile_columns); + } + if (tile_y != pps->num_tile_rows - 1 && + (pps_tile_idx_delta_present_flag || tile_x == 0)) { + uep(*slice_height_in_tiles, 1, 1, pps->num_tile_rows); + } else { + if (tile_y == pps->num_tile_rows - 1) + *slice_height_in_tiles = 1; + } + return 0; +} + +static void pps_derive_tile_xy(const VVCPPS *pps, const int tile_idx, + int *tile_x, int *tile_y) +{ + *tile_x = tile_idx % pps->num_tile_columns; + *tile_y = tile_idx / pps->num_tile_columns; +} + +static int pps_parse_tile_idx(const VVCPPS *pps, const int slice_idx, int tile_idx, + const int slice_width_in_tiles, const int slice_height_in_tiles, const int pps_tile_idx_delta_present_flag, + GetBitContext *gb) +{ + if (pps_tile_idx_delta_present_flag) { + tile_idx += get_se_golomb(gb); //< pps_tile_idx_delta_val + } else { + tile_idx += slice_width_in_tiles; + if (tile_idx % pps->num_tile_columns == 0) + tile_idx += (slice_height_in_tiles - 1) * pps->num_tile_columns; + } + return tile_idx; +} + +typedef struct SliceMap { + uint16_t start_offset; + const VVCSPS *sps; + VVCPPS *pps; + uint16_t top_left_ctu_x[VVC_MAX_SLICES]; + uint16_t top_left_ctu_y[VVC_MAX_SLICES]; +} SliceMap; + +static void slice_map_init(SliceMap *slice_map, const VVCSPS *sps, VVCPPS *pps) +{ + slice_map->start_offset = 0; + slice_map->pps = pps; + slice_map->sps = sps; +} + +static void slice_map_add_new_slice(SliceMap *slice_map, const int slice_idx, const int ctu_x, const int ctu_y, const int height, const int ctb_count) +{ + VVCPPS *pps = slice_map->pps; + pps->slice_start_offset[slice_idx] = slice_map->start_offset; + + slice_map->top_left_ctu_x[slice_idx] = ctu_x; + slice_map->top_left_ctu_y[slice_idx] = ctu_y; + pps->num_ctus_in_slice[slice_idx] = ctb_count; + slice_map->start_offset += ctb_count; +} + +static int slice_map_add_ctus(SliceMap *slice_map, const int slice_idx, const int ctu_x, const int ctu_y, const int width, const int height) +{ + VVCPPS *pps = slice_map->pps; + const int x_end = ctu_x + width; + const int y_end = ctu_y + height; + int ctb_count = 0; + + for (int y = ctu_y; y < y_end; y++) { + for (int x = ctu_x; x < x_end; x++) { + const uint16_t ctb_addr_in_rs = y * pps->ctb_width + x; //< CtbAddrInRs + const int offset = slice_map->start_offset + ctb_count; + pps->ctb_addr_in_slice[offset] = ctb_addr_in_rs; + ctb_count++; + } + } + slice_map_add_new_slice(slice_map, slice_idx, ctu_x, ctu_y, height, ctb_count); + return slice_map->sps->entropy_coding_sync_enabled_flag ? height - 1 : 0; +} + +static void slice_map_add_tiles(SliceMap *slice_map, const int slice_idx, + const int tile_x_start, const int tile_y_start, const int tile_width, const int tile_height) +{ + VVCPPS *pps = slice_map->pps; + const int tile_x_end = tile_x_start + tile_width; + const int tile_y_end = tile_y_start + tile_height; + int height = 0, ctb_count = 0; + + if (!tile_width || !tile_height) + return ; + + for (int tile_y = tile_y_start; tile_y < tile_y_end; tile_y++) { + for (int tile_x = tile_x_start; tile_x < tile_x_end; tile_x++) { + + const int ctu_x = pps->col_bd[tile_x]; + const int ctu_y = pps->row_bd[tile_y]; + const int x_end = ctu_x + pps->column_width[tile_x]; + const int y_end = ctu_y + pps->row_height[tile_y]; + + for (int y = ctu_y; y < y_end; y++) { + for (int x = ctu_x; x < x_end; x++) { + const uint16_t ctb_addr_in_rs = y * pps->ctb_width + x; //< CtbAddrInRs + const int offset = slice_map->start_offset + ctb_count; + pps->ctb_addr_in_slice[offset] = ctb_addr_in_rs; + ctb_count++; + } + } + } + height += pps->row_height[tile_y]; + } + + slice_map_add_new_slice(slice_map, slice_idx, pps->col_bd[tile_x_start], pps->row_bd[tile_y_start], height, ctb_count); +} + +static int pps_parse_slices_in_one_tile(VVCPPS *pps, SliceMap *slice_map, + const int tile_x, const int tile_y, GetBitContext *gb, void *log_ctx, int *slice_idx) +{ + int num_slices_in_tile, pps_num_exp_slices_in_tile, uniform_slice_height, remaining_height_in_ctbs_y; + int ctu_x = pps->col_bd[tile_x]; + int ctu_y = pps->row_bd[tile_y]; + int i = *slice_idx; + + remaining_height_in_ctbs_y = pps->row_height[tile_y]; + ue(pps_num_exp_slices_in_tile, pps->row_height[tile_y] - 1); + if (pps_num_exp_slices_in_tile == 0) { + num_slices_in_tile = 1; + slice_map_add_ctus(slice_map, i, ctu_x, ctu_y, pps->column_width[tile_x], pps->row_height[tile_y]); + } else { + int j, slice_height_in_ctus; + for (j = 0; j < pps_num_exp_slices_in_tile; j++) { + uep(slice_height_in_ctus, 1, 1, pps->row_height[tile_y]); + + slice_map_add_ctus(slice_map, i + j, ctu_x, ctu_y, pps->column_width[tile_x], slice_height_in_ctus); + + ctu_y += slice_height_in_ctus; + remaining_height_in_ctbs_y -= slice_height_in_ctus; + } + uniform_slice_height = (j == 0 ? pps->row_height[tile_y] : slice_height_in_ctus); + + while (remaining_height_in_ctbs_y > 0) { + slice_map_add_ctus(slice_map, i + j, ctu_x, ctu_y, + pps->column_width[tile_x], FFMIN(uniform_slice_height, remaining_height_in_ctbs_y)); + + ctu_y += uniform_slice_height; + remaining_height_in_ctbs_y -= uniform_slice_height; + j++; + } + num_slices_in_tile = j; + } + *slice_idx += num_slices_in_tile - 1; + return 0; +} + +static int sps_pos_in_subpic(const VVCSPS *sps, const int subpic_idx, const int pos_x, const int pos_y) +{ + return (pos_x >= sps->subpic_ctu_top_left_x[subpic_idx]) && + (pos_y >= sps->subpic_ctu_top_left_y[subpic_idx]) && + (pos_x < sps->subpic_ctu_top_left_x[subpic_idx] + sps->subpic_width[subpic_idx]) && + (pos_y < sps->subpic_ctu_top_left_y[subpic_idx] + sps->subpic_height[subpic_idx]); + +} + +static int pps_parse_rect_slice(VVCPPS *pps, const VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + int i; + SliceMap slice_map; + uint16_t num_slices_in_pic; ///< pps_num_slices_in_pic_minus1 + 1; + + slice_map_init(&slice_map, sps, pps); + if (!pps->single_slice_per_subpic_flag) { + int tile_idx = 0, pps_tile_idx_delta_present_flag = 0, tile_x, tile_y, ret, j; + uep(num_slices_in_pic, 1, 1, VVC_MAX_SLICES); + + if (num_slices_in_pic > 2) + pps_tile_idx_delta_present_flag = get_bits1(gb); + + for (i = 0; i < num_slices_in_pic; i++) { + pps_derive_tile_xy(pps, tile_idx, &tile_x, &tile_y); + if (i < num_slices_in_pic - 1) { + int slice_width_in_tiles, slice_height_in_tiles; + ret = pps_parse_slice_width_height_in_tiles(pps, i, tile_x, tile_y, pps_tile_idx_delta_present_flag, + gb, log_ctx, &slice_width_in_tiles, &slice_height_in_tiles); + if (ret < 0) + return ret; + + if (slice_width_in_tiles == 1 && slice_height_in_tiles == 1 && pps->row_height[tile_y] > 1) { + ret = pps_parse_slices_in_one_tile(pps, &slice_map, tile_x, tile_y, gb, log_ctx, &i); + if (ret < 0) + return ret; + } else { + slice_map_add_tiles(&slice_map, i, tile_x, tile_y, slice_width_in_tiles, slice_height_in_tiles); + } + if (i < num_slices_in_pic - 1) { + tile_idx = pps_parse_tile_idx(pps, i, tile_idx, slice_width_in_tiles, slice_height_in_tiles, pps_tile_idx_delta_present_flag, gb); + if (tile_idx < 0 || tile_idx >= pps->num_tiles_in_pic) + return AVERROR_INVALIDDATA; + } + } + else { + slice_map_add_tiles(&slice_map, num_slices_in_pic - 1, + tile_x, tile_y, pps->num_tile_columns - tile_x, pps->num_tile_rows - tile_y); + } + } + + //now, we got all slice information, let's resolve NumSlicesInSubpic + for (i = 0; i < sps->num_subpics; i++) { + pps->num_slices_in_subpic[i] = 0; + for (j = 0; j < num_slices_in_pic; j++) { + if (sps_pos_in_subpic(sps, i, slice_map.top_left_ctu_x[j], slice_map.top_left_ctu_y[j])) { + pps->num_slices_in_subpic[i]++; + } + } + } + } else { + num_slices_in_pic = sps->num_subpics; + for (i = 0; i < num_slices_in_pic; i++) { + int start_x = -1, start_y = -1, width_in_tiles, height_in_tiles; + pps->num_slices_in_subpic[i] = 1; + for (int tile_y = 0; tile_y < pps->num_tile_rows; tile_y++) { + for (int tile_x = 0; tile_x < pps->num_tile_columns; tile_x++) { + if (sps_pos_in_subpic(sps, i, pps->col_bd[tile_x], pps->row_bd[tile_y])) { + if (start_x == -1) { + start_x = tile_x; + start_y = tile_y; + } + width_in_tiles = tile_x - start_x + 1; + height_in_tiles = tile_y - start_y + 1; + } + } + } + if (start_x != -1) + slice_map_add_tiles(&slice_map, i, start_x, start_y, width_in_tiles, height_in_tiles); + } + } + if (pps->single_slice_per_subpic_flag || num_slices_in_pic > 1) + pps->loop_filter_across_slices_enabled_flag = get_bits1(gb); + return 0; +} + +static int pps_parse_slice(VVCPPS *pps, const VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + int ret; + + pps->loop_filter_across_slices_enabled_flag = 0; + if (pps->rect_slice_flag) { + ret = pps_parse_rect_slice(pps, sps, gb, log_ctx); + if (ret < 0) + return ret; + } else { + int ctu_idx = 0; + for (int tile_y = 0; tile_y < pps->num_tile_rows; tile_y++) { + for (int tile_x = 0; tile_x < pps->num_tile_columns; tile_x++) { + for (int ctu_y = pps->row_bd[tile_y]; ctu_y < pps->row_bd[tile_y] + pps->row_height[tile_y]; ctu_y++) { + for (int ctu_x = pps->col_bd[tile_x]; ctu_x < pps->col_bd[tile_x] + pps->column_width[tile_x]; ctu_x++) { + const int ctu_addr_rs = ctu_y * pps->ctb_width + ctu_x; + pps->ctb_addr_in_slice[ctu_idx++] = ctu_addr_rs; + + } + } + } + } + pps->loop_filter_across_slices_enabled_flag = get_bits1(gb); + } + + return 0; +} + +static int pps_no_pic_partition(VVCPPS *pps, const VVCSPS *sps) +{ + SliceMap slice_map; + + pps->num_tile_columns = 1; + pps->num_tile_rows = 1; + pps->num_tiles_in_pic = 1; + + pps->column_width = av_malloc_array(pps->num_tile_columns, sizeof(*pps->column_width)); + pps->row_height = av_malloc_array(pps->num_tile_rows, sizeof(*pps->row_height)); + if (!pps->column_width || !pps->row_height) + return AVERROR(ENOMEM); + pps->column_width[0] = pps->ctb_width; + pps->row_height[0] = pps->ctb_height; + + pps->col_bd = pps_setup_bd(pps->column_width, pps->num_tile_columns); + pps->row_bd = pps_setup_bd(pps->row_height, pps->num_tile_rows); + if (!pps->col_bd || !pps->row_bd) + return AVERROR(ENOMEM); + + slice_map_init(&slice_map, sps, pps); + slice_map_add_ctus(&slice_map, 0, 0, 0, pps->ctb_width, pps->ctb_height); + + return 0; +} + +static int pps_parse_pic_partition(VVCPPS *pps, const VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + pps->ctb_addr_in_slice = av_calloc(pps->ctb_count, sizeof(*pps->ctb_addr_in_slice)); + if (!pps->ctb_addr_in_slice) + return AVERROR(ENOMEM); + + if (!pps->no_pic_partition_flag) { + int ret; + uint8_t pps_log2_ctu_size_minus5; + u(2, pps_log2_ctu_size_minus5, sps->ctb_log2_size_y - 5, sps->ctb_log2_size_y - 5); + + ret = pps_parse_num_tiles_in_pic(pps, gb, log_ctx); + if (ret < 0) + return ret; + + pps->rect_slice_flag = 1; + if (pps->num_tiles_in_pic > 1) { + pps->loop_filter_across_tiles_enabled_flag = get_bits1(gb); + pps->rect_slice_flag = get_bits1(gb); + } + + pps->single_slice_per_subpic_flag = pps->rect_slice_flag ? get_bits1(gb) : 0; + + return pps_parse_slice(pps, sps, gb, log_ctx); + } + + return pps_no_pic_partition(pps, sps); +} + +static int pps_parse_inter(VVCPPS *pps, const VVCSPS *sps, GetBitContext *gb, void *log_ctx) +{ + for (int i = 0; i < 2; i++) + uep(pps->num_ref_idx_default_active[i], 1, 1, 15); + + pps->rpl1_idx_present_flag = get_bits1(gb); + pps->weighted_pred_flag = get_bits1(gb); + pps->weighted_bipred_flag = get_bits1(gb); + pps->ref_wraparound_enabled_flag = get_bits1(gb); + + if (pps->ref_wraparound_enabled_flag) + pps->ref_wraparound_offset = (pps->width / sps->min_cb_size_y) - get_ue_golomb_long(gb); + return 0; +} + +static void pps_parse_ph_flags(VVCPPS *pps, GetBitContext *gb) +{ + if (!pps->no_pic_partition_flag) { + pps->rpl_info_in_ph_flag = get_bits1(gb); + pps->sao_info_in_ph_flag = get_bits1(gb); + pps->alf_info_in_ph_flag = get_bits1(gb); + if ((pps->weighted_pred_flag || pps->weighted_bipred_flag) && + pps->rpl_info_in_ph_flag) + pps->wp_info_in_ph_flag = get_bits1(gb); + pps->qp_delta_info_in_ph_flag = get_bits1(gb); + } +} + +int ff_vvc_decode_pps(VVCParamSets *ps, GetBitContext *gb, void *log_ctx) +{ + const VVCSPS *sps = NULL; + int ret = 0; + ptrdiff_t nal_size; + AVBufferRef *pps_buf; + + VVCPPS *pps = av_mallocz(sizeof(*pps)); + if (!pps) + return AVERROR(ENOMEM); + + pps_buf = av_buffer_create((uint8_t *)pps, sizeof(*pps), vvc_pps_free, NULL, 0); + if (!pps_buf) { + av_freep(&pps); + return AVERROR(ENOMEM); + } + + av_log(log_ctx, AV_LOG_DEBUG, "Decoding PPS\n"); + + nal_size = gb->buffer_end - gb->buffer; + if (nal_size > sizeof(pps->data)) { + av_log(log_ctx, AV_LOG_WARNING, "Truncating likely oversized PPS " + "(%"PTRDIFF_SPECIFIER" > %"SIZE_SPECIFIER")\n", + nal_size, sizeof(pps->data)); + pps->data_size = sizeof(pps->data); + } else { + pps->data_size = nal_size; + } + memcpy(pps->data, gb->buffer, pps->data_size); + + pps->pic_parameter_set_id = get_bits(gb, 6); + pps->seq_parameter_set_id = get_bits(gb, 4); + if (!ps->sps_list[pps->seq_parameter_set_id]) { + av_log(log_ctx, AV_LOG_ERROR, "SPS %u does not exist.\n", pps->seq_parameter_set_id); + ret = AVERROR_INVALIDDATA; + goto err; + } + sps = (VVCSPS *)ps->sps_list[pps->seq_parameter_set_id]->data; + + pps->mixed_nalu_types_in_pic_flag = get_bits1(gb); + + ret = pps_parse_width_height(pps, sps, gb, log_ctx); + if (ret < 0) + goto err; + + pps_parse_conf_win(pps, sps, gb); + + ret = pps_scaling_win_parse(pps, sps, gb, log_ctx); + if (ret < 0) + goto err; + + pps->output_flag_present_flag = get_bits1(gb); + + ret = pps_parse_subpic_id(pps, sps, gb, log_ctx); + if (ret < 0) + goto err; + + pps->ctb_width = vvc_ceil(pps->width, sps->ctb_size_y); + pps->ctb_height = vvc_ceil(pps->height, sps->ctb_size_y); + pps->ctb_count = pps->ctb_width * pps->ctb_height; + + ret = pps_parse_pic_partition(pps, sps, gb, log_ctx); + if (ret < 0) + goto err; + + pps->cabac_init_present_flag = get_bits1(gb); + + ret = pps_parse_inter(pps, sps, gb, log_ctx); + if (ret < 0) + goto err; + + sep(pps->init_qp, 26, -(sps->qp_bd_offset), 63); + pps->cu_qp_delta_enabled_flag = get_bits1(gb); + + ret = pps_parse_chroma_tool_offsets(pps, gb, log_ctx); + if (ret < 0) + goto err; + + ret = pps_parse_deblocking_control(pps, gb, log_ctx); + if (ret < 0) + goto err; + + pps_parse_ph_flags(pps, gb); + + pps->picture_header_extension_present_flag = get_bits1(gb); + pps->slice_header_extension_present_flag = get_bits1(gb); + + skip_bits1(gb); ///< pps_extension_flag + + pps->min_cb_width = pps->width / sps->min_cb_size_y; + pps->min_cb_height = pps->height / sps->min_cb_size_y; + pps->min_pu_width = pps->width >> MIN_PU_LOG2; + pps->min_pu_height = pps->height >> MIN_PU_LOG2; + pps->min_tu_width = pps->width >> MIN_TU_LOG2; + pps->min_tu_height = pps->height >> MIN_TU_LOG2; + pps->width32 = AV_CEIL_RSHIFT(pps->width, 5); + pps->height32 = AV_CEIL_RSHIFT(pps->height, 5); + pps->width64 = AV_CEIL_RSHIFT(pps->width, 6); + pps->height64 = AV_CEIL_RSHIFT(pps->height, 6); + + ret = pps_setup(pps, sps); + if (ret < 0) + goto err; + + if (get_bits_left(gb) < 0) { + av_log(log_ctx, AV_LOG_ERROR, + "Overread PPS by %d bits\n", -get_bits_left(gb)); + goto err; + } + remove_pps(ps, pps->pic_parameter_set_id); + ps->pps_list[pps->pic_parameter_set_id] = pps_buf; + + return 0; + +err: + av_buffer_unref(&pps_buf); + return ret; +} + +static int ph_parse_pic_parameter_set_id(VVCPH *ph, VVCParamSets *ps, GetBitContext* gb, void *log_ctx) +{ + AVBufferRef *buf; + + ue(ph->pic_parameter_set_id, VVC_MAX_PPS_COUNT - 1); + buf = ps->pps_list[ph->pic_parameter_set_id]; + if (!buf) { + av_log(log_ctx, AV_LOG_ERROR, "PPS id %d not available.\n", + ph->pic_parameter_set_id); + return AVERROR_INVALIDDATA; + } + ps->pps = (VVCPPS *)buf->data; + + buf = ps->sps_list[ps->pps->seq_parameter_set_id]; + if (!buf) { + av_log(log_ctx, AV_LOG_ERROR, "SPS id %d not available.\n", + ps->pps->seq_parameter_set_id); + return AVERROR_INVALIDDATA; + } + ps->sps = (VVCSPS*)buf->data; + + buf = ps->vps_list[ps->sps->video_parameter_set_id]; + if (!buf) { + av_log(log_ctx, AV_LOG_ERROR, "VPS id %d not available.\n", + ps->sps->video_parameter_set_id); + return AVERROR_INVALIDDATA; + } + return 0; +} + +static int rpls_list_parse(VVCRefPicListStruct *ref_lists, const VVCParamSets *ps, + const int poc, GetBitContext *gb, void *log_ctx) +{ + const VVCSPS *sps = ps->sps; + const VVCPPS *pps = ps->pps; + int i, j, rpl_sps_flag[2], rpl_idx[2]; + for (i = 0; i < 2; i++) { + VVCRefPicListStruct *rpls = ref_lists + i; + int prev_delta_poc_msb = 0; + + rpl_sps_flag[i] = 0; + if (sps->num_ref_pic_lists[i] > 0) { + if (i == 0 || pps->rpl1_idx_present_flag) + rpl_sps_flag[i] = get_bits1(gb); + else + rpl_sps_flag[i] = rpl_sps_flag[0]; + } + if (rpl_sps_flag[i]) { + if (sps->num_ref_pic_lists[i] == 1) { + rpl_idx[i] = 0; + } else if (i == 0 || pps->rpl1_idx_present_flag) { + uint8_t bits = av_ceil_log2(sps->num_ref_pic_lists[i]); + u(bits, rpl_idx[i], 0, sps->num_ref_pic_lists[i] - 1); + } else { + rpl_idx[1] = rpl_idx[0]; + } + memcpy(rpls, &sps->ref_pic_list_struct[i][rpl_idx[i]], sizeof(*rpls)); + } else { + rpls_parse(rpls, gb, i, sps->num_ref_pic_lists[i], sps, log_ctx); + } + + for (j = 0; j < rpls->num_ref_entries; j++) { + VVCRefPicListStructEntry *ref = &rpls->entries[j]; + + if (!ref->st_ref_pic_flag) { + if (rpls->ltrp_in_header_flag) + ref->lt_poc = get_bits(gb, sps->log2_max_pic_order_cnt_lsb); + + ref->lt_msb_flag = get_bits1(gb); + if (ref->lt_msb_flag) { + uint32_t max = 1 << (32 - sps->log2_max_pic_order_cnt_lsb); + uint32_t delta_poc_msb_cycle_lt; + + ue(delta_poc_msb_cycle_lt, max); + delta_poc_msb_cycle_lt += prev_delta_poc_msb; + ref->lt_poc = + poc - delta_poc_msb_cycle_lt * sps->max_pic_order_cnt_lsb - + (poc & (sps->max_pic_order_cnt_lsb - 1)) + ref->lt_poc; + + prev_delta_poc_msb = delta_poc_msb_cycle_lt; + } + } + } + } + + return 0; + +} + +static int alf_parse(Alf *alf, const VVCParamSets* ps, GetBitContext *gb, void *log_ctx) +{ + const VVCSPS *sps = ps->sps; + alf->cc_enabled_flag[0] = alf->cc_enabled_flag[1] = 0; + alf->enabled_flag[CB] = alf->enabled_flag[CR] = 0; + + alf->enabled_flag[LUMA] = get_bits1(gb); + if (alf->enabled_flag[LUMA]) { + + alf->num_aps_ids_luma = get_bits(gb, 3); + for (int i = 0; i < alf->num_aps_ids_luma; i++) { + alf->aps_id_luma[i] = get_bits(gb, 3); + if (!ps->alf_list[alf->aps_id_luma[i]]) { + av_log(log_ctx, AV_LOG_ERROR, "aps_id_luma %d not available.\n", + alf->aps_id_luma[i]); + return AVERROR_INVALIDDATA; + } + } + if (sps->chroma_format_idc != 0) { + for (int i = CB; i <= CR; i++) + alf->enabled_flag[i] = get_bits1(gb); + } + + if (alf->enabled_flag[CB] || alf->enabled_flag[CR]) { + alf->aps_id_chroma = get_bits(gb, 3); + if (!ps->alf_list[alf->aps_id_chroma]) { + av_log(log_ctx, AV_LOG_ERROR, "aps_id_chroma %d not available.\n", + alf->aps_id_chroma); + return AVERROR_INVALIDDATA; + } + } + + if (sps->ccalf_enabled_flag) { + for (int i = 0; i < 2; i++) { + alf->cc_enabled_flag[i] = get_bits1(gb); + if (alf->cc_enabled_flag[i]) { + alf->cc_aps_id[i] = get_bits(gb, 3); + if (!ps->alf_list[alf->cc_aps_id[i]]) { + av_log(log_ctx, AV_LOG_ERROR, "cc_aps_id[%d] %d not available.\n", + i, alf->cc_aps_id[i]); + return AVERROR_INVALIDDATA; + } + } + } + } + } + return 0; +} + +// 8.3.1 Decoding process for picture order count +static int ph_compute_poc(VVCPH *ph, const VVCSPS *sps, const int poc_tid0, const int is_clvss) +{ + const int max_poc_lsb = sps->max_pic_order_cnt_lsb; + const int prev_poc_lsb = poc_tid0 % max_poc_lsb; + const int prev_poc_msb = poc_tid0 - prev_poc_lsb; + const int poc_lsb = ph->pic_order_cnt_lsb; + int poc_msb; + + if (ph->poc_msb_cycle_present_flag) { + poc_msb = ph->poc_msb_cycle_val * max_poc_lsb; + } else if (is_clvss) { + poc_msb = 0; + } else { + if (poc_lsb < prev_poc_lsb && prev_poc_lsb - poc_lsb >= max_poc_lsb / 2) + poc_msb = prev_poc_msb + max_poc_lsb; + else if (poc_lsb > prev_poc_lsb && poc_lsb - prev_poc_lsb > max_poc_lsb / 2) + poc_msb = prev_poc_msb - max_poc_lsb; + else + poc_msb = prev_poc_msb; + } + + return poc_msb + poc_lsb; +} + +static int ph_parse_poc(VVCPH *ph, const VVCSPS *sps, const int poc_tid0, const int is_clvss, GetBitContext *gb, void *log_ctx) +{ + ph->pic_order_cnt_lsb = get_bits(gb, sps->log2_max_pic_order_cnt_lsb); + if (ph->gdr_pic_flag) + ue(ph->recovery_poc_cnt, 1 << sps->log2_max_pic_order_cnt_lsb); + + for (int i = 0; i < sps->num_extra_ph_bytes * 8; i++) { + if (sps->extra_ph_bit_present_flag[i]) + skip_bits1(gb); + } + if (sps->poc_msb_cycle_flag) { + ph->poc_msb_cycle_present_flag = get_bits1(gb); + if (ph->poc_msb_cycle_present_flag) + ph->poc_msb_cycle_val = get_bits(gb, sps->poc_msb_cycle_len); + } + ph->poc = ph_compute_poc(ph, sps, poc_tid0, is_clvss); + + return 0; +} + +static int ph_parse_alf(VVCPH *ph, const VVCParamSets *ps, GetBitContext *gb, void *log_ctx) +{ + + if (ps->sps->alf_enabled_flag && ps->pps->alf_info_in_ph_flag) + return alf_parse(&ph->alf, ps, gb, log_ctx); + ph->alf.enabled_flag[LUMA] = 0; + return 0; +} + +static av_always_inline int lmcs_derive_lut_sample(int sample, + int *pivot1, int *pivot2, int *scale_coeff, const int idx, const int max) +{ + const int lut_sample = + pivot1[idx] + ((scale_coeff[idx] * (sample - pivot2[idx]) + (1<< 10)) >> 11); + return av_clip(lut_sample, 0, max - 1); +} + +//8.8.2.2 Inverse mapping process for a luma sample +static int ph_lmcs_derive_lut(VVCPH *ph, const VVCParamSets *ps) +{ + const VVCSPS *sps = ps->sps; + const AVBufferRef *lmcs_buf; + const VVCLMCS *lmcs; + const int max = (1 << sps->bit_depth); + const int org_cw = max / LMCS_MAX_BIN_SIZE; + const int shift = av_log2(org_cw); + const int off = 1 << (shift - 1); + int cw[LMCS_MAX_BIN_SIZE]; + int input_pivot[LMCS_MAX_BIN_SIZE]; + int scale_coeff[LMCS_MAX_BIN_SIZE]; + int inv_scale_coeff[LMCS_MAX_BIN_SIZE]; + int i; + if (sps->bit_depth > LMCS_MAX_BIT_DEPTH) + return AVERROR_PATCHWELCOME; + + lmcs_buf = ps->lmcs_list[ph->lmcs_aps_id]; + if (!lmcs_buf) + return AVERROR_INVALIDDATA; + lmcs = (VVCLMCS*)lmcs_buf->data; + + memset(cw, 0, sizeof(cw)); + for (int i = lmcs->min_bin_idx; i <= lmcs->max_bin_idx; i++) + cw[i] = org_cw + lmcs->delta_cw[i]; + + ph->lmcs_pivot[0] = 0; + for (i = 0; i < LMCS_MAX_BIN_SIZE; i++) { + input_pivot[i] = i * org_cw; + ph->lmcs_pivot[i + 1] = ph->lmcs_pivot[i] + cw[i]; + scale_coeff[i] = (cw[i] * (1 << 11) + off) >> shift; + if (cw[i] == 0) { + inv_scale_coeff[i] = 0; + ph->lmcs_chroma_scale_coeff[i] = (1 << 11); + } else { + inv_scale_coeff[i] = org_cw * (1 << 11) / cw[i]; + ph->lmcs_chroma_scale_coeff[i] = org_cw * (1 << 11) / (cw[i] + lmcs->delta_crs); + } + } + + //derive lmcs_fwd_lut + for (int sample = 0; sample < max; sample++) { + const int idx_y = sample / org_cw; + const int fwd_sample = lmcs_derive_lut_sample(sample, ph->lmcs_pivot, + input_pivot, scale_coeff, idx_y, max); + if (sps->bit_depth > 8) + ((uint16_t *)ph->lmcs_fwd_lut)[sample] = fwd_sample; + else + ph->lmcs_fwd_lut[sample] = fwd_sample; + + } + + //derive lmcs_inv_lut + i = lmcs->min_bin_idx; + for (int sample = 0; sample < max; sample++) { + int inv_sample; + while (sample >= ph->lmcs_pivot[i + 1] && i <= lmcs->max_bin_idx) + i++; + + inv_sample = lmcs_derive_lut_sample(sample, input_pivot, ph->lmcs_pivot, + inv_scale_coeff, i, max); + + if (sps->bit_depth > 8) + ((uint16_t *)ph->lmcs_inv_lut)[sample] = inv_sample; + else + ph->lmcs_inv_lut[sample] = inv_sample; + } + + ph->lmcs_min_bin_idx = lmcs->min_bin_idx; + ph->lmcs_max_bin_idx = lmcs->max_bin_idx; + + return 0; +} + +static int ph_parse_lmcs(VVCPH *ph, const VVCParamSets *ps, GetBitContext *gb) +{ + const VVCSPS *sps = ps->sps; + int ret; + + ph->lmcs_enabled_flag = 0; + ph->chroma_residual_scale_flag = 0; + if (sps->lmcs_enabled_flag) { + ph->lmcs_enabled_flag = get_bits1(gb); + if (ph->lmcs_enabled_flag) { + ph->lmcs_aps_id = get_bits(gb, 2); + if (sps->chroma_format_idc) + ph->chroma_residual_scale_flag = get_bits1(gb); + ret = ph_lmcs_derive_lut(ph, ps); + if (ret < 0) + return ret; + } + } + return 0; +} + +static void ph_parse_scaling_list(VVCPH *ph, const VVCSPS *sps, GetBitContext *gb) +{ + ph->explicit_scaling_list_enabled_flag = 0; + if (sps->explicit_scaling_list_enabled_flag) { + ph->explicit_scaling_list_enabled_flag = get_bits1(gb); + if (ph->explicit_scaling_list_enabled_flag) { + //todo: check the ph->scaling_list_aps_id range, when aps ready + ph->scaling_list_aps_id = get_bits(gb, 3); + } + } +} + +static int ph_parse_virtual_boundaries(VVCPH *ph, const VVCSPS *sps, + const VVCPPS *pps, GetBitContext *gb, void *log_ctx) +{ + ph->vbs.virtual_boundaries_present_flag = 0; + if (sps->virtual_boundaries_enabled_flag && !sps->vbs.virtual_boundaries_present_flag) { + const int ret = virtual_boundaries_parse(&ph->vbs, pps->width, pps->height, gb, log_ctx); + if (ret < 0) + return ret; + } + return 0; +} + +static int ph_parse_temporal_mvp(VVCPH *ph, const VVCSPS *sps, const VVCPPS *pps, GetBitContext *gb, void *log_ctx) +{ + ph->temporal_mvp_enabled_flag = 0; + if (sps->temporal_mvp_enabled_flag) { + ph->temporal_mvp_enabled_flag = get_bits1(gb); + if (ph->temporal_mvp_enabled_flag && pps->rpl_info_in_ph_flag) { + int num_ref_entries; + ph->collocated_list = L0; + if (ph->rpls[1].num_ref_entries > 0) + ph->collocated_list = !get_bits1(gb); + num_ref_entries = ph->rpls[ph->collocated_list].num_ref_entries; + if (num_ref_entries > 1) { + ue(ph->collocated_ref_idx, num_ref_entries - 1); + } + } + } + return 0; +} + +static void ph_parse_sao(VVCPH *ph, const VVCSPS *sps, const VVCPPS *pps, GetBitContext *gb) +{ + ph->sao_luma_enabled_flag = 0; + ph->sao_chroma_enabled_flag = 0; + if (sps->sao_enabled_flag && pps->sao_info_in_ph_flag) { + ph->sao_luma_enabled_flag = get_bits1(gb); + if (sps->chroma_format_idc != 0) + ph->sao_chroma_enabled_flag = get_bits1(gb); + } +} + +static int ph_parse_dbf(VVCPH *ph, const VVCPPS *pps, GetBitContext *gb, void *log_ctx) +{ + ph->deblocking_filter_disabled_flag = pps->deblocking_filter_disabled_flag; + if (pps->dbf_info_in_ph_flag) { + int ph_deblocking_params_present_flag = get_bits1(gb); + if (ph_deblocking_params_present_flag) { + ph->deblocking_filter_disabled_flag = 0; + if (!pps->deblocking_filter_disabled_flag) + ph->deblocking_filter_disabled_flag = get_bits1(gb); + if (!ph->deblocking_filter_disabled_flag) + return deblock_parse(&ph->deblock, pps, gb, log_ctx); + } + } + memcpy(&ph->deblock, &pps->deblock, sizeof(ph->deblock)); + return 0; +} + +static int ph_parse_cu_qp(VVCPH *ph, const int inter, const VVCSPS *sps, const VVCPPS *pps, GetBitContext *gb, void *log_ctx) +{ + const PartitionConstraints *pc = inter ? &ph->inter_slice : &ph->intra_slice_luma; + const int ctb_log2_size_y = sps->ctb_log2_size_y; + const int min_qt_log2_size_y = pc->log2_diff_min_qt_min_cb + sps->min_cb_log2_size_y; + + ph->cu_qp_delta_subdiv[inter] = 0; + if (pps->cu_qp_delta_enabled_flag) + ue(ph->cu_qp_delta_subdiv[inter], + 2 * (ctb_log2_size_y - min_qt_log2_size_y + + pc->max_mtt_hierarchy_depth)); + + ph->cu_chroma_qp_offset_subdiv[inter] = 0; + if (pps->cu_chroma_qp_offset_list_enabled_flag) + ue(ph->cu_chroma_qp_offset_subdiv[inter], + 2 * (ctb_log2_size_y - min_qt_log2_size_y + + pc->max_mtt_hierarchy_depth)); + + return 0; +} + +static int ph_parse_intra(VVCPH *ph, const VVCSPS *sps, const VVCPPS *pps, GetBitContext *gb, void *log_ctx) +{ + int ret; + + if (ph->intra_slice_allowed_flag) { + ph->intra_slice_luma = sps->intra_slice_luma; + ph->intra_slice_chroma = sps->intra_slice_chroma; + if (ph->partition_constraints_override_flag) { + ret = partition_constraints_parse(&ph->intra_slice_luma, sps, gb, log_ctx); + if (ret < 0) + return ret; + + if (sps->qtbtt_dual_tree_intra_flag) { + ret = partition_constraints_parse(&ph->intra_slice_chroma, sps, gb, log_ctx); + if (ret < 0) + return ret; + } + } + ret = ph_parse_cu_qp(ph, 0, sps, pps, gb, log_ctx); + if (ret < 0) + return ret; + } + + return 0; +} + +static int hls_pred_weight_table(PredWeightTable *w, const uint8_t *num_ref_idx_active, + const VVCRefPicListStruct *rpls, const VVCSPS *sps, const VVCPPS *pps, GetBitContext *gb, + void *log_ctx) +{ + const int has_chroma = (sps->chroma_format_idc > 0); + + ue(w->log2_denom[LUMA], 7); + + w->log2_denom[CHROMA] = 0; + if (has_chroma) + sep(w->log2_denom[CHROMA], w->log2_denom[LUMA], 0, 7); + + for (int lx = L0; lx <= L1; lx++) { + w->nb_weights[lx] = num_ref_idx_active[lx]; + if (pps->wp_info_in_ph_flag) { + w->nb_weights[lx] = 0; + if (lx == L0 || (pps->weighted_bipred_flag && rpls[L1].num_ref_entries)) + ue(w->nb_weights[lx], FFMIN(15, rpls[lx].num_ref_entries)); + } + + for (int is_chroma = 0; is_chroma <= has_chroma; is_chroma++) { + for (int i = 0; i < w->nb_weights[lx]; i++) + w->weight_flag[lx][is_chroma][i] = get_bits1(gb); + } + + for (int i = 0; i < w->nb_weights[lx]; i++) { + const int c_end = has_chroma ? VVC_MAX_SAMPLE_ARRAYS : 1; + for (int c_idx = 0; c_idx < c_end; c_idx++) { + const int is_chroma = !!c_idx; + const int denom = 1 << w->log2_denom[is_chroma]; + + w->weight[lx][c_idx][i] = denom; + w->offset[lx][c_idx][i] = 0; + if (w->weight_flag[lx][is_chroma][i]) { + sep(w->weight[lx][c_idx][i], denom, -128 + denom, 127 + denom); + if (!c_idx) { + se(w->offset[lx][c_idx][i], -128, 127); + } else { + int offset; + se(offset, -4 * 128, 4 * 127); + offset += 128 - ((128 * w->weight[lx][c_idx][i]) >> w->log2_denom[CHROMA]); + w->offset[lx][c_idx][i] = av_clip_intp2(offset, 7); + } + } + } + } + } + return 0; +} + +static int ph_parse_inter(VVCPH *ph, const VVCSPS *sps, const VVCPPS *pps, GetBitContext *gb, void *log_ctx) +{ + int ret; + + if (ph->inter_slice_allowed_flag) { + ph->inter_slice = sps->inter_slice; + if (ph->partition_constraints_override_flag) { + ret = partition_constraints_parse(&ph->inter_slice, sps, gb, log_ctx); + if (ret < 0) + return ret; + } + + ret = ph_parse_cu_qp(ph, 1, sps, pps, gb, log_ctx); + if (ret < 0) + return ret; + + ret = ph_parse_temporal_mvp(ph, sps, pps, gb, log_ctx); + if (ret < 0) + return ret; + + if (sps->affine_enabled_flag) + ph->max_num_subblock_merge_cand = 5 - sps->five_minus_max_num_subblock_merge_cand; + else + ph->max_num_subblock_merge_cand = sps->sbtmvp_enabled_flag && ph->temporal_mvp_enabled_flag; + + ph->mmvd_fullpel_only_flag = 0; + if (sps->mmvd_fullpel_only_enabled_flag) + ph->mmvd_fullpel_only_flag = get_bits1(gb); + + ph->mvd_l1_zero_flag = 1; + ph->bdof_disabled_flag = 1; + ph->dmvr_disabled_flag = 1; + if (!pps->rpl_info_in_ph_flag || ph->rpls[1].num_ref_entries > 0) { + ph->mvd_l1_zero_flag = get_bits1(gb); + + ph->bdof_disabled_flag = 1 - sps->bdof_enabled_flag; + if (sps->bdof_control_present_in_ph_flag) + ph->bdof_disabled_flag = get_bits1(gb); + + ph->dmvr_disabled_flag = 1 - sps->dmvr_enabled_flag; + if (sps->dmvr_control_present_in_ph_flag) + ph->dmvr_disabled_flag = get_bits1(gb); + } + + ph->prof_disabled_flag = 1; + if (sps->prof_control_present_in_ph_flag) + ph->prof_disabled_flag = get_bits1(gb); + + if ((pps->weighted_pred_flag || + pps->weighted_bipred_flag) && + pps->wp_info_in_ph_flag) { + // if pps->wp_info_in_ph->flag == 1 + // hls_pred_weight_table will not use num_ref_idx_active + uint8_t num_ref_idx_active[2] = {0, 0}; + ret = hls_pred_weight_table(&ph->pwt, num_ref_idx_active, + ph->rpls, sps, pps, gb, log_ctx); + if (ret < 0) + return ret; + } + } + return 0; +} + +static int ph_parse(VVCPH *ph, VVCParamSets *ps, const int poc_tid0, const int is_clvss, GetBitContext *gb, void *log_ctx) +{ + const VVCSPS *sps; + const VVCPPS *pps; + int ret, start_bit; + + start_bit = get_bits_count(gb); + ph->gdr_or_irap_pic_flag = get_bits1(gb); + ph->non_ref_pic_flag = get_bits1(gb); + + if (ph->gdr_or_irap_pic_flag) + ph->gdr_pic_flag = get_bits1(gb); + + ph->inter_slice_allowed_flag = get_bits1(gb); + ph->intra_slice_allowed_flag = !ph->inter_slice_allowed_flag || get_bits1(gb); + + ret = ph_parse_pic_parameter_set_id(ph, ps, gb, log_ctx); + if (ret < 0) + return ret; + sps = ps->sps; + pps = ps->pps; + + ret = ph_parse_poc(ph, sps, poc_tid0, is_clvss, gb, log_ctx); + if (ret < 0) + return ret; + + ret = ph_parse_alf(ph, ps, gb, log_ctx); + if (ret < 0) + return ret; + + ret = ph_parse_lmcs(ph, ps, gb); + if (ret < 0) + return ret; + ph_parse_scaling_list(ph, sps, gb); + ph_parse_virtual_boundaries(ph, sps, pps, gb, log_ctx); + + ph->pic_output_flag = 1; + if (pps->output_flag_present_flag && !ph->non_ref_pic_flag) + ph->pic_output_flag = get_bits1(gb); + + if (pps->rpl_info_in_ph_flag) + rpls_list_parse(ph->rpls, ps, ph->poc, gb, log_ctx); + + if (sps->partition_constraints_override_enabled_flag) + ph->partition_constraints_override_flag = get_bits1(gb); + + ret = ph_parse_intra(ph, sps, pps, gb, log_ctx); + if (ret < 0) + return ret; + + ret = ph_parse_inter(ph, sps, pps, gb, log_ctx); + if (ret < 0) + return ret; + + if (pps->qp_delta_info_in_ph_flag) + se(ph->qp_delta, -sps->qp_bd_offset - pps->init_qp, 63 - pps->init_qp); + + ph->joint_cbcr_sign_flag = 0; + if (sps->joint_cbcr_enabled_flag) + ph->joint_cbcr_sign_flag = get_bits1(gb); + + ph_parse_sao(ph, sps, pps, gb); + ph_parse_dbf(ph, pps, gb, log_ctx); + + if (get_bits_left(gb) < 0) { + av_log(log_ctx, AV_LOG_ERROR, + "Overread PH by %d bits\n", -get_bits_left(gb)); + return AVERROR_INVALIDDATA; + } + ph->size = get_bits_count(gb) - start_bit; + return 0; + +} + +int ff_vvc_decode_ph(VVCParamSets *ps, const int poc_tid0, const int is_clvss, GetBitContext *gb, void *log_ctx) +{ + const VVCSPS *sps = ps->sps; + const VVCPPS *pps = ps->pps; + VVCPH *ph; + AVBufferRef *ph_buf; + int ret; + + ph_buf = av_buffer_allocz(sizeof(*ps->ph)); + if (!ph_buf) + return AVERROR(ENOMEM); + + ph = (VVCPH *)ph_buf->data; + ret = ph_parse(ph, ps, poc_tid0, is_clvss, gb, log_ctx); + if (ret < 0) { + //sps and pps may changed + ps->sps = sps; + ps->pps = pps; + av_buffer_unref(&ph_buf); + return ret; + } + av_buffer_unref(&ps->ph_buf); + ps->ph_buf = ph_buf; + ps->ph = ph; + return 0; +} + +static int aps_alf_parse_luma(VVCALF *alf, GetBitContext *gb, void *log_ctx) +{ + int alf_luma_coeff_delta_idx[ALF_NUM_FILTERS_LUMA] = { 0 }; + int8_t luma_coeff [ALF_NUM_FILTERS_LUMA * ALF_NUM_COEFF_LUMA]; + uint8_t luma_clip_idx[ALF_NUM_FILTERS_LUMA * ALF_NUM_COEFF_LUMA]; + + const int alf_luma_clip_flag = get_bits1(gb); + const int alf_luma_num_filters_signalled = get_ue_golomb(gb) + 1; + + if (alf_luma_num_filters_signalled > ALF_NUM_FILTERS_LUMA) { + av_log(log_ctx, AV_LOG_WARNING, "alf_luma_num_filters_signalled(%d) should <= %d\n", + alf_luma_num_filters_signalled, ALF_NUM_FILTERS_LUMA); + return AVERROR_INVALIDDATA; + } + + //alf_luma_coeff_delta_idx[] + if (alf_luma_num_filters_signalled > 1) { + const int num_bits = av_ceil_log2(alf_luma_num_filters_signalled); + for (int i = 0; i < ALF_NUM_FILTERS_LUMA; i++) { + alf_luma_coeff_delta_idx[i] = get_bits(gb, num_bits); + if (alf_luma_coeff_delta_idx[i] >= ALF_NUM_FILTERS_LUMA) { + av_log(log_ctx, AV_LOG_WARNING, "alf_luma_coeff_delta_idx[%d](%d) should < %d\n", + i, alf_luma_coeff_delta_idx[i], ALF_NUM_FILTERS_LUMA); + return AVERROR_INVALIDDATA; + } + } + } + + //alf_luma_coeff_abs, alf_luma_coeff_sign + for (int i = 0; i < alf_luma_num_filters_signalled; i++) { + for (int j = 0; j < ALF_NUM_COEFF_LUMA; j++) { + + int alf_luma_coeff = get_ue_golomb(gb); + + if (alf_luma_coeff && get_bits1(gb)) + alf_luma_coeff = -alf_luma_coeff; + if (alf_luma_coeff < -128 || alf_luma_coeff > 127) { + av_log(log_ctx, AV_LOG_WARNING, "alf_luma_coeff[%d][%d](%d) should in range [-128, 127]\n", + i, j, alf_luma_coeff); + return AVERROR_INVALIDDATA; + } + luma_coeff[i * ALF_NUM_COEFF_LUMA + j] = alf_luma_coeff; + } + } + + if (alf_luma_clip_flag ) { + for (int i = 0; i < alf_luma_num_filters_signalled; i++) { + for (int j = 0; j < ALF_NUM_COEFF_LUMA; j++) + luma_clip_idx[i * ALF_NUM_COEFF_LUMA + j] = get_bits(gb, 2); + } + } else { + memset(luma_clip_idx, 0, sizeof(luma_clip_idx)); + } + + for (int i = 0; i < ALF_NUM_FILTERS_LUMA; i++) { + const int idx = alf_luma_coeff_delta_idx[i]; + memcpy(&alf->luma_coeff[i * ALF_NUM_COEFF_LUMA], &luma_coeff[idx * ALF_NUM_COEFF_LUMA], + sizeof(luma_coeff[0]) * ALF_NUM_COEFF_LUMA); + memcpy(&alf->luma_clip_idx[i * ALF_NUM_COEFF_LUMA], &luma_clip_idx[idx * ALF_NUM_COEFF_LUMA], + sizeof(luma_clip_idx[0]) * ALF_NUM_COEFF_LUMA); + } + return 0; +} + +static int aps_alf_parse_chroma(VVCALF *alf, GetBitContext *gb, void *log_ctx) +{ + const int alf_chroma_clip_flag = get_bits1(gb); + + alf->num_chroma_filters = get_ue_golomb_long(gb) + 1; + + if (alf->num_chroma_filters > ALF_NUM_FILTERS_CHROMA) { + av_log(log_ctx, AV_LOG_WARNING, "alf_num_chroma_filters_signalled(%d) should <= %d\n", + alf->num_chroma_filters, ALF_NUM_FILTERS_CHROMA); + return AVERROR_INVALIDDATA; + } + + //alf_chroma_coeff_abs, alf_chroma_coeff_sign + for (int i = 0; i < alf->num_chroma_filters; i++) { + for (int j = 0; j < ALF_NUM_COEFF_CHROMA; j++) { + int alf_chroma_coeff = get_ue_golomb(gb); + + if (alf_chroma_coeff && get_bits1(gb)) + alf_chroma_coeff = -alf_chroma_coeff; + if (alf_chroma_coeff < -128 || alf_chroma_coeff > 127) { + av_log(log_ctx, AV_LOG_WARNING, "alf_chroma_coeff[%d][%d](%d) should in range [-128, 127]\n", + i, j, alf_chroma_coeff); + return AVERROR_INVALIDDATA; + } + alf->chroma_coeff[i * ALF_NUM_COEFF_CHROMA + j] = alf_chroma_coeff; + } + if (alf_chroma_clip_flag) { + for (int j = 0; j < ALF_NUM_COEFF_CHROMA; j++) { + const int alf_chroma_clip_idx = get_bits(gb, 2); + alf->chroma_clip_idx[i * ALF_NUM_COEFF_CHROMA + j] = alf_chroma_clip_idx; + } + } + } + return 0; +} + +static int aps_alf_parse_cc(VVCALF *alf, const int idx, GetBitContext *gb, void *log_ctx) +{ + alf->cc_filters_signalled[idx] = get_ue_golomb(gb) + 1; + if (alf->cc_filters_signalled[idx] > ALF_NUM_FILTERS_CC) { + av_log(log_ctx, AV_LOG_WARNING, "cc_filters_signalled[%d](%d) should in range <= %d\n", + idx, alf->cc_filters_signalled[idx], ALF_NUM_FILTERS_CC); + return AVERROR_INVALIDDATA; + } + for (int i = 0; i < alf->cc_filters_signalled[idx]; i++) { + for (int j = 0; j < ALF_NUM_COEFF_CC; j++) { + int coeff = get_bits(gb, 3); + if (coeff) + coeff = (1 - 2 * get_bits1(gb)) * (1 << (coeff - 1)); + alf->cc_coeff[idx][i * ALF_NUM_COEFF_CC + j] = coeff; + } + } + return 0; +} + +static int aps_alf_parse(VVCALF *alf, GetBitContext *gb, void *log_ctx) +{ + const int aps_chroma_present_flag = get_bits1(gb); + const int alf_luma_filter_signal_flag = get_bits1(gb); + int alf_chroma_filter_signal_flag = 0; + int alf_cc_filter_signal_flag[2] = { 0 }; + int ret; + + if (aps_chroma_present_flag) { + alf_chroma_filter_signal_flag = get_bits1(gb); + alf_cc_filter_signal_flag[0] = get_bits1(gb); + alf_cc_filter_signal_flag[1] = get_bits1(gb); + } + if (alf_luma_filter_signal_flag) { + ret = aps_alf_parse_luma(alf, gb, log_ctx); + if (ret < 0) + return ret; + } + if (alf_chroma_filter_signal_flag) { + ret = aps_alf_parse_chroma(alf, gb, log_ctx); + if (ret < 0 ) + return ret; + } + for (int i = 0; i < 2; i++) { + if (alf_cc_filter_signal_flag[i]) { + ret = aps_alf_parse_cc(alf, i, gb, log_ctx); + if (ret < 0) + return ret; + } + } + return 0; +} + +static int aps_lmcs_parse(VVCLMCS *lmcs, GetBitContext *gb, void *log_ctx) +{ + const int aps_chroma_present_flag = get_bits1(gb); + int lmcs_delta_cw_prec; + + lmcs->min_bin_idx = get_ue_golomb(gb); + lmcs->max_bin_idx = LMCS_MAX_BIN_SIZE - 1 - get_ue_golomb(gb); + lmcs_delta_cw_prec = get_ue_golomb(gb) + 1; + if (lmcs->min_bin_idx >= LMCS_MAX_BIN_SIZE) { + av_log(log_ctx, AV_LOG_WARNING, "lmcs_min_bin_idx(%d) should < %d\n", + lmcs->min_bin_idx, LMCS_MAX_BIN_SIZE); + return AVERROR_INVALIDDATA; + } + if (lmcs->max_bin_idx >= LMCS_MAX_BIN_SIZE || lmcs->max_bin_idx < lmcs->min_bin_idx) { + av_log(log_ctx, AV_LOG_WARNING, "lmcs_max_bin_idx(%d) should in range [%d, %d]\n", + lmcs->max_bin_idx, lmcs->min_bin_idx, LMCS_MAX_BIN_SIZE - 1); + return AVERROR_INVALIDDATA; + } + if (lmcs_delta_cw_prec > LMCS_MAX_BIN_SIZE - 1) { + av_log(log_ctx, AV_LOG_WARNING, "lmcs_delta_cw_prec_minus1(%d) should in range [0, 14]\n", + lmcs_delta_cw_prec - 1); + return AVERROR_INVALIDDATA; + } + + memset(&lmcs->delta_cw, 0, sizeof(lmcs->delta_cw)); + for (int i = lmcs->min_bin_idx; i <= lmcs->max_bin_idx; i++) { + lmcs->delta_cw[i] = get_bits(gb, lmcs_delta_cw_prec); + if (lmcs->delta_cw[i] && get_bits1(gb)) + lmcs->delta_cw[i] = -lmcs->delta_cw[i]; + } + if (aps_chroma_present_flag) { + lmcs->delta_crs = get_bits(gb, 3); + if (lmcs->delta_crs && get_bits1(gb)) + lmcs->delta_crs = -lmcs->delta_crs; + } + return 0; +} + +static int is_luma_list(const int id) +{ + return id % VVC_MAX_SAMPLE_ARRAYS == SL_START_4x4 || id == SL_START_64x64 + 1; +} + +static int derive_matrix_size(const int id) +{ + return id < SL_START_4x4 ? 2 : (id < SL_START_8x8 ? 4 : 8); +} + +static int derive_max_delta(const int id) +{ + return (id < SL_START_4x4) ? id : ((id < SL_START_8x8) ? (id - 2) : (id - 8)); +} + +// 7.4.3.20 Scaling list data semantics +static int aps_scaling_parse(VVCScalingList *sl, GetBitContext *gb, AVCodecContext *log_ctx) +{ + + int coeff[SL_MAX_MATRIX_SIZE * SL_MAX_MATRIX_SIZE]; + const uint8_t *pred; + const int *scaling_list; + const int aps_chroma_present_flag = get_bits1(gb); + + for (int id = 0; id < SL_MAX_ID; id++) { + const int matrix_size = derive_matrix_size(id); + const int log2_size = log2(matrix_size); + const int list_size = matrix_size * matrix_size; + int scaling_list_copy_mode_flag = 1; + int scaling_list_pred_mode_flag = 0; + int scaling_list_pred_id_delta = 0; + int dc = 0; + + if (aps_chroma_present_flag || is_luma_list(id)) { + scaling_list_copy_mode_flag = get_bits1(gb); + if (!scaling_list_copy_mode_flag) + scaling_list_pred_mode_flag = get_bits1(gb); + if ((scaling_list_copy_mode_flag || scaling_list_pred_mode_flag) && + id != SL_START_2x2 && + id != SL_START_4x4 && + id != SL_START_8x8) { + const int max_delta = derive_max_delta(id); + ue(scaling_list_pred_id_delta, max_delta); + } + if (!scaling_list_copy_mode_flag) { + int next_coef = 0; + int scaling_list_delta_coef, scaling_list_dc_coef; + + if (id >= SL_START_16x16) { + se(scaling_list_dc_coef, -128, 127); + dc = next_coef = scaling_list_dc_coef; + } + + for (int i = 0; i < list_size; i++) { + const int x = ff_vvc_diag_scan_x[3][3][i]; + const int y = ff_vvc_diag_scan_y[3][3][i]; + + if (!(id >= SL_START_64x64 && x >= 4 && y >= 4)) { + se(scaling_list_delta_coef, -128, 127); + next_coef += scaling_list_delta_coef; + } + coeff[i] = next_coef; + } + } + } + + //dc + if (id >= SL_START_16x16) { + if (!scaling_list_copy_mode_flag && !scaling_list_pred_mode_flag) { + sl->scaling_matrix_dc_rec[id - SL_START_16x16] = 8; + } else if (!scaling_list_pred_id_delta) { + sl->scaling_matrix_dc_rec[id - SL_START_16x16] = 16; + } else { + const int ref_id = id - scaling_list_pred_id_delta; + if (ref_id >= SL_START_16x16) + dc += sl->scaling_matrix_dc_rec[ref_id - SL_START_16x16]; + else + dc += sl->scaling_matrix_rec[ref_id][0]; + sl->scaling_matrix_dc_rec[id - SL_START_16x16] = dc & 255; + } + } + + //ac + scaling_list = scaling_list_copy_mode_flag ? ff_vvc_scaling_list0 : coeff; + if (!scaling_list_copy_mode_flag && !scaling_list_pred_mode_flag) + pred = ff_vvc_scaling_pred_8; + else if (!scaling_list_pred_id_delta) + pred = ff_vvc_scaling_pred_16; + else + pred = sl->scaling_matrix_rec[id - scaling_list_pred_id_delta]; + for (int i = 0; i < list_size; i++) { + const int x = ff_vvc_diag_scan_x[log2_size][log2_size][i]; + const int y = ff_vvc_diag_scan_y[log2_size][log2_size][i]; + const int off = y * matrix_size + x; + sl->scaling_matrix_rec[id][off] = (pred[off] + scaling_list[i]) & 255; + } + } + + return 0; +} + +int ff_vvc_decode_aps(VVCParamSets *ps, GetBitContext *gb, void *log_ctx) +{ + int ret = 0; + const int aps_params_type = get_bits(gb, 3); + const int aps_adaptation_parameter_set_id = get_bits(gb, 5); + + const int max_id[] = { VVC_MAX_ALF_COUNT, VVC_MAX_LMCS_COUNT, VVC_MAX_SL_COUNT }; + const int size[] = { sizeof(VVCALF), sizeof(VVCLMCS), sizeof(VVCScalingList) }; + AVBufferRef **list[] = { ps->alf_list, ps->lmcs_list, ps->scaling_list }; + AVBufferRef *buf; + + if (aps_params_type >= FF_ARRAY_ELEMS(max_id)) { + av_log(log_ctx, AV_LOG_INFO, "Skipping APS type %d\n", aps_params_type); + return 0; + } + if (aps_adaptation_parameter_set_id >= max_id[aps_params_type]) { + av_log(log_ctx, AV_LOG_WARNING, "aps_adaptation_parameter_set_id(%d) should <= %d\n", + aps_adaptation_parameter_set_id, max_id[aps_params_type]); + return AVERROR_INVALIDDATA; + } + + buf = av_buffer_allocz(size[aps_params_type]); + if (!buf) + return AVERROR(ENOMEM); + + switch (aps_params_type) { + case APS_ALF: + ret = aps_alf_parse((VVCALF *)buf->data, gb, log_ctx); + break; + case APS_LMCS: + ret = aps_lmcs_parse((VVCLMCS *)buf->data, gb, log_ctx); + break; + case APS_SCALING: + ret = aps_scaling_parse((VVCScalingList *)buf->data, gb, log_ctx); + break; + default: + av_log(log_ctx, AV_LOG_INFO, "Skipping APS type %d\n", aps_params_type); + goto fail; + } + if (ret < 0) + goto fail; + + get_bits1(gb); // aps_extension_flag + + if (get_bits_left(gb) < 0) { + av_log(log_ctx, AV_LOG_ERROR, + "Overread aps type %d by %d bits\n", aps_params_type, -get_bits_left(gb)); + ret = AVERROR_INVALIDDATA; + goto fail; + } + + ret = av_buffer_replace(&list[aps_params_type][aps_adaptation_parameter_set_id], buf); + +fail: + av_buffer_unref(&buf); + return ret; +} + + +void ff_vvc_ps_uninit(VVCParamSets *ps) +{ + int i; + + for (i = 0; i < FF_ARRAY_ELEMS(ps->scaling_list); i++) + av_buffer_unref(&ps->scaling_list[i]); + for (i = 0; i < FF_ARRAY_ELEMS(ps->lmcs_list); i++) + av_buffer_unref(&ps->lmcs_list[i]); + for (i = 0; i < FF_ARRAY_ELEMS(ps->alf_list); i++) + av_buffer_unref(&ps->alf_list[i]); + for (i = 0; i < FF_ARRAY_ELEMS(ps->vps_list); i++) + av_buffer_unref(&ps->vps_list[i]); + for (i = 0; i < FF_ARRAY_ELEMS(ps->sps_list); i++) + av_buffer_unref(&ps->sps_list[i]); + for (i = 0; i < FF_ARRAY_ELEMS(ps->pps_list); i++) + av_buffer_unref(&ps->pps_list[i]); + av_buffer_unref(&ps->ph_buf); +} + +static int sh_parse_subpic_idx(VVCSH *sh, const VVCParamSets *ps, GetBitContext *gb) +{ + const VVCSPS *sps = ps->sps; + const VVCPPS *pps = ps->pps; + if (!sps->subpic_info_present_flag) + return 0; + + sh->subpic_id = get_bits(gb, sps->subpic_id_len ); + if (!sps->subpic_id_mapping_explicitly_signalled_flag) + return sh->subpic_id; + + for (int i = 0; i < sps->num_subpics; i++) { + if (pps->subpic_id[i] == sh->subpic_id) + return i; + } + return sps->num_subpics; +} + +static void sh_parse_extra_bits(const VVCSPS *sps, GetBitContext *gb) +{ + for (int i = 0; i < sps->num_extra_sh_bytes * 8; i++) { + if (sps->extra_sh_bit_present_flag[i]) + get_bits1(gb); + } +} + +static int sh_parse_slice_address(VVCSH *sh, VVCContext *s, const int curr_subpic_idx, GetBitContext *gb) +{ + void *log_ctx = s->avctx; + const VVCSPS *sps = s->ps.sps; + const VVCPPS *pps = s->ps.pps; + int num_slices_in_subpic = pps->num_slices_in_subpic[curr_subpic_idx]; + + sh->slice_address = 0; + if ((pps->rect_slice_flag && num_slices_in_subpic > 1) || + (!pps->rect_slice_flag && pps->num_tiles_in_pic > 1)) { + unsigned int bits, max; + if (!pps->rect_slice_flag) { + bits = av_ceil_log2(pps->num_tiles_in_pic); + max = pps->num_tiles_in_pic - 1; + } else { + bits = av_ceil_log2(num_slices_in_subpic); + max = num_slices_in_subpic - 1; + } + u(bits, sh->slice_address, 0, max); + } + + sh_parse_extra_bits(sps, gb); + + if (pps->rect_slice_flag) { + int pic_level_slice_idx = sh->slice_address; + for (int j = 0; j < curr_subpic_idx; j++) + pic_level_slice_idx += pps->num_slices_in_subpic[j]; + sh->ctb_addr_in_curr_slice = pps->ctb_addr_in_slice + pps->slice_start_offset[pic_level_slice_idx]; + sh->num_ctus_in_curr_slice = pps->num_ctus_in_slice[pic_level_slice_idx]; + } else { + int tile_x = sh->slice_address % pps->num_tile_columns; + int tile_y = sh->slice_address / pps->num_tile_columns; + const int slice_start_ctb = pps->row_bd[tile_y] * pps->ctb_width + pps->col_bd[tile_x] * pps->row_height[tile_y]; + sh->num_tiles_in_slice = 1; + if (pps->num_tiles_in_pic - sh->slice_address > 1) + uep(sh->num_tiles_in_slice, 1, 1, pps->num_tiles_in_pic - sh->slice_address); + sh->ctb_addr_in_curr_slice = pps->ctb_addr_in_slice + slice_start_ctb; + + sh->num_ctus_in_curr_slice = 0; + for (int tile_idx = sh->slice_address; tile_idx < sh->slice_address + sh->num_tiles_in_slice; tile_idx++) { + tile_x = tile_idx % pps->num_tile_columns; + tile_y = tile_idx / pps->num_tile_columns; + sh->num_ctus_in_curr_slice += pps->row_height[tile_y] * pps->column_width[tile_x]; + } + } + + return 0; +} + +static int sh_parse_nb_refs(const VVCSH *sh, uint8_t *nb_refs, const VVCPPS *pps, GetBitContext* gb, void *log_ctx) +{ + if ((!IS_I(sh)&& sh->rpls[0].num_ref_entries > 1) || + (IS_B(sh) && sh->rpls[1].num_ref_entries > 1)) { + int num_ref_idx_active_override_flag = get_bits1(gb); + for (int i = 0; i < (IS_B(sh) ? 2 : 1); i++) { + if (num_ref_idx_active_override_flag) { + nb_refs[i] = 1; + if (sh->rpls[i].num_ref_entries > 1) { + nb_refs[i] = get_ue_golomb_long(gb) + 1; + if (nb_refs[i] > 15) { + av_log(log_ctx, AV_LOG_ERROR, + "num_ref_idx_active_minus1(%d) should in range [0, 14]\n", + nb_refs[i] - 1); + return AVERROR_INVALIDDATA; + } + } + } else { + nb_refs[i] = + FFMIN(pps->num_ref_idx_default_active[i], sh->rpls[i].num_ref_entries); + } + } + } else { + nb_refs[0] = !IS_I(sh); + nb_refs[1] = IS_B(sh); + } + return 0; +} + +static int sh_parse_alf(VVCSH *sh, VVCContext *s, GetBitContext *gb) +{ + int ret; + const VVCParamSets *ps = &s->ps; + + sh->alf.enabled_flag[LUMA] = 0; + if (ps->sps->alf_enabled_flag) { + if (!ps->pps->alf_info_in_ph_flag) { + ret = alf_parse(&sh->alf, ps, gb, s->avctx); + if (ret < 0) + return ret; + } else { + sh->alf = ps->ph->alf; + } + } + return 0; +} + +static int sh_parse_inter(VVCSH *sh, VVCContext *s, GetBitContext *gb) +{ + int ret; + void *log_ctx = s->avctx; + const VVCParamSets *ps = &s->ps; + const VVCSPS *sps = ps->sps; + const VVCPPS *pps = ps->pps; + const VVCPH *ph = ps->ph; + + if (!pps->rpl_info_in_ph_flag && (!IS_IDR(s) || sps->idr_rpl_present_flag)) { + ret = rpls_list_parse(sh->rpls, ps, ph->poc, gb, log_ctx); + if (ret < 0) + return ret; + } else { + memcpy(&sh->rpls, &ph->rpls, sizeof(ph->rpls)); + } + + ret = sh_parse_nb_refs(sh, sh->nb_refs, pps, gb, log_ctx); + if (ret < 0) + return ret; + + sh->cabac_init_flag = 0; + if (!IS_I(sh)) { + if (pps->cabac_init_present_flag) + sh->cabac_init_flag = get_bits1(gb); + if (ph->temporal_mvp_enabled_flag && !pps->rpl_info_in_ph_flag) { + sh->collocated_list = L0; + if (IS_B(sh)) + sh->collocated_list = !get_bits1(gb); + if (sh->nb_refs[sh->collocated_list] > 1) { + ue(sh->collocated_ref_idx, sh->nb_refs[sh->collocated_list] - 1); + } + if (!pps->wp_info_in_ph_flag && + ((pps->weighted_pred_flag && IS_P(sh)) || + (pps->weighted_bipred_flag && IS_B(sh)))) { + ret = hls_pred_weight_table(&sh->pwt, sh->nb_refs, sh->rpls, + sps, pps, gb, log_ctx); + if (ret < 0) + return ret; + } + } + + } + return 0; +} + +static int sh_parse_slice_qp_y(VVCSH *sh, const VVCParamSets *ps, GetBitContext* gb, void *log_ctx) +{ + const VVCSPS *sps = ps->sps; + const VVCPPS *pps = ps->pps; + const VVCPH *ph = ps->ph; + if (!pps->qp_delta_info_in_ph_flag) { + int8_t sh_qp_delta; + se(sh_qp_delta, -6 * (sps->bit_depth - 8) - pps->init_qp, + 63 - pps->init_qp); + sh->slice_qp_y = pps->init_qp + sh_qp_delta; + } else { + sh->slice_qp_y = pps->init_qp + ph->qp_delta; + } + return 0; +} + +static int sh_parse_chroma_qp_offsets(VVCSH *sh, const VVCParamSets *ps, GetBitContext* gb, void *log_ctx) +{ + const VVCSPS *sps = ps->sps; + const VVCPPS *pps = ps->pps; + + memset(sh->chroma_qp_offset, 0, sizeof(sh->chroma_qp_offset)); + + if (pps->slice_chroma_qp_offsets_present_flag) { + int8_t off; + for (int i = CB - 1; i < CR + sps->joint_cbcr_enabled_flag; i++) { + se(sh->chroma_qp_offset[i], -12, 12); + off = pps->chroma_qp_offset[i] + sh->chroma_qp_offset[i]; + if (off < -12 || off > 12) { + av_log(log_ctx, AV_LOG_ERROR, + "chroma_qp_offset(%d) not in range [-12, 12].\n", off); + return AVERROR_INVALIDDATA; + } + } + } + + sh->cu_chroma_qp_offset_enabled_flag = 0; + if (pps->cu_chroma_qp_offset_list_enabled_flag) + sh->cu_chroma_qp_offset_enabled_flag = get_bits1(gb); + return 0; +} + +static void sh_parse_sao_used_flag(VVCSH *sh, const VVCParamSets *ps, GetBitContext *gb) +{ + const VVCSPS *sps = ps->sps; + const VVCPPS *pps = ps->pps; + const VVCPH *ph = ps->ph; + if (sps->sao_enabled_flag && !pps->sao_info_in_ph_flag) { + const int has_chroma = sps->chroma_format_idc != 0; + sh->sao_used_flag[0] = get_bits1(gb); + sh->sao_used_flag[1] = has_chroma ? get_bits1(gb) : 0; + } else { + sh->sao_used_flag[0] = ph->sao_luma_enabled_flag; + sh->sao_used_flag[1] = ph->sao_chroma_enabled_flag; + } + sh->sao_used_flag[2] = sh->sao_used_flag[1]; +} + +static int sh_parse_deblock(VVCSH *sh, const VVCPPS *pps, const VVCPH *ph, GetBitContext *gb, void *log_ctx) +{ + int sh_deblocking_params_present_flag = 0; + + if (pps->deblocking_filter_override_enabled_flag && !pps->dbf_info_in_ph_flag) + sh_deblocking_params_present_flag = get_bits1(gb); + + sh->deblocking_filter_disabled_flag = ph->deblocking_filter_disabled_flag; + if (sh_deblocking_params_present_flag) { + sh->deblocking_filter_disabled_flag = 0; + if (!pps->deblocking_filter_disabled_flag) + sh->deblocking_filter_disabled_flag = get_bits1(gb); + + if (!sh->deblocking_filter_disabled_flag) + return deblock_parse(&sh->deblock,pps, gb, log_ctx); + } + memcpy(&sh->deblock, &ph->deblock, sizeof(sh->deblock)); + + return 0; +} + +static void sh_parse_transform(VVCSH *sh, const VVCSPS *sps, GetBitContext *gb) +{ + sh->dep_quant_used_flag = 0; + if (sps->dep_quant_enabled_flag) + sh->dep_quant_used_flag = get_bits1(gb); + + sh->sign_data_hiding_used_flag = 0; + if (sps->sign_data_hiding_enabled_flag && !sh->dep_quant_used_flag) + sh->sign_data_hiding_used_flag = get_bits1(gb); + + sh->ts_residual_coding_disabled_flag = 0; + if (sps->transform_skip_enabled_flag && + !sh->dep_quant_used_flag && + !sh->sign_data_hiding_used_flag) + sh->ts_residual_coding_disabled_flag = get_bits1(gb); +} + +static int sh_parse_entry_points(VVCSH *sh, const int curr_subpic_idx, + const VVCParamSets *ps, GetBitContext *gb, void *log_ctx) +{ + const VVCSPS *sps = ps->sps; + const VVCPPS *pps = ps->pps; + + sh->num_entry_points = 0; + if (sps->entry_point_offsets_present_flag) { + for (int i = 1; i num_ctus_in_curr_slice; i++) { + const int pre_ctb_addr_x = sh->ctb_addr_in_curr_slice[i - 1] % pps->ctb_width; + const int pre_ctb_addr_y = sh->ctb_addr_in_curr_slice[i - 1] / pps->ctb_width; + const int ctb_addr_x = sh->ctb_addr_in_curr_slice[i] % pps->ctb_width; + const int ctb_addr_y = sh->ctb_addr_in_curr_slice[i] / pps->ctb_width; + if (pps->ctb_to_row_bd[ctb_addr_y] != pps->ctb_to_row_bd[pre_ctb_addr_y] || + pps->ctb_to_col_bd[ctb_addr_x] != pps->ctb_to_col_bd[pre_ctb_addr_x] || + (ctb_addr_y != pre_ctb_addr_y && sps->entropy_coding_sync_enabled_flag)) { + sh->entry_point_start_ctu[sh->num_entry_points] = i; + sh->num_entry_points++; + } + } + + if (sh->num_entry_points > VVC_MAX_ENTRY_POINTS) { + avpriv_request_sample(log_ctx, "Too many entry points: " + "%"PRIu16".\n", sh->num_entry_points); + return AVERROR_PATCHWELCOME; + } + } + + if (sh->num_entry_points > 0) { + int sh_entry_offset_len_minus1; + ue(sh_entry_offset_len_minus1, 31); + for (int i = 0; i < sh->num_entry_points; i++) + sh->entry_point_offset[i] = get_bits(gb, sh_entry_offset_len_minus1 + 1) + 1; + } + + return 0; +} + +static int sh_parse_param_set(VVCContext *s, const int sh_picture_header_in_slice_header_flag, + const int is_first_slice, GetBitContext *gb) +{ + VVCPH *ph = s->ps.ph; + int ret = 0; + + if (!(sh_picture_header_in_slice_header_flag && is_first_slice) && !ph) + return AVERROR_INVALIDDATA; + + if (sh_picture_header_in_slice_header_flag){ + if (is_first_slice) { + ret = ff_vvc_decode_ph(&s->ps, s->pocTid0, IS_CLVSS(s), gb, s->avctx); + if (ret < 0) + return ret; + } else { + skip_bits(gb, ph->size); + } + } + + return ret; +} + +int ff_vvc_decode_sh(VVCSH *sh, VVCContext *s, const int is_first_slice, GetBitContext *gb) +{ + void *log_ctx = s->avctx; + VVCParamSets *ps = &s->ps; + const int sh_picture_header_in_slice_header_flag = get_bits1(gb); + int ret, curr_subpic_idx; + + ret = sh_parse_param_set(s, sh_picture_header_in_slice_header_flag, is_first_slice, gb); + if (ret < 0) + return ret; + + curr_subpic_idx = sh_parse_subpic_idx(sh, ps, gb); + if (curr_subpic_idx >= ps->sps->num_subpics) { + av_log(log_ctx, AV_LOG_ERROR, + "sh->subpic_id(%d) should in range [0, %d]\n", + curr_subpic_idx, ps->sps->num_subpics - 1); + return AVERROR_INVALIDDATA; + } + + ret = sh_parse_slice_address(sh, s, curr_subpic_idx, gb); + if (ret < 0) + return ret; + + sh->slice_type = VVC_SLICE_TYPE_I; + if (ps->ph->inter_slice_allowed_flag) + ue(sh->slice_type, VVC_SLICE_TYPE_I); + + if (IS_CVSS(s)) + sh->no_output_of_prior_pics_flag = get_bits1(gb); + + ret = sh_parse_alf(sh, s, gb); + if (ret < 0) + return ret; + + if (ps->ph->lmcs_enabled_flag && !sh_picture_header_in_slice_header_flag) + sh->lmcs_used_flag = get_bits1(gb); + else + sh->lmcs_used_flag = sh_picture_header_in_slice_header_flag ? ps->ph->lmcs_enabled_flag : 0; + + sh->explicit_scaling_list_used_flag = 0; + if (ps->ph->explicit_scaling_list_enabled_flag) { + sh->explicit_scaling_list_used_flag = 1; + if (!sh_picture_header_in_slice_header_flag) + sh->explicit_scaling_list_used_flag = get_bits1(gb); + } + + ret = sh_parse_inter(sh, s, gb); + if (ret < 0) + return ret; + + ret = sh_parse_slice_qp_y(sh, ps, gb, log_ctx); + if (ret < 0) + return ret; + + ret = sh_parse_chroma_qp_offsets(sh, ps, gb, log_ctx); + if (ret < 0) + return ret; + + sh_parse_sao_used_flag(sh, ps, gb); + + ret = sh_parse_deblock(sh, ps->pps, ps->ph, gb, log_ctx); + if (ret < 0) + return ret; + + sh_parse_transform(sh, ps->sps, gb); + + if (ps->pps->slice_header_extension_present_flag) { + int sh_slice_header_extension_length; + ue(sh_slice_header_extension_length, 256); + skip_bits(gb, 8 * sh_slice_header_extension_length); + } + + ret = sh_parse_entry_points(sh, curr_subpic_idx, ps, gb, log_ctx); + if (ret < 0) + return ret; + + skip_bits(gb, 1); + align_get_bits(gb); + + if (get_bits_left(gb) < 0) { + av_log(log_ctx, AV_LOG_ERROR, + "Overread slice header by %d bits\n", -get_bits_left(gb)); + return AVERROR_INVALIDDATA; + } + + //get calculated values + { + const PartitionConstraints *constraints[2] = { &ps->ph->inter_slice, &ps->ph->inter_slice }; + if (IS_I(sh)) { + constraints[LUMA] = &ps->ph->intra_slice_luma; + constraints[CHROMA] = &ps->ph->intra_slice_chroma; + } + + sh->cu_qp_delta_subdiv = ps->ph->cu_qp_delta_subdiv[!IS_I(sh)]; + sh->cu_chroma_qp_offset_subdiv = ps->ph->cu_chroma_qp_offset_subdiv[!IS_I(sh)]; + + for (int i = LUMA; i <= CHROMA; i++) { + const PartitionConstraints *pc = constraints[i]; + const int min_qt_log2_size = ps->sps->min_cb_log2_size_y + pc->log2_diff_min_qt_min_cb; + + sh->max_bt_size[i] = 1 << (min_qt_log2_size + pc->log2_diff_max_bt_min_qt); + sh->max_tt_size[i] = 1 << (min_qt_log2_size + pc->log2_diff_max_tt_min_qt); + sh->max_mtt_depth[i] = pc->max_mtt_hierarchy_depth; + sh->min_qt_size[i] = 1 << min_qt_log2_size; + } + + } + return 0; +} diff --git a/libavcodec/vvc/vvc_ps.h b/libavcodec/vvc/vvc_ps.h new file mode 100644 index 0000000000..dc094bee41 --- /dev/null +++ b/libavcodec/vvc/vvc_ps.h @@ -0,0 +1,811 @@ +/* + * VVC parameter set parser + * + * Copyright (C) 2023 Nuo Mi + * + * 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_VVC_PS_H +#define AVCODEC_VVC_PS_H + +#include "libavcodec/vvc.h" + +#define IS_VCL(t) ((t) <= VVC_RSV_IRAP_11 && (t) >= VVC_TRAIL_NUT) + +#define IS_IDR(s) ((s)->vcl_unit_type == VVC_IDR_W_RADL || (s)->vcl_unit_type == VVC_IDR_N_LP) +#define IS_CRA(s) ((s)->vcl_unit_type == VVC_CRA_NUT) +#define IS_IRAP(s) (IS_IDR(s) || IS_CRA(s)) +#define IS_GDR(s) ((s)->vcl_unit_type == VVC_GDR_NUT) +#define IS_CVSS(s) (IS_IRAP(s)|| IS_GDR(s)) +#define IS_CLVSS(s) (IS_CVSS(s) && s->no_output_before_recovery_flag) +#define IS_RASL(s) ((s)->vcl_unit_type == VVC_RASL_NUT) +#define IS_RADL(s) ((s)->vcl_unit_type == VVC_RADL_NUT) + +#define IS_I(sh) ((sh)->slice_type == VVC_SLICE_TYPE_I) +#define IS_P(sh) ((sh)->slice_type == VVC_SLICE_TYPE_P) +#define IS_B(sh) ((sh)->slice_type == VVC_SLICE_TYPE_B) + +#define LMCS_MAX_BIT_DEPTH 12 +#define LMCS_MAX_LUT_SIZE (1 << LMCS_MAX_BIT_DEPTH) +#define LMCS_MAX_BIN_SIZE 16 +#define LADF_MAX_INTERVAL 5 + +enum { + CHROMA_FORMAT_MONO, + CHROMA_FORMAT_420, + CHROMA_FORMAT_422, + CHROMA_FORMAT_444, +}; + +typedef struct VUI { + uint16_t payload_size; + + uint8_t progressive_source_flag; + uint8_t interlaced_source_flag; + uint8_t non_packed_constraint_flag; + uint8_t non_projected_constraint_flag; + + uint8_t aspect_ratio_info_present_flag; + uint8_t aspect_ratio_constant_flag; + uint8_t aspect_ratio_idc; + + uint16_t sar_width; + uint16_t sar_height; + + uint8_t overscan_info_present_flag; + uint8_t overscan_appropriate_flag; + + uint8_t colour_description_present_flag; + uint8_t colour_primaries; + + uint8_t transfer_characteristics; + uint8_t matrix_coeffs; + uint8_t full_range_flag; + + uint8_t chroma_loc_info_present_flag; + uint8_t chroma_sample_loc_type_frame; + uint8_t chroma_sample_loc_type_top_field; + uint8_t chroma_sample_loc_type_bottom_field; +} VUI; + +typedef struct GeneralConstraintsInfo { + uint8_t present_flag; + /* general */ + uint8_t intra_only_constraint_flag; + uint8_t all_layers_independent_constraint_flag; + uint8_t one_au_only_constraint_flag; + + /* picture format */ + uint8_t sixteen_minus_max_bitdepth_constraint_idc; + uint8_t three_minus_max_chroma_format_constraint_idc; + + /* NAL unit type related */ + uint8_t no_mixed_nalu_types_in_pic_constraint_flag; + uint8_t no_trail_constraint_flag; + uint8_t no_stsa_constraint_flag; + uint8_t no_rasl_constraint_flag; + uint8_t no_radl_constraint_flag; + uint8_t no_idr_constraint_flag; + uint8_t no_cra_constraint_flag; + uint8_t no_gdr_constraint_flag; + uint8_t no_aps_constraint_flag; + uint8_t no_idr_rpl_constraint_flag; + + /* tile, slice, subpicture partitioning */ + uint8_t one_tile_per_pic_constraint_flag; + uint8_t pic_header_in_slice_header_constraint_flag; + uint8_t one_slice_per_pic_constraint_flag; + uint8_t no_rectangular_slice_constraint_flag; + uint8_t one_slice_per_subpic_constraint_flag; + uint8_t no_subpic_info_constraint_flag; + + /* CTU and block partitioning */ + uint8_t three_minus_max_log2_ctu_size_constraint_idc; + uint8_t no_partition_constraints_override_constraint_flag; + uint8_t no_mtt_constraint_flag; + uint8_t no_qtbtt_dual_tree_intra_constraint_flag; + + /* intra */ + uint8_t no_palette_constraint_flag; + uint8_t no_ibc_constraint_flag; + uint8_t no_isp_constraint_flag; + uint8_t no_mrl_constraint_flag; + uint8_t no_mip_constraint_flag; + uint8_t no_cclm_constraint_flag; + + /* inter */ + uint8_t no_ref_pic_resampling_constraint_flag; + uint8_t no_res_change_in_clvs_constraint_flag; + uint8_t no_weighted_prediction_constraint_flag; + uint8_t no_ref_wraparound_constraint_flag; + uint8_t no_temporal_mvp_constraint_flag; + uint8_t no_sbtmvp_constraint_flag; + uint8_t no_amvr_constraint_flag; + uint8_t no_bdof_constraint_flag; + uint8_t no_smvd_constraint_flag; + uint8_t no_dmvr_constraint_flag; + uint8_t no_mmvd_constraint_flag; + uint8_t no_affine_motion_constraint_flag; + uint8_t no_prof_constraint_flag; + uint8_t no_bcw_constraint_flag; + uint8_t no_ciip_constraint_flag; + uint8_t no_gpm_constraint_flag; + + /* transform, quantization, residual */ + uint8_t no_luma_transform_size_64_constraint_flag; + uint8_t no_transform_skip_constraint_flag; + uint8_t no_bdpcm_constraint_flag; + uint8_t no_mts_constraint_flag; + uint8_t no_lfnst_constraint_flag; + uint8_t no_joint_cbcr_constraint_flag; + uint8_t no_sbt_constraint_flag; + uint8_t no_act_constraint_flag; + uint8_t no_explicit_scaling_list_constraint_flag; + uint8_t no_dep_quant_constraint_flag; + uint8_t no_sign_data_hiding_constraint_flag; + uint8_t no_cu_qp_delta_constraint_flag; + uint8_t no_chroma_qp_offset_constraint_flag; + + /* loop filter */ + uint8_t no_sao_constraint_flag; + uint8_t no_alf_constraint_flag; + uint8_t no_ccalf_constraint_flag; + uint8_t no_lmcs_constraint_flag; + uint8_t no_ladf_constraint_flag; + uint8_t no_virtual_boundaries_constraint_flag; +} GeneralConstraintsInfo; + +typedef struct PTL { + uint8_t general_profile_idc; + uint8_t general_tier_flag; + uint8_t general_level_idc; + uint8_t frame_only_constraint_flag; + uint8_t multilayer_enabled_flag; + GeneralConstraintsInfo gci; + uint8_t sublayer_level_present_flag[VVC_MAX_SUBLAYERS - 1]; + uint8_t sublayer_level_idc[VVC_MAX_SUBLAYERS - 1]; + uint8_t num_sub_profiles; + uint32_t general_sub_profile_idc[VVC_MAX_SUB_PROFILES]; +} PTL; + +typedef struct DpbParameters { + uint8_t max_dec_pic_buffering[VVC_MAX_SUBLAYERS]; + uint8_t max_num_reorder_pics[VVC_MAX_SUBLAYERS]; + uint8_t max_latency_increase[VVC_MAX_SUBLAYERS]; +} DpbParameters; + +typedef struct VVCVPS { + uint8_t video_parameter_set_id; + uint8_t max_layers; + uint8_t max_sublayers_minus1; + uint8_t default_ptl_dpb_hrd_max_tid_flag; + uint8_t all_independent_layers_flag; + uint8_t layer_id[VVC_MAX_LAYERS]; + uint8_t independent_layer_flag[VVC_MAX_LAYERS]; + uint8_t max_tid_ref_present_flag[VVC_MAX_LAYERS]; + uint8_t direct_ref_layer_flag[VVC_MAX_LAYERS][VVC_MAX_LAYERS - 1]; + uint8_t max_tid_il_ref_pics_plus1[VVC_MAX_LAYERS][VVC_MAX_LAYERS - 1]; + uint8_t each_layer_is_an_ols_flag; + uint8_t ols_mode_idc; + uint8_t num_output_layer_sets_minus2; + uint8_t ols_output_layer_flag[VVC_MAX_TOTAL_NUM_OLSS][VVC_MAX_LAYERS]; + + uint8_t num_ptls_minus1; + uint8_t pt_present_flag[VVC_MAX_PTLS]; + uint8_t ptl_max_tid[VVC_MAX_PTLS]; + + uint8_t ols_ptl_idx[VVC_MAX_TOTAL_NUM_OLSS]; + + uint16_t num_dpb_params_minus1; + uint8_t sublayer_dpb_params_present_flag; + uint8_t dpb_max_tid[VVC_MAX_TOTAL_NUM_OLSS]; + uint16_t ols_dpb_pic_width[VVC_MAX_TOTAL_NUM_OLSS]; + uint16_t ols_dpb_pic_height[VVC_MAX_TOTAL_NUM_OLSS]; + uint8_t ols_dpb_chroma_format[VVC_MAX_TOTAL_NUM_OLSS]; + uint8_t ols_dpb_bitdepth_minus8[VVC_MAX_TOTAL_NUM_OLSS]; + uint16_t ols_dpb_params_idx[VVC_MAX_TOTAL_NUM_OLSS]; + + uint8_t timing_hrd_params_present_flag; + uint8_t sublayer_cpb_params_present_flag; + uint16_t num_ols_timing_hrd_params_minus1; + uint8_t hrd_max_tid[VVC_MAX_TOTAL_NUM_OLSS]; + uint8_t ols_timing_hrd_idx[VVC_MAX_TOTAL_NUM_OLSS]; + + uint8_t data[4096]; + int data_size; +} VVCVPS; + +typedef struct VVCWindow { + int left_offset; + int right_offset; + int top_offset; + int bottom_offset; +} VVCWindow; + +typedef struct VVCRefPicListStructEntry { + uint8_t inter_layer_ref_pic_flag; + uint8_t st_ref_pic_flag; + + //shortterm + int8_t delta_poc_val_st; ///< DeltaPocValSt + + //longterm + uint8_t lt_msb_flag; ///< delta_poc_msb_cycle_present_flag + int16_t lt_poc; + + //interlayer + uint8_t ilrp_idx; +} VVCRefPicListStructEntry; + +typedef struct VVCRefPicListStruct { + uint8_t num_ref_entries; + uint8_t num_ltrp_entries; ///< NumLtrpEntries + uint8_t ltrp_in_header_flag; + VVCRefPicListStructEntry entries[VVC_MAX_REF_ENTRIES]; +} VVCRefPicListStruct; + +/* + * we use PartitionConstraints for following fields in spec + uint8_t log2_diff_min_qt_min_cb_intra_slice_luma; + uint8_t max_mtt_hierarchy_depth_intra_slice_luma; + uint8_t log2_diff_max_bt_min_qt_intra_slice_luma; + uint8_t log2_diff_max_tt_min_qt_intra_slice_luma; + + uint8_t log2_diff_min_qt_min_cb_intra_slice_chroma; + uint8_t max_mtt_hierarchy_depth_intra_slice_chroma; + uint8_t log2_diff_max_bt_min_qt_intra_slice_chroma; + uint8_t log2_diff_max_tt_min_qt_intra_slice_chroma; + + uint8_t log2_diff_min_qt_min_cb_inter_slice; + uint8_t max_mtt_hierarchy_depth_inter_slice; + uint8_t log2_diff_max_bt_min_qt_inter_slice; + uint8_t log2_diff_max_tt_min_qt_inter_slice; + +*/ +typedef struct PartitionConstraints { + uint8_t log2_diff_min_qt_min_cb; + uint8_t max_mtt_hierarchy_depth; + uint8_t log2_diff_max_bt_min_qt; + uint8_t log2_diff_max_tt_min_qt; +} PartitionConstraints; + +typedef struct GeneralTimingHrdParameters { + uint8_t general_nal_hrd_params_present_flag; + uint8_t general_vcl_hrd_params_present_flag; + uint8_t general_du_hrd_params_present_flag; + int hrd_cpb_cnt; ///< hrd_cpb_cnt_minus1 + 1 +} GeneralTimingHrdParameters; + +typedef struct VirtualBoundaries { + uint8_t virtual_boundaries_present_flag; + uint8_t num_ver_virtual_boundaries; + uint16_t virtual_boundary_pos_x_minus1[3]; + uint8_t num_hor_virtual_boundaries; + uint16_t virtual_boundary_pos_y_minus1[3]; +} VirtualBoundaries; + +typedef struct VVCSPS { + unsigned video_parameter_set_id; + + VVCWindow output_window; + + VVCWindow conf_win; + + int pixel_shift; + + enum AVPixelFormat pix_fmt; + + uint8_t max_sublayers; + uint8_t chroma_format_idc; + + uint8_t ref_pic_resampling_enabled_flag; + uint8_t res_change_in_clvs_allowed_flag; + + uint16_t width; + uint16_t height; + + uint8_t subpic_info_present_flag; + uint16_t num_subpics; + uint8_t independent_subpics_flag; + uint16_t subpic_ctu_top_left_x[VVC_MAX_SLICES]; + uint16_t subpic_ctu_top_left_y[VVC_MAX_SLICES]; + uint16_t subpic_width[VVC_MAX_SLICES]; + uint16_t subpic_height[VVC_MAX_SLICES]; + uint8_t subpic_treated_as_pic_flag[VVC_MAX_SLICES]; + uint8_t loop_filter_across_subpic_enabled_flag[VVC_MAX_SLICES]; + uint8_t subpic_id_len; + uint8_t subpic_id_mapping_explicitly_signalled_flag; + uint8_t subpic_id_mapping_present_flag; + uint32_t subpic_id[VVC_MAX_SLICES]; + + uint8_t entropy_coding_sync_enabled_flag; + uint8_t entry_point_offsets_present_flag; + + uint8_t log2_max_pic_order_cnt_lsb; + uint8_t poc_msb_cycle_flag; + uint8_t poc_msb_cycle_len; + + uint8_t num_extra_ph_bytes; + uint8_t extra_ph_bit_present_flag[16]; + + uint8_t num_extra_sh_bytes; + uint8_t extra_sh_bit_present_flag[16]; + + uint8_t sublayer_dpb_params_flag; + DpbParameters dpb; + + uint8_t partition_constraints_override_enabled_flag; + uint8_t qtbtt_dual_tree_intra_flag; + + PartitionConstraints intra_slice_luma; + PartitionConstraints intra_slice_chroma; + PartitionConstraints inter_slice; + + uint8_t transform_skip_enabled_flag; + uint8_t bdpcm_enabled_flag; + + uint8_t mts_enabled_flag; + uint8_t explicit_mts_intra_enabled_flag; + uint8_t explicit_mts_inter_enabled_flag; + + uint8_t lfnst_enabled_flag; + + uint8_t joint_cbcr_enabled_flag; + + uint8_t sao_enabled_flag; + uint8_t alf_enabled_flag; + uint8_t ccalf_enabled_flag; + uint8_t lmcs_enabled_flag; + + // inter + uint8_t weighted_pred_flag; + uint8_t weighted_bipred_flag; + uint8_t long_term_ref_pics_flag; + uint8_t inter_layer_prediction_enabled_flag; + uint8_t idr_rpl_present_flag; + uint8_t num_ref_pic_lists[2]; + VVCRefPicListStruct ref_pic_list_struct[2][VVC_MAX_REF_PIC_LISTS]; + uint8_t ref_wraparound_enabled_flag; + uint8_t temporal_mvp_enabled_flag; + uint8_t sbtmvp_enabled_flag; + uint8_t amvr_enabled_flag; + uint8_t bdof_enabled_flag; + uint8_t bdof_control_present_in_ph_flag; + uint8_t smvd_enabled_flag; + uint8_t dmvr_enabled_flag; + uint8_t dmvr_control_present_in_ph_flag; + uint8_t mmvd_enabled_flag; + uint8_t mmvd_fullpel_only_enabled_flag; + uint8_t sbt_enabled_flag; + uint8_t affine_enabled_flag; + uint8_t five_minus_max_num_subblock_merge_cand; + uint8_t six_param_affine_enabled_flag; + uint8_t affine_amvr_enabled_flag; + uint8_t affine_prof_enabled_flag; + uint8_t prof_control_present_in_ph_flag; + uint8_t bcw_enabled_flag; + uint8_t ciip_enabled_flag; + uint8_t gpm_enabled_flag; + uint8_t log2_parallel_merge_level; + + // intra + uint8_t isp_enabled_flag; + uint8_t mrl_enabled_flag; + uint8_t mip_enabled_flag; + uint8_t cclm_enabled_flag; + uint8_t chroma_horizontal_collocated_flag; + uint8_t chroma_vertical_collocated_flag; + uint8_t palette_enabled_flag; + uint8_t act_enabled_flag; + uint8_t min_qp_prime_ts; + uint8_t ibc_enabled_flag; + + uint8_t ladf_enabled_flag; + uint8_t num_ladf_intervals; ///< sps_num_ladf_intervals_minus2 + 2; + int8_t ladf_lowest_interval_qp_offset; + int8_t ladf_qp_offset[LADF_MAX_INTERVAL]; + + uint8_t explicit_scaling_list_enabled_flag; + uint8_t scaling_matrix_for_lfnst_disabled_flag; + uint8_t scaling_matrix_for_alternative_colour_space_disabled_flag; + uint8_t scaling_matrix_designated_colour_space_flag; + uint8_t dep_quant_enabled_flag; + uint8_t sign_data_hiding_enabled_flag; + + uint8_t virtual_boundaries_enabled_flag; + VirtualBoundaries vbs; + + uint8_t timing_hrd_params_present_flag; + uint8_t sublayer_cpb_params_present_flag; + GeneralTimingHrdParameters general_timing_hrd_parameters; + + uint8_t field_seq_flag; + + VUI vui; + + PTL ptl; + + int hshift[VVC_MAX_SAMPLE_ARRAYS]; + int vshift[VVC_MAX_SAMPLE_ARRAYS]; + + //derived values + unsigned int max_pic_order_cnt_lsb; ///< MaxPicOrderCntLsb + uint8_t bit_depth; ///< BitDepth + uint8_t qp_bd_offset; ///< QpBdOffset + uint8_t ctb_log2_size_y; ///< CtbLog2SizeY + uint8_t ctb_size_y; ///< CtbSizeY + uint8_t min_cb_log2_size_y; ///< MinCbLog2SizeY + uint8_t min_cb_size_y; ///< MinCbSizeY + uint8_t max_tb_size_y; ///< MaxTbSizeY + uint8_t max_ts_size; ///< MaxTsSize + uint8_t max_num_merge_cand; ///< MaxNumMergeCand + uint8_t max_num_ibc_merge_cand; ///< MaxNumIbcMergeCand + uint8_t max_num_gpm_merge_cand; ///< MaxNumGpmMergeCand + unsigned int ladf_interval_lower_bound[LADF_MAX_INTERVAL]; ///< SpsLadfIntervalLowerBound[] + + uint8_t data[4096]; + int data_size; + + int chroma_qp_table[VVC_MAX_SAMPLE_ARRAYS][VVC_MAX_POINTS_IN_QP_TABLE]; +} VVCSPS; + +typedef struct DBParams { + int beta_offset[VVC_MAX_SAMPLE_ARRAYS]; + int tc_offset[VVC_MAX_SAMPLE_ARRAYS]; +} DBParams; + +typedef struct VVCPPS { + uint8_t pic_parameter_set_id; + uint8_t seq_parameter_set_id; + uint8_t mixed_nalu_types_in_pic_flag; + uint16_t width; + uint16_t height; + + VVCWindow conf_win; + VVCWindow scaling_win; + + uint8_t output_flag_present_flag; + uint8_t no_pic_partition_flag; + + uint8_t loop_filter_across_tiles_enabled_flag; + uint8_t rect_slice_flag; + uint8_t single_slice_per_subpic_flag; + + uint8_t tile_idx_delta_present_flag; + + uint8_t loop_filter_across_slices_enabled_flag; + uint8_t cabac_init_present_flag; + + uint8_t num_ref_idx_default_active[2]; + uint8_t rpl1_idx_present_flag; + uint8_t weighted_pred_flag; + uint8_t weighted_bipred_flag; + uint8_t ref_wraparound_enabled_flag; + int8_t init_qp; ///< 26 + pps_init_qp_minus26 + uint8_t cu_qp_delta_enabled_flag; + + uint8_t chroma_tool_offsets_present_flag; + int8_t chroma_qp_offset[3]; ///< pps_cb_qp_offset, pps_cr_qp_offset, pps_joint_cbcr_qp_offset_value + uint8_t slice_chroma_qp_offsets_present_flag; + uint8_t cu_chroma_qp_offset_list_enabled_flag; + uint8_t chroma_qp_offset_list_len_minus1; + int8_t chroma_qp_offset_list[6][3]; ///< pps_cb_qp_offset_list, pps_cr_qp_offset_list, pps_joint_cbcr_qp_offset_list + + uint8_t deblocking_filter_control_present_flag; + uint8_t deblocking_filter_override_enabled_flag; + uint8_t deblocking_filter_disabled_flag; + uint8_t dbf_info_in_ph_flag; + DBParams deblock; + + uint8_t rpl_info_in_ph_flag; + uint8_t sao_info_in_ph_flag; + uint8_t alf_info_in_ph_flag; + uint8_t wp_info_in_ph_flag; + uint8_t qp_delta_info_in_ph_flag; + + uint8_t picture_header_extension_present_flag; + uint8_t slice_header_extension_present_flag; + + //derived value; + uint16_t num_tiles_in_pic; + uint16_t slice_start_offset [VVC_MAX_SLICES]; + uint16_t num_slices_in_subpic[VVC_MAX_SLICES]; + uint16_t num_ctus_in_slice [VVC_MAX_SLICES]; + + uint16_t min_cb_width; + uint16_t min_cb_height; + + uint16_t ctb_width; + uint16_t ctb_height; + int ctb_count; + + uint16_t min_pu_width; + uint16_t min_pu_height; + uint16_t min_tu_width; + uint16_t min_tu_height; + + uint16_t num_tile_columns; ///< NumTileColumns + uint16_t num_tile_rows; ///< NumTileRows + unsigned int *column_width; ///< ColWidthVal + unsigned int *row_height; ///< RowHeightVal + unsigned int *col_bd; ///< TileColBdVal + unsigned int *row_bd; ///< TileRowBdVal + unsigned int *ctb_to_col_bd; ///< CtbToTileColBd + unsigned int *ctb_to_row_bd; ///< CtbToTileRowBd + unsigned int *ctb_addr_in_slice; ///< CtbAddrInCurrSlice for entire picture + + uint16_t width32; ///< width in 32 pixels + uint16_t height32; ///< height in 32 pixels + uint16_t width64; ///< width in 64 pixels + uint16_t height64; ///< height in 64 pixels + + uint16_t subpic_id[VVC_MAX_SLICES]; ///< SubpicIdVal[] + uint16_t ref_wraparound_offset; ///< PpsRefWraparoundOffset + + uint8_t data[4096]; + int data_size; +} VVCPPS; + +#define VVC_MAX_ALF_COUNT 8 +#define VVC_MAX_LMCS_COUNT 4 +#define VVC_MAX_SL_COUNT 8 + +#define ALF_NUM_FILTERS_LUMA 25 +#define ALF_NUM_FILTERS_CHROMA 8 +#define ALF_NUM_FILTERS_CC 5 + +#define ALF_NUM_COEFF_LUMA 12 +#define ALF_NUM_COEFF_CHROMA 6 +#define ALF_NUM_COEFF_CC 7 + +enum { + APS_ALF, + APS_LMCS, + APS_SCALING, +}; + +typedef struct Alf { + //< ph_alf_enabled_flag, ph_alf_cb_enabled_flag, ph_alf_cr_enabled_flag + //< sh_alf_enabled_flag, sh_alf_cb_enabled_flag, sh_alf_cr_enabled_flag + uint8_t enabled_flag[VVC_MAX_SAMPLE_ARRAYS]; + + //< ph_num_alf_aps_ids_luma + //< sh_alf_aps_id_luma + uint8_t num_aps_ids_luma; + + //< ph_alf_aps_id_luma + //< sh_alf_aps_id_luma + uint8_t aps_id_luma[8]; + + //< ph_alf_aps_id_chroma + //< sh_alf_aps_id_chroma + uint8_t aps_id_chroma; + + //< ph_alf_cc_cb_enabled_flag, ph_alf_cc_cr_enabled_flag + //< sh_alf_cc_cb_enabled_flag, sh_alf_cc_cr_enabled_flag + uint8_t cc_enabled_flag[2]; + + //< ph_alf_cc_cb_aps_id, ph_alf_cc_cr_aps_id + //< sh_alf_cc_cb_aps_id, sh_alf_cc_cr_aps_id + uint8_t cc_aps_id[2]; +} Alf; + +#define MAX_WEIGHTS 15 +typedef struct PredWeightTable { + int log2_denom[2]; ///< luma_log2_weight_denom, ChromaLog2WeightDenom + + int nb_weights[2]; ///< num_l0_weights, num_l1_weights + int weight_flag[2][2][MAX_WEIGHTS]; ///< luma_weight_l0_flag, chroma_weight_l0_flag, + ///< luma_weight_l1_flag, chroma_weight_l1_flag, + int weight[2][VVC_MAX_SAMPLE_ARRAYS][MAX_WEIGHTS]; ///< LumaWeightL0, LumaWeightL1, ChromaWeightL0, ChromaWeightL1 + int offset[2][VVC_MAX_SAMPLE_ARRAYS][MAX_WEIGHTS]; ///< luma_offset_l0, luma_offset_l1, ChromaOffsetL0, ChromaOffsetL1 +} PredWeightTable; + +typedef struct VVCPH { + uint8_t gdr_or_irap_pic_flag; + uint8_t non_ref_pic_flag; + uint8_t gdr_pic_flag; + + uint8_t inter_slice_allowed_flag; + uint8_t intra_slice_allowed_flag; + + uint8_t pic_parameter_set_id; + + uint16_t pic_order_cnt_lsb; + uint8_t recovery_poc_cnt; + uint8_t poc_msb_cycle_present_flag; + uint8_t poc_msb_cycle_val; + + Alf alf; + + uint8_t lmcs_enabled_flag; + uint8_t lmcs_aps_id; + + uint8_t chroma_residual_scale_flag; + uint8_t explicit_scaling_list_enabled_flag; + uint8_t scaling_list_aps_id; + + VirtualBoundaries vbs; + + uint8_t pic_output_flag; + VVCRefPicListStruct rpls[2]; + + uint8_t partition_constraints_override_flag; + PartitionConstraints intra_slice_luma; + PartitionConstraints intra_slice_chroma; + PartitionConstraints inter_slice; + + + uint8_t cu_qp_delta_subdiv[2]; ///< cu_qp_delta_subdiv_intra_slice, cu_qp_delta_subdiv_inter_slice + uint8_t cu_chroma_qp_offset_subdiv[2]; ///< cu_chroma_qp_offset_subdiv_intra_slice, cu_chroma_qp_offset_subdiv_inter_slice + + uint8_t temporal_mvp_enabled_flag; + uint8_t collocated_ref_idx; + uint8_t mmvd_fullpel_only_flag; + uint8_t mvd_l1_zero_flag; + uint8_t bdof_disabled_flag; + uint8_t dmvr_disabled_flag; + uint8_t prof_disabled_flag; + PredWeightTable pwt; + + int8_t qp_delta; + uint8_t joint_cbcr_sign_flag; + + uint8_t sao_luma_enabled_flag; + uint8_t sao_chroma_enabled_flag; + + uint8_t deblocking_filter_disabled_flag; + DBParams deblock; + + //derived values + unsigned int max_num_subblock_merge_cand; ///< MaxNumSubblockMergeCand + + int poc; ///< PicOrderCntVal + uint8_t collocated_list; ///< !collocated_from_l0_flag + + //*2 for high depth + uint8_t lmcs_fwd_lut[LMCS_MAX_LUT_SIZE * 2]; + uint8_t lmcs_inv_lut[LMCS_MAX_LUT_SIZE * 2]; + int lmcs_min_bin_idx; + int lmcs_max_bin_idx; + int lmcs_pivot[LMCS_MAX_BIN_SIZE + 1]; + int lmcs_chroma_scale_coeff[LMCS_MAX_BIN_SIZE]; + + int size; +} VVCPH; + +typedef struct VVCALF { + int8_t luma_coeff [ALF_NUM_FILTERS_LUMA * ALF_NUM_COEFF_LUMA]; + uint8_t luma_clip_idx [ALF_NUM_FILTERS_LUMA * ALF_NUM_COEFF_LUMA]; + + uint8_t num_chroma_filters; + int8_t chroma_coeff [ALF_NUM_FILTERS_CHROMA * ALF_NUM_COEFF_CHROMA]; + uint8_t chroma_clip_idx[ALF_NUM_FILTERS_CHROMA * ALF_NUM_COEFF_CHROMA]; + + uint8_t cc_filters_signalled[2]; //< alf_cc_cb_filters_signalled + 1, alf_cc_cr_filters_signalled + 1 + int8_t cc_coeff[2][ALF_NUM_FILTERS_CC * ALF_NUM_COEFF_CC]; +} VVCALF; + +#define SL_MAX_ID 28 +#define SL_MAX_MATRIX_SIZE 8 + +enum { + SL_START_2x2 = 0, + SL_START_4x4 = 2, + SL_START_8x8 = 8, + SL_START_16x16 = 14, + SL_START_32x32 = 20, + SL_START_64x64 = 26, +}; + +typedef struct VVCScalingList { + uint8_t scaling_matrix_rec[SL_MAX_ID][SL_MAX_MATRIX_SIZE * SL_MAX_MATRIX_SIZE]; ///< ScalingMatrixRec + uint8_t scaling_matrix_dc_rec[SL_MAX_ID - SL_START_16x16]; ///< ScalingMatrixDcRec[refId − 14] +} VVCScalingList; + +typedef struct VVCParamSets { + AVBufferRef *vps_list[VVC_MAX_VPS_COUNT]; + AVBufferRef *sps_list[VVC_MAX_SPS_COUNT]; + AVBufferRef *pps_list[VVC_MAX_PPS_COUNT]; + AVBufferRef *alf_list[VVC_MAX_ALF_COUNT]; + AVBufferRef *lmcs_list[VVC_MAX_LMCS_COUNT]; + AVBufferRef *scaling_list[VVC_MAX_SL_COUNT]; + AVBufferRef *ph_buf; + + const VVCSPS *sps; + const VVCPPS *pps; + VVCPH *ph; +} VVCParamSets; + +typedef struct VVCFrameParamSets { + AVBufferRef *sps_buf; + AVBufferRef *pps_buf; + AVBufferRef *ph_buf; + AVBufferRef *alf_list[VVC_MAX_ALF_COUNT]; + AVBufferRef *lmcs_list[VVC_MAX_LMCS_COUNT]; + AVBufferRef *scaling_list[VVC_MAX_SL_COUNT]; + + const VVCSPS *sps; + const VVCPPS *pps; + const VVCPH *ph; +} VVCFrameParamSets; + +typedef struct VVCSH { + + uint16_t subpic_id; + uint16_t slice_address; + uint8_t num_tiles_in_slice; + uint8_t slice_type; + uint8_t no_output_of_prior_pics_flag; + + Alf alf; + + uint8_t lmcs_used_flag; + uint8_t explicit_scaling_list_used_flag; + + VVCRefPicListStruct rpls[2]; + + uint8_t num_ref_idx_active_override_flag; + uint8_t cabac_init_flag; + uint8_t collocated_ref_idx; + + PredWeightTable pwt; + + int8_t chroma_qp_offset[3]; ///< cb_qp_offset, cr_qp_offset, joint_cbcr_qp_offset + uint8_t cu_chroma_qp_offset_enabled_flag; + + uint8_t sao_used_flag[VVC_MAX_SAMPLE_ARRAYS]; ///< sh_sao_luma_used_flag and sh_sao_chroma_used_flag + + uint8_t deblocking_filter_disabled_flag; + DBParams deblock; + uint8_t dep_quant_used_flag; + + uint8_t sign_data_hiding_used_flag; + uint8_t ts_residual_coding_disabled_flag; + + //calculated value; + uint8_t collocated_list; ///< !sh_collocated_from_l0_flag + uint8_t nb_refs[2]; ///< NumRefIdxActive[] + uint8_t min_qt_size[2]; ///< MinQtSizeY, MinQtSizeC + uint8_t max_bt_size[2]; ///< MaxBtSizeY, MaxBtSizeC + uint8_t max_tt_size[2]; ///< MaxTtSizeY, MaxTtSizeC + uint8_t max_mtt_depth[2]; ///< MaxMttDepthY, MaxMttDepthC + uint8_t cu_qp_delta_subdiv; ///< CuQpDeltaSubdiv + uint8_t cu_chroma_qp_offset_subdiv; ///< CuChromaQpOffsetSubdiv + int8_t slice_qp_y; ///< SliceQpY + int8_t ref_idx_sym[2]; ///< RefIdxSymL0, RefIdxSymL1 + int num_ctus_in_curr_slice; ///< NumCtusInCurrSlice + uint32_t entry_point_offset[VVC_MAX_ENTRY_POINTS]; ///< entry_point_offset_minus1 + 1 + uint32_t entry_point_start_ctu[VVC_MAX_ENTRY_POINTS]; ///< entry point start in ctu_addr + unsigned int *ctb_addr_in_curr_slice; ///< CtbAddrInCurrSlice + unsigned int num_entry_points; ///< NumEntryPoints + + uint8_t first_slice_flag; +} VVCSH; + +struct VVCContext; + +int ff_vvc_decode_sps(VVCParamSets *ps, GetBitContext *gb, + int apply_defdispwin, int nuh_layer_id, AVCodecContext *avctx); +int ff_vvc_decode_pps(VVCParamSets *ps, GetBitContext *gb, void *log_ctx); +int ff_vvc_decode_ph(VVCParamSets *ps, const int poc_tid0, const int is_clvss, GetBitContext *gb, void *log_ctx); +int ff_vvc_decode_aps(VVCParamSets *ps, GetBitContext *gb, void *log_ctx); +int ff_vvc_decode_sh(VVCSH *sh, struct VVCContext *s, const int is_first_slice, GetBitContext *gb); +void ff_vvc_ps_uninit(VVCParamSets *ps); + +#endif /* AVCODEC_VVC_PS_H */ diff --git a/libavcodec/vvc/vvcdec.h b/libavcodec/vvc/vvcdec.h index 7097293af8..2b01ae94ff 100644 --- a/libavcodec/vvc/vvcdec.h +++ b/libavcodec/vvc/vvcdec.h @@ -30,6 +30,7 @@ #include "libavcodec/vvc.h" #include "vvc_executor.h" +#include "vvc_ps.h" #define LUMA 0 #define CHROMA 1 @@ -268,6 +269,8 @@ typedef struct VVCContext { const AVClass *c; // needed by private avoptions AVCodecContext *avctx; + VVCParamSets ps; + int temporal_id; ///< temporal_id_plus1 - 1 int pocTid0;