Commit Graph

70 Commits

Author SHA1 Message Date
Thomas Mundt f4438e387e avfilter/vf_interlace: fix numerical options
Regression since 9c01cdb94e

Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
2018-09-07 18:46:56 +02:00
Vasile Toncu 9c01cdb94e avfilter/vf_interlace: remove duplicate code with same funcionality 2018-04-23 23:48:30 +02:00
Thomas Mundt d491d6a0cd avfilter/interlace: rename two variables for consistency
Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
2017-09-25 22:13:37 +02:00
Thomas Mundt 40bfaa190c avfilter/interlace: add support for 10 and 12 bit
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-09-23 16:19:58 -03:00
Thomas Mundt 58ca446672 avfilter/tinterlace: use drawutils for pad mode
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-09-23 16:19:58 -03:00
James Almer 3af1060319 avfilter/tinterlace: Simplify checks for lowpass filtering flags 2017-09-18 00:15:58 -03:00
Thomas Mundt ed48e22748 avfilter/interlace: simplify code
Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-15 22:40:21 +02:00
Thomas Mundt a7f6bfdc18 avfilter/interlace: prevent over-sharpening with the complex low-pass filter
The complex vertical low-pass filter slightly over-sharpens the picture. This becomes visible when several transcodings are cascaded and the error potentises, e.g. some generations of HD->SD SD->HD.
To prevent this behaviour the destination pixel must not exceed the source pixel when the average of the pixels above and below is less than the source pixel. And the other way around.

Tested and approved in a visual transcoding cascade test by video professionals.
SSIM/PSNR test with the first generation of an HD->SD file as a reference against the 6th generation(3 x SD->HD HD->SD):
Results without the patch:
SSIM Y:0.956508 (13.615881) U:0.991601 (20.757750) V:0.993004 (21.551382) All:0.974405 (15.918463)
PSNR y:31.838009 u:48.424280 v:48.962711 average:34.759466 min:31.699297 max:40.857847
Results with the patch:
SSIM Y:0.970051 (15.236232) U:0.991883 (20.905857) V:0.993174 (21.658049) All:0.981290 (17.279202)
PSNR y:34.412108 u:48.504454 v:48.969496 average:37.264644 min:34.310637 max:42.373392

Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-15 22:40:21 +02:00
Thomas Mundt 2da5bf4c2f avfilter/interlace: add complex vertical low-pass filter
This complex (-1 2 6 2 -1) filter slightly less reduces interlace 'twitter' but better retain detail and subjective sharpness impression compared to the linear (1 2 1) filter.

Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-02 14:09:50 -03:00
Thomas Mundt 207e6debf8 avfilter/interlace: change lowpass_line function prototype
Signed-off-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-22 20:12:15 +02:00
Nicolas George 183ce55b0d lavfi: split frame_count between input and output.
AVFilterLink.frame_count is supposed to count the number of frames
that were passed on the link, but with min_samples, that number is
not always the same for the source and destination filters.
With the addition of a FIFO on the link, the difference will become
more significant.

Split the variable in two: frame_count_in counts the number of
frames that entered the link, frame_count_out counts the number
of frames that were sent to the destination filter.
2016-11-13 10:41:16 +01:00
Michael Niedermayer b65ea6ab44 avfilter/vf_tinterlace: fix image alignment
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-14 19:17:36 +01:00
Derek Buitenhuis 21f9468402 avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPAT
Libav, for some reason, merged this as a public API function. This will
aid in future merges.

A define is left for backwards compat, just in case some person
used it, since it is in a public header.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-01-27 16:36:46 +00:00
Paul B Mahol 13090895cf avfilter/vf_tinterlace: add mergex2 mode
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-03 15:22:16 +02:00
Nicolas George 44f660e7e7 lavfi: remove FF_LINK_FLAG_REQUEST_LOOP.
It has no longer any effect.
2015-09-20 19:02:33 +02:00
Carl Eugen Hoyos 3b4e694ead lavfi/tinterlace: Double aspect ratio for modes merge and pad. 2015-06-04 17:03:29 +02:00
Paul B Mahol a0854c084e avfilter: handle error in query_formats() in bunch of filters
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-04-08 13:05:06 +00:00
Michael Niedermayer ac3f6429ba vfilter/vf_tinterlace: Fix issues with linesize and cols
Based on patch by Vittorio Giovara <vittorio.giovara@gmail.com> from 696141e898

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 23:21:28 +01:00
Michael Niedermayer 59f1f764d6 avfilter/vf_tinterlace: Favor using standard timebases for the output
Reported-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Inspired by discussion with Kieran Kunhya <kierank@obe.tv>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-02 18:28:06 +01:00
Michael Niedermayer 08ee02deca avfilter/vf_tinterlace: remove unused variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-16 01:06:18 +01:00
Michael Niedermayer fb3eb57369 avfilter/tinterlace: add Support for ff_lowpass_line_avx() & ff_lowpass_line_sse2()
Based-on: 2e1704059a by Kieran Kunhya

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-15 04:02:33 +01:00
Michael Niedermayer 18b46ecc93 avfilter/tinterlace: Move lowpass_line to a separate function and call it through a function pointer
This permits replacing it by a optimized implementation
Based-on / Idea-from: 2e1704059a by Kieran Kunhya

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-15 03:25:43 +01:00
Michael Niedermayer 9d548fce24 avfilter/tinterlace: split context definition into seperate header so it can be used by future optimizations
Idea from 2e1704059a from Kieran Kunhya

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-15 03:22:35 +01:00
Michael Niedermayer f043965cd5 avfilter/vf_tinterlace: fix linesize vs. width
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-15 03:03:58 +01:00
Michael Niedermayer 05e0ea6050 avfilter/vf_tinterlace: Fix output top field first flag for MODE_INTERLACEX2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-15 02:45:13 +01:00
Aleksey Vasenev 8349001638 avfilter/vf_tinterlace: fix frame rate
Signed-off-by: Aleksey Vasenev <margtu-fivt@ya.ru>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-13 22:35:15 +01:00
Reimar Döffinger c9a4ec7969 lavfi: add const/static const to pix_fmts arrays.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-08-31 10:25:36 +02:00
Jasper Taylor 0d5ae023b2 avfilter/vf_tinterlace: Fix vf_tinterlace mode 6 (interlacex2)
The purpose of this filter mode is to allow interlaced content to
display properly in interlaced video modes, as described in
http://forum.xbmc.org/showthread.php?tid=81834 and
https://github.com/mpv-player/mpv/issues/624#issuecomment-37685195 . The
filter doubles the video frame rate, but does not work properly because:
(1) it does not set the properties of the output stream to indicate the
doubled frame rate, and
(2) it does not set an appropriate PTS on the extra frames.
The attached patch fixes these problems by settling these values the
same way they are set in vf_yadif mode 1 (field) which also doubles the
frame rate.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-16 17:25:54 +01:00
Michael Niedermayer 6a71efff33 avfilter/vf_tinterlace: check clone return value
Inspired by: 3a16ec19d2

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-19 18:08:58 +01:00
Michael Niedermayer 325f6e0a97 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavfi: do not export the filters from shared objects

