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 10th April 2021, 17:53   #1  |  Link
Lariel22
Registered User
 
Join Date: Feb 2011
Posts: 11
colorspace - DVD with odd luma range 16 to ca. 215 - how to correct?

I'm working with a DVD which has even the brightest luma values a bit low. Bright scenes look toned down, like the material is a little underexposed. I used
Code:
ColorYUV(analyze=true).Histogram("levels")
to have a closer look at the numbers. And I tried to fix this issue using
Code:
Levels(0,1,235,0,255,coring = false)
because it looks to me like the the lower luma end is fine, but at the upper end someone seems to have forgotten to open up the range one time. 92% of 255 is 235, and 92% of 235 is 216,6. And it appears the upper range is about 216.

Here are some pictures of bright scenes.

Original frame 533 (this frame seems to be an exception, see my explanation below):


Corrected frame 533:


Original frame 3890:


Corrected frame 3890:


Original frame 4454:


Corrected frame 4454:


Original frame 30368:


Corrected frame 30368:


Frame 533 is a rare exception. After the correction, the upper luma value extends well beyond 235, being 252 max. and 239 loose max. However, if I understand it correctly, the luma range is just a flag and the restricted range from 16 to 235 is used so that there is some overhead. Already the lower luma end does not stop at 16 but can be found at 11, 12 14, etc.

The other bright scenes look alright with this correction, in my opinion. The maximum values are at 230, 231, 232. So still below but close to 235.

Question 1: Is this just some film material with low brightness values deliberately used or am I seeing things correctly and this is a badly mastered DVD that is worthy of correction?

Question 2: Is my way of correcting this the way to go about this or is there some better way to do it?

Quesiton 3: The graphs of the corrected frames show some gaps. Can this be done without such gaps occuring, for example by converting to 16 bit or something like this?

Question 4: Is it okay that the corrected frame 533 has a max. value way beyond 235? Will this be clipped when encoding as MPEG2 and the range set to 16 to 235?

Last edited by Lariel22; 10th April 2021 at 17:58.
Lariel22 is offline   Reply With Quote
Old 11th April 2021, 00:31   #2  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
1) +2) Some of it might be subjective, but you could argue some of those shots like explosion should be "brighter".

3) for gaps - levels(dither=true) , or smoothlevels

4) depends on the mpeg2 encoder. Overshoots are often seen on retail DVD's.

You can adjust per scene too; you don't have to use 1 set of values for everything
poisondeathray is offline   Reply With Quote
Old 11th April 2021, 08:21   #3  |  Link
Arx1meD
Registered User
 
Arx1meD's Avatar
 
Join Date: Feb 2021
Posts: 121
I use OutRange to find the maximum and minimum luma values.
My simplified version of OutRange:
Code:
Function OutRange2(clip c, float "thr", bool "Y", bool "U", bool "V", int "borders", string "filename") {
thr = String(Default(thr, 0.0))
Y   = Default(Y, true)
U   = Default(U, false)
V   = Default(V, false)
br  = Default(borders, 0)
FN  = Default(filename, "OutRange.log")

Assert(Y || U || V, "OutRange: One of channel Y or U or V mast be true")

Yeval = Y ? "ymax=YPlaneMax("+thr+") ymin=YPlaneMin("+thr+")" : """ "" """
Ueval = U ? "umax=UPlaneMax("+thr+") umin=UPlaneMin("+thr+")" : """ "" """
Veval = V ? "vmax=VPlaneMax("+thr+") vmin=VPlaneMin("+thr+")" : """ "" """

wriY = Y ? """ "YMax = " + String(ymax) + "; YMin = " + String(ymin) """ : """ "" """
wriU = U ? """ "UMax = " + String(umax) + "; UMin = " + String(Umin) """ : """ "" """
wriV = V ? """ "VMax = " + String(vmax) + "; VMin = " + String(vmin) """ : """ "" """

expe = Yeval + Chr(10) + Ueval + Chr(10) + Veval

expw = wriY + String(Y && (U || V) ? """ + "; " + """ : """ + "" + """) 
   \ + wriU + String(U && V ? """ + "; " + """ : """ + "" + """)
   \ + wriV

c.Crop(br, br, -br, -br)
FrameEvaluate(expe)
WriteFile(last, FN, "current_frame", """ ": " """, expw)
}
For example:
Code:
LWLibavVideoSource("C:\MV02\VideoFile.mkv")
Import(C:\AVS\OutRange.avsi")
OutRange2(thr=0, Y=true, U=false, V=false, borders=10, filename="OutRange.log")
Run it in AVSMeter to collect frame statistics. The "OutRange.log" file will be created.

To smooth the levels on the graphs use the SmoothLevels filter, this is the easiest way. Or a combination of filters after Levels(...):
Code:
UnDot()
MiniDeen(radiusY=1, radiusUV=1, thrY=10, thrUV=12, y=3, u=3, v=3)
f3kdb(preset="low/nograin", sample_mode=2)

Last edited by Arx1meD; 11th April 2021 at 12:37.
Arx1meD is offline   Reply With Quote
Old 11th April 2021, 08:31   #4  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
@Lariel22: Keep in mind that the level shift may drive the RGB components beyond legal values and clip, even though the YUV (YCbCr) values are still sane.

Last edited by Sharc; 11th April 2021 at 08:41.
Sharc is offline   Reply With Quote
Old 11th April 2021, 13:26   #5  |  Link
Richard1485
Guest
 
Posts: n/a
The original looks fine to me. There's no reason that the luma has to push the edge of the range, even if there is an explosion. But, of course, it's down to user preference.
  Reply With Quote
Old 11th April 2021, 16:26   #6  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
Yep, no idea why you assume it has to be pushed to the edge. Final look was established during grading process. You just create your own version. I don't see anything better there (brighter doesn't mean better).
Overshoots are basically always there when you use lossy compression. Even intermediate codecs like ProRes, DNxHR do it. It's not that big deal (unless you sending it to broadcast).
You could have whole 90 minutes movie with max luma at eg 200. It can happen and no need to "fix it".

