29 #define OFFSET(x) offsetof(IDETContext, x) 30 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 34 {
"prog_thres",
"set progressive threshold",
OFFSET(progressive_threshold),
AV_OPT_TYPE_FLOAT, {.dbl = 1.5}, -1, FLT_MAX, FLAGS },
35 {
"rep_thres",
"set repeat threshold",
OFFSET(repeat_threshold),
AV_OPT_TYPE_FLOAT, {.dbl = 3.0}, -1, FLT_MAX, FLAGS },
36 {
"half_life",
"half life of cumulative statistics",
OFFSET(half_life),
AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, -1, INT_MAX, FLAGS },
37 {
"analyze_interlaced_flag",
"set number of frames to use to determine if the interlace flag is accurate",
OFFSET(analyze_interlaced_flag),
AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, FLAGS },
46 case TFF :
return "tff";
47 case BFF :
return "bff";
54 #define PRECISION 1048576 56 static uint64_t
uintpow(uint64_t
b,
unsigned int e)
67 uint64_t print_precision =
uintpow(10, digits);
71 snprintf(valuestr,
sizeof(valuestr),
"%"PRId64
".%0*"PRId64,
72 value / print_precision, digits, value % print_precision);
79 switch(repeated_field) {
93 int v = (*a++ + *c++) - 2 * *b++;
106 int v = (*a++ + *c++) - 2 * *b++;
117 int64_t
alpha[2]={0};
119 int64_t gamma[2]={0};
135 for (y = 2; y < h - 2; y++) {
139 alpha[ y &1] += idet->
filter_line(cur-refs, prev, cur+refs, w);
140 alpha[(y^1)&1] += idet->
filter_line(cur-refs, next, cur+refs, w);
141 delta += idet->
filter_line(cur-refs, cur, cur+refs, w);
142 gamma[(y^1)&1] += idet->
filter_line(cur , prev, cur , w);
172 if(idet->
history[i] == best_type) {
213 av_log(ctx,
AV_LOG_DEBUG,
"Repeated Field:%12s, Single frame:%12s, Multi frame:%12s\n",
254 if( picref->
width != link->
w 341 av_log(ctx, level,
"Repeated Fields: Neither:%6"PRId64
" Top:%6"PRId64
" Bottom:%6"PRId64
"\n",
346 av_log(ctx, level,
"Single frame detection: TFF:%6"PRId64
" BFF:%6"PRId64
" Progressive:%6"PRId64
" Undetermined:%6"PRId64
"\n",
352 av_log(ctx, level,
"Multi frame detection: TFF:%6"PRId64
" BFF:%6"PRId64
" Progressive:%6"PRId64
" Undetermined:%6"PRId64
"\n",
453 .priv_class = &idet_class,
in the bitstream is reported as 00b
static void filter(AVFilterContext *ctx)
static float alpha(float a)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
static const char * type2str(Type type)
#define AV_PIX_FMT_YUV444P14
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
static int query_formats(AVFilterContext *ctx)
int h
agreed upon image height
static const AVFilterPad idet_inputs[]
#define AV_PIX_FMT_YUV420P12
int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const uint16_t *c, int w)
float interlace_threshold
const AVPixFmtDescriptor * csp
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static const AVFilterPad idet_outputs[]
float progressive_threshold
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
char * name
name of this filter instance
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
uint64_t decay_coefficient
static const AVOption idet_options[]
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AVERROR_EOF
End of file.
AVDictionary * metadata
metadata.
#define AV_PIX_FMT_YUV444P16
int interlaced_frame
The content of the picture is interlaced.
#define AV_PIX_FMT_YUV422P12
A filter pad used for either input or output.
A link between two filters.
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
void ff_idet_init_x86(IDETContext *idet, int for_16b)
uint8_t history[HIST_SIZE]
int analyze_interlaced_flag
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFILTER_DEFINE_CLASS(idet)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int(* ff_idet_filter_func)(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w)
void * priv
private data for use by the filter
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static const char * rep2str(RepeatedField repeated_field)
#define AV_PIX_FMT_YUV444P10
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int w
agreed upon image width
#define AV_PIX_FMT_YUV422P9
int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w)
uint8_t nb_components
The number of components each pixel has, (1-4)
#define AV_PIX_FMT_GRAY16
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
uint64_t total_prestat[4]
AVFilterContext * src
source filter
static const AVFilterPad inputs[]
#define AV_PIX_FMT_YUV444P9
ff_idet_filter_func filter_line
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
static const AVFilterPad outputs[]
int format
agreed upon media format
static av_cold void uninit(AVFilterContext *ctx)
#define AV_PIX_FMT_YUV420P16
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
#define AV_LOG_INFO
Standard information.
#define AV_PIX_FMT_YUV420P14
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
static uint64_t uintpow(uint64_t b, unsigned int e)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
const char * name
Filter name.
#define AV_PIX_FMT_YUV420P9
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P10
static int request_frame(AVFilterLink *link)
#define AV_PIX_FMT_YUV444P12
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal and external API header
uint64_t total_poststat[4]
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
int analyze_interlaced_flag_done
int top_field_first
If the content is interlaced, is top field displayed first.
static int filter_frame(AVFilterLink *link, AVFrame *picref)
AVFilterContext * dst
dest filter
static av_cold int init(AVFilterContext *ctx)
int interlaced_flag_accuracy
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
uint64_t total_repeats[3]
int depth
Number of bits in the component.
AVPixelFormat
Pixel format.
static int av_dict_set_fxp(AVDictionary **pm, const char *key, uint64_t value, unsigned int digits, int flags)
#define AV_PIX_FMT_YUV422P16
#define AV_CEIL_RSHIFT(a, b)