summaryrefslogtreecommitdiff
path: root/libavfilter/vf_libvmaf.c
Commit message (Collapse)AuthorAge
* avfilter/vf_libvmaf: update filter for libvmaf v2.0.0Kyle Swanson2022-01-23
|
* avfilter: Reindentation after query_formats changesAndreas Rheinhardt2021-10-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avfilter/vf_libvmaf: Use formats list instead of query functionAndreas Rheinhardt2021-10-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.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/vf_libvmaf: Remove always-false format checkAndreas Rheinhardt2021-09-21
| | | | | | | This filter uses ff_set_common_formats_from_list(). Reviewed-by: Paul B Mahol <onemda@gmail.com> 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/formats: Factor common function combinations outAndreas Rheinhardt2021-08-13
| | | | | | | | | | | Several combinations of functions happen quite often in query_format functions; e.g. ff_set_common_formats(ctx, ff_make_format_list(sample_fmts)) is very common. This commit therefore adds functions that are equivalent to commonly used function combinations in order to reduce code duplication. Reviewed-by: Nicolas George <george@nsup.org> 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/libvmaf: mention csv as available log formatHarry Mallon2020-08-21
| | | | | Signed-off-by: Harry Mallon <harry.mallon@codex.online> Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
* avfilter/vf_libvmaf: Check for av_frame_alloc failureLimin Wang2019-11-28
| | | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avfilter/vf_libvmaf: fix filtering of >8 bit dataPaul B Mahol2019-10-13
| | | | This is what reference does.
* lavfi/vf_libvmaf: update to use libvmaf v1.3.9Kyle Swanson2018-08-10
| | | | Signed-off-by: Kyle Swanson <kswanson@netflix.com>
* avfilter/vf_libvmaf: the libvmaf filter tried to join on an invalid thread idKevin Wheatley2018-05-04
| | | | | | | | | | | The thread id was invalid because it was not initialised during the calls to init_complex_filtergraph. This adds a flag to check for initialisation before trying to peform the join. Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com> Signed-off-by: Kevin Wheatley <kevin.j.wheatley@gmail.com>
* vf_libvmaf: Fix memory leakenctac2018-03-31
| | | | Fixes ticket #6967
* libvmaf: exit gracefully if the library fails.Ronald S. Bultje2017-12-18
| | | | Fixes trac issue #6884 and Netflix/vmaf issue #124.
* lavfi/libvmaf: Rename local variable "main" as "master".Carl Eugen Hoyos2017-11-30
| | | | | | | Fixes the following warning: libavfilter/vf_libvmaf.c:179:14: warning: 'main' is usually a function Missed in 5d3e9357
* avfilter/vf_libvmaf: fix errors while running with psnr=1.Ashish Pratap Singh2017-11-06
| | | | | | | | This patch fixes the seg fault which ocuured while running libvmaf filter with option psnr=1. Signed-off-by: ashk43712 <ashk43712@gmail.com> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* lavfi: rename framesync2 to framesync.Nicolas George2017-09-12
|
* avfilter/vf_libvmaf: fix pre convert to framesync2 bugsAshish Singh2017-08-30
| | | | | | | | | | Hi, it fixes the errors while converting to framesync2. libvmaf was changed recently, double *score variable is removed in the new version since it's not used anywhere. This patch fixes all the warnings and segmentation faults. Signed-off-by: Ashish Singh <ashk43712@gmail.com> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* lavfi/vf_libvmaf: convert to framesync2.Nicolas George2017-08-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After this commit, the code compiles, but on my setup it segfaults before and after. It also prints the very worrying warning: src/libavfilter/vf_libvmaf.c:161:66: warning: passing argument 4 of ‘compute_vmaf’ from incompatible pointer type [-Wincompatible-pointer-types] /tmp/i/include/libvmaf.h:26:8: note: expected ‘int (*)(float *, float *, float *, int, void *)’ but argument is of type ‘int (*)(float *, float *, float *, int, double *, void *)’ ==12116== Thread 6: ==12116== Conditional jump or move depends on uninitialised value(s) ==12116== at 0x526D432: cons_ (ocval.h:1188) ==12116== by 0x526D432: GenericIT (ocval.h:1119) ==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92) ==12116== by 0x5211F5D: loads (pickleloader.h:566) ==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290) ==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405) ==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77) ==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149) ==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645) ==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161) ==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170) ==12116== by 0x7967493: start_thread (pthread_create.c:333) ==12116== by 0x7F69A8E: clone (clone.S:97) ==12116== ==12116== Conditional jump or move depends on uninitialised value(s) ==12116== at 0x526D432: cons_ (ocval.h:1188) ==12116== by 0x526D432: GenericIT (ocval.h:1119) ==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92) ==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94) ==12116== by 0x5211F5D: loads (pickleloader.h:566) ==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290) ==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405) ==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77) ==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149) ==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645) ==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161) ==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170) ==12116== by 0x7967493: start_thread (pthread_create.c:333) ==12116== by 0x7F69A8E: clone (clone.S:97) ==12116== ==12116== Conditional jump or move depends on uninitialised value(s) ==12116== at 0x526D432: cons_ (ocval.h:1188) ==12116== by 0x526D432: GenericIT (ocval.h:1119) ==12116== by 0x526D432: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:92) ==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94) ==12116== by 0x526D50D: OC::TranslateForNumPyClassesToArray(OC::Val&) (pickleloader.h:94) ==12116== by 0x5211F5D: loads (pickleloader.h:566) ==12116== by 0x5211F5D: LoadValFromArray (chooseser.h:290) ==12116== by 0x5211F5D: LoadValFromFile (chooseser.h:405) ==12116== by 0x5211F5D: _read_and_assert_model(char const*, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&, OC::Val&) (vmaf.cpp:77) ==12116== by 0x5212B0F: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:149) ==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645) ==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161) ==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170) ==12116== by 0x7967493: start_thread (pthread_create.c:333) ==12116== by 0x7F69A8E: clone (clone.S:97) ==12116== ==12116== Use of uninitialised value of size 8 ==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147) ==12116== by 0x52AB5E8: combo (combo.c:149) ==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278) ==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645) ==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161) ==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170) ==12116== by 0x7967493: start_thread (pthread_create.c:333) ==12116== by 0x7F69A8E: clone (clone.S:97) ==12116== ==12116== Invalid read of size 4 ==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147) ==12116== by 0x52AB5E8: combo (combo.c:149) ==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278) ==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645) ==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161) ==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170) ==12116== by 0x7967493: start_thread (pthread_create.c:333) ==12116== by 0x7F69A8E: clone (clone.S:97) ==12116== Address 0x40 is not stack'd, malloc'd or (recently) free'd ==12116== ==12116== ==12116== Process terminating with default action of signal 11 (SIGSEGV) ==12116== Access not within mapped region at address 0x40 ==12116== at 0x518AC79: read_frame_8bit (vf_libvmaf.c:147) ==12116== by 0x52AB5E8: combo (combo.c:149) ==12116== by 0x5212E95: VmafRunner::run(Asset, int (*)(float*, float*, float*, int, void*), void*, bool, bool, bool, bool, bool) (vmaf.cpp:278) ==12116== by 0x52165B6: RunVmaf(char const*, int, int, int (*)(float*, float*, float*, int, void*), void*, char const*, char const*, char const*, bool, bool, bool, bool, bool, char const*) (vmaf.cpp:645) ==12116== by 0x518AFFF: compute_vmaf_score (vf_libvmaf.c:161) ==12116== by 0x518AFFF: call_vmaf (vf_libvmaf.c:170) ==12116== by 0x7967493: start_thread (pthread_create.c:333) ==12116== by 0x7F69A8E: clone (clone.S:97)
* avfilter: add LIBVMAF filterAshish Singh2017-07-16
This one changes the previous vmaf patch to libvmaf to keep it separate from the native implementation of vmaf inside ffmpeg later. Signed-off-by: Ashish Singh <ashk43712@gmail.com> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>