Last edited by kolak; 11th April 2021 at 16:34.
kolak is offline   Reply With Quote
Old 13th April 2021, 22:40   #7  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,531
And to add to that, lariel22, Levels made holes in your histogram.
no dither -> unpopulated values -> banding.
If you must stretch you may consider SmoothAdjust, this dithers well.
frame 533 looks already blown out to me after your stretch, well this depends on mapping of the display anyway.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."
Emulgator is offline   Reply With Quote
Old 14th May 2021, 19:16   #8  |  Link
Lariel22
Registered User
 
Join Date: Feb 2011
Posts: 11
Sorry for the late reply and thanks a lot for all your input!

So I guess I will use SmoothLevels. I was pondering why I think that the levels are off. I simply remember them being brighter when seeing this show on TV. I remembered that I also have TV recordings of the show, even from two different countries. Both confirm my assumption. See for yourself. The following is the exact same frame (despite the frame numbers being slightly apart).




The first is from DVD, the second from TV capture. In the first you can hardly guess what the color of the barrel on the right is, while in the second you can clearly see that it is blue.
Lariel22 is offline   Reply With Quote
Old 14th May 2021, 20:31   #9  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,406
I think you are correct, stretching the the range with dithering is probably a good idea. I would be careful to not overdo it though, less is more.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Old 14th May 2021, 20:52   #10  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,769
I would rather keep the TV capture, it certainly has a better resolution (details) however, then, one has to be careful when using screenshots to compare various videos (there is first the 16-235 vs 0-255 issue, then, for US NTSC the issue of pedestal).

The "reds" are washed out in the TV capture, though. Probably a hue issue, easily to be corrected.
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Old 15th May 2021, 08:12   #11  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
It's problematic to make judgements based on a single frame only, but for archiving I would definitely keep the retail (DVD) variant and make any tweaks (brightness, contrast, saturation) during viewing on the PC or TV as you prefer.
The TV version has clipped blues (e.g. the sky), and the black level of the active picture appears to be offset too high. The picture looks washed to me (e.g. the red light on the police car).
The TV variant also tends to producing illegal RGB triplets when decoded to RGB (sky for example), although it's minor for this picture, and it depends on the player how 'smart' these violations will be dealt with for playback.

Edit: The TV variant looks perhaps sharper but it has sharpening artefacts like halos, best seen on vertical edges. I don't see more real details.

Last edited by Sharc; 15th May 2021 at 08:54.
Sharc is offline   Reply With Quote
Old 15th May 2021, 09:44   #12  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,769
Well, try reading the licence plate
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Old 15th May 2021, 09:57   #13  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
So what can you read?
Sharc is offline   Reply With Quote
Reply

Tags
colorspace, luma

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 13:03.


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