From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: PNG pictures have gamma correction twice applied Date: Mon, 11 Nov 2002 05:20:08 -0500 Sender: emacs-devel-admin@gnu.org Message-ID: References: <200211061556.gA6FuCU6005082@localhost.localdomain> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1037200820 18727 80.91.224.249 (13 Nov 2002 15:20:20 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 13 Nov 2002 15:20:20 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18BzCx-0004AM-00 for ; Wed, 13 Nov 2002 16:13:35 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18BzOt-00066k-01 for ; Wed, 13 Nov 2002 16:25:56 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18BBxF-0004ZM-00; Mon, 11 Nov 2002 05:38:05 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18BBiJ-0005Mc-00 for emacs-devel@gnu.org; Mon, 11 Nov 2002 05:22:39 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18BBiF-0005MI-00 for emacs-devel@gnu.org; Mon, 11 Nov 2002 05:22:38 -0500 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by monty-python.gnu.org with esmtp (Exim 4.10) id 18BBfz-0004pz-00 for emacs-devel@gnu.org; Mon, 11 Nov 2002 05:20:15 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.10) id 18BBfs-0002H9-00; Mon, 11 Nov 2002 05:20:08 -0500 Original-To: David.Kastrup@t-online.de In-reply-to: (David.Kastrup@t-online.de) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:9325 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:9325 Would you like to rewrite the png code thoroughly? This table is used as some sort of a cache, in addition, and this cache is apparently not cleared or reused consistently when the gamma correction factor of the frame (gamma correction is a frame-local property) changes: If the lookup cannot be avoided completely, the caching may be worth while as an optimization. I am not saying that it is, since I have not studied the code, just that this is something you should consider. The size of the hash table is 101 entries, so if things like JPEG images are displayed, easily 100000 different colors can be achieved, and thus a single hash bucket might contain thousands of pixels. There needs to be a way to reallocate this hash table in case it gets too full. It would appear to me that the pictures should be made to bypass this lookup mechanism entirely: If that is possible, it would sure be better. All this is very much over the top where images are concerned: an operation far too costly to do for every pixel anew. If only the png library does its own gamma correction, it would seem Emacs should still do gamma correction for images itself. But perhaps it can do that in a more efficient way. nowadays), the whole pixel lookup and color allocation business is utterly unnecessary, anyway, since one can directly map requested color to available color We could keep the ability to do the lookup but use it only on devices where it is needed. Anyway, please do clean up this mess.