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 800F64D0AF for ; Mon, 8 Dec 2025 17:57:05 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'cGPdzUoWEE0Go9kSFGUgVTb0gXrkYjQyaCBvFDcrnVc=', expected b'ERGZ9w7IjOzxE+kDZu1eeZzGq9ArHB0f61a0WFL96N0=')) 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=1765216615; 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=cGPdzUoWEE0Go9kSFGUgVTb0gXrkYjQyaCBvFDcrnVc=; b=roZXpzj+0tc4z4Wcys1PdJ0z8LvvlPrd8sTuze4XLF+MIEBaqiUo00v6JAlg5TJfI9ePl RfVe7P8XtIMo+1qfaf9EmPHj0YaO3oVNexfHEXIckNHuwTrIx+K6sS8FhDCI1FkshajhHKu zYC/o5GlMhQfKeI3w30mP8ml3Mcplagdbxv4322D1DePBDU2fVSns9B3OJkkY4x6iWKHeng PjDIg6/9Fjre7MwvBS8mdo6fCChGa/OBuoGor/MF9GIfNg6IimTc1G/yZCzdVgGBSdat6xL FU/Ap5Owf7v24GlkHGE8Q1uThG1vQVHDpjzfHc971FjaScgPTyklHK5hU42g== Received: from [172.19.0.3] (unknown [172.19.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 879EE690657; Mon, 8 Dec 2025 19:56:55 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1765216600; b=t+kBabuwQDVPNswHirvpUgXbP4Ri7nrv0cdg7HyPyKJyP3ISB8wbHgWdWK1q24clLvRR3 DiWj77TfyTvGnUWe0YamLdlqUIK0no6FJu9SrUmLBdv0pk/9ixF0xNW1JWvQUaVPwogniF2 /hZbL6zkvzBYbLAHI4jL9O8HeuJBfIA+y3mZsvaITpaH+j61zH4vnQbFdiuP2NtrnoGyGaO EEqtckZIC/9jgwzyt8zSspZ0cp6VpyOzjts5DeZOdEVWvdnrcqJOTmN3TPevt5r0iwAZNZ2 +vJwY4SFtlO6leoIUy85hXk/COk26/7XKRTsYQcOL32DsUiL1SCuA/ggXc6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1765216600; 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=4K5FHEkWJsyNbtm2dnnHEXEkDCrSVLaf5ELCbQTH60M=; b=g/0AGmwZGuI0L2MERBHX4wqpWm71+W/4HoGkqqF+sHcQxknM1Kk8oglr4xSTteMddp2nS /iN4Zv9x2m5G3w8fKZq+AAvmPJVjGJL5nXOzXpyAXduGnVIh1gX08/qpyIroQ4fhDpXKbhU ygaBWqE/vSZDRuSw01LqDkCojpw3Et9LyvXQaqluS6mhVjfNtwRYacv9YoYcwPX2uacyN89 MhbUIP30f0u8NoDcGipkui1NZeZtQnBxVmZhL1roAALAc+wqQf+dtRmbiKzWR1mCGSvNEez Ah3ximoAU5qS2YXzHjXp13EICN+zKfmZK0pDrC/ltBnk7A4wFMB08sS73AEg== 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=1765216593; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=ERGZ9w7IjOzxE+kDZu1eeZzGq9ArHB0f61a0WFL96N0=; b=RPg9bxslTdR4rx9OoU0vH5a6yetqUqOecOM2TT+jkrrFoso/kKcfGUGf3O3Hzet9KO2pr frdXuqAERbLznr6nYcpCyg/S3W7x6HuCfqGYh/oCkAEU41l7HddkG0SQcZ6BC29WmDfy2oT 8SdIOCEFmn3YrutaJUVA4ds41c3Xw66RiGA7nlLdzHp0gsL5N9Is9h9Xc/xcdlzpGbmkd3F BmFTsU2dR6LShQ9DOWU1laifFPg2C4SwMzk5hf41nKVRUpGgJ/5UTKBz/zCIt2QkPdPio5m GYAxfcYA7PSnuToe34HR5jt4iitWF3jw38DjqbzXY3LLcSNedyWwLUp6m1Qw== Received: from 55ca25703178 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 395AB690172 for ; Mon, 8 Dec 2025 19:56:33 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Mon, 08 Dec 2025 17:56:32 -0000 Message-ID: <176521659331.39.15123593980835721327@2cb04c0e5124> Message-ID-Hash: 5QV7NJVZDXU3ZD5EJ55KPCR7TNAM2SPD X-Message-ID-Hash: 5QV7NJVZDXU3ZD5EJ55KPCR7TNAM2SPD 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] swscale/optimizer: improve and properly document range tracking (PR #21135) 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: Niklas Haas via ffmpeg-devel Cc: Niklas Haas Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21135 opened by Niklas Haas (haasn) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21135 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21135.patch >>From b1b2c20d1cfc71765e51fdb0e30abe8ded0eb20b Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Mon, 8 Dec 2025 18:38:36 +0100 Subject: [PATCH 1/2] swscale/ops_optimizer: set correct value range for subpixel reads e.g. rgb4 only reads values up to 15, not 255. Setting this correctly eliminates a number of redundant clamps in cases like e.g. rgb4 -> monow. --- libswscale/ops_optimizer.c | 2 +- tests/ref/fate/sws-ops-list | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/ops_optimizer.c b/libswscale/ops_optimizer.c index b13e7ebdc1..f173e1f78f 100644 --- a/libswscale/ops_optimizer.c +++ b/libswscale/ops_optimizer.c @@ -97,7 +97,7 @@ void ff_sws_op_list_update_comps(SwsOpList *ops) case SWS_OP_READ: for (int i = 0; i < op->rw.elems; i++) { if (ff_sws_pixel_type_is_int(op->type)) { - int bits = 8 * ff_sws_pixel_type_size(op->type); + int bits = 8 * ff_sws_pixel_type_size(op->type) >> op->rw.frac; if (!op->rw.packed && ops->src.desc) { /* Use legal value range from pixdesc if available; * we don't need to do this for packed formats because diff --git a/tests/ref/fate/sws-ops-list b/tests/ref/fate/sws-ops-list index f77c60fde3..132f66f4fc 100644 --- a/tests/ref/fate/sws-ops-list +++ b/tests/ref/fate/sws-ops-list @@ -1 +1 @@ -e124847bc6663ca538b784de17bf42f0 +eae3a49ac3af42c13ad274883611ac21 -- 2.49.1 >>From 8383bd2db8ba30693912f536deb32d2ddea53a13 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Mon, 8 Dec 2025 18:53:33 +0100 Subject: [PATCH 2/2] swscale/ops: clarify SwsOpList.src/dst semantics Turns out these are not, in fact, purely informative - but the optimizer can take them into account. This should be documented properly. I tried to think of a way to avoid needing this in the optimizer, but any way I could think of would require shoving this to SwsReadWriteOp, which I am particularly unwilling to do. --- libswscale/ops.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libswscale/ops.h b/libswscale/ops.h index dccc00d2f0..14edc77978 100644 --- a/libswscale/ops.h +++ b/libswscale/ops.h @@ -209,8 +209,8 @@ typedef struct SwsOpList { SwsOp *ops; int num_ops; - /* Purely informative metadata associated with this operation list */ - SwsFormat src, dst; + /* Metadata associated with this operation list */ + SwsFormat src, dst; /* if set; may inform the optimizer about e.g value ranges */ } SwsOpList; SwsOpList *ff_sws_op_list_alloc(void); -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org