2
* Copyright 1994-2012 Olivier Girondel
4
* This file is part of lebiniou.
6
* lebiniou 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.
11
* lebiniou 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 lebiniou. If not, see <http://www.gnu.org/licenses/>.
20
* EffecTV - Realtime Digital Video Effector
21
* Copyright (C) 2001-2006 FUKUCHI Kentaro
23
* PredatorTV - makes incoming objects invisible like the Predator.
24
* Copyright (C) 2001-2002 FUKUCHI Kentaro
31
u_long id = 1325445400;
32
u_long options = BE_GFX|BEQ_PICTURE|BEQ_BYPASS;
33
char desc[] = "PredatorTV plugin from the EffecTV project";
34
u_long mode = OVERLAY;
36
#define MAGIC_THRESHOLD 40
38
static Buffer8_t *diff = NULL;
43
create(__attribute__ ((unused)) Context_t *ctx)
46
options |= BEQ_DISABLED;
53
delete(__attribute__ ((unused)) Context_t *ctx)
60
on_switch_on(Context_t *ctx)
62
ctx->ref_taken[ctx->cam] = 0;
67
static unsigned char *
68
image_diff_filter(unsigned char *diff)
71
/* noise filter for subtracted image. */
72
unsigned char *image_diff_filter(unsigned char *diff)
75
unsigned char *src, *dest;
77
unsigned int sum1, sum2, sum3;
78
const int width = video_width;
81
dest = diff2 + width +1;
82
for(y=1; y<video_height-1; y++) {
83
sum1 = src[0] + src[width] + src[width*2];
84
sum2 = src[1] + src[width+1] + src[width*2+1];
86
for(x=1; x<width-1; x++) {
87
sum3 = src[0] + src[width] + src[width*2];
88
count = sum1 + sum2 + sum3;
91
*dest++ = (0xff*3 - count)>>24;
116
pthread_mutex_lock(&ctx->cam_mtx[ctx->cam]);
117
src1 = ctx->cam_save[ctx->cam][0];
118
src2 = ctx->cam_ref[ctx->cam];
119
Buffer8_substract_y(src1, src2, MAGIC_THRESHOLD, diff);
123
dst = passive_buffer(ctx)->buffer;
124
dst += WIDTH * sizeof(Pixel_t);
125
d += WIDTH * sizeof(Pixel_t);
126
src = ctx->cam_ref[ctx->cam]->buffer + (WIDTH * sizeof(Pixel_t));
128
for (y = 1; y < MAXY; y++) {
129
for (x = 0; x < WIDTH; x++) {
131
*dst = src[4] & 0xfc;
140
pthread_mutex_unlock(&ctx->cam_mtx[ctx->cam]);
145
static int draw(RGB32 *src, RGB32 *dest)
150
diff = image_bgsubtract_y(src);
151
diff = image_diff_filter(diff);
155
src = bgimage + video_width;
156
for(y=1; y<video_height-1; y++) {
157
for(x=0; x<video_width; x++) {
159
*dest = src[4] & 0xfcfcfc;