/* * filter_burn.c -- burning filter * Copyright (C) 2007 Stephane Fillod * * Filter taken from EffecTV - Realtime Digital Video Effector * Copyright (C) 2001-2006 FUKUCHI Kentaro * * BurningTV - burns incoming objects. * Copyright (C) 2001-2002 FUKUCHI Kentaro * * Fire routine is taken from Frank Jan Sorensen's demo program. * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "filter_burn.h" #include #include #include #include #include #include "utils.h" #define MaxColor 120 #define Decay 15 #define MAGIC_THRESHOLD "50" static RGB32 palette[256]; /* FIXME: endianess? */ static void makePalette(void) { int i, r, g, b; for(i=0; i> 8)); i++; } i += 2; } mlt_convert_rgb24a_to_yuv422((uint8_t *)dest, *width, *height, *width * sizeof(RGB32), *image, NULL ); mlt_pool_release(dest); } return error; } /** Filter processing. */ static mlt_frame filter_process( mlt_filter this, mlt_frame frame ) { // Push the frame filter mlt_frame_push_service( frame, this ); mlt_frame_push_get_image( frame, filter_get_image ); return frame; } /** Constructor for the filter. */ mlt_filter filter_burn_init( char *arg ) { mlt_filter this = mlt_filter_new( ); if ( this != NULL ) { this->process = filter_process; mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "foreground", "0" ); mlt_properties_set( MLT_FILTER_PROPERTIES( this ), "threshold", MAGIC_THRESHOLD ); } if (!palette[128]) { makePalette(); } return this; }