Floating Point Pixels in Output Module (HELP!)
Copy link to clipboard
Copied
This is driving me crazy. I tried to update an output module I had written (and used extensively years ago) which simply finds the average pixel value for each color and writes it to a text file. (I am trying to evaluate effects that manipulate film frames of solid colors that have been scanned and want to get the average rather than just some random pixel.)
The updated version works with 16-bit comps but I need to use in now on floating point comps since some of the frames may have 'super whites" in them. The values I get for floating point pixels in the plug-in seem to bear no relationship to the values I see in the Info panel in After Effects.
As a test I created a sequence of solids filled with equal RGB having the following values:
1.0, 0.8, 0.6, 0.4, 0.2, 0, 1.5, 2.0
What I see in the plug-in is pixel values of
1.0, 0.6038, 0.3185, 0.1329, 0.0331, 0, 2.5495, 5.0199
I can see that the plug-in thinks the depth of the image is 96 and the pixel format is PF_PixelFormat_ARGB128.
Does anybody have any idea why I am seeing this or where I should look for the problem?
Does anyone see a mathematical relationship between those sequences of values? It must be some kind of exponential function, right?
Copy link to clipboard
Copied
OK. It is an exponential function: x^0.999999.
WTF
Copy link to clipboard
Copied
No, apparently Excel is playing with my brain. I give up.
Copy link to clipboard
Copied
At the risk of embarrassing myself even more, I'm going to venture the opinion that the relationship between the two sequences of numbers is parabolic. I did a project with a solid whose color animates from 0 to 3.0 in steps of 0.05 and ran my output plug-in to read the average pixel values for each frame and plotted the resulting values in Excel. It looks like half a parabola to me, but I cannot make Solver in Excel figure out the exact parameters for the parabola. It comes pretty close, but the very bottom end is still off.
Not that this is at all relevant to my real problem which is figuring out how to get valid pixel values in an output module for floating point projects. The sample project FBIO is limited to 8 and 16 bit pixels, but I thought I had changed the necessary flags or settings to make my output plug-in work with floating point pixels. It sees the pixel format as floating point, but the values are screwy.
Copy link to clipboard
Copied
It occurs to me that the problem may be the way I am accessing the floating point pixels in the AddFrame function.
Is there something wrong with this code:
switch (pixelFormat)
{
case PF_PixelFormat_ARGB128: // float pixel values
layer32Pixel = (PF_Pixel32 *)(wP->data);
for(row = 0; row <wP->height; row ++)
{
layer32Pixel = (PF_Pixel32*)((Ptr)wP->data + row * wP->rowbytes);
// CAN I ASSUME A FLOATING POINT IMAGE HAS NO PADDING
for(col = 0; col < wP->width; col++)
{
redTotal += layer32Pixel->red;
greenTotal += layer32Pixel->green;
blueTotal += layer32Pixel->blue;
pixelCount++;
layer32Pixel++;
}
}
}
break;

