FFmpeg
Data Structures | Macros | Functions | Variables
vf_readeia608.c File Reference
#include <string.h>
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/timestamp.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  LineItem
 
struct  CodeItem
 
struct  ReadEIA608Context
 

Macros

#define LAG   25
 
#define CLOCK_BITSIZE_MIN   0.2f
 
#define CLOCK_BITSIZE_MAX   1.5f
 
#define SYNC_BITSIZE_MIN   12.f
 
#define SYNC_BITSIZE_MAX   15.f
 
#define OFFSET(x)   offsetof(ReadEIA608Context, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

 AVFILTER_DEFINE_CLASS (readeia608)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static void build_histogram (ReadEIA608Context *s, const LineItem *line, int len)
 
static void find_black_and_white (ReadEIA608Context *s)
 
static float meanf (const LineItem *line, int len)
 
static float stddevf (const LineItem *line, int len)
 
static void thresholding (ReadEIA608Context *s, LineItem *line, int lag, float threshold, float influence, int len)
 
static int periods (const LineItem *line, CodeItem *code, int len)
 
static void dump_code (AVFilterContext *ctx, int len, int item)
 
static void extract_line (AVFilterContext *ctx, AVFrame *in, int w, int nb_line)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption readeia608_options []
 
static const AVFilterPad readeia608_inputs []
 
static const AVFilterPad readeia608_outputs []
 
AVFilter ff_vf_readeia608
 

Detailed Description

Filter for reading closed captioning data (EIA-608). See also https://en.wikipedia.org/wiki/EIA-608

Definition in file vf_readeia608.c.

Macro Definition Documentation

◆ LAG

#define LAG   25

Definition at line 39 of file vf_readeia608.c.

◆ CLOCK_BITSIZE_MIN

#define CLOCK_BITSIZE_MIN   0.2f

Definition at line 40 of file vf_readeia608.c.

◆ CLOCK_BITSIZE_MAX

#define CLOCK_BITSIZE_MAX   1.5f

Definition at line 41 of file vf_readeia608.c.

◆ SYNC_BITSIZE_MIN

#define SYNC_BITSIZE_MIN   12.f

Definition at line 42 of file vf_readeia608.c.

◆ SYNC_BITSIZE_MAX

#define SYNC_BITSIZE_MAX   15.f

Definition at line 43 of file vf_readeia608.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(ReadEIA608Context, x)

Definition at line 76 of file vf_readeia608.c.

◆ FLAGS

Definition at line 77 of file vf_readeia608.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( readeia608  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 90 of file vf_readeia608.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 108 of file vf_readeia608.c.

◆ build_histogram()

static void build_histogram ( ReadEIA608Context s,
const LineItem line,
int  len 
)
static

Definition at line 132 of file vf_readeia608.c.

Referenced by extract_line().

◆ find_black_and_white()

static void find_black_and_white ( ReadEIA608Context s)
static

Definition at line 140 of file vf_readeia608.c.

Referenced by extract_line().

◆ meanf()

static float meanf ( const LineItem line,
int  len 
)
static

Definition at line 182 of file vf_readeia608.c.

Referenced by stddevf(), and thresholding().

◆ stddevf()

static float stddevf ( const LineItem line,
int  len 
)
static

Definition at line 194 of file vf_readeia608.c.

Referenced by thresholding().

◆ thresholding()

static void thresholding ( ReadEIA608Context s,
LineItem line,
int  lag,
float  threshold,
float  influence,
int  len 
)
static

Definition at line 205 of file vf_readeia608.c.

Referenced by extract_line().

◆ periods()

static int periods ( const LineItem line,
CodeItem code,
int  len 
)
static

Definition at line 244 of file vf_readeia608.c.

Referenced by extract_line().

◆ dump_code()

static void dump_code ( AVFilterContext ctx,
int  len,
int  item 
)
static

Definition at line 267 of file vf_readeia608.c.

Referenced by extract_line().

◆ extract_line()

static void extract_line ( AVFilterContext ctx,
AVFrame in,
int  w,
int  nb_line 
)
static

Definition at line 278 of file vf_readeia608.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 393 of file vf_readeia608.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 407 of file vf_readeia608.c.

Variable Documentation

◆ readeia608_options

const AVOption readeia608_options[]
static
Initial value:
= {
{ "scan_min", "set from which line to scan for codes", OFFSET(start), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
{ "scan_max", "set to which line to scan for codes", OFFSET(end), AV_OPT_TYPE_INT, {.i64=29}, 0, INT_MAX, FLAGS },
{ "spw", "set ratio of width reserved for sync code detection", OFFSET(spw), AV_OPT_TYPE_FLOAT, {.dbl=.27}, 0.1, 0.7, FLAGS },
{ "chp", "check and apply parity bit", OFFSET(chp), AV_OPT_TYPE_BOOL, {.i64= 0}, 0, 1, FLAGS },
{ "lp", "lowpass line prior to processing", OFFSET(lp), AV_OPT_TYPE_BOOL, {.i64= 1}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 79 of file vf_readeia608.c.

◆ readeia608_inputs

const AVFilterPad readeia608_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.config_props = config_input,
},
{ NULL }
}

Definition at line 415 of file vf_readeia608.c.

◆ readeia608_outputs

const AVFilterPad readeia608_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}

Definition at line 425 of file vf_readeia608.c.

◆ ff_vf_readeia608

AVFilter ff_vf_readeia608
Initial value:
= {
.name = "readeia608",
.description = NULL_IF_CONFIG_SMALL("Read EIA-608 Closed Caption codes from input video and write them to frame metadata."),
.priv_size = sizeof(ReadEIA608Context),
.priv_class = &readeia608_class,
}

Definition at line 433 of file vf_readeia608.c.

end
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:92
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_readeia608.c:393
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_readeia608.c:90
ReadEIA608Context
Definition: vf_readeia608.c:60
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
FLAGS
#define FLAGS
Definition: vf_readeia608.c:77
NULL
#define NULL
Definition: coverity.c:32
readeia608_inputs
static const AVFilterPad readeia608_inputs[]
Definition: vf_readeia608.c:415
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_readeia608.c:407
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
OFFSET
#define OFFSET(x)
Definition: vf_readeia608.c:76
readeia608_outputs
static const AVFilterPad readeia608_outputs[]
Definition: vf_readeia608.c:425
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:125
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:226
config_input
static int config_input(AVFilterLink *inlink)
Definition: vf_readeia608.c:108
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565