64#define SET_META(key, format, value) \
65 snprintf(buf, sizeof(buf), format, value); \
66 av_dict_set(metadata, key, buf, 0)
74 unsigned int black_pixels_count = 0;
79 for (
int x = 0; x < td->
width; x++)
80 black_pixels_count += p[x] < td->
bthresh;
95 int nb_jobs =
FFMIN(inlink->
h, nb_threads);
111 s->last_keyframe =
s->frame;
114 if (pblack >=
s->bamount) {
118 "type:%c last_keyframe:%d\n",
119 s->frame, pblack,
frame->pts,
123 SET_META(
"lavfi.blackframe.pblack",
"%u", pblack);
130#define OFFSET(x) offsetof(BlackFrameContext, x)
131#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
133 {
"amount",
"percentage of the pixels that have to be below the threshold "
135 {
"threshold",
"threshold below which a pixel value is considered black",
137 {
"thresh",
"threshold below which a pixel value is considered black",
153 .p.name =
"blackframe",
155 .p.priv_class = &blackframe_class,
const FFFilter ff_vf_blackframe
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Main libavfilter public API header.
static int FUNC metadata(CodedBitstreamContext *ctx, RWContext *rw, APVRawMetadata *current)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
#define atomic_fetch_add_explicit(object, operand, order)
#define atomic_load_explicit(object, order)
#define atomic_init(obj, value)
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define AV_LOG_INFO
Standard information.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
#define FILTER_PIXFMTS_ARRAY(array)
#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[]
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_NV21
as above, but U and V bytes are swapped
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Describe the class of an AVClass context structure.
AVFilterLink ** outputs
array of pointers to output links
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
AVFilterContext * dst
dest filter
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
unsigned int last_keyframe
frame number of the last received key-frame
unsigned int frame
frame number
atomic_uint nblack
number of black pixels counted so far
int bthresh
black threshold
Used for passing data between threads.
static AVFormatContext * ctx
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
static const AVFilterPad avfilter_vf_blackframe_inputs[]
#define SET_META(key, format, value)
static const AVOption blackframe_options[]
static int blackframe_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)