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 Development

Reply
 
Thread Tools Display Modes
Old 19th July 2012, 16:32   #21  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
Quote:
Originally Posted by TheFluff View Post
Slightly academic, but this can overflow with very large frames (slightly bigger than 4096x4096). If you want a 64-bit integer with MSVC in 32-bit mode use __int64 (or #include <stdint.h> and use int64_t). sizeof(long) is 4 in pretty much all 32-bit compilers.
OK, you win, implemented 64 bit accumulator.
__________________
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 19th July 2012, 18:22   #22  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
Quote:
Originally Posted by StainlessS View Post
EDIT: I'll look at the "YUV-to-RGB conversion", thanks,
but dont look hopeful as would require invoke on every frame (runtime filters dont have constructors), from the link you posted:
Avisynth supplies you with the user_data pointer for a reason, stick the clip generated by the env->Invoke() call there. Of course, then you run into problems if your function is called multiple times in the same script but with different clips... Solving those problems is left as an exercise to the reader.
TheFluff is offline   Reply With Quote
Old 20th July 2012, 00:45   #23  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
Quote:
Originally Posted by TheFluff View Post
Avisynth supplies you with the user_data pointer for a reason, stick the clip generated by the env->Invoke() call there. Of course, then you run into problems if your function is called multiple times in the same script but with different clips... Solving those problems is left as an exercise to the reader.
Quote:
Originally Posted by StainlessS View Post
EDIT: The user always has the option of convert to eg Y8 or YV12 before calling the runtime filter, that would be best all round.
Thanks, think I'll stick with that. It is expected (the way I expect to use it) that args would change, having a fallback if user does not convert to a YUV form is not such a bad thing.

Quote:
Originally Posted by TheFluff View Post
Solving those problems is left as an exercise to the reader.
I have not seen any explanation of how the user_data thing works (other than in the font thing using a malloc string,
no idea how it would fare with Avisynth objects and/or whether they would need destroyed).
Also, thanks but I dont need any exercises, quite happy living in ignorance and if you knew how to
solve the "problem", you would no doubt have said so.
__________________
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; 20th July 2012 at 01:51.
StainlessS is offline   Reply With Quote
Old 20th July 2012, 04:00   #24  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
Why do you even want to support RGB input to a function that is only meaningful for YUV images?

Quote:
Originally Posted by StainlessS View Post
I have not seen any explanation of how the user_data thing works (other than in the font thing using a malloc string,
no idea how it would fare with Avisynth objects and/or whether they would need destroyed).
user_data is void* pointer. That means it can point to anything. That means you can create an arbitrary object or c struct or whatever floats your boat, get a pointer to it and set user_data to that pointer. The environment will pass the pointer back to you each time your function is called, thus neatly solving the problem with arbitrary functions that need to keep some kind of state between calls, without having to resort to ugly hacks like global static objects.

In other words: create some kind of object or struct that stores any state you want to save. Do this in AvisynthPluginInit2, and pass a pointer to the object in question as the last argument to env->AddFunction. This pointer will be passed to the function you just registered, as the user_data argument. Do whatever you want with the object there. If you're worried about memory leaks, register an env->AtExit() hook that deletes the object.

The PClip class acts as a reference counted smart pointer; it behaves much like its relatives in the C++ standard library does and has the same semantics. If you're not familiar with how smart pointers work in C++, I really think you should take the time to read up on it.

Quote:
Originally Posted by StainlessS View Post
Also, thanks but I dont need any exercises, quite happy living in ignorance and if you knew how to
solve the "problem", you would no doubt have said so.
I didn't explain it because it's a tedious problem to solve, not a hard one. You just need to make your code handle an arbitrary number of clips, not just one, and find some way of identifying which clip you're currently working with.
TheFluff is offline   Reply With Quote
Old 20th July 2012, 04:12   #25  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,417
Quote:
Originally Posted by TheFluff View Post
Why do you even want to support RGB input to a function that is only meaningful for YUV images?
Fallback.
__________________
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; 6th August 2012 at 17:46.
StainlessS is offline   Reply With Quote
Reply

Tags
runtime, runtime error, runtime functions

Thread Tools
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 19:07.


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