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

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 15th September 2018, 12:18   #4261  |  Link
Richard1485
Guest
 
Posts: n/a
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.
 
Old 15th September 2018, 12:20   #4262  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
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  
Old 15th September 2018, 12:27   #4263  |  Link
Richard1485
Guest
 
Posts: n/a
Yeah, I tried that. The resulting histogram still looks like the second one that I posted above.
 
Old 15th September 2018, 13:50   #4264  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
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 wonkey_monkey; 15th September 2018 at 13:55.
wonkey_monkey is offline  
Old 15th September 2018, 14:05   #4265  |  Link
Richard1485
Guest
 
Posts: n/a
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.
 
Old 29th September 2018, 23:29   #4266  |  Link
StvG
Registered User
 
Join Date: Jul 2018
Posts: 447
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  
Old 16th October 2018, 12:45   #4267  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
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 wonkey_monkey; 16th October 2018 at 13:09.
wonkey_monkey is offline  
Old 18th October 2018, 08:57   #4268  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
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  
Old 18th October 2018, 10:22   #4269  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
Okay. Such a facility would be nice if you ever happen to be near that code again
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline  
Old 24th October 2018, 01:57   #4270  |  Link
Richard1485
Guest
 
Posts: n/a
I've experienced for the second time the same problem that I raised in post#4261. If I switch from the x64 version of ffms2 to the x86 one, it goes away. This must have been why the issue suddenly seemed to clear up (for which, see post#4265): both times, I switched versions (for unrelated reasons). I just didn't put two and two together. Does anyone experience this issue or is it just me?
 
Old 24th October 2018, 03:09   #4271  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by Richard1485 View Post
I've experienced for the second time the same problem that I raised in post#4261. If I switch from the x64 version of ffms2 to the x86 one, it goes away. This must have been why the issue suddenly seemed to clear up (for which, see post#4265): both times, I switched versions (for unrelated reasons). I just didn't put two and two together. Does anyone experience this issue or is it just me?
I can reproduce this.

Either ffms2 or lsmash as your earlier post

avsresize to convert bits instead of convertbits also same result

I don't have avs+ 86 installed , so I can't check that or x86 source filters . But if it "goes away" with ffms2 x86, then it suggests avisynth+ x86 histogram is not affected

vpy x64 version of histogram not affected


EDIT: I just rechecked some things and I can NOT reproduce it anymore! I have no idea what is going on but I'm sure I saw it earlier

Last edited by poisondeathray; 24th October 2018 at 03:35.
poisondeathray is offline  
Old 24th October 2018, 15:10   #4272  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by Richard1485 View Post
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.
If my assumption is right, the problem depends on special timing conditions so it's not 100% reproducible, and is inside Avisynth.
https://github.com/pinterf/AviSynthP...gram.cpp#L1600
The brigtness lookup table may not always be initialized fully by the time it is used in another thread. I could reproduce such effect by inserting an artificial sleep
std::this_thread::sleep_for(std::chrono::milliseconds(1));
inside the for-loop of lookup (here: variable exptab) generation.

Looking at the code of the Classic histogram I noticed another problem. Since there is only a single predefined lookup table, it will be calculated for whatever bit-depth is found first.
When classic histogram appears e.g. twice for different bit-depth they won’t work properly for both instance. Just check it:
Code:
...some 8-bit clip here...
x8 = last
x16 = last.ConvertBits(16)
StackVertical(x16.Histogram().ConvertBits(8),x8.Histogram())
I'll check both problems.
pinterf is offline  
Old 27th October 2018, 16:27   #4273  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Hi P, hows bout an Avisynth_+_Pinterf thread, about time you had thread control.

Just point one last post pointing at new thread (with request for no new posts unless directed at Ultim original branch).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 27th October 2018 at 20:17.
StainlessS is offline  
Old 28th October 2018, 16:03   #4274  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,542
Strange internal filter error here.

Any hint? Latest AVS+ installed.
__________________
@turment on Telegram
tormento is offline  
Old 28th October 2018, 16:09   #4275  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
The expression "latest" is insufficient. Please tell us the exact version (e.g. via AVSMeter).

The latest release of AviSynth+ MT by pinterf is r2728-MT (20180702).
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid

Last edited by LigH; 28th October 2018 at 16:12.
LigH is offline  
Old 28th October 2018, 16:17   #4276  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,542
Quote:
Originally Posted by LigH View Post
The expression "latest" is insufficient.
I use the latest release version. The one you quoted, x64 flavor.
__________________
@turment on Telegram
tormento is offline  
Old 28th October 2018, 16:55   #4277  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by tormento View Post
I use the latest release version. The one you quoted, x64 flavor.
Run "avsmeter64 avsinfo" and check if that throws any error(s).
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline  
Old 28th October 2018, 17:18   #4278  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,542
Quote:
Originally Posted by Groucho2004 View Post
Run "avsmeter64 avsinfo" and check if that throws any error(s).
AFAIK no error:
Code:
AVSMeter 2.8.6 (x64) - Copyright (c) 2012-2018, Groucho2004

