Copy link to clipboard
Copied
// initial transform
ERR(in_data->utils->transform_world(in_data->effect_ref,
in_data->quality,
PF_MF_Alpha_STRAIGHT,
in_data->field,
input,
&composite_mode,
NULL,
&initial_matrix,
1L,
TRUE,
&output->extent_hint,
output));
// take output and use that as input
for(A_long i=0; i<100; i++){
ERR(in_data->utils->transform_world(in_data->effect_ref,
in_data->quality,
PF_MF_Alpha_STRAIGHT,
in_data->field,
output,
&composite_mode,
NULL,
&second_matrix,
1L,
TRUE,
&output->extent_hint,
output));
}
ok... i think i partially understand what you're aiming for... i too do some preparative re-transformations of the result, but i do this to achieve exponential replications. 🙂
anyways, here are a the consideration you should take into... consideration...
1. when you transform an image in any way where original pixels don't end up on exact "whole" pixels, the image gets degraded. for example, if an input pixel ends up half way between two output pixels, these two pixels will have that input pixe
...Copy link to clipboard
Copied
1. you can't use the same buffer as both the transform_world input and output. they have to be two different buffers. that might be the cause of the issue you're seeing.
2. FOR THE LOVE OF GOD, MULTIPLY THE MATRICES AND DON'T DO TWO RENDERS!!! AAAAAA!!!!!
Copy link to clipboard
Copied
Sure Shachar :), newbie here and I'm trying to understand this, and I will listen to any advice. But let me explain my issue I'm trying to solve.
So, imagine you want to copy input pixels many times (like a cloner), if I do 1 transformation in a loop, in matrix multiplication I have to multply initial position, scale, rotation in every instance of a loop, which is imho unnecessary cost. I would like to do this initially first, that take that result and to further do matrix operations. That way it's much faster. So, to recap, never use 2 renders (transform_world)? And any advice on how to achive this would be appreciated! Thanks!
Copy link to clipboard
Copied
ok... i think i partially understand what you're aiming for... i too do some preparative re-transformations of the result, but i do this to achieve exponential replications. 🙂
anyways, here are a the consideration you should take into... consideration...
1. when you transform an image in any way where original pixels don't end up on exact "whole" pixels, the image gets degraded. for example, if an input pixel ends up half way between two output pixels, these two pixels will have that input pixel blended between them. so re-transforming several times with "lossy" transformations, will give you a degraded result (blurry or jagged) compared to a single transformation render with a single matrix containing all the transformation operations.
2. transformation matrix multiplication is VERY cheap. it's a 3x3 matrix. you do like, 20 something operations to multiple the matrix, and then you go and to 6(ish) operations PER PIXEL when rendering, summing up at the TENS OF MILLIONS of operations per 2K image transformed... (without even talking about subsampling...). so you save very little time multiplying the matrices, and spend a TON of time doing redundant rendering.
as per "never use 2 renders (transform_world)", i think you misunderstood what i wrote. never use the same buffer as both the input and the output of transform_world, as it reads the input and overwrites it at the same time, most likely resulting in a corrupted output.
if you want to do repeated transformations you should:
1. create a new buffer. let's call it "temp".
2. transform the input to temp.
3. transform temp to output.
4. transform output back to temp.
5. repeat steps 2-4 as much as needed.
6. if the last transformation ended up on temp, copy it to output.
7. NEVER overwrite the input buffer... AE hands you the original, which it caches. writing to the input buffer creates the most bizarre bugs. don't ask.
Copy link to clipboard
Copied
Thanks! Just to make sure, temp shouln't be pointer, right? (like input and output world)
Copy link to clipboard
Copied
indeed. it should have some real allocated memory behind it. use AEGP_WorldSuite3->AEGP_New() to create the temp world.
just don't forget to release it using AEGP_Dispose() when you're done with it.
Copy link to clipboard
Copied
Is there any particular reason for AEGP? AEGP_WorldH vs PF_EffectWorld, what is the difference?
Copy link to clipboard
Copied
good qeustion. they are essentially the same.
you can wrap AEGP_WorldH onto a PF_EffectWorld using AEGP_FillOutPFEffectWorld, but not the othe way around.
so why go with AEGP_WorldH? because some functions, such as AEGP_FastBlur() take only a PF_EffectWorld.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now