From fa74e4aef2103e27424d2cfae3f142149b6a3b36 Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Sun, 4 Nov 2018 10:02:07 -0800 Subject: avfilter/yadif_common: Add field type tracking to help bwdif The bwdif filter can use common yadif frame management if we track when a field is the first or last field in a sequence. While this information is not used by yadif, the added benefit of removing the duplicated frame management logic makes it worth tracking this state in the common code. --- libavfilter/yadif.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libavfilter/yadif.h') diff --git a/libavfilter/yadif.h b/libavfilter/yadif.h index 32d6f4a0d4..c928911b35 100644 --- a/libavfilter/yadif.h +++ b/libavfilter/yadif.h @@ -41,6 +41,12 @@ enum YADIFDeint { YADIF_DEINT_INTERLACED = 1, ///< only deinterlace frames marked as interlaced }; +enum YADIFCurrentField { + YADIF_FIELD_BACK_END = -1, ///< The last frame in a sequence + YADIF_FIELD_END = 0, ///< The first or last field in a sequence + YADIF_FIELD_NORMAL = 1, ///< A normal field in the middle of a sequence +}; + typedef struct YADIFContext { const AVClass *class; @@ -70,6 +76,14 @@ typedef struct YADIFContext { int eof; uint8_t *temp_line; int temp_line_size; + + /* + * An algorithm that treats first and/or last fields in a sequence + * differently can use this to detect those cases. It is the algorithm's + * responsibility to set the value to YADIF_FIELD_NORMAL after processing + * the first field. + */ + int current_field; ///< YADIFCurrentField } YADIFContext; void ff_yadif_init_x86(YADIFContext *yadif); -- cgit v1.2.3