Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th March 2013, 00:51   #1  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
Current guide to x264 "--vf" downscaling modes

I'm playing around with the internal x264 scaling modes from libswscale. I'm having a devil of a time finding useful documentation about them. The most definitive I've found is this one, but the actual research was done in 2008!

http://forum.doom9.org/showthread.php?t=160593

The default of bicubic is good for moderate downscaling almost everywhere. But I'm trying to figure out what's the most neutral one for big ratios (like 1920x1080 to 352x192); that's >5x. And with 4K sources starting to be used, we'll have >10x ratios for some scenarios. For this kind of stuff, even bicubic has historically had trouble with the fine details of rolling credits and that sort of thing. Heck, and optimal scaling algorithm has as many taps as the source frame has pixels that overlap with the region that the output pixel comes from, so that'd be 25+ even in the 1080p -> 192p case.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 16th March 2013, 01:02   #2  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
I don't think there is a "best" one, because they all have their pros and cons.

But a nice comparison of various resize kernels (not all available in libswscale) can be fond here, for example:
http://svn.int64.org/viewvc/int64/re...c/kernels.html
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 16th March 2013, 01:29   #3  |  Link
xooyoozoo
Registered User
 
Join Date: Dec 2012
Posts: 197
From what I remember, resizing that drastically means that it's best to use multiple steps of 0.5 reductions each time using gaussian and bilinear. As gaussian blurs more than bilinear but iterative bilinear adds distortions, I think people generally save bilinear for the last step.

Note that the above at least applies to reduction work in image editing. I've no idea if libswscale will perform similarly.
xooyoozoo is offline   Reply With Quote
Old 16th March 2013, 03:37   #4  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,392
Quote:
Originally Posted by benwaggoner
Heck, an optimal scaling algorithm has as many taps as the source frame has pixels that overlap with the region that the output pixel comes from, so that'd be 25+ even in the 1080p -> 192p case.
Are there any scaling algorithms that don't do that? Other than nearest neighbor.

Quote:
Originally Posted by xooyoozoo
multiple steps of 0.5 reductions each time using gaussian and bilinear
Why would you do that, rather than composing all of those steps into a single FIR filter? Same ideal result, less intermediate rounding, less cache thrashing.
akupenguin is offline   Reply With Quote
Old 16th March 2013, 03:47   #5  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
Quote:
Originally Posted by LoRd_MuldeR View Post
I don't think there is a "best" one, because they all have their pros and cons.
Indeed. I really want a very neutral one. Fine details like text should come out legible without aliasing and without the letter shapes changing significantly frame-to-frame.

Beyond that, I don't want extra hard-to-compress detail like ringing. And I want it to be reasonably sharp, without problematic blurring or sharpening.

Quote:
But a nice comparison of various resize kernels (not all available in libswscale) can be fond here, for example:
http://svn.int64.org/viewvc/int64/re...c/kernels.html
This is good! Of the ones in libswscale, Gauss looks to be the best. Oddly, though bilinear is shown as the most neutral of all, which doesn't match my experience.

It'd be nice if they'd say which parameters were being used in bicubic, lanczos, etcetera.

Time for more testing!
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 16th March 2013, 04:24   #6  |  Link
xooyoozoo
Registered User
 
Join Date: Dec 2012
Posts: 197
Quote:
Originally Posted by akupenguin View Post
Why would you do that, rather than composing all of those steps into a single FIR filter? Same ideal result, less intermediate rounding, less cache thrashing.
That process is meant to be more of a way to deal with many image programs's limited set of sizing options rather than an efficient or even optimal approach. I thought it might apply here, as the OP seem to want to stick with swscale's current selection of scalers.

In any case, ImageMagick has a thorough page detailing its plethora of scaling algorithms and their relative sharpness and potential artifacts. Only some apply to swscale, but the resource could be useful. The author visits this forum too.
xooyoozoo is offline   Reply With Quote
Old 16th March 2013, 04:31   #7  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by xooyoozoo View Post
That process is meant to be more of a way to deal with many image programs's limited set of sizing options rather than an efficient or even optimal approach. I thought it might apply here, as the OP seem to want to stick with swscale's current selection of scalers.
But, like akupenguin said, swscale's scalers already do that. Splitting the downscaling into multiple steps would just make things worse.
Dark Shikari is offline   Reply With Quote
Reply

Tags
downscaling, libswscale, scaling

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:14.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.