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 26th April 2011, 06:08   #161  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
@Yup,

Looks like ConvertToYV12() is broken with Y8 input. You will have to go from YV24 direct to YV12 and wear the performance hit with this alpha release.

A possible faster solution might be
Code:
FastishY8toYV12(Clip C) {
  UV = Blankclip(C, Width=C.Width()/2, Height=C.Height()/2, Color=$808080)
  Return YtoUV(UV, UV, C)
}
And Join Date: Feb 2003, Posts: 549, and you still can't report error messages as text. Hint: Press Control-C in VirtualDubs Error Messagebox, this copies the error text to the clipboard.

@Gavino,

Yes, I think most of these bugs have been addressed, and I am crawling towards doing another interim release, this time it might actually be somewhat tested.
IanB is offline   Reply With Quote
Old 27th April 2011, 14:55   #162  |  Link
pbristow
Registered User
 
pbristow's Avatar
 
Join Date: Jun 2009
Location: UK
Posts: 263
IanB,

No feature requests or bug reports from me at this time, just wanted to say thankyou for all the effort you're putting into this new V2.6. I'm looking forward to trying out the next official build.
pbristow is offline   Reply With Quote
Old 27th April 2011, 21:03   #163  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
@yup,

I moved several 'nnedi3 resize' posts to a new thread.
Wilbert is offline   Reply With Quote
Old 17th May 2011, 03:00   #164  |  Link
pwnsweet
Registered User
 
Join Date: Nov 2008
Posts: 100
I think I may have found a bug with Avisynth 2.5.8, MeGUI or something else, but I think it's with AviSynth. Before I can confirm it is a bug, it would be appreciated it someone can replicate my workflow to confirm that they have the same problem.

I'm using MeGUI 2008 (svn) to encode my movies. Basically I'm having a problem where the color displayed in the avs script creator window is never the same as the source, but the resultant encoded video is. I experienced this issue when indexing an .m2ts Blu-ray file (with an MPEG-2 video stream) using DGindex. When the .d2v is loaded into avs script creator, I've got the option to enable or disable color correction in the filters tab. Setting this option to on or off changes the colors slightly in the preview window (most noticeably with greens and reds) but neither setting produces the same colors as the source. Interestingly though, the colors of the actual encoded video had the same colors as the source when color correction was turned off.

Now, I'm not sure if this is a bug in AviSynth or a bug with me (ie, I'm not comparing them properly). So here's how I compare.

I open the source with Daum PotPlayer and then I open the preview window in avs script creator and compare them side by side with and without color correction. The result is neither setting produces the same colors as the source. When I'm comparing the encoded video to the source, I open the encoded mp4 in one PotPlayer window and the source in another and compare them side by side. The result is the encoded video only has the same color as the source when color correction is off. That's it.

Can someone please replicate this issue to see if they have the same problem? For reference, my source was Mission Imposssible 3 on Blu-ray. Alternatively, if there is a flaw in the way I compare, please point it out and explain why it's flawed so I can further my understanding (I'm noob). My script with color correction set to off is displayed below:

# Set DAR in encoder to 65 : 27. The following line is for automatic signalling
global MeGUI_darx = 65
global MeGUI_dary = 27
LoadPlugin("D:\stuff\megui\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("D:\Temp\MI3\00003.d2v")
#deinterlace
crop( 0, 130, 0, -132)

Spline36Resize(1504,640) # Spline36 (Neutral)
#denoise

Last edited by pwnsweet; 17th May 2011 at 03:04.
pwnsweet is offline   Reply With Quote
Old 17th May 2011, 03:05   #165  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by pwnsweet View Post
I think I may have found a bug with Avisynth 2.5.8. Before I can confirm it is a bug, it would be appreciated it someone can replicate my workflow to confirm that they have the same problem.

I'm using MeGUI 2008 (svn) to encode my movies. Basically I'm having a problem where the color displayed in the avs script creator window is never the same as the source, but the resultant encoded video is. I experienced this issue when indexing an .m2ts Blu-ray file (with an MPEG-2 video stream) using DGindex. When the .d2v is loaded into avs script creator, I've got the option to enable or disable color correction in the filters tab. Setting this option to on or off changes the colors slightly in the preview window (most noticeably with greens and reds) but neither setting produces the same colors as the source. Interestingly though, the colors of the actual encoded video had the same colors as the source when color correction was turned off.

Now, I'm not sure if this is a bug in AviSynth or a bug with me (ie, I'm not comparing them properly). So here's how I compare.

I open the source with Daum PotPlayer and then I open the preview window in avs script creator and compare them side by side with and without color correction. The result is neither setting produces the same colors as the source. When I'm comparing the encoded video to the source, I open the encoded mp4 in one PotPlayer window and the source in another and compare them side by side. The result is the encoded video only has the same color as the source when color correction is off. That's it.

Can someone please replicate this issue to see if they have the same problem? For reference, my source was Mission Imposssible 3 on Blu-ray. Alternatively, if there is a flaw in the way I compare, please point it out and explain why it's flawed so I can further my understanding (I'm noob). My script with color correction set to off is displayed below:

# Set DAR in encoder to 65 : 27. The following line is for automatic signalling
global MeGUI_darx = 65
global MeGUI_dary = 27
LoadPlugin("D:\stuff\megui\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("D:\Temp\MI3\00003.d2v")
#deinterlace
crop( 0, 130, 0, -132)

Spline36Resize(1504,640) # Spline36 (Neutral)
#denoise


probably a playback issue

the preview in megui uses rec601 to convert to rgb for display

your player is probably using rec709 for hd material

levels are untouched and you remain in YUV when you encode with that script using megui

ie. no additional RGB<=>YUV conversions are going on here , only when it's converted to RGB for display



To test this out, add converttorgb(matrix="rec709") to the end of your script, what does the preview look like in megui ? Comment it out (#)before you encode
poisondeathray is offline   Reply With Quote
Old 17th May 2011, 09:25   #166  |  Link
pbristow
Registered User
 
pbristow's Avatar
 
Join Date: Jun 2009
Location: UK
Posts: 263
So, when you open both the source and the encoded video using *the same player* (PotPlayer), they have the same colours (provided you set colour correction to off). But if you open them in different players (one in PotPlayer, one in MeGui), they look different. Clearly then, the two players are disagreeing with each other about how the colours should be rendered on screen.

poisondeathray's explanation for that is probably correct... Or it could be a bug in either MeGui or PotPlayer. Nothing points to AviSynth as causing the problem.

Hope that helps.
pbristow is offline   Reply With Quote
Old 26th May 2011, 11:09   #167  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
An interim patch release.

Get AviSynth_110525.exe (4.9MiB) from SourceForge.

Note, it's now a full release with the documentation component.
IanB is offline   Reply With Quote
Old 26th May 2011, 16:27   #168  |  Link
Mini-Me
Registered User
 
Join Date: Jan 2011
Posts: 121
Quote:
Originally Posted by IanB View Post
An interim patch release.

Get AviSynth_110525.exe (4.9MiB) from SourceForge.

Note, it's now a full release with the documentation component.
YAYYYY!!! It's funny, because I've been having some crashes this week with complex ScriptClip stuff, and I've been checking here for the past three days hoping for a new 2.6 release. I felt silly expecting it to be posted so imminently, but lo and behold!

I can't wait for the time to check it out. Thank you!

Last edited by Mini-Me; 26th May 2011 at 16:32.
Mini-Me is offline   Reply With Quote
Old 26th May 2011, 22:06   #169  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Thanks for the new release!

If I read the code correctly (and your adjusted documentation) i see that an YV12 clip (when converting to YV12 itself) is processed when ChromaInPlacement or ChromaOutPlacement is specified, right? (So this can be used to change the chroma placement in an YV12 clip.) I guess when both are specified and equal, the original clip can also be returned?

Code:
  if (clip->GetVideoInfo().IsYV12()) {
    if (!args[3].Defined() && !args[5].Defined()) || (args[3] == args[5])
      return clip;
  }
Wilbert is offline   Reply With Quote
Old 26th May 2011, 22:54   #170  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Quote:
Originally Posted by Wilbert View Post
If I read the code correctly (and your adjusted documentation) i see that an YV12 clip (when converting to YV12 itself) is processed when ChromaInPlacement or ChromaOutPlacement is specified, right? (So this can be used to change the chroma placement in an YV12 clip.) I guess when both are specified and equal, the original clip can also be returned?
Code:
AVSValue ... ConvertToPlanarGeneric::CreateYV12(...) {
...
  if (clip->GetVideoInfo().IsYV12()) {
    if (!args[3].Defined() && !args[5].Defined()) || (args[3] == args[5])
      return clip;
  }
...
Yes it can be used to change the chroma placement in an YV12 clip.

And yes the code probably should check for ChromaInPlacement == ChromaOutPlacement, it currently relies on the resizer core to detect a null operation however the frame will still be plane split and reassembled so cost a needless set of blits.
IanB is offline   Reply With Quote
Old 27th May 2011, 05:35   #171  |  Link
Mini-Me
Registered User
 
Join Date: Jan 2011
Posts: 121
The new release has unfortunately not solved my crashes, so a question occurred to me: What's the best way to debug a crash in Avisynth?

I'm currently using a script that should take about 8 hours to complete. It previously crashed in places like a quarter to a third of the way through, and it just crashed at over 80% complete instead with Alpha3 (an improvement ). If I load the script through Virtualdub for rendering, I get "Dub/IO-Video error: (Unknown) (80004005)," and if I render the script to .avi through AvsPMod, it just suddenly skips to "Done" as if it finished (but the file isn't complete). Is there another way to run Avisynth that will give me more information about what's causing the crash?

Thanks for both your advice and your hard work!
Mini-Me is offline   Reply With Quote
Old 27th May 2011, 07:13   #172  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
And yes the code probably should check for ChromaInPlacement == ChromaOutPlacement, it currently relies on the resizer core to detect a null operation however the frame will still be plane split and reassembled so cost a needless set of blits.
Ok, i see what you mean. Second attempt:

Code:
AVSValue __cdecl ConvertToYV12::Create(AVSValue args, void*, IScriptEnvironment* env)
{
  PClip clip = args[0].AsClip();
  const VideoInfo& vi = clip->GetVideoInfo();

  if (vi.IsYV12()) {
    if (!args[3].Defined() && !args[5].Defined()) || (args[3] == args[5])
      return clip;
  }

  if (vi.IsYUY2() && !args[3].Defined() && !args[4].Defined() && !args[5].Defined())  // User has not requested options, do it fast!
    return new ConvertToYV12(clip,args[1].AsBool(false),env);

  return ConvertToPlanarGeneric::CreateYV12(args,0,env);
}

@Mini-Me,
Quote:
The new release has unfortunately not solved my crashes, so a question occurred to me: What's the best way to debug a crash in Avisynth?
Could you simplify your script as much as possible (retaining the crash) and post it?

Last edited by Wilbert; 27th May 2011 at 07:34.
Wilbert is offline   Reply With Quote
Old 27th May 2011, 10:21   #173  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Thanks for all your work on the new release, Ian.

Quote:
Originally Posted by Wilbert View Post
Code:
  if (vi.IsYV12()) {
    if (!args[3].Defined() && !args[5].Defined()) || (args[3] == args[5])
      return clip;
  }
You've got a misplaced bracket there.
I think you mean
Code:
    if ((!args[3].Defined() && !args[5].Defined()) || (args[3] == args[5]))
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 27th May 2011, 15:42   #174  |  Link
pbristow
Registered User
 
pbristow's Avatar
 
Join Date: Jun 2009
Location: UK
Posts: 263
Where can I find an up-to-date list (preferably with definitions, not just the abbreviations) of the colourspaces that are support by this release? I've found various posts that talk about what colourspaces are/were intended for Avisynth 2.6 and for 3.0, but I'm getting a confused picture of what's been implemented so far.

I know 2.6 has the YV16 (Like YV12 but the chroma is only halved in one dimension) and YV24 (chroma is full resolution) variants. What else? Do we have ways of storing 12 bit or 16 bit luma yet (plus the core filters to work with it, of course)?
I've been shying away from trying the development/alpha versions, but if 2.6.0.2 has the colourspaces I want to work in then I'll take the plunge!
pbristow is offline   Reply With Quote
Old 27th May 2011, 17:07   #175  |  Link
Mini-Me
Registered User
 
Join Date: Jan 2011
Posts: 121
Quote:
Originally Posted by Wilbert View Post
@Mini-Me,

Could you simplify your script as much as possible (retaining the crash) and post it?
I can post it, but simplifying it while retaining the crashes would probably be quite difficult. It calls a function that uses [G]ScriptClip recursion, and along with all of its helper functions, it's over 350 lines long. (A lot of the lines are comments, but taking those out before posting would probably be unwise.) The crashes seem to have a direct relationship with the complexity and amount of work done. I could strip out some features (effectiveness ) and robustness and bring it down to the core algorithm, and it might still crash, but it would probably take a lot longer and require a clip the length of The Ten Commandments movie (and it already takes hours of peaceful and effective operation before it suddenly fails). Would you still be interested in seeing it as-is?

I have another script that crashes in the same way, but it's just as long and probably more complex. Some months ago, I was getting crashes with simpler and non-recursive (but more numerous) [local] [G]ScriptClip functions, but the total combined length of the functions was similar.

Last edited by Mini-Me; 27th May 2011 at 17:13.
Mini-Me is offline   Reply With Quote
Old 27th May 2011, 17:10   #176  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
Where can I find an up-to-date list (preferably with definitions, not just the abbreviations) of the colourspaces that are support by this release?
See http://avisynth.org/mediawiki/ConvertToRGB or http://avisynth.org/mediawiki/Filter_SDK/Data_storage .

Quote:
Do we have ways of storing 12 bit or 16 bit luma yet (plus the core filters to work with it, of course)?
Nope to both questions.

@Gavino, yes thanks. I probably looked at vba too long where you don't need all those brackets.
Wilbert is offline   Reply With Quote
Old 27th May 2011, 22:26   #177  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
@Gavino,

I merged a post of you (thread consisting of one post) in this thread: http://forum.doom9.org/showthread.ph...89#post1394689 . Is that issue still relevant?
Quote:
For some time, I have been puzzled (and mildly annoyed!) that using a run-time function like AverageLuma outside of a run-time filter (ScriptClip, etc) produces the error "Invalid arguments to function ...", especially when the source code contains logic to produce the more helpful "This filter can only be used within ConditionalFilter". So I decided to investigate properly.

The reason the more helpful (and presumably intended) message is not produced is that the code (in AveragePlane::AvgPlane and elsewhere) looks like this:
Code:
  AVSValue cn = env->GetVar("current_frame");
  if (!cn.IsInt())
    env->ThrowError("Average Plane: This filter can only be used within ConditionalFilter");
However, if current_frame does not exist (the usual case outside the run-time environment), GetVar will throw a NotFound exception and the error-checking code will never be reached. The exception is propagated back to the parser, which is evaluating the original call to AverageLuma (etc), where it sees this as an inability to call and reports it as "Invalid arguments".

The solution is to use the exception-protected GetVar from conditional_reader.h instead of env->GetVar to read current_frame (in 4 places in conditional_functions.c). At the same time, the error message could be changed to refer to "run-time filters" instead of specifically to ConditionalFilter (which I suspect was the only one that existed when this code was written).
Wilbert is offline   Reply With Quote
Old 27th May 2011, 22:59   #178  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by Wilbert View Post
@Gavino,

I merged a post of you (thread consisting of one post) in this thread: http://forum.doom9.org/showthread.ph...89#post1394689 . Is that issue still relevant?
It's fixed now (by IanB in revision 1.10 of conditional_functions.cpp).
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 28th May 2011, 01:00   #179  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
In general the construct (args[3] == args[5]) never expresses a useful intent. In most cases you should be comparing the contents of the AVSValue, i.e. (args[3].AsInt() == args[5].AsInt()).

In the case here to get Wilberts intent and avoid the redundant blits it would be :-
Code:
... (getPlacement(Arg[3].AsString(0)) == getPlacement(Arg[5].AsString(0)))


@Mini-Me,

You need to post your script so we can get some idea what your issue might be. As this is a long standing problem that spans multiple version you probably should start a new thread to discuss this problem in detail. A first initial guess given things fall out of the sky without an Avisymth exception report of some sort is you are exhausting the process address space. Reporting an error does need some free memory. Monitor the process virtual memory size, if it is growing and over 1.5GB then that is a very strong indicator.


@pbristow,

At the script level there is currently YV24, YV16, YV12 and YV411 as YUV tri-planar formats.

The core is currently capable of handling any planar format with 1, 2, or 4 times subsampling independently in horizontal and vertical directions, you just can't script it yet.

Last edited by IanB; 28th May 2011 at 01:19. Reason: with -> without
IanB is offline   Reply With Quote
Old 28th May 2011, 13:58   #180  |  Link
pbristow
Registered User
 
pbristow's Avatar
 
Join Date: Jun 2009
Location: UK
Posts: 263
Thanks, Wilbert and Ian. In other words, "we're getting there, be patient", eh?

[EDIT:] Ah, hang on... To clarify, Ian, do you mean the core can now handle any planar format *in any (likely) bit depth*? Or is it restricted to 8-bit components? (Colour subsampling doesn't worry me so much, as I find YV12 adequate for almost everything on that score - Although it's good to know that other options are available when required.)

Last edited by pbristow; 28th May 2011 at 14:04.
pbristow 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 15:13.


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