<html><head></head><body><div class="gmail_quote">Le 26 juin 2017 19:20:15 GMT+02:00, Steve Lhomme <robux4@videolabs.io> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">This way we can use a generic callback.<br />---<br /> modules/video_filter/deinterlace/algo_basic.c | 38 +++++++++++++++++-------<br /> modules/video_filter/deinterlace/algo_basic.h | 18 ++++++-----<br /> modules/video_filter/deinterlace/algo_ivtc.c | 6 +++-<br /> modules/video_filter/deinterlace/algo_ivtc.h | 3 +-<br /> modules/video_filter/deinterlace/algo_phosphor.c | 3 +-<br /> modules/video_filter/deinterlace/algo_phosphor.h | 2 +-<br /> modules/video_filter/deinterlace/algo_x.c | 7 ++++-<br /> modules/video_filter/deinterlace/algo_x.h | 3 +-<br /> modules/video_filter/deinterlace/algo_yadif.c | 2 +-<br /> modules/video_filter/deinterlace/deinterlace.c | 34 ++++++++++++---------<br /> 10 files changed, 76 insertions(+), 40 deletions(-)<br /><br />diff --git a/modules/video_filter/deinterlace/algo_basic.c b/modules/video_filter/deinterlace/algo_basic.c<br />index e7f32baac2..c22c7995d1 100644<br />--- a/modules/video_filter/deinterlace/algo_basic.c<br />+++ b/modules/video_filter/deinterlace/algo_basic.c<br />@@ -42,11 +42,13 @@<br /> * RenderDiscard: only keep TOP or BOTTOM field, discard the other.<br /> *****************************************************************************/<br /> <br />-void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field )<br />+int RenderDiscard( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,<br />+ int order, int i_field )<br /> {<br />+ VLC_UNUSED(p_filter);<br />+ VLC_UNUSED(order);<br /> VLC_UNUSED(i_field);<br /> int i_plane;<br />-<br /> /* Copy image and skip lines */<br /> for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )<br /> {<br />@@ -66,14 +68,18 @@ void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field )<br /> p_in += 2 * p_pic->p[i_plane].i_pitch;<br /> }<br /> }<br />+ return VLC_SUCCESS;<br /> }<br /> <br /> /*****************************************************************************<br /> * RenderBob: renders a BOB picture - simple copy<br /> *****************************************************************************/<br /> <br />-void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field )<br />+int RenderBob( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,<br />+ int order, int i_field )<br /> {<br />+ VLC_UNUSED(p_filter);<br />+ VLC_UNUSED(order);<br /> int i_plane;<br /> <br /> /* Copy image and skip lines */<br />@@ -118,15 +124,18 @@ void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field )<br /> memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );<br /> }<br /> }<br />+ return VLC_SUCCESS;<br /> }<br /> <br /> /*****************************************************************************<br /> * RenderLinear: BOB with linear interpolation<br /> *****************************************************************************/<br /> <br />-void RenderLinear( filter_t *p_filter,<br />- picture_t *p_outpic, picture_t *p_pic, int i_field )<br />+int RenderLinear( filter_t *p_filter,<br />+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field )<br /> {<br />+ VLC_UNUSED(p_filter);<br />+ VLC_UNUSED(order);<br /> int i_plane;<br /> <br /> /* Copy image and skip lines */<br />@@ -173,17 +182,20 @@ void RenderLinear( filter_t *p_filter,<br /> }<br /> }<br /> EndMerge();<br />+ return VLC_SUCCESS;<br /> }<br /> <br /> /*****************************************************************************<br /> * RenderMean: Half-resolution blender<br /> *****************************************************************************/<br /> <br />-void RenderMean( filter_t *p_filter,<br />- picture_t *p_outpic, picture_t *p_pic )<br />+int RenderMean( filter_t *p_filter,<br />+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field )<br /> {<br />+ VLC_UNUSED(p_filter);<br />+ VLC_UNUSED(order);<br />+ VLC_UNUSED(i_field);<br /> int i_plane;<br />-<br /> /* Copy image and skip lines */<br /> for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )<br /> {<br />@@ -206,17 +218,20 @@ void RenderMean( filter_t *p_filter,<br /> }<br /> }<br /> EndMerge();<br />+ return VLC_SUCCESS;<br /> }<br /> <br /> /*****************************************************************************<br /> * RenderBlend: Full-resolution blender<br /> *****************************************************************************/<br /> <br />-void RenderBlend( filter_t *p_filter,<br />- picture_t *p_outpic, picture_t *p_pic )<br />+int RenderBlend( filter_t *p_filter,<br />+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field )<br /> {<br />+ VLC_UNUSED(p_filter);<br />+ VLC_UNUSED(order);<br />+ VLC_UNUSED(i_field);<br /> int i_plane;<br />-<br /> /* Copy image and skip lines */<br /> for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )<br /> {<br />@@ -243,4 +258,5 @@ void RenderBlend( filter_t *p_filter,<br /> }<br /> }<br /> EndMerge();<br />+ return VLC_SUCCESS;<br /> }<br />diff --git a/modules/video_filter/deinterlace/algo_basic.h b/modules/video_filter/deinterlace/algo_basic.h<br />index 2b1d9e3c81..aaeec3d4c5 100644<br />--- a/modules/video_filter/deinterlace/algo_basic.h<br />+++ b/modules/video_filter/deinterlace/algo_basic.h<br />@@ -50,7 +50,8 @@ struct picture_t;<br /> * @see RenderBob()<br /> * @see Deinterlace()<br /> */<br />-void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field );<br />+int RenderDiscard( filter_t *p_filter,<br />+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field );<br /> <br /> /**<br /> * RenderBob: basic framerate doubler.<br />@@ -65,7 +66,8 @@ void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field );<br /> * @see RenderLinear()<br /> * @see Deinterlace()<br /> */<br />-void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field );<br />+int RenderBob( filter_t *p_filter,<br />+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field );<br /> <br /> /**<br /> * RenderLinear: Bob with linear interpolation.<br />@@ -79,8 +81,8 @@ void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field );<br /> * @see RenderBob()<br /> * @see Deinterlace()<br /> */<br />-void RenderLinear( filter_t *p_filter,<br />- picture_t *p_outpic, picture_t *p_pic, int i_field );<br />+int RenderLinear( filter_t *p_filter,<br />+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field );<br /> <br /> /**<br /> * RenderMean: half-resolution blender.<br />@@ -94,8 +96,8 @@ void RenderLinear( filter_t *p_filter,<br /> * @param p_pic Input frame. Must exist.<br /> * @see Deinterlace()<br /> */<br />-void RenderMean( filter_t *p_filter,<br />- picture_t *p_outpic, picture_t *p_pic );<br />+int RenderMean( filter_t *p_filter,<br />+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field );<br /> <br /> /**<br /> * RenderBlend: full-resolution blender.<br />@@ -110,7 +112,7 @@ void RenderMean( filter_t *p_filter,<br /> * @param p_pic Input frame. Must exist.<br /> * @see Deinterlace()<br /> */<br />-void RenderBlend( filter_t *p_filter,<br />- picture_t *p_outpic, picture_t *p_pic );<br />+int RenderBlend( filter_t *p_filter,<br />+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field );<br /> <br /> #endif<br />diff --git a/modules/video_filter/deinterlace/algo_ivtc.c b/modules/video_filter/deinterlace/algo_ivtc.c<br />index 35f920beeb..5603828f0e 100644<br />--- a/modules/video_filter/deinterlace/algo_ivtc.c<br />+++ b/modules/video_filter/deinterlace/algo_ivtc.c<br />@@ -1467,8 +1467,12 @@ static bool IVTCOutputOrDropFrame( filter_t *p_filter, picture_t *p_dst )<br /> *****************************************************************************/<br /> <br /> /* See function doc in header. */<br />-int RenderIVTC( filter_t *p_filter, picture_t *p_dst )<br />+int RenderIVTC( filter_t *p_filter, picture_t *p_dst, picture_t *p_pic,<br />+ int order, int i_field )<br /> {<br />+ VLC_UNUSED(p_pic);<br />+ VLC_UNUSED(order);<br />+ VLC_UNUSED(i_field);<br /> assert( p_filter != NULL );<br /> assert( p_dst != NULL );<br /> <br />diff --git a/modules/video_filter/deinterlace/algo_ivtc.h b/modules/video_filter/deinterlace/algo_ivtc.h<br />index 3bc4ff3f0a..69334ae0ee 100644<br />--- a/modules/video_filter/deinterlace/algo_ivtc.h<br />+++ b/modules/video_filter/deinterlace/algo_ivtc.h<br />@@ -141,7 +141,8 @@ typedef struct<br /> * @see CalculateInterlaceScore()<br /> * @see EstimateNumBlocksWithMotion()<br /> */<br />-int RenderIVTC( filter_t *p_filter, picture_t *p_dst );<br />+int RenderIVTC( filter_t *p_filter, picture_t *p_dst, picture_t *p_pic,<br />+ int i_field, int order);<br /> <br /> /**<br /> * Clears the inverse telecine subsystem state.<br />diff --git a/modules/video_filter/deinterlace/algo_phosphor.c b/modules/video_filter/deinterlace/algo_phosphor.c<br />index 0240e0bce5..cc90ec13a6 100644<br />--- a/modules/video_filter/deinterlace/algo_phosphor.c<br />+++ b/modules/video_filter/deinterlace/algo_phosphor.c<br />@@ -278,9 +278,10 @@ static void DarkenFieldMMX( picture_t *p_dst,<br /> <br /> /* See header for function doc. */<br /> int RenderPhosphor( filter_t *p_filter,<br />- picture_t *p_dst,<br />+ picture_t *p_dst, picture_t *p_pic,<br /> int i_order, int i_field )<br /> {<br />+ VLC_UNUSED(p_pic);<br /> assert( p_filter != NULL );<br /> assert( p_dst != NULL );<br /> assert( i_order >= 0 && i_order <= 2 ); /* 2 = soft field repeat */<br />diff --git a/modules/video_filter/deinterlace/algo_phosphor.h b/modules/video_filter/deinterlace/algo_phosphor.h<br />index 8159adb374..14aa252502 100644<br />--- a/modules/video_filter/deinterlace/algo_phosphor.h<br />+++ b/modules/video_filter/deinterlace/algo_phosphor.h<br />@@ -101,7 +101,7 @@ typedef struct<br /> * @see Deinterlace()<br /> */<br /> int RenderPhosphor( filter_t *p_filter,<br />- picture_t *p_dst,<br />+ picture_t *p_dst, picture_t *p_pic,<br /> int i_order, int i_field );<br /> <br /> /*****************************************************************************<br />diff --git a/modules/video_filter/deinterlace/algo_x.c b/modules/video_filter/deinterlace/algo_x.c<br />index 70633a6fc0..4e6dee782c 100644<br />--- a/modules/video_filter/deinterlace/algo_x.c<br />+++ b/modules/video_filter/deinterlace/algo_x.c<br />@@ -512,8 +512,12 @@ static inline void XDeintBand8x8MMXEXT( uint8_t *dst, int i_dst,<br /> * Public functions<br /> *****************************************************************************/<br /> <br />-void RenderX( picture_t *p_outpic, picture_t *p_pic )<br />+int RenderX( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,<br />+ int order, int i_field )<br /> {<br />+ VLC_UNUSED(p_filter);<br />+ VLC_UNUSED(order);<br />+ VLC_UNUSED(i_field);<br /> int i_plane;<br /> #if defined (CAN_COMPILE_MMXEXT)<br /> const bool mmxext = vlc_CPU_MMXEXT();<br />@@ -569,4 +573,5 @@ void RenderX( picture_t *p_outpic, picture_t *p_pic )<br /> if( mmxext )<br /> emms();<br /> #endif<br />+ return VLC_SUCCESS;<br /> }<br />diff --git a/modules/video_filter/deinterlace/algo_x.h b/modules/video_filter/deinterlace/algo_x.h<br />index 16b7cd1bde..99aadf99dc 100644<br />--- a/modules/video_filter/deinterlace/algo_x.h<br />+++ b/modules/video_filter/deinterlace/algo_x.h<br />@@ -50,6 +50,7 @@ struct picture_t;<br /> * @param[out] p_outpic Output frame. Must be allocated by caller.<br /> * @see Deinterlace()<br /> */<br />-void RenderX( picture_t *p_outpic, picture_t *p_pic );<br />+int RenderX( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,<br />+ int order, int i_field );<br /> <br /> #endif<br />diff --git a/modules/video_filter/deinterlace/algo_yadif.c b/modules/video_filter/deinterlace/algo_yadif.c<br />index da3470dde6..b326a17736 100644<br />--- a/modules/video_filter/deinterlace/algo_yadif.c<br />+++ b/modules/video_filter/deinterlace/algo_yadif.c<br />@@ -182,7 +182,7 @@ int RenderYadif( filter_t *p_filter, picture_t *p_dst, picture_t *p_src,<br /> as set by Open() or SetFilterMethod(). It is always 0. */<br /> <br /> /* FIXME not good as it does not use i_order/i_field */<br />- RenderX( p_dst, p_next );<br />+ RenderX( p_filter, p_dst, p_next, i_order, i_field );<br /> return VLC_SUCCESS;<br /> }<br /> else<br />diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c<br />index 57df63c813..c3948e1c25 100644<br />--- a/modules/video_filter/deinterlace/deinterlace.c<br />+++ b/modules/video_filter/deinterlace/deinterlace.c<br />@@ -440,35 +440,41 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<br /> switch( p_sys->i_mode )<br /> {<br /> case DEINTERLACE_DISCARD:<br />- RenderDiscard( p_dst[0], p_pic, 0 );<br />+ RenderDiscard( p_filter, p_dst[0], p_pic, 0, 0 );<br /> break;<br /> <br /> case DEINTERLACE_BOB:<br />- RenderBob( p_dst[0], p_pic, !b_top_field_first );<br />+ RenderBob( p_filter, p_dst[0], p_pic, 0,<br />+ !b_top_field_first );<br /> if( p_dst[1] )<br />- RenderBob( p_dst[1], p_pic, b_top_field_first );<br />+ RenderBob( p_filter, p_dst[1], p_pic, 1,<br />+ b_top_field_first );<br /> if( p_dst[2] )<br />- RenderBob( p_dst[2], p_pic, !b_top_field_first );<br />+ RenderBob( p_filter, p_dst[2], p_pic, 2,<br />+ !b_top_field_first );<br /> break;;<br /> <br /> case DEINTERLACE_LINEAR:<br />- RenderLinear( p_filter, p_dst[0], p_pic, !b_top_field_first );<br />+ RenderLinear( p_filter, p_dst[0], p_pic, 0,<br />+ !b_top_field_first );<br /> if( p_dst[1] )<br />- RenderLinear( p_filter, p_dst[1], p_pic, b_top_field_first );<br />+ RenderLinear( p_filter, p_dst[1], p_pic, 1,<br />+ b_top_field_first );<br /> if( p_dst[2] )<br />- RenderLinear( p_filter, p_dst[2], p_pic, !b_top_field_first );<br />+ RenderLinear( p_filter, p_dst[2], p_pic, 2,<br />+ !b_top_field_first );<br /> break;<br /> <br /> case DEINTERLACE_MEAN:<br />- RenderMean( p_filter, p_dst[0], p_pic );<br />+ RenderMean( p_filter, p_dst[0], p_pic, 0, 0 );<br /> break;<br /> <br /> case DEINTERLACE_BLEND:<br />- RenderBlend( p_filter, p_dst[0], p_pic );<br />+ RenderBlend( p_filter, p_dst[0], p_pic, 0, 0 );<br /> break;<br /> <br /> case DEINTERLACE_X:<br />- RenderX( p_dst[0], p_pic );<br />+ RenderX( p_filter, p_dst[0], p_pic, 0, 0 );<br /> break;<br /> <br /> case DEINTERLACE_YADIF:<br />@@ -486,21 +492,21 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )<br /> break;<br /> <br /> case DEINTERLACE_PHOSPHOR:<br />- if( RenderPhosphor( p_filter, p_dst[0], 0,<br />+ if( RenderPhosphor( p_filter, p_dst[0], p_pic, 0,<br /> !b_top_field_first ) )<br /> goto drop;<br /> if( p_dst[1] )<br />- RenderPhosphor( p_filter, p_dst[1], 1,<br />+ RenderPhosphor( p_filter, p_dst[1], p_pic, 1,<br /> b_top_field_first );<br /> if( p_dst[2] )<br />- RenderPhosphor( p_filter, p_dst[2], 2,<br />+ RenderPhosphor( p_filter, p_dst[2], p_pic, 2,<br /> !b_top_field_first );<br /> break;<br /> <br /> case DEINTERLACE_IVTC:<br /> /* Note: RenderIVTC will automatically drop the duplicate frames<br /> produced by IVTC. This is part of normal operation. */<br />- if( RenderIVTC( p_filter, p_dst[0] ) )<br />+ if( RenderIVTC( p_filter, p_dst[0], p_pic, 0, 0 ) )<br /> goto drop;<br /> break;<br /> }</pre></blockquote></div><br clear="all">What is the return value used for?<br>
-- <br>
Rémi Denis-Courmont<br>
Typed on an inconvenient virtual keyboard</body></html>