Commit Graph

52 Commits

Author SHA1 Message Date
Andreas Rheinhardt 1be3d8a0cb avcodec/avcodec: Stop including channel_layout.h in avcodec.h
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:31 +02:00
Andreas Rheinhardt a04ad248a0 avfilter: Constify all AVFilters
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:05 -03:00
Marton Balint 84094f017e avfilter/avf_showcqt: use av_gettime_relative() instead of av_gettime()
av_gettime_relative() is using the monotonic clock therefore more suitable for
relative time calculations.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-27 21:30:41 +01:00
Nicolas George 2f76476549 lavfi: regroup formats lists in a single structure.
It will allow to refernce it as a whole without clunky macros.

Most of the changes have been automatically made with sed:

sed -i '
  s/-> *in_formats/->incfg.formats/g;
  s/-> *out_formats/->outcfg.formats/g;
  s/-> *in_channel_layouts/->incfg.channel_layouts/g;
  s/-> *out_channel_layouts/->outcfg.channel_layouts/g;
  s/-> *in_samplerates/->incfg.samplerates/g;
  s/-> *out_samplerates/->outcfg.samplerates/g;
  ' src/libavfilter/*(.)
2020-09-08 14:02:40 +02:00
Andreas Rheinhardt ae5026c905 avfilter/formats: Schedule avfilter_make_format64_list() for removal
Despite its name, this function is not part of the public API, as
formats.h, the header containing its declaration, is a private header.
The formats API was once public API, but that changed long ago
(b74a1da49d, the commit scheduling it to
become private, is from 2012). That avfilter_make_format64_list() was
forgotten is probably a result of the confusion resulting from the
libav-ffmpeg split.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-12 21:10:59 +02:00
Andreas Rheinhardt 2e0cf4de01 avfilter/avf_showcqt: Mark arrays as static const
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-12 21:08:16 +02:00
Anton Khirnov f30a41a608 Stop hardcoding align=32 in av_frame_get_buffer() calls.
Use 0, which selects the alignment automatically.
2020-05-22 14:38:57 +02:00
Paul B Mahol d64cbd4fda remove CHAR_MIN/CHAR_MAX usage
It is not needed at all.
2020-03-17 22:46:36 +01:00
Muhammad Faiz 6af050d7d0 avfilter: do not use AVFrame accessor
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-04-23 14:40:30 +07:00
Muhammad Faiz 3408f46694 avfilter/avf_showcqt: add attack option
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-04-09 14:38:42 +07:00
Muhammad Faiz c4a3526b57 avfilter/showcqt: make minimum timeclamp option lower
high basefreq does not require high timeclamp

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-01-30 05:41:49 +07:00
Muhammad Faiz 0686537002 avfilter/avf_showcqt: add bar_t option
custom bargraph transparency

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-10-29 22:11:58 +07:00
Muhammad Faiz 56689a46b3 avfilter/showcqt: add cscheme option
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-10-20 14:10:43 +07:00
Muhammad Faiz 923488bdaa avfilter/showcqt: add font option
this is fontconfig pattern

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-10-18 00:47:57 +07:00
Muhammad Faiz a11757d7cb avfilter/showcqt: add csp option
from colorspace filter

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-10-16 05:41:09 +07:00
Muhammad Faiz 1b7eaead0c avfilter/showcqt: set some frame properties
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-06-24 15:33:16 +07:00
Muhammad Faiz a096d3ec47 avfilter/avf_showcqt: set range on fps/rate/r option
see Ticket #5618

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-06-09 01:16:26 +07:00
Muhammad Faiz 1e69ac9246 avfilter/avf_showcqt: cqt_calc optimization on x86
on x86_64:
        time    PSNR
plain   3.303   inf
SSE     1.649   107.087535
SSE3    1.632   107.087535
AVX     1.409   106.986771
FMA3    1.265   107.108437

on x86_32 (PSNR compared to x86_64 plain):
        time    PSNR
plain   7.225   103.951979
SSE     1.827   105.859282
SSE3    1.819   105.859282
AVX     1.533   105.997661
FMA3    1.384   105.885377

