Commit df7eecf6 authored by Edward Wang's avatar Edward Wang Committed by Jean-Baptiste Kempf

opencv_wrapper: Remove the weird custom verbosity and clock_t

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 67f6d91e
...@@ -93,10 +93,6 @@ vlc_module_begin () ...@@ -93,10 +93,6 @@ vlc_module_begin ()
N_("Wrapper filter output"), N_("Wrapper filter output"),
N_("Determines what (if any) video is displayed by the wrapper filter"), false); N_("Determines what (if any) video is displayed by the wrapper filter"), false);
change_string_list( output_list, output_list_text, 0); change_string_list( output_list, output_list_text, 0);
add_string( "opencv-verbosity", "error",
N_("Wrapper filter verbosity"),
N_("Determines wrapper filter verbosity level"), false);
change_string_list( verbosity_list, verbosity_list_text, 0);
add_string( "opencv-filter-name", "none", add_string( "opencv-filter-name", "none",
N_("OpenCV internal filter name"), N_("OpenCV internal filter name"),
N_("Name of internal OpenCV plugin filter to use"), false); N_("Name of internal OpenCV plugin filter to use"), false);
...@@ -123,16 +119,6 @@ enum internal_chroma_t ...@@ -123,16 +119,6 @@ enum internal_chroma_t
RGB RGB
}; };
/*****************************************************************************
* verbosity_t:
*****************************************************************************/
enum verbosity_t
{
VERB_ERROR,
VERB_WARN,
VERB_DEBUG
};
/***************************************************************************** /*****************************************************************************
* filter_sys_t: opencv_wrapper video output method descriptor * filter_sys_t: opencv_wrapper video output method descriptor
***************************************************************************** *****************************************************************************
...@@ -152,7 +138,6 @@ struct filter_sys_t ...@@ -152,7 +138,6 @@ struct filter_sys_t
int i_wrapper_output; int i_wrapper_output;
int i_internal_chroma; int i_internal_chroma;
int i_verbosity;
IplImage *p_cv_image[VOUT_MAX_PLANES]; IplImage *p_cv_image[VOUT_MAX_PLANES];
...@@ -258,44 +243,19 @@ static int Create( vlc_object_t *p_this ) ...@@ -258,44 +243,19 @@ static int Create( vlc_object_t *p_this )
} }
free( psz_output ); free( psz_output );
psz_verbosity = var_InheritString( p_filter, "opencv-verbosity" );
if( psz_verbosity == NULL )
{
msg_Err( p_filter, "configuration variable %s empty, using 'input'",
"opencv-verbosity" );
p_filter->p_sys->i_verbosity = VERB_ERROR;
}
else
{
if( !strcmp( psz_verbosity, "error" ) )
p_filter->p_sys->i_verbosity = VERB_ERROR;
else if( !strcmp( psz_verbosity, "warning" ) )
p_filter->p_sys->i_verbosity = VERB_WARN;
else if( !strcmp( psz_verbosity, "debug" ) )
p_filter->p_sys->i_verbosity = VERB_DEBUG;
else
{
msg_Err( p_filter, "no valid opencv-verbosity provided, using 'error'" );
p_filter->p_sys->i_verbosity = VERB_ERROR;
}
}
free( psz_verbosity);
p_filter->p_sys->f_scale = p_filter->p_sys->f_scale =
var_InheritFloat( p_filter, "opencv-scale" ); var_InheritFloat( p_filter, "opencv-scale" );
if (p_filter->p_sys->i_verbosity > VERB_WARN)
msg_Info(p_filter, "Configuration: opencv-scale: %f, opencv-chroma: %d, " msg_Info(p_filter, "Configuration: opencv-scale: %f, opencv-chroma: %d, "
"opencv-output: %d, opencv-verbosity %d, opencv-filter %s", "opencv-output: %d, opencv-filter %s",
p_filter->p_sys->f_scale, p_filter->p_sys->f_scale,
p_filter->p_sys->i_internal_chroma, p_filter->p_sys->i_internal_chroma,
p_filter->p_sys->i_wrapper_output, p_filter->p_sys->i_wrapper_output,
p_filter->p_sys->i_verbosity,
p_filter->p_sys->psz_inner_name); p_filter->p_sys->psz_inner_name);
/* Try to open the real video output */ #ifndef NDEBUG
if (p_filter->p_sys->i_verbosity > VERB_WARN) msg_Dbg( p_filter, "opencv_wrapper successfully started" );
msg_Dbg( p_filter, "spawning the real video output" ); #endif
p_filter->pf_video_filter = Filter; p_filter->pf_video_filter = Filter;
...@@ -345,8 +305,10 @@ static void ReleaseImages( filter_t* p_filter ) ...@@ -345,8 +305,10 @@ static void ReleaseImages( filter_t* p_filter )
picture_Release( p_sys->p_to_be_freed ); picture_Release( p_sys->p_to_be_freed );
p_sys->p_to_be_freed = NULL; p_sys->p_to_be_freed = NULL;
} }
if (p_sys->i_verbosity > VERB_WARN)
#ifndef NDEBUG
msg_Dbg( p_filter, "images released" ); msg_Dbg( p_filter, "images released" );
#endif
} }
/***************************************************************************** /*****************************************************************************
...@@ -361,14 +323,11 @@ static void VlcPictureToIplImage( filter_t* p_filter, picture_t* p_in ) ...@@ -361,14 +323,11 @@ static void VlcPictureToIplImage( filter_t* p_filter, picture_t* p_in )
// input video size // input video size
CvSize sz = cvSize(abs(p_in->format.i_width), abs(p_in->format.i_height)); CvSize sz = cvSize(abs(p_in->format.i_width), abs(p_in->format.i_height));
video_format_t fmt_out; video_format_t fmt_out;
clock_t start, finish; //performance measures
double duration; double duration;
filter_sys_t* p_sys = p_filter->p_sys; filter_sys_t* p_sys = p_filter->p_sys;
memset( &fmt_out, 0, sizeof(video_format_t) ); memset( &fmt_out, 0, sizeof(video_format_t) );
start = clock();
//do scale / color conversion according to p_sys config //do scale / color conversion according to p_sys config
if ((p_sys->f_scale != 1) || (p_sys->i_internal_chroma != CINPUT)) if ((p_sys->f_scale != 1) || (p_sys->i_internal_chroma != CINPUT))
{ {
...@@ -434,11 +393,9 @@ static void VlcPictureToIplImage( filter_t* p_filter, picture_t* p_in ) ...@@ -434,11 +393,9 @@ static void VlcPictureToIplImage( filter_t* p_filter, picture_t* p_in )
p_sys->hacked_pic.i_planes = planes; p_sys->hacked_pic.i_planes = planes;
p_sys->hacked_pic.format.i_chroma = fmt_out.i_chroma; p_sys->hacked_pic.format.i_chroma = fmt_out.i_chroma;
//calculate duration of conversion #ifndef NDEBUG
finish = clock(); msg_Dbg( p_filter, "VlcPictureToIplImageRgb() completed" );
duration = (double)(finish - start) / CLOCKS_PER_SEC; #endif
if (p_sys->i_verbosity > VERB_WARN)
msg_Dbg( p_filter, "VlcPictureToIplImageRgb took %2.4f seconds", duration );
} }
/***************************************************************************** /*****************************************************************************
...@@ -451,8 +408,6 @@ static picture_t* Filter( filter_t* p_filter, picture_t* p_pic ) ...@@ -451,8 +408,6 @@ static picture_t* Filter( filter_t* p_filter, picture_t* p_pic )
{ {
picture_t* p_outpic = filter_NewPicture( p_filter ); picture_t* p_outpic = filter_NewPicture( p_filter );
clock_t start = clock();
// Make a copy if we want to show the original input // Make a copy if we want to show the original input
if (p_filter->p_sys->i_wrapper_output == VINPUT) if (p_filter->p_sys->i_wrapper_output == VINPUT)
picture_Copy( p_outpic, p_pic ); picture_Copy( p_outpic, p_pic );
...@@ -472,11 +427,9 @@ static picture_t* Filter( filter_t* p_filter, picture_t* p_pic ) ...@@ -472,11 +427,9 @@ static picture_t* Filter( filter_t* p_filter, picture_t* p_pic )
ReleaseImages( p_filter ); ReleaseImages( p_filter );
//calculate duration #ifndef NDEBUG
clock_t finish = clock(); msg_Dbg( p_filter, "Filter() done" );
double duration = (double)(finish - start) / CLOCKS_PER_SEC; #endif
if (p_filter->p_sys->i_verbosity > VERB_WARN)
msg_Dbg( p_filter, "Filter took %2.4f seconds", duration );
if( p_filter->p_sys->i_wrapper_output == VINPUT ) { if( p_filter->p_sys->i_wrapper_output == VINPUT ) {
picture_Release( p_pic ); picture_Release( p_pic );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment