From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Famulari Subject: Re: [PATCH 2/2] gnu: graphicsmagick: Build with 16 bit quantum depth. Date: Wed, 8 Mar 2017 13:54:25 -0500 Message-ID: <20170308185425.GA4625@jasmine> References: <20170307172647.944-1-arunisaac@systemreboot.net> <20170307172647.944-2-arunisaac@systemreboot.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clgjK-0006RX-Ef for guix-devel@gnu.org; Wed, 08 Mar 2017 13:54:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clgjG-0007gb-Hg for guix-devel@gnu.org; Wed, 08 Mar 2017 13:54:34 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:40073) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clgjG-0007gT-Aq for guix-devel@gnu.org; Wed, 08 Mar 2017 13:54:30 -0500 Content-Disposition: inline In-Reply-To: <20170307172647.944-2-arunisaac@systemreboot.net> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Arun Isaac Cc: guix-devel@gnu.org On Tue, Mar 07, 2017 at 10:56:47PM +0530, Arun Isaac wrote: > Octave requires graphicsmagick to be built with 16 bit quantum depth. > > * gnu/packages/imagemagick.scm (graphicsmagick)[arguments]: Add > "--with-quantum-depth=16" to #:configure-flags. In case anyone is wonder what this option does, here is documentation from source file 'www/INSTALL-unix.rst': --with-quantum-depth This option allows the user to specify the number of bits to use per pixel quantum (the size of the red, green, blue, and alpha pixel components. When an image file with less depth is read, smaller values are scaled up to this size for processing, and are scaled down from this size when a file with lower depth is written. For example, "--with-quantum-depth=8" builds GraphicsMagick using 8-bit quantums. Most computer display adaptors use 8-bit quantums. Currently supported arguments are 8, 16, or 32. The default is 8. This option is the most important option in determining the overall run-time performance of GraphicsMagick. The number of bits in a quantum determines how many values it may contain. Each quantum level supports 256 times as many values as the previous level. The following table shows the range available for various quantum sizes. ============ ===================== ================= QuantumDepth Valid Range (Decimal) Valid Range (Hex) ============ ===================== ================= 8 0-255 00-FF 16 0-65535 0000-FFFF 32 0-4294967295 00000000-FFFFFFFF ============ ===================== ================= Larger pixel quantums cause GraphicsMagick to run more slowly and to require more memory. For example, using sixteen-bit pixel quantums causes GraphicsMagick to run 15% to 50% slower (and take twice as much memory) than when it is built to support eight-bit pixel quantums. Regardless, the GraphicsMagick authors prefer to use sixteen-bit pixel quantums since they support all common image formats and assure that there is no loss of color precision. The amount of virtual memory consumed by an image can be computed by the equation (QuantumDepth*Rows*Columns*5)/8. This is an important consideration when resources are limited, particularly since processing an image may require several images to be in memory at one time. The following table shows memory consumption values for a 1024x768 image: ============ ============== QuantumDepth Virtual Memory ============ ============== 8 3MB 16 8MB 32 15MB ============ ============== GraphicsMagick performs all image processing computations using floating point or non-lossy integer arithmetic, so results are very accurate. Increasing the quantum storage size decreases the amount of quantization noise (usually not visible at 8 bits) and helps prevent countouring and posterization in the image. Consider also using the --enable-quantum-library-names configure option so that installed shared libraries include the quantum depth as part of their names so that shared libraries using different quantum depth options may co-exist in the same directory.