Commit Graph

35 Commits

Author SHA1 Message Date
Andreas Rheinhardt 1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Andreas Rheinhardt 8be701d9f7 avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilter
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>
2021-08-20 12:53:58 +02:00
Andreas Rheinhardt 1b20853fb3 avfilter/internal: Factor out executing a filter's execute_func
The current way of doing it involves writing the ctx parameter twice.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-15 21:33:25 +02:00
Andreas Rheinhardt 18ec426a86 avfilter/formats: Factor common function combinations out
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>
2021-08-13 17:36:22 +02:00
Limin Wang fd3dabe68e avfilter/vf_ssim: remove unnecessary check
For the pointer have been checked in the previous few lines of code

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-05-01 08:45:30 +08: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
Guo, Yejun ac6dd87cd1 avfilter/vf_ssim.c: fix build warning for [-Wmain]
The build warning message:
src/libavfilter/vf_ssim.c: In function ‘ssim_plane_16bit’:
src/libavfilter/vf_ssim.c:246:24: warning: ‘main’ is usually a function [-Wmain]
         const uint8_t *main = td->main_data[c];
                        ^~~~
src/libavfilter/vf_ssim.c: In function ‘ssim_plane’:
src/libavfilter/vf_ssim.c:289:24: warning: ‘main’ is usually a function [-Wmain]
         const uint8_t *main = td->main_data[c];
                        ^~~~

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
2021-02-25 11:43:56 +01:00
Paul B Mahol c2ca1eb2a7 avfilter/vf_ssim: add slice threading 2021-02-19 21:15:08 +01:00
Paul B Mahol 3300d718f7 avfilter/vf_ssim: remove precision limits for metadata values 2021-02-12 23:22:32 +01:00
Paul B Mahol 05a6d82d5c avfilter/vf_ssim: add timeline support 2021-02-12 21:21:25 +01:00
Paul B Mahol fcc0424c93 avfilter/vf_ssim: improve precision
Use doubles for accumulating floats.
2020-02-04 18:28:04 +01:00
Paul B Mahol 89eee09739 avfilter/vf_ssim: fix logic failure when comparing time bases 2020-02-01 21:09:32 +01:00
Paul B Mahol 9e283aa24e avfilter/vf_psnr,vf_ssim: add warning if different timebases are encountered 2019-10-25 22:02:41 +02:00
Paul B Mahol bd6c57d532 avfilter: add support for gray14 format 2018-09-09 19:10:44 +02:00
Carl Eugen Hoyos 5d3e935728 lavfi: Rename local variables "main" as "master".
Silences several warnings:
main is usually a function
2017-10-07 20:49:48 +02:00
Nicolas George 5f5dcf44e3 lavfi: rename framesync2 to framesync. 2017-09-12 11:03:51 +02:00
Nicolas George ef2176473d vf_ssim: convert to framesync2. 2017-08-29 10:19:04 +02:00
Paul B Mahol bac508fec1 avfilter: add support for GRAY9 and GBRAP10 2017-08-07 13:11:09 +02:00
Muhammad Faiz f2d23ec03f avfilter/vf_ssim: fix temp size calculation
Also use av_mallocz_array.
Fix Ticket6519.

Reviewed-by: Tobias Rapp <t.rapp@noa-archive.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-08-04 06:53:39 +07:00
Paul B Mahol 1212041c91 avfilter/vf_ssim: use unsigned so result can be properly stored
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-07-04 10:21:14 +02: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
Paul B Mahol 334fad3645 avfilter/vf_ssim: add >8 bit depth suppport
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-12-17 16:33:16 +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
Ganesh Ajjanagadde b8e1980807 avfilter/vf_ssim: use log10 instead of log()/log(10)
This is likely more precise and conveys the intent better.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-29 19:02:05 -04:00
Ronald S. Bultje 0c7b44a01c vf_psnr/ssim: don't crash if stats_file is NULL. 2015-10-23 06:38:30 -04:00
Ronald S. Bultje e7d9061d4f vf_ssim: print per-channel dB values. 2015-10-22 17:18:40 -04:00
Tobias Rapp 18e8fac531 avfilter/vf_ssim: Add support for writing stats to stdout
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-21 22:11:33 +02:00
Michael Niedermayer 0ff4953e1b avfilter/vf_ssim: Fix "incompatible pointer type" warnings
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-14 13:29:55 +02:00
Ronald S. Bultje dfc58584b4 vf_ssim: x86 simd for ssim_4x4xN and ssim_endN.
Both are 2-2.5x faster than their C counterpart.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-14 05:07:07 +02:00
Ronald S. Bultje 03931ecf71 vf_ssim: remove another obscure double loop.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-13 02:39:51 +02:00
Ronald S. Bultje a1f4848049 ssim: refactor a weird double loop.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-13 02:23:30 +02:00
Ronald S. Bultje f353b851b9 vf_ssim: fix s->coefs for yuv with non-4:2:0 subsampling.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-12 17:15:42 +02:00
Michael Niedermayer 8fca37d5f8 avfilter/vf_ssim: Mark constant tables as const
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-10 23:43:21 +02:00
Paul B Mahol 185e76976e avfilter/vf_ssim: fix some cosmetics issues
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-06-30 02:52:33 +00:00
Paul B Mahol 5a1f785249 avfilter: add ssim filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-06-24 14:04:40 +00:00