1 // Copyright 2002, 2003, 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
22 * image_weighted_avg.h: Image representing a weighted average of inputs.
25 #ifndef __image_weighted_avg_h__
26 #define __image_weighted_avg_h__
28 #include "image_ale_real.h"
29 #include "exposure/exposure.h"
33 #define ALE_GLSL_IMAGE_WEIGHTED_AVG_INCLUDE \
34 ALE_GLSL_IMAGE_INCLUDE \
35 "struct image_weighted_avg {\n"\
39 "bool image_weighted_avg_accumulate_norender(inout image_weighted_avg _this, vec4 pos);\n"\
40 "void image_weighted_avg_accumulate(inout image_weighted_avg _this, vec4 pos, int frame, vec3 value, vec3 confidence);\n"\
41 "image image_weighted_avg_get_weights(inout image_weighted_avg _this);\n"\
42 "vec3 image_weighted_avg_get_pixel(inout image_weighted_avg _this, vec4 pos);\n"
44 class image_weighted_avg
: public image
, public gpu::program::library
{
46 void trigger(pixel multiplier
) {
51 image_weighted_avg (unsigned int dimy
, unsigned int dimx
, unsigned int
52 depth
, const char *name
= "anonymous")
53 : image(dimy
, dimx
, depth
, name
, NULL
) {
56 virtual ~image_weighted_avg() {
59 void set_pixel(unsigned int y
, unsigned int x
, spixel p
) {
63 spixel
get_pixel(unsigned int y
, unsigned int x
) const {
66 return spixel(0, 0, 0);
69 void set_chan(unsigned int y
, unsigned int x
, unsigned int k
, ale_sreal c
) {
73 ale_sreal
get_chan(unsigned int y
, unsigned int x
, unsigned int k
) const {
80 * Make a new image suitable for receiving scaled values.
82 virtual image
*scale_generator(int height
, int width
, int depth
, const char *name
) const {
83 return new_image_ale_real(height
, width
, depth
, name
, _exp
);
87 * Pre-transformation check for whether an area should be skipped.
88 * Takes image weights as an argument.
90 virtual int accumulate_norender(int i
, int j
) = 0;
95 virtual void accumulate(int i
, int j
, int f
, pixel new_value
, pixel new_weight
) = 0;
97 virtual void accumulate_accel(const gpu::program
*p
) {
104 virtual image
*get_colors() = 0;
109 virtual image
*get_weights() = 0;