Repository navigation
Add libjpeg-turbo for preview image size reduction on disk. - #2696
Conversation
|
Is this patch, that Google and Mozilla are using, also important for HandBrake? |
|
I assume you've not committed the libhb code yet? |
Judging by the Blink repo commit message, it seems to mostly affect packetized data input. I'm guessing it won't be an issue for local use. Curious why the patch is thought unlikely to be accepted upstream.
Just got the libs linking and building succeeding. CMake wasn't picking up the arch automatically so fixed that. Haven't yet started any implementation. |
|
LGTM! |
6cf7fcb to
3be2dd4
Compare
|
Wired up. Works great using MacGUI. 30 previews, cropped 4K source (single title): original 296.1 MB, compressed 24.5 MB. I initially created Also note that every preview image save/load creates a new compressor/decompressor context, which seems inconsequential in my limited testing. |
Implementation in HandBrake#2696 only requires the former.
|
Blu-ray source with 71 usable titles, 10 previews per title (default): original 2 GB, compressed 150 MB. 😸 Update: I did not Valgrind this; however, watching macOS Activity Monitor while scanning a ~230 title Blu-ray source showed HandBrake maintaining 95 MB (+7/-3) memory usage. Over 2300 previews totaling more than 5 GB compressed to 377 MB. 🎉 |
|
Looks like this built on Ubuntu, but I have not yet tested there. I'll need to figure out the additional package dependencies for all distros we document at some point. |
|
Over 60 previews, it's approx 1~2 seconds slower on an NVME SSD where storage isn't the bottleneck. I suspect spinning rust might gain an advantage due to the large writes. 878MB -> 51MB Think it's a good compromise. |
Same for macOS Finder. I debated adding the file extension as people might want to obfuscate certain source previews, but decided it's probably fine. |
|
I'm sure there will be 1 user who takes issue with it. Especially since there is the occasional risk the files won't be cleared up until a system cleanup runs. |
|
Package |
Implementation in HandBrake#2696 only requires the former.
c91329c to
cf32474
Compare
|
Improved a few things in the last commit. Should be ready to rock, though I'd wait until our CI is on Focal so TurboJPEG API v2 is available. |
In what folder are they getting saved on macOS? |
|
Thanks, found it in /private/var/folders/qh/gtfyt26d59nff_mf4033r7rc0000gn/T/fr.handbrake.HandBrake/hb.15496 Even for insane 100 preview pictures of a 4k movie I just get 66.8 MB 😀👍🏻 And it seems a little bit faster then before. |
|
Note also, macOS has |
I was also curious, so I've asked:
|
Implementation in HandBrake#2696 only requires the former.
Also silences a warning about nested pointer type qualifiers.
1b9e050 to
94533fa
Compare

Update: Wired up and functional (#2696 (comment)).
As the title states, we may wish to use this
for experimentation, specifically with improving on-disk cache sizes for preview images as storage resolutions increase. Speed will likely also improve due to reducing storage/retrieval times, offloading part of the workload to the CPU which is usually not under high load during scan.API Documentation.
libjpeg.a|soexposes the original libjpeg API whilelibturbojpeg.a|soexposes the TurboJPEG API, which is simpler albeit less powerful.Both are linked. If all platforms decide on the same API, we can exclude the other lib. There's no major pressure to do so as each should be under 1 MB.This would seem to affect libhb only and I implemented compression/decompression using the TurboJPEG API.On Fedora, please install the
turbojpeg-develpackage. Notlibturbojpeg-devel, which is probably installed already, but does not providelibturbojpeg.so.I have not yet tested on other distros or architectures other than x86_64. I hope I properly ensured
module.defsis compatible with other architectures, including aarch64.This builds and statically links on macOS/mingw-w64. My mingw-w64 cross build was from macOS.
Quoting my previous comments on #2574:
Test on:
Smoke tested building and launching the GUI on each platform.