bylee20 / bomi

bomi - a powerful and easy-to-use multimedia player
http://bomi-player.github.io
Other
426 stars 89 forks source link

Sharpen and blur filters are unbelievably slow with chroma upsamplers #52

Closed ValdikSS closed 9 years ago

ValdikSS commented 10 years ago

When used with any chroma upscaler except bicubic, enabling sharpen or blur filters makes video from video to slideshow with 1-3 fps, making video almost unplayable.

How to reproduce:

  1. Open video file
  2. Set chroma upscaler to everything except bicubic (i,e, Fast Lanczos)
  3. Enable sharpen or blur filter

Expected result: Video is sharpened or blurred without much dropped frames

Actual result: Video is sharpened or blurred, but >80% frames are dropped

bylee20 commented 10 years ago

Well, please just don't do that. Chroma upscaling requires lots of texture fetching (16 ~ 64 times) and for YCbCr format, because there are two chroma components, it'll be doubled. blur/sharp filter requires 9 times and when you enabled chroma upscaling, they are multiplied. So, At least you need 16_2_9=288 fetching for just one pixel and there's no hardware which can handle in realtime.

In fact, chroma upscaling is useless in many cases. Can you recognize any difference with chroma upscaler? Fundamentally, human eyes are good at recognizing luminance differene but poor at telling chroma. That's why chroma are suppressed but luminance is preserved when encoding a video. That's just an option for videophiles, and I'm seriously considering drop the feature for maintanance burden.

Anyway, as long as you can set such combination, there should be some notification or documentations. Maybe some wiki page working shoud be done from now.

ValdikSS commented 10 years ago

Can you recognize any difference with chroma upscaler? Fundamentally, human eyes are good at recognizing luminance differene but poor at telling chroma.

Well, yes, that's true. I can't tell any difference, but in theory there is a difference. I suppose, you can see the difference on a formats like 4:1:1 (which is not really common).

I'm seriously considering drop the feature for maintanance burden.

Hmm. Maybe it would be better to make bicubic upscaling factor configurable, and drop other algorithms?

bylee20 commented 10 years ago

From the point of quantity of color informations, 4:1:1 sampling is the same as 4:2:0 sampling. Both of them store one value of each Cb/Cr for 4 pixels. Their difference is how the data are stored(interleaving or separated planes for Y/Cb/Cr) and 4:2:0 is very very common format (I can say it's defacto standard). So, even 411 format won't show any difference for normal people.

Since chroma upscaling and video interpolation share same codes, there's no burden to implement all of them. The maintance burden comes from that inserting chroma upscaling algorithm makes the shader code dirty and hard to recognize and debug.

bylee20 commented 9 years ago

Sharpen and blur effects are dropped now. So I close this. But still, highquality of chroma upscailing requires lots of operations and it could cause massive frame drop.