[vlc-devel] [PATCH 08/15] video_filter:deinterlace: normalize render callback signatures
Steve Lhomme
robux4 at videolabs.io
Fri Jun 30 14:20:01 CEST 2017
---
modules/video_filter/deinterlace/algo_basic.c | 28 ++++++++++++++++--------
modules/video_filter/deinterlace/algo_basic.h | 16 ++++++--------
modules/video_filter/deinterlace/algo_ivtc.c | 3 ++-
modules/video_filter/deinterlace/algo_ivtc.h | 2 +-
modules/video_filter/deinterlace/algo_phosphor.c | 3 ++-
modules/video_filter/deinterlace/algo_phosphor.h | 2 +-
modules/video_filter/deinterlace/algo_x.c | 4 +++-
modules/video_filter/deinterlace/algo_x.h | 2 +-
modules/video_filter/deinterlace/algo_yadif.c | 7 +++++-
modules/video_filter/deinterlace/algo_yadif.h | 5 +++++
modules/video_filter/deinterlace/deinterlace.c | 24 ++++++++++----------
11 files changed, 59 insertions(+), 37 deletions(-)
diff --git a/modules/video_filter/deinterlace/algo_basic.c b/modules/video_filter/deinterlace/algo_basic.c
index e2cfdf63fc..6ad9b06e0c 100644
--- a/modules/video_filter/deinterlace/algo_basic.c
+++ b/modules/video_filter/deinterlace/algo_basic.c
@@ -43,9 +43,9 @@
* RenderDiscard: only keep TOP or BOTTOM field, discard the other.
*****************************************************************************/
-void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field )
+int RenderDiscard( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic )
{
- assert(i_field == 0);
+ VLC_UNUSED(p_filter);
int i_plane;
/* Copy image and skip lines */
@@ -67,14 +67,18 @@ void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field )
p_in += 2 * p_pic->p[i_plane].i_pitch;
}
}
+ return VLC_SUCCESS;
}
/*****************************************************************************
* RenderBob: renders a BOB picture - simple copy
*****************************************************************************/
-void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field )
+int RenderBob( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,
+ int order, int i_field )
{
+ VLC_UNUSED(p_filter);
+ VLC_UNUSED(order);
int i_plane;
/* Copy image and skip lines */
@@ -119,15 +123,18 @@ void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field )
memcpy( p_out, p_in, p_pic->p[i_plane].i_pitch );
}
}
+ return VLC_SUCCESS;
}
/*****************************************************************************
* RenderLinear: BOB with linear interpolation
*****************************************************************************/
-void RenderLinear( filter_t *p_filter,
- picture_t *p_outpic, picture_t *p_pic, int i_field )
+int RenderLinear( filter_t *p_filter,
+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field )
{
+ VLC_UNUSED(p_filter);
+ VLC_UNUSED(order);
int i_plane;
/* Copy image and skip lines */
@@ -174,15 +181,16 @@ void RenderLinear( filter_t *p_filter,
}
}
EndMerge();
+ return VLC_SUCCESS;
}
/*****************************************************************************
* RenderMean: Half-resolution blender
*****************************************************************************/
-void RenderMean( filter_t *p_filter,
- picture_t *p_outpic, picture_t *p_pic )
+int RenderMean( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic )
{
+ VLC_UNUSED(p_filter);
int i_plane;
/* Copy image and skip lines */
@@ -207,15 +215,16 @@ void RenderMean( filter_t *p_filter,
}
}
EndMerge();
+ return VLC_SUCCESS;
}
/*****************************************************************************
* RenderBlend: Full-resolution blender
*****************************************************************************/
-void RenderBlend( filter_t *p_filter,
- picture_t *p_outpic, picture_t *p_pic )
+int RenderBlend( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic )
{
+ VLC_UNUSED(p_filter);
int i_plane;
/* Copy image and skip lines */
@@ -244,4 +253,5 @@ void RenderBlend( filter_t *p_filter,
}
}
EndMerge();
+ return VLC_SUCCESS;
}
diff --git a/modules/video_filter/deinterlace/algo_basic.h b/modules/video_filter/deinterlace/algo_basic.h
index 2b1d9e3c81..e72b3e909d 100644
--- a/modules/video_filter/deinterlace/algo_basic.h
+++ b/modules/video_filter/deinterlace/algo_basic.h
@@ -46,11 +46,10 @@ struct picture_t;
*
* @param p_outpic Output frame. Must be allocated by caller.
* @param p_pic Input frame. Must exist.
- * @param i_field Keep which field? 0 = top field, 1 = bottom field.
* @see RenderBob()
* @see Deinterlace()
*/
-void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field );
+int RenderDiscard( filter_t *, picture_t *p_outpic, picture_t *p_pic );
/**
* RenderBob: basic framerate doubler.
@@ -65,7 +64,8 @@ void RenderDiscard( picture_t *p_outpic, picture_t *p_pic, int i_field );
* @see RenderLinear()
* @see Deinterlace()
*/
-void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field );
+int RenderBob( filter_t *,
+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field );
/**
* RenderLinear: Bob with linear interpolation.
@@ -79,8 +79,8 @@ void RenderBob( picture_t *p_outpic, picture_t *p_pic, int i_field );
* @see RenderBob()
* @see Deinterlace()
*/
-void RenderLinear( filter_t *p_filter,
- picture_t *p_outpic, picture_t *p_pic, int i_field );
+int RenderLinear( filter_t *p_filter,
+ picture_t *p_outpic, picture_t *p_pic, int order, int i_field );
/**
* RenderMean: half-resolution blender.
@@ -94,8 +94,7 @@ void RenderLinear( filter_t *p_filter,
* @param p_pic Input frame. Must exist.
* @see Deinterlace()
*/
-void RenderMean( filter_t *p_filter,
- picture_t *p_outpic, picture_t *p_pic );
+int RenderMean( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic );
/**
* RenderBlend: full-resolution blender.
@@ -110,7 +109,6 @@ void RenderMean( filter_t *p_filter,
* @param p_pic Input frame. Must exist.
* @see Deinterlace()
*/
-void RenderBlend( filter_t *p_filter,
- picture_t *p_outpic, picture_t *p_pic );
+int RenderBlend( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic );
#endif
diff --git a/modules/video_filter/deinterlace/algo_ivtc.c b/modules/video_filter/deinterlace/algo_ivtc.c
index 1ae36da5d0..e320dde42b 100644
--- a/modules/video_filter/deinterlace/algo_ivtc.c
+++ b/modules/video_filter/deinterlace/algo_ivtc.c
@@ -1469,8 +1469,9 @@ static bool IVTCOutputOrDropFrame( filter_t *p_filter, picture_t *p_dst )
*****************************************************************************/
/* See function doc in header. */
-int RenderIVTC( filter_t *p_filter, picture_t *p_dst )
+int RenderIVTC( filter_t *p_filter, picture_t *p_dst, picture_t *p_pic )
{
+ VLC_UNUSED(p_pic);
assert( p_filter != NULL );
assert( p_dst != NULL );
diff --git a/modules/video_filter/deinterlace/algo_ivtc.h b/modules/video_filter/deinterlace/algo_ivtc.h
index 3bc4ff3f0a..2a090132e9 100644
--- a/modules/video_filter/deinterlace/algo_ivtc.h
+++ b/modules/video_filter/deinterlace/algo_ivtc.h
@@ -141,7 +141,7 @@ typedef struct
* @see CalculateInterlaceScore()
* @see EstimateNumBlocksWithMotion()
*/
-int RenderIVTC( filter_t *p_filter, picture_t *p_dst );
+int RenderIVTC( filter_t *p_filter, picture_t *p_dst, picture_t *p_pic );
/**
* Clears the inverse telecine subsystem state.
diff --git a/modules/video_filter/deinterlace/algo_phosphor.c b/modules/video_filter/deinterlace/algo_phosphor.c
index 0240e0bce5..cc90ec13a6 100644
--- a/modules/video_filter/deinterlace/algo_phosphor.c
+++ b/modules/video_filter/deinterlace/algo_phosphor.c
@@ -278,9 +278,10 @@ static void DarkenFieldMMX( picture_t *p_dst,
/* See header for function doc. */
int RenderPhosphor( filter_t *p_filter,
- picture_t *p_dst,
+ picture_t *p_dst, picture_t *p_pic,
int i_order, int i_field )
{
+ VLC_UNUSED(p_pic);
assert( p_filter != NULL );
assert( p_dst != NULL );
assert( i_order >= 0 && i_order <= 2 ); /* 2 = soft field repeat */
diff --git a/modules/video_filter/deinterlace/algo_phosphor.h b/modules/video_filter/deinterlace/algo_phosphor.h
index 8159adb374..14aa252502 100644
--- a/modules/video_filter/deinterlace/algo_phosphor.h
+++ b/modules/video_filter/deinterlace/algo_phosphor.h
@@ -101,7 +101,7 @@ typedef struct
* @see Deinterlace()
*/
int RenderPhosphor( filter_t *p_filter,
- picture_t *p_dst,
+ picture_t *p_dst, picture_t *p_pic,
int i_order, int i_field );
/*****************************************************************************
diff --git a/modules/video_filter/deinterlace/algo_x.c b/modules/video_filter/deinterlace/algo_x.c
index 70633a6fc0..164dc3e822 100644
--- a/modules/video_filter/deinterlace/algo_x.c
+++ b/modules/video_filter/deinterlace/algo_x.c
@@ -512,8 +512,9 @@ static inline void XDeintBand8x8MMXEXT( uint8_t *dst, int i_dst,
* Public functions
*****************************************************************************/
-void RenderX( picture_t *p_outpic, picture_t *p_pic )
+int RenderX( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic )
{
+ VLC_UNUSED(p_filter);
int i_plane;
#if defined (CAN_COMPILE_MMXEXT)
const bool mmxext = vlc_CPU_MMXEXT();
@@ -569,4 +570,5 @@ void RenderX( picture_t *p_outpic, picture_t *p_pic )
if( mmxext )
emms();
#endif
+ return VLC_SUCCESS;
}
diff --git a/modules/video_filter/deinterlace/algo_x.h b/modules/video_filter/deinterlace/algo_x.h
index 16b7cd1bde..3ac1b4289a 100644
--- a/modules/video_filter/deinterlace/algo_x.h
+++ b/modules/video_filter/deinterlace/algo_x.h
@@ -50,6 +50,6 @@ struct picture_t;
* @param[out] p_outpic Output frame. Must be allocated by caller.
* @see Deinterlace()
*/
-void RenderX( picture_t *p_outpic, picture_t *p_pic );
+int RenderX( filter_t *, picture_t *p_outpic, picture_t *p_pic );
#endif
diff --git a/modules/video_filter/deinterlace/algo_yadif.c b/modules/video_filter/deinterlace/algo_yadif.c
index da3470dde6..122af599cd 100644
--- a/modules/video_filter/deinterlace/algo_yadif.c
+++ b/modules/video_filter/deinterlace/algo_yadif.c
@@ -47,6 +47,11 @@
Necessary preprocessor macros are defined in common.h. */
#include "yadif.h"
+int RenderYadifSingle( filter_t *p_filter, picture_t *p_dst, picture_t *p_src )
+{
+ return RenderYadif( p_filter, p_dst, p_src, 0, 0 );
+}
+
int RenderYadif( filter_t *p_filter, picture_t *p_dst, picture_t *p_src,
int i_order, int i_field )
{
@@ -182,7 +187,7 @@ int RenderYadif( filter_t *p_filter, picture_t *p_dst, picture_t *p_src,
as set by Open() or SetFilterMethod(). It is always 0. */
/* FIXME not good as it does not use i_order/i_field */
- RenderX( p_dst, p_next );
+ RenderX( p_filter, p_dst, p_next );
return VLC_SUCCESS;
}
else
diff --git a/modules/video_filter/deinterlace/algo_yadif.h b/modules/video_filter/deinterlace/algo_yadif.h
index d1ff76f817..7bc4518b0e 100644
--- a/modules/video_filter/deinterlace/algo_yadif.h
+++ b/modules/video_filter/deinterlace/algo_yadif.h
@@ -86,4 +86,9 @@ struct picture_t;
int RenderYadif( filter_t *p_filter, picture_t *p_dst, picture_t *p_src,
int i_order, int i_field );
+/**
+ * Same as RenderYadif() but with no temporal references
+ */
+int RenderYadifSingle( filter_t *p_filter, picture_t *p_dst, picture_t *p_src );
+
#endif
diff --git a/modules/video_filter/deinterlace/deinterlace.c b/modules/video_filter/deinterlace/deinterlace.c
index 20492c9d46..741c1831f1 100644
--- a/modules/video_filter/deinterlace/deinterlace.c
+++ b/modules/video_filter/deinterlace/deinterlace.c
@@ -426,23 +426,23 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
switch( p_sys->i_mode )
{
case DEINTERLACE_DISCARD:
- RenderDiscard( p_dst[0], p_pic, 0 );
+ RenderDiscard( p_filter, p_dst[0], p_pic );
break;
case DEINTERLACE_BOB:
- RenderBob( p_dst[0], p_pic, !b_top_field_first );
+ RenderBob( p_filter, p_dst[0], p_pic, 0, !b_top_field_first );
if( p_dst[1] )
- RenderBob( p_dst[1], p_pic, b_top_field_first );
+ RenderBob( p_filter, p_dst[1], p_pic, 1, b_top_field_first );
if( p_dst[2] )
- RenderBob( p_dst[2], p_pic, !b_top_field_first );
+ RenderBob( p_filter, p_dst[2], p_pic, 2, !b_top_field_first );
break;;
case DEINTERLACE_LINEAR:
- RenderLinear( p_filter, p_dst[0], p_pic, !b_top_field_first );
+ RenderLinear( p_filter, p_dst[0], p_pic, 0, !b_top_field_first );
if( p_dst[1] )
- RenderLinear( p_filter, p_dst[1], p_pic, b_top_field_first );
+ RenderLinear( p_filter, p_dst[1], p_pic, 1, b_top_field_first );
if( p_dst[2] )
- RenderLinear( p_filter, p_dst[2], p_pic, !b_top_field_first );
+ RenderLinear( p_filter, p_dst[2], p_pic, 2, !b_top_field_first );
break;
case DEINTERLACE_MEAN:
@@ -454,7 +454,7 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
break;
case DEINTERLACE_X:
- RenderX( p_dst[0], p_pic );
+ RenderX( p_filter, p_dst[0], p_pic );
break;
case DEINTERLACE_YADIF:
@@ -472,21 +472,21 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
break;
case DEINTERLACE_PHOSPHOR:
- if( RenderPhosphor( p_filter, p_dst[0], 0,
+ if( RenderPhosphor( p_filter, p_dst[0], p_pic, 0,
!b_top_field_first ) )
goto drop;
if( p_dst[1] )
- RenderPhosphor( p_filter, p_dst[1], 1,
+ RenderPhosphor( p_filter, p_dst[1], p_pic, 1,
b_top_field_first );
if( p_dst[2] )
- RenderPhosphor( p_filter, p_dst[2], 2,
+ RenderPhosphor( p_filter, p_dst[2], p_pic, 2,
!b_top_field_first );
break;
case DEINTERLACE_IVTC:
/* Note: RenderIVTC will automatically drop the duplicate frames
produced by IVTC. This is part of normal operation. */
- if( RenderIVTC( p_filter, p_dst[0] ) )
+ if( RenderIVTC( p_filter, p_dst[0], p_pic ) )
goto drop;
break;
}
--
2.12.1
More information about the vlc-devel
mailing list