From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#74476: [PATCH] Explore JPEG loading without quantization Date: Sat, 30 Nov 2024 15:37:29 +0000 Message-ID: References: <871pz39v6p.fsf@ledu-giraud.fr> <86iks581nf.fsf@gnu.org> <87y11093gx.fsf@ledu-giraud.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32569"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 74476@debbugs.gnu.org To: Manuel Giraud Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 30 16:38:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tHPY2-0008LP-PP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Nov 2024 16:38:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHPXo-0002VM-Ac; Sat, 30 Nov 2024 10:38:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHPXm-0002V8-D8 for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2024 10:38:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tHPXm-00010n-4L for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2024 10:38:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:MIME-Version:References:From:Date:To:Subject; bh=BVm5GH8TVBWPQQsEy6Jnlb9ZaY/jkkVoyKriae6aRlA=; b=ml0Shb7BeMXG/6h56Y5uWMu3TCpxqchYW4mID9tWWfIlpDbvAeBZkR4mZjAsYKvQeKfXSG2I5fOCoiLoTKwv169UbTpf9sRQ4e0TvxmzInpLxhfrs1Y9SzuDK6G3HOz+Ik4MfZJyQjr7UAXzC/ZHKWoh/A6Vy5/Zfrw1TmQIQyIW3ZfuPV9BiD8Xm1ByGp3bCN51keAAcL4QmxmmD36ByRiw+lAwJ7stf7oVxkRZPQiMNFfQ6is8MnXye2IIw+GzBfny/AlRjW7jzdBYFxcWIJTi4V6F/1nACEamh9nuayViM216QMEOVbKV3uB8b+HmoChGq0bPYNLrxLt2ABBfqA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHPXl-00008n-V4 for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2024 10:38:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Nov 2024 15:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74476 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74476-submit@debbugs.gnu.org id=B74476.1732981059493 (code B ref 74476); Sat, 30 Nov 2024 15:38:01 +0000 Original-Received: (at 74476) by debbugs.gnu.org; 30 Nov 2024 15:37:39 +0000 Original-Received: from localhost ([127.0.0.1]:48315 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHPXO-00007t-Pe for submit@debbugs.gnu.org; Sat, 30 Nov 2024 10:37:39 -0500 Original-Received: from dane.soverin.net ([185.233.34.24]:54947) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHPXN-00007c-Lq for 74476@debbugs.gnu.org; Sat, 30 Nov 2024 10:37:38 -0500 Original-Received: from smtp.soverin.net (c04smtp-lb01.int.sover.in [10.10.4.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dane.soverin.net (Postfix) with ESMTPS id 4Y0vLg0nb3zyZC; Sat, 30 Nov 2024 15:37:31 +0000 (UTC) Original-Received: from smtp.soverin.net (smtp.soverin.net [10.10.4.100]) by soverin.net (Postfix) with ESMTPSA id 4Y0vLf4MH4zB4; Sat, 30 Nov 2024 15:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=idiocy.org; s=soverin; t=1732981050; bh=GGDrHynGsaZvJTqaLmskUXwl+A+OOdat5UxmpQiW5qA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jeZ/BLa1ZlnptCQTuDDEJvtmt5HkTiayOTLTQphxWhNEZGPG4aM0rzdrYP6tCW8I2 vPBLZolgtIRMrgxRYXriSnK/AaILjm7qN8w6i05lSWjcUFntVqFsgKKHPy1T9WZ3XA DitHUcgPxXnQm5fiOMqvLqN1/cR6w0bH/0IRIFjzsvDNn4sBYvvei4XC5arYyOEk0G 8EmLSuBZGdursQUwd1qpn9q+Bxl6hjL1tCmnt64KOvcY1e9tCsbXRwX6K/um9s+Em8 QJ8IVc5ajzvB0jbBv13xknDh4LyA4g1J1xVe6B8vQ4+01sFO+H/mUR8WTVfG04ul8c qya60ozZnpHiQ== Original-Received: from localhost (faroe.holly.idiocy.org [local]) by faroe.holly.idiocy.org (OpenSMTPD) with ESMTPA id 5539fa70; Sat, 30 Nov 2024 15:37:29 +0000 (UTC) Mail-Followup-To: Alan Third , Manuel Giraud , Eli Zaretskii , 74476@debbugs.gnu.org Content-Disposition: inline In-Reply-To: <87y11093gx.fsf@ledu-giraud.fr> X-Spampanel-Class: ham X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296169 Archived-At: On Sat, Nov 30, 2024 at 03:54:38PM +0100, Manuel Giraud wrote: > Alan Third writes: > > [...] > > > Manuel, I think you want to use lookup_rgb_color when setting the > > pixels in the final image buffer. This should do the right thing. You > > presumably also need to call init_color_table before using it, and I > > see calls to colors_in_color_table and free_color_table which look > > necessary, but I think they're already in the jpeg code. > > Hi Alan, > > I don't really understand: my proposed patch is getting rid of calls to > lookup_rgb_color and init_color_table. Yes, but they're internal Emacs functions, not related to libjpeg. All the other image library code uses them, so I think they are necessary to handle systems that use colour mapping (and possibly Windows too, it has a different implementation of lookup_rgb_color). For example, the PNG code looks like this: /* Fill the X image and mask from PNG data. */ init_color_table (); for (y = 0; y < height; ++y) { png_byte *p = rows[y]; for (x = 0; x < width; ++x) { int r, g, b; r = *p++ << 8; g = *p++ << 8; b = *p++ << 8; PUT_PIXEL (ximg, x, y, lookup_rgb_color (f, r, g, b)); ... -- Alan Third