avfilter/avfilter: Add numbers of (in|out)pads directly to AVFilter
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Thu, 12 Aug 2021 11:05:31 +0000 (13:05 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Fri, 20 Aug 2021 10:53:58 +0000 (12:53 +0200)
commit8be701d9f7f77ff2282cc7fe6e0791ca5419de70
treef8b71470413002e9234c6a9a7adf9d4dde3ad5eb
parentd53d48c7993fe2e9ffcc4a638ebd2f4c5273c144
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>
389 files changed:
libavfilter/aeval.c
libavfilter/af_acontrast.c
libavfilter/af_acopy.c
libavfilter/af_acrossover.c
libavfilter/af_acrusher.c
libavfilter/af_adeclick.c
libavfilter/af_adelay.c
libavfilter/af_adenorm.c
libavfilter/af_aderivative.c
libavfilter/af_aecho.c
libavfilter/af_aemphasis.c
libavfilter/af_aexciter.c
libavfilter/af_afade.c
libavfilter/af_afftdn.c
libavfilter/af_afftfilt.c
libavfilter/af_aformat.c
libavfilter/af_afreqshift.c
libavfilter/af_afwtdn.c
libavfilter/af_agate.c
libavfilter/af_aiir.c
libavfilter/af_alimiter.c
libavfilter/af_amerge.c
libavfilter/af_amix.c
libavfilter/af_amultiply.c
libavfilter/af_anequalizer.c
libavfilter/af_anlmdn.c
libavfilter/af_anlms.c
libavfilter/af_anull.c
libavfilter/af_apad.c
libavfilter/af_aphaser.c
libavfilter/af_apulsator.c
libavfilter/af_aresample.c
libavfilter/af_arnndn.c
libavfilter/af_asetnsamples.c
libavfilter/af_asetrate.c
libavfilter/af_ashowinfo.c
libavfilter/af_asoftclip.c
libavfilter/af_asr.c
libavfilter/af_astats.c
libavfilter/af_asubboost.c
libavfilter/af_asupercut.c
libavfilter/af_atempo.c
libavfilter/af_axcorrelate.c
libavfilter/af_biquads.c
libavfilter/af_bs2b.c
libavfilter/af_channelmap.c
libavfilter/af_channelsplit.c
libavfilter/af_chorus.c
libavfilter/af_compand.c
libavfilter/af_compensationdelay.c
libavfilter/af_crossfeed.c
libavfilter/af_crystalizer.c
libavfilter/af_dcshift.c
libavfilter/af_deesser.c
libavfilter/af_drmeter.c
libavfilter/af_dynaudnorm.c
libavfilter/af_earwax.c
libavfilter/af_extrastereo.c
libavfilter/af_firequalizer.c
libavfilter/af_flanger.c
libavfilter/af_haas.c
libavfilter/af_hdcd.c
libavfilter/af_headphone.c
libavfilter/af_join.c
libavfilter/af_ladspa.c
libavfilter/af_loudnorm.c
libavfilter/af_lv2.c
libavfilter/af_mcompand.c
libavfilter/af_pan.c
libavfilter/af_replaygain.c
libavfilter/af_rubberband.c
libavfilter/af_sidechaincompress.c
libavfilter/af_silencedetect.c
libavfilter/af_silenceremove.c
libavfilter/af_sofalizer.c
libavfilter/af_speechnorm.c
libavfilter/af_stereotools.c
libavfilter/af_stereowiden.c
libavfilter/af_superequalizer.c
libavfilter/af_surround.c
libavfilter/af_tremolo.c
libavfilter/af_vibrato.c
libavfilter/af_volume.c
libavfilter/af_volumedetect.c
libavfilter/asink_anullsink.c
libavfilter/asrc_afirsrc.c
libavfilter/asrc_anoisesrc.c
libavfilter/asrc_anullsrc.c
libavfilter/asrc_flite.c
libavfilter/asrc_hilbert.c
libavfilter/asrc_sinc.c
libavfilter/asrc_sine.c
libavfilter/avf_abitscope.c
libavfilter/avf_ahistogram.c
libavfilter/avf_aphasemeter.c
libavfilter/avf_avectorscope.c
libavfilter/avf_showcqt.c
libavfilter/avf_showfreqs.c
libavfilter/avf_showspatial.c
libavfilter/avf_showspectrum.c
libavfilter/avf_showvolume.c
libavfilter/avf_showwaves.c
libavfilter/avfilter.c
libavfilter/avfilter.h
libavfilter/buffersink.c
libavfilter/buffersrc.c
libavfilter/f_bench.c
libavfilter/f_cue.c
libavfilter/f_drawgraph.c
libavfilter/f_ebur128.c
libavfilter/f_graphmonitor.c
libavfilter/f_interleave.c
libavfilter/f_loop.c
libavfilter/f_metadata.c
libavfilter/f_perms.c
libavfilter/f_realtime.c
libavfilter/f_reverse.c
libavfilter/f_segment.c
libavfilter/f_select.c
libavfilter/f_sendcmd.c
libavfilter/f_sidedata.c
libavfilter/f_zmq.c
libavfilter/fifo.c
libavfilter/internal.h
libavfilter/setpts.c
libavfilter/settb.c
libavfilter/split.c
libavfilter/trim.c
libavfilter/vaf_spectrumsynth.c
libavfilter/vf_addroi.c
libavfilter/vf_alphamerge.c
libavfilter/vf_amplify.c
libavfilter/vf_aspect.c
libavfilter/vf_atadenoise.c
libavfilter/vf_avgblur.c
libavfilter/vf_avgblur_opencl.c
libavfilter/vf_avgblur_vulkan.c
libavfilter/vf_bbox.c
libavfilter/vf_bilateral.c
libavfilter/vf_bitplanenoise.c
libavfilter/vf_blackdetect.c
libavfilter/vf_blackframe.c
libavfilter/vf_blend.c
libavfilter/vf_bm3d.c
libavfilter/vf_boxblur.c
libavfilter/vf_bwdif.c
libavfilter/vf_cas.c
libavfilter/vf_chromaber_vulkan.c
libavfilter/vf_chromakey.c
libavfilter/vf_chromanr.c
libavfilter/vf_chromashift.c
libavfilter/vf_ciescope.c
libavfilter/vf_codecview.c
libavfilter/vf_colorbalance.c
libavfilter/vf_colorchannelmixer.c
libavfilter/vf_colorconstancy.c
libavfilter/vf_colorcontrast.c
libavfilter/vf_colorcorrect.c
libavfilter/vf_colorize.c
libavfilter/vf_colorkey.c
libavfilter/vf_colorkey_opencl.c
libavfilter/vf_colorlevels.c
libavfilter/vf_colormatrix.c
libavfilter/vf_colorspace.c
libavfilter/vf_colortemperature.c
libavfilter/vf_convolution.c
libavfilter/vf_convolution_opencl.c
libavfilter/vf_convolve.c
libavfilter/vf_copy.c
libavfilter/vf_coreimage.m
libavfilter/vf_cover_rect.c
libavfilter/vf_crop.c
libavfilter/vf_cropdetect.c
libavfilter/vf_curves.c
libavfilter/vf_datascope.c
libavfilter/vf_dblur.c
libavfilter/vf_dctdnoiz.c
libavfilter/vf_deband.c
libavfilter/vf_deblock.c
libavfilter/vf_decimate.c
libavfilter/vf_dedot.c
libavfilter/vf_deflicker.c
libavfilter/vf_deinterlace_qsv.c
libavfilter/vf_deinterlace_vaapi.c
libavfilter/vf_dejudder.c
libavfilter/vf_delogo.c
libavfilter/vf_derain.c
libavfilter/vf_deshake.c
libavfilter/vf_deshake_opencl.c
libavfilter/vf_despill.c
libavfilter/vf_detelecine.c
libavfilter/vf_displace.c
libavfilter/vf_dnn_classify.c
libavfilter/vf_dnn_detect.c
libavfilter/vf_dnn_processing.c
libavfilter/vf_drawbox.c
libavfilter/vf_drawtext.c
libavfilter/vf_edgedetect.c
libavfilter/vf_elbg.c
libavfilter/vf_entropy.c
libavfilter/vf_epx.c
libavfilter/vf_eq.c
libavfilter/vf_estdif.c
libavfilter/vf_exposure.c
libavfilter/vf_extractplanes.c
libavfilter/vf_fade.c
libavfilter/vf_fftdnoiz.c
libavfilter/vf_fftfilt.c
libavfilter/vf_field.c
libavfilter/vf_fieldhint.c
libavfilter/vf_fieldmatch.c
libavfilter/vf_fieldorder.c
libavfilter/vf_fillborders.c
libavfilter/vf_find_rect.c
libavfilter/vf_floodfill.c
libavfilter/vf_format.c
libavfilter/vf_fps.c
libavfilter/vf_framepack.c
libavfilter/vf_framerate.c
libavfilter/vf_framestep.c
libavfilter/vf_freezedetect.c
libavfilter/vf_freezeframes.c
libavfilter/vf_frei0r.c
libavfilter/vf_fspp.c
libavfilter/vf_gblur.c
libavfilter/vf_geq.c
libavfilter/vf_gradfun.c
libavfilter/vf_guided.c
libavfilter/vf_hflip.c
libavfilter/vf_histeq.c
libavfilter/vf_histogram.c
libavfilter/vf_hqdn3d.c
libavfilter/vf_hqx.c
libavfilter/vf_hue.c
libavfilter/vf_hwdownload.c
libavfilter/vf_hwmap.c
libavfilter/vf_hwupload.c
libavfilter/vf_hwupload_cuda.c
libavfilter/vf_hysteresis.c
libavfilter/vf_identity.c
libavfilter/vf_idet.c
libavfilter/vf_il.c
libavfilter/vf_kerndeint.c
libavfilter/vf_lagfun.c
libavfilter/vf_lenscorrection.c
libavfilter/vf_lensfun.c
libavfilter/vf_libopencv.c
libavfilter/vf_libvmaf.c
libavfilter/vf_limiter.c
libavfilter/vf_lumakey.c
libavfilter/vf_lut.c
libavfilter/vf_lut2.c
libavfilter/vf_lut3d.c
libavfilter/vf_maskedclamp.c
libavfilter/vf_maskedmerge.c
libavfilter/vf_maskedminmax.c
libavfilter/vf_maskedthreshold.c
libavfilter/vf_maskfun.c
libavfilter/vf_mcdeint.c
libavfilter/vf_median.c
libavfilter/vf_mergeplanes.c
libavfilter/vf_mestimate.c
libavfilter/vf_midequalizer.c
libavfilter/vf_minterpolate.c
libavfilter/vf_misc_vaapi.c
libavfilter/vf_mix.c
libavfilter/vf_monochrome.c
libavfilter/vf_mpdecimate.c
libavfilter/vf_neighbor.c
libavfilter/vf_neighbor_opencl.c
libavfilter/vf_nlmeans.c
libavfilter/vf_nlmeans_opencl.c
libavfilter/vf_nnedi.c
libavfilter/vf_noise.c
libavfilter/vf_normalize.c
libavfilter/vf_null.c
libavfilter/vf_ocr.c
libavfilter/vf_overlay.c
libavfilter/vf_overlay_cuda.c
libavfilter/vf_overlay_opencl.c
libavfilter/vf_overlay_qsv.c
libavfilter/vf_overlay_vulkan.c
libavfilter/vf_owdenoise.c
libavfilter/vf_pad.c
libavfilter/vf_pad_opencl.c
libavfilter/vf_palettegen.c
libavfilter/vf_paletteuse.c
libavfilter/vf_perspective.c
libavfilter/vf_phase.c
libavfilter/vf_photosensitivity.c
libavfilter/vf_pixdesctest.c
libavfilter/vf_pp.c
libavfilter/vf_pp7.c
libavfilter/vf_premultiply.c
libavfilter/vf_procamp_vaapi.c
libavfilter/vf_program_opencl.c
libavfilter/vf_pseudocolor.c
libavfilter/vf_psnr.c
libavfilter/vf_pullup.c
libavfilter/vf_qp.c
libavfilter/vf_random.c
libavfilter/vf_readeia608.c
libavfilter/vf_readvitc.c
libavfilter/vf_remap.c
libavfilter/vf_removegrain.c
libavfilter/vf_removelogo.c
libavfilter/vf_repeatfields.c
libavfilter/vf_rotate.c
libavfilter/vf_sab.c
libavfilter/vf_scale.c
libavfilter/vf_scale_cuda.c
libavfilter/vf_scale_npp.c
libavfilter/vf_scale_qsv.c
libavfilter/vf_scale_vaapi.c
libavfilter/vf_scale_vulkan.c
libavfilter/vf_scdet.c
libavfilter/vf_scroll.c
libavfilter/vf_selectivecolor.c
libavfilter/vf_separatefields.c
libavfilter/vf_setparams.c
libavfilter/vf_shear.c
libavfilter/vf_showinfo.c
libavfilter/vf_showpalette.c
libavfilter/vf_shuffleframes.c
libavfilter/vf_shufflepixels.c
libavfilter/vf_shuffleplanes.c
libavfilter/vf_signalstats.c
libavfilter/vf_signature.c
libavfilter/vf_smartblur.c
libavfilter/vf_spp.c
libavfilter/vf_sr.c
libavfilter/vf_ssim.c
libavfilter/vf_stack.c
libavfilter/vf_stereo3d.c
libavfilter/vf_subtitles.c
libavfilter/vf_super2xsai.c
libavfilter/vf_swaprect.c
libavfilter/vf_swapuv.c
libavfilter/vf_telecine.c
libavfilter/vf_threshold.c
libavfilter/vf_thumbnail.c
libavfilter/vf_thumbnail_cuda.c
libavfilter/vf_tile.c
libavfilter/vf_tinterlace.c
libavfilter/vf_tmidequalizer.c
libavfilter/vf_tonemap.c
libavfilter/vf_tonemap_opencl.c
libavfilter/vf_tonemap_vaapi.c
libavfilter/vf_tpad.c
libavfilter/vf_transpose.c
libavfilter/vf_transpose_npp.c
libavfilter/vf_transpose_opencl.c
libavfilter/vf_transpose_vaapi.c
libavfilter/vf_unsharp.c
libavfilter/vf_unsharp_opencl.c
libavfilter/vf_untile.c
libavfilter/vf_uspp.c
libavfilter/vf_v360.c
libavfilter/vf_vaguedenoiser.c
libavfilter/vf_vectorscope.c
libavfilter/vf_vflip.c
libavfilter/vf_vfrdet.c
libavfilter/vf_vibrance.c
libavfilter/vf_vidstabdetect.c
libavfilter/vf_vidstabtransform.c
libavfilter/vf_vif.c
libavfilter/vf_vignette.c
libavfilter/vf_vmafmotion.c
libavfilter/vf_vpp_qsv.c
libavfilter/vf_w3fdif.c
libavfilter/vf_waveform.c
libavfilter/vf_weave.c
libavfilter/vf_xbr.c
libavfilter/vf_xfade.c
libavfilter/vf_xfade_opencl.c
libavfilter/vf_xmedian.c
libavfilter/vf_yadif.c
libavfilter/vf_yadif_cuda.c
libavfilter/vf_yaepblur.c
libavfilter/vf_zoompan.c
libavfilter/vf_zscale.c
libavfilter/vsink_nullsink.c
libavfilter/vsrc_cellauto.c
libavfilter/vsrc_gradients.c
libavfilter/vsrc_life.c
libavfilter/vsrc_mandelbrot.c
libavfilter/vsrc_mptestsrc.c
libavfilter/vsrc_sierpinski.c
libavfilter/vsrc_testsrc.c