include/it/transform2D.h

Go to the documentation of this file.
00001 /*
00002    libit - Library for basic source and channel coding functions
00003    Copyright (C) 2005-2008 Francois Cayre, 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   2D Transforms
00022   Copyright (C) 2005 Vivien Chappelier
00023 */
00024 
00025 #ifndef __it_transform2D_h
00026 #define __it_transform2D_h
00027 
00028 #include <it/types.h>
00029 #include <it/mat.h>
00030 
00031 /*---------------------------------------------------------------------------*/
00032 /*! \addtogroup transform                                                    */
00033 /* @{                                                                        */
00034 /*---------------------------------------------------------------------------*/
00035 
00036 typedef struct _it_transform2D_ {
00037   it_extends (it_object_t);
00038 
00039   Mat (*transform) (struct _it_transform2D_ * transform, Mat image);
00040   Mat (*itransform) (struct _it_transform2D_ * transform, Mat image);
00041 
00042   /* get the size of the output matrix */
00043   /* this is equal to input_size for critically sampled transforms */
00044   void (*get_output_size) (struct _it_transform2D_ * transform,
00045          idx_t * width, idx_t * height);
00046 
00047   /* fix the length of the vectors on which to apply the transform */
00048   void (*set_size) (struct _it_transform2D_ * transform, idx_t width,
00049         idx_t height);
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_transform2D_ * transform, idx_t * width,
00053         idx_t * height);
00054 
00055 } it_transform2D_t;
00056 
00057 #define IT_TRANSFORM2D(x) IT_CAST(it_transform2D_t, x)
00058 
00059 static inline it_instanciate (it_transform2D_t) {
00060   it_construct (it_object_t);
00061   it_set_magic (it_this, it_transform2D_t);
00062   return (it_this);
00063 }
00064 #define it_transform2D(t, image) __it_transform2D(IT_TRANSFORM2D(t), (Mat) image)
00065 static inline Mat __it_transform2D (it_transform2D_t * t, Mat image) {
00066   return (t->transform (t, image));
00067 }
00068 
00069 #define it_itransform2D(t, image) __it_itransform2D(IT_TRANSFORM2D(t), (Mat) image)
00070 static inline Mat __it_itransform2D (it_transform2D_t * t, Mat image) {
00071   return (t->itransform (t, image));
00072 }
00073 
00074 #define it_transform2D_get_output_size(t, w, h) \
00075             __it_transform2D_get_output_size(IT_TRANSFORM2D(t, w, h))
00076 static inline void __it_transform2D_get_output_size (it_transform2D_t * t,
00077                  idx_t * w, idx_t * h) {
00078   t->get_output_size (t, w, h);
00079 }
00080 
00081 #define it_transform2D_set_size(t, w, h) \
00082             __it_transform2D_set_size(IT_TRANSFORM2D(t), w, h)
00083 static inline void __it_transform2D_set_size (it_transform2D_t * t,
00084                 idx_t w, idx_t h) {
00085   t->set_size (t, w, h);
00086 }
00087 
00088 #define it_transform2D_get_size(t, w, h) \
00089             __it_transform_get_size(IT_TRANSFORM2D(t), l)
00090 static inline void __it_transform2D_get_size (it_transform2D_t * t,
00091                 idx_t * w, idx_t * h) {
00092   t->get_size (t, w, h);
00093 }
00094 
00095 #define it_transform2D_clear_size(t) it_transform2D_set_size(t, 0, 0)
00096 
00097 /* @} */
00098 
00099 
00100 #endif

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