FMA4 test is not available

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-06-08 16:09:43 +07:00
Muhammad Faiz 1e6a0c9d14 avfilter/avf_showcqt: render default font at 960x16
and let ffmpeg scaler scale it
this impoves quality

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-06-04 14:05:04 +07:00
Muhammad Faiz 1b05521bb7 avfilter/avf_showcqt: full chroma blending on draw_axis_yuv
improve quality on axis drawing with yuv422p and yuv420p format

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-06-02 16:14:16 +07:00
Muhammad Faiz fd0c9789cf avfilter/avf_showcqt: add performance debugging log
for easier development

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-03-08 20:50:26 +07:00
Muhammad Faiz 7dd60a0b54 avfilter/avf_showcqt: remove CoeffsType
seems not useful

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-03-06 16:36:37 +07:00
Muhammad Faiz d1401cb1d0 avfilter/avf_showcqt: optimize draw routines
optimize draw_bar_yuv (slightly faster)
optimize draw_axis (about 2x faster)

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-02-29 16:06:39 +07:00
Muhammad Faiz 6eb4021d47 avfilter/avf_showcqt: use lrint
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-02-23 22:14:08 +07:00
Muhammad Faiz 76377d66b7 avfilter/avf_showcqt: remove unneeded headers 2016-02-23 01:05:08 +07:00
Muhammad Faiz 7c11e727f6 avfilter/avf_showcqt: improve pts handling
correct output pts based on input pts
make seeking possible
output frame one by one on eof
tested with showinfo filter

Suggested-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-17 16:13:09 +01:00
Muhammad Faiz 54ed3ebbe4 avfilter/showcqt: BASEFREQ and ENDFREQ cast to double
fix default basefreq/endfreq comparison
on platform that does not do comparison
in double type

found on zeranoe 32-bit build, where
default freq range is detected as non-default

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-07 01:28:48 +01:00
Michael Niedermayer 1b539fbfe3 avfilter/avf_showcqt: Fix uninitialized return code
Fixes CID1322329

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-11 01:07:45 +01:00
Muhammad Faiz 6df2c94130 avfilter/showcqt: remove yuv offset
this makes draw_bar faster
slightly different result with old version

check result (with ~3 minutes audio file):
old:
    real    0m49.611s
    user    0m49.260s
    sys     0m0.073s
new:
    real    0m47.606s
    user    0m47.378s
    sys     0m0.068s
PSNR between old and new:
yuv444p PSNR
    y:109.519298 u:107.506485 v:104.746878
    average:106.816074 min:99.167305 max:inf
yuv422p PSNR
    y:109.519298 u:108.025801 v:104.489734
    average:107.279817 min:98.007467 max:inf
yuv420p PSNR
    y:109.519298 u:108.363875 v:105.290200
    average:108.261511 min:97.461812 max:inf

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-03 23:47:09 +01:00
Michael Niedermayer 34f49bfacd avfilter/avf_showcqt: Replace all fmin* and fmax* by FFMIN/FFMAX
Should fix build on x86_32-msvc2012

The alternative of emulating fmin/fmax* turns out to be non trivial

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-31 00:29:51 +01:00
Muhammad Faiz f8d429e0c5 avfilter/avf_showcqt: rewrite showcqt and add features
add yuv444p, yuv422p, and yuv420p output format (lower cpu usage
on ffplay playback because it does not do format conversion)
custom size with size/s option (fullhd option is deprecated)
custom layout with bar_h, axis_h, and sono_h option
support rational frame rate (within fps/r/rate option)
relaxed frame rate restriction (support fractional sample step)
support all input sample rates
separate sonogram and bargraph volume (with volume/sono_v and
volume2/bar_v)
timeclamp option alias (timeclamp/tc)
fcount option
gamma option alias (gamma/sono_g and gamma2/bar_g)
support custom frequency range (basefreq and endfreq)
support drawing axis using external image file (axisfile option)
alias for disabling drawing to axis (text/axis)
possibility to optimize it using arch specific asm code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-28 02:30:03 +01:00
Ganesh Ajjanagadde 8507b98c10 avfilter,swresample,swscale: use fabs, fabsf instead of FFABS
It is well known that fabs and fabsf are at least as fast and sometimes
faster than the FFABS macro, at least on the gcc+glibc combination.
For instance, see the reference:
http://patchwork.sourceware.org/patch/6735/.
This was a patch to glibc in order to remove their usages of a macro.

