X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fblendbench.c;h=4efff565bd6a62eb2fd72b684493df58482445ca;hb=2c0b770976956de35b321f3307405adc9cfde85e;hp=dab13aba8b43f5ab676ade201b75400f2c622b7d;hpb=5e15258c9ef28558fe2abc941fc1527e02b04c21;p=vlc diff --git a/modules/video_filter/blendbench.c b/modules/video_filter/blendbench.c index dab13aba8b..4efff565bd 100644 --- a/modules/video_filter/blendbench.c +++ b/modules/video_filter/blendbench.c @@ -4,7 +4,7 @@ * Copyright (C) 2007 the VideoLAN team * $Id$ * - * Author: Søren Bøg + * Author: Søren Bøg * * 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 @@ -29,13 +29,13 @@ # include "config.h" #endif -#include +#include #include #include -#include +#include -#include "vlc_filter.h" -#include "vlc_image.h" +#include +#include /***************************************************************************** * Local prototypes @@ -61,7 +61,7 @@ static picture_t *Filter( filter_t *, picture_t * ); #define BASE_CHROMA_TEXT N_("Chroma for the base image") #define BASE_CHROMA_LONGTEXT N_("Chroma which the base image will be loaded in") -#define BLEND_IMAGE_TEXT N_("Image which will be blended.") +#define BLEND_IMAGE_TEXT N_("Image which will be blended") #define BLEND_IMAGE_LONGTEXT N_("The image blended onto the base image") #define BLEND_CHROMA_TEXT N_("Chroma for the blend image") @@ -70,33 +70,33 @@ static picture_t *Filter( filter_t *, picture_t * ); #define CFG_PREFIX "blendbench-" -vlc_module_begin(); - set_description( N_("Blending benchmark filter") ); - set_shortname( N_("blendbench" )); - set_category( CAT_VIDEO ); - set_subcategory( SUBCAT_VIDEO_VFILTER ); - set_capability( "video filter2", 0 ); +vlc_module_begin () + set_description( N_("Blending benchmark filter") ) + set_shortname( N_("Blendbench" )) + set_category( CAT_VIDEO ) + set_subcategory( SUBCAT_VIDEO_VFILTER ) + set_capability( "video filter2", 0 ) - set_section( N_("Benchmarking"), NULL ); + set_section( N_("Benchmarking"), NULL ) add_integer( CFG_PREFIX "loops", 1000, NULL, LOOPS_TEXT, - LOOPS_LONGTEXT, false ); + LOOPS_LONGTEXT, false ) add_integer_with_range( CFG_PREFIX "alpha", 128, 0, 255, NULL, ALPHA_TEXT, - ALPHA_LONGTEXT, false ); + ALPHA_LONGTEXT, false ) - set_section( N_("Base image"), NULL ); + set_section( N_("Base image"), NULL ) add_file( CFG_PREFIX "base-image", NULL, NULL, BASE_IMAGE_TEXT, - BASE_IMAGE_LONGTEXT, false ); + BASE_IMAGE_LONGTEXT, false ) add_string( CFG_PREFIX "base-chroma", "I420", NULL, BASE_CHROMA_TEXT, - BASE_CHROMA_LONGTEXT, false ); + BASE_CHROMA_LONGTEXT, false ) - set_section( N_("Blend image"), NULL ); + set_section( N_("Blend image"), NULL ) add_file( CFG_PREFIX "blend-image", NULL, NULL, BLEND_IMAGE_TEXT, - BLEND_IMAGE_LONGTEXT, false ); + BLEND_IMAGE_LONGTEXT, false ) add_string( CFG_PREFIX "blend-chroma", "YUVA", NULL, BLEND_CHROMA_TEXT, - BLEND_CHROMA_LONGTEXT, false ); + BLEND_CHROMA_LONGTEXT, false ) - set_callbacks( Create, Destroy ); -vlc_module_end(); + set_callbacks( Create, Destroy ) +vlc_module_end () static const char *const ppsz_filter_options[] = { "loops", "alpha", "base-image", "base-chroma", "blend-image", @@ -152,7 +152,7 @@ static int Create( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys; - char *psz_temp; + char *psz_temp, *psz_cmd; /* Allocate structure */ p_filter->p_sys = malloc( sizeof( filter_sys_t ) ); @@ -177,17 +177,21 @@ static int Create( vlc_object_t *p_this ) psz_temp = var_CreateGetStringCommand( p_filter, CFG_PREFIX "base-chroma" ); p_sys->i_base_chroma = VLC_FOURCC( psz_temp[0], psz_temp[1], psz_temp[2], psz_temp[3] ); + psz_cmd = var_CreateGetStringCommand( p_filter, CFG_PREFIX "base-image" ); blendbench_LoadImage( p_this, &p_sys->p_base_image, p_sys->i_base_chroma, - var_CreateGetStringCommand( p_filter, CFG_PREFIX "base-image" ), - "Base" ); + psz_cmd, "Base" ); + free( psz_temp ); + free( psz_cmd ); psz_temp = var_CreateGetStringCommand( p_filter, CFG_PREFIX "blend-chroma" ); p_sys->i_blend_chroma = VLC_FOURCC( psz_temp[0], psz_temp[1], psz_temp[2], psz_temp[3] ); + psz_cmd = var_CreateGetStringCommand( p_filter, CFG_PREFIX "blend-image" ); blendbench_LoadImage( p_this, &p_sys->p_blend_image, p_sys->i_blend_chroma, - var_CreateGetStringCommand( p_filter, CFG_PREFIX "blend-image" ), - "Blend" ); + psz_cmd, "Blend" ); + free( psz_temp ); + free( psz_cmd ); return VLC_SUCCESS; } @@ -200,8 +204,8 @@ static void Destroy( vlc_object_t *p_this ) filter_t *p_filter = (filter_t *)p_this; filter_sys_t *p_sys = p_filter->p_sys; - p_sys->p_base_image->pf_release( p_sys->p_base_image ); - p_sys->p_blend_image->pf_release( p_sys->p_blend_image ); + picture_Release( p_sys->p_base_image ); + picture_Release( p_sys->p_blend_image ); } /***************************************************************************** @@ -215,20 +219,19 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) if( p_sys->b_done ) return p_pic; - p_blend = vlc_object_create( p_filter, VLC_OBJECT_FILTER ); + p_blend = vlc_object_create( p_filter, sizeof(filter_t) ); if( !p_blend ) { - p_pic->pf_release( p_pic ); + picture_Release( p_pic ); return NULL; } vlc_object_attach( p_blend, p_filter ); p_blend->fmt_out.video = p_sys->p_base_image->format; p_blend->fmt_in.video = p_sys->p_blend_image->format; - p_blend->p_module = module_Need( p_blend, "video blending", 0, 0 ); + p_blend->p_module = module_need( p_blend, "video blending", NULL, false ); if( !p_blend->p_module ) { - p_pic->pf_release( p_pic ); - vlc_object_detach( p_blend ); + picture_Release( p_pic ); vlc_object_release( p_blend ); return NULL; } @@ -236,13 +239,13 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) mtime_t time = mdate(); for( int i_iter = 0; i_iter < p_sys->i_loops; ++i_iter ) { - p_blend->pf_video_blend( p_blend, p_sys->p_base_image, + p_blend->pf_video_blend( p_blend, p_sys->p_base_image, p_sys->p_blend_image, 0, 0, p_sys->i_alpha ); } time = mdate() - time; - msg_Info( p_filter, "Blended %d images in %f sec.", p_sys->i_loops, + msg_Info( p_filter, "Blended %d images in %f sec", p_sys->i_loops, time / 1000000.0f ); msg_Info( p_filter, "Speed is: %f images/second, %f pixels/second", (float) p_sys->i_loops / time * 1000000, @@ -250,9 +253,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) p_sys->p_blend_image->p[Y_PLANE].i_visible_pitch * p_sys->p_blend_image->p[Y_PLANE].i_visible_lines ); - module_Unneed( p_blend, p_blend->p_module ); + module_unneed( p_blend, p_blend->p_module ); - vlc_object_detach( p_blend ); vlc_object_release( p_blend ); p_sys->b_done = true;