Commit 2085fb08 authored by Antoine Cellerier's avatar Antoine Cellerier

Factorize some code in the filters.

parent b6dc08db
......@@ -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,
......
......@@ -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 );
}
......@@ -32,6 +32,7 @@
#include <vlc_plugin.h>
#include <vlc_vout.h>
#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 );
}
......@@ -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 );
}
/*****************************************************************************
......
......@@ -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 )
......
......@@ -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;
......
......@@ -34,6 +34,7 @@
#include <vlc_vout.h>
#include "vlc_filter.h"
#include "filter_picture.h"
#include <math.h> /* 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 );
}
......@@ -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 );
}
/*****************************************************************************
......
......@@ -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 );
}
......@@ -34,6 +34,7 @@
#include <vlc_vout.h>
#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 );
}
......@@ -35,6 +35,7 @@
#include <vlc_sout.h>
#include <vlc_vout.h>
#include <vlc_filter.h>
#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 );
}
/*****************************************************************************
......
......@@ -34,6 +34,7 @@
#include <vlc_vout.h>
#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 );
}
......@@ -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 );
}
......@@ -36,6 +36,7 @@
#include <vlc_plugin.h>
#include <vlc_vout.h>
#include <vlc_filter.h>
#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 );
}
......@@ -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 );
}
/*****************************************************************************
......
......@@ -36,6 +36,7 @@
#include <vlc_vout.h>
#include "vlc_filter.h"
#include "filter_picture.h"
#include <assert.h>
......@@ -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 );
......
......@@ -42,6 +42,7 @@
#include <vlc_vout.h>
#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.")
......@@ -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,
......
......@@ -37,6 +37,7 @@
#include <vlc_vout.h>
#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 );
}
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