Log in

View Full Version : Advice on education


daveoggy
23rd April 2005, 18:26
Hi,

Can anyone suggest what road in education I need to take in order for this forum to stop sounding like double-dutch?

I did a very small amount of C, Assembler (on a 6502) and VB for my HND in Electronic Engineering but nothing extensive.

Are there any courses that specialise in programming software for the video industry?

Any discussion or friendly :) suggestions are welcome.

Thanks

trevlac
24th April 2005, 02:26
While at the University ... i did none of this. It has nothing to do with my job either. But is sure is fun. :)

Over the last year or so ... I've learned a buuunch ... 1 piece at a time.

------ My best resources -------

Web searches
Reading avs source code
writing filter code
testing

--------------------------------

What do you want to know? There are all kinds of gems through out this forum.

Guest
24th April 2005, 03:17
Get a book called "Video Demystified" by Keith Jack.

Also, "Digital Video and HDTV" by Charles Poynton.

What specific terms were you finding to be difficult to follow?

daveoggy
24th April 2005, 10:50
The problem is that I do not have any C++ coding experience. So where I start having difficulty is after the includes are declared. Seriously when I look at SimpleSample that's the only part that is clear :o

This is why I think I need some formal education so I can speak the language before I start trying to 'write a book'. Maybe not, maybe there are a few online crash courses which will de-mystify things. Any suggestions?

Guest
24th April 2005, 13:58
Buy some books on C++ and study them in conjunction with the extensive source code that is available. In my own experience, my C functional programming background was a barrier to absorbing the object model. But one day an "Aha" occurred.

Schlumpf
24th April 2005, 15:51
Slightly off-topic but now that you brought it up: I haven't programmed anything besides C yet but I'm interested in learning Java (and maybe C++). Problem is I can't really grasp the concept of object-orientated programming.
Any recommandation for sources that are specialized on "converting programmers' minds" from procedural to object-orientated?

unskinnyboy
24th April 2005, 16:20
Try this: Java for C and C++ Programmers (http://www.d.umn.edu/~gshute/java/c2java.html).

trevlac
25th April 2005, 03:47
Originally posted by daveoggy
The problem is that I do not have any C++ coding experience. So where I start having difficulty is after the includes are declared. Seriously when I look at SimpleSample that's the only part that is clear :o

This is why I think I need some formal education so I can speak the language before I start trying to 'write a book'. Maybe not, maybe there are a few online crash courses which will de-mystify things. Any suggestions?

So you ment you wanted info on reading/writing the c++ code ... not on video per say.

You can try doing vdub filters to get your feet wet. They require no c++. Just basic c. But if you want a gui dialog, you gotta mess with windows stuff. Personally I've found that reading the c++ books was more confusing to me than it should have been. Here's a quick tutorial ...

--- trevlac's 3 comments on those silly c++ classes ---

This is more for reading and understanding not for designing programs. :)

1) It's all just bytes in memory.
2) A class is a glorified structure (aka a defined layout in memory)
3) Class structures are mostly pointers to functions that let you access their data. (function pointers just say go here and treat it like code)

I Added a bunch of comments to Simon's 1st simple sample. My intention was to help with all the avisynth setup bits ... not with how you process the pixels. i think Simon covers that in his other samples.

http://trevlac.us/docs/SimpleSample.cpp

If you can read the font :) Ben provided some nice info about all of this when he 1st made Avisynth.

http://www.avisynth.org/BensAviSynthDocs

------------------------
Hope that helps. :D

[edit]
If it is not clear from the code ... the basic order of things for a plugin filter is ...

1) Avisynth calls AvisynthPluginInit2() of your dll because if found a LoadPlugin() in a script.

2) Inside of AvisynthPluginInit2() you 'register' your function by giving Avisynth the script name of your function and a pointer to call when it finds your function in a script.

3) When Avisynth encounters your function in a script, it calls your registered pointer. You return a pointer to your class structure. This class structure needs to be based on a standard filter or provide pointers to some functions that Avisynth may want to call.

4) One function Avisynth wants to call is GetFrame(). Which Avisynth expects your filter to have. When it calls this, it expects your filter to return a 'filtered' frame.

daveoggy
25th April 2005, 16:32
My story so far:

Started working through a C++ tutorial I found on the web. Everything seemed to be progressing until I came to this program which stopped me in my tracks:

// integer increaser
#include <iostream.h>

void increase (void* data, int type)
{
switch (type)
{
case sizeof(char) : (*((char*)data))++; break;
case sizeof(short): (*((short*)data))++; break;
case sizeof(long) : (*((long*)data))++; break;
}
}

