22#include "config_components.h"
76 int threshold,
const uint8_t *coordinates[],
int coord,
81 for (x = 0; x <
width; x++) {
85 for (
i = 0;
i < 8;
i++) {
86 if (coord & (1 <<
i)) {
97 int threshold,
const uint8_t *coordinates[],
int coord,
100 uint16_t *
dst = (uint16_t *)dstp;
103 for (x = 0; x <
width; x++) {
107 for (
i = 0;
i < 8;
i++) {
108 if (coord & (1 <<
i)) {
119 int threshold,
const uint8_t *coordinates[],
int coord,
124 for (x = 0; x <
width; x++) {
128 for (
i = 0;
i < 8;
i++) {
129 if (coord & (1 <<
i)) {
140 int threshold,
const uint8_t *coordinates[],
int coord,
143 uint16_t *
dst = (uint16_t *)dstp;
146 for (x = 0; x <
width; x++) {
150 for (
i = 0;
i < 8;
i++) {
151 if (coord & (1 <<
i)) {
162 int threshold,
const uint8_t *coordinates[],
int coord,
167 for (x = 0; x <
width; x++) {
171 for (
i = 0;
i < 8; sum += *(coordinates[
i++] + x));
178 int threshold,
const uint8_t *coordinates[],
int coord,
181 uint16_t *
dst = (uint16_t *)dstp;
184 for (x = 0; x <
width; x++) {
188 for (
i = 0;
i < 8; sum +=
AV_RN16A(coordinates[
i++] + x * 2));
195 int threshold,
const uint8_t *coordinates[],
int coord,
200 for (x = 0; x <
width; x++) {
204 for (
i = 0;
i < 8; sum += *(coordinates[
i++] + x));
211 int threshold,
const uint8_t *coordinates[],
int coord,
214 uint16_t *
dst = (uint16_t *)dstp;
217 for (x = 0; x <
width; x++) {
221 for (
i = 0;
i < 8; sum +=
AV_RN16A(coordinates[
i++] + x * 2));
233 s->depth =
desc->comp[0].depth;
234 s->max = (1 <<
s->depth) - 1;
235 s->bpc = (
s->depth + 7) / 8;
238 s->planewidth[0] =
s->planewidth[3] = inlink->
w;
240 s->planeheight[0] =
s->planeheight[3] = inlink->
h;
244 if (!strcmp(
ctx->filter->name,
"erosion"))
246 else if (!strcmp(
ctx->filter->name,
"dilation"))
248 else if (!strcmp(
ctx->filter->name,
"deflate"))
250 else if (!strcmp(
ctx->filter->name,
"inflate"))
264 for (plane = 0; plane <
s->nb_planes; plane++) {
265 const int bpc =
s->bpc;
266 const int threshold =
s->threshold[plane];
268 const int dstride =
out->linesize[plane];
269 const int height =
s->planeheight[plane];
270 const int width =
s->planewidth[plane];
282 const int nh = y > 0;
289 src + 1 * bpc,
src + 1 * bpc,
296 s->filter(
dst,
src, 1, threshold, coordinateslb,
s->coordinates,
s->max);
298 s->filter(
dst + 1 * bpc,
src + 1 * bpc,
width - 2, threshold, coordinates,
s->coordinates,
s->max);
299 s->filter(
dst + (
width - 1) * bpc,
src + (
width - 1) * bpc, 1, threshold, coordinatesrb,
s->coordinates,
s->max);
343#define OFFSET(x) offsetof(NContext, x)
344#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
346#define DEFINE_NEIGHBOR_FILTER(name_, description_, priv_class_) \
347const FFFilter ff_vf_##name_ = { \
349 .p.description = NULL_IF_CONFIG_SMALL(description_), \
350 .p.priv_class = &priv_class_##_class, \
351 .p.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC| \
352 AVFILTER_FLAG_SLICE_THREADS, \
353 .priv_size = sizeof(NContext), \
354 FILTER_INPUTS(neighbor_inputs), \
355 FILTER_OUTPUTS(ff_video_default_filterpad), \
356 FILTER_PIXFMTS_ARRAY(pix_fmts), \
357 .process_command = ff_filter_process_command, \
362#define DEINFLATE_OPTIONS_OFFSET (CONFIG_EROSION_FILTER || CONFIG_DILATION_FILTER)
364#if CONFIG_EROSION_FILTER || CONFIG_DILATION_FILTER
376#if CONFIG_EROSION_FILTER
382#if CONFIG_DILATION_FILTER
391#if CONFIG_DEFLATE_FILTER
397#if CONFIG_INFLATE_FILTER
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static int config_input(AVFilterLink *inlink)
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.
#define i(width, name, range_min, range_max)
static int FUNC ph(CodedBitstreamContext *ctx, RWContext *rw, H266RawPH *current)
#define AV_CEIL_RSHIFT(a, b)
static int filter_frame(DBEDecodeContext *s, AVFrame *frame)
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
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 AVFILTER_DEFINE_CLASS_EXT(name, desc, options)
static enum AVPixelFormat pix_fmts[]
static int slice_end(AVCodecContext *avctx, AVFrame *pict, int *got_output)
Handle slice ends.
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_GBRAP12
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUV420P14
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ 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_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
@ 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)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ 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_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P10
Describe the class of an AVClass context structure.
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * dst
dest filter
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
void(* filter)(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
Used for passing data between threads.
static AVFormatContext * ctx
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static void erosion(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
#define DEFINE_NEIGHBOR_FILTER(name_, description_, priv_class_)
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
static void deflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
static void erosion16(uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
static void dilation(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
static int config_input(AVFilterLink *inlink)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static void dilation16(uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
static void deflate16(uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
static void inflate16(uint8_t *dstp, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
#define DEINFLATE_OPTIONS_OFFSET
static const AVFilterPad neighbor_inputs[]
static double limit(double x)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static int slice_start(SliceContext *sc, VVCContext *s, VVCFrameContext *fc, const CodedBitstreamUnit *unit, const int is_first_slice)