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 29th August 2019, 08:55   #4861  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 782
Another bug?

ConditionalReader:

Code:
TYPE string
DEFAULT this_is_the_default

1 test
2 string
5 
8 testing
This throws an error that it doesn't understand line 6 (the one with frame 5). Note that there's just one space after 5. The space is there to separate the frame number from the value. In this case I want the value to be an empty string.
Note that setting the default string to empty *does* in fact work (with just the one space after "DEFAULT"), but the exact same thing *does not* work for the individual frames.

edit:
This example script goes with the above "test.txt" text file, for testing purposes:
Code:
ColorBars
Trim(0,500)
ScriptClip("Subtitle(String(myvar))")
ConditionalReader("test.txt", "myvar", false)

Last edited by ajp_anton; 29th August 2019 at 08:58.
ajp_anton is offline   Reply With Quote
Old 29th August 2019, 09:13   #4862  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Quote:
Originally Posted by ajp_anton View Post
ConvertBits(8,dither=1)
doesn't seem to work for 8-bit sources.
You can dither from 16bits to 16bits so why not from 8bits to 8bits?
Because I didn't have additional weeks to implement it like it works for 10-16 bit sources (where you can specify dither_bits)
pinterf is offline   Reply With Quote
Old 29th August 2019, 09:47   #4863  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Quote:
Originally Posted by ajp_anton View Post
Another bug?

ConditionalReader:

Code:
TYPE string
DEFAULT this_is_the_default

1 test
2 string
5 
8 testing
This throws an error that it doesn't understand line 6 (the one with frame 5). Note that there's just one space after 5. The space is there to separate the frame number from the value. In this case I want the value to be an empty string.
Note that setting the default string to empty *does* in fact work (with just the one space after "DEFAULT"), but the exact same thing *does not* work for the individual frames.
Good catch, fixed.
pinterf is offline   Reply With Quote
Old 29th August 2019, 13:50   #4864  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Test build again, files only.
Avisynth+ r2915
Changes since last r2900 test in July (for all changes since r2772 see readmes):
Code:
- Changed: Trim, FreezeFrame, DeleteFrame, DuplicateFrame, Reverse and Loop are using frame cache again (similar to classic Avs 2.6)
- Enhanced: Expr: faster exp, log, pow for AVX2 (sekrit-twc)
- ConditionalReader: allow empty value in text file when TYPE string
- Fix: Expr: fix non-mod-8 issues for forced RGB output and YUV inputs
- New: AviSource support v308 and v408 format (packed 8 bit 444 and 4444)
- Fix: AviSource v410 source garbage (YUV444P10)
- Fix: Expr: when using parameter "scale_inputs" and the source bit depth conversion occured, predefined constants
  (ymin/max, cmin/max, range_min/max/half) would not follow the new bit depth
pinterf is offline   Reply With Quote
Old 29th August 2019, 14:21   #4865  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,253
OOOoooh lovely
__________________
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   Reply With Quote
Old 29th August 2019, 14:49   #4866  |  Link
VoodooFX
Registered User
 
Join Date: Sep 2008
Posts: 78
Thank you. Now trims/loops are fast.

Code:
2s   - AVS Standard 2.6
61s  - AVS+ r2772
2s   - AVS+ r2915
VoodooFX is offline   Reply With Quote
Old 31st August 2019, 23:48   #4867  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,634
After confirming speed issues when using FFVideoSource or LWLibavVideoSource under AVS+ 32-bit in MT mode:
https://forum.doom9.org/showthread.p...64#post1883664
I just want to know if it is feasible to add some kind of workaround to AVS+ to ensure linear frame requests to these source filters.


Cheers
manolito
manolito is offline   Reply With Quote
Old 8th September 2019, 23:20   #4868  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,982
More evidence of the ConvertToXX (chromaresample="point") bug with shifting chroma, as pointed out in post 4287

avsresize does not exhibit the bug (nor does vapoursynth)

https://forum.doom9.org/showthread.p...51#post1884351
poisondeathray is offline   Reply With Quote
Old 9th September 2019, 13:28   #4869  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Quote:
Originally Posted by poisondeathray View Post
More evidence of the ConvertToXX (chromaresample="point") bug with shifting chroma, as pointed out in post 4287

