1 // Copyright 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "scaled_filter.h"
28 * Scaled filter class with exclusion.
38 mutable point _offset
;
39 mutable int have_offset
;
43 ssfe(scaled_filter
*f
, int honor_exclusion
) {
44 this->honor_exclusion
= honor_exclusion
;
48 const scaled_filter
*get_scaled_filter() const {
52 int equals(const ssfe
*s
) {
53 return (honor_exclusion
== s
->honor_exclusion
57 int ex_is_honored() const {
58 return honor_exclusion
;
62 * Set the parameters for filtering.
64 void set_parameters(transformation t
, const image
*im
, point offset
) const {
67 f
->set_parameters(t
, im
, offset
);
69 void set_parameters(transformation t
, transformation s
, const image
*im
) const {
71 f
->set_parameters(t
, s
, im
);
75 * Return filtered RESULT and WEIGHT at point P in a coordinate system
76 * specified by the inverse of transformation T based on data taken
79 void filtered(int i
, int j
, int frame
, pixel
*result
,
80 pixel
*weight
, pixel prev_value
= pixel(0, 0, 0), pixel prev_weight
= pixel(0, 0, 0)) const {
83 * We need a valid offset in order to determine exclusion
87 assert (have_offset
|| !honor_exclusion
);
89 *result
= pixel(0, 0, 0);
90 *weight
= pixel(0, 0, 0);
92 if (honor_exclusion
&& render::is_excluded_r(_offset
, i
, j
, frame
))
95 f
->filtered(i
, j
, result
, weight
, honor_exclusion
, frame
, prev_value
, prev_weight
);