From patchwork Fri Jul 5 00:21:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 50357 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp4017122vqv; Thu, 4 Jul 2024 18:19:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWfRbju4aln/iZPSerJ5p12EdXhJuXUN2sOxAVzDCyfq3hAxDAjGtpJW6B9jJN1+I5c4iV3mYajkkLeVtxJoL7hIUP8CvW5k593cA== X-Google-Smtp-Source: AGHT+IHMbj/sY+6LAQsI033RZ4tfWqM4CcA8olcPd8azHcMuweb00Z8dy43/j2RfK0Z9QBTZn5lW X-Received: by 2002:ac2:44d9:0:b0:52e:751a:a172 with SMTP id 2adb3069b0e04-52ea06a70f5mr2859814e87.49.1720142347466; Thu, 04 Jul 2024 18:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720142347; cv=none; d=google.com; s=arc-20160816; b=yMuodGqtz0LmfQSiIPr99+BTo5u8YSsEi6OGE2EHxMW9D+ay+7dqdT26uFKzwxgzuq 6DjEfq7yWwTBU6rQxY0IV1yMqVDxThST5h9ldaZYfxGMimvew8QmETO8T68Gv8dDP4Kw DAyRJyYcUw9vugQOfSWr4DZJHLMFR/2FH95Xj2v0RJ3poxLm2AOzKtmGY8Xup9KoZ8r7 8rGBSlapJopMh5beuTNQG2xEN40iM/kwfENxg/0gvCUZHLyVacVBoLCJD2+itL9kWBsy xaiJMeLSYJDA6LwfRpWvnuesTFiuQUCNGu3Q+BL2B8O/HofGPkgk6lJxWs6SpBkXbLMY eW3A== 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=8WVhci6XfNotYI9371xiZCdLFMj7T6Lie8jiK1vwOdQ=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=dO2dcJwaePk6PVWLElBkrpJ3RynXLRQeFNYI5e0WVx7pdF/z6yJG2Ns0VSb7IZ9chm Xx6yLtdu3ZMlQv2JADtZVZmzdhKjDLIY4jF+UoAd+xTGYIvq3eYiQqAeNjk17+CHnTG1 aCkXWnpXEP4UqAI2Nqs61PPQR9qjYzI3flVo3tk43QRYK0mc4w0rpBRKTMvpopWfr7nd rPH4qMem+75EledgCQEyhvp84ns8qt9FQDa2n3FRWzZe47n/29FOH7FQE5Q4WDyvSjtg i4xJzzjGade8xpyfrDMHenp6xKIwOmFsb2UWOeDD1F9ja2dtIMjz+E8/5jXuQgrOf8Bu 4I/w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=E7Ua8qiu; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a72ab0674acsi706258566b.498.2024.07.04.18.19.06; Thu, 04 Jul 2024 18:19:07 -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=@niedermayer.cc header.s=gm1 header.b=E7Ua8qiu; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 16ABD68DB0B; Fri, 5 Jul 2024 03:22:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 05EB368DA9B for ; Fri, 5 Jul 2024 03:22:07 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 3A9661BF203 for ; Fri, 5 Jul 2024 00:22:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1720138927; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vn0NNsk4RmqyH0BfAVtDhSAVV2Q27wSfSzagq5l8F3I=; b=E7Ua8qiuyQihLQoTrmh/1UYC9C3EKqCLnkQR8hpu7vlw1OujgSVZp5Pn4juLASvwm0KxeZ gpfQ/69KQ5pl7izKMlqfnhpvxDA5qNLYXqYQR2YcogkRu5xn2kM4MJX2Pr2Y9nhs3DVlId M2uOOeBGdgLmvNJ/AB/3hznmMmlfHCML+dQJl4W2il8xYD/fjuoxI37LdyG0DZcx7cRIuE 5p0BOi/SXWLuuY/kI2Dwew2uEUJn2Y5lE8sZTJh5ezbRaKkBAD/dyIVM/lOd7M9UuOyu8+ OyfVKka1EJC+ZEoDfJ26CgMQsi4++2Nsed8sWeEMi7ItjvV0rEAHfSW/MXDkEg== From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 5 Jul 2024 02:21:54 +0200 Message-ID: <20240705002156.1964272-13-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240705002156.1964272-1-michael@niedermayer.cc> References: <20240705002156.1964272-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 13/15] avcodec/mlpenc: Use 64 for ml, mr 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: dgTrWwtT3Upm Fixes: CID1604429 Overflowed constant Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer --- libavcodec/mlpenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c index 67e0e109aa0..06670de456e 100644 --- a/libavcodec/mlpenc.c +++ b/libavcodec/mlpenc.c @@ -1414,7 +1414,8 @@ static int estimate_coeff(MLPEncodeContext *ctx, MLPSubstream *s, int32_t maxl = INT32_MIN, maxr = INT32_MIN, minl = INT32_MAX, minr = INT32_MAX; int64_t summ = 0, sums = 0, suml = 0, sumr = 0, enl = 0, enr = 0; const int shift = 14 - ctx->rematrix_precision; - int32_t cf0, cf1, e[4], d[4], ml, mr; + int32_t cf0, cf1, e[4], d[4]; + int64_t ml, mr; int i, count = 0; for (int j = 0; j <= ctx->cur_restart_interval; j++) { @@ -1447,8 +1448,8 @@ static int estimate_coeff(MLPEncodeContext *ctx, MLPSubstream *s, summ -= FFABS(suml + sumr); sums -= FFABS(suml - sumr); - ml = maxl - minl; - mr = maxr - minr; + ml = maxl - (int64_t)minl; + mr = maxr - (int64_t)minr; if (!summ && !sums) return 0;