avsresize does not exhibit the bug (nor does vapoursynth)

https://forum.doom9.org/showthread.p...51#post1884351
Is classic Avisynth 2.6 affected as well?
pinterf is offline   Reply With Quote
Old 9th September 2019, 13:28   #4870  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Quote:
Originally Posted by manolito View Post
After confirming speed issues when using FFVideoSource or LWLibavVideoSource under AVS+ 32-bit in MT mode:
https://forum.doom9.org/showthread.p...64#post1883664
I just want to know if it is feasible to add some kind of workaround to AVS+ to ensure linear frame requests to these source filters.
Unfortunately not.
pinterf is offline   Reply With Quote
Old 9th September 2019, 15:07   #4871  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,982
Quote:
Originally Posted by pinterf View Post
Is classic Avisynth 2.6 affected as well?
Yes

I forgot that Gavino explained this a long time ago

https://forum.doom9.org/showthread.p...15#post1571315
poisondeathray is offline   Reply With Quote
Old 9th September 2019, 18:39   #4872  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,839
I just made this image to compare chroma resampling in converttoXXX:

https://i.imgur.com/xxQu7KV.png

It shows the result of repeat conversions between YV12 and RGB24. Does it indicate a problem with "sinc"?

If nothing else, it shows a downward shift which none of the others (except "point", for reasons already discussed) exhibits.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 9th September 2019 at 18:42.
wonkey_monkey is offline   Reply With Quote
Old 9th September 2019, 20:56   #4873  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,982
Quote:
Originally Posted by wonkey_monkey View Post
I just made this image to compare chroma resampling in converttoXXX:

https://i.imgur.com/xxQu7KV.png

It shows the result of repeat conversions between YV12 and RGB24. Does it indicate a problem with "sinc"?

If nothing else, it shows a downward shift which none of the others (except "point", for reasons already discussed) exhibits.
Yes the ConvertToXX "sinc" implementation has issues too . Looks to be more than just down direction. Also occurs with avs classic

avsresize shows expected result with sinc

https://i.postimg.cc/kg7MjBk4/sinc.png
poisondeathray is offline   Reply With Quote
Old 9th September 2019, 23:38   #4874  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,253
Just curious, what is the purpose of
Code:
Null "c[copy]s"      # Function Null(clip c,String "Copy")
Is it some temp debug thing for test version avs+ r2915

Code:
colorbars(pixel_type="YV12")
#NULL("YV24")
NULL()
info
Quote:
Error reading source frame 0: Avisynth read error: bug found
EDIT: Also, I found a script from some time ago, (about june/july)
Code:
Colorbars
x=GetPlaneWidthSubSampling
return last
Dont know if it was implemented back then or whether or not I was just testing for the function existing, but it aint supported in r2915,
perhaps that is part reason I gave up s_ExLogo modding, is pretty fundamental function and easily added, can next issue of avs+ have it (GetPlaneWidthSubSampling) and
also GetPlaneHeigthSubSampling too please.
I can use RT_ColorSpaceXMod(clip) and RT_ColorSpaceYMod(clip,Laced) but not for avs+ colorspaces. https://forum.doom9.org/showthread.p...02#post1864802

EDIT: Below maybe handy for Wiki/Docs (where ColorSpaceXMod and ColorSpaceYMod cropping granularity of colorspace due to U and V)
where ColorSpaceYMod would be as BitLShift(1,Last.GetPlaneHeightSubSampling) OR Last.RT_ColorSpaceYMod() in Avs Std.
Code:
H=5                                            # Test height
CS="YV24"
ColorSpaceYMod = 1                             # ColorSpaceYMod = 1 : Can crop vertically in multiples of 1 for YV24 : ColorSpaceYMod = BitLShift(1,Last.GetPlaneHeightSubSampling)
                                               # ColorSpaceYMod = 1 : if eg Y8, GetPlaneHeightSubSampling() would produce error if no chroma.
Colorbars(Pixel_type=CS)
O=Last
crop(0,0,0,H*ColorSpaceYMod)

# MINIMUM CROPPED INPUT SIZE PER RESIZER
# Resizer Name                                 # Minimum (cropped) input size that succeeds (eg ColorSpaceYMod=2 for YV12, 1 for YV24 : ColorSpaceXMod for horizontal same sort of thing for width)
#PointResize(O.Width,O.Height)                 # 1*ColorSpaceYMod
#BilinearResize(O.Width,O.Height)              # 2*ColorSpaceYMod
#BiCubicResize(O.Width,O.Height)               # 3*ColorSpaceYMod
#Spline16Resize(O.Width,O.Height)              # 3*ColorSpaceYMod
#Spline36Resize(O.Width,O.Height)              # 4*ColorSpaceYMod
#Spline64Resize(O.Width,O.Height)              # 5*ColorSpaceYMod
#GaussResize(O.Width,O.Height,p=30.0)          # 5*ColorSpaceYMod
#Lanczos4Resize(O.Width,O.Height)              # 5*ColorSpaceYMod (taps=4)
#LanczosResize(O.Width,O.Height,taps=3)        # (taps+1)*ColorSpaceYMod
#BlackmanResize(O.Width,O.Height,taps=4)       # (taps+1)*ColorSpaceYMod
#SincResize(O.Width,O.Height,taps=4)           # (taps+1)*ColorSpaceYMod

# Uncomment one of above

return Info
EDIT: Maybe ColorSpaceXMod/YMod would actually be more useful [than GetPlane-Height/Width-SubSampling], and avoid special cases [in script] where no chroma or RGB.
__________________
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; 10th September 2019 at 03:36.
StainlessS is offline   Reply With Quote
Old 10th September 2019, 09:57   #4875  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Quote:
Originally Posted by StainlessS View Post
Just curious, what is the purpose of
Code:
Null "c[copy]s"      # Function Null(clip c,String "Copy")
Is it some temp debug thing for test version avs+ r2915
I was not aware of such function, it probably served debug purposes from the beginnings.
pinterf is offline   Reply With Quote
Old 10th September 2019, 10:34   #4876  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 1,256
Quote:
Originally Posted by poisondeathray View Post
Yes the ConvertToXX "sinc" implementation has issues too . Looks to be more than just down direction. Also occurs with avs classic

avsresize shows expected result with sinc

https://i.postimg.cc/kg7MjBk4/sinc.png
In Avsresize sinc is a (legacy) lanczos with taps=4.
While "sinc" in Avisynth+ has different core from Lanczos.

Which can be a bug or not.

Lanczos and Sinc are different in avisynth+ because
"sinc" does not have the extra calculation of sinc(value) * sinc(value/taps) like Lanczos has.

avs+ Lanczos:
Code:
double LanczosFilter::sinc(double value) {
  if (value > 0.000001) {
    value *= M_PI;
    return sin(value) / value;
  } else {
    return 1.0;
  }
}

double LanczosFilter::f(double value) {
   value = fabs(value);

  if (value < taps) {
    return (sinc(value) * sinc(value / taps));
  } else {
    return 0.0;
  }
}
avs+ sinc filter
Code:
/***********************
 *** Sinc filter ***
 ***********************/
double SincFilter::f(double value) {
   value = fabs(value);

  if (value > 0.000001) {
    value *= M_PI;
    return sin(value)/value;
  } else {
    return 1.0;
  }
}
pinterf is offline   Reply With Quote
Old 10th September 2019, 13:44   #4877  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,253
Quote:
Originally Posted by pinterf View Post
I was not aware of such function, it probably served debug purposes from the beginnings.
Dang!, you are correct.
Also present in v2.58, seen the function lists for v2.58, v2.60,
v2.61, avs+ many times and never noticed it before.
EDIT: Ideal for April Fool jokes, make AVS+/Plugin coders think they have serious bug in avs+ or plugs.
__________________
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; 10th September 2019 at 14:31.
StainlessS is offline   Reply With Quote
Old 11th September 2019, 08:31   #4878  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 5,956
I believe a Null() transform filter is useful for the ternary conditional statement (if ? then : else) when one alternative is not supposed to change the clip. But there was also a NOP statement, IIRC?
__________________

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

