include/it/wavelet.h

Go to the documentation of this file.
00001 /*
00002    libit - Library for basic source and channel coding functions
00003    Copyright (C) 2005-2005 Vivien Chappelier, Herve Jegou
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public
00016    License along with this library; if not, write to the Free
00017    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 /*
00021   1D wavelet transform using lifting.
00022   Copyright (C) 2005 Vivien Chappelier, Herve Jegou
00023 */
00024 
00025 #ifndef __it_wavelet_h
00026 #define __it_wavelet_h
00027 
00028 #include <it/types.h>
00029 #include <it/mat.h>
00030 #include <it/transform.h>
00031 
00032 /*---------------------------------------------------------------------------*/
00033 /*! \addtogroup transform                                                    */
00034 /* @{                                                                        */
00035 /*---------------------------------------------------------------------------*/
00036 
00037 /* the lifting structure */
00038 typedef struct _wavelet_lifting_ {
00039   int const count;    /* number of lifting steps, must be even and > 0 */
00040   double const scale;   /* final scaling coefficient */
00041   double const *step;   /* steps in predict/update order */
00042 } it_wavelet_lifting_t;
00043 
00044 /* some predefined filters */
00045 extern it_wavelet_lifting_t const *it_wavelet_lifting_97;
00046 extern it_wavelet_lifting_t const *it_wavelet_lifting_53;
00047 
00048 typedef struct _it_wavelet_ {
00049   it_extends (it_transform_t);
00050 
00051   void (*it_overloaded (destructor)) (it_object_t * it_this);
00052 
00053   it_wavelet_lifting_t *lifting;
00054   idx_t length;   /* length of the vector to decompose */
00055   int  level;     /* current decomposition level    */
00056   int  levels;    /* number of decomposition levels */
00057   vec  current;   /* a double buffer of vectors     */
00058   vec  next;      /* for temporary processing       */
00059 
00060 } it_wavelet_t;
00061 
00062 #define IT_WAVELET(x) IT_CAST(it_wavelet_t, x)
00063 
00064 it_instanciate (it_wavelet_t);
00065 
00066 static inline it_wavelet_t *it_wavelet_new (it_wavelet_lifting_t const
00067               *lifting, int level) {
00068   return (it_new_va (it_wavelet_t) (it_va, lifting, level));
00069 }
00070 /* 1D wavelet transform and inverse transform */
00071 #define it_wavelet_transform(t, v) ((vec) it_transform(IT_WAVELET(t), (vec) v))
00072 #define it_wavelet_itransform(t, v) ((vec) it_itransform(IT_WAVELET(t), (vec) v))
00073 vec  it_dwt (vec v, it_wavelet_lifting_t const *lifting, int levels);
00074 vec  it_idwt (vec t, it_wavelet_lifting_t const *lifting, int levels);
00075 
00076 /*--------------------------------------------------------------------*/
00077 /* Split a vector containing all wavelet coefficients into several vectors,
00078    one for each subband.
00079    All the memory is allocated inside.                                      */
00080 vec *it_wavelet_split (vec wav, int nb_levels);
00081 vec  it_wavelet_merge (vec * subbands, int nb_level);
00082 
00083 /* @} */
00084 
00085 #endif

Hosted by
Copyright (C) 2005-2006 Hervé Jégou
Vivien Chappelier
Francois Cayre
libit logo courtesy of Jonathan Delhumeau