Conflicts:
	libavfilter/af_amix.c
	libavfilter/af_anull.c
	libavfilter/asrc_anullsrc.c
	libavfilter/f_select.c
	libavfilter/f_settb.c
	libavfilter/split.c
	libavfilter/src_movie.c
	libavfilter/vf_aspect.c
	libavfilter/vf_blackframe.c
	libavfilter/vf_colorbalance.c
	libavfilter/vf_copy.c
	libavfilter/vf_crop.c
	libavfilter/vf_cropdetect.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_format.c
	libavfilter/vf_framestep.c
	libavfilter/vf_frei0r.c
	libavfilter/vf_hflip.c
	libavfilter/vf_libopencv.c
	libavfilter/vf_lut.c
	libavfilter/vf_null.c
	libavfilter/vf_overlay.c
	libavfilter/vf_scale.c
	libavfilter/vf_transpose.c
	libavfilter/vf_unsharp.c
	libavfilter/vf_vflip.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-29 11:58:11 +01:00
Paul B Mahol 8ac0eb2cd7 avfilter/vf_tinterlace: add yuv411p, yuv440p, yuva422p and yuva444p
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-21 12:48:24 +00:00
Paul B Mahol b211607b5c avfilter: various cosmetics
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-09-12 14:01:43 +00:00
Michael Niedermayer e41bf19d2c Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavfi: math typo in interlace filter

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-18 09:31:05 +02:00
Paul B Mahol 4f8e4b8a54 lavfi/tinterlace: remove request frame hack
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-05-27 09:55:40 +00:00
Clément Bœsch 50e66726a2 lavfi: use ceil right shift for chroma width/height.
This should fix several issues with odd dimensions inputs.

lut, vflip, pad and crop video filters also need to be checked for such
issues. It's possible sws is also affected.
2013-05-10 17:20:06 +02:00
Clément Bœsch 570d63eef3 lavu: add FF_CEIL_RSHIFT and use it in various places. 2013-05-09 16:59:42 +02:00
Michael Niedermayer e92862e75f avfilter/vf_tinterlace: fix handling of not so even sizes
Fixes green bottom line

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-29 12:26:15 +02:00
Clément Bœsch c85f56bb4f lavfi/tinterlace: switch to an AVOptions-based system. 2013-04-11 11:51:48 +02:00
Paul B Mahol ed8373e7db lavfi: always check return value of ff_get_{audio,video}_buffer()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-04-08 19:24:09 +00:00
Clément Bœsch cbf224b631 lavfi/tinterlace: use standard options parsing. 2013-03-24 12:26: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
Michael Niedermayer e797f22efa vf_tinterlace: fix logical/bit op mixup
Fixes CID966642

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-06 04:38:53 +01:00
Michael Niedermayer b84871b8eb vf_tinterlace: dont mix declarations and expressions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-30 16:59:52 +01:00
Mark Himsley 8997a0fa79 lavfi/tinterlace: add low-pass-filter for top/bottom interleave modes
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
2012-12-30 15:19:23 +01:00
Michael Niedermayer b11a889055 vf_tinterlace: default of mode switch is impossible, add assert.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-11 00:03:23 +01:00
Stefano Sabatini da9a45b681 lavfi/tinterlace: drop redundant NULL checks in uninit() 2012-12-06 22:32:03 +01:00
Stefano Sabatini c6a216771f lavfi/tinterlace: add support to option parsing
Simplify code, and provide introspection through the AVOption system.
2012-12-06 22:31:42 +01:00
Stefano Sabatini fef7b2e0be lavfi/tinterlace: switch to filter_frame API
Also add missing NULL checks.
2012-12-06 22:30:59 +01:00
Clément Bœsch 2d9d444051 lavfi: convert remaining input/output list compound literals to named objects.
This is following 568c70e79e.
2012-11-28 23:19:20 +01:00
Michael Niedermayer ac2a3a7a05 vf_tinterlace: check av_image_get_linesize() return value
Fixes CID703717
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-03 02:38:30 +01:00