X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fvmfx%2Ffilter_chroma.c;h=6d9384c5d05b179b6144c5d6bc3f8e12b531a6e6;hb=66ee48cf0b9448e670cfa19dfbbdc06193288181;hp=565ac029964a7a9547f3a5f8d1612f093bf7c8f9;hpb=c8c8ab1aabc373033798bdcc2d0ed63c13bc00cb;p=melted diff --git a/src/modules/vmfx/filter_chroma.c b/src/modules/vmfx/filter_chroma.c index 565ac02..6d9384c 100644 --- a/src/modules/vmfx/filter_chroma.c +++ b/src/modules/vmfx/filter_chroma.c @@ -4,16 +4,16 @@ * Author: Charles Yates * * 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 + * it under the terms of the GNU Lesser 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. + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License + * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -27,7 +27,7 @@ static inline int in_range( uint8_t v, uint8_t c, int var ) { - return ( v >= c - var ) && ( v <= c + var ); + return ( ( int )v >= c - var ) && ( ( int )v <= c + var ); } static inline uint8_t alpha_value( uint8_t a, uint8_t *p, uint8_t u, uint8_t v, int var ) @@ -42,7 +42,7 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format { mlt_filter this = mlt_frame_pop_service( frame ); char *key = mlt_properties_get( MLT_FILTER_PROPERTIES( this ), "key" ); - int variance = 255 * mlt_properties_get_double( MLT_FILTER_PROPERTIES( this ), "variance" ) + 0.5; + int variance = 200 * mlt_properties_get_double( MLT_FILTER_PROPERTIES( this ), "variance" ); int32_t key_val = strtol( key, &key, 0 ); uint8_t b = key_val & 0xff; uint8_t g = ( key_val >> 8 ) & 0xff; @@ -55,14 +55,15 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format { uint8_t *alpha = mlt_frame_get_alpha_mask( frame ); uint8_t *p = *image; - int size = *width * *height; - int odd = 0; + int size = *width * *height / 2; while ( size -- ) { *alpha = alpha_value( *alpha, p, u, v, variance ); - if ( odd ) p += 4; - odd = !odd; + *alpha ++; + p += 2; + *alpha = alpha_value( *alpha, p, v, u, variance ); alpha ++; + p += 2; } }