View Single Post
Old 05-23-2020, 08:51 AM   #1
Human being with feelings
amagalma's Avatar
Join Date: Apr 2011
Posts: 2,199
Default I need a video processor/gfx tutorial. Anyone can help?

I am trying to understand how things work with the video processor and its gfx functions. But they all seem very complicated. Could anyone help? I have lots of questions unfortunately..

1) Could someone explain me how the gfx_blit works?
Draws input to framebuffer. preserve_aspect=-1 for no fill in pad areas
From what I have understood, it will draw the specified input to the dest set by gfx_dest. Right? And -1 is the final layer (the current framebuffer), right?
Let's say that I have this code that will half the width of the video while preserving the aspect:
input_info(0, w, h); // getting the w,h of the video
gfx_blit(-1); // blitting a black layer on the frame
gfx_blit(0, 1, 0, 0, w/2, h, 0, 0, w, h ); // halving the width of the frame
But although x=y=0 the image is blitted centralized in height. I found out that in order to place it up/down or left/right I must use this:

input_info(0, w, h);
// example for up right
div = 0.5;
vert_position = 1; //1 for up, -1 for down
k = vert_position*(0.5*div - 0.5);
horiz_position = w*div; // 0 for left, w*div for right
gfx_blit(0, 1, w*div, h*k, w*div, h, 0, 0, w, h );
And the opposite function is true if only the height is changed:
input_info(0, w, h);
// example for up right
div = 0.5;
horiz_position = -1; //1 for left, -1 for right
k = horiz_position*(0.5*div - 0.5);
vert_position = 0; // 0 for up, h*div for down
gfx_blit(0, 1, w*k, vert_position, w, h*div, 0, 0, w, h );
Let's say that I have figured out these (although they seem to me very complicated and unexpected results)...

What happens with these: ?
The scrx and srcy I think I understood how they work. But the other two give me totally unexpected results (plus Reaper hard-crashes if I set a negative value to srcw!).

Is there a logic on how all these interact?

2) For gfx_blit the final layer was -1 but for the input_info function the current is 0 and not -1, right? So, for which functions is the current -1 and for which is it 0?

input_info(input, w, h[,srctime, wet, parm1, ...])
Returns 1 if input is available, sets w/h to dimensions. If srctime specified, it will be set with the source-local time of the underlying media. if input is a video processor in effect form, automated parameters can be queried via wet/parm1/...
3) If I try to draw something on the image the image flickers like crazy. Why?
input_info(0, w, h);
Thanks in advance for any help!

Last edited by amagalma; 05-23-2020 at 08:59 AM.
amagalma is offline   Reply With Quote