aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/elbg.c
Commit message (Collapse)AuthorAgeFilesLines
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: Remove av_restrictAndreas Rheinhardt2024-03-151-3/+3
| | | | | | | | | All versions of MSVC that support C11 (namely >= v19.27) also support the restrict keyword, therefore av_restrict is no longer necessary since 75697836b1db3e0f0a3b7061be6be28d00c675a0. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: fix integer overflowsPaul B Mahol2023-05-211-20/+36
| | | | Fixes #9977
* avcodec/elbg: Mark ELBGContext as being unaliased by using av_restrictAndreas Rheinhardt2021-09-241-3/+3
| | | | | | | | | | | This improves performance: For msvideo1, the performance improved by 4.8% when encoding the sample from the fate-vsynth1-msvideo1 test; when encoding the sample from fate-vsynth1-cinepak, performance improved by 2%. The compiler user was GCC 10 and the calls to encode2 have been timed. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Add flags to avpriv_elbg_do()Andreas Rheinhardt2021-09-241-1/+1
| | | | | | | | | This is currently unused and it is only added to enable changes while maintaining ABI compatibility. The type is uintptr_t in order to potentially accept a pointer argument. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Also allocate buffers for recursion only onceAndreas Rheinhardt2021-09-231-18/+20
| | | | | | | | | | This is possible because the number of elements needed in each recursion step decreases geometrically, so the geometric series provides an upper bound for the sum of number of elements of the needed buffers. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Keep buffers to avoid allocations and freesAndreas Rheinhardt2021-09-201-30/+54
| | | | | | | | | | | | | | | | | | | Up until now, each call to avpriv_elbg_do() would result in at least six allocations. And this function is called a lot: A typical FATE run results in 52213653 calls to av_malloc; of these, 34974671 originate from av_malloc_array and from these 34783679 originate from avpriv_elbg_do; the msvideo1 encoder tests are behind most of these. This commit changes this by keeping the buffers and only reallocating them when needed. E.g. for the encoding part of fate-vsynth1-msvideo1 total heap usage went down from 11,407,939 allocs and frees with 468,106,207 bytes allocated to 3,149 allocs and frees with 13,181,847 bytes allocated. The time for one encode2-call went down by 69%. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Move arguments to the context early if possibleAndreas Rheinhardt2021-09-201-38/+35
| | | | | | | | | This affects all the arguments that don't change during a call to avpriv_elbg_do(); doing so makes it easily recognizable which arguments change upon recursive calls. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Add persistent ELBGContextAndreas Rheinhardt2021-09-201-1/+11
| | | | | | | | It will be used in future commits to avoid having to allocate and free all the buffers used. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Rename elbg_data to ELBGContextAndreas Rheinhardt2021-09-201-42/+42
| | | | | | | | It is in line with our naming conventions for types. Also change numCB to num_cb for the same reason. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Merge avpriv_init_elbg() into avpriv_do_elbg()Andreas Rheinhardt2021-09-201-4/+25
| | | | | | | | | These functions are always called directly after another with the exact same arguments. This avoids exporting a symbol; it also avoids having to perform two calls for every caller. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Move avpriv_init_elbg() downAndreas Rheinhardt2021-09-201-36/+35
| | | | | | | It will avoid a forward declaration later. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Remove avoidable bufferAndreas Rheinhardt2021-09-171-6/+3
| | | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Increase some fields to 64bitMichael Niedermayer2021-09-151-7/+9
| | | | | | | Fixes: Ticket8312 Fixes: Ticket8321 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Remove/replace some unnecessary avcodec.h inclusionsAndreas Rheinhardt2021-07-221-1/+0
| | | | | | | Also remove other unnecessary headers and include headers directly while at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'Clément Bœsch2016-06-211-2/+2
|\ | | | | | | | | | | | | * commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb': cosmetics: Fix spelling mistakes Merged-by: Clément Bœsch <u@pkh.me>
| * cosmetics: Fix spelling mistakesVittorio Giovara2016-05-041-2/+2
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | Merge commit '7f9f771eac0d37a632e0ed9bd89961d57fcfb7e0'Michael Niedermayer2015-02-141-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '7f9f771eac0d37a632e0ed9bd89961d57fcfb7e0': avcodec: Don't anonymously typedef structs Conflicts: libavcodec/alac.c libavcodec/cinepak.c libavcodec/cscd.c libavcodec/dcadec.c libavcodec/g723_1.c libavcodec/gif.c libavcodec/iff.c libavcodec/kgv1dec.c libavcodec/libopenjpegenc.c libavcodec/libspeexenc.c libavcodec/ra288.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * avcodec: Don't anonymously typedef structsDiego Biurrun2015-02-141-1/+1
| |
* | Merge commit 'ae2d41ec875965ce4ab9fdd88a5e8ba57cada67a'Michael Niedermayer2014-12-191-10/+25
|\| | | | | | | | | | | | | | | | | | | | | * commit 'ae2d41ec875965ce4ab9fdd88a5e8ba57cada67a': elbg: check memory allocations and propagate errors Conflicts: libavcodec/elbg.c libavcodec/elbg.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * elbg: check memory allocations and propagate errorsVittorio Giovara2014-12-181-10/+25
| |
| * elbg: Fix an assertMichael Niedermayer2012-09-041-1/+1
| | | | | | | | | | | | It seems the condition was flipped from what was intended. Signed-off-by: Martin Storsjö <martin@martin.st>
* | avcodec/elbg: Use av_malloc(z)_array()Michael Niedermayer2014-04-121-8/+8
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | elbg: change utility_inc to 64bitMichael Niedermayer2014-03-221-5/+15
| | | | | | | | | | | | | | Fixes integer overflow Fixes Ticket3462 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavc/elbg: rename ff_ symbols to avpriv_, so they can be used in shared libsStefano Sabatini2013-11-131-4/+4
| | | | | | | | | | In particular, allows the use of elbg in other FFmpeg libraries, required by the pending elbg filter.
* | elbg: switch to av_assertMichael Niedermayer2012-08-181-1/+2
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | elbg: fix assertMichael Niedermayer2012-08-181-1/+1
| | | | | | | | | | | | It seems the condition was flipped from what was intended Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-08-161-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: Fix even more missing includes after the common.h removal build: Factor out rangecoder dependencies to CONFIG_RANGECODER build: Factor out error resilience dependencies to CONFIG_ERROR_RESILIENCE x86: avcodec: Consistently name all init files Add more missing includes after removing the implicit common.h Add some more missing includes after removing the implicit common.h Don't include common.h from avutil.h rtmp: Automatically compute the hash for SWFVerification Conflicts: configure doc/APIchanges doc/examples/decoding_encoding.c libavcodec/Makefile libavcodec/assdec.c libavcodec/audio_frame_queue.c libavcodec/avpacket.c libavcodec/dv_profile.c libavcodec/dwt.c libavcodec/libtheoraenc.c libavcodec/rawdec.c libavcodec/rv40dsp.c libavcodec/tiff.c libavcodec/tiffenc.c libavcodec/v210dec.h libavcodec/vc1dsp.c libavcodec/x86/Makefile libavfilter/asrc_anullsrc.c libavfilter/avfilter.c libavfilter/buffer.c libavfilter/formats.c libavfilter/vf_ass.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_select.c libavfilter/video.c libavfilter/vsrc_testsrc.c libavformat/version.h libavutil/audioconvert.c libavutil/error.h libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Don't include common.h from avutil.hMartin Storsjö2012-08-151-0/+1
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
| * Replace FFmpeg with Libav in licence headersMans Rullgard2011-03-191-4/+4
| | | | | | | | Signed-off-by: Mans Rullgard <mans@mansr.com>
* | cosmetics: minor libavcodec spelling errorsLou Logan2012-06-291-1/+1
|/ | | | | | Also update some common misspelled words in patcheck Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Fix misspelled parameter names in Doxygen documentation.Diego Biurrun2010-07-021-1/+1
| | | | | | This fixes one Doxygen warning each. Originally committed as revision 23970 to svn://svn.ffmpeg.org/ffmpeg/trunk
* elbg: remove VLAsMåns Rullgård2010-06-251-15/+23
| | | | Originally committed as revision 23787 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Remove explicit filename from Doxygen @file commands.Diego Biurrun2010-04-201-1/+1
| | | | | | | | Passing an explicit filename to this command is only necessary if the documentation in the @file block refers to a file different from the one the block resides in. Originally committed as revision 22921 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Small ELBG optimization: use last pixel as a initial guess for the codebookVitor Sessak2010-01-021-5/+8
| | | | | | entry. Originally committed as revision 21001 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Fix bug when elbg->utility_inc[elbg->numCB-1] == 1Vitor Sessak2009-03-101-1/+1
| | | | Originally committed as revision 17926 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Use FLG pseudo-random number generator in RoQ and ELBGVitor Sessak2009-03-081-5/+5
| | | | Originally committed as revision 17881 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Use full internal pathname in doxygen @file directives.Diego Biurrun2009-02-011-1/+1
| | | | | | | Otherwise doxygen complains about ambiguous filenames when files exist under the same name in different subdirectories. Originally committed as revision 16912 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Fix filenames in Doxygen comments.Diego Biurrun2009-01-261-1/+1
| | | | Originally committed as revision 16811 to svn://svn.ffmpeg.org/ffmpeg/trunk
* My commit at r14340 was not the right solution. For a monochromaticVitor Sessak2008-07-231-4/+3
| | | | | | | | frame, there will be only one centroid and it will be impossible to find three distinct ones. It is better to just avoid shifting if there are not three different centroids. Originally committed as revision 14343 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Do declaration and initialization separately in elbg.cVitor Sessak2008-07-231-1/+5
| | | | | | to workaround an ICC bug. Originally committed as revision 14342 to svn://svn.ffmpeg.org/ffmpeg/trunk
* When picking a "high utility centroid" do not pick oneVitor Sessak2008-07-231-1/+4
| | | | | | | | that has no corresponding points. Not only it is the worst possible pick, but also the code was written without this case in mind. Originally committed as revision 14341 to svn://svn.ffmpeg.org/ffmpeg/trunk
* The codebook generator algorithm involves picking threeVitor Sessak2008-07-231-1/+3
| | | | | | | | | different codebook centroids ("high utility", "low utility" and "closest to the low utility one"). This change avoid the corner case of choosing two times the same centroid. Originally committed as revision 14340 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Use full path for #includes from another directory.Diego Biurrun2008-05-091-1/+1
| | | | Originally committed as revision 13098 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Add my last name to copyright headersVitor Sessak2007-07-051-1/+1
| | | | Originally committed as revision 9488 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Cygwin compatibility workaroundEric Lasota2007-06-111-4/+5
| | | | | | | | patch by Eric Lasota: [ riot icculus org ] original thread: [FFmpeg-devel] [PATCH] elbg.c Cygwin compatibility workaround date: 06/09/2007 09:26 AM Originally committed as revision 9279 to svn://svn.ffmpeg.org/ffmpeg/trunk
* Codebook generator using the ELBG algorithmVitor Sessak2007-06-041-0/+416
patch by Vitor: printf(vitor%d gmail com, 1001) original thread: Re: [FFmpeg-devel] [PATCH] Add a codebook generator (was: [PATCH] RoQ video encoder, take 2) date: 05/28/2007 01:21 PM Originally committed as revision 9196 to svn://svn.ffmpeg.org/ffmpeg/trunk