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 > Programming and Hacking > Development
Register FAQ Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 10th February 2003, 00:24   #1  |  Link
Walda
Registered User
 
Join Date: Jan 2003
Location: Czech Republic
Posts: 7
How to store data in Avisynth plugin?? Varying of fps?

Hi,

I´m just finishing new version of very simple "smart" Logo - off plugin. ( Only because the Logo masters don´t have enough enthusiasm to convert their great RGB filters to YUY2 ot UV12).
The plugins is working ( for me good), but I´m not satisfied with the architecture of it.

The question is - how to store buffer with data, which are proccesed only once when loading the plugin, and when proccessing every frame it is only reading from this buffer. And how to free ( delete) memory for this buffer after encoding is done?
The storing data in some file and repeatedly reading of it for every frame seems to me slightly unhappy solution.

// Logo.cpp : Defines the entry point for the DLL application.

#include .....

unsigned char* smart = new unsigned char[255*255];

class Logo : public GenericVideoFilter
{

public:
Logo(PClip _child, int _fix, int _fiy, int _f_width, int _f_height, int _c, const char * _fileName, IScriptEnvironment* env) : GenericVideoFilter(_child), fix(_fix), fiy(_fiy), f_width(_f_width), f_height(_f_height), c(_c), fileName(_fileName)
{
here is smart proccessing
}
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env);
};

PVideoFrame __stdcall Logo::GetFrame(int n, IScriptEnvironment* env) {
Here is only reading from smart
}
AVSValue ...
extern "C" ...

The second question - when using Avisynth with some plugin, there is varying of fps when encoding ( in my case between 2-8fps.) Is it normal??

Zdenek W.
Walda is offline   Reply With Quote
Old 11th February 2003, 17:32   #2  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
Quote:
The question is - how to store buffer with data, which are proccesed only once when loading the plugin, and when proccessing every frame it is only reading from this buffer.
What's wrong with you current method - storing the data as a class member?? This is how it's done anywhere else.

Adding:
Code:
Logo::~Logo(void) 
{
  if (smart) delete[] smart;
}
Should solve your problems, and properly deallocate the data.

Is there a specific reason why you have a fixed size on your data - will it always be contained within 255*255 bytes?
Quote:
The second question - when using Avisynth with some plugin, there is varying of fps when encoding ( in my case between 2-8fps.) Is it normal??
Well - some filters (like temporalsoften for instance) varies in speed depending on the data it recieves, but most filters take the same processing time. What might be the root of the problem is that virtual dub has two separate threads for reading and writing (encoding) data. That makes the fps jump, as the threads doesn't always get the same amount of frames done within a time-sample period (the time between fps measures).

Use xvid with "null transform mode" - this will disable encoding, and therefore give a more stable image of the framerate.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Reply


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 10:04.


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