Copy link to clipboard
Copied
Hello for All!
I want to write plugin based on AE SDK (2017 version currently) custom filter based on current pixel value and values of pixel neighborhoods. But completely don't understood how to access to neighborhoods? SDK examples showed usage of PF_IterateSuite with iterate function provided pointer on current pixel only and pixels X/Y coordinates. Anybody may assist me- how to directly operate with input/output buffers without Iteration Site and compute pixel' neighborhoods positions (and capture values of these pixels, of course) from previous and from next lines (north and south direction with custom distance)?
Thank you in advance.
Copy link to clipboard
Copied
you can access a buffer's pixel data directly like so:
PF_Pixel *p = buffer->data + x + y * (buffer->rowbytes / sizeof(PF_Pixel));
p now pointer to the point in ram where the pixel in (x,y) coordinates is stored in the buffer.
you can read data like so:
char red = p->red;
you can write data like so:
p->alpha = whatever;
(just don't write into the input buffers. they're mutable...)
Copy link to clipboard
Copied
Hi Shachar, thank you for reply.
Could you please say me - what you means 'buffer'?
Render receive only these parameters:
PF_InData *in_data,
PF_OutData *out_data,
PF_ParamDef *params[],
PF_LayerDef *output)
And filter function called by iterator:
void *refcon,
A_long xL,
A_long yL,
PF_Pixel8 *inP,
PF_Pixel8 *outP
where (from my understanding): xL and xY - line and pixels offset from start of buffer,
refcon - user data, inP and outP pointers on current pixels in input and in output buffer accordingly.
Thank you in advance.
Copy link to clipboard
Copied
Exist any way to avoid usage of iteration site and iteraion API and implement loops on lines and pixels passes by itself? What kind of input/output buffers properties I need to get for implement these loops? From my opinion function call with push/pop parameters per each pixel isn't good for performance. Ot maybe I didn't understood something?
Copy link to clipboard
Copied
yes you can avoid the use of the iteration suite. the code i showed you allows you to access any random pixel in a buffer. what's a buffer? the input and outputs AE hands you are buffer. so "input->data" is the pointer to the base address of the pixel buffer.
take a look at the "CCU" sample project. it demonstrates a "for" loop that scans lines just like you asked.
Copy link to clipboard
Copied
Hi Shachar, thank you again. CCU example - exactly what I need.
Thanks. 🙂