diff --git a/modules/video_filter/adjust.c b/modules/video_filter/adjust.c index a15dbcaae36b..01c7af788e00 100644 --- a/modules/video_filter/adjust.c +++ b/modules/video_filter/adjust.c @@ -410,16 +410,7 @@ static picture_t *FilterPlanar( filter_t *p_filter, picture_t *p_pic ) #undef WRITE_UV } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } /***************************************************************************** @@ -652,16 +643,7 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic ) #undef WRITE_UV } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } static int AdjustCallback( vlc_object_t *p_this, char const *psz_var, diff --git a/modules/video_filter/colorthres.c b/modules/video_filter/colorthres.c index 0d0d89080f2d..67ddf2429b83 100644 --- a/modules/video_filter/colorthres.c +++ b/modules/video_filter/colorthres.c @@ -228,14 +228,5 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) p_out_v++; } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } diff --git a/modules/video_filter/croppadd.c b/modules/video_filter/croppadd.c index 3bf236ed835a..9f5bc64059f9 100644 --- a/modules/video_filter/croppadd.c +++ b/modules/video_filter/croppadd.c @@ -32,6 +32,7 @@ #include #include #include "vlc_filter.h" +#include "filter_picture.h" /**************************************************************************** * Local prototypes @@ -187,13 +188,5 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) ( i_outheight - i_ypadd - i_height ) * p_outplane->i_pitch ); } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } diff --git a/modules/video_filter/erase.c b/modules/video_filter/erase.c index 370c68d3ef8c..19d1dbafd7aa 100644 --- a/modules/video_filter/erase.c +++ b/modules/video_filter/erase.c @@ -36,6 +36,7 @@ #include "vlc_image.h" #include "vlc_filter.h" +#include "filter_picture.h" /***************************************************************************** * Local prototypes @@ -216,16 +217,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) /* Here */ FilterErase( p_filter, p_pic, p_outpic ); - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } /***************************************************************************** diff --git a/modules/video_filter/extract.c b/modules/video_filter/extract.c index 0aae4f3f1d93..f08477f3fed1 100644 --- a/modules/video_filter/extract.c +++ b/modules/video_filter/extract.c @@ -250,16 +250,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) return NULL; } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } static inline uint8_t crop( int a ) diff --git a/modules/video_filter/filter_picture.h b/modules/video_filter/filter_picture.h index 97ac7b32a154..df5b33fed2c2 100644 --- a/modules/video_filter/filter_picture.h +++ b/modules/video_filter/filter_picture.h @@ -86,7 +86,7 @@ static inline int GetPackedYuvOffsets( vlc_fourcc_t i_chroma, /***************************************************************************** * *****************************************************************************/ -static inline picture_t *CopyMetaAndRelease( picture_t *p_outpic, picture_t *p_inpic ) +static inline picture_t *CopyInfoAndRelease( picture_t *p_outpic, picture_t *p_inpic ) { p_outpic->date = p_inpic->date; p_outpic->b_force = p_inpic->b_force; diff --git a/modules/video_filter/gaussianblur.c b/modules/video_filter/gaussianblur.c index 8a6536d6b748..e42832f5adb5 100644 --- a/modules/video_filter/gaussianblur.c +++ b/modules/video_filter/gaussianblur.c @@ -34,6 +34,7 @@ #include #include "vlc_filter.h" +#include "filter_picture.h" #include /* exp(), sqrt() */ @@ -377,14 +378,5 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) } } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } diff --git a/modules/video_filter/gradient.c b/modules/video_filter/gradient.c index 8a32c3934b64..c989023bfa10 100644 --- a/modules/video_filter/gradient.c +++ b/modules/video_filter/gradient.c @@ -263,16 +263,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) break; } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } /***************************************************************************** diff --git a/modules/video_filter/grain.c b/modules/video_filter/grain.c index 64654dee448b..7029ac7ed104 100644 --- a/modules/video_filter/grain.c +++ b/modules/video_filter/grain.c @@ -203,14 +203,5 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } diff --git a/modules/video_filter/invert.c b/modules/video_filter/invert.c index 39b7e707df6c..b6a566905fc7 100644 --- a/modules/video_filter/invert.c +++ b/modules/video_filter/invert.c @@ -34,6 +34,7 @@ #include #include "vlc_filter.h" +#include "filter_picture.h" /***************************************************************************** * Local prototypes @@ -181,14 +182,5 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) } } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } diff --git a/modules/video_filter/motionblur.c b/modules/video_filter/motionblur.c index 971f8f01f68c..cc45b5c6ab64 100644 --- a/modules/video_filter/motionblur.c +++ b/modules/video_filter/motionblur.c @@ -35,6 +35,7 @@ #include #include #include +#include "filter_picture.h" /***************************************************************************** * Local protypes @@ -129,17 +130,6 @@ static void Destroy( vlc_object_t *p_this ) free( p_filter->p_sys ); } -#define RELEASE( pic ) \ - if( pic ->pf_release ) \ - pic ->pf_release( pic ); - -#define INITPIC( dst, src ) \ - dst ->date = src ->date; \ - dst ->b_force = src ->b_force; \ - dst ->i_nb_fields = src ->i_nb_fields; \ - dst ->b_progressive = src->b_progressive; \ - dst ->b_top_field_first = src ->b_top_field_first; - /***************************************************************************** * Filter *****************************************************************************/ @@ -154,10 +144,10 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) if( !p_outpic ) { msg_Warn( p_filter, "can't get output picture" ); - RELEASE( p_pic ); + if( p_pic->pf_release ) + p_pic->pf_release( p_pic ); return NULL; } - INITPIC( p_outpic, p_pic ); if( !p_sys->pp_planes ) { @@ -178,8 +168,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) RenderBlur( p_sys, p_pic, p_outpic ); Copy( p_filter, p_outpic ); - RELEASE( p_pic ); - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } /***************************************************************************** diff --git a/modules/video_filter/noise.c b/modules/video_filter/noise.c index 06fb31ac05a1..eb26d3b4946a 100644 --- a/modules/video_filter/noise.c +++ b/modules/video_filter/noise.c @@ -34,6 +34,7 @@ #include #include "vlc_filter.h" +#include "filter_picture.h" /***************************************************************************** * Local prototypes @@ -171,14 +172,5 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) } } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } diff --git a/modules/video_filter/psychedelic.c b/modules/video_filter/psychedelic.c index 374c3e29d2aa..2620d3c731fd 100644 --- a/modules/video_filter/psychedelic.c +++ b/modules/video_filter/psychedelic.c @@ -37,6 +37,7 @@ #include "vlc_filter.h" #include "vlc_image.h" +#include "filter_picture.h" /***************************************************************************** * Local prototypes @@ -252,14 +253,5 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) p_filter->p_sys->v += 1; } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } diff --git a/modules/video_filter/ripple.c b/modules/video_filter/ripple.c index 6963ba3da9fa..3099dfd2998d 100644 --- a/modules/video_filter/ripple.c +++ b/modules/video_filter/ripple.c @@ -36,6 +36,7 @@ #include #include #include +#include "filter_picture.h" /***************************************************************************** * Local prototypes @@ -203,14 +204,5 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) } } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } diff --git a/modules/video_filter/rotate.c b/modules/video_filter/rotate.c index af73f8a270e3..7e87b40afc04 100644 --- a/modules/video_filter/rotate.c +++ b/modules/video_filter/rotate.c @@ -283,7 +283,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) } } - return CopyMetaAndRelease( p_outpic, p_pic ); + return CopyInfoAndRelease( p_outpic, p_pic ); } /***************************************************************************** @@ -385,7 +385,7 @@ static picture_t *FilterPacked( filter_t *p_filter, picture_t *p_pic ) } } - return CopyMetaAndRelease( p_outpic, p_pic ); + return CopyInfoAndRelease( p_outpic, p_pic ); } /***************************************************************************** diff --git a/modules/video_filter/seamcarving.c b/modules/video_filter/seamcarving.c index a22294ed661d..edaf74284bdc 100644 --- a/modules/video_filter/seamcarving.c +++ b/modules/video_filter/seamcarving.c @@ -36,6 +36,7 @@ #include #include "vlc_filter.h" +#include "filter_picture.h" #include @@ -126,16 +127,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) FilterSeamCarving( p_filter, p_pic, p_outpic ); - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } static inline int my_min3( int a, int b, int c ); diff --git a/modules/video_filter/sharpen.c b/modules/video_filter/sharpen.c index 2aa3b3470c86..a1a62210b852 100644 --- a/modules/video_filter/sharpen.c +++ b/modules/video_filter/sharpen.c @@ -42,6 +42,7 @@ #include #include "vlc_filter.h" +#include "filter_picture.h" #define SIG_TEXT N_("Sharpen strength (0-2)") #define SIG_LONGTEXT N_("Set the Sharpen strength, between 0 and 2. Defaults to 0.05.") @@ -101,7 +102,7 @@ inline static int32_t clip( int32_t a ) static void init_precalc_table(filter_sys_t *p_filter) { float sigma = p_filter->f_sigma; - + for(int i = 0; i < 512; ++i) { p_filter->tab_precalc[i] = (i - 256) * sigma; @@ -237,16 +238,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) p_outpic->p[V_PLANE].i_lines * p_outpic->p[V_PLANE].i_pitch ); - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); } static int SharpenCallback( vlc_object_t *p_this, char const *psz_var, diff --git a/modules/video_filter/wave.c b/modules/video_filter/wave.c index 5abf08d2f8cb..1e6236a1c783 100644 --- a/modules/video_filter/wave.c +++ b/modules/video_filter/wave.c @@ -37,6 +37,7 @@ #include #include "vlc_filter.h" +#include "filter_picture.h" /***************************************************************************** * Local prototypes @@ -193,14 +194,5 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) } } - p_outpic->date = p_pic->date; - p_outpic->b_force = p_pic->b_force; - p_outpic->i_nb_fields = p_pic->i_nb_fields; - p_outpic->b_progressive = p_pic->b_progressive; - p_outpic->b_top_field_first = p_pic->b_top_field_first; - - if( p_pic->pf_release ) - p_pic->pf_release( p_pic ); - - return p_outpic; + return CopyInfoAndRelease( p_outpic, p_pic ); }