From patchwork Tue Jun 11 18:52:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 49806 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c504:0:b0:460:55fa:d5ed with SMTP id c4csp23849vqq; Tue, 11 Jun 2024 11:52:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWzhq6E2Uqr3ZzZEREjqgNF/6ERxykQ4vS04lAWoLEMI/BjBmVF1XuZK6UotCC43Z3mYZvNTl1aU9KwNy5eCJAvQTgprKGbmBG8jw== X-Google-Smtp-Source: AGHT+IFFc283W+HL0U/phILFgkTWiAJTAk7HacEuGfXzYMwUmINl70d5bu7wVYL03DywvNbA4JTX X-Received: by 2002:a17:906:684d:b0:a6e:f533:ce28 with SMTP id a640c23a62f3a-a6ef533cfa9mr702084566b.12.1718131956376; Tue, 11 Jun 2024 11:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718131956; cv=none; d=google.com; s=arc-20160816; b=KonKzWVUGTFW5F2/QaDKg9hjch7pZKT3f41BG7zlNWDl5qPPCLhbxzTQRQjbSqw90V IWxvBYi5Bwha64vyNww1EHsvG0oYr+W013QNgrivrYYpRIoG2M7Z5lVL2uT01OJ6H7vG 5WOPcNb/mRGe6ZCGVDEEJwefzDKIgHn4yGVQwJBYCRB7ZWY46wx/ElyZ7VafLf8WShgv Zvumr7oP1UxqqtaB/L0sBpWgZ3vSc+ukR2KFd3tYVXpbsiokxakj/l6WuuShxiaPQHte 8d7FPJMXAvuSM7FNhIquiwcigvo/s27AEwtaGuaZUkhQ1KcsOPDCCrHBzm59DZKBfCa3 uKdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=osehSF793SsPRDSdaE5Rz2DqviACvNbd+pkjqN+z0cI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=DBkxS+ERx8daZUTAp76HNBZKNN9j6i4eSMoW06GzwVq7gXHZqjAedWVFu/VwL1iCRa /yxQtj1ygCG1aPQO463TxYo97Mr8UTaxpflZ1IniN68OPrrOtXpy9IfuBh2WCS74Wtap Y/Ug6vQaFVRp1Lq5j1S6wlCKSlA8VrNqwJUgECFQdI3bVB9YMUCB7+K3n36lqUY33Te8 HhBVSqsiEDlC02zxp0HDcU8IaVf70nYkZMrEJjBShTbZH/di6uB1YyVmnKEQCRUE0CyN l88qI9Rshoz1UEY0ofOaYuw7zvpe6mrmXSkJLDnUtNggTbBoG6YXYjNb+JxkH+R4lvLt kcnQ==; 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=VaZk1Mob; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a6f0e805e54si323374566b.161.2024.06.11.11.52.34; Tue, 11 Jun 2024 11:52:36 -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=@gmail.com header.s=20230601 header.b=VaZk1Mob; 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 59A6968D38F; Tue, 11 Jun 2024 21:52:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7ABB568D89E for ; Tue, 11 Jun 2024 21:52:24 +0300 (EEST) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-7046e87e9afso1211750b3a.0 for ; Tue, 11 Jun 2024 11:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718131942; x=1718736742; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=cc8aUGCmzIcrTj4/OJjMXXM+mG11W483AV8p7M56m9Y=; b=VaZk1Mobfiv9Up2VvWA/0I5uGfAVCK4nmDteflUqSWZLaYi1po4taPXhbdDdC/Vod1 5rwVtZSKLDSGc8mBPENEN2FDt2NaihgmlvLBYjC8jp7e8k14kbfLuR3FF0xyUw+eUwUi dRfRVjdE53TBND+GCQOzL9fhKGB/N5eRXvpooz7QGO0GIJWnIuUemn3c6FhSR8PTTsl4 x5IF1GPNiBAAuZgUe20khcCAa+luoIE1QdQfmlcyFM1pJo6gfL62985JxfGM5SpwewZe Gx8Yim8IEE/7oWZCxxPFMv4NDR2y2sBcQSO35I+QfdguFwA7g4eg4wHKrrBrpSRte0xr pTCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718131942; x=1718736742; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cc8aUGCmzIcrTj4/OJjMXXM+mG11W483AV8p7M56m9Y=; b=ekJ7vUoW9suIX3EdpPvMf3CBmZ685b9+rVkQA2zhVCo1qomEp852ouHQy/wF+0OsFg q16SOtE+jHU+VLW/Igwwzicb8J3eEMs/70y5Q+HF/KDClrsSM68gNr6ttE3RTYTu3C4X HlP3ir2/UMjqmqvESHM+lVzU2SHtNFXLSDaC8viChMNkZaSyAQsI+ht2BK6arO9ummi0 WIe/TtV2PuspluocN3nTh0bbI0NTglkNySjndSjzVmBKO7FVK7SspQ7hTLROMv5yusqE YoVKZvXXRQZgAQbQO7ABGUK7b3D6fo0t5hQrVmdHUCEw6X1yeWXqj229FqPPQRf86ggA 8fqQ== X-Gm-Message-State: AOJu0YxwBjyKMg9xQ4vW3SCUgHyXNmT+tEHQ2uo0FadSZ5WcUf4C+oOs cKiCPN3B4sKYuNYOmyH4DzsPusq6YpbH2MP17s9U+xRHDabgqKWr+Xn9dg== X-Received: by 2002:a05:6a00:1989:b0:705:a0de:6155 with SMTP id d2e1a72fcca58-705a0de6553mr4888546b3a.25.1718131942141; Tue, 11 Jun 2024 11:52:22 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd7f309csm104586015ad.263.2024.06.11.11.52.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 11:52:21 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jun 2024 15:52:30 -0300 Message-ID: <20240611185232.5384-1-jamrial@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] avutil: rename av_mod_uintp2 to av_zero_extend 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: YvdLGE+IS90/ It's more descriptive of what it does. Signed-off-by: James Almer --- libavutil/common.h | 16 +++++++++++++++- libavutil/version.h | 1 + libavutil/x86/intmath.h | 6 +++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/libavutil/common.h b/libavutil/common.h index 3e4c339893..acd041fb67 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -42,6 +42,7 @@ #include "attributes.h" #include "error.h" #include "macros.h" +#include "version.h" #ifdef HAVE_AV_CONFIG_H # include "config.h" @@ -122,9 +123,11 @@ #ifndef av_clip_uintp2 # define av_clip_uintp2 av_clip_uintp2_c #endif +#if FF_API_MOD_UINTP2 #ifndef av_mod_uintp2 # define av_mod_uintp2 av_mod_uintp2_c #endif +#endif #ifndef av_sat_add32 # define av_sat_add32 av_sat_add32_c #endif @@ -149,6 +152,9 @@ #ifndef av_clipd # define av_clipd av_clipd_c #endif +#ifndef av_zero_extend +# define av_zero_extend av_zero_extend_c +#endif #ifndef av_popcount # define av_popcount av_popcount_c #endif @@ -288,11 +294,19 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) * @param p bit position to clip at * @return clipped value */ -static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) +static av_always_inline av_const unsigned av_zero_extend_c(unsigned a, unsigned p) { return a & ((1U << p) - 1); } +#if FF_API_MOD_UINTP2 +attribute_deprecated +static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) +{ + return av_zero_extend_c(a, p); +} +#endif + /** * Add two signed 32-bit values with saturation. * diff --git a/libavutil/version.h b/libavutil/version.h index 9d08d56884..38456affb8 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -112,6 +112,7 @@ #define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 60) #define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60) #define FF_API_H274_FILM_GRAIN_VCS (LIBAVUTIL_VERSION_MAJOR < 60) +#define FF_API_MOD_UINTP2 (LIBAVUTIL_VERSION_MAJOR < 60) /** * @} diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h index 8a6b5ae261..821a06ab66 100644 --- a/libavutil/x86/intmath.h +++ b/libavutil/x86/intmath.h @@ -82,13 +82,13 @@ static av_always_inline av_const int ff_ctzll_x86(long long v) #if defined(__BMI2__) #if AV_GCC_VERSION_AT_LEAST(5,1) -#define av_mod_uintp2 __builtin_ia32_bzhi_si +#define av_zero_extend __builtin_ia32_bzhi_si #elif HAVE_INLINE_ASM /* GCC releases before 5.1.0 have a broken bzhi builtin, so for those we * implement it using inline assembly */ -#define av_mod_uintp2 av_mod_uintp2_bmi2 -static av_always_inline av_const unsigned av_mod_uintp2_bmi2(unsigned a, unsigned p) +#define av_zero_extend av_zero_extend_bmi2 +static av_always_inline av_const unsigned av_zero_extend_bmi2(unsigned a, unsigned p) { if (av_builtin_constant_p(p)) return a & ((1 << p) - 1); From patchwork Tue Jun 11 18:52:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 49807 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c504:0:b0:460:55fa:d5ed with SMTP id c4csp23900vqq; Tue, 11 Jun 2024 11:52:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXS/VPgGQPPuhouaAL/HuZA3G0IrjVn/8xkm3PSQWs8sgpsOP8kQtgna/Z81GdGfVDrkAmDkcn/DQN1CU0llZsoqV15g7BIBIuMMg== X-Google-Smtp-Source: AGHT+IF5+izErHzYmZZ0XFkgrKJiCi3wKfzWMhzzBZbX4E2KPJOzrld5LeozaSSvB7bdlAGQ6zqS X-Received: by 2002:a50:f69a:0:b0:57c:55f6:b068 with SMTP id 4fb4d7f45d1cf-57c55f6b093mr10049668a12.32.1718131963796; Tue, 11 Jun 2024 11:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718131963; cv=none; d=google.com; s=arc-20160816; b=MmTLOLyTWC/xeR7DTUwZBCDcTP4XBeiFUkBPTw/pmwoyq1LW7xcZ+55iJYJsYvvBR1 5joTe6BC1B3yOQcLm/GZdZS1QD0i5NmL5r5x5y17DdRW8tEPiXiHxta9UTylUmPlk2xz hdhvQ/uSDpQWG5saowtMyDr+ogW6KWjsEo4qghEGopWXU+zht3SpJESAOWDg1ndmiWkG LsvucO341XFnN1nSHyj6YS+t6eyq4+M9XzSLH7chDlKpOdIpDqLXqU2piWTrvlam82BI tpBCB48YrU4Tc/08vP3awGyc3olYGpPEAURtSzdyZtH9Li5XOFGPY24IlB0Qxf4JjGZ2 O7Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=PjymJ0Nb+797xOLe35ltzBAXO+lV1y1F8SEDsUIxTuE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=JgO0jMzF7b177aS4AAgoiuh+o47ajQzm2rypWJmvI6czl1cnbiSXoegqeIaRwCLIUm A9J3iirKqcsQW6DQuI7X5wTPrsTUu/CZeCxMp8So8ZeqoWIWIXlIQMggygI4jDKm7N6/ gFDwo2b0tjE2Lkbdt2HgK7TBhAKpHhSe5IXCmZ4YSykPCYGmJ1h97lDsf6wW8PptivuJ jmVfT7hjBXUKCtcfuwY+EyeSIBG+GYt0ZrTJ2gtkkoU7xgDHRmksvRpvx8CK9zNevReH CLodPCejmkEc57T9d3ZArJa6rEBRRbSw5MoZs63t+e4l9O65bIqNjoo8Mh0SdgLiHPWN Ps6w==; 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="VEfW+s/5"; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a6f0fcc108dsi331652766b.674.2024.06.11.11.52.43; Tue, 11 Jun 2024 11:52:43 -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=@gmail.com header.s=20230601 header.b="VEfW+s/5"; 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 846A668D8BC; Tue, 11 Jun 2024 21:52:32 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 892DD68D89E for ; Tue, 11 Jun 2024 21:52:26 +0300 (EEST) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1f4a5344ec7so1336035ad.1 for ; Tue, 11 Jun 2024 11:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718131944; x=1718736744; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=ZM87yV5PjWII8SLQ4tOdxx0k3FOT6Dm9j94Xodapsos=; b=VEfW+s/5cHeqWKNzFaTFUMyT6r0Gb3IR2d8E1EYVc+oivMMr5Rhkwx5O1Pa843NGPk wW4hJhJWr64tiwcsc5EXBSsQIjufA3H3PbcXmNjMlJjAZ4FQL6DsiLZw2FhtL7bD8Pwc T8+jPyuFVPMYUkUeTFrn4A6VJARLUOyqqVuut84Do+e4y2CJj8V6eOSveis3ZK28Bcb3 lZBjl0q66MfGf34UIEq4F88lS7h6ni/wPbMdQXxgHkFu26UGq03I9Oa2yTI5A8GVbokw PiNvLZtp/Yw0EwY9gLT1+7wImgGeczkDKRpqsg27LKqO2YX8GgK2TLGj9npwFSfrrad5 DVig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718131944; x=1718736744; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZM87yV5PjWII8SLQ4tOdxx0k3FOT6Dm9j94Xodapsos=; b=W25cisBQ+T8xv+W875HMd+cGNsS5fTcBNVmSs0q5QY2/Vn7b9Jxg/YMTqOuFh6ccM8 ssE1XYJn9+t7ciqb2VY4S4qHOiHyGQlgkqK4BQkzW5a52+35SUIJfaIcNnAZ983+xaPV YM1F0cPqB6H5KpbYyooSIY6PgAEFPYtL5+aePF9O8khWJODmOo6lhwGaiBiBr+iMAgam GdX+vaHFW/ef6hEsYA1FQ+DIGWyA2u79vUrdcW1bqxit9IvdPUWXo1cJV3JlMcqt6TWL SuMI+CChPkdlkogfaRUMf/Nu6xHXnQw9+mDEYeQlDe1+9m8eVkDWaT1wmv4PPFvRikmx 1oTg== X-Gm-Message-State: AOJu0Yyn9iRotrubJznxRCa1wP5NQMy8PgCc6QNoa+YzzYZFBAbJplLp JbjvANMIjjSbjoAx5td0QNeb28c4EUh0Ax/HViX1WUwvNCanXbXiZxYrAQ== X-Received: by 2002:a17:902:dac9:b0:1f6:fac5:d5f1 with SMTP id d9443c01a7336-1f728930b6bmr50530785ad.27.1718131943757; Tue, 11 Jun 2024 11:52:23 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd7f309csm104586015ad.263.2024.06.11.11.52.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 11:52:23 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jun 2024 15:52:31 -0300 Message-ID: <20240611185232.5384-2-jamrial@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240611185232.5384-1-jamrial@gmail.com> References: <20240611185232.5384-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avutil/common: assert that bit position in av_zero_extend is valid 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: OBk99z5sWFNu Signed-off-by: James Almer --- libavutil/common.h | 3 +++ libavutil/x86/intmath.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libavutil/common.h b/libavutil/common.h index acd041fb67..65448d47d3 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -296,6 +296,9 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) */ static av_always_inline av_const unsigned av_zero_extend_c(unsigned a, unsigned p) { +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (p > 31) abort(); +#endif return a & ((1U << p) - 1); } diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h index 821a06ab66..de6da72129 100644 --- a/libavutil/x86/intmath.h +++ b/libavutil/x86/intmath.h @@ -90,8 +90,11 @@ static av_always_inline av_const int ff_ctzll_x86(long long v) #define av_zero_extend av_zero_extend_bmi2 static av_always_inline av_const unsigned av_zero_extend_bmi2(unsigned a, unsigned p) { +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (p > 31) abort(); +#endif if (av_builtin_constant_p(p)) - return a & ((1 << p) - 1); + return a & ((1U << p) - 1); else { unsigned x; __asm__ ("bzhi %2, %1, %0 \n\t" : "=r"(x) : "rm"(a), "r"(p)); From patchwork Tue Jun 11 18:52:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 49808 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c504:0:b0:460:55fa:d5ed with SMTP id c4csp23961vqq; Tue, 11 Jun 2024 11:52:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU5p4eSAWNoZPW0HVadZTUHNE39BU6Ba4mlBn2ZesYUpgqlHe0vw0F8m2VtOHyyA5Rf5iKlKwUCJt0BaB3yeLgUJB1XdLjTDwP1vQ== X-Google-Smtp-Source: AGHT+IF1RMyC0nrY+ZUedKNQt8/w7tRbajDr4zVqPv05z5jrDRPaKfmqnAot2p4z1KKu+OL4xmRk X-Received: by 2002:a05:6512:2316:b0:52c:988c:6e6e with SMTP id 2adb3069b0e04-52c988c6f93mr635093e87.30.1718131973522; Tue, 11 Jun 2024 11:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718131973; cv=none; d=google.com; s=arc-20160816; b=EDpNdlahktORpgGXccJgiUvhK99IkQQuoNrL5eBfjzvthW5ZAw0XJX8evMVyUa88tW 307TLCADvSV0TGWQ0p82sJAfh1o5i1KCsg7g20hZOpLIJjo+qLtPM5A38XzcXODcCeV5 77/50o+Tybo9hkLRTLJhmAYyDUdFWANkmJefkn9V3HlYq+WderTjVXMj/hWpR4clSQ/0 wv+M5EYargrZZpvmapLM9Y/RqdqJzNeT3OeaFRka6V+el6HCMUVQgyq6fgma87fZtm1i I+Z6JmTyL1HWkrvO2GWy6zYvxb+HTWe8Ql28nB2v4RHRcE6lqkeawXmGqS8cnofIhWlM pc2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=7hH7pjLqDo1gPZ1JPoiicV2XU82uq6Xuz82pKffGtII=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=MfMaOCvd60DCTrf+riJXBJgH3Rtl3bL+4jfB2JYUFJnsqa3RWJRuOdk40nd6WH3X6f p0n7jaW/xL78mg3nL87n8Phwun3gPxuzLHJKPVVq0ciN78IvE5xf5/UkXS+W5CWeYT5K Uib8q37C7dzH9fgs0PgSYeXe76pIOQAppGVxWzrofzhTePNo7nMIq210sIJl1sWtwVmW WVZWm4yQQkLjPxfpdhDGrzzKr6Bf9KIjmZnClvDwjLfXcKc8VjeFxEkSvN8hw8nAnucq aN8R/teUNbiIrXCHNMJwre7wJd7d/fHA45m/yRoJsgOY9/7ucIZRCxXEIsmdCARi2YKk h2mQ==; 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=HTZYCCtb; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-52c8fc4de8bsi860541e87.131.2024.06.11.11.52.53; Tue, 11 Jun 2024 11:52:53 -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=@gmail.com header.s=20230601 header.b=HTZYCCtb; 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 C6AA668D8C6; Tue, 11 Jun 2024 21:52:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8002F68D8B9 for ; Tue, 11 Jun 2024 21:52:28 +0300 (EEST) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-70435f4c330so1224963b3a.1 for ; Tue, 11 Jun 2024 11:52:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718131946; x=1718736746; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vHlv5x2OHBKEB1SJI2OIsaHBFgqbVYFZsZar4PCUosU=; b=HTZYCCtbXdCugKdSdWLoI76rAyjjENA9GIoBPG7BcOPnxnwW0082IPVI1RVLz06ZTJ 1FJlrfItbZayaO9IVqIXk2DeRolbwEmJeyDKu7iY2U/LuYSeNuXBM/9H1kaNAITV4Lmo OgCaedl3GATG0ilmw2obIg7feLFS7e7cJf16J5A00vnbDHxHgY1owAROR//AOUucA9KC gGNdP/Iuc9dtkJAkxZu9RQ/KNRahMl8i6v2Kw3d5tp+kE0qwNGD/CjmDNHrh3O0V0oPJ RrtSGuX6fgFtu2KsR928AN7XiRMPQKMwDv8hjmZ9YH3Xtwz79EWRoEkq47+6C7+KMgwg Mo2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718131946; x=1718736746; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vHlv5x2OHBKEB1SJI2OIsaHBFgqbVYFZsZar4PCUosU=; b=bX7UUpyt9M37AhXRNUBnSBmSQ61JNQOCuBoPVc4KKsl5/VM1pEJAYPdcQKUdjxSQ+p yFMdG7/rGvITlVyypUcZKzuW/FUIuOAuNKlvyIdWF39wNkSYXfjsVEg88nhXOPOhNW24 lkKfNBMJhc+I4tU7yyKu/I+GUf0voNzobgFR7bdE4iY2ZZgeoR0WRoAx2MQbI+ieZgST 9z+jK+JiR0s8VIhbeT/s/IXIvhioTgZgDL0eo4QOpiSwDYNXRj+iM15eKsLpmXHtnLM3 82NAaFCvYuEiobIjxkzwlb8PA8L9aaLpngz4Flm6ZoXdr3J2Zy3srTLAFl43DkwW7BpT wZDw== X-Gm-Message-State: AOJu0YwLyFT7vKHWVXZeYoWubkwdPF1ffFAKT9koE7L7IhrJYxo3BVsB 3drOrb1D2+y6XO+p9VOMyvEo358iXl35fwFdpbqZCBXM5klhQwkWvtasdA== X-Received: by 2002:aa7:8890:0:b0:705:b9da:8148 with SMTP id d2e1a72fcca58-705b9da820amr795272b3a.26.1718131945581; Tue, 11 Jun 2024 11:52:25 -0700 (PDT) Received: from localhost.localdomain ([190.194.167.233]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd7f309csm104586015ad.263.2024.06.11.11.52.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 11:52:25 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jun 2024 15:52:32 -0300 Message-ID: <20240611185232.5384-3-jamrial@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240611185232.5384-1-jamrial@gmail.com> References: <20240611185232.5384-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avcodec: use the renamed av_zero_extend 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: i22R9EvFbqSt Signed-off-by: James Almer --- libavcodec/adpcm.c | 2 +- libavcodec/amrwbdec.c | 2 +- libavcodec/atrac3plus.c | 2 +- libavcodec/dnxhdenc.c | 2 +- libavcodec/dvenc.c | 2 +- libavcodec/ffv1dec_template.c | 2 +- libavcodec/g726.c | 2 +- libavcodec/g729dec.c | 2 +- libavcodec/h264_refs.c | 2 +- libavcodec/h264_slice.c | 4 ++-- libavcodec/hevc/cabac.c | 4 ++-- libavcodec/hevc/hevcdec.c | 20 ++++++++++---------- libavcodec/hevc/mvs.c | 4 ++-- libavcodec/hevc/pred_template.c | 4 ++-- libavcodec/hevc/ps.c | 4 ++-- libavcodec/mpeg12enc.c | 8 ++++---- libavcodec/opus_pvq.c | 4 ++-- libavcodec/opus_rc.c | 6 +++--- libavcodec/pixlet.c | 4 ++-- libavcodec/pngdec.c | 2 +- libavcodec/proresenc_anatoliy.c | 2 +- libavcodec/proresenc_kostya.c | 4 ++-- libavcodec/put_bits.h | 2 +- libavcodec/put_golomb.h | 2 +- libavcodec/speedhqenc.c | 8 ++++---- libavcodec/vulkan_hevc.c | 2 +- libavcodec/vvc/cabac.c | 8 ++++---- libavcodec/vvc/ctu.c | 8 ++++---- libavcodec/vvc/inter.c | 18 +++++++++--------- libavcodec/vvc/inter_template.c | 8 ++++---- libavcodec/vvc/intra_template.c | 2 +- libavcodec/vvc/intra_utils.c | 4 ++-- libavcodec/vvc/mvs.c | 2 +- 33 files changed, 76 insertions(+), 76 deletions(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 59b9ef3497..f63afefd63 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -493,7 +493,7 @@ static inline int16_t adpcm_ima_wav_expand_nibble(ADPCMChannelStatus *c, GetBitC step_index = av_clip(step_index, 0, 88); sign = nibble & (1 << shift); - delta = av_mod_uintp2(nibble, shift); + delta = av_zero_extend(nibble, shift); diff = ((2 * delta + 1) * step) >> shift; predictor = c->predictor; if (sign) predictor -= diff; diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 21a730b835..bb0864587a 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -370,7 +370,7 @@ static void decode_pitch_vector(AMRWBContext *ctx, } /** Get x bits in the index interval [lsb,lsb+len-1] inclusive */ -#define BIT_STR(x,lsb,len) av_mod_uintp2((x) >> (lsb), (len)) +#define BIT_STR(x,lsb,len) av_zero_extend((x) >> (lsb), (len)) /** Get the bit at specified position */ #define BIT_POS(x, p) (((x) >> (p)) & 1) diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c index 61753af73e..f17ed0cbb5 100644 --- a/libavcodec/atrac3plus.c +++ b/libavcodec/atrac3plus.c @@ -734,7 +734,7 @@ static void decode_qu_spectra(GetBitContext *gb, const Atrac3pSpecCodeTab *tab, val = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); for (i = 0; i < num_coeffs; i++) { - cf = av_mod_uintp2(val, bits); + cf = av_zero_extend(val, bits); if (is_signed) cf = sign_extend(cf, bits); else if (cf && get_bits1(gb)) diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 028604a6e5..771c706633 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -570,7 +570,7 @@ static av_always_inline void dnxhd_encode_dc(PutBitContext *pb, DNXHDEncContext } put_bits(pb, ctx->cid_table->dc_bits[nbits] + nbits, (ctx->cid_table->dc_codes[nbits] << nbits) + - av_mod_uintp2(diff, nbits)); + av_zero_extend(diff, nbits)); } static av_always_inline diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c index 3afeedbb87..71f9b71c7b 100644 --- a/libavcodec/dvenc.c +++ b/libavcodec/dvenc.c @@ -215,7 +215,7 @@ static av_always_inline PutBitContext *dv_encode_ac(EncBlockInfo *bi, if (bits_left) { size -= bits_left; put_bits(pb, bits_left, vlc >> size); - vlc = av_mod_uintp2(vlc, size); + vlc = av_zero_extend(vlc, size); } if (pb + 1 >= pb_end) { bi->partial_bit_count = size; diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c index 590ccac022..a90c28cd0e 100644 --- a/libavcodec/ffv1dec_template.c +++ b/libavcodec/ffv1dec_template.c @@ -121,7 +121,7 @@ static av_always_inline int RENAME(decode_line)(FFV1Context *s, int w, if (sign) diff = -(unsigned)diff; - sample[1][x] = av_mod_uintp2(RENAME(predict)(sample[1] + x, sample[0] + x) + (SUINT)diff, bits); + sample[1][x] = av_zero_extend(RENAME(predict)(sample[1] + x, sample[0] + x) + (SUINT)diff, bits); } s->run_index = run_index; return 0; diff --git a/libavcodec/g726.c b/libavcodec/g726.c index 6c5638760d..e048cd973e 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -302,7 +302,7 @@ static int16_t g726_encode(G726Context* c, int16_t sig) { uint8_t i; - i = av_mod_uintp2(quant(c, sig/4 - c->se), c->code_size); + i = av_zero_extend(quant(c, sig/4 - c->se), c->code_size); g726_decode(c, i); return i; } diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index 3e1be326d0..bf10a6dd33 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -536,7 +536,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, if (frame_erasure) { ctx->rand_value = g729_prng(ctx->rand_value); - fc_indexes = av_mod_uintp2(ctx->rand_value, format->fc_indexes_bits); + fc_indexes = av_zero_extend(ctx->rand_value, format->fc_indexes_bits); ctx->rand_value = g729_prng(ctx->rand_value); pulses_signs = ctx->rand_value; diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 99820142b9..5eb2855065 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -791,7 +791,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h) for (int i = 0; i < h->short_ref_count; i++) { H264Picture *pic = h->short_ref[i]; if (pic->invalid_gap) { - int d = av_mod_uintp2(h->cur_pic_ptr->frame_num - pic->frame_num, h->ps.sps->log2_max_frame_num); + int d = av_zero_extend(h->cur_pic_ptr->frame_num - pic->frame_num, h->ps.sps->log2_max_frame_num); if (d > h->ps.sps->ref_frame_count) remove_short(h, pic->frame_num, 0); } diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index ce2c4caca1..a66b75ca80 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1637,8 +1637,8 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, h->valid_recovery_point = 1; if ( h->recovery_frame < 0 - || av_mod_uintp2(h->recovery_frame - h->poc.frame_num, h->ps.sps->log2_max_frame_num) > sei_recovery_frame_cnt) { - h->recovery_frame = av_mod_uintp2(h->poc.frame_num + sei_recovery_frame_cnt, h->ps.sps->log2_max_frame_num); + || av_zero_extend(h->recovery_frame - h->poc.frame_num, h->ps.sps->log2_max_frame_num) > sei_recovery_frame_cnt) { + h->recovery_frame = av_zero_extend(h->poc.frame_num + sei_recovery_frame_cnt, h->ps.sps->log2_max_frame_num); if (!h->valid_recovery_point) h->recovery_frame = h->poc.frame_num; diff --git a/libavcodec/hevc/cabac.c b/libavcodec/hevc/cabac.c index 39ca7c0135..33f8241bb3 100644 --- a/libavcodec/hevc/cabac.c +++ b/libavcodec/hevc/cabac.c @@ -642,8 +642,8 @@ int ff_hevc_split_coding_unit_flag_decode(HEVCLocalContext *lc, const HEVCSPS *s { const HEVCContext *const s = lc->parent; int inc = 0, depth_left = 0, depth_top = 0; - int x0b = av_mod_uintp2(x0, sps->log2_ctb_size); - int y0b = av_mod_uintp2(y0, sps->log2_ctb_size); + int x0b = av_zero_extend(x0, sps->log2_ctb_size); + int y0b = av_zero_extend(y0, sps->log2_ctb_size); int x_cb = x0 >> sps->log2_min_cb_size; int y_cb = y0 >> sps->log2_min_cb_size; diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 88f2bcecad..b3b5f2ef57 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -1679,8 +1679,8 @@ static void chroma_mc_uni(HEVCLocalContext *lc, int idx = hevc_pel_weight[block_w]; int hshift = sps->hshift[1]; int vshift = sps->vshift[1]; - intptr_t mx = av_mod_uintp2(mv->x, 2 + hshift); - intptr_t my = av_mod_uintp2(mv->y, 2 + vshift); + intptr_t mx = av_zero_extend(mv->x, 2 + hshift); + intptr_t my = av_zero_extend(mv->y, 2 + vshift); intptr_t _mx = mx << (1 - hshift); intptr_t _my = my << (1 - vshift); int emu = src0 == s->cur_frame->f->data[1] || src0 == s->cur_frame->f->data[2]; @@ -1753,10 +1753,10 @@ static void chroma_mc_bi(HEVCLocalContext *lc, int hshift = sps->hshift[1]; int vshift = sps->vshift[1]; - intptr_t mx0 = av_mod_uintp2(mv0->x, 2 + hshift); - intptr_t my0 = av_mod_uintp2(mv0->y, 2 + vshift); - intptr_t mx1 = av_mod_uintp2(mv1->x, 2 + hshift); - intptr_t my1 = av_mod_uintp2(mv1->y, 2 + vshift); + intptr_t mx0 = av_zero_extend(mv0->x, 2 + hshift); + intptr_t my0 = av_zero_extend(mv0->y, 2 + vshift); + intptr_t mx1 = av_zero_extend(mv1->x, 2 + hshift); + intptr_t my1 = av_zero_extend(mv1->y, 2 + vshift); intptr_t _mx0 = mx0 << (1 - hshift); intptr_t _my0 = my0 << (1 - vshift); intptr_t _mx1 = mx1 << (1 - hshift); @@ -2020,8 +2020,8 @@ static int luma_intra_pred_mode(HEVCLocalContext *lc, const HEVCSPS *sps, int y_pu = y0 >> sps->log2_min_pu_size; int min_pu_width = sps->min_pu_width; int size_in_pus = pu_size >> sps->log2_min_pu_size; - int x0b = av_mod_uintp2(x0, sps->log2_ctb_size); - int y0b = av_mod_uintp2(y0, sps->log2_ctb_size); + int x0b = av_zero_extend(x0, sps->log2_ctb_size); + int y0b = av_zero_extend(y0, sps->log2_ctb_size); int cand_up = (lc->ctb_up_flag || y0b) ? s->tab_ipm[(y_pu - 1) * min_pu_width + x_pu] : INTRA_DC; @@ -2233,8 +2233,8 @@ static int hls_coding_unit(HEVCLocalContext *lc, const HEVCContext *s, lc->cu.cu_transquant_bypass_flag = 0; if (s->sh.slice_type != HEVC_SLICE_I) { - const int x0b = av_mod_uintp2(x0, sps->log2_ctb_size); - const int y0b = av_mod_uintp2(y0, sps->log2_ctb_size); + const int x0b = av_zero_extend(x0, sps->log2_ctb_size); + const int y0b = av_zero_extend(y0, sps->log2_ctb_size); uint8_t skip_flag = ff_hevc_skip_flag_decode(lc, x0b, y0b, x_cb, y_cb, min_cb_width); diff --git a/libavcodec/hevc/mvs.c b/libavcodec/hevc/mvs.c index 772fedceeb..96d8d58f39 100644 --- a/libavcodec/hevc/mvs.c +++ b/libavcodec/hevc/mvs.c @@ -43,8 +43,8 @@ static const uint8_t l0_l1_cand_idx[12][2] = { void ff_hevc_set_neighbour_available(HEVCLocalContext *lc, int x0, int y0, int nPbW, int nPbH, int log2_ctb_size) { - int x0b = av_mod_uintp2(x0, log2_ctb_size); - int y0b = av_mod_uintp2(y0, log2_ctb_size); + int x0b = av_zero_extend(x0, log2_ctb_size); + int y0b = av_zero_extend(y0, log2_ctb_size); lc->na.cand_up = (lc->ctb_up_flag || y0b); lc->na.cand_left = (lc->ctb_left_flag || x0b); diff --git a/libavcodec/hevc/pred_template.c b/libavcodec/hevc/pred_template.c index ca21774f75..b4c2fcf506 100644 --- a/libavcodec/hevc/pred_template.c +++ b/libavcodec/hevc/pred_template.c @@ -121,8 +121,8 @@ do { \ if (pps->constrained_intra_pred_flag == 1) { int size_in_luma_pu_v = PU(size_in_luma_v); int size_in_luma_pu_h = PU(size_in_luma_h); - int on_pu_edge_x = !av_mod_uintp2(x0, sps->log2_min_pu_size); - int on_pu_edge_y = !av_mod_uintp2(y0, sps->log2_min_pu_size); + int on_pu_edge_x = !av_zero_extend(x0, sps->log2_min_pu_size); + int on_pu_edge_y = !av_zero_extend(y0, sps->log2_min_pu_size); if (!size_in_luma_pu_h) size_in_luma_pu_h++; if (cand_bottom_left == 1 && on_pu_edge_x) { diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c index c02fc8b6c3..80ac35a7db 100644 --- a/libavcodec/hevc/ps.c +++ b/libavcodec/hevc/ps.c @@ -1258,8 +1258,8 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, sps->qp_bd_offset = 6 * (sps->bit_depth - 8); - if (av_mod_uintp2(sps->width, sps->log2_min_cb_size) || - av_mod_uintp2(sps->height, sps->log2_min_cb_size)) { + if (av_zero_extend(sps->width, sps->log2_min_cb_size) || + av_zero_extend(sps->height, sps->log2_min_cb_size)) { av_log(avctx, AV_LOG_ERROR, "Invalid coded frame dimensions.\n"); return AVERROR_INVALIDDATA; } diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index f956dde78f..cbda0ad3c9 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -693,12 +693,12 @@ static inline void encode_dc(MpegEncContext *s, int diff, int component) put_bits(&s->pb, ff_mpeg12_vlc_dc_lum_bits[index] + index, (ff_mpeg12_vlc_dc_lum_code[index] << index) + - av_mod_uintp2(diff, index)); + av_zero_extend(diff, index)); else put_bits(&s->pb, ff_mpeg12_vlc_dc_chroma_bits[index] + index, (ff_mpeg12_vlc_dc_chroma_code[index] << index) + - av_mod_uintp2(diff, index)); + av_zero_extend(diff, index)); } else { if (component == 0) put_bits(&s->pb, @@ -1100,12 +1100,12 @@ static av_cold void mpeg12_encode_init_static(void) bits = ff_mpeg12_vlc_dc_lum_bits[index] + index; code = (ff_mpeg12_vlc_dc_lum_code[index] << index) + - av_mod_uintp2(diff, index); + av_zero_extend(diff, index); mpeg1_lum_dc_uni[i + 255] = bits + (code << 8); bits = ff_mpeg12_vlc_dc_chroma_bits[index] + index; code = (ff_mpeg12_vlc_dc_chroma_code[index] << index) + - av_mod_uintp2(diff, index); + av_zero_extend(diff, index); mpeg1_chr_dc_uni[i + 255] = bits + (code << 8); } diff --git a/libavcodec/opus_pvq.c b/libavcodec/opus_pvq.c index 554a72609f..b16916fbfb 100644 --- a/libavcodec/opus_pvq.c +++ b/libavcodec/opus_pvq.c @@ -663,7 +663,7 @@ static av_always_inline uint32_t quant_band_template(CeltPVQ *pvq, CeltFrame *f, if (itheta == 0) { imid = 32767; iside = 0; - fill = av_mod_uintp2(fill, blocks); + fill = av_zero_extend(fill, blocks); delta = -16384; } else if (itheta == 16384) { imid = 0; @@ -878,7 +878,7 @@ static av_always_inline uint32_t quant_band_template(CeltPVQ *pvq, CeltFrame *f, for (i = 0; i < N0; i++) lowband_out[i] = n * X[i]; } - cm = av_mod_uintp2(cm, blocks); + cm = av_zero_extend(cm, blocks); } return cm; diff --git a/libavcodec/opus_rc.c b/libavcodec/opus_rc.c index 031332c9ce..0687e9e779 100644 --- a/libavcodec/opus_rc.c +++ b/libavcodec/opus_rc.c @@ -147,7 +147,7 @@ uint32_t ff_opus_rc_get_raw(OpusRangeCoder *rc, uint32_t count) rc->rb.bytes--; } - value = av_mod_uintp2(rc->rb.cacheval, count); + value = av_zero_extend(rc->rb.cacheval, count); rc->rb.cacheval >>= count; rc->rb.cachelen -= count; rc->total_bits += count; @@ -163,7 +163,7 @@ void ff_opus_rc_put_raw(OpusRangeCoder *rc, uint32_t val, uint32_t count) const int to_write = FFMIN(32 - rc->rb.cachelen, count); rc->total_bits += count; - rc->rb.cacheval |= av_mod_uintp2(val, to_write) << rc->rb.cachelen; + rc->rb.cacheval |= av_zero_extend(val, to_write) << rc->rb.cachelen; rc->rb.cachelen = (rc->rb.cachelen + to_write) % 32; if (!rc->rb.cachelen && count) { @@ -171,7 +171,7 @@ void ff_opus_rc_put_raw(OpusRangeCoder *rc, uint32_t val, uint32_t count) rc->rb.bytes += 4; rc->rb.position -= 4; rc->rb.cachelen = count - to_write; - rc->rb.cacheval = av_mod_uintp2(val >> to_write, rc->rb.cachelen); + rc->rb.cacheval = av_zero_extend(val >> to_write, rc->rb.cachelen); av_assert0(rc->rng_cur < rc->rb.position); } } diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c index b3baaf6260..6b6e39f275 100644 --- a/libavcodec/pixlet.c +++ b/libavcodec/pixlet.c @@ -162,7 +162,7 @@ static int read_low_coeffs(AVCodecContext *avctx, int16_t *dst, int size, continue; nbits = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24; - escape = av_mod_uintp2(16383, nbits); + escape = av_zero_extend(16383, nbits); cnt1 = get_unary(bc, 0, 8); if (cnt1 > 7) { rlen = get_bits(bc, 16); @@ -269,7 +269,7 @@ static int read_high_coeffs(AVCodecContext *avctx, const uint8_t *src, int16_t * continue; pfx = ((state + 8) >> 5) + (state ? ff_clz(state) : 32) - 24; - escape = av_mod_uintp2(16383, pfx); + escape = av_zero_extend(16383, pfx); cnt1 = get_unary(bc, 0, 8); if (cnt1 < 8) { if (pfx < 1 || pfx > 25) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 8934a95a7f..1c910e6a5b 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1018,7 +1018,7 @@ static int decode_trns_chunk(AVCodecContext *avctx, PNGDecContext *s, for (i = 0; i < length / 2; i++) { /* only use the least significant bits */ - v = av_mod_uintp2(bytestream2_get_be16(gb), s->bit_depth); + v = av_zero_extend(bytestream2_get_be16(gb), s->bit_depth); if (s->bit_depth > 8) AV_WB16(&s->transparent_color_be[2 * i], v); diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c index 8709f400d0..2300301af9 100644 --- a/libavcodec/proresenc_anatoliy.c +++ b/libavcodec/proresenc_anatoliy.c @@ -415,7 +415,7 @@ static void put_alpha_diff(PutBitContext *pb, int cur, int prev) const int dsize = 1 << dbits - 1; int diff = cur - prev; - diff = av_mod_uintp2(diff, abits); + diff = av_zero_extend(diff, abits); if (diff >= (1 << abits) - dsize) diff -= 1 << abits; if (diff < -dsize || diff > dsize || !diff) { diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c index b2b5f880ae..8b91ca1a98 100644 --- a/libavcodec/proresenc_kostya.c +++ b/libavcodec/proresenc_kostya.c @@ -477,7 +477,7 @@ static void put_alpha_diff(PutBitContext *pb, int cur, int prev, int abits) const int dsize = 1 << dbits - 1; int diff = cur - prev; - diff = av_mod_uintp2(diff, abits); + diff = av_zero_extend(diff, abits); if (diff >= (1 << abits) - dsize) diff -= 1 << abits; if (diff < -dsize || diff > dsize || !diff) { @@ -721,7 +721,7 @@ static int est_alpha_diff(int cur, int prev, int abits) const int dsize = 1 << dbits - 1; int diff = cur - prev; - diff = av_mod_uintp2(diff, abits); + diff = av_zero_extend(diff, abits); if (diff >= (1 << abits) - dsize) diff -= 1 << abits; if (diff < -dsize || diff > dsize || !diff) diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h index 4561dc131a..0caaa6b338 100644 --- a/libavcodec/put_bits.h +++ b/libavcodec/put_bits.h @@ -282,7 +282,7 @@ static inline void put_sbits(PutBitContext *pb, int n, int32_t value) { av_assert2(n >= 0 && n <= 31); - put_bits(pb, n, av_mod_uintp2(value, n)); + put_bits(pb, n, av_zero_extend(value, n)); } /** diff --git a/libavcodec/put_golomb.h b/libavcodec/put_golomb.h index df47fd2c0a..43c1233fdb 100644 --- a/libavcodec/put_golomb.h +++ b/libavcodec/put_golomb.h @@ -103,7 +103,7 @@ static inline void set_ur_golomb(PutBitContext *pb, int i, int k, int limit, e = i >> k; if (e < limit) - put_bits(pb, e + k + 1, (1 << k) + av_mod_uintp2(i, k)); + put_bits(pb, e + k + 1, (1 << k) + av_zero_extend(i, k)); else put_bits(pb, limit + esc_len, i - limit + 1); } diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c index 39ed244bca..4995b19f3b 100644 --- a/libavcodec/speedhqenc.c +++ b/libavcodec/speedhqenc.c @@ -82,12 +82,12 @@ static av_cold void speedhq_init_static_data(void) bits = ff_mpeg12_vlc_dc_lum_bits[index] + index; code = mpeg12_vlc_dc_lum_code_reversed[index] + - (av_mod_uintp2(diff, index) << ff_mpeg12_vlc_dc_lum_bits[index]); + (av_zero_extend(diff, index) << ff_mpeg12_vlc_dc_lum_bits[index]); speedhq_lum_dc_uni[i + 255] = bits + (code << 8); bits = ff_mpeg12_vlc_dc_chroma_bits[index] + index; code = mpeg12_vlc_dc_chroma_code_reversed[index] + - (av_mod_uintp2(diff, index) << ff_mpeg12_vlc_dc_chroma_bits[index]); + (av_zero_extend(diff, index) << ff_mpeg12_vlc_dc_chroma_bits[index]); speedhq_chr_dc_uni[i + 255] = bits + (code << 8); } @@ -182,12 +182,12 @@ static inline void encode_dc(PutBitContext *pb, int diff, int component) put_bits_le(pb, ff_mpeg12_vlc_dc_lum_bits[index] + index, mpeg12_vlc_dc_lum_code_reversed[index] + - (av_mod_uintp2(diff, index) << ff_mpeg12_vlc_dc_lum_bits[index])); + (av_zero_extend(diff, index) << ff_mpeg12_vlc_dc_lum_bits[index])); else put_bits_le(pb, ff_mpeg12_vlc_dc_chroma_bits[index] + index, mpeg12_vlc_dc_chroma_code_reversed[index] + - (av_mod_uintp2(diff, index) << ff_mpeg12_vlc_dc_chroma_bits[index])); + (av_zero_extend(diff, index) << ff_mpeg12_vlc_dc_chroma_bits[index])); } else { if (component == 0) put_bits_le(pb, diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c index 33a6326297..5228e41ad5 100644 --- a/libavcodec/vulkan_hevc.c +++ b/libavcodec/vulkan_hevc.c @@ -374,7 +374,7 @@ static void set_sps(const HEVCSPS *sps, int sps_idx, /* NOTE: This is the predicted, and *reordered* version. * Probably incorrect, but the spec doesn't say which version to use. */ str[i].used_by_curr_pic_flag = st_rps->used; - str[i].used_by_curr_pic_s0_flag = av_mod_uintp2(st_rps->used, str[i].num_negative_pics); + str[i].used_by_curr_pic_s0_flag = av_zero_extend(st_rps->used, str[i].num_negative_pics); str[i].used_by_curr_pic_s1_flag = st_rps->used >> str[i].num_negative_pics; for (int j = 0; j < str[i].num_negative_pics; j++) diff --git a/libavcodec/vvc/cabac.c b/libavcodec/vvc/cabac.c index a5ccccd1c0..0d45eec751 100644 --- a/libavcodec/vvc/cabac.c +++ b/libavcodec/vvc/cabac.c @@ -954,8 +954,8 @@ void get_left_top(const VVCLocalContext *lc, uint8_t *left, uint8_t *top, const VVCFrameContext *fc = lc->fc; const VVCSPS *sps = fc->ps.sps; const int min_cb_width = fc->ps.pps->min_cb_width; - const int x0b = av_mod_uintp2(x0, sps->ctb_log2_size_y); - const int y0b = av_mod_uintp2(y0, sps->ctb_log2_size_y); + const int x0b = av_zero_extend(x0, sps->ctb_log2_size_y); + const int y0b = av_zero_extend(y0, sps->ctb_log2_size_y); const int x_cb = x0 >> sps->min_cb_log2_size_y; const int y_cb = y0 >> sps->min_cb_log2_size_y; @@ -1132,8 +1132,8 @@ static int mtt_split_cu_vertical_flag_decode(VVCLocalContext *lc, const int x0, const VVCFrameContext *fc = lc->fc; const VVCSPS *sps = fc->ps.sps; const int min_cb_width = fc->ps.pps->min_cb_width; - const int x0b = av_mod_uintp2(x0, sps->ctb_log2_size_y); - const int y0b = av_mod_uintp2(y0, sps->ctb_log2_size_y); + const int x0b = av_zero_extend(x0, sps->ctb_log2_size_y); + const int y0b = av_zero_extend(y0, sps->ctb_log2_size_y); const int x_cb = x0 >> sps->min_cb_log2_size_y; const int y_cb = y0 >> sps->min_cb_log2_size_y; const int available_a = lc->ctb_up_flag || y0b; diff --git a/libavcodec/vvc/ctu.c b/libavcodec/vvc/ctu.c index 809510b93d..ce79f14288 100644 --- a/libavcodec/vvc/ctu.c +++ b/libavcodec/vvc/ctu.c @@ -713,8 +713,8 @@ static enum IntraPredMode luma_intra_pred_mode(VVCLocalContext* lc, const int in const int x_b = (x0 + cu->cb_width - 1) >> sps->min_cb_log2_size_y; const int y_b = (y0 - 1) >> sps->min_cb_log2_size_y; int min_cb_width = fc->ps.pps->min_cb_width; - int x0b = av_mod_uintp2(x0, sps->ctb_log2_size_y); - int y0b = av_mod_uintp2(y0, sps->ctb_log2_size_y); + int x0b = av_zero_extend(x0, sps->ctb_log2_size_y); + int y0b = av_zero_extend(y0, sps->ctb_log2_size_y); const int available_l = lc->ctb_left_flag || x0b; const int available_u = lc->ctb_up_flag || y0b; @@ -2508,8 +2508,8 @@ void ff_vvc_set_neighbour_available(VVCLocalContext *lc, const int x0, const int y0, const int w, const int h) { const int log2_ctb_size = lc->fc->ps.sps->ctb_log2_size_y; - const int x0b = av_mod_uintp2(x0, log2_ctb_size); - const int y0b = av_mod_uintp2(y0, log2_ctb_size); + const int x0b = av_zero_extend(x0, log2_ctb_size); + const int y0b = av_zero_extend(y0, log2_ctb_size); lc->na.cand_up = (lc->ctb_up_flag || y0b); lc->na.cand_left = (lc->ctb_left_flag || x0b); diff --git a/libavcodec/vvc/inter.c b/libavcodec/vvc/inter.c index aaf3230c1e..344a0a8c13 100644 --- a/libavcodec/vvc/inter.c +++ b/libavcodec/vvc/inter.c @@ -267,8 +267,8 @@ static void mc(VVCLocalContext *lc, int16_t *dst, const VVCFrame *ref, const Mv const int hs = fc->ps.sps->hshift[c_idx]; const int vs = fc->ps.sps->vshift[c_idx]; const int idx = av_log2(block_w) - 1; - const intptr_t mx = av_mod_uintp2(mv->x, 4 + hs) << (is_chroma - hs); - const intptr_t my = av_mod_uintp2(mv->y, 4 + vs) << (is_chroma - vs); + const intptr_t mx = av_zero_extend(mv->x, 4 + hs) << (is_chroma - hs); + const intptr_t my = av_zero_extend(mv->y, 4 + vs) << (is_chroma - vs); const int hpel_if_idx = (is_chroma || pu->merge_gpm_flag) ? 0 : pu->mi.hpel_if_idx; const int8_t *hf = INTER_FILTER(hpel_if_idx, mx); const int8_t *vf = INTER_FILTER(hpel_if_idx, my); @@ -295,8 +295,8 @@ static void mc_uni(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride const int idx = av_log2(block_w) - 1; const Mv *mv = &mvf->mv[lx]; const int is_chroma = !!c_idx; - const intptr_t mx = av_mod_uintp2(mv->x, 4 + hs) << (is_chroma - hs); - const intptr_t my = av_mod_uintp2(mv->y, 4 + vs) << (is_chroma - vs); + const intptr_t mx = av_zero_extend(mv->x, 4 + hs) << (is_chroma - hs); + const intptr_t my = av_zero_extend(mv->y, 4 + vs) << (is_chroma - vs); const int hpel_if_idx = is_chroma ? 0 : pu->mi.hpel_if_idx; const int8_t *hf = INTER_FILTER(hpel_if_idx, mx); const int8_t *vf = INTER_FILTER(hpel_if_idx, my); @@ -335,8 +335,8 @@ static void mc_bi(VVCLocalContext *lc, uint8_t *dst, const ptrdiff_t dst_stride, for (int i = L0; i <= L1; i++) { const Mv *mv = mvf->mv + i; - const int mx = av_mod_uintp2(mv->x, 4 + hs) << (is_chroma - hs); - const int my = av_mod_uintp2(mv->y, 4 + vs) << (is_chroma - vs); + const int mx = av_zero_extend(mv->x, 4 + hs) << (is_chroma - hs); + const int my = av_zero_extend(mv->y, 4 + vs) << (is_chroma - vs); const int ox = x_off + (mv->x >> (4 + hs)); const int oy = y_off + (mv->y >> (4 + vs)); const VVCFrame *ref = refs[i]; @@ -672,8 +672,8 @@ static int ciip_derive_intra_weight(const VVCLocalContext *lc, const int x0, con { const VVCFrameContext *fc = lc->fc; const VVCSPS *sps = fc->ps.sps; - const int x0b = av_mod_uintp2(x0, sps->ctb_log2_size_y); - const int y0b = av_mod_uintp2(y0, sps->ctb_log2_size_y); + const int x0b = av_zero_extend(x0, sps->ctb_log2_size_y); + const int y0b = av_zero_extend(y0, sps->ctb_log2_size_y); const int available_l = lc->ctb_left_flag || x0b; const int available_u = lc->ctb_up_flag || y0b; const int min_pu_width = fc->ps.pps->min_pu_width; @@ -971,7 +971,7 @@ static void pred_affine_blk(VVCLocalContext *lc) luma_prof_bi(lc, dst0, dst_stride, refp[L0], refp[L1], mv, x, y, sbw, sbh); } if (fc->ps.sps->r->sps_chroma_format_idc) { - if (!av_mod_uintp2(sby, vs) && !av_mod_uintp2(sbx, hs)) { + if (!av_zero_extend(sby, vs) && !av_zero_extend(sbx, hs)) { MvField mvc; derive_affine_mvc(&mvc, fc, mv, x, y, sbw, sbh); diff --git a/libavcodec/vvc/inter_template.c b/libavcodec/vvc/inter_template.c index a8068f4ba8..89effffb8f 100644 --- a/libavcodec/vvc/inter_template.c +++ b/libavcodec/vvc/inter_template.c @@ -47,7 +47,7 @@ static void av_always_inline FUNC(put_scaled)(uint8_t *_dst, const ptrdiff_t _ds for (int i = 0; i < width; i++) { const int tx = _x + dx * i; const int x = SCALED_INT(tx) - x0; - const int mx = av_mod_uintp2(tx >> shift1, shift2); + const int mx = av_zero_extend(tx >> shift1, shift2); const int8_t *filter = hf + mx * taps; const pixel *src = (pixel*)_src - extra_before * src_stride; @@ -61,7 +61,7 @@ static void av_always_inline FUNC(put_scaled)(uint8_t *_dst, const ptrdiff_t _ds for (int i = 0; i < height; i++) { const int ty = _y + dy * i; const int x = SCALED_INT(ty) - y0; - const int mx = av_mod_uintp2(ty >> shift1, shift2); + const int mx = av_zero_extend(ty >> shift1, shift2); const int8_t *filter = vf + mx * taps; tmp = tmp_array + extra_before; @@ -136,7 +136,7 @@ static void av_always_inline FUNC(put_uni_w_scaled)(uint8_t *_dst, const ptrdiff for (int i = 0; i < width; i++) { const int tx = _x + dx * i; const int x = SCALED_INT(tx) - x0; - const int mx = av_mod_uintp2(tx >> shift1, shift2); + const int mx = av_zero_extend(tx >> shift1, shift2); const int8_t *filter = hf + mx * taps; const pixel *src = (pixel*)_src - extra_before * src_stride; @@ -150,7 +150,7 @@ static void av_always_inline FUNC(put_uni_w_scaled)(uint8_t *_dst, const ptrdiff for (int i = 0; i < height; i++) { const int ty = _y + dy * i; const int x = SCALED_INT(ty) - y0; - const int mx = av_mod_uintp2(ty >> shift1, shift2); + const int mx = av_zero_extend(ty >> shift1, shift2); const int8_t *filter = vf + mx * taps; tmp = tmp_array + extra_before; diff --git a/libavcodec/vvc/intra_template.c b/libavcodec/vvc/intra_template.c index 1a4d5f6f93..62342c8142 100644 --- a/libavcodec/vvc/intra_template.c +++ b/libavcodec/vvc/intra_template.c @@ -99,7 +99,7 @@ static av_always_inline void FUNC(cclm_select_luma)(const VVCFrameContext *fc, { const VVCSPS *sps = fc->ps.sps; - const int b_ctu_boundary = !av_mod_uintp2(y0, sps->ctb_log2_size_y); + const int b_ctu_boundary = !av_zero_extend(y0, sps->ctb_log2_size_y); const int hs = sps->hshift[1]; const int vs = sps->vshift[1]; const ptrdiff_t stride = fc->frame->linesize[0] / sizeof(pixel); diff --git a/libavcodec/vvc/intra_utils.c b/libavcodec/vvc/intra_utils.c index 040aacdffe..8c40eb1b16 100644 --- a/libavcodec/vvc/intra_utils.c +++ b/libavcodec/vvc/intra_utils.c @@ -100,7 +100,7 @@ int ff_vvc_get_top_available(const VVCLocalContext *lc, const int x, const int y const int vs = sps->vshift[c_idx]; const int log2_ctb_size_v = sps->ctb_log2_size_y - vs; const int end_of_ctb_x = ((lc->cu->x0 >> sps->ctb_log2_size_y) + 1) << sps->ctb_log2_size_y; - const int y0b = av_mod_uintp2(y, log2_ctb_size_v); + const int y0b = av_zero_extend(y, log2_ctb_size_v); const int max_x = FFMIN(fc->ps.pps->width, end_of_ctb_x) >> hs; const ReconstructedArea *a; int px = x; @@ -130,7 +130,7 @@ int ff_vvc_get_left_available(const VVCLocalContext *lc, const int x, const int const int hs = sps->hshift[c_idx]; const int vs = sps->vshift[c_idx]; const int log2_ctb_size_h = sps->ctb_log2_size_y - hs; - const int x0b = av_mod_uintp2(x, log2_ctb_size_h); + const int x0b = av_zero_extend(x, log2_ctb_size_h); const int end_of_ctb_y = ((lc->cu->y0 >> sps->ctb_log2_size_y) + 1) << sps->ctb_log2_size_y; const int max_y = FFMIN(fc->ps.pps->height, end_of_ctb_y) >> vs; const ReconstructedArea *a; diff --git a/libavcodec/vvc/mvs.c b/libavcodec/vvc/mvs.c index b96e750272..42564b3e6f 100644 --- a/libavcodec/vvc/mvs.c +++ b/libavcodec/vvc/mvs.c @@ -549,7 +549,7 @@ static int is_a0_available(const VVCLocalContext *lc, const CodingUnit *cu) { const VVCFrameContext *fc = lc->fc; const VVCSPS *sps = fc->ps.sps; - const int x0b = av_mod_uintp2(cu->x0, sps->ctb_log2_size_y); + const int x0b = av_zero_extend(cu->x0, sps->ctb_log2_size_y); int cand_bottom_left; if (!x0b && !lc->ctb_left_flag) {