From patchwork Sun Nov 10 12:13:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nuo Mi X-Patchwork-Id: 52656 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2fe5:b0:4a6:1c7:11b7 with SMTP id kw5csp3347852vqb; Sun, 10 Nov 2024 04:13:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXDQCZL3MWbRdyo86WeccHkqqlLKvKTRmUK86v5bRXLQu7APedp0S+ohHRQnSFh/XF0NKLeNhAUmnaPuK99DF1P@gmail.com X-Google-Smtp-Source: AGHT+IFjzHV237+fLZNAUluFkwn4bYASDjiXxCWeB6Kt5HtHc5d5A1PL26yifYZAGUwE1/UEyEIV X-Received: by 2002:a17:906:2b10:b0:a9f:4f7:f064 with SMTP id a640c23a62f3a-a9f04f816a1mr338794866b.3.1731240820162; Sun, 10 Nov 2024 04:13:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731240820; cv=none; d=google.com; s=arc-20240605; b=hmQVqr2aZf7bXdnl/7Jjh2Sw3S/xKOKmHuthzZ7uD7IHkL+v7wdmUF+3nKabWwR0xg M0Pmoo2WCsLf6YElmkJT7R9z9lssh+pmx5H2c+z66YtaZ1QVQBFDxmUGVr9yUPINgxfP Gw7JxphSlQgOd4Lu0xclZOElrjp+f32fwfkg3K3yeBRR3DG7R/DBHasnpaHQwX54hghx R0zt2vfwVvzxNY5R5ndL5SbaM3wtCtNGh2FzPOkfxGC5txIsOzfd/60tqZPg89BsNsv/ h1glfBdLymlsTJOIO4znZoS7JWvepUxbxAKCmQJpDfXANWfn+6jHvhfnyZEGY7hA8VOX WlnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:message-id:date:to:from :dkim-signature:delivered-to; bh=X1yWu67avbqvreLgnvuvTkN4TzZ4NumcvN6qQhw6sv4=; fh=BmCo7omBTbT1U9uZaYNAyg1wX3srS6ESZnqeSyZxyKM=; b=dNrklpadSc9/nukSz+VACf+zJJJIsH1XPp6iLZl2XANn687CJ8YRbiRL5MSbD/ZNRV NYBh4tHoMP3YcYgkFep7NaXA6JmCNh+gsNezh8tGEa+GUBleA9eI9geBg9jpCvPYQlHH 0XHNOR6MeOG0W1hHxIH7EqD8wlZAAF2tMhbG3BdrFuVK3jIq0NJ0gZDq42c+VgrJhBlk m2Z10+glFi1Tz8Hx7ElWriVnB3DmkKhTHOZYIe3+hgawW3TRcHc9u7Ite5KUQAPeG2JT PxwnqWm5inuJpkTAhPw9ybolNiXGwnb5C9NOoicscps+S/2TwUX1zlhV7TkGrv7/bdVr tBSQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=D86udVna; 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; dara=fail header.i=@gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTPS id a640c23a62f3a-a9ee0e2ec94si502137866b.810.2024.11.10.04.13.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Nov 2024 04:13:40 -0800 (PST) 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=20230601 header.b=D86udVna; 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; dara=fail header.i=@gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0C44F68D8B3; Sun, 10 Nov 2024 14:13:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 763FF68DE57 for ; Sun, 10 Nov 2024 14:13:27 +0200 (EET) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-20ca388d242so37286145ad.2 for ; Sun, 10 Nov 2024 04:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731240805; x=1731845605; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/IV7f5U21kIm960xv3uDdlZdEifkTuK9yan1Yo2K/fY=; b=D86udVnaBKdOm7RcbMf6Mlerh6JXG7lMDMKKDnAp1SqympFs2anol/Asg9xUFkQXHv QtWusUIhreSjBeW6fBAUd6KhZRTmaXdiD2sjETKzEcMhcnVvBde9W41luUvONgtcY9wD +zGx1mV78T4aKYpG6FJORb/d7xhBtWV0sO3rDgGiYluZzhOY7QjgEiVrbcEB+isvtrYu 1C654j0q+q0O7rO+WSB0T9hg4H4QoUYDMY+LDj0Od8xRVXyxWo8mXclwRrFVSvMJrVNZ CS6srgT2DKyjMpyLm5PQPbxOu/XOzQ8Pf9k5WqsyDDkB152G8/xffp8qRkiZ445nTCxy wcrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731240805; x=1731845605; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/IV7f5U21kIm960xv3uDdlZdEifkTuK9yan1Yo2K/fY=; b=g5+llvd5JG5cbCX/zXoeOOJhq0SMpErHfMfY1csgr/rwdhDXKDXrk5L7h4czYmMGwh oJ5C64WPHb6nJoZ+gT8MPL+SX027FdSHzbbrL8BSrl6kwxPP1gTO6ofHlqdr8e8UeQrH HWQOp4BQ4dDbvS+eedZQ3e2tjQLWQ55USl6jji+86Hc5a8CGgyL38lL/n5Eqp9FOj/h7 ohZrZEDX7+Zr2Yp4rIx9TqoY24MHSv6dzuQ18G91jFKWEkXoYaRJ198LTOiLCO9brXFO nhWh/o5tsI2dDK7wYyoeklRHvVIRPfOt+ec2HP4GUBXXHVldCJbL2H1lO1mu5fLVSLZ9 mcRA== X-Gm-Message-State: AOJu0YxjOqi1bEBgmj1PjT5T8sAld2+PKZgJtVPImX8hEBbLsBmVh/zm 4BVmwKfHRaOfAoRXVXe8UMnHTsxK0P7x2VsMP84ZNPrERfaC9ZNSPq5tiQ== X-Received: by 2002:a17:902:e747:b0:20c:e262:2560 with SMTP id d9443c01a7336-21183e4c8a3mr129343685ad.50.1731240805386; Sun, 10 Nov 2024 04:13:25 -0800 (PST) Received: from localhost ([112.64.8.17]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21177dc7e96sm59241425ad.42.2024.11.10.04.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Nov 2024 04:13:24 -0800 (PST) From: Nuo Mi To: ffmpeg-devel@ffmpeg.org Date: Sun, 10 Nov 2024 20:13:14 +0800 Message-Id: <20241110121314.12540-1-nuomi2021@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/cbs_h266: Fix regression in DVB clip introduced by 93281630a71c06642adfebebb0d4b105a4e02e91 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 , Nuo Mi Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: OWzoeGv1w+jd This commit introduced a regression to VVC_HDR_UHDTV1_OpenGOP_3840x2160_50fps_HLG10_mosaic.ts. Root Cause: The AV_CEIL_RSHIFT(a, b) macro uses bit tricks that work only when -a is a negative value. However, due to integer promotion rules, this behavior does not extend to the unsigned int type. See "6.3.1.1 Boolean, characters, and integers" in the "ISO/IEC 9899" for details. Reported-by: Frank Plowman --- libavcodec/cbs_h266_syntax_template.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index b21d07491b..6b2d6534ef 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -1162,7 +1162,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, for (i = 1; i <= current->sps_num_subpics_minus1; i++) { if (!current->sps_subpic_same_size_flag) { if (current->sps_pic_width_max_in_luma_samples > ctb_size_y) { - const unsigned int win_right_edge = + const int win_right_edge = current->sps_pic_width_max_in_luma_samples - current->sps_conf_win_right_offset * sub_width_c; us(wlen, sps_subpic_ctu_top_left_x[i], 0, @@ -1172,7 +1172,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, infer(sps_subpic_ctu_top_left_x[i], 0); if (current->sps_pic_height_max_in_luma_samples > ctb_size_y) { - const unsigned int win_bottom_edge = + const int win_bottom_edge = current->sps_pic_height_max_in_luma_samples - current->sps_conf_win_bottom_offset * sub_height_c; us(hlen, sps_subpic_ctu_top_left_y[i], 0, @@ -1183,9 +1183,9 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, if (i < current->sps_num_subpics_minus1 && current->sps_pic_width_max_in_luma_samples > ctb_size_y) { - const unsigned int win_left_edge = + const int win_left_edge = current->sps_conf_win_left_offset * sub_width_c; - const unsigned int win_left_edge_ctus = + const int win_left_edge_ctus = AV_CEIL_RSHIFT(win_left_edge, ctb_log2_size_y); us(wlen, sps_subpic_width_minus1[i], win_left_edge_ctus > current->sps_subpic_ctu_top_left_x[i] @@ -1200,9 +1200,9 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, if (i < current->sps_num_subpics_minus1 && current->sps_pic_height_max_in_luma_samples > ctb_size_y) { - const unsigned int win_top_edge = + const int win_top_edge = current->sps_conf_win_top_offset * sub_height_c; - const unsigned int win_top_edge_ctus = + const int win_top_edge_ctus = AV_CEIL_RSHIFT(win_top_edge, ctb_log2_size_y); us(hlen, sps_subpic_height_minus1[i], win_top_edge_ctus > current->sps_subpic_ctu_top_left_y[i]