From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id AA8884CFED for ; Tue, 4 Nov 2025 16:10:20 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'P4XGIY3DWsJuBzug2YKez9MrGS4BNmKWn0uGUo0gnhA=', expected b'A535Z/sbGWToFDdt+GaxKJ8V719da2mBbi2YDOQ94nw=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1762272613; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=P4XGIY3DWsJuBzug2YKez9MrGS4BNmKWn0uGUo0gnhA=; b=1fmwKxFiMSmj4I/jQ1JV/boXtSBJkntLt6YpJm9ID4AzEivSwyk66jemKB6IbC/vLZ/iM ND7xnn00zgCYuOe7siF26eDI8iphBb+0rS4rWoobcd/fhDd645y/rd6+FIDTiWUeiRZiAHA uabJmUOf1YkWAJuyBGbGz26IoWEYIuQFXWBKdLfWiu+c2Wo6ibEoJaFouS+QkVLrk0VaPbs R6cMLuzZhti17cYD23tJNABkN6OSkI1+vtpC77kCtdt5F9snkqu9O52wA6zrlR8pX+dOWPA MEC5dCFiUD8HsvmsuREvxE9WZ2wrrCOlDZTiWNT9xpxG3u9pJXoQdUUtKMxQ== Received: from [172.19.0.2] (unknown [172.19.0.2]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 3853D68FB25; Tue, 4 Nov 2025 18:10:13 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1762272603; b=lt8uHVvYyrt+1tr/zBeHcG+NRRssDKAS13KO28DcEDTZOw0aV+D8k5+hXPHkynLi5DBzG kkofV0Vz1S8GZ/To3MXbdFz4pr8mhVC+qvlRJ7qsyW2iAdjluKtdCD5qwT3yLadWrSCIrAQ DqamHwHuNaRkycKmrHhk3ejK0eJHcCsXxwCjk1g/oJaRJl9p9FA5ZkuBtyDddyojXcjbWLO r+m8IggTpldPNIkcLWpEmf71tfbGdwhXmyLaPtJLp5LEOf8bRlb35F2+1LCauKOiVZ+XmKj 1V8HGTMlF5twtfBf35vkPuc7o6cBtyUiXMcjXs+0A1gChTow8uM1bYDDJ8jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1762272603; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=dZ2Q3O6tOCdlJwIQrlm2Z3L+j2kp2XVjjtAPMYkQ+no=; b=PDpOWe6LHX4vvHaLbXbrhUpJnho8yPnfW2jDBzxoJlHUk7Q3ZXLecHJlQFncTsDz3T8dG w0xffiikAHzVP61LMvzAWbwhcerf9YzZsepajq+qByoDL+3SPEjtB6z0uDr4ZZ0MrnAelkT Ahj+hQHCQQMkGSOnwjJGFWUz4cF9hXXaaZhukOSrsl4iYLKAXOxwIrMmw/VsnOIJdGngwYC Fu4WlFRORP3GeRR9CVQFcidwMMC3RUtQPfq0Af0nJS3PVw3jIyUszqvpnTI0TH1RABZ6st+ 54LU8LBhRrOr5I/E/6/On30rUHl/pxsCYaOOMF8uAKdid8Rv3Tv+VfHuMsEg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1762272596; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=A535Z/sbGWToFDdt+GaxKJ8V719da2mBbi2YDOQ94nw=; b=lQml5nTv1h18sX07R1R7X8K3bkoVwaByrNfqF8woV4bWxa21igP+Hi4I89KCBARaHDrmD VtggtZfpbWc4I7wEzp0AWKirmO8ez63OKd3YP+Wm60RImVRsWDI35tWRE9UzzmROc1ig4zA BoB0aROaZG62LrNqFBBy+wBHYP44rgomMLvs2ItXDKuOShCYJLduG43cwtTwid3VdeiZxmE l+eZ+rqri/KlCIBOVXCHDaTq4q1s94uEGMykT8hTIXpA+Jr1upPC3GlmhDPx2UOi9rUDyQ5 GYKHea/QRC0IACLscRDUD1BsP3hOHhuG9w1yoGOLOaDm8RdsTAmOu/VxLO0A== Received: from 02c22a36bd31 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id E912568FAE0 for ; Tue, 4 Nov 2025 18:09:55 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Tue, 04 Nov 2025 16:09:55 -0000 Message-ID: <176227259604.25.13430801497140127003@2cb04c0e5124> Message-ID-Hash: 27FDIAAC3PMEVUCC3FQXOYPN2WT7O4AN X-Message-ID-Hash: 27FDIAAC3PMEVUCC3FQXOYPN2WT7O4AN X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] WIP: swscale/range_convert: fix truncation bias in range conversion (PR #20836) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Ramiro Polla via ffmpeg-devel Cc: Ramiro Polla Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20836 opened by Ramiro Polla (ramiro) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20836 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20836.patch 384fe39623e932e68fe35af7d5b51fcd0a6c28fb introduced a regression in the range conversion offset calculation, resulting in a slight green tint. The offset being calculated was not taking into consideration a bias needed for correctly rounding the result from the multiplication stage, leading to a truncated value. Fixes issue #11646. Note this is still missing updating all fate results. >>From dec7df004722525fc0ba3c8b98c7248a90a7e617 Mon Sep 17 00:00:00 2001 From: Ramiro Polla Date: Tue, 4 Nov 2025 16:18:47 +0100 Subject: [PATCH] [WIP] swscale/range_convert: fix truncation bias in range conversion 384fe39623e932e68fe35af7d5b51fcd0a6c28fb introduced a regression in the range conversion offset calculation, resulting in a slight green tint. The offset being calculated was not taking into consideration a bias needed for correctly rounding the result from the multiplication stage, leading to a truncated value. Fixes issue #11646. Note this is still missing updating all fate results. --- libswscale/swscale.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index c3d64a67b8..f4c7eccac4 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -581,7 +581,8 @@ static void solve_range_convert(uint16_t src_min, uint16_t src_max, int total_shift = mult_shift + src_shift; *coeff = AV_CEIL_RSHIFT(((uint64_t) dst_range << total_shift) / src_range, src_shift); *offset = ((int64_t) dst_max << total_shift) - - ((int64_t) src_max << src_shift) * *coeff; + ((int64_t) src_max << src_shift) * *coeff + + (1U << (mult_shift - 1)); } static void init_range_convert_constants(SwsInternal *c) -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org