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 > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th March 2013, 12:41   #1  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
How do ConvertToRGB* handle out-of-range YUV combinations?

When the input clip to ConvertToRGB*() contains pixels with out-of-range YUV combinations no error is thrown, so presumably they are processed somehow. However, I can't find any explanation in the Convert description of how this done. What exactly happens in such cases?

Thanks,
Francois
fvisagie is offline   Reply With Quote
Old 25th March 2013, 13:34   #2  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: UK
Posts: 1,673
The resulting RGB values are clipped to be within the range 0-255.

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 25th March 2013, 18:57   #3  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
Thanks, appreciated.
fvisagie is offline   Reply With Quote
Old 25th March 2013, 20:47   #4  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
See the thread U and V ranges for valid RGB for a demonstration, and post #14 of the thread (and the later post #25) for a function that will identify the out-of-range pixels in a frame.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 26th March 2013, 09:15   #5  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
Thanks, Gavino, that's a very useful function and thread.
fvisagie is offline   Reply With Quote
Old 26th March 2013, 09:47   #6  |  Link
fvisagie
Registered User
 
Join Date: Aug 2008
Location: Isle of Man
Posts: 588
In the case where
  1. Input is in out-of-RGB-gamut YUV
  2. Intermediate conversion to and from RGB32 is needed, and
  3. Output is in YUV

a useful approach seems to be

Code:
# Reduce number of pixels that will be clipped by RGB conversion
Levels(...)
ConvertToRGB(...)
# RGB32 work
ConvertToYV12(...)
# Back in YUV complete rest of colour treatment to what's desired for aesthetics and what output can handle:
#   restore colour range and/or correct gamma and/or adjust dynamic range etc.
This will require balancing reduced clipping against loss of colour resolution, but in principle this may be worth trying out, correct? I'm asking because I don't always know enough yet to understand what I'm looking at .
fvisagie is offline   Reply With Quote
Reply

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 02:23.


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