mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 21:28:45 +00:00
deinterlace: Add support for deinterlacing using buffer caps/flags
When not using the fieldanalysis element immediately upstream of deinterlace, behaviour should remain unchanged. fieldanalysis will set the caps and flags on the buffers such that they can be interpreted and acted upon to produce progressive output. There are two main modes of operation: - Passive pattern locking Passive pattern locking is a non-blocking, low-latency mode of operation that is suitable for close-to-live usage. Initially a telecine stream will be output as variable framerate with naïve timestamp adjustment. With each incoming buffer, an attempt is made to lock onto a pattern. When a lock is obtained, the src pad and output buffer caps will reflect the pattern and timestamps will be accurately interpolated between pattern repeats. This means that initially and at pattern transitions there will be short periods of inaccurate timestamping. - Active pattern locking Active pattern locking is a blocking, high-latency mode of operation that is targeted at use-cases where timestamp accuracy is paramount. Buffers will be queued until enough are present to make a lock. When locked, timestamps will be accurately interpolated between pattern repeats. Orphan fields can be dropped or deinterlaced. If no lock can be obtained, a single field might be pushed through to be deinterlaced. Locking can also be disabled or 'auto' chooses between passive and active locking modes depending on whether upstream is live.
This commit is contained in:
parent
165fbc368e
commit
c1b100cf9c
2 changed files with 1075 additions and 180 deletions
File diff suppressed because it is too large
Load diff
|
@ -43,8 +43,6 @@ G_BEGIN_DECLS
|
||||||
typedef struct _GstDeinterlace GstDeinterlace;
|
typedef struct _GstDeinterlace GstDeinterlace;
|
||||||
typedef struct _GstDeinterlaceClass GstDeinterlaceClass;
|
typedef struct _GstDeinterlaceClass GstDeinterlaceClass;
|
||||||
|
|
||||||
#define GST_DEINTERLACE_MAX_FIELD_HISTORY 10
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GST_DEINTERLACE_TOMSMOCOMP,
|
GST_DEINTERLACE_TOMSMOCOMP,
|
||||||
|
@ -79,6 +77,39 @@ typedef enum {
|
||||||
GST_DEINTERLACE_MODE_DISABLED
|
GST_DEINTERLACE_MODE_DISABLED
|
||||||
} GstDeinterlaceMode;
|
} GstDeinterlaceMode;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
GST_DEINTERLACE_LOCKING_NONE,
|
||||||
|
GST_DEINTERLACE_LOCKING_AUTO,
|
||||||
|
GST_DEINTERLACE_LOCKING_ACTIVE,
|
||||||
|
GST_DEINTERLACE_LOCKING_PASSIVE,
|
||||||
|
} GstDeinterlaceLocking;
|
||||||
|
|
||||||
|
#define GST_DEINTERLACE_MAX_FIELD_HISTORY 10
|
||||||
|
#define GST_DEINTERLACE_MAX_BUFFER_STATE_HISTORY 50
|
||||||
|
/* check max field history is large enough */
|
||||||
|
#if GST_DEINTERLACE_MAX_FIELD_HISTORY < GST_DEINTERLACE_MAX_BUFFER_STATE_HISTORY * 3
|
||||||
|
#undef GST_DEINTERLACE_MAX_FIELD_HISTORY
|
||||||
|
#define GST_DEINTERLACE_MAX_FIELD_HISTORY (GST_DEINTERLACE_MAX_BUFFER_STATE_HISTORY * 3)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct _TelecinePattern TelecinePattern;
|
||||||
|
struct _TelecinePattern
|
||||||
|
{
|
||||||
|
const gchar *nick;
|
||||||
|
guint8 length;
|
||||||
|
guint8 ratio_n, ratio_d;
|
||||||
|
guint8 states[GST_DEINTERLACE_MAX_BUFFER_STATE_HISTORY];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct _GstDeinterlaceBufferState GstDeinterlaceBufferState;
|
||||||
|
struct _GstDeinterlaceBufferState
|
||||||
|
{
|
||||||
|
GstClockTime timestamp;
|
||||||
|
GstClockTime duration;
|
||||||
|
guint8 state;
|
||||||
|
};
|
||||||
|
|
||||||
struct _GstDeinterlace
|
struct _GstDeinterlace
|
||||||
{
|
{
|
||||||
GstElement parent;
|
GstElement parent;
|
||||||
|
@ -92,8 +123,10 @@ struct _GstDeinterlace
|
||||||
|
|
||||||
GstDeinterlaceFields fields;
|
GstDeinterlaceFields fields;
|
||||||
|
|
||||||
GstDeinterlaceMethods method_id; /* current state (differs when flushing) */
|
/* current state (differs when flushing/inverse telecine using weave) */
|
||||||
GstDeinterlaceMethods user_set_method_id; /* property value */
|
GstDeinterlaceMethods method_id;
|
||||||
|
/* property value */
|
||||||
|
GstDeinterlaceMethods user_set_method_id;
|
||||||
GstDeinterlaceMethod *method;
|
GstDeinterlaceMethod *method;
|
||||||
|
|
||||||
GstVideoFormat format;
|
GstVideoFormat format;
|
||||||
|
@ -134,6 +167,24 @@ struct _GstDeinterlace
|
||||||
gboolean reconfigure;
|
gboolean reconfigure;
|
||||||
GstDeinterlaceMode new_mode;
|
GstDeinterlaceMode new_mode;
|
||||||
GstDeinterlaceFields new_fields;
|
GstDeinterlaceFields new_fields;
|
||||||
|
|
||||||
|
GstDeinterlaceLocking locking;
|
||||||
|
gint low_latency;
|
||||||
|
gboolean drop_orphans;
|
||||||
|
gboolean ignore_obscure;
|
||||||
|
gboolean pattern_lock;
|
||||||
|
gboolean pattern_refresh;
|
||||||
|
GstDeinterlaceBufferState buf_states[GST_DEINTERLACE_MAX_BUFFER_STATE_HISTORY];
|
||||||
|
gint state_count;
|
||||||
|
gint pattern;
|
||||||
|
guint8 pattern_phase;
|
||||||
|
guint8 pattern_count;
|
||||||
|
guint8 output_count;
|
||||||
|
GstClockTime pattern_base_ts;
|
||||||
|
GstClockTime pattern_buf_dur;
|
||||||
|
|
||||||
|
gboolean need_more;
|
||||||
|
gboolean have_eos;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstDeinterlaceClass
|
struct _GstDeinterlaceClass
|
||||||
|
|
Loading…
Reference in a new issue