gml_HaarLookup.h

Go to the documentation of this file.
00001 /**
00002  * @file gml_HaarLookup.h
00003  *
00004  *  Lookup tables for a lookup-based pseudo S-transform.
00005  *
00006  *  The generation of the lookup tables is described in
00007  *  "REVERSIBLE N-BIT TO N-BIT INTEGER HAAR-LIKE TRANSFORMS", by
00008  *  Joshua G. Senecal, Mark A. Duchaineau, and Kenneth I. Joy.
00009  *
00010  * Copyright (c) 2004 CLIPS-IMAG
00011  *
00012  * See the file "gml_LicenseTerms.txt" for information on usage and redistribution
00013  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
00014  *
00015  *  Created on January 14, 2004 (JL).
00016  */
00017 
00018 #ifndef __GML_HAAR_LOOKUP__
00019 #define __GML_HAAR_LOOKUP__
00020 
00021 #include <stdlib.h>
00022 
00023 #include "gml/base/gml_Types.h"
00024 
00025 extern UInt16 const gml_HaarLookup_AB2HL[256*256];
00026 extern UInt16 const gml_HaarLookup_HL2AB[256*256];
00027 
00028 /** gml_HaarLookup_Forward --
00029  *
00030  *    Map two consecutive samples <a> and <b> to a high-resolution
00031  *    information <h> and a low-resolution information <l>.
00032  */
00033 inline static
00034 void gml_HaarLookup_Forward (UInt8 a, UInt8 b, UInt8* h, UInt8* l)
00035 {
00036   UInt16 const v = gml_HaarLookup_AB2HL[ (UInt16(a) << 8) | b ];
00037   *h = v >> 8;
00038   *l = v &  0xFF;
00039 }
00040 
00041 /** gml_HaarLookup_Forward --
00042  *
00043  *    Inverse operation of gml_HaarLookup_Forward().
00044  */
00045 inline static
00046 void gml_HaarLookup_Reverse (UInt8 h, UInt8 l, UInt8* a, UInt8* b)
00047 {
00048   UInt16 const v = gml_HaarLookup_HL2AB[ (UInt16(h) << 8) | l ];
00049   *a = v >> 8;
00050   *b = v &  0xFF;
00051 }
00052 
00053 
00054 #endif /* __GML_HAAR_LOOKUP__ */
00055 
Generated on Tue Jun 12 14:03:27 2007 for gml by Doxygen 1.5.2.