Parallel filtering of multiple frames

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
Mitch074
Posts: 4
Joined: Sat Jan 06, 2018 1:09 am

Parallel filtering of multiple frames

Post by Mitch074 »

Hello,
I've noticed, when using filters like deblock and/or the denoiser, that one core is pegged at 100% use while the 3 other cores have a 50-80% use. Until now, what I've done to mitigate this sub-par CPU use it to launch a couple encodes in parallel.
I guess most (if not all) image filters are single threaded and only process images in sequence, but I wonder if there would be a way to parallel/thread the image processing pass. This would allow better CPU use, especially now that quad cores are going from "mainstream" to "entry level" - encoding a file on a Ryzen 5 or 7 with image processing enabled would be a waste.
Any thought?
mduell
Veteran User
Posts: 8197
Joined: Sat Apr 21, 2007 8:54 pm

Re: Parallel filtering of multiple frames

Post by mduell »

Sure, merely a matter of algorithm and software development.

Some filters are multi-threaded. Some decoders are too.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5722
Joined: Sat Feb 09, 2008 7:21 pm

Re: Parallel filtering of multiple frames

Post by JohnAStebbins »

Code: Select all

I guess most (if not all) image filters are single threaded
Several HandBrake filters are in fact multi-threaded. nlmeans, lapsharp, unsharp, grayscale, decomb, combdetect are all multi-threaded. Detelecine, hqdn3d, deblock, cropscale, rotate, deinterlace, pad are single threaded. Some of the single threaded filters could be made multi-threaded.

It's really just a matter of finding a developer that is interested in doing so. I don't have much interested in fixing either deblock or hqdn3d denoise myself. I don't use either of them. nlmeans is a better denoiser, so I use that when I need a denoiser. deblock should only be used on sources that were badly encoded and have blocky edges. I never use such poor quality sources. Similar argument for deinterlace, decomb is better. cropscale, rotate and pad are fast enough that they don't need to be threaded. Detelecine is the only filter I occasionally use that would benefit from threading.
Mitch074
Posts: 4
Joined: Sat Jan 06, 2018 1:09 am

Re: Parallel filtering of multiple frames

Post by Mitch074 »

Thanks for the details - I'll change the filters I use to the multithreaded ones.
Mitch074
Posts: 4
Joined: Sat Jan 06, 2018 1:09 am

Re: Parallel filtering of multiple frames

Post by Mitch074 »

Ok, so I tried using NLMeans instead of deblock, and using decomb. And now I remember why I prefer using deblock: on sources that are only slightly noisy (like animation from a DVD), even single-threaded decomb is MUCH faster than NLMean on 4 cores.
I'll take for example my latest DVD backup (x264, animation preset, high profile, level 4.2, RF20) :
- unfiltered : 110 fps (all CPUs around 98%)
- using decomb/default and deblock/5: 46 fps (1 CPU@100%, all 3 others@50%)
- using decomb/default and NLMeans/Light/Animation : 11 fps (all CPUs around 98%)
That's... a bit much when all I want is cleaning up some MPEG-2 artifacts and noise.
Post Reply