FFmpeg: libavfilter/vf_morpho.c Source File
Go to the documentation of this file. 1 /*
2 * Copyright (c) 2016 ReneBrals
3 * Copyright (c) 2021 Paul B Mahol
4 *
5 * This file is part of FFmpeg.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
36
46 };
47
54
62
64 /* arr is shifted from base_arr by FFMAX(min_r, 0).
65 * arr != NULL means "lut completely allocated" */
75
82
87
90
97
101
106
110
118
120
122
125
126 #define OFFSET(x) offsetof(MorphoContext, x)
127 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_RUNTIME_PARAM
128
140 {
"first",
"process only first structure, ignore rest", 0,
AV_OPT_TYPE_CONST, {.i64=0}, 0, 0,
FLAGS,
"str" },
143 };
144
146
167 };
168
169 static void min_fun(uint8_t *
c,
const uint8_t *
a,
const uint8_t *
b,
int x)
170 {
171 for (
int i = 0;
i < x;
i++)
173 }
174
176 {
177 for (
int i = 0;
i < x;
i++)
179 }
180
181 static void max_fun(uint8_t *
c,
const uint8_t *
a,
const uint8_t *
b,
int x)
182 {
183 for (
int i = 0;
i < x;
i++)
185 }
186
188 {
189 for (
int i = 0;
i < x;
i++)
191 }
192
194 {
195 for (
int i = 0;
i < x;
i++)
197 }
198
200 {
201 for (
int i = 0;
i < x;
i++)
203 }
204
205 static void min16_fun(uint8_t *cc,
const uint8_t *aa,
const uint8_t *bb,
int x)
206 {
207 const uint16_t *
a = (
const uint16_t *)aa;
208 const uint16_t *
b = (
const uint16_t *)bb;
209 uint16_t *
c = (uint16_t *)cc;
210
211 for (
int i = 0;
i < x;
i++)
213 }
214
216 {
217 uint16_t *
a = (uint16_t *)aa;
218 const uint16_t *
b = (
const uint16_t *)bb;
219
220 for (
int i = 0;
i < x;
i++)
222 }
223
224 static void diff16_fun(uint8_t *aa,
const uint8_t *bb,
int x)
225 {
226 const uint16_t *
b = (
const uint16_t *)bb;
227 uint16_t *
a = (uint16_t *)aa;
228
229 for (
int i = 0;
i < x;
i++)
231 }
232
234 {
235 uint16_t *
a = (uint16_t *)aa;
236 const uint16_t *
b = (
const uint16_t *)bb;
237
238 for (
int i = 0;
i < x;
i++)
240 }
241
242 static void max16_fun(uint8_t *cc,
const uint8_t *aa,
const uint8_t *bb,
int x)
243 {
244 const uint16_t *
a = (
const uint16_t *)aa;
245 const uint16_t *
b = (
const uint16_t *)bb;
246 uint16_t *
c = (uint16_t *)cc;
247
248 for (
int i = 0;
i < x;
i++)
250 }
251
253 {
254 uint16_t *
a = (uint16_t *)aa;
255 const uint16_t *
b = (
const uint16_t *)bb;
256
257 for (
int i = 0;
i < x;
i++)
259 }
260
262 {
265 int pre_pad_x = 0;
266
268 pre_pad_x = 0 -
SE->minX;
271
279 for (
int i = 0;
i < Ty->
I;
i++) {
284 memset(arr[
i], UINT8_MAX, pre_pad_x * type_size);
285 /* Shifting the X index such that negative indices correspond to
286 * the pre-padding.
287 */
288 arr[
i] = &(arr[
i][pre_pad_x * type_size]);
289 }
290 }
291
293
294 return 0;
295 }
296
298 {
301
302 if (!
table->base_arr)
303 return;
304
307 break;
308 for (
int i = 0;
i <
table->I;
i++) {
310 break;
311 // The X index was also shifted, for padding purposes.
313 }
315 }
318 }
319
322 {
323 if (!Ty->
arr || Ty->
I !=
SE->Lnum ||
327 Ty->
max_r !=
SE->maxY + num - 1) {
329
331
335 Ty->
max_r =
SE->maxY + num - 1;
339 }
340 return 0;
341 }
342
344 {
345 /*
346 * Swap the pointers to r-indices in a circle. This is useful because
347 * Ty(r,i,x) = Ty-1(r+1,i,x) for r < ymax.
348 */
351
352 for (
int r = Ty->
min_r; r < Ty->max_r;
r++)
354
356 }
357 }
358
360 {
361 if (y +
r >= 0 && y + r < f->
h) {
363 } else {
365 }
366
367 for (
int i = 1;
i <
SE->Lnum;
i++) {
368 int d =
SE->R[
i] -
SE->R[
i - 1];
369
374 memcpy(Ty->
arr[
r][
i] + (Ty->
X -
d) *
f->type_size,
375 Ty->
arr[
r][
i - 1] + (Ty->
X -
d) *
f->type_size,
377 }
378 }
379
381 {
382 for (
int i = 0;
i < num;
i++)
384
386 }
387
389 {
393
394 for (
int r = Ty->
min_r; r <= Ty->max_r;
r++)
396
397 return 0;
398 }
399
401 {
402 if (y +
r >= 0 && y + r < f->
h) {
404 } else {
406 }
407
408 for (
int i = 1;
i <
SE->Lnum;
i++) {
409 int d =
SE->R[
i] -
SE->R[
i - 1];
410
415 memcpy(Ty->
arr[
r][
i] + (Ty->
X -
d) *
f->type_size,
416 Ty->
arr[
r][
i - 1] + (Ty->
X -
d) *
f->type_size,
418 }
419 }
420
422 {
423 for (
int i = 0;
i < num;
i++)
425
427 }
428
430 {
434
435 for (
int r = Ty->
min_r; r <= Ty->max_r;
r++)
437
438 return 0;
439 }
440
442 {
443 memset(
g->img[y], 0,
g->w *
g->type_size);
444
445 for (
int c = 0;
c <
SE->size;
c++) {
446 g->max_in_place(
g->img[y],
449 }
450 }
451
453 {
454 memset(
g->img[y], UINT8_MAX,
g->w *
g->type_size);
455
456 for (
int c = 0;
c <
SE->size;
c++) {
457 g->min_in_place(
g->img[y],
460 }
461 }
462
464 {
468
470 for (
int y = 1; y <
f->h; y++) {
473 }
474
475 return 0;
476 }
477
479 {
483
485 for (
int y = 1; y <
f->h; y++) {
488 }
489
490 return 0;
491 }
492
494 {
495 for (
int y = 0; y <
f->h; y++)
496 f->diff_in_place(
g->img[y],
f->img[y],
f->w);
497 }
498
500 {
501 for (
int y = 0; y <
f->h; y++)
502 f->diff_rin_place(
g->img[y],
f->img[y],
f->w);
503 }
504
506 {
507 // Checking if chord fits in dynamic array, resize if not.
508 if (chords->
size == chords->
cap) {
513 }
514
515 // Add the chord to the dynamic array.
516 chords->
C[chords->
size].
x =
c.x;
517 chords->
C[chords->
size].
y =
c.y;
518 chords->
C[chords->
size++].
l =
c.l;
519
520 // Update minimum/maximum x/y offsets of the chord set.
523
526
527 return 0;
528 }
529
531 {
535
538 }
539
541 {
547
549 chords->
minX = INT16_MAX;
550 chords->
maxX = INT16_MIN;
551 chords->
minY = INT16_MAX;
552 chords->
maxY = INT16_MIN;
553
554 return 0;
555 }
556
558 {
562
563 return (
a.l >
b.l) - (
a.l <
b.l);
564 }
565
567 {
571
572 return (
a.y >
b.y) - (
a.y <
b.y);
573 }
574
576 {
577 const int mid = 1 << (
SE->depth - 1);
578 int chord_length_index;
579 int chord_start,
val,
ret;
580 int centerX, centerY;
581 int r_cap = 1;
583
587 /*
588 * In erosion/dilation, the center of the IPlane has S.E. offset (0,0).
589 * Otherwise, the resulting IPlane would be shifted to the top-left.
590 */
591 centerX = (
SE->w - 1) / 2;
592 centerY = (
SE->h - 1) / 2;
593
594 /*
595 * Computing the set of chords C.
596 */
597 for (
int y = 0; y <
SE->h; y++) {
598 int x;
599
600 chord_start = -1;
601 for (x = 0; x <
SE->w; x++) {
602 if (
SE->type_size == 1) {
604 //A chord is a run of non-zero pixels.
605 if (
SE->img[y][x] >= mid && chord_start == -1) {
606 // Chord starts.
607 chord_start = x;
608 }
else if (
SE->img[y][x] < mid && chord_start != -1) {
609 // Chord ends before end of line.
610 c.x = chord_start - centerX;
612 c.l = x - chord_start;
616 chord_start = -1;
617 }
618 } else {
620 //A chord is a run of non-zero pixels.
621 if (
AV_RN16(&
SE->img[y][x * 2]) >= mid && chord_start == -1) {
622 // Chord starts.
623 chord_start = x;
624 }
else if (
AV_RN16(&
SE->img[y][x * 2]) < mid && chord_start != -1) {
625 // Chord ends before end of line.
626 c.x = chord_start - centerX;
628 c.l = x - chord_start;
632 chord_start = -1;
633 }
634 }
635 }
636 if (chord_start != -1) {
637 // Chord ends at end of line.
638 c.x = chord_start - centerX;
640 c.l = x - chord_start;
644 }
645 }
646
647 /*
648 * Computing the array of chord lengths R(i).
649 * This is needed because the lookup table will contain a row for each
650 * length index i.
651 */
658 r_cap = 1;
659
660 if (chords->
size > 0) {
662 if (chords->
Lnum >= r_cap) {
666 r_cap *= 2;
667 }
668 chords->
R[chords->
Lnum++] = 1;
670 }
671
672 for (
int i = 0;
i < chords->
size;
i++) {
673 if (
val != chords->
C[
i].
l) {
674 while (2 * val < chords->
C[
i].l &&
val != 0) {
675 if (chords->
Lnum >= r_cap) {
679 r_cap *= 2;
680 }
681
682 chords->
R[chords->
Lnum++] = 2 *
val;
684 }
686
687 if (chords->
Lnum >= r_cap) {
691 r_cap *= 2;
692 }
694 }
695 }
696
697 /*
698 * Setting the length indices of chords.
699 * These are needed so that the algorithm can, for each chord,
700 * access the lookup table at the correct length in constant time.
701 */
702 chord_length_index = 0;
703 for (
int i = 0;
i < chords->
size;
i++) {
704 while (chords->
R[chord_length_index] < chords->
C[
i].
l)
705 chord_length_index++;
706 chords->
C[
i].
i = chord_length_index;
707 }
708
709 /*
710 * Chords are sorted on Y. This way, when a row of the lookup table or IPlane
711 * is cached, the next chord offset has a better chance of being on the
712 * same cache line.
713 */
715
716 return 0;
717 }
718
720 {
722 }
723
725 int w,
int h,
int R,
int type_size,
int depth)
726 {
731
743
744 for (
int y = 0; y <
h; y++)
745 imp->
img[y] = (uint8_t *)dst + y * dst_linesize;
746
747 return 0;
748 }
749
751 {
754
755 s->depth =
desc->comp[0].depth;
756 s->type_size = (
s->depth + 7) / 8;
757 s->nb_planes =
desc->nb_components;
759 s->planewidth[0] =
s->planewidth[3] =
inlink->w;
761 s->planeheight[0] =
s->planeheight[3] =
inlink->h;
762
763 return 0;
764 }
765
767 {
771
773
775 s->splanewidth[0] =
s->splanewidth[3] =
inlink->w;
777 s->splaneheight[0] =
s->splaneheight[3] =
inlink->h;
778
779 return 0;
780 }
781
783 {
786 }
787
789 {
796
800 if (!structurepic)
802
807 }
809
810 for (
int p = 0; p <
s->nb_planes; p++) {
811 const uint8_t *
src = in->
data[p];
813 const uint8_t *ssrc = structurepic->data[p];
814 const int ssrc_linesize = structurepic->linesize[p];
815 uint8_t *dst =
out->data[p];
816 int dst_linesize =
out->linesize[p];
817 const int swidth =
s->splanewidth[p];
818 const int sheight =
s->splaneheight[p];
819 const int width =
s->planewidth[p];
820 const int height =
s->planeheight[p];
821 const int depth =
s->depth;
822 int type_size =
s->type_size;
823
824 if (
ctx->is_disabled || !(
s->planes & (1 << p))) {
830 width * ((
s->depth + 7) / 8),
832 continue;
833 }
834
835 if (!
s->got_structure[p] ||
s->structures) {
837
838 ret =
read_iplane(&
s->SEimg[p], ssrc, ssrc_linesize, swidth, sheight, 1, type_size, depth);
844 s->got_structure[p] = 1;
845 }
846
847 if (
s->SE[p].minX == INT16_MAX ||
848 s->SE[p].minY == INT16_MAX ||
849 s->SE[p].maxX == INT16_MIN ||
850 s->SE[p].maxY == INT16_MIN)
852
856
857 ret =
read_iplane(&
s->g[p], dst, dst_linesize,
s->f[p].w,
s->f[p].h,
s->f[p].range, type_size, depth);
860
863 ret =
erode(&
s->g[p], &
s->f[p], &
s->SE[p], &
s->Ty[0][p]);
864 break;
867 break;
871 break;
872 ret =
erode(&
s->h[p], &
s->f[p], &
s->SE[p], &
s->Ty[0][p]);
874 break;
876 break;
880 break;
883 break;
884 ret =
erode(&
s->g[p], &
s->h[p], &
s->SE[p], &
s->Ty[1][p]);
885 break;
889 break;
892 break;
893 ret =
erode(&
s->h[p], &
s->f[p], &
s->SE[p], &
s->Ty[1][p]);
895 break;
897 break;
901 break;
902 ret =
erode(&
s->h[p], &
s->f[p], &
s->SE[p], &
s->Ty[0][p]);
904 break;
907 break;
909 break;
913 break;
916 break;
917 ret =
erode(&
s->g[p], &
s->h[p], &
s->SE[p], &
s->Ty[1][p]);
919 break;
921 break;
922 default:
924 }
925
928 }
929
937 }
938
940 {
945
950 outlink->
w = mainlink->
w;
951 outlink->
h = mainlink->
h;
955
959
963
964 s->plane_f =
av_calloc(outlink->
w * outlink->
h,
sizeof(*
s->plane_f));
965 s->plane_g =
av_calloc(outlink->
w * outlink->
h,
sizeof(*
s->plane_g));
966 if (!
s->plane_f || !
s->plane_g)
968
969 return 0;
970 }
971
973 {
975
976 for (int p = 0; p < 4; p++) {
984 }
985
987
991 }
992
994 {
998 },
999 {
1000 .name = "structure",
1003 },
1004 };
1005
1007 {
1011 },
1012 };
1013
1017 .preinit = morpho_framesync_preinit,
1019 .priv_class = &morpho_class,
1027 };
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
#define AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_GBRAP16
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
AVPixelFormat
Pixel format.
static const struct @346 planes[]
static void line_erode(IPlane *g, LUT *Ty, chord_set *SE, int y, int tid)
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
static void free_chord_set(chord_set *SE)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static void mininplace_fun(uint8_t *a, const uint8_t *b, int x)
void(* min_in_place)(uint8_t *a, const uint8_t *b, int x)
#define FILTER_PIXFMTS_ARRAY(array)
static void diffinplace_fun(uint8_t *a, const uint8_t *b, int x)
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
static int activate(AVFilterContext *ctx)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define AV_PIX_FMT_YUVA422P9
This structure describes decoded (raw) audio or video data.
#define AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P10
static const uint16_t table[]
#define AV_PIX_FMT_YUV420P10
static int alloc_lut_if_necessary(LUT *Ty, IPlane *f, chord_set *SE, int y, int num, enum MorphModes mode)
const AVFilter ff_vf_morpho
FRAMESYNC_DEFINE_CLASS(morpho, MorphoContext, fs)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
const char * name
Filter name.
A link between two filters.
#define AV_PIX_FMT_YUVA422P10
void(* min_out_place)(uint8_t *c, const uint8_t *a, const uint8_t *b, int x)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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.
#define AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_GBRP14
static int alloc_lut(LUT *Ty, chord_set *SE, int type_size, int mode)
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUVA444P16
static void min16_fun(uint8_t *cc, const uint8_t *aa, const uint8_t *bb, int x)
#define AV_PIX_FMT_YUV422P9
static double val(void *priv, double ch)
#define AV_PIX_FMT_GRAY16
static enum AVPixelFormat pix_fmts[]
A filter pad used for either input or output.
#define AV_PIX_FMT_YUV444P10
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
static av_cold void uninit(AVFilterContext *ctx)
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
#define AV_PIX_FMT_YUV422P16
static int do_morpho(FFFrameSync *fs)
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
#define AV_PIX_FMT_GBRAP10
static void maxinplace16_fun(uint8_t *aa, const uint8_t *bb, int x)
#define AV_PIX_FMT_GBRAP12
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
static void mininplace16_fun(uint8_t *aa, const uint8_t *bb, int x)
#define AV_PIX_FMT_YUV444P16
#define AV_CEIL_RSHIFT(a, b)
static const AVFilterPad morpho_inputs[]
static void difference2(IPlane *g, IPlane *f)
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
#define av_assert0(cond)
assert() equivalent, that is always enabled.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P16
static int insert_chord_set(chord_set *chords, chord c)
#define AV_PIX_FMT_GRAY14
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FILTER_INPUTS(array)
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
#define AV_PIX_FMT_GRAY10
static void compute_max_row(IPlane *f, LUT *Ty, chord_set *SE, int r, int y)
#define av_realloc_f(p, o, n)
#define AV_PIX_FMT_GBRP16
Describe the class of an AVClass context structure.
void(* diff_in_place)(uint8_t *a, const uint8_t *b, int x)
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define fs(width, name, subs,...)
static int config_input_structure(AVFilterLink *inlink)
static void maxinplace_fun(uint8_t *a, const uint8_t *b, int x)
static void diff16_fun(uint8_t *aa, const uint8_t *bb, int x)
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
static const AVFilterPad morpho_outputs[]
#define AV_PIX_FMT_YUV422P10
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static int init_chordset(chord_set *chords)
static void free_lut(LUT *table)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int ff_framesync_init_dualinput(FFFrameSync *fs, AVFilterContext *parent)
Initialize a frame sync structure for dualinput.
static void copy(const float *p1, float *p2, const int length)
#define AV_PIX_FMT_YUV422P12
static void free_iplane(IPlane *imp)
static int read_iplane(IPlane *imp, const uint8_t *dst, int dst_linesize, int w, int h, int R, int type_size, int depth)
#define AV_PIX_FMT_YUV444P12
static void line_dilate(IPlane *g, LUT *Ty, chord_set *SE, int y, int tid)
AVFilterContext * src
source filter
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
#define AV_PIX_FMT_YUVA444P10
static int build_chord_set(IPlane *SE, chord_set *chords)
static void max_fun(uint8_t *c, const uint8_t *a, const uint8_t *b, int x)
#define i(width, name, range_min, range_max)
int w
agreed upon image width
static int config_output(AVFilterLink *outlink)
#define AV_PIX_FMT_GBRP12
static void diffinplace16_fun(uint8_t *aa, const uint8_t *bb, int x)
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
const char * name
Pad name.
void * av_calloc(size_t nmemb, size_t size)
#define AV_PIX_FMT_YUV444P9
static void max16_fun(uint8_t *cc, const uint8_t *aa, const uint8_t *bb, int x)
#define AV_PIX_FMT_YUVA444P9
static void update_max_lut(IPlane *f, LUT *Ty, chord_set *SE, int y, int tid, int num)
#define AV_PIX_FMT_YUV420P12
static void circular_swap(LUT *Ty)
#define AV_PIX_FMT_YUV422P14
int h
agreed upon image height
static void diff_fun(uint8_t *a, const uint8_t *b, int x)
#define AV_PIX_FMT_YUVA422P12
static int config_input(AVFilterLink *inlink)
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
static int comp_chord(const void *p, const void *q)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
static void min_fun(uint8_t *c, const uint8_t *a, const uint8_t *b, int x)
static int compute_max_lut(LUT *Ty, IPlane *f, chord_set *SE, int y, int num)
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
#define FILTER_OUTPUTS(array)
static int comp_chord_length(const void *p, const void *q)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
static void update_min_lut(IPlane *f, LUT *Ty, chord_set *SE, int y, int tid, int num)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
void(* max_out_place)(uint8_t *c, const uint8_t *a, const uint8_t *b, int x)
#define AV_PIX_FMT_YUV440P12
static void difference(IPlane *g, IPlane *f)
#define AV_PIX_FMT_YUV444P14
void(* max_in_place)(uint8_t *a, const uint8_t *b, int x)
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
int ff_framesync_dualinput_get(FFFrameSync *fs, AVFrame **f0, AVFrame **f1)
#define AV_PIX_FMT_GRAY12
static int erode(IPlane *g, IPlane *f, chord_set *SE, LUT *Ty)
static int compute_min_lut(LUT *Ty, IPlane *f, chord_set *SE, int y, int num)
static const AVOption morpho_options[]
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
#define AV_PIX_FMT_YUV420P14
static void compute_min_row(IPlane *f, LUT *Ty, chord_set *SE, int r, int y)
void(* diff_rin_place)(uint8_t *a, const uint8_t *b, int x)
static int dilate(IPlane *g, IPlane *f, chord_set *SE, LUT *Ty)
Generated on Tue Feb 28 2023 21:33:57 for FFmpeg by
doxygen
1.8.17