remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / plugins / libeffecttv / effecttv.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program 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 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef EFFECTTV_H
23 #define EFFECTTV_H
24
25 #include "cicolors.h"
26 #include "vframe.inc"
27 #include <stdint.h>
28
29 // Environment for EffectTV effects
30 class EffectTV
31 {
32 public:
33         EffectTV(int w, int h);
34         virtual ~EffectTV();
35
36         void image_set_threshold_y(int threshold);
37         unsigned char* image_bgsubtract_update_y(unsigned char **input_rows,
38                 unsigned char **output_rows,
39                 int color_model);
40         unsigned char* image_bgsubtract_y(unsigned char **input_rows, int color_model);
41         void image_bgset_y(VFrame *frame);
42         unsigned char* image_diff_filter(unsigned char *diff);
43
44         int yuv_init();
45         static void frame_to_effecttv(VFrame *frame, uint32_t *tmp);
46         static void effecttv_to_frame(VFrame *frame, uint32_t *tmp);
47
48 /*
49  * fastrand - fast fake random number generator
50  * Warning: The low-order bits of numbers generated by fastrand()
51  *          are bad as random numbers. For example, fastrand()%4
52  *          generates 1,2,3,0,1,2,3,0...
53  *          You should use high-order bits.
54  */
55         static unsigned int fastrand_val;
56
57         static inline unsigned int fastrand()
58         {
59                 return (fastrand_val = fastrand_val * 1103515245 + 12345);
60         };
61
62         int w;
63         int h;
64
65         int y_threshold;
66
67         unsigned char *background;
68         unsigned char *diff, *diff2;
69
70         int YtoRGB[0x100];
71         int VtoR[0x100];
72         int VtoG[0x100];
73         int UtoG[0x100];
74         int UtoB[0x100];
75         int RtoY[0x100];
76         int RtoU[0x100];
77         int RtoV[0x100];
78         int GtoY[0x100];
79         int GtoU[0x100];
80         int GtoV[0x100];
81         int BtoY[0x100];
82         int BtoV[0x100];
83         YUV *yuv;
84 };
85
86
87 #endif