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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th September 2018, 12:18   #4261  |  Link
Richard1485
Registered User
 
Join Date: Feb 2010
Posts: 221
When converting from 10bit to 8bit with the following script...

Code:
LWLibavVideoSource("bla.mkv", stacked=true, format="YUV420P10")
ConvertFromStacked(bits=10)
ConvertBits(bits=8, dither=0)
... the luma range goes from looking like this...



to looking like this...



Have I overlooked something? When previewing in VirtualDub2, the video doesn't look obviously wrong, but I've never seen a histogram look like that unless there's a problem of some kind.

Last edited by Richard1485; 15th September 2018 at 12:25.
Richard1485 is offline   Reply With Quote
Old 15th September 2018, 12:20   #4262  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 5,645
what happens when us use: dither = -1 ?
Quote:
int dither = -1
If -1 (default), do not add dither;
If 0, add ordered dither;
If 1, add error diffusion (Floyd-Steinberg) dither doom9
Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 15th September 2018, 12:27   #4263  |  Link
Richard1485
Registered User
 
Join Date: Feb 2010
Posts: 221
Yeah, I tried that. The resulting histogram still looks like the second one that I posted above.
Richard1485 is offline   Reply With Quote
Old 15th September 2018, 13:50   #4264  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,508
At what point in the script did you call histogram to get the first image?

It looks to me like histogram has got its levels mixed up. The graph is ostensibly the same, but there are parts where it looks like the values being plotted have overflowed - the same pattern of pixels is seen as in the "correct" image but in dark grey instead of light grey.

In fact that is exactly how it looks - if you darken the image to 0-128, then add 128 to the "blacked-out" areas, it seems to take on the correct range when comparing it to the "correct" image.

So it's like a 9-bit graph output truncated to 8-bits.
__________________
My AviSynth filters / I'm the Doctor

Last edited by davidhorman; 15th September 2018 at 13:55.
davidhorman is offline   Reply With Quote
Old 15th September 2018, 14:05   #4265  |  Link
Richard1485
Registered User
 
Join Date: Feb 2010
Posts: 221
I called Histogram() when returning the video. But the first one looks fine to me. It's the second one that looks messed up.

EDIT: It's working now. I'm not sure what went wrong, but there you go.

Last edited by Richard1485; 26th September 2018 at 12:53.
Richard1485 is offline   Reply With Quote
Old 29th September 2018, 23:29   #4266  |  Link
StvG
Registered User
 
Join Date: Jul 2018
Posts: 17
ConvertBits(8) gives a big difference compared to z_ConvertFormat(pixel_type="YV12") and DitherPost(mode=-1). Is that an expected behavior?

Code:
ImageSource()
Interleave(ShowRed("y8"), ShowGreen("y8"), ShowBlue("y8")).Dither_convert_8_to_16()
Dither_convert_rgb_to_yuv (
\ SelectEvery (3, 0), SelectEvery (3, 1), SelectEvery (3, 2),
\ matrix="709", noring=true, output="YV12", tv_range=true, chromak="spline36",
\ lsb=false, mode=6)
z_ConvertFormat(width/2,height/2,pixel_type="yuv420p16", resample_filter="spline36")
s=last
ConvertToStacked()
DitherPost(mode=-1)
a=last
s
z_ConvertFormat(pixel_type="yv12")
Compare(a, channels="yuv")

Code:
ImageSource()
Interleave(ShowRed("y8"), ShowGreen("y8"), ShowBlue("y8")).Dither_convert_8_to_16()
Dither_convert_rgb_to_yuv (
\ SelectEvery (3, 0), SelectEvery (3, 1), SelectEvery (3, 2),
\ matrix="709", noring=true, output="YV12", tv_range=true, chromak="spline36",
\ lsb=false, mode=6)
z_ConvertFormat(width/2,height/2,pixel_type="yuv420p16", resample_filter="spline36")
s=last
ConvertToStacked()
DitherPost(mode=-1)
a=last
s
ConvertBits(8)
Compare(a, channels="yuv")

Code:
ImageSource()
Interleave(ShowRed("y8"), ShowGreen("y8"), ShowBlue("y8")).Dither_convert_8_to_16()
Dither_convert_rgb_to_yuv (
\ SelectEvery (3, 0), SelectEvery (3, 1), SelectEvery (3, 2),
\ matrix="709", noring=true, output="YV12", tv_range=true, chromak="spline36",
\ lsb=false, mode=6)
z_ConvertFormat(width/2,height/2,pixel_type="yuv420p16", resample_filter="spline36")
s=last
ConvertBits(8)
a=last
s
z_ConvertFormat(pixel_type="yv12")
Compare(a, channels="yuv")

Image source.
StvG is offline   Reply With Quote
Old 16th October 2018, 12:45   #4267  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,508
Is there any way to get a debug output of the compiled code generated when using expr()?
__________________
My AviSynth filters / I'm the Doctor

Last edited by davidhorman; 16th October 2018 at 13:09.
davidhorman is offline   Reply With Quote
Old 18th October 2018, 08:57   #4268  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 996
Quote:
Originally Posted by davidhorman View Post
Is there any way to get a debug output of the compiled code generated when using expr()?
No, I put a breakpoint at the entry of calling the compiled code and then changed to assembler view.
pinterf is offline   Reply With Quote
Old 18th October 2018, 10:22   #4269  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,508
Okay. Such a facility would be nice if you ever happen to be near that code again
__________________
My AviSynth filters / I'm the Doctor
davidhorman 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 05:12.


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