include/it/transform.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   Transforms
00022   Copyright (C) 2005 Vivien Chappelier
00023 */
00024 
00025 #ifndef __it_transform_h
00026 #define __it_transform_h
00027 
00028 #include <it/types.h>
00029 #include <it/mat.h>
00030 
00031 /*---------------------------------------------------------------------------*/
00032 /*! \addtogroup transform                                                    */
00033 /* @{                                                                        */
00034 /*---------------------------------------------------------------------------*/
00035 
00036 
00037 typedef struct _it_transform_ {
00038   it_extends (it_object_t);
00039 
00040   Vec (*transform) (struct _it_transform_ * transform, Vec v);
00041   Vec (*itransform) (struct _it_transform_ * transform, Vec V);
00042 
00043   /* get the length of the output vector */
00044   /* this is equal to input_size for critically sampled transforms */
00045   void (*get_output_size) (struct _it_transform_ * transform,
00046          idx_t * input_size);
00047 
00048   /* fix the length of the vectors on which to apply the transform */
00049   void (*set_size) (struct _it_transform_ * transform, idx_t length);
00050   /* get the length of the vectors on which to apply the transform */
00051   /* 0 means automatic allocation/deletion during tranform/itransform */
00052   void (*get_size) (struct _it_transform_ * transform, idx_t * length);
00053 
00054 } it_transform_t;
00055 
00056 #define IT_TRANSFORM(x) IT_CAST(it_transform_t, x)
00057 
00058 static inline it_instanciate (it_transform_t) {
00059   it_construct (it_object_t);
00060   it_set_magic (it_this, it_transform_t);
00061   return (it_this);
00062 }
00063 #define it_transform(t, v) __it_transform(IT_TRANSFORM(t), (Vec) v)
00064 static inline Vec __it_transform (it_transform_t * t, Vec v) {
00065   return (t->transform (t, v));
00066 }
00067 
00068 #define it_itransform(t, V) __it_itransform(IT_TRANSFORM(t), (Vec) V)
00069 static inline Vec __it_itransform (it_transform_t * t, Vec V) {
00070   return (t->itransform (t, V));
00071 }
00072 
00073 #define it_transform_get_output_size(t, l) \
00074             __it_transform_get_output_size(IT_TRANSFORM(t), l)
00075 static inline void __it_transform_get_output_size (it_transform_t * t,
00076                idx_t * l) {
00077   t->get_output_size (t, l);
00078 }
00079 
00080 #define it_transform_set_size(t, l) __it_transform_set_size(IT_TRANSFORM(t), l)
00081 static inline void __it_transform_set_size (it_transform_t * t, idx_t l) {
00082   t->set_size (t, l);
00083 }
00084 
00085 #define it_transform_get_size(t, l) __it_transform_get_size(IT_TRANSFORM(t), l)
00086 static inline void __it_transform_get_size (it_transform_t * t, idx_t * l) {
00087   t->get_size (t, l);
00088 }
00089 
00090 #define it_transform_clear_size(t) it_transform_set_size(t, 0)
00091 
00092 /* @} */
00093 
00094 #endif

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