int main ()
{
char a = 5;
short b = 9;
long c = 12;
increase (&a,sizeof(a));
increase (&b,sizeof(b));
increase (&c,sizeof(c));
cout << (int) a << ", " << b << ", " << c;
return 0;
}

I don't understand what the colons are saying and there was no prior mention of their meaning.

Then I checked back here and read Trevlac's post and his suggested reading. Now from what I can understand a great deal of the code in SimpleSample is standard and just has to be there, and to alter the output only the "//--- FINALLY !!!! --------" code needs altering.

So I decided to compile SimpleSample (1.7) and look at what the un-altered code does. And now for even more embarrassment, I can't even get the filter to work! Apparently the syntax is SimpleSample(clip,[size]), so shouldn't this work:

Loadplugin("c:\av\avisynth\myplugins\SimpleSampleDbg.dll")

TheClip = AVISource("c:\someclip.avi")
SimpleSample(TheClip, 10)

I know I'm an idiot and probably on borrowed time in a forum such as this, but here's hoping.

Guest
25th April 2005, 17:02
Originally posted by daveoggy
I don't understand what the colons are saying and there was no prior mention of their meaning. The only colons I see are just standard syntax of a C switch statement, i.e., a colon after the case clause.

I can't even get the filter to work! Apparently the syntax is SimpleSample(clip,[size]), so shouldn't this work:

Loadplugin("c:\av\avisynth\myplugins\SimpleSampleDbg.dll")

TheClip = AVISource("c:\someclip.avi")
SimpleSample(TheClip, 10)

I know I'm an idiot and probably on borrowed time in a forum such as this, but here's hoping. That sample takes no parameters and does nothing (actually just copies its input to its output), so it is working fine. :)

Look at later versions of the sample at www.avisynth.org/SimpleSample, where more functionality is added. This one (the first) is just a skeleton without any real processing.

daveoggy
25th April 2005, 17:25
I compiled version 1.7 of Simplesample which supposedly draws a square in the middle of the video. I don't get any video out and AviSynth gives me this error:

Invalid arguments to function "SimpleSample"
(c:\test.avs, Line 4)

I not 100% sure I'm compiling properly. Compiling the dll gives me the file name simplesampleDbg. Is this the debugging version and does that matter?

Thanks Neuron2 I understand the colons now, I was looking too hard for some hidden meaning.

trevlac
25th April 2005, 20:37
Maybe the code had a bug.

Why don't you try one of the ones here:
http://www.avisynth.org/SimpleSample

They only go up to 1.6


They also have comments like the ones I made. Maybe when it is said a few different ways ... it will be easier.

daveoggy
26th April 2005, 22:18
It appears the code did indeed have a bug :eek:

1.6 compiled and worked fine. I'm going to start faffing around with the code now to see how much I can break it.

If I'm happy to just work in RGB32 can I safely delete all the other colour space code?

I'll probably be asking some more questions very soon...

trevlac
27th April 2005, 14:21
Originally posted by daveoggy
If I'm happy to just work in RGB32 can I safely delete all the other colour space code?


Sure ... delete away.

--------------- To add an xtra check --------------

Look in sample 1.0b, for the following line

if (vi.IsPlanar()) // is input planar?
env->ThrowError("SimpleSample: input to filter must be in YUY2 or RGB");


This is checking for the input color "packaging". You could do a similar thing and check for RGB32. Then you would be sure no one could pass anything else into your filter.


if (! (vi.IsRGB32()) ) // is input RGB32?
env->ThrowError("SimpleSample: input to filter must be RGB32");


BTW: vi is a videoInformation object. vi.IsRGB32() is a call to a function of vi. Calling vi's functions is just like checking for values in a big structure. In fact, (without looking at the code), I'm quite sure this is all that vi does. It has a structure of 'flags' and it passes back true/false if you ask it about these. Use a class viewer to see all the calls to vi, or look in the avisynth.h file.

env is a reference back to Avisynth. ThrowError is a function you can call to stop everything.

dot notation vs arrow -- This is in both C and C++ and can be confusing. vi.IsRGB32() means vi is the starting point in memory for the vi structure (object). We know exactly where vi it is, so go call it's IsRGB32() function. For env->ThrowError(), env is a pointer to an env structure. Meaning goto the env pointer memory location ... find where the real env is ... go there .... go call it's function.

Here is a quick link I found on C,C++,Java. It's looks to be short and concise. :)
http://www.outbacksoftware.com/cpp/cpp.html

Si
28th April 2005, 22:11
@daveoggy
Could you post the exact script that gave you the error with 1.7 please
regards
Simon