Last edited by LigH; 11th September 2019 at 08:33.
LigH is offline   Reply With Quote
Old 11th September 2019, 11:04   #4879  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,253
Null() not useful to replace NOP.

Null(clip c, string "Copy"="none"), is not intended to be used from script.
from v2.60 std source, debug.h
Code:
class Null : public GenericVideoFilter 
/**
  * Class for debugging Avisynth internals.
 **/
As it is in avs v2.60 std source, seems to always produce error
debug.cpp
Code:
/*******************************
 *******   Null Filter   *******
 *******  for debugging  *******
 ******************************/

Null::Null(PClip _child, const char * _copy, IScriptEnvironment* env)
  : GenericVideoFilter(_child), copy(_copy)
{
}

Null::~Null()
{
}


PVideoFrame __stdcall Null::GetFrame(int n, IScriptEnvironment* env)
{
  PVideoFrame src = child->GetFrame(n, env);

  BYTE * foo = new BYTE[256];
  BYTE * bar = new BYTE[256];
  MemDebug md;

  md.randomFill(foo, 8, 8, 8);
  env->BitBlt(bar, 8, foo, 8, 8, 8);

  md.reset();
  int i = md.randomCheck(bar, 9, 8, 8);                                        // ssS: Looks like always forces error (9 instead of 8)

  if (i)
    env->ThrowError("bug found");                                              // ssS: OUR SHOWN ERROR "Error reading source frame 0: Avisynth read error: bug found"

  delete [] foo;
  delete [] bar;

  if (!lstrcmpi(copy, "makewritable"))
  {
    env->MakeWritable(&src);
    return src;
  }

  // TODO: no support for planar formats!
  if (!lstrcmpi(copy, "memcopy"))
  {
    PVideoFrame dst = env->NewVideoFrame(child->GetVideoInfo(), 16);
    if (dst->IsWritable() == false)
      env->ThrowError("new frame not writable"); // honestly don't know whether to expect this condition

    memcpy( dst->GetWritePtr(), src->GetReadPtr(), src->GetPitch() * src->GetHeight() );
    return dst;
  }

  if (!lstrcmpi(copy, "bitblt"))
  {
    PVideoFrame dst = env->NewVideoFrame(child->GetVideoInfo(), 16);
    if (dst->IsWritable() == false)
      env->ThrowError("new frame not writable"); // honestly don't know whether to expect this condition

    env->BitBlt( dst->GetWritePtr(), src->GetPitch(), src->GetReadPtr(), src->GetPitch(),
            src->GetRowSize(), src->GetHeight() );
    return dst;
  }

  //if (!lstrcmpi(copy, "none"))
    // do nothing
  return src;
}

AVSValue __cdecl Null::Create(AVSValue args, void*, IScriptEnvironment* env)
{
  return new Null(args[0].AsClip(), args[1].AsString("none"), env);
}
Cant say that I understand whats happening there, seems a bit weird.
EDIT: Dont know where this bit is coming from "Error reading source frame 0: Avisynth read error".

EDIT: Although this dont throw error (As no GetFrame called, only Null() constructor called)
Code:
# this just returns the info whatsit, no error thrown
colorbars(pixel_type="YV12")
O=Last

Last.Null(Copy="What the hell ! ")   # always do the Null thingy

return O.Info
EDIT: Maybe that particular code is intended to be "hacked as required", and above is just how it was left after last use.
__________________
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; 11th September 2019 at 11:41.
StainlessS is offline   Reply With Quote
Old 16th September 2019, 18:19   #4880  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,839
I'm writing a C++ program which creates an IScriptEnvironment2 for the purposes of displaying clips. It also lets the user modify the filter chain by changing conversion matrix, interlacing settings, bobbing, etc. If I invoke a filter, is there any way to absolutely forbid the environment from ever caching frames from that filter? And would this/could this propagate to downstream filters, so that every single request for an output frame (even if it was the same frame that had just been requested) would go back up the chain to the uncached filter?
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey 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 01:16.


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