Multithreading support
I couldn't find any info about the state of multithreading in this library. Can you please explain more?
Hi) Multi-threading is supported, but slightly reduces quality. You need to compile test application with -DH264E_MAX_THREADS=n (where n=max number of threads) and use -threads command line switch:
$ ./h264enc_x64 ↑
Usage:
h264e_test [options] <input[frame_size].yuv> <output.264>
Frame size can be: WxH sqcif qvga svga 4vga sxga xga vga qcif 4cif
4sif cif sif pal ntsc d1 16cif 16sif 720p 4SVGA 4XGA 16VGA 16VGA
Options:
-gen - generate input instead of passing <input.yuv>
-qop<n> - key frame period >= 0
-qp<n> - set QP [10..51]
-kbps<n> - set bitrate (fps=30 assumed)
-maxframes<n> - encode no more than given number of frames
-threads<n> - use <n> threads for encode
-speed<n> - speed [0..10], 0 means best quality
-denoise - use temporal noise supression
-stats - print frame statistics
-psnr - print psnr statistics
For example:
./scripts/build_x86.sh
./h264enc_x64 -threads4 vectors/foreman.cif
Thanks! I am curious though as how multi-threading would reduce quality...
Quality reduction happen because of image split on n (number of threads) independent parts.
so are you slicing one frame between multiple parts? Or each frame on one thread?
Yes, slices are used. Here where per thread start\end macro-block params calculated https://github.com/lieff/minih264/blob/master/minih264e.h#L11323 .