Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-h.b-one.net (mx-h.one.com [91.198.169.55])
	by mail9.b-one.net (Postfix) with ESMTP id 4958C400B7B
	for <info@awaresystems.be>; Tue, 11 May 2010 21:21:22 +0200 (CEST)
Received: by mx-h.b-one.net (Postfix, from userid 106)
	id 3F44517D06E7; Tue, 11 May 2010 21:21:22 +0200 (CEST)
X-Virus-Scanned: by one.com
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=4 tests=[none]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144]) by
 mx-h.b-one.net (Postfix) with ESMTP id 6AF3C17D06E7 for
 <info@awaresystems.be>; Tue, 11 May 2010 21:21:21 +0200 (CEST)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
 lists.maptools.org (Postfix) with ESMTP id 523461D18FB39; Tue, 11 May 2010
 14:20:13 -0500 (EST)
Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.25])
 by lists.maptools.org (Postfix) with ESMTP id 9906D1D52D068 for
 <tiff@lists.maptools.org>; Tue, 11 May 2010 14:15:32 -0500 (EST)
Received: by ey-out-2122.google.com with SMTP id 4so34697eyf.41 for
 <tiff@lists.maptools.org>; Tue, 11 May 2010 12:15:32 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.102.240.34 with SMTP id n34mr3712583muh.31.1273605331886;
 Tue,  11 May 2010 12:15:31 -0700 (PDT)
Received: by 10.103.170.20 with HTTP; Tue, 11 May 2010 12:15:31 -0700 (PDT)
In-Reply-To: <4BE994E4.1000501@kreisbote.de>
References: <4BE98CD9.5080305@cybox.com> <4BE994E4.1000501@kreisbote.de>
Date: Tue, 11 May 2010 15:15:31 -0400
Message-ID: <AANLkTinu3uzWSv3qJ3Aa_JbW0SxuXpvwFvkXeV8H_Rcv@mail.gmail.com>
From: Olivier Paquet <olivier.paquet@gmail.com>
To: Oliver Geisen <oliver.geisen@kreisbote.de>
Cc: tiff@lists.maptools.org
Subject: Re: [Tiff] Combining multiple G4 images into a single output image
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

2010/5/11 Oliver Geisen <oliver.geisen@kreisbote.de>:
> bit shifting. I'm not really shure what it means to do such massive
> shifting operations. It really depends on the size of the images to be

It really means nothing if you put a minimal amount of work into the
implementation (ie. process more than one bit at a time). You are far
more likely to be limited by file I/O and decompression/compression.
For example, on a 2.2 GHz athlon 64 I can shift almost 1 GB/s in-place
(a little less if copying) with this basic code:

    unsigned *buffer = ...
    unsigned prev = 0;
    for( unsigned i = 0; i < n; ++i )
    {
        unsigned b = buffer[i];
        buffer[i] = prev | (b >> rshift);
        prev = b << (32 - rshift);
    }

which by the way does not work if rshift == 0 or rshift >= 32. You
will need to do a little patching on the edges of the image but it
won't matter in the overall run time. By the way, for those edges, you
can generate a mask for the leftmost (or rightmost) n bits easily
with:
unsigned rightmost = (1u << n) - 1u; /* for n 0 to 31 */
unsigned leftmost = INT_MIN >> (n - 1); /* for n 1 to 32 */

That will let you copy only some bits in a word easily. Note that all
that code assumes a 32-bit unsigned type. You should use whatever
typedef your environment provides to ensure you get that (eg. uint32_t
or similar).

Olivier
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
