sharpen.cpp

00001
00002 /***************************************************************************
00003  *  sharpen.cpp - Implementation of the sharpen filter
00004  *
00005  *  Created: Thu Jun 16 16:13:15 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/sharpen.h>
00025
00026 #include <core/exception.h>
00027
00028 #include <ippi.h>
00029 
00030 /** @class FilterSharpen <filters/sharpen.h>
00031  * Sharpen filter.
00032  * @author Tim Niemueller
00033  */
00034 
00035 /** Constructor. */
00036 FilterSharpen::FilterSharpen()
00037   : Filter("FilterSharpen")
00038 {
00039 }
00040
00041
00042 void
00043 FilterSharpen::apply()
00044 {
00045   IppiSize size;
00046   size.width = src_roi[0]->width;
00047   size.height = src_roi[0]->height;
00048
00049   IppStatus status;
00050
00051   //                                   base + number of bytes to line y              + pixel bytes
00052   status = ippiFilterSharpen_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,
00053                                      dst + (dst_roi->start.y * dst_roi->line_step) + (dst_roi->start.x * dst_roi->pixel_step), dst_roi->line_step,
00054                                      size );
00055
00056   if ( status != ippStsNoErr ) {
00057     throw fawkes::Exception("Sharpen filter failed with %i\n", status);
00058   }
00059
00060 }