IntegerMathEngine.C

Go to the documentation of this file.
00001 /*!@file Channels/IntegerMathEngine.C */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00005 // by the University of Southern California (USC) and the iLab at USC.  //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file: Rob Peters <rjpeters at usc dot edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Channels/IntegerMathEngine.C $
00035 // $Id: IntegerMathEngine.C 8160 2007-03-21 21:34:16Z rjpeters $
00036 //
00037 
00038 #ifndef CHANNELS_INTEGERMATHENGINE_C_DEFINED
00039 #define CHANNELS_INTEGERMATHENGINE_C_DEFINED
00040 
00041 #include "Channels/IntegerMathEngine.H"
00042 
00043 #include "Channels/ChannelOpts.H"
00044 #include "Component/ModelOptionDef.H"
00045 #include "Image/c_integer_math_ops.h"
00046 
00047 IntegerMathEngine::IntegerMathEngine(OptionManager& mgr)
00048   :
00049   ModelComponent(mgr, "Integer Math Engine", "IntegerMathEngine"),
00050   itsScaleBits(&OPT_IntChannelScaleBits, this),
00051   itsLowPass5(&OPT_IntMathLowPass5, this),
00052   itsLowPass9(&OPT_IntMathLowPass9, this),
00053   itsImath()
00054 {
00055 
00056   itsImath.nbits = 30;
00057   itsImath.low_pass_5_x_dec_x_manybits = &c_intg_low_pass_5_x_dec_x_manybits;
00058   itsImath.low_pass_5_y_dec_y_manybits = &c_intg_low_pass_5_y_dec_y_manybits;
00059   itsImath.low_pass_5_x_dec_x_fewbits = &c_intg_low_pass_5_x_dec_x_fewbits;
00060   itsImath.low_pass_5_y_dec_y_fewbits = &c_intg_low_pass_5_y_dec_y_fewbits;
00061   itsImath.low_pass_9_x_manybits = &c_intg_low_pass_9_x_manybits;
00062   itsImath.low_pass_9_y_manybits = &c_intg_low_pass_9_y_manybits;
00063   itsImath.low_pass_9_x_fewbits = &c_intg_low_pass_9_x_fewbits;
00064   itsImath.low_pass_9_y_fewbits = &c_intg_low_pass_9_y_fewbits;
00065   itsImath.x_filter_clean_manybits = &c_intg_x_filter_clean_manybits;
00066   itsImath.x_filter_clean_fewbits = &c_intg_x_filter_clean_fewbits;
00067   itsImath.x_filter_clean_small_manybits = &c_intg_x_filter_clean_small_manybits;
00068   itsImath.x_filter_clean_small_fewbits = &c_intg_x_filter_clean_small_fewbits;
00069   itsImath.y_filter_clean_manybits = &c_intg_y_filter_clean_manybits;
00070   itsImath.y_filter_clean_fewbits = &c_intg_y_filter_clean_fewbits;
00071   itsImath.y_filter_clean_small_manybits = &c_intg_y_filter_clean_small_manybits;
00072   itsImath.y_filter_clean_small_fewbits = &c_intg_y_filter_clean_small_fewbits;
00073 
00074 }
00075 
00076 void IntegerMathEngine::paramChanged(ModelParamBase* const param,
00077                                      const bool valueChanged,
00078                                      ParamClient::ChangeStatus* status)
00079 {
00080   ModelComponent::paramChanged(param, valueChanged, status);
00081 
00082   if (param == &itsScaleBits)
00083     itsImath.nbits = itsScaleBits.getVal();
00084 
00085   else if (param == &itsLowPass5)
00086     {
00087       if (itsLowPass5.getVal().compare("lp5std") == 0)
00088         {
00089           itsImath.low_pass_5_x_dec_x_manybits = &c_intg_low_pass_5_x_dec_x_manybits;
00090           itsImath.low_pass_5_y_dec_y_manybits = &c_intg_low_pass_5_y_dec_y_manybits;
00091           itsImath.low_pass_5_x_dec_x_fewbits = &c_intg_low_pass_5_x_dec_x_fewbits;
00092           itsImath.low_pass_5_y_dec_y_fewbits = &c_intg_low_pass_5_y_dec_y_fewbits;
00093         }
00094       else if (itsLowPass5.getVal().compare("lp5optim") == 0)
00095         {
00096           itsImath.low_pass_5_x_dec_x_manybits = &c_intg_low_pass_5_x_dec_x_manybits;
00097           itsImath.low_pass_5_y_dec_y_manybits = &c_intg_low_pass_5_y_dec_y_manybits;
00098           itsImath.low_pass_5_x_dec_x_fewbits = &c_intg_low_pass_5_x_dec_x_fewbits_optim;
00099           itsImath.low_pass_5_y_dec_y_fewbits = &c_intg_low_pass_5_y_dec_y_fewbits_optim;
00100         }
00101       else
00102         {
00103           LFATAL("Invalid value for --%s; "
00104                  "valid values are lp5std, lp5optim",
00105                  itsLowPass5.getOptionDef()->longoptname);
00106         }
00107 
00108       LINFO("Using lowpass5 algorithm '%s'",
00109             itsLowPass5.getVal().c_str());
00110     }
00111 
00112   else if (param == &itsLowPass9)
00113     {
00114       if (itsLowPass9.getVal().compare("lp9std") == 0)
00115         {
00116           itsImath.low_pass_9_x_manybits = &c_intg_low_pass_9_x_manybits;
00117           itsImath.low_pass_9_y_manybits = &c_intg_low_pass_9_y_manybits;
00118           itsImath.low_pass_9_x_fewbits = &c_intg_low_pass_9_x_fewbits;
00119           itsImath.low_pass_9_y_fewbits = &c_intg_low_pass_9_y_fewbits;
00120         }
00121       else if (itsLowPass9.getVal().compare("lp9optim") == 0)
00122         {
00123           itsImath.low_pass_9_x_manybits = &c_intg_low_pass_9_x_manybits;
00124           itsImath.low_pass_9_y_manybits = &c_intg_low_pass_9_y_manybits;
00125           itsImath.low_pass_9_x_fewbits = &c_intg_low_pass_9_x_fewbits_optim;
00126           itsImath.low_pass_9_y_fewbits = &c_intg_low_pass_9_y_fewbits_optim;
00127         }
00128       else
00129         {
00130           LFATAL("Invalid value for --%s; "
00131                  "valid values are lp9std, lp9optim",
00132                  itsLowPass9.getOptionDef()->longoptname);
00133         }
00134 
00135       LINFO("Using lowpass9 algorithm '%s'",
00136             itsLowPass9.getVal().c_str());
00137     }
00138 
00139 }
00140 
00141 // ######################################################################
00142 /* So things look consistent in everyone's emacs... */
00143 /* Local Variables: */
00144 /* mode: c++ */
00145 /* indent-tabs-mode: nil */
00146 /* End: */
00147 #endif // CHANNELS_INTEGERMATHENGINE_C_DEFINED
Generated on Sun May 8 08:04:41 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3