aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegenc_huffman.c
Commit message (Collapse)AuthorAgeFilesLines
* all: fix typos found by codespellTimo Rothenpieler7 days1-2/+2
|
* avcodec/mjpegenc_huffman: Avoid AV_QSORT to sort entries by lengthAndreas Rheinhardt2025-04-181-45/+19
| | | | | | | | | | | | | | | | | | | | It is unnecessary, as we already have the entries sorted by probability and therefore implicitly by length. All we need on top of that to build the tree is the number of entries of a given length. Doing so gives a 3.6% speedup of ff_mjpeg_encode_huffman_close() here; it also saves about 640B of .text here. The new code puts values with higher probability to the left of the tree. The old code did not and therefore the FATE checksums needed to be updated. Due to MJPEG's 0xFF unescaping file sizes as well as file checksums needed to be updated; the decoded picture hashes stayed the same. Given that codes on the left of the tree have on average fewer bits set than codes on the right, the file sizes mostly improve (all except vsynth3-mjpeg-444). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avocdec/mjpegenc_huffman: Avoid redundant loopAndreas Rheinhardt2025-04-091-14/+10
| | | | | | There is no point in iterating over the list twice. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc_huffman: Make ff_mjpegenc_huffman_compute_bits() staticAndreas Rheinhardt2025-04-091-2/+29
| | | | | | Only used here and in a test tool. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary libavutil/(avutil|common|internal).h inclusionsAndreas Rheinhardt2022-02-241-3/+0
| | | | | | | | | | Some of these were made possible by moving several common macros to libavutil/macros.h. While just at it, also improve the other headers a bit. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mjpegenc_huffman: Assert length in ff_mjpegenc_huffman_compute_bits()Michael Niedermayer2017-04-101-0/+2
| | | | | | This should help coverity see that the issues this leads to cannot occur Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mjpegenc: Simplify by moving assert into ff_mjpeg_encode_huffman_close()Michael Niedermayer2017-02-101-8/+4
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/mjpegenc_huffman: remove unneeded header includeMichael Niedermayer2017-02-101-1/+0
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Implement optimal huffman encoding for (M)JPEG.Jerry Jiang2017-02-081-0/+195
> seems to break > make fate-vsynth1-mjpeg-444 Fixed.