View Single Post
Old 11th September 2007, 00:29   #7  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Code:
boolean Autolevels::isSceneStart(int frameno, IScriptEnvironment* env) {
...
    if (frameno > 1) {
      PVideoFrame frame = child->GetFrame(frameno, env);
      PVideoFrame prevframe = child->GetFrame(frameno-1, env);
frame and prevframe are still fetched but are no longer used?
Code:
IntPair Autolevels::getMinMax(int frameno, IScriptEnvironment* env) {
  PVideoFrame frame = child->GetFrame(frameno, env);
  const unsigned char* pY = frame->GetReadPtr(PLANAR_Y);
...
  hash_map<int, IntPair>::const_iterator mmIter = MinMaxCache.find(frameno);
You still fetch the frames before checking you MinMaxCache, you probably only need to fetch it if there is no cache entry.

If you adjust your code to only fetch the "new" frame for the MinMaxCache and the "current" frame for outputing then the MakeWriteable model will be appropriate.

Also check on the libraries implementation of hash_map you may need to manually clear them in your destructor code.
IanB is offline   Reply With Quote