summaryrefslogtreecommitdiff
path: root/libavfilter/avf_showcqt.c
Commit message (Collapse)AuthorAge
* avfilter: convert to new channel layout APIJames Almer2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avfilter: Replace query_formats callback with union of list and callbackAndreas Rheinhardt2021-10-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If one looks at the many query_formats callbacks in existence, one will immediately recognize that there is one type of default callback for video and a slightly different default callback for audio: It is "return ff_set_common_formats_from_list(ctx, pix_fmts);" for video with a filter-specific pix_fmts list. For audio, it is the same with a filter-specific sample_fmts list together with ff_set_common_all_samplerates() and ff_set_common_all_channel_counts(). This commit allows to remove the boilerplate query_formats callbacks by replacing said callback with a union consisting the old callback and pointers for pixel and sample format arrays. For the not uncommon case in which these lists only contain a single entry (besides the sentinel) enum AVPixelFormat and enum AVSampleFormat fields are also added to the union to store them directly in the AVFilter, thereby avoiding a relocation. The state of said union will be contained in a new, dedicated AVFilter field (the nb_inputs and nb_outputs fields have been shrunk to uint8_t in order to create a hole for this new field; this is no problem, as the maximum of all the nb_inputs is four; for nb_outputs it is only two). The state's default value coincides with the earlier default of query_formats being unset, namely that the filter accepts all formats (and also sample rates and channel counts/layouts for audio) provided that these properties agree coincide for all inputs and outputs. By using different union members for audio and video filters the type-unsafety of using the same functions for audio and video lists will furthermore be more confined to formats.c than before. When the new fields are used, they will also avoid allocations: Currently something nearly equivalent to ff_default_query_formats() is called after every successful call to a query_formats callback; yet in the common case that the newly allocated AVFilterFormats are not used at all (namely if there are no free links) these newly allocated AVFilterFormats are freed again without ever being used. Filters no longer using the callback will not exhibit this any more. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilterAndreas Rheinhardt2021-08-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, an AVFilter's lists of input and output AVFilterPads were terminated by a sentinel and the only way to get the length of these lists was by using avfilter_pad_count(). This has two drawbacks: first, sizeof(AVFilterPad) is not negligible (i.e. 64B on 64bit systems); second, getting the size involves a function call instead of just reading the data. This commit therefore changes this. The sentinels are removed and new private fields nb_inputs and nb_outputs are added to AVFilter that contain the number of elements of the respective AVFilterPad array. Given that AVFilter.(in|out)puts are the only arrays of zero-terminated AVFilterPads an API user has access to (AVFilterContext.(in|out)put_pads are not zero-terminated and they already have a size field) the argument to avfilter_pad_count() is always one of these lists, so it just has to find the filter the list belongs to and read said number. This is slower than before, but a replacement function that just reads the internal numbers that users are expected to switch to will be added soon; and furthermore, avfilter_pad_count() is probably never called in hot loops anyway. This saves about 49KiB from the binary; notice that these sentinels are not in .bss despite being zeroed: they are in .data.rel.ro due to the non-sentinels. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/avf_showcqt: switch to TX FFT from avutilPaul B Mahol2021-07-27
|
* Remove unnecessary avassert.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Stop including channel_layout.h in avcodec.hAndreas Rheinhardt2021-07-22
| | | | | | Also include channel_layout.h directly wherever used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter: Constify all AVFiltersAndreas Rheinhardt2021-04-27
| | | | | | | 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>
* avfilter/avf_showcqt: use av_gettime_relative() instead of av_gettime()Marton Balint2021-02-27
| | | | | | | av_gettime_relative() is using the monotonic clock therefore more suitable for relative time calculations. Signed-off-by: Marton Balint <cus@passwd.hu>
* lavfi: regroup formats lists in a single structure.Nicolas George2020-09-08
| | | | | | | | | | | | | | | 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/*(.)
* avfilter/formats: Schedule avfilter_make_format64_list() for removalAndreas Rheinhardt2020-08-12
| | | | | | | | | | | | 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 (b74a1da49db5ebed51aceae6cacc2329288a92c1, 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>
* avfilter/avf_showcqt: Mark arrays as static constAndreas Rheinhardt2020-08-12
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* Stop hardcoding align=32 in av_frame_get_buffer() calls.Anton Khirnov2020-05-22
| | | | Use 0, which selects the alignment automatically.
* remove CHAR_MIN/CHAR_MAX usagePaul B Mahol2020-03-17
| | | | It is not needed at all.
* avfilter: do not use AVFrame accessorMuhammad Faiz2017-04-23
| | | | | Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/avf_showcqt: add attack optionMuhammad Faiz2017-04-09
| | | | Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/showcqt: make minimum timeclamp option lowerMuhammad Faiz2017-01-30
| | | | | | high basefreq does not require high timeclamp Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/avf_showcqt: add bar_t optionMuhammad Faiz2016-10-29
| | | | | | custom bargraph transparency Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/showcqt: add cscheme optionMuhammad Faiz2016-10-20
| | | | Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/showcqt: add font optionMuhammad Faiz2016-10-18
| | | | | | this is fontconfig pattern Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/showcqt: add csp optionMuhammad Faiz2016-10-16
| | | | | | from colorspace filter Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/showcqt: set some frame propertiesMuhammad Faiz2016-06-24
| | | | Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/avf_showcqt: set range on fps/rate/r optionMuhammad Faiz2016-06-09
| | | | | | see Ticket #5618 Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/avf_showcqt: cqt_calc optimization on x86Muhammad Faiz2016-06-08
| | | | | | | | | | | | | | | | | | | | | | | 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>
* avfilter/avf_showcqt: render default font at 960x16Muhammad Faiz2016-06-04
| | | | | | | and let ffmpeg scaler scale it this impoves quality Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/avf_showcqt: full chroma blending on draw_axis_yuvMuhammad Faiz2016-06-02
| | | | | | improve quality on axis drawing with yuv422p and yuv420p format Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/avf_showcqt: add performance debugging logMuhammad Faiz2016-03-08
| | | | | | for easier development Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/avf_showcqt: remove CoeffsTypeMuhammad Faiz2016-03-06
| | | | | | seems not useful Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/avf_showcqt: optimize draw routinesMuhammad Faiz2016-02-29
| | | | | | | optimize draw_bar_yuv (slightly faster) optimize draw_axis (about 2x faster) Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/avf_showcqt: use lrintMuhammad Faiz2016-02-23
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
* avfilter/avf_showcqt: remove unneeded headersMuhammad Faiz2016-02-23
|
* avfilter/avf_showcqt: improve pts handlingMuhammad Faiz2016-02-17
| | | | | | | | | | | 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>
* avfilter/showcqt: BASEFREQ and ENDFREQ cast to doubleMuhammad Faiz2015-12-07
| | | | | | | | | | | 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>
* avfilter/avf_showcqt: Fix uninitialized return codeMichael Niedermayer2015-11-11
| | | | | | Fixes CID1322329 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/showcqt: remove yuv offsetMuhammad Faiz2015-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* avfilter/avf_showcqt: Replace all fmin* and fmax* by FFMIN/FFMAXMichael Niedermayer2015-10-31
| | | | | | | | 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>
* avfilter/avf_showcqt: rewrite showcqt and add featuresMuhammad Faiz2015-10-28
| | | | | | | | | | | | | | | | | | | | | 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>
* avfilter,swresample,swscale: use fabs, fabsf instead of FFABSGanesh Ajjanagadde2015-10-22
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* avfilter/all: propagate errors of functions from avfilter/formatsGanesh Ajjanagadde2015-10-14
| | | | | | | | | | | | | | | | | | 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>
* lavfi/avf_showcqt: remove looping on request_frame().Nicolas George2015-10-07
|
* avfilter/avf_showcqt: use frequency domain windowingMuhammad Faiz2015-09-18
| | | | | | | | faster initialization and less code slightly different result computationally from previous coeffclamp option is ignored Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/avf_showcqt: draw text optionallyPaul B Mahol2015-09-15
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avfilter/avf_showcqt: change fft left-right separationMuhammad Faiz2015-09-14
| | | | | | This simplifies the code Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/showcqt: use AV_OPT_TYPE_BOOL for fullhd optionClément Bœsch2015-09-08
|
* avfilter/avf_showcqt: Fix gamma comparisonsMichael Niedermayer2015-05-12
| | | | | | Fixes CID1297587, CID1297586, 1297585 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/avf_showcqt: optimize gamma calculationMuhammad Faiz2015-05-03
| | | | | | | | | | | | | | | | | | 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>
* lavfi/avf_showcqt: fix error code.Nicolas George2015-04-16
| | | | | Signed-off-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/avf_showcqt: use av_malloc_array()Michael Niedermayer2015-01-22
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/showcqt: add gamma2 optionMuhammad Faiz2015-01-18
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avfilter/showcqt: add fontcolor optionMuhammad Faiz2014-08-23
|
* avfilter/showcqt: add and extend tlength and volume optionsMuhammad Faiz2014-08-08
| | | | | | | | | 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>