VersionString:              AviSynth+ 0.1 (r2728, MT, x86_64)
VersionNumber:              2.60
File / Product version:     0.1.0.0 / 0.1.0.0
Interface Version:          5
Multi-threading support:    Yes
Avisynth.dll location:      C:\WINDOWS\SYSTEM32\avisynth.dll
Avisynth.dll time stamp:    2018-07-02, 12:54:16 (UTC)
PluginDir2_5 (HKLM, x64):   D:\Programmi\Media\AviSynth+\plugins64
PluginDir+   (HKLM, x64):   D:\Programmi\Media\AviSynth+\plugins64+


[CPP 2.6 Plugins (64 Bit)]
D:\Programmi\Media\AviSynth+\plugins64+\FFT3dFilter-2.5-pinterf.dll  [2.5.0.0]
D:\Programmi\Media\AviSynth+\plugins64+\GamMac-1.10.dll  [1.10.0.0]
D:\Programmi\Media\AviSynth+\plugins64+\KNLMeansCL-1.1.1.dll  [2018-01-29]
D:\Programmi\Media\AviSynth+\plugins64+\MaskTools-2.2.18-pinterf.dll  [2.2.18.0]
D:\Programmi\Media\AviSynth+\plugins64+\MVTools-2.7.32-pinterf.dll  [2.7.32.0]
D:\Programmi\Media\AviSynth+\plugins64+\RgTools-0.97-pinterf.dll  [0.97.0.0]
D:\Programmi\Media\AviSynth+\plugins64+\ZLlib-r1d-Savage.dll  [2018-03-22]

[Scripts (AVSI)]
D:\Programmi\Media\AviSynth+\plugins64\CompTest.avsi  [2010-09-05]
D:\Programmi\Media\AviSynth+\plugins64\SMDegrain-3.1.2·100.avsi  [2018-07-11]
D:\Programmi\Media\AviSynth+\plugins64\TemporalDegrain-2.1.1-ErazorTT.avsi  [2018-10-27]

[Uncategorized DLLs (64 Bit)]
D:\Programmi\Media\AviSynth+\plugins64+\libfftw3f-3.dll  [2018-10-24]

[Uncategorized files]
D:\Programmi\Media\AviSynth+\plugins64+\AviSynth-new.css  [2016-03-31]
D:\Programmi\Media\AviSynth+\plugins64+\AviSynth.css  [2016-03-31]
D:\Programmi\Media\AviSynth+\plugins64+\FFT3dFilter-2.5-pinterf.htm  [2018-07-06]
D:\Programmi\Media\AviSynth+\plugins64+\FFT3dFilter-2.5-pinterf.md  [2018-07-02]
D:\Programmi\Media\AviSynth+\plugins64+\FFT3dFilter.gif  [2005-04-04]
D:\Programmi\Media\AviSynth+\plugins64+\GamMac-1.10.txt  [2018-06-15]
D:\Programmi\Media\AviSynth+\plugins64+\KNLMeansCL-1.1.1.htm  [2018-03-10]
D:\Programmi\Media\AviSynth+\plugins64+\MaskTools-2.0a48.htm  [2010-12-31]
D:\Programmi\Media\AviSynth+\plugins64+\MaskTools-2.2.18-pinterf.md  [2018-09-05]
D:\Programmi\Media\AviSynth+\plugins64+\MVTools-2.7.32-pinterf.htm  [2018-10-18]
D:\Programmi\Media\AviSynth+\plugins64+\MVTools-2.7.32-pinterf.md  [2018-10-18]
D:\Programmi\Media\AviSynth+\plugins64+\RgTools-0.97-pinterf.md  [2018-07-02]
D:\Programmi\Media\AviSynth+\plugins64+\ZLib-r1d-Savage.md  [2016-10-30]
D:\Programmi\Media\AviSynth+\plugins64\AviSynth-new.css  [2016-03-31]
D:\Programmi\Media\AviSynth+\plugins64\AviSynth.css  [2016-03-31]
D:\Programmi\Media\AviSynth+\plugins64\SMDegrain-3.1.2d.htm  [2015-07-21]
D:\Programmi\Media\AviSynth+\plugins64\Stab-256.1.01-videoFred.7z  [2018-09-04]
__________________
@turment on Telegram
tormento is offline  
Old 28th October 2018, 17:54   #4279  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
No help here but get rid of all the uncategorised files from plugs, they are all not needed there, ie rubbish.

No sure if ok to have libbfft3d-3.dll where it is (think some plugs were altered to also scan same dir as plugin).
(I would probably put mine in system32, although if using both 32 and 64 bit together, then I think things change,
not sure, have to check that out when I go that way)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline  
Old 28th October 2018, 18:33   #4280  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by tormento View Post
AFAIK no error
Weird. Run the script with avsmeter64.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline  
Closed Thread

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 17:55.


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