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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th August 2020, 23:21   #181  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,378
Thanks to you both! I'm gonna try it out and see whether it does what it's supposed to do with my source which definitely would have benefited from an hardware time base correction (but the tape is on another site 500 km away and it's not exactly the time to... uh... travel... you know...).
FranceBB is offline   Reply With Quote
Old 15th August 2020, 20:16   #182  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,676
Quote:
Originally Posted by StainlessS View Post
EDIT: Maybe Reel.Deel has any missing plugins.
Those are all of jmac's plugins. He also lost the source code to all of them .
Reel.Deel is offline   Reply With Quote
Old 15th August 2020, 20:29   #183  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,406
Yep, Sendspace only keeps them for 30 days after latest download. [ what a silly billy ]

RD, did you update this on Wiki: http://avisynth.nl/index.php/Filter_SDK/Env_SaveString

Thats a pretty awful example of env->SaveString() use, eg
Code:
Filter SDK/Env SaveString

env->SaveString is given to allow users to pass strings to AVSValue, and ensure that they are being deallocated on unload.

An Example: 
     fnpluginnew = new char[string_len];
     
     strcpy(fnpluginnew, fnplugin.AsString());
     strcat(fnpluginnew, " ");
     strcat(fnpluginnew, name);
     
     env->SetGlobalVar("$PluginFunctions$", AVSValue(env->SaveString(fnpluginnew, string_len)));
     
     // Since fnpluginnew has now been saved it can safely be deleted.
     
     delete[] fnpluginnew;
What newbie is gonna know what "$PluginFunctions$" is, and if thats not bad enough, looks like it will squash your current plugin functions list to me.

I think previous example was taken from one of my posts in dev forum, way better [but I'm probably biased a bit].
I'll find it if you want.

EDIT: Here:- https://forum.doom9.org/showthread.p...36#post1633936

Quote:
Originally Posted by StainlessS View Post
Here how to return strings:-

Code:
    char * strlit="AnyOldName";
    int len=strlen(strlit);
    char * s=new char[len+1];
    if(s==NULL)
        env->ThrowError("Cannot Allocate string mem");
    strcpy(s,strlit);                               // dup
    char *e=s+len;                                  // point at nul

//  make safe copy of string (freed on Avisynth closure)
    AVSValue ret =  env->SaveString(s,e-s);         // e-s is text len only (excl nul) {SaveString uses memcpy)
//  AVSValue ret =  env->SaveString(s);             // alternative, Avisynth uses strlen to ascertain length
//  AVSValue ret =  env->SaveString(s,-1);          // alternative, Avisynth uses strlen to ascertain length
    delete [] s;                                    // delete our temp s buffer
    return ret;                                     // return Saved Str as AVSValue

//  return strlit;                                  // Alternative to MOST of above code char* converted to AVSValue.
//  return "AnyOldName";                            // Alternative to ALL of above code char* converted to AVSValue.
// String literals are read only and at constant address and so need not be saved.
above untested
EDIT: Dont use the one in red above (Its a bit naughty).
EDIT:
Avisynth and your plugin both have their own heap memory [new/malloc] and when you return a string allocated on your plugin heap,
you MUST hand over a string copy to avisynth, you must make a copy on avisynth heap (using avisynth's env->SaveString()) and give it the copy,
this gives avisynth full control over the string memory and also the responsibility to delete the memory when avisynth closes down.
After you make a string copy for avisynth, you can then delete/free your temp string memory buffer.
It is not necessary to use SaveString() on a string literal, "String literals are read only and at constant address and so need not be saved".

Set a Global var named MyGlobalString="Some GlobalVar Text" (actually does not need to use SaveString as "Some GlobalVar Text" is a String Literal).
Code:
env->SetGlobalVar("MyGlobalString", AVSValue(env->SaveString("Some GlobalVar Text")));   // Set Global [SaveString will use strlen() to establish length of string]
...
env->SetVar("MyLocalString", AVSValue(env->SaveString("Some LocalVar Text")));           // Set Local [SaveString will use strlen() to establish length of string]
Also NOTE above, if MyGlobalString and MyLocalString variable name strings above were NOT string literals and located in some dynamic memory buffer, you would
similarly have to use env->SaveString() to make copies of them, and give the copies as the names to SetGlobalVar() and SetVar() functions.


Set Global variable MyPi=3.1415926 [again, below MyPiName is a pointer to "MyPi" string literal (text wrapped in double quotes) and does not need env->SaveString, is just for illustration purposes]
Code:
char *MyPiName = "MyPi";
float pi=3.1415926f;
env->SetGlobalVar(env->SaveString(MyPiName), AVSValue(pi));
...
env->SetGlobalVar(env->SaveString(MyPiName), pi);   // Implicit type conversion of float pi to an AVSValue
__________________
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; 16th August 2020 at 15:28.
StainlessS is offline   Reply With Quote
Old 10th June 2024, 01:11   #184  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,869
Thanks for finding my old plugins. I still don't know where a good place to post stuff is though. What site lasts 10 years these days?

I actually did work on an aspect of this recently. What I called the perfect TBC method was using a correlation to find horizontal line jitter. This used several samples so was able to be more robust to noise, besides changes in brightness and contrast. I was able to use ChatGPT to solve all the math behind it. I've learned much more since then. There's a bunch of approaches to my problem and they can be measured against something called the Rao bound. Math like this is used for many things such as photogrammatry and aligning audio from different sources, measuring echo, and other types of alignment problems.

The baked in type of jitter could probably be trained with AI now.
Good thing I turned into a data scientist

Meanwhile we have vhsdecode which is improving all the time.
https://www.videohelp.com/software/VHS-Decode

You need to solder two wires to your direct head feed. You don't need an expensive Doomsday decoder, you can use a cheap TV USB stick as used in SDR or Software Defined Radio.
https://www.rtl-sdr.com/buy-rtl-sdr-dvb-t-dongles/

Since VHS is an FM signal, the capture doesn't device doesn't have to be precise, it only needs to measure a frequency.
jmac698 is offline   Reply With Quote
Old 10th June 2024, 01:11   #185  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,869
Also my mailbox is not full, I don't know what's wrong. mail away
jmac698 is offline   Reply With Quote
Old 10th June 2024, 02:36   #186  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,669
Quote:
Originally Posted by jmac698 View Post
I still don't know where a good place to post stuff is though. What site lasts 10 years these days?
Authors, contributors of many code projects (not just avisynth related) use Github . It's owned by Microsoft now, but unlikely to "disappear"
poisondeathray is offline   Reply With Quote
Old 10th June 2024, 22:01   #187  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,676
Quote:
Originally Posted by jmac698 View Post
Thanks for finding my old plugins. I still don't know where a good place to post stuff is though. What site lasts 10 years these days?
Too bad you were hesitant on releasing the source code back then . But having something instead of nothing is better.

If you don't want to host on GitHub as poisondeathray suggested, VideoHelp offers 512mb of storage. They have proven to be reliable and you can easily archive it also. I've done exactly that with a handful of plugins that are on the wiki.
Reel.Deel is offline   Reply With Quote
Reply

Tags
tbc

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 09:26.


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