Commit Graph

14 Commits

Author SHA1 Message Date
Anton Khirnov 1e7d2007c3 all: use designated initializers for AVOption.unit
Makes it robust against adding fields before it, which will be useful in
following commits.

Majority of the patch generated by the following Coccinelle script:

@@
typedef AVOption;
identifier arr_name;
initializer list il;
initializer list[8] il1;
expression tail;
@@
AVOption arr_name[] = { il, { il1,
- tail
+ .unit = tail
}, ...  };

with some manual changes, as the script:
* has trouble with options defined inside macros
* sometimes does not handle options under an #else branch
* sometimes swallows whitespace
2024-02-14 14:53:41 +01:00
Marton Balint 52cc89dc45 avfilter/yadif_common: fix timestamps with very small timebases
Yadif filter assumed that the output timebase is always half of the input
timebase. This is not true if halving the input time base is not representable
as an AVRational causing the output timestamps to be invalidly scaled in such a
case.

So let's use av_reduce instead of av_mul_q when calculating the output time
base and if the conversion is inexact then let's fall back to the original
timebase which probably makes more parctical sense than using x/INT_MAX.

Fixes invalidly scaled pts_time values in this command line:
ffmpeg -f lavfi -i testsrc -vf settb=tb=1/2000000000,yadif,showinfo -f null none

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Marton Balint 268062fa15 avfilter/yadif_common: factorize some part of the config_output and the uninit functions
This unifies slightly diverged code and ensures that cc_fifo is always initialized.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-02-04 20:04:18 +01:00
Anton Khirnov 63bc6430a6 lavfi/yadif: update output frame durations 2023-10-03 16:57:02 +02:00
Andreas Rheinhardt 423b6a7e49 avutil/imgutils: Add wrapper for av_image_copy() to avoid casts
av_image_copy() accepts const uint8_t* const * as source;
lots of user have uint8_t* const * and therefore either
cast (the majority) or copy the array of pointers.

This commit changes this by adding a static inline wrapper
for av_image_copy() that casts between the two types
so that we do not need to add casts everywhere else.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-09-12 09:42:27 +02:00
Andreas Rheinhardt 6d15643173 avfilter/internal: Don't include video.h
internal.h does not depend on video.h (and should not depend on it)
and therefore should not include video.h at all; instead all users
of video.h should include it directly.

Doing so also avoids unnecessary video.h inclusions in files that
don't need it, like most audio filters.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-07 09:21:13 +02:00
James Almer 7f890b2fbb avfilter/ccfifo: remove unnecessary context allocations
This is not public API, no it has no need for an alloc() and free()
functions. The struct can reside on stack.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-12 16:21:18 -03:00
Devin Heitmueller cecf35ae3e avfilter/yadif: Properly preserve CEA-708 closed captions
Various deinterlacing modes have the effect of doubling the
framerate, and we need to ensure that the caption data isn't
duplicated (or else you get double captions on-screen).

Use the new ccfifo mechanism for yadif (and yadif_cuda and bwdif
since they use the same yadif core) so that CEA-708 data is
properly preserved through this filter.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2023-05-11 22:06:20 +08:00
James Almer 599abc0f3a avutil/frame: deprecate interlaced_frame and top_field_first
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:15:00 -03:00
James Almer 36827ea783 avfilter: use the new AVFrame interlace flags in all filters
Signed-off-by: James Almer <jamrial@gmail.com>
2023-05-04 18:14:11 -03:00
Limin Wang 71ec3e4583 Revert "avfilter/yadif: simplify the code for better readability"
This reverts commit 2a9b934675.
2020-08-27 07:30:30 +08:00
Limin Wang 2a9b934675 avfilter/yadif: simplify the code for better readability
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-08-26 14:21:11 +08:00
Philip Langdale fa74e4aef2 avfilter/yadif_common: Add field type tracking to help bwdif
The bwdif filter can use common yadif frame management if we track
when a field is the first or last field in a sequence. While this
information is not used by yadif, the added benefit of removing the
duplicated frame management logic makes it worth tracking this state
in the common code.
2018-11-14 17:41:01 -08:00
Philip Langdale 598f0f3927 libavfilter/vf_yadif: Make frame management logic and options shareable
I'm writing a cuda implementation of yadif, and while this
obviously has a very different implementation of the actual
filtering, all the frame management is unchanged. To avoid
duplicating that logic, let's make it shareable.

From the perspective of the existing filter, the only real change
is introducing a function pointer for the filter() function so it
can be specified for the specific filter.
2018-11-02 11:24:05 -07:00