The reason essentially boils down to fabs using the __builtin_fabs of
the compiler, while FFABS needs to infer to not use a branch and to
simply change the sign bit. Usually the inference works, but sometimes
it does not. This may be easily checked by looking at the asm.

This also has the added benefit of reducing macro usage, which has
problems with side-effects.

Note that avcodec is not handled here, as it is huge and
most things there are integer arithmetic anyway.

Tested with FATE.

Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-22 16:13:26 -04:00
Ganesh Ajjanagadde 6aaac24d72 avfilter/all: propagate errors of functions from avfilter/formats
Many of the functions from avfilter/formats can return errors, usually AVERROR(ENOMEM).
This propagates the return values.

All of these were found by using av_warn_unused_result, demonstrating its utility.

Tested with FATE. I am least sure of the changes to avfilter/filtergraph,
since I don't know what/how reduce_format is intended to behave and how it should
react to errors.

Fixes: CID 1325680, 1325679, 1325678.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Previous version Reviewed-by: Nicolas George <george@nsup.org>
Previous version Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-14 10:04:01 -04:00
Nicolas George 114f3f526e lavfi/avf_showcqt: remove looping on request_frame(). 2015-10-07 19:00:22 +02:00
Muhammad Faiz 5b48dd75d5 avfilter/avf_showcqt: use frequency domain windowing
faster initialization and less code
slightly different result computationally from previous
coeffclamp option is ignored

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-18 18:27:18 +02:00
Paul B Mahol 1c853d5727 avfilter/avf_showcqt: draw text optionally
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-09-15 07:54:47 +00:00
Muhammad Faiz 145c5a9978 avfilter/avf_showcqt: change fft left-right separation
This simplifies the code

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-14 12:51:43 +02:00
Clément Bœsch af0945d912 avfilter/showcqt: use AV_OPT_TYPE_BOOL for fullhd option 2015-09-08 23:26:30 +02:00
Michael Niedermayer d3c9f1fdbe avfilter/avf_showcqt: Fix gamma comparisons
Fixes CID1297587, CID1297586, 1297585

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-12 20:31:21 +02:00
Muhammad Faiz a141948a8b avfilter/avf_showcqt: optimize gamma calculation
benchmark (on intel core2 duo, gcc 4.9.1)
input samples duration 00:03:39.59
command: time -p ffmpeg -f f32le -ac 2 -ar 44100 -i input.pcm \
         -filter_complex showcqt=fullhd=0:gamma=$gamma \
         -f rawvideo -y /dev/null
gamma  previous  modified
  1    48.49 s   45.38 s
  2    49.33 s   48.11 s
  3    80.86 s   59.80 s
  4    80.84 s   51.25 s
  5    80.75 s   61.06 s
  6    80.93 s   61.80 s
  7    80.03 s   61.56 s

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-03 11:53:04 +02:00
Nicolas George 38155865df lavfi/avf_showcqt: fix error code.
Signed-off-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-16 12:38:28 +02:00
Michael Niedermayer a30fd828ab avfilter/avf_showcqt: use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-22 13:56:30 +01:00
Muhammad Faiz eba5cb2028 avfilter/showcqt: add gamma2 option
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-18 05:15:15 +01:00
Muhammad Faiz c82a288f87 avfilter/showcqt: add fontcolor option 2014-08-23 10:01:22 +02:00
Muhammad Faiz 94494dab91 avfilter/showcqt: add and extend tlength and volume options
Add a tlength option with frequency and timeclamp variable

Add to the volume option support for frequency and timeclamp variable,
   a_weighting, b_weighting and c_weighting functions

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-08 18:59:02 +02:00
Muhammad Faiz 46563af79c avfilter/showcqt: adding freetype support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 21:53:14 +02:00
Michael Niedermayer 1df441eaa8 vfilter/avf_showcqt: fix 'mixed declarations and code'
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-13 20:32:54 +02:00
Muhammad Faiz 0a64fb7fb0 avfilter/avf_showcqt: add option for lower resolution
Resolution can be 1920x1080 or 960x540.
2014-06-12 09:16:08 +00:00
Clément Bœsch 0180c46928 avfilter/showcqt: move qsort_sparsecoeff closer to where it belongs 2014-06-11 21:33:09 +02:00
Clément Bœsch 1786cd850f avfilter/showcqt: fix misc style issues 2014-06-11 21:33:09 +02:00