Re: Width, Height, and Rowbytes in FxImage returning possible wrong values.
Re: Width, Height, and Rowbytes in FxImage returning possible wrong values.
- Subject: Re: Width, Height, and Rowbytes in FxImage returning possible wrong values.
- From: Brad Wright <email@hidden>
- Date: Sun, 10 Aug 2008 21:41:48 -0700
Thanksi Steve:
Actually, I did some analysis on the image being returned. I
actually walk the image a for loop and the values are consistent with
a 1440x1080 image. I did this by running creating test patterns for
the image, so I can see where the values should line up in memory.
In this particular case, the values are consistent with 1440 pixels
wide and not 720. I'm testing with Final Cut 5.14 and the latest
FxPlug API's. It certainly could be broken in this combination.
Brad Wright
On Aug 10, 2008, at 9:15 PM, Steve Christensen wrote:
No, you're assuming that 16 x width == rowBytes. That's not always
true.
What I was getting at was this: 23040 bytes works out to 1440 16-
byte float pixels between the start of each succeeding row. Given
that you're seeing an image size of 720 x 240 (half of 720 x 480),
it looks like you have imageInfo.fieldOrder set to either
kFxFieldOrder_UPPER_FIRST or kFxFieldOrder_LOWER_FIRST. (This is
also likely the type of input and output images your plugin is
being provided.) Thus the bitmap is laid out like this:
|<- 16 x width ->||<- 16 x width ->|
|<----------- rowBytes ----------->|
row 0 |<---- upper --->||<--- lower ---->|
row 1 |<---- upper --->||<--- lower ---->|
...
row 719 |<---- upper --->||<--- lower ---->|
or this:
|<- 16 x width ->||<- 16 x width ->|
|<----------- rowBytes ----------->|
|<--- upper ---->|
row 0 |<---- lower --->||<--- upper ---->|
row 1 |<---- lower --->||<--- upper ---->|
...
row 719 |<---- lower --->||<--- upper ---->|
The rowBytes value is set so that you're using every other line (or
one field) of the overall image. You should only be working with
the first 720 pixels (or 11520 bytes) on each line since the other
half of the rowBytes -may- contain the other field's pixels or it
may be uninitialized -- the implementation details are unspecified.
That's why you have to respect both the image dimensions as well as
the rowBytes: there may be bytes at the end of each row in the
image you're processing that are supposed to be left alone.
On Aug 10, 2008, at 8:20 PM, Brad Wright wrote:
Thanks Steve:
From what I'm seeing math doesn't quite add up. The row bytes
reports 23040 while the image format is 32 bit float. 32 bit
float is 16 bytes wide. Therefore, 23040/16 is 1440 which is the
width of the sequence settings. So, it looks like something is
inconsistent.
Brad
On Aug 9, 2008, at 11:45 PM, Steve Christensen wrote:
What value did you supply in imageInfo.fieldOrder? If it contains
something other than kFxFieldOrder_PROGRESSIVE, the bitmap may
actually contain the entire image, but rowBytes is set up so you
only see the pixels in every other row. If that's the case, it's
not an application bug since it's doing exactly what you told it
to do.
On Aug 9, 2008, at 6:29 PM, Brad Wright wrote:
I'm seeing possibly wrong values for width and height in an
FxImage. The problem happens when I export to a DVC Pro 25 NTSC
movie from an HD timeline. My sequence is 1440x1080, and the
exported image is 720x480. In the rederOutput function I
retrieve the actual image using the temporal image API.
if ([tempororalImageApi getInputBitmap:(FxBitmap **)
&myBitmapImage withInfo:(FxRenderInfo) imageInfo atTime:(double)
renderInfo.frame]==NO)
{
NSLog(@"Failed to retrieve the original Bitmap image\n");
return NO;
}
Here's the values I get:
[myBitmapImage width] == 720
[myBitmapImage height] == 240
[myBitmapImage rowBytes] = 23040
The image format is Float and 32 bit wide.
23040 is the correct row bytes value for the image if it's at
1440 pixels wide.
When I try to process the image using these values in my loop, I
get only the first part of the actual image. So it appears that
the image is actually 1440 wide instead of being 720 wide. Is
this a know bug? Is there a workaround?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden