Commit Graph

31 Commits

Author SHA1 Message Date
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
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
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
Michael Niedermayer 0968180f02 avfilter/yadif: Change enums to int, which are accessed via AVOption as int
This fixes depending on implementation defined behavior

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-05 15:46:11 +02:00
Robert Krüger 194ef56ba7 Change license of yadif from GPL to LGPL
Signed-off-by: Robert Krüger <krueger@lesspain.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-14 14:19:15 +01:00
Robert Krüger 4a38eeec38 Revert "Revert "vf_yadif: move x86 init code to x86/yadif.c""
This reverts commit 975110a85e.

Signed-off-by: Robert Krüger <krueger@lesspain.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-14 14:19:14 +01:00
Michael Niedermayer 975110a85e Revert "vf_yadif: move x86 init code to x86/yadif.c"
This reverts commit a87b17f328.
This reduces the amount of non LGPL code, making a relicensing to LGPL
easier

Conflicts:

	libavfilter/vf_yadif.c
	libavfilter/x86/yadif.c
	libavfilter/x86/yadif_template.c
	libavfilter/yadif.h

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-01 20:26:26 +01:00
James Darnley 0735b50880 yadif: restore speed of the C filtering code
Always use the special filter for the first and last 3 columns (only).

Changes made in 64ed397 slowed the filter to just under 3/4 of what it
was.  This commit restores the speed while maintaining identical output.

For reference, on my Athlon64:
1733222 decicycles in old
2358563 decicycles in new
1727558 decicycles in this

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-13 22:07:25 +01:00
Michael Niedermayer a05a44e205 Merge commit '7e350379f87e7f74420b4813170fe808e2313911'
* commit '7e350379f87e7f74420b4813170fe808e2313911':
  lavfi: switch to AVFrame.

Conflicts:
	doc/filters.texi
	libavfilter/af_ashowinfo.c
	libavfilter/audio.c
	libavfilter/avfilter.c
	libavfilter/avfilter.h
	libavfilter/buffersink.c
	libavfilter/buffersrc.c
	libavfilter/buffersrc.h
	libavfilter/f_select.c
	libavfilter/f_setpts.c
	libavfilter/fifo.c
	libavfilter/split.c
	libavfilter/src_movie.c
	libavfilter/version.h
	libavfilter/vf_aspect.c
	libavfilter/vf_bbox.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_delogo.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fade.c
	libavfilter/vf_fieldorder.c
	libavfilter/vf_fps.c
	libavfilter/vf_frei0r.c
	libavfilter/vf_gradfun.c
	libavfilter/vf_hqdn3d.c
	libavfilter/vf_lut.c
	libavfilter/vf_overlay.c
	libavfilter/vf_pad.c
	libavfilter/vf_scale.c
	libavfilter/vf_showinfo.c
	libavfilter/vf_transpose.c
	libavfilter/vf_vflip.c
	libavfilter/vf_yadif.c
	libavfilter/video.c
	libavfilter/vsrc_testsrc.c
	libavfilter/yadif.h

Following are notes about the merge authorship and various technical details.

Michael Niedermayer:
  * Main merge operation, notably avfilter.c and video.c
  * Switch to AVFrame:
    - afade
    - anullsrc
    - apad
    - aresample
    - blackframe
    - deshake
    - idet
    - il
    - mandelbrot
    - mptestsrc
    - noise
    - setfield
    - smartblur
    - tinterlace
  * various merge changes and fixes in:
    - ashowinfo
    - blackdetect
    - field
    - fps
    - select
    - testsrc
    - yadif

Nicolas George:
  * Switch to AVFrame:
    - make rawdec work with refcounted frames. Adapted from commit
      759001c534 by Anton Khirnov.
      Also, fix the use of || instead of | in a flags check.
    - make buffer sink and src, audio and video work all together

Clément Bœsch:
  * Switch to AVFrame:
    - aevalsrc
    - alphaextract
    - blend
    - cellauto
    - colormatrix
    - concat
    - earwax
    - ebur128
    - edgedetect
    - geq
    - histeq
    - histogram
    - hue
    - kerndeint
    - life
    - movie
    - mp (with the help of Michael)
    - overlay
    - pad
    - pan
    - pp
    - pp
    - removelogo
    - sendcmd
    - showspectrum
    - showwaves
    - silencedetect
    - stereo3d
    - subtitles
    - super2xsai
    - swapuv
    - thumbnail
    - tile

Hendrik Leppkes:
  * Switch to AVFrame:
    - aconvert
    - amerge
    - asetnsamples
    - atempo
    - biquads

Matthieu Bouron:
  * Switch to AVFrame
    - alphamerge
    - decimate
    - volumedetect

Stefano Sabatini:
  * Switch to AVFrame:
    - astreamsync
    - flite
    - framestep

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Clément Bœsch <ubitux@gmail.com>
Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-10 01:40:35 +01:00
Anton Khirnov 7e350379f8 lavfi: switch to AVFrame.
Deprecate AVFilterBuffer/AVFilterBufferRef and everything related to it
and use AVFrame instead.
2013-03-08 07:37:18 +01:00
Michael Niedermayer 446f7c62a2 Merge commit '64ed397635ef2666b0ca0c8d8c60a8bc44581d82'
* commit '64ed397635ef2666b0ca0c8d8c60a8bc44581d82':
  vf_yadif: fix out-of line reads

Conflicts:
	libavfilter/vf_yadif.c
	tests/ref/fate/filter-yadif-mode0
	tests/ref/fate/filter-yadif-mode1

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-16 09:09:38 +01:00
Anton Khirnov 64ed397635 vf_yadif: fix out-of line reads
Some changes in the border pixels, visually indistinguishable.
2013-02-15 16:08:33 +01:00
Michael Niedermayer 6e9f3f3b65 Merge commit '238614de679a71970c20d7c3fee08a322967ec40'
* commit '238614de679a71970c20d7c3fee08a322967ec40':
  cdgraphics: do not rely on get_buffer() initializing the frame.
  svq1: replace struct svq1_frame_size with an array.
  vf_yadif: silence a warning.

Conflicts:
	libavcodec/svq1dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-06 14:53:49 +01:00
Anton Khirnov 99162f8d46 vf_yadif: silence a warning.
clang says:
libavfilter/vf_yadif.c:192:28: warning: incompatible pointer types assigning to
'void (*)(uint8_t *, uint8_t *, uint8_t *, uint8_t *, int, int, int, int, int)'
from 'void (uint16_t *, uint16_t *, uint16_t *, uint16_t *, int, int, int, int, int)'
2013-02-06 10:21:51 +01:00
Stefano Sabatini cb8d3965fd lavfi/yadif: add support to named constants 2013-01-04 11:48:54 +01:00
Stefano Sabatini f7dc6aa6b1 lavfi/yadif: add support to named options and options introspection
Also rename the "enable_auto" field to "deint", to match the name of the
option.
2013-01-04 11:48:54 +01:00
Michael Niedermayer 55c49afc42 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  yuv4mpeg: return proper error codes.
  Give all anonymously typedeffed structs in headers a name
  fate: Add parseutils test
  parseutils-test: Drop random colors from parsing test
  vf_pad/scale: use double precision for aspect ratios.
  build: error on variable-length arrays
  ppc: swscale: rework yuv2planeX_altivec()
  ppc: fmtconvert: kill VLA in float_to_int16_interleave_altivec()
  x86: dsputil: kill VLA in gmc_mmx()
  libspeexenc: Updated commentary to reflect recent changes
  libspeexenc: Add an option for enabling DTX
  doc/APIchanges: fill in missing dates and hashes.
  lavr: bump major to 1 and declare it stable.
  lavr: change the type of the data buffers to uint8_t**.
  lavc: deprecate the audio resampling API.

Conflicts:
	cmdutils.h
	configure
	doc/APIchanges
	ffplay.c
	libavcodec/dwt.h
	libavcodec/libspeexenc.c
	libavfilter/vf_pad.c
	libavfilter/vf_scale.c
	libavformat/asf.h
	tests/fate/libavutil.mak
	tests/ref/fate/parseutils

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-06 13:45:08 +02:00
Diego Biurrun e4cbf7529b Give all anonymously typedeffed structs in headers a name
Anonymous structs cannot be forward declared and have no benefit.
2012-10-06 09:27:11 +02:00
Michael Niedermayer 2f7e8dcf45 yadif: redesign first and last 2 lines handling.
The previous code dependent on the input buffer matching the
buffer that has been provided by yadifs get_buffer.
The API does in now way gurantee this though its often true.
This fixes some out of array reads.
The regression test checksums change due to "out of picture" values
being initialized differently.
There should be no visual difference in the filters output

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-10 00:08:34 +02:00
Michael Niedermayer b286383bd2 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  asfdec: read attached pictures.
  apetag: reindent
  apetag: export attached covers as video streams.
  apetag: fix the amount of data read from binary tags.
  apetag: make sure avio_get_str() doesn't read more than it should.
  mov: read itunes cover art.
  snow: remove VLA in mc_block()
  intfloat: Don't use designated initializers in the public headers
  snow: remove a VLA.
  doc: Remind devs to check return values, especially for malloc() et al
  MS ATC Screen (aka MSS3) decoder
  vf_yadif: move x86 init code to x86/yadif.c
  vf_gradfun: move x86 init code to x86/gradfun.c
  roqvideo: Remove a totally unused dspcontext
  smacker: remove some unused code
  dsicin: remove dead assignment
  aacdec: remove dead assignment
  rl2: remove dead assignment
  proresenc: make a variable local to the loop where it is used
  alsdec: remove dead assignments

Conflicts:
	Changelog
	doc/developer.texi
	libavcodec/allcodecs.c
	libavcodec/avcodec.h
	libavcodec/version.h
	libavfilter/gradfun.h
	libavfilter/x86/gradfun.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-02 21:19:41 +02:00
Mans Rullgard a87b17f328 vf_yadif: move x86 init code to x86/yadif.c
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-07-02 01:16:37 +01:00
Michael Niedermayer 233ed6b314 Change yadif to not use out of picture lines.
Fixes issue2272.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-04-03 08:46:19 +02:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Michael Niedermayer bad82d3d7d Change yadif to not use out of picture lines.
Fixes issue2272.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-02-18 19:39:42 +01:00
Baptiste Coudurier bf799f686f Declare sse2 and ssse2 function in yadif header
Originally committed as revision 25877 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-04 05:50:28 +00:00
Michael Niedermayer acbac56789 yadif filter, based on stefanos port of my yadif from mplayer.
Compared to stefanos, 2 frame output works with ffplay.

Originally committed as revision 25196 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-09-25 16:43:42 +00:00