From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id E6D364DF44 for ; Wed, 5 Mar 2025 18:40:11 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DED1668F02F; Wed, 5 Mar 2025 20:40:07 +0200 (EET) Received: from sender-op-o11.zoho.eu (sender-op-o11.zoho.eu [136.143.169.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2D3D968F026 for ; Wed, 5 Mar 2025 20:40:01 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; t=1741199999; cv=none; d=zohomail.eu; s=zohoarc; b=HmcrekKMXBUxrXRFUnGFky3hPkC0pbBUhtHccxyzuxRo2MWJJVLin2A6O/eLh0Fw/KpvZHKUiAEZoNQqnDh0xmazHEWY11IvB0LAvEh43zRz0YBvVdF51n2e/GuqJ13FsUoZsom7wfXrrzHf6k+AgJSlzoSJIvuMPqNvi3M8hgM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1741199999; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=cHa74LR9wmanQJ8rP+Gk1mJqcxnb15L7m9UrGMtxD5M=; b=b52KXTUUBPOsZTOs5MkFXA5/yf+yc0VNfwVogTOKbnOp9SPp9PmlpXQKxd4Uq4GwFOPDCOY+QznKiDBc8LSnvGyZ1IcxiYv5r+vjEiSHN1jqq0f1OykOvaz384v3WuJi8ksA/z5mPC2pZAPTG2YRYHB9Tj4+sFiDI0kysMXnIlA= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=frankplowman.com; spf=pass smtp.mailfrom=post@frankplowman.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1741199999; s=zmail; d=frankplowman.com; i=post@frankplowman.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=cHa74LR9wmanQJ8rP+Gk1mJqcxnb15L7m9UrGMtxD5M=; b=Ys37089932qt7bsTGqYhM2Y4Kd7XHqTwllzH5N7Hes9X//uKvW4Cws0t6giwQd75 Q094QTrEmYkVB3j72SXrGvITXANirsLsKEQqqjedhRexSGEBv7nWljss/lI9YfNGCDS uGiRLTbMPaF+z0iCcL/Ykz3NOUk4zlxkvHKp+liY= Received: by mx.zoho.eu with SMTPS id 1741199996513282.8195574102873; Wed, 5 Mar 2025 19:39:56 +0100 (CET) From: Frank Plowman To: ffmpeg-devel@ffmpeg.org Date: Wed, 5 Mar 2025 18:38:41 +0000 Message-ID: <20250305183930.82261-1-post@frankplowman.com> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-ZohoMailClient: External Subject: [FFmpeg-devel] [PATCH v2] lavc/vvc: Fix NumEntryPoints derivation 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: Frank Plowman , nuomi2021@gmail.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: If pps_single_slice_per_subpic_flag is 1, slice_{width,height}_in_tiles are undefined and we must instead get the dimensions of the slice by referring to the corresponding subpicture. Signed-off-by: Frank Plowman --- Changes since v1: * slice_height_in_tiles is also undefined if pps->pps_single_slice_per_subpic_flag is 1, so also derive that from the subpic info. --- libavcodec/cbs_h266_syntax_template.c | 49 +++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 58211026bb..05634bc19c 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3440,13 +3440,50 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, for (i = 0; i < current->curr_subpic_idx; i++) { slice_idx += pps->num_slices_in_subpic[i]; } - width_in_tiles = - pps->pps_slice_width_in_tiles_minus1[slice_idx] + 1; - if (entropy_sync) - height = pps->slice_height_in_ctus[slice_idx]; - else - height = pps->pps_slice_height_in_tiles_minus1[slice_idx] + 1; + if (pps->pps_single_slice_per_subpic_flag) { + const int width_in_ctus = sps->sps_subpic_width_minus1[slice_idx] + 1; + const int subpic_l = sps->sps_subpic_ctu_top_left_x[slice_idx]; + const int subpic_r = subpic_l + width_in_ctus; + + int ctb_x = 0, tile_x = 0; + for (; ctb_x < subpic_l && tile_x < pps->num_tile_columns; tile_x++) + ctb_x += pps->col_width_val[tile_x]; + + width_in_tiles = 0; + for (; ctb_x < subpic_r && tile_x < pps->num_tile_columns; tile_x++) { + ctb_x += pps->col_width_val[tile_x]; + width_in_tiles++; + } + + if (entropy_sync) + height = sps->sps_subpic_height_minus1[slice_idx] + 1; + else { + const int height_in_ctus = sps->sps_subpic_height_minus1[slice_idx] + 1; + const int subpic_t = sps->sps_subpic_ctu_top_left_y[slice_idx]; + const int subpic_b = subpic_t + height_in_ctus; + + int ctb_y = 0, tile_y = 0, height_in_tiles; + for (; ctb_y < subpic_t && tile_y < pps->num_tile_rows; tile_y++) + ctb_y += pps->row_height_val[tile_y]; + + height_in_tiles = 0; + for (; ctb_y < subpic_b && tile_y < pps->num_tile_rows; tile_y++) { + ctb_y += pps->row_height_val[tile_y]; + height_in_tiles++; + } + + height = height_in_tiles; + } + } else { + width_in_tiles = + pps->pps_slice_width_in_tiles_minus1[slice_idx] + 1; + + if (entropy_sync) + height = pps->slice_height_in_ctus[slice_idx]; + else + height = pps->pps_slice_height_in_tiles_minus1[slice_idx] + 1; + } current->num_entry_points = width_in_tiles * height; } else { -- 2.47.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".