From patchwork Thu Nov 3 12:21:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Siedel X-Patchwork-Id: 39132 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp499886pzb; Thu, 3 Nov 2022 05:22:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7w8TxAfnlC5tfc2uzJ5BE0e6ubpP+uHJX72s0nMI/3MejLCN9DwNH/0/xQiBd649FnNTLz X-Received: by 2002:a17:906:9253:b0:7ae:5a6:22f8 with SMTP id c19-20020a170906925300b007ae05a622f8mr8095081ejx.108.1667478174028; Thu, 03 Nov 2022 05:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667478174; cv=none; d=google.com; s=arc-20160816; b=gBkLq1fxlDPPMso8W2vTWbr6OCCL37DToHNuDUCqoFN38cQED2F4qSlM11m8QH8prT dkPlmb1Oh/wQEQ50HMgq3DOP6kShIIcdu7fhdgTnwcsznp6W5BByYgCh9TbLDRW8plm8 bIVPgZWmmq3YeA8949gEXiDK/ve3xM9TD8OnvRMosFDQFxSxG1955owgn3WsXZupYwA9 0ESBlJ/WSqWA/+slpcO9hIFLmBCcg3DxG2dFHQv28MJeijcF4F1FpApgkUoc8li105Qq eYtUN2DcTlZsXzEslRsEXfI84XmqOI33Gz5An4Ozh9eaXZG35RKW5aCEUa329TmHKTAp QXTg== 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=9UT2Da0c91X6229uPv9Kn+AIim4sQogdorl/QQidxJ0=; b=AUSAXDPwVprhJgOKAyWAuaB6zafxNZgRE5ZGSFc0B/XwANHDE86pI0keJM/bxT6/9e DvJ0O1IU9TqlPrCD+VVYXm+CnHS05/Z5CxSaRwnlKogjriNjkI8J7bsOyJVTCWHNWgyO IVVR+aShdG3maMI6e9trYnmVkrMJC5tn/yXuexVW9/EFkiuWstpgXovasl8yNzfLhsye O9vtlXAIjasdIkQNlgiYk+XLq+wFcVk9/Bh/8yx0V6tX1CnMHOuP/PRpmkhqeUDZWOLe FZ4Xs4yHaahXv79YMWtw0UHd50RkT7kU98Kr/ZDPZwH/n10C+6bcX4DJgaa8tJ58+bXc HzeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@spin-digital-com.20210112.gappssmtp.com header.s=20210112 header.b="kDxHZ/D+"; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c14-20020a50d64e000000b00458e689f41fsi1036005edj.415.2022.11.03.05.22.53; Thu, 03 Nov 2022 05:22:54 -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=@spin-digital-com.20210112.gappssmtp.com header.s=20210112 header.b="kDxHZ/D+"; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 33F5868BF41; Thu, 3 Nov 2022 14:22:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EA78B68BF1B for ; Thu, 3 Nov 2022 14:22:32 +0200 (EET) Received: by mail-ej1-f50.google.com with SMTP id q9so4856394ejd.0 for ; Thu, 03 Nov 2022 05:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spin-digital-com.20210112.gappssmtp.com; s=20210112; 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=MH53QFumJ3WhvtGyuhPpN7s1qhIt+fjHsdsJa3ZsVZg=; b=kDxHZ/D+e6z82faKc05MjDe+zr1JS+jaMmx3gbT6V7LoPz+iYxEXBKsoa7sqpuhGlR tYhjPVEy1JBWlYXF1R6NB24+ceNAsgXaCxuT1neUe5ToiYHKmi3XBrGD7Zf/ebPyzyYV 106P0IbR+UYGBiCVJpDp3m2GNT+ogGWyxWfl64jUSGCNV5KTNBVt4itd2Z652+MeDgKx 7cARURaRXxA10PxqdK9XwxBD2JYmQMRbtLw5vYHhXM++mmXTuBknwSMh66Xhmfp48yx4 0XOJJY2KOVTj8VVkp1c8t21OOJ/Mp7RQuQKxYrpb1oOfpDoMa6Q9yp7/5XSa1+JxVidZ epdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=MH53QFumJ3WhvtGyuhPpN7s1qhIt+fjHsdsJa3ZsVZg=; b=cwIUweJ7oQwgbfnxsWYP/RyLnwx9ex0RbTR3+LhdVcdMviYuXUkeT42lSGI6NziJNd tgp9KXHdy1t9XTz60bVWXIs6GYXx/0WSIgEQQhK67o4PvncQpO2t+W8NCfN0szbwZu3m pqcx8DaI+esH28n78Eo5uFcyhbqe8oPVmi2g5M50V+vh82KQGP/eSWrQ1Y3NHBfkSyyK AHZ7ZBMGOnHGnmiPEdL4P6PckQeLrT3kmSZBXNIJPgPH7ZJL9j9y+eZkOYQwpqG7ODOk dfnw/05S5OsJV+6kZGA5CUjvadfmEv5hRoUUZLAqJ/AKVvA1SeOcFQCI05Y0vzKg/bX2 9EzQ== X-Gm-Message-State: ACrzQf3ryCzHW+nqiH/KjhpamkFK7+3jFHM8l7lNXwYw+u9y+jB//M+7 mBbwW8IHl9wwUei3Q976dDDadbRHHuzEhg== X-Received: by 2002:a17:907:3e03:b0:722:e694:438 with SMTP id hp3-20020a1709073e0300b00722e6940438mr29206164ejc.755.1667478151959; Thu, 03 Nov 2022 05:22:31 -0700 (PDT) Received: from thomas-win.localdomain ([213.138.44.237]) by smtp.gmail.com with ESMTPSA id c7-20020a0564021f8700b0045c010d0584sm457117edc.47.2022.11.03.05.22.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 05:22:31 -0700 (PDT) From: Thomas Siedel To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Nov 2022 13:21:49 +0100 Message-Id: <20221103122158.27169-2-thomas.ff@spin-digital.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221103122158.27169-1-thomas.ff@spin-digital.com> References: <20221103122158.27169-1-thomas.ff@spin-digital.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 01/10] avcodec: add enum types for H266/VVC 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: Thomas Siedel Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: l/N+nWGFzdAZ Add types as nal unit types, slice types and vvc typedefs needed for parsing vvc high-level syntax. Signed-off-by: Thomas Siedel --- libavcodec/vvc.h | 142 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 libavcodec/vvc.h diff --git a/libavcodec/vvc.h b/libavcodec/vvc.h new file mode 100644 index 0000000000..19979b7017 --- /dev/null +++ b/libavcodec/vvc.h @@ -0,0 +1,142 @@ +/* + * VVC shared code + * + * 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_H +#define AVCODEC_VVC_H + +/** + * Table 5 – NAL unit type codes and NAL unit type classes + * in T-REC-H.266-202008 + */ +enum VVCNALUnitType { + VVC_TRAIL_NUT = 0, + VVC_STSA_NUT = 1, + VVC_RADL_NUT = 2, + VVC_RASL_NUT = 3, + VVC_RSV_VCL_4 = 4, + VVC_RSV_VCL_5 = 5, + VVC_RSV_VCL_6 = 6, + VVC_IDR_W_RADL = 7, + VVC_IDR_N_LP = 8, + VVC_CRA_NUT = 9, + VVC_GDR_NUT = 10, + VVC_RSV_IRAP_11 = 11, + VVC_OPI_NUT = 12, + VVC_DCI_NUT = 13, + VVC_VPS_NUT = 14, + VVC_SPS_NUT = 15, + VVC_PPS_NUT = 16, + VVC_PREFIX_APS_NUT = 17, + VVC_SUFFIX_APS_NUT = 18, + VVC_PH_NUT = 19, + VVC_AUD_NUT = 20, + VVC_EOS_NUT = 21, + VVC_EOB_NUT = 22, + VVC_PREFIX_SEI_NUT = 23, + VVC_SUFFIX_SEI_NUT = 24, + VVC_FD_NUT = 25, + VVC_RSV_NVCL_26 = 26, + VVC_RSV_NVCL_27 = 27, + VVC_UNSPEC_28 = 28, + VVC_UNSPEC_29 = 29, + VVC_UNSPEC_30 = 30, + VVC_UNSPEC_31 = 31, +}; + +enum VVCSliceType { + VVC_SLICE_TYPE_B = 0, + VVC_SLICE_TYPE_P = 1, + VVC_SLICE_TYPE_I = 2, +}; + +enum { + //6.2 we can have 3 sample arrays + VVC_MAX_SAMPLE_ARRAYS = 3, + + //7.4.3.3 vps_max_layers_minus1 is u(6) + VVC_MAX_LAYERS = 64, + + //7.4.3.3 The value of vps_max_sublayers_minus1 shall be in the range of 0 to 6, inclusive + VVC_MAX_SUBLAYERS = 7, + + //7.4.3.3 vps_num_ptls_minus1 is u(8) + VVC_MAX_PTLS = 256, + + //7.4.3.3 vps_num_output_layer_sets_minus2 is u(8) + VVC_MAX_TOTAL_NUM_OLSS = 257, + + // 7.3.2.3: vps_video_parameter_set_id is u(4). + VVC_MAX_VPS_COUNT = 16, + // 7.3.2.4: sps_seq_parameter_set_id is u(4) + VVC_MAX_SPS_COUNT = 16, + // 7.3.2.5: pps_pic_parameter_set_id is u(6) + VVC_MAX_PPS_COUNT = 64, + + // 7.4.4.1: ptl_num_sub_profiles is u(8) + VVC_MAX_SUB_PROFILES = 256, + + // A.4.2: according to (1577), MaxDpbSize is bounded above by 2 * maxDpbPicBuf(8) + VVC_MAX_DPB_SIZE = 16, + + //7.4.3.4 sps_num_ref_pic_lists in range [0, 64] + VVC_MAX_REF_PIC_LISTS = 64, + + //7.4.11 num_ref_entries in range [0, MaxDpbSize + 13] + VVC_MAX_REF_ENTRIES = VVC_MAX_DPB_SIZE + 13, + + //7.4.3.3 sps_num_points_in_qp_table_minus1[i] in range [0, 36 − sps_qp_table_start_minus26[i]], + //sps_qp_table_start_minus26[i] in range [sps_qp_table_start_minus26[i] −26 − QpBdOffset, 36] + //for 10 bitsQpBdOffset is 12, so sps_num_points_in_qp_table_minus1[i] in range [0, 74] + VVC_MAX_POINTS_IN_QP_TABLE = 75, + + // 7.4.6.1: hrd_cpb_cnt_minus1 is in [0, 31]. + VVC_MAX_CPB_CNT = 32, + + // A.4.1: the highest level allows a MaxLumaPs of 35 651 584. + VVC_MAX_LUMA_PS = 35651584, + + // A.4.1: pic_width_in_luma_samples and pic_height_in_luma_samples are + // constrained to be not greater than sqrt(MaxLumaPs * 8). Hence height/ + // width are bounded above by sqrt(8 * 35651584) = 16888.2 samples. + VVC_MAX_WIDTH = 16888, + VVC_MAX_HEIGHT = 16888, + + // A.4.1: table A.1 allows at most 440 tiles per au for any level. + VVC_MAX_TILES_PER_AU = 440, + // A.4.1: table A.1 did not define max tile rows. + // in worest a case, we can have 1x440 tiles picture. + VVC_MAX_TILE_ROWS = VVC_MAX_TILES_PER_AU, + // A.4.1: table A.1 allows at most 20 tile columns for any level. + VVC_MAX_TILE_COLUMNS = 20, + + // A.4.1 table A.1 allows at most 600 slice for any level. + VVC_MAX_SLICES = 600, + + // 7.4.8: in the worst case (!pps_no_pic_partition_flag and + // sps_entropy_coding_sync_enabled_flag are both true), entry points can be + // placed at the beginning of every Ctb row in every tile, giving an + // upper bound of (num_tile_columns_minus1 + 1) * PicHeightInCtbsY - 1. + // Only a stream with very high resolution and perverse parameters could + // get near that, though, so set a lower limit here with the maximum + // possible value for 8K video (at most 135 32x32 Ctb rows). + VVC_MAX_ENTRY_POINTS = VVC_MAX_TILE_COLUMNS * 135, +}; + +#endif /* AVCODEC_VVC_H */ \ No newline at end of file