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. |
|
|
Thread Tools | Search this Thread | Display Modes |
7th June 2020, 16:37 | #1 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,493
|
Can someone look over this and tell me if I'm doing something wrong/inadvisable?
https://pastebin.com/w5h1ksny
This is some code for a basic caching filter I wrote to speed up a random access filter. I'm currently using it as part of a complex script, and for some reason it seems to be causing a crash (I also can't rule out the child filter yet, but removing the call to this filter also stops the crash). And by "crash" I mean the host program, either VirtualDub, AvsMeter64, or my own, just disappears completely without so much as an exception. I'm calling it with: Code:
FrameCache(0, 40, true) One odd thing I've noticed is that, for some reason, during the caching filter's constructor the passed ("child", I still think that's poor terminology though!) clip's GetFrame is called three times in a row for frame 0, without ever returning to the calling point (line 33 in the file). It only gets called once for all the other frames. Usually it crashes after the first or second GetFrame for frame 0 of the child clip, but it's one of those weird ones where adding more debugging output lines seems to stop the crash happening. Edit: running AvsMeter64, because it crashes memory usage peaks at about 1.5Gb, so it doesn't seem to be a memory problem. Anyone got any clues? Is what I'm doing liable to be an abuse of PVideoFrame? Last edited by wonkey_monkey; 7th June 2020 at 16:47. |
7th June 2020, 17:03 | #2 | Link |
Registered User
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
|
there are FrameCache in warpsharp, so it's better to change the function name
__________________
See My Avisynth Stuff |
7th June 2020, 17:34 | #3 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Wonkey, I dont see any real probs, but
Code:
//#ssS if (start < 0 || end < 0 || end < start) env->ThrowError("FrameCache: bad start/end value(s)"); // Original line if (start < 0 || end < start || end >= num_frames) env->ThrowError("FrameCache: bad start/end value(s)"); Code:
AVSValue __cdecl Create_FrameCache(AVSValue args, void* user_data, IScriptEnvironment* env) { return new FrameCache( args[0].AsClip(), args[1].AsInt(0), args[2].AsInt(0), args[3].AsBool(), //sss # No default env ); } Code:
FrameCache::FrameCache(PClip _child, int _start, int _end, bool _immediate, IScriptEnvironment* env) : GenericVideoFilter(_child), start(_start), end(_end), immediate(_immediate), cache(NULL) { Code:
int __cdecl dprintf(char* fmt, ...) { char printString[2048]="Wonkey_Test: "; // This must be nul termed eg "Hello: ", at very least char printString[2048]="". char *p=printString; for(;*p++;); --p; // @ null term va_list argp; va_start(argp, fmt); vsprintf(p, fmt, argp); va_end(argp); for(;*p++;); --p; // @ null term if(printString == p || p[-1] != '\n') { p[0]='\n'; // append n/l if not there already p[1]='\0'; } OutputDebugString(printString); return int(p-printString); // strlen printString } Code:
dprintf("We got to position %d so far",position); Code:
#define _CRT_SECURE_NO_WARNINGS
__________________
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; 7th June 2020 at 18:21. |
7th June 2020, 21:45 | #4 | Link | |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,493
|
Quote:
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|