hipass.cpp

00001 
00002 /***************************************************************************
00003  *  hipass.cpp - Implementation of a generic hipass filter
00004  *
00005  *  Created: Thu Jun 16 17:12:16 2005
00006  *  Copyright  2005-2007  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #include <filters/hipass.h>
00025 #include <core/exception.h>
00026 
00027 #include <ippi.h>
00028 
00029 namespace firevision {
00030 #if 0 /* just to make Emacs auto-indent happy */
00031 }
00032 #endif
00033 
00034 /** @class FilterHipass <filters/hipass.h>
00035  * Hipass filter.
00036  */
00037 
00038 /** Constructor. */
00039 FilterHipass::FilterHipass()
00040   : Filter("FilterHipass")
00041 {
00042 }
00043 
00044 
00045 void
00046 FilterHipass::apply()
00047 {
00048   IppiSize size;
00049   size.width = src_roi[0]->width;
00050   size.height = src_roi[0]->height;
00051 
00052   IppStatus status;
00053 
00054   //                                    base + number of bytes to line y              + pixel bytes
00055   status = ippiFilterHipass_8u_C1R( src[0] + (src_roi[0]->start.y * src_roi[0]->line_step) + (src_roi[0]->start.x * src_roi[0]->pixel_step), src_roi[0]->line_step,
00056                                     dst + (dst_roi->start.y * dst_roi->line_step) + (dst_roi->start.x * dst_roi->pixel_step), dst_roi->line_step,
00057                                     size, ippMskSize3x3 );
00058 
00059   if ( status != ippStsNoErr ) {
00060     throw fawkes::Exception("Hipass filter failed with %i\n", status);
00061   }
00062 }
00063 
00064 } // end namespace firevision