83 #define DEFINE_DEDOTCRAWL(name, type, div) \ 84 static int dedotcrawl##name(AVFilterContext *ctx, void *arg, \ 85 int jobnr, int nb_jobs) \ 87 DedotContext *s = ctx->priv; \ 89 int src_linesize = s->frames[2]->linesize[0] / div; \ 90 int dst_linesize = out->linesize[0] / div; \ 91 int p0_linesize = s->frames[0]->linesize[0] / div; \ 92 int p1_linesize = s->frames[1]->linesize[0] / div; \ 93 int p3_linesize = s->frames[3]->linesize[0] / div; \ 94 int p4_linesize = s->frames[4]->linesize[0] / div; \ 95 const int h = s->planeheight[0]; \ 96 int slice_start = (h * jobnr) / nb_jobs; \ 97 int slice_end = (h * (jobnr+1)) / nb_jobs; \ 98 type *p0 = (type *)s->frames[0]->data[0]; \ 99 type *p1 = (type *)s->frames[1]->data[0]; \ 100 type *p3 = (type *)s->frames[3]->data[0]; \ 101 type *p4 = (type *)s->frames[4]->data[0]; \ 102 type *src = (type *)s->frames[2]->data[0]; \ 103 type *dst = (type *)out->data[0]; \ 104 const int luma2d = s->luma2d; \ 105 const int lumaT = s->lumaT; \ 107 if (!slice_start) { \ 110 p0 += p0_linesize * slice_start; \ 111 p1 += p1_linesize * slice_start; \ 112 p3 += p3_linesize * slice_start; \ 113 p4 += p4_linesize * slice_start; \ 114 src += src_linesize * slice_start; \ 115 dst += dst_linesize * slice_start; \ 116 if (slice_end == h) { \ 119 for (int y = slice_start; y < slice_end; y++) { \ 120 for (int x = 1; x < s->planewidth[0] - 1; x++) { \ 121 int above = src[x - src_linesize]; \ 122 int bellow = src[x + src_linesize]; \ 124 int left = src[x - 1]; \ 125 int right = src[x + 1]; \ 127 if (FFABS(above + bellow - 2 * cur) <= luma2d && \ 128 FFABS(left + right - 2 * cur) <= luma2d) \ 131 if (FFABS(cur - p0[x]) <= lumaT && \ 132 FFABS(cur - p4[x]) <= lumaT && \ 133 FFABS(p1[x] - p3[x]) <= lumaT) { \ 134 int diff1 = FFABS(cur - p1[x]); \ 135 int diff2 = FFABS(cur - p3[x]); \ 138 dst[x] = (src[x] + p1[x] + 1) >> 1; \ 140 dst[x] = (src[x] + p3[x] + 1) >> 1; \ 144 dst += dst_linesize; \ 145 src += src_linesize; \ 162 #define DEFINE_DERAINBOW(name, type, div) \ 163 static int derainbow##name(AVFilterContext *ctx, void *arg, \ 164 int jobnr, int nb_jobs) \ 166 DedotContext *s = ctx->priv; \ 167 ThreadData *td = arg; \ 168 AVFrame *out = td->out; \ 169 const int plane = td->plane; \ 170 const int h = s->planeheight[plane]; \ 171 int slice_start = (h * jobnr) / nb_jobs; \ 172 int slice_end = (h * (jobnr+1)) / nb_jobs; \ 173 int src_linesize = s->frames[2]->linesize[plane] / div; \ 174 int dst_linesize = out->linesize[plane] / div; \ 175 int p0_linesize = s->frames[0]->linesize[plane] / div; \ 176 int p1_linesize = s->frames[1]->linesize[plane] / div; \ 177 int p3_linesize = s->frames[3]->linesize[plane] / div; \ 178 int p4_linesize = s->frames[4]->linesize[plane] / div; \ 179 type *p0 = (type *)s->frames[0]->data[plane]; \ 180 type *p1 = (type *)s->frames[1]->data[plane]; \ 181 type *p3 = (type *)s->frames[3]->data[plane]; \ 182 type *p4 = (type *)s->frames[4]->data[plane]; \ 183 type *src = (type *)s->frames[2]->data[plane]; \ 184 type *dst = (type *)out->data[plane]; \ 185 const int chromaT1 = s->chromaT1; \ 186 const int chromaT2 = s->chromaT2; \ 188 p0 += slice_start * p0_linesize; \ 189 p1 += slice_start * p1_linesize; \ 190 p3 += slice_start * p3_linesize; \ 191 p4 += slice_start * p4_linesize; \ 192 src += slice_start * src_linesize; \ 193 dst += slice_start * dst_linesize; \ 194 for (int y = slice_start; y < slice_end; y++) { \ 195 for (int x = 0; x < s->planewidth[plane]; x++) { \ 198 if (FFABS(cur - p0[x]) <= chromaT1 && \ 199 FFABS(cur - p4[x]) <= chromaT1 && \ 200 FFABS(p1[x] - p3[x]) <= chromaT1 && \ 201 FFABS(cur - p1[x]) > chromaT2 && \ 202 FFABS(cur - p3[x]) > chromaT2) { \ 203 int diff1 = FFABS(cur - p1[x]); \ 204 int diff2 = FFABS(cur - p3[x]); \ 207 dst[x] = (src[x] + p1[x] + 1) >> 1; \ 209 dst[x] = (src[x] + p3[x] + 1) >> 1; \ 213 dst += dst_linesize; \ 214 src += src_linesize; \ 281 for (
int i = 2;
i < 5;
i++) {
362 for (
int i = 0;
i < 5;
i++)
366 #define OFFSET(x) offsetof(DedotContext, x) 367 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM 403 .priv_class = &dedot_class,
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
#define AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P9
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
This structure describes decoded (raw) audio or video data.
#define AV_PIX_FMT_YUVA420P10
static const AVOption dedot_options[]
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUVA422P10
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Main libavfilter public API header.
int h
agreed upon image height
#define FFERROR_NOT_READY
Filters implementation helper functions.
static int activate(AVFilterContext *ctx)
#define AV_PIX_FMT_YUV420P12
const AVPixFmtDescriptor * desc
static int query_formats(AVFilterContext *ctx)
int is_disabled
the enabled state from the last expression evaluation
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
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.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define AV_PIX_FMT_YUVA420P9
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.
#define AV_PIX_FMT_YUV444P16
int(* dedotcrawl)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUVA420P16
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
A filter pad used for either input or output.
A link between two filters.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define i(width, name, range_min, range_max)
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUV444P10
AVFILTER_DEFINE_CLASS(dedot)
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
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define DEFINE_DERAINBOW(name, type, div)
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUV444P9
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P14
Used for passing data between threads.
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AV_PIX_FMT_YUV420P10
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Describe the class of an AVClass context structure.
#define DEFINE_DEDOTCRAWL(name, type, div)
const char * name
Filter name.
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV420P9
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
AVFilterLink ** outputs
array of pointers to output links
static const AVFilterPad inputs[]
#define AV_PIX_FMT_YUV422P14
int(* derainbow)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
#define flags(name, subs,...)
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV444P12
static av_cold void uninit(AVFilterContext *ctx)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static const AVFilterPad outputs[]
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
#define AV_PIX_FMT_YUVA444P9
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)
avfilter_execute_func * execute
static int config_output(AVFilterLink *outlink)
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
int depth
Number of bits in the component.
AVPixelFormat
Pixel format.
#define AV_PIX_FMT_YUV422P16
#define AV_CEIL_RSHIFT(a, b)