X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fdeinterlace.c;h=1e8d55b836a08096910ce031c66a2958ece875a8;hb=d1d3dc1d109110bf68cb048c429f6f05a3839200;hp=9b4a03cde41e341506aeadf777a244d28c670a26;hpb=f485214f09dd284cbb85674e937fbbb0a6032a2e;p=vlc diff --git a/modules/video_filter/deinterlace.c b/modules/video_filter/deinterlace.c index 9b4a03cde4..1e8d55b836 100644 --- a/modules/video_filter/deinterlace.c +++ b/modules/video_filter/deinterlace.c @@ -25,12 +25,14 @@ * Preamble *****************************************************************************/ #include -#include /* malloc(), free() */ -#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include -#include -#include +#include +#include #include "vlc_filter.h" #ifdef HAVE_ALTIVEC_H @@ -65,7 +67,7 @@ static void RenderBob ( vout_thread_t *, picture_t *, picture_t *, int ); static void RenderMean ( vout_thread_t *, picture_t *, picture_t * ); static void RenderBlend ( vout_thread_t *, picture_t *, picture_t * ); static void RenderLinear ( vout_thread_t *, picture_t *, picture_t *, int ); -static void RenderX ( vout_thread_t *, picture_t *, picture_t * ); +static void RenderX ( picture_t *, picture_t * ); static void MergeGeneric ( void *, const void *, const void *, size_t ); #if defined(CAN_COMPILE_C_ALTIVEC) @@ -113,20 +115,20 @@ static int FilterCallback ( vlc_object_t *, char const *, #define FILTER_CFG_PREFIX "sout-deinterlace-" -static char *mode_list[] = { "discard", "blend", "mean", "bob", "linear", "x" }; -static char *mode_list_text[] = { N_("Discard"), N_("Blend"), N_("Mean"), +static const char *mode_list[] = { "discard", "blend", "mean", "bob", "linear", "x" }; +static const char *mode_list_text[] = { N_("Discard"), N_("Blend"), N_("Mean"), N_("Bob"), N_("Linear"), "X" }; vlc_module_begin(); set_description( _("Deinterlacing video filter") ); - set_shortname( N_("Deinterlace" )); + set_shortname( _("Deinterlace" )); set_capability( "video filter", 0 ); set_category( CAT_VIDEO ); set_subcategory( SUBCAT_VIDEO_VFILTER ); set_section( N_("Display"),NULL); add_string( "deinterlace-mode", "discard", NULL, MODE_TEXT, - MODE_LONGTEXT, VLC_FALSE ); + MODE_LONGTEXT, false ); change_string_list( mode_list, mode_list_text, 0 ); add_shortcut( "deinterlace" ); @@ -136,7 +138,7 @@ vlc_module_begin(); set_capability( "video filter2", 0 ); set_section( N_("Streaming"),NULL); add_string( FILTER_CFG_PREFIX "mode", "blend", NULL, SOUT_MODE_TEXT, - SOUT_MODE_LONGTEXT, VLC_FALSE ); + SOUT_MODE_LONGTEXT, false ); change_string_list( mode_list, mode_list_text, 0 ); set_callbacks( OpenFilter, CloseFilter ); vlc_module_end(); @@ -154,7 +156,7 @@ static const char *ppsz_filter_options[] = { struct vout_sys_t { int i_mode; /* Deinterlace mode */ - vlc_bool_t b_double_rate; /* Shall we double the framerate? */ + bool b_double_rate; /* Shall we double the framerate? */ mtime_t last_date; mtime_t next_date; @@ -201,13 +203,13 @@ static int Create( vlc_object_t *p_this ) p_vout->pf_control = Control; p_vout->p_sys->i_mode = DEINTERLACE_DISCARD; - p_vout->p_sys->b_double_rate = VLC_FALSE; + p_vout->p_sys->b_double_rate = false; p_vout->p_sys->last_date = 0; p_vout->p_sys->p_vout = 0; vlc_mutex_init( p_vout, &p_vout->p_sys->filter_lock ); #if defined(CAN_COMPILE_C_ALTIVEC) - if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_ALTIVEC ) + if( vlc_CPU() & CPU_CAPABILITY_ALTIVEC ) { p_vout->p_sys->pf_merge = MergeAltivec; p_vout->p_sys->pf_end_merge = NULL; @@ -215,7 +217,7 @@ static int Create( vlc_object_t *p_this ) else #endif #if defined(CAN_COMPILE_SSE) - if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_SSE2 ) + if( vlc_CPU() & CPU_CAPABILITY_SSE2 ) { p_vout->p_sys->pf_merge = MergeSSE2; p_vout->p_sys->pf_end_merge = EndMMX; @@ -223,7 +225,7 @@ static int Create( vlc_object_t *p_this ) else #endif #if defined(CAN_COMPILE_MMXEXT) - if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT ) + if( vlc_CPU() & CPU_CAPABILITY_MMXEXT ) { p_vout->p_sys->pf_merge = MergeMMXEXT; p_vout->p_sys->pf_end_merge = EndMMX; @@ -231,7 +233,7 @@ static int Create( vlc_object_t *p_this ) else #endif #if defined(CAN_COMPILE_3DNOW) - if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_3DNOW ) + if( vlc_CPU() & CPU_CAPABILITY_3DNOW ) { p_vout->p_sys->pf_merge = Merge3DNow; p_vout->p_sys->pf_end_merge = End3DNow; @@ -272,35 +274,35 @@ static void SetFilterMethod( vout_thread_t *p_vout, char *psz_method ) if( !strcmp( psz_method, "discard" ) ) { p_vout->p_sys->i_mode = DEINTERLACE_DISCARD; - p_vout->p_sys->b_double_rate = VLC_FALSE; + p_vout->p_sys->b_double_rate = false; } else if( !strcmp( psz_method, "mean" ) ) { p_vout->p_sys->i_mode = DEINTERLACE_MEAN; - p_vout->p_sys->b_double_rate = VLC_FALSE; + p_vout->p_sys->b_double_rate = false; } else if( !strcmp( psz_method, "blend" ) || !strcmp( psz_method, "average" ) || !strcmp( psz_method, "combine-fields" ) ) { p_vout->p_sys->i_mode = DEINTERLACE_BLEND; - p_vout->p_sys->b_double_rate = VLC_FALSE; + p_vout->p_sys->b_double_rate = false; } else if( !strcmp( psz_method, "bob" ) || !strcmp( psz_method, "progressive-scan" ) ) { p_vout->p_sys->i_mode = DEINTERLACE_BOB; - p_vout->p_sys->b_double_rate = VLC_TRUE; + p_vout->p_sys->b_double_rate = true; } else if( !strcmp( psz_method, "linear" ) ) { p_vout->p_sys->i_mode = DEINTERLACE_LINEAR; - p_vout->p_sys->b_double_rate = VLC_TRUE; + p_vout->p_sys->b_double_rate = true; } else if( !strcmp( psz_method, "x" ) ) { p_vout->p_sys->i_mode = DEINTERLACE_X; - p_vout->p_sys->b_double_rate = VLC_FALSE; + p_vout->p_sys->b_double_rate = false; } else { @@ -369,7 +371,8 @@ static int Init( vout_thread_t *p_vout ) static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout ) { vout_thread_t *p_real_vout = NULL; - video_format_t fmt = {0}; + video_format_t fmt; + memset( &fmt, 0, sizeof( video_format_t ) ); msg_Dbg( p_vout, "spawning the real video output" ); @@ -531,16 +534,16 @@ static void Render ( vout_thread_t *p_vout, picture_t *p_pic ) break; case DEINTERLACE_BOB: - RenderBob( p_vout, pp_outpic[0], p_pic, 0 ); + RenderBob( p_vout, pp_outpic[0], p_pic, p_pic->b_top_field_first ? 0 : 1 ); vout_DisplayPicture( p_vout->p_sys->p_vout, pp_outpic[0] ); - RenderBob( p_vout, pp_outpic[1], p_pic, 1 ); + RenderBob( p_vout, pp_outpic[1], p_pic, p_pic->b_top_field_first ? 1 : 0 ); vout_DisplayPicture( p_vout->p_sys->p_vout, pp_outpic[1] ); break; case DEINTERLACE_LINEAR: - RenderLinear( p_vout, pp_outpic[0], p_pic, 0 ); + RenderLinear( p_vout, pp_outpic[0], p_pic, p_pic->b_top_field_first ? 0 : 1 ); vout_DisplayPicture( p_vout->p_sys->p_vout, pp_outpic[0] ); - RenderLinear( p_vout, pp_outpic[1], p_pic, 1 ); + RenderLinear( p_vout, pp_outpic[1], p_pic, p_pic->b_top_field_first ? 1 : 0 ); vout_DisplayPicture( p_vout->p_sys->p_vout, pp_outpic[1] ); break; @@ -555,7 +558,7 @@ static void Render ( vout_thread_t *p_vout, picture_t *p_pic ) break; case DEINTERLACE_X: - RenderX( p_vout, pp_outpic[0], p_pic ); + RenderX( pp_outpic[0], p_pic ); vout_DisplayPicture( p_vout->p_sys->p_vout, pp_outpic[0] ); break; } @@ -1010,10 +1013,10 @@ static void MergeSSE2( void *_p_dest, const void *_p_s1, const void *_p_s2, const uint8_t *p_s1 = (const uint8_t *)_p_s1; const uint8_t *p_s2 = (const uint8_t *)_p_s2; uint8_t* p_end; - while( (ptrdiff_t)p_s1 % 16 ) + while( (uintptr_t)p_s1 % 16 ) { *p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1; - } + } p_end = p_dest + i_bytes - 16; while( p_dest < p_end ) { @@ -1165,7 +1168,7 @@ static inline int XDeint8x8DetectC( uint8_t *src, int i_src ) src += 2*i_src; } - return fc < 1 ? VLC_FALSE : VLC_TRUE; + return fc < 1 ? false : true; } #ifdef CAN_COMPILE_MMXEXT static inline int XDeint8x8DetectMMXEXT( uint8_t *src, int i_src ) @@ -1282,7 +1285,7 @@ static inline void XDeint8x8MergeMMXEXT( uint8_t *dst, int i_dst, uint8_t *src1, int i_src1, uint8_t *src2, int i_src2 ) { - static const uint64_t m_4 = I64C(0x0004000400040004); + static const uint64_t m_4 = INT64_C(0x0004000400040004); int y, x; /* Progressive */ @@ -1787,7 +1790,7 @@ static inline int XDeintNxNDetect( uint8_t *src, int i_src, fc++; } - return fc < 2 ? VLC_FALSE : VLC_TRUE; + return fc < 2 ? false : true; } static inline void XDeintNxNFrame( uint8_t *dst, int i_dst, @@ -1939,8 +1942,7 @@ static inline void XDeintBand8x8MMXEXT( uint8_t *dst, int i_dst, } #endif -static void RenderX( vout_thread_t *p_vout, - picture_t *p_outpic, picture_t *p_pic ) +static void RenderX( picture_t *p_outpic, picture_t *p_pic ) { int i_plane; @@ -1964,7 +1966,7 @@ static void RenderX( vout_thread_t *p_vout, uint8_t *src = &p_pic->p[i_plane].p_pixels[8*y*i_src]; #ifdef CAN_COMPILE_MMXEXT - if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT ) + if( vlc_CPU() & CPU_CAPABILITY_MMXEXT ) XDeintBand8x8MMXEXT( dst, i_dst, src, i_src, i_mbx, i_modx ); else #endif @@ -1991,7 +1993,7 @@ static void RenderX( vout_thread_t *p_vout, } #ifdef CAN_COMPILE_MMXEXT - if( p_vout->p_libvlc_global->i_cpu & CPU_CAPABILITY_MMXEXT ) + if( vlc_CPU() & CPU_CAPABILITY_MMXEXT ) emms(); #endif } @@ -2002,6 +2004,7 @@ static void RenderX( vout_thread_t *p_vout, static int SendEvents( vlc_object_t *p_this, char const *psz_var, vlc_value_t oldval, vlc_value_t newval, void *_p_vout ) { + VLC_UNUSED(p_this); VLC_UNUSED(oldval); vout_thread_t *p_vout = (vout_thread_t *)_p_vout; vlc_value_t sentval = newval; @@ -2028,6 +2031,7 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { + VLC_UNUSED(psz_cmd); VLC_UNUSED(p_data); VLC_UNUSED(oldval); vout_thread_t * p_vout = (vout_thread_t *)p_this; int i_old_mode = p_vout->p_sys->i_mode; @@ -2108,6 +2112,7 @@ static int FilterCallback( vlc_object_t *p_this, char const *psz_cmd, static int SendEventsToChild( vlc_object_t *p_this, char const *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { + VLC_UNUSED(p_data); VLC_UNUSED(oldval); vout_thread_t *p_vout = (vout_thread_t *)p_this; var_Set( p_vout->p_sys->p_vout, psz_var, newval ); return VLC_SUCCESS; @@ -2167,14 +2172,14 @@ static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic ) break; case DEINTERLACE_X: - RenderX( p_vout, p_pic_dst, p_pic ); + RenderX( p_pic_dst, p_pic ); break; } p_pic_dst->date = p_pic->date; p_pic_dst->b_force = p_pic->b_force; p_pic_dst->i_nb_fields = p_pic->i_nb_fields; - p_pic_dst->b_progressive = VLC_TRUE; + p_pic_dst->b_progressive = true; p_pic_dst->b_top_field_first = p_pic->b_top_field_first; p_pic->pf_release( p_pic ); @@ -2205,7 +2210,7 @@ static int OpenFilter( vlc_object_t *p_this ) p_filter->p_sys = (filter_sys_t *)p_vout; p_vout->render.i_chroma = p_filter->fmt_in.video.i_chroma; - sout_CfgParse( p_filter, FILTER_CFG_PREFIX, ppsz_filter_options, + config_ChainParse( p_filter, FILTER_CFG_PREFIX, ppsz_filter_options, p_filter->p_cfg ); var_Get( p_filter, FILTER_CFG_PREFIX "mode", &val ); var_Create( p_filter, "deinterlace-mode", VLC_VAR_STRING );