From patchwork Tue Aug 8 10:59:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 43173 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9329:b0:130:ccc6:6c4b with SMTP id r41csp2186993pzh; Tue, 8 Aug 2023 03:59:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGv/adQqQFF6Uv48b7fuBzhgdrESvh0gcA0J28X56HweBtz9n4d+hr/FuBZ/YCc5SWWn6fl X-Received: by 2002:aa7:c487:0:b0:523:47cf:5034 with SMTP id m7-20020aa7c487000000b0052347cf5034mr1256413edq.34.1691492397900; Tue, 08 Aug 2023 03:59:57 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a17-20020aa7cf11000000b005234011bb45si1484936edy.690.2023.08.08.03.59.57; Tue, 08 Aug 2023 03:59:57 -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=@outlook.com header.s=selector1 header.b=a4FXnfkB; arc=fail (body hash mismatch); 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 1557968C7B0; Tue, 8 Aug 2023 13:59:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01olkn2092.outbound.protection.outlook.com [40.92.53.92]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 57D0A68C7AC for ; Tue, 8 Aug 2023 13:59:20 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YiAaoO8JmcAtjRh9AHP/cTUk8Rjam/AlxSwQ09m3Gao/v/TY0jMfE8GW1BWsNa4VG56qzgghqucvGCROriwdf3sXf3EIdVBRNpet0pFw6P6WwnfHq/+nA5Lf7J4ThEMuAoW7Q2fwUkBZbLjRzFLdOcvXIVxekHcYZopjPheRHyXOdbB1KrPUcge4uh6INnDBarYTiORWFrceVATqIl8FDI/25kpwDc9mjiKPTaAFUfFTqXcOiS3WeMNhsj6XLhm5x477IacDpHe7KyzGkvH3uhloAmwR4vwKOJPAkIRZN9Dm2n8H0y941QA2H9LmVffGRp0QiGWmxDfyYb8UYtfXgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dy1K5iYIF1t8AJinjUjqk+dGhen5tg+ld/s/YRj4PdI=; b=ke7HSXZ4lyE2NdsAxTQTT+HogvX6YslLoRVRXu90JWgfA1GlVerD4Zv2m5h4FEXaw/v0XwWbpFWLgiv3PerTkvHsh+z3WhA9+0vi2TqaMTXA9BT5NpFoWOevRxhvhfYGll6ef72CeSQ81NUinijaMih4geIyec1bchYQwhDQ0tTjmHH8rKW0HpcbslTAORb5EAyt2V1kD+bM+VE4K4A4lLbAzdJo9GRKBVJ17z5mCqTDxALmATUc6BcDOGFI5VOKZZ0oivT5ArPa9mrA3i1IrK31Xm0btzmIBYY4FUnL8TT2J46STZrBxU0AOauuNoUhP47El4VlUA2i5JePSTySxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dy1K5iYIF1t8AJinjUjqk+dGhen5tg+ld/s/YRj4PdI=; b=a4FXnfkBKE9gshtRPW8bDS/MKfEmmHGcxUZ9b3pB1rIyHYZZDDdPv/ns+dqpYExhgqNHtDM29kM4PQ19aEJkTN3r42zCk9KKMQdtcpM5laV5Ln4AUIPG9T0orVRZcorVCRQfIJAxGBCOFTyuRsYEz2QA4y1H6r6lyqyYkLUvy4C8QTDVkwHt9iFcsxLWSMD/5fZ2YrutBv2whMxn5U2TWUdiMyZS5lAeri+ahaLhxdolPyOEQS3Z7yKb9ySsae2/XrClHi3+veEZeti3F94krmPDht742PJhmkysfXx/DTfUDkv5ZPneWA9hqDdBsUSAcMiXOVSbM725j9fKPye1OA== Received: from TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) by SEZPR06MB5692.apcprd06.prod.outlook.com (2603:1096:101:ae::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Tue, 8 Aug 2023 10:59:07 +0000 Received: from TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::f1a4:bbff:7592:ee31]) by TYSPR06MB6433.apcprd06.prod.outlook.com ([fe80::f1a4:bbff:7592:ee31%5]) with mapi id 15.20.6652.026; Tue, 8 Aug 2023 10:59:07 +0000 From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Tue, 8 Aug 2023 18:59:00 +0800 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230808105903.6667-1-nuomi2021@gmail.com> References: <20230808105903.6667-1-nuomi2021@gmail.com> X-TMN: [fdn1x/BTsPnatfLNLSMZNHxnymd0yKen] X-ClientProxiedBy: TYCPR01CA0046.jpnprd01.prod.outlook.com (2603:1096:405:1::34) To TYSPR06MB6433.apcprd06.prod.outlook.com (2603:1096:400:47a::6) X-Microsoft-Original-Message-ID: <20230808105903.6667-5-nuomi2021@gmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 2 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6433:EE_|SEZPR06MB5692:EE_ X-MS-Office365-Filtering-Correlation-Id: e42453ed-e48e-4471-9dae-08db97fe7c78 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CNHaa1J3cQWiyDtxy1BrA75/z+t36TQDePoNmvZfX6uFwFewRRTeag6hIk/1Q21XBTWUr64xyRg9wmr9NC0+CFtzghBJPVnXMDzoyg45Krs2aV5oMywngKhxoGIr86a7SMDizeCI6OO+mec6/OHJ6y1tAEPX/fh2Mjrywk1hGgmo4uJoMEKqQl0xMB51FQt0/Uv4kQLAPbLvAPccLrwHvmBqsdDZw72GzI7Xy/mhf7ZetZx2ipV3yErt8dTbUwzTG7XNSBSMMP0U3dr1pJ1Djk/M7sXr/+gVCXuCl99TShq/uu9chwQ+XYfHCOPqJY+AekMXaRfyaWcnJHIN1MvyIZm82KFna//i/4lFC3oKHIrUK/AhTtZz2jVfhAKcxfFoaHa3IQN8c4UJVb6EnjUWdGtOvfQPpMLaYnMnkNIxt1chYsPXgfZjGVoWnHEkEU2GjN7dokK7i+I/zN6dNZIcEtTLIVn/MeGHNQTmEO5X1nQak6OWlSibw1C9BatdpCmo8D9Bls7dqp+TiNNJWbTw2sel0avsntFcoUWRFA1W6ibXZspQABbFOW1c/N6CA9nMUA85gsl2Zta8UlBOkFq1L6CU7Psn+FXhafhops8/7U9cGIYbUvAgfgkKQ6+Nd7wl X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Te8ObXN+FX3Le0OkRaCiJco/n4YwYtLUbmbBwm+ZzAiVhD6JoiaAVTdQB4eB/EdyPJAvqDLSJwjqaJyt9Pe84BN2Uq0I4oK/u7fw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IddyB68qnW5Ib9pMakUDDUEn6IWw8KDyRVlrB9uNDJ/IcpMxkdJre1OZX24jT+7NOzmuKwsuZwBEYr/XqP55G7JfsShjOj9xbooN90w3iBNPV X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e42453ed-e48e-4471-9dae-08db97fe7c78 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6433.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2023 10:59:07.1431 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5692 Subject: [FFmpeg-devel] [PATCH v2 5/8] cbs_h266: H266RawSliceHeader, expose NumEntryPoints 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: osgRHE0eHi6L --- libavcodec/cbs_h266.h | 3 +++ libavcodec/cbs_h266_syntax_template.c | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 0196f46bc0..1d80c74feb 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -828,6 +828,9 @@ typedef struct H266RawSliceHeader { uint8_t sh_entry_offset_len_minus1; uint32_t sh_entry_point_offset_minus1[VVC_MAX_ENTRY_POINTS]; + // derived values + uint32_t num_entry_points; ///< NumEntryPoints + } H266RawSliceHeader; typedef struct H266RawSlice { diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 43b3346359..d0d1ccadd2 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3374,8 +3374,9 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, for (i = 0; i < current->sh_slice_header_extension_length; i++) us(8, sh_slice_header_extension_data_byte[i], 0x00, 0xff, 1, i); } + + current->num_entry_points = 0; if (sps->sps_entry_point_offsets_present_flag) { - int num_entry_points = 0; uint8_t entropy_sync = sps->sps_entropy_coding_sync_enabled_flag; int height; if (pps->pps_rect_slice_flag) { @@ -3392,7 +3393,7 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, else height = pps->pps_slice_height_in_tiles_minus1[slice_idx] + 1; - num_entry_points = width_in_tiles * height; + current->num_entry_points = width_in_tiles * height; } else { int tile_idx; int tile_y; @@ -3402,18 +3403,18 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, current->sh_num_tiles_in_slice_minus1; tile_idx++) { tile_y = tile_idx / pps->num_tile_rows; height = pps->row_height_val[tile_y]; - num_entry_points += (entropy_sync ? height : 1); + current->num_entry_points += (entropy_sync ? height : 1); } } - num_entry_points--; - if (num_entry_points > VVC_MAX_ENTRY_POINTS) { + current->num_entry_points--; + if (current->num_entry_points > VVC_MAX_ENTRY_POINTS) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Too many entry points: " - "%" PRIu16 ".\n", num_entry_points); + "%" PRIu16 ".\n", current->num_entry_points); return AVERROR_PATCHWELCOME; } - if (num_entry_points > 0) { + if (current->num_entry_points > 0) { ue(sh_entry_offset_len_minus1, 0, 31); - for (i = 0; i < num_entry_points; i++) { + for (i = 0; i < current->num_entry_points; i++) { ubs(current->sh_entry_offset_len_minus1 + 1, sh_entry_point_offset_minus1[i], 1, i); }