Log in

View Full Version : Source grading dll


DocAliG
3rd January 2007, 16:43
Hi all,
i follow regularly all the discussions on this forum, it's full of very useful information....
I recently decided to use avisynth as a base for my developments, but the structure is very new for me... And i'm fighting with my dll since 2 weeks now....

I'm working on a project to autograde a videosource, i.e. blindly give a score (more or less objectively) to a source. Not having any reference to compare the content is quite complicated, that's why i started with the "easy" part of the job.
Get a video, turn it into YUV colorspace, and calculate a contrast score (first for the luminance, the chrominance should be easy after that).
I've made this little source, mainly taken from CompareYV12, but nothing happens, and i just don't know how to debug this dll, using avisynth dll, that uses rundll32...

Any help would be great

Thank you again for your work !

Guest
3rd January 2007, 18:01
Please fix your thread title to comply with rule 9. Thank you.

foxyshadis
3rd January 2007, 20:16
This is what you're working from? It crashes out of the box because:

return new GradeYV12(args[0].AsClip(),
args[2].AsString(), //YUV
args[3].AsString(OutputFileName),//LOG file
env);
should be
return new GradeYV12(args[0].AsClip(),
args[1].AsString(), //YUV
args[2].AsString(OutputFileName),//LOG file
env);

Also:
CH_Y/U/V might better be PLANAR_Y/U/V, because that way you could simplify some of your code. On the other hand, it's up to you.

The real error is:
while(!_child->GetFrame(i, env)) {i++;}
should be
frmcnt = vi.num_frames;

Besides being incredibly wasteful if it did work - you'd render each frame twice - it doesn't work, and a quick trip through the debugger would show that.

DocAliG
3rd January 2007, 23:08
Please fix your thread title to comply with rule 9. Thank you.

Fixed. Sorry :)

Thank you foxyshadis ! Errors fixed....

In classical executable files, we can use breakpoints and run the program step by step to check each function.
What would be really helpful, is a method to debug avisynth plugin dll.

Again, thank you very much.

Fizick
3rd January 2007, 23:36
create avs script, with loading of your plugin and function.
run virtualdub as your debugging exe

Guest
4th January 2007, 00:27
http://forum.doom9.org/showthread.php?p=784386#post784386

DocAliG
4th January 2007, 10:43
Thank you Fizick and Neuron2 :D :D :D

DocAliG
10th January 2007, 11:44
Hi everyone,

coming back to this dll, thanks to you it works as i expected.
Except maybe that as foxyshadis said, it parses the video once, give th results, and then, it parses a second time!
After running this step by step, i don't understand why. Which function is calling it again, it's a mystery for me...

If you have any clue...

Thanks in advance !

foxyshadis
10th January 2007, 12:43
Maybe it has to do with the way you play fast and loose with the cache. You will read each frame 2-3 times if you have chroma - but that's fine, normally, it'll be in cache. But you try to get a write pointer to it, which I'm sure has some bad cache effect. (Too tired to remember what.) Better to construct a new destination frame than making the source writable when you know it can't be, and make the source const.