I am trying to write a filter for Avisynth that works in the following fashion: Frame 1: Does nothing. Frame 2: Modifies frame 2 based on frame 1. Frame 3: Modifies frame 3 based on the modified frame 2. Frame 4: Modifies frame 4 based on the modified frame 3. etc Obviously for practical operation it would require being run in sequence. How would I do this?
Another question: why doesn't this work? *PreviousFrame = malloc(src_width*src_height*sizeof(int)); 1>.\Main.cpp(121) : error C2440: '=' : cannot convert from 'void *' to 'int' 1> There is no context in which this conversion is possible I didn't have to do anything when my code was in c, in x264: int *array=x264_malloc(h->param.i_height * h->param.i_width * sizeof(int)); Why won't this work in C++?
If you're doing this inside a filter, just use a PVideoFrame variable (that has scope larger than the getframe call) and assign it the frame you want to keep. Then it'll still be there when you want to use it.
--------------------- Devon 1983 323e (sold) 1988 525e (sold) 2002 X5 3.0 (sold) 1993 325is Coupe 160,000 miles
Another question: In x264, I used this: uint8_t *curframe_block = &fenc->plane[0][x+y*fenc->i_stride[0]]; uint8_t *prevframe_block = &prevframe->plane[0][x+y*fenc->i_stride[0]]; to create pointers to the current macroblock of the current and previous frame. Can I do this with Avisynth? What type do I declare them to be, since C++ seems to have no uint8_t? (Also, come on #avisynth IRC channel, on freenode--your help will be appreciated :) )
--------------------- 19" HRE 543, Remus Exhaust w/Res Delete, GruppeM CAI, M5 Front Bumper, Xenon Angel Eyes
Thanks, working on the error handling. Some other issues: 1. I want to check my mallocs, but c++ doesn't have an identifier called "null"--what do I do for == null? Edit: nevermind, NULL seems to work. 2. How do I deallocate my memory? free(ptr)? 3. What licensing requirements are there for an Avisynth filter? I assume it doesn't have to be GPL, given the exception given in the license--but what requirements are there? 4. How do I make certain parameter values default if not specified? Edit: Found this, thanks anyways.
2. if (ptr) free(ptr); 3. If all you do is include avisynth.h, there are no requirements. Ben made an exception for that. 4. As Ben writes in : "For convenience, AVSValue offers a set of As...() functions which take default values. See avisynth.h." This example sets defaults of 0 and 7 for mode and threshold, respectively: Code:
--------------------- SOLD, again!! Good luck, Eric!! 6/10/2012 "To my mind it is wholly irresponsible to go into the world incapable of preventing violence, injury, crime, and death. How feeble is the mindset to accept defenselessness. How unnatural. How cheap. How cowar