• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Output Width and Height in Iterate Float

Participant ,
Oct 20, 2017 Oct 20, 2017

Copy link to clipboard

Copied

I am trying to write an effect that needs to process an entire frame at once. (I want to replace all the pixels with the average pixel value in the frame.)  I tried setting the area rectangle for the Iterate function to be the entire frame, but when it does the iteration it thinks the output width and height are greater than the actual frame.  The comp is set to 1024 x 768 (from a source image which is 2048 x 1556), but the output width and height in the function call are 1230 x 924.  Where are these numbers coming from?  My effect crashes (it gets an exception error while iterating) and I assume it is because it is trying to write beyond the memory bounds for the output frame.

I am using the latest version of After Effects on a Mac with Xcode 9 and my plug-in is based on the Smarty Pants example.  I did change the iterate_origin to just the iterate function since I want to get the entire frame at once.

Is there a better way to do this?  I need to read the entire frame to get the average value and then make a second pass to write the average value to each pixel. Perhaps I should just use the fill_float function instead, but I'd like to know why the plug-in thinks my height and width greater than the comp height and width.

TOPICS
SDK

Views

366

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 20, 2017 Oct 20, 2017

Copy link to clipboard

Copied

to begin with, yes, it seems your plug-in is crashing because you're

writing data to ram bit outside of the buffer's allocated memory.

here's a possible reason.

the size of the input buffer isn't always the size of the layer. here's

some of the stuff that can make it change:

1. half/quarter/ect res rendering. the buffer will be half/quarter it's

original size.

2. masks cause AE to pass the minimal buffer encompassing the masks.

3. layer is partially offscreen. AE will pass only the visible rectangle.

(plus a little)

4. some effects expand the original size. blur, for instance, causes a

larger-than-original buffer to be passed onto following effect.

buffers that were contracted/expanded will have their "origin" param tell

you the original location of relative to the buffer's .

so you should decide whether your effect should process what it's being

passed, the whole image, or the original image.

during PreRender you can request a buffer of a certain size, or better yet,

tell AE your effect needs all the pixels, even those who were made

transparent.

you can even tell AE you'll transfer a different sized output than the

input.

in any case, when iterating, you can only iterate over the size of the

existing buffer or up to that size.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 21, 2017 Oct 21, 2017

Copy link to clipboard

Copied

LATEST

Thanks for responding.

None of the four things you listed seem applicable to my effect.  My problem, I think, stems from the fact that I am trying to process an entire frame rather than doing a line at a time like the Smarty Pants sample.

I don't see where during PreRender I am supposed to set the buffer size.  Can you show me the lines in the Smarty Pants example that are specifying the buffer size.

I also noticed that when I ran Smarty Pants on the same comp, it also showed the width as 1230 and height as 924, but that does not keep it from rendering successfully.

My only guess is that there is some kind of interaction involved in a smart render that I don't understand and which makes me unable to iterate through an entire frame at once.  When I stepped through the debugger during the rendering function, it appeared to me that it did not exit the function after it completed the firsts pass through the frame but jumped back up to make another pass that resulted in overwriting memory beyond the bounds of the buffer.  Does this make any sense?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines