From patchwork Mon Dec 21 06:07:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 24600 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id EA59C449D98 for ; Mon, 21 Dec 2020 08:13:53 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C5FD768AD15; Mon, 21 Dec 2020 08:13:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B2B3568ACDB for ; Mon, 21 Dec 2020 08:13:46 +0200 (EET) Received: by mail-pg1-f177.google.com with SMTP id f17so5735748pge.6 for ; Sun, 20 Dec 2020 22:13:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kPBCleaEYPyALo7gUKoUfXuxWS+ZPrh3e7nw/iV1YWU=; b=pKqNNIeqbRilft0F/CE8PW7WkKjOszySVb/r97iN5NNoSf0XHRp6xxKv7ZoIlF4z0L xkLMOLjZXPbqHB4sYwYw+SS1XAhJuaZdlLSd32r4V6XDVNKjvs8EbUKlRB42JWnXB7hm YezjHz91OmrvGg+5mxKrO8K42P8V8VIQvlOHk0Eti74iMBEtkRkLqgs4nuBqZUGrsSjn 6JddsZU6wg55uFAXg04vCI/0V7uUakJo8aW7xiBFJ6aPxkIWVco8DhVe5XKzplQOTlEW 8ABwLY6dNBgbT6lLpdxuuOReWlNogUCMHRrDMPw62vfpP8J6aj93Z1MktEQFJawJYkov eArA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kPBCleaEYPyALo7gUKoUfXuxWS+ZPrh3e7nw/iV1YWU=; b=Bd7IZCyrJ/roxw+mtdn2elWsNFxpRamgBitaxAPWMLB0tExhIs3b3fdpgzbrnEJpUB x/w7gx65gl4hm+spJAe4Skyd/DkbzXQwW6F+5KAYkNTgJtL9FB0UuSX5O+arCYvlKCcz Axg8FnIr5ET24cOGaVaBcsgOB/QOGaugjBLAUOrTEK7U+I2sdd8/o8O74h37OFAxZ405 v2Lz+Rso0TiCsM43+a6IaFeF8u5c3IL5ZxpAPO0R/t9gS6vNPg8IDcKEJZGf+zZU7tzF vB9sRT1CEpH1+vPZKT3gM2iZewQYX0NW8qFeaVUq8hR9FSbri9ElHYhtWhrM2VeuTf1A mJtQ== X-Gm-Message-State: AOAM5311qigwgDZhqbMSETeBPU1S/pSrE6s//G6TjN0Kc113Pl1n7quW 9piljLrF9XaSJyVxLbsFL3z5YUed9pqvlg== X-Google-Smtp-Source: ABdhPJz/owpShcYAb2/JbJw71th3ex3O3iNswFn+0wBqLXg8sUAPz5k8K+AeH+HicYQpGQXMUduEUA== X-Received: by 2002:a63:1d59:: with SMTP id d25mr13849017pgm.259.1608530887239; Sun, 20 Dec 2020 22:08:07 -0800 (PST) Received: from Guangxin-PC.localdomain (23.83.245.51.16clouds.com. [23.83.245.51]) by smtp.gmail.com with ESMTPSA id h10sm11485061pfn.213.2020.12.20.22.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Dec 2020 22:08:06 -0800 (PST) From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Mon, 21 Dec 2020 14:07:05 +0800 Message-Id: <20201221060710.12230-1-nuomi2021@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/6] avcodec/h266: add shared header for h266 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" --- libavcodec/h266.h | 121 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 libavcodec/h266.h diff --git a/libavcodec/h266.h b/libavcodec/h266.h new file mode 100644 index 0000000000..d5793b76fc --- /dev/null +++ b/libavcodec/h266.h @@ -0,0 +1,121 @@ +/* + * H.266 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_H266_H +#define AVCODEC_H266_H + +/** + * Table 5 – NAL unit type codes and NAL unit type classes in + * T-REC-H.266-202008 + */ +enum H266NALUnitType { + H266_NAL_TRAIL = 0, + H266_NAL_STSA = 1, + H266_NAL_RADL = 2, + H266_NAL_RASL = 3, + H266_NAL_RSV_VCL_4 = 4, + H266_NAL_RSV_VCL_5 = 5, + H266_NAL_RSV_VCL_6 = 6, + H266_NAL_IDR_W_RADL = 7, + H266_NAL_IDR_N_LP = 8, + H266_NAL_CRA_NUT = 9, + H266_NAL_GDR_NUT = 10, + H266_NAL_RSV_IRAP_11 = 11, + H266_NAL_OPI = 12, + H266_NAL_DCI = 13, + H266_NAL_VPS = 14, + H266_NAL_SPS = 15, + H266_NAL_PPS = 16, + H266_NAL_PREFIX_APS = 17, + H266_NAL_SUFFIX_APS = 18, + H266_NAL_PH = 19, + H266_NAL_AUD = 20, + H266_NAL_EOS_NUT = 21, + H266_NAL_EOB_NUT = 22, + H266_NAL_PREFIX_SEI = 23, + H266_NAL_SUFFIX_SEI = 24, + H266_NAL_FD_NUT = 25, + H266_NAL_RSV_NVCL_26 = 26, + H266_NAL_RSV_NVCL_27 = 27, + H266_NAL_UNSPEC_28 = 28, + H266_NAL_UNSPEC_29 = 29, + H266_NAL_UNSPEC_30 = 30, + H266_NAL_UNSPEC_31 = 31, +}; + +enum H266SliceType { + H266_SLICE_B = 0, + H266_SLICE_P = 1, + H266_SLICE_I = 2, +}; + +enum { + H266_MAX_PLANES = 3, + //7.4.3.3 The value of vps_max_sublayers_minus1 shall be in the range of 0 to 6, inclusive + H266_MAX_SUB_LAYERS = 7, + + // 7.3.2.3: vps_video_parameter_set_id is u(4). + H266_MAX_VPS_COUNT = 16, + // 7.3.2.4: sps_seq_parameter_set_id is in [0, 15]. + H266_MAX_SPS_COUNT = 16, + // 7.3.2.5: pps_pic_parameter_set_id is in [0, 63]. + H266_MAX_PPS_COUNT = 64, + + // A.4.2: MaxDpbSize is bounded above by 16. + H266_MAX_DPB_SIZE = 16, + + //7.4.3.4 sps_num_ref_pic_lists in range [0, 64] + H266_MAX_REF_PIC_LISTS = 64, + + //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] + H266_MAX_POINTS_IN_QP_TABLE = 75, + + // 7.4.6.1: hrd_cpb_cnt_minus1 is in [0, 31]. + H266_MAX_CPB_CNT = 32, + + // A.4.1: in table A.6 the highest level allows a MaxLumaPs of 35 651 584. + H266_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. + H266_MAX_WIDTH = 16888, + H266_MAX_HEIGHT = 16888, + + // A.4.1: table A.1 allows at most 20 tile rows for any level. + H266_MAX_TILE_ROWS = 20, + // A.4.1: table A.1 allows at most 20 tile columns for any level. + H266_MAX_TILE_COLUMNS = 20, + + // A.4.1 table A.1 allows at most 600 slice for any level. + H266_MAX_SLICES = 600, + + // 7.4.8: in the worst case (tiles_enabled_flag and + // entropy_coding_sync_enabled_flag are both set), 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). + H266_MAX_ENTRY_POINT_OFFSETS = H266_MAX_TILE_COLUMNS * 135, +}; + +#endif /* AVCODEC_H266_H */