162 #define OFFSET(x) offsetof(SelectContext, x)
163 #define DEFINE_OPTIONS(filt_name, FLAGS) \
164 static const AVOption filt_name##_options[] = { \
165 { "expr", "set an expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags=FLAGS }, \
166 { "e", "set an expression to use for selecting frames", OFFSET(expr_str), AV_OPT_TYPE_STRING, { .str = "1" }, .flags=FLAGS }, \
167 { "outputs", "set the number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, .flags=FLAGS }, \
168 { "n", "set the number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, .flags=FLAGS }, \
193 pad.
type =
ctx->filter->inputs[0].type;
204 #define INTERLACE_TYPE_P 0
205 #define INTERLACE_TYPE_T 1
206 #define INTERLACE_TYPE_B 2
214 desc->nb_components >= 3;
219 for (
int plane = 0; plane < select->
nb_planes; plane++) {
221 int vsub =
desc->log2_chroma_h;
286 for (
int plane = 0; plane < select->
nb_planes; plane++) {
290 select->
width[plane], select->
height[plane], &plane_sad);
292 count += select->
width[plane] * select->
height[plane];
296 mafd = (double)sad / count / (1ULL << (select->
bitdepth - 8));
311 if (start_time_entry) {
314 if (duration_entry) {
346 switch (inlink->
type) {
368 "n:%f pts:%f t:%f key:%d",
374 switch (inlink->
type) {
391 }
else if (
isnan(res) || res < 0) {
440 for (
i = 0;
i <
ctx->nb_outputs;
i++)
448 #if CONFIG_ASELECT_FILTER
469 static const AVFilterPad avfilter_af_aselect_inputs[] = {
482 .init = aselect_init,
485 .
inputs = avfilter_af_aselect_inputs,
486 .priv_class = &aselect_class,
491 #if CONFIG_SELECT_FILTER
533 static const AVFilterPad avfilter_vf_select_inputs[] = {
550 .priv_class = &select_class,
551 .
inputs = avfilter_vf_select_inputs,
static int query_formats(AVFilterContext *ctx)
static const AVFilterPad inputs[]
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Main libavfilter public API header.
char * av_asprintf(const char *fmt,...)
#define flags(name, subs,...)
#define AV_CEIL_RSHIFT(a, b)
#define CONFIG_SELECT_FILTER
static __device__ float fabs(float a)
static __device__ float ceilf(float a)
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
int av_expr_parse(AVExpr **expr, const char *s, const char *const *const_names, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), int log_offset, void *log_ctx)
Parse an expression.
simple arithmetic expression evaluator
static double get_concatdec_select(AVFrame *frame, int64_t pts)
static int config_input(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static double get_scene_score(AVFilterContext *ctx, AVFrame *frame)
static int request_frame(AVFilterLink *outlink)
static const char *const var_names[]
static av_cold int init(AVFilterContext *ctx)
static av_cold void uninit(AVFilterContext *ctx)
#define DEFINE_OPTIONS(filt_name, FLAGS)
static void select_frame(AVFilterContext *ctx, AVFrame *frame)
static int64_t start_time
a very simple circular buffer FIFO implementation
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane)
Compute the size of an image line with format pix_fmt and width width for the plane plane.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PICTURE_TYPE_BI
BI type.
@ AV_PICTURE_TYPE_SP
Switching Predicted.
@ AV_PICTURE_TYPE_P
Predicted.
@ AV_PICTURE_TYPE_SI
Switching Intra.
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
static int ff_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new output pad for the filter.
#define AVFILTER_DEFINE_CLASS(fname)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static enum AVPixelFormat pix_fmts[]
#define AV_OPT_FLAG_FILTERING_PARAM
a generic parameter which can be set by the user for filtering
#define AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_VIDEO_PARAM
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.
#define AV_PIX_FMT_YUV420P10
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
ff_scene_sad_fn ff_scene_sad_get_fn(int depth)
void(* ff_scene_sad_fn)(SCENE_SAD_PARAMS)
Describe the class of an AVClass context structure.
AVFilterLink ** inputs
array of pointers to input links
void * priv
private data for use by the filter
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
enum AVMediaType type
filter media type
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int sample_rate
samples per second
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
int(* request_frame)(AVFilterLink *link)
Frame request callback.
enum AVMediaType type
AVFilterPad type.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int key_frame
1 -> keyframe, 0-> not
int64_t pkt_pos
reordered pos from the last AVPacket that has been input into the decoder
AVDictionary * metadata
metadata.
int top_field_first
If the content is interlaced, is top field displayed first.
int interlaced_frame
The content of the picture is interlaced.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
enum AVPictureType pict_type
Picture type of the frame.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
int do_scene_detect
1 if the expression requires scene detection variables, 0 otherwise
double prev_mafd
previous MAFD (scene detect only)
int select_out
mark the selected output pad index
double var_values[VAR_VARS_NB]
ff_scene_sad_fn sad
Sum of the absolute difference function (scene detect only)
AVFrame * prev_picref
previous frame (scene detect only)
static av_always_inline int diff(const uint32_t a, const uint32_t b)