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 /** @class FilterHipass <filters/hipass.h>
00030  * Hipass filter.
00031  */
00032 
00033 /** Constructor. */
00034 FilterHipass::FilterHipass()
00035   : Filter("FilterHipass")
00036 {
00037 }
00038
00039
00040 void
00041 FilterHipass::apply()
00042 {
00043   IppiSize size;
00044   size.width = src_roi[0]->width;
00045   size.height = src_roi[0]->height;
00046
00047   IppStatus status;
00048
00049   //                                    base + number of bytes to line y              + pixel bytes
00050   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,
00051                                     dst + (dst_roi->start.y * dst_roi->line_step) + (dst_roi->start.x * dst_roi->pixel_step), dst_roi->line_step,
00052                                     size, ippMskSize3x3 );
00053
00054   if ( status != ippStsNoErr ) {
00055     throw fawkes::Exception("Hipass filter failed with %i\n", status);
00056   }
00057 }