Page 1 of 2

How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-17T04:38:15-07:00
by Nicola
Hi,

I'm using IM with VC++ and want to put some data array into an DPX file.
The data array contains an image of 10 bit YUV 422 sorted:

Code: Select all

|  U  |  Y  |  V  | 00 |  Y  |  U  |  Y  | 00 |...
|10bit|10bit|10bit|2bit|10bit|10bit|10bit|2bit|...
|  32bit = 4Byte       |  32bit = 4Byte       |...
Is there a simple method to get this into an Magick::Image object that than can be written to a DPX file?

For an RGB (actually BGR) image I do it the following way:

Code: Select all

          Magick::Image cMagickImage(
            pcBmpBuffer->getWidth(),
            pcBmpBuffer->getHeight(),
            "BGR",
            Magick::CharPixel,
            pcBmpBuffer->getImage() );
          cMagickImage.write( "test.dpx" );
Very easy but I don't know how to do the same for my 10 bit YUV 422 data...

Thank you in advance,
Nicola

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-18T03:32:27-07:00
by Nicola
No suggestions?

My first work around was to convert the data into a "simpler" format of a short array sorted: UY VY UY VY ...
But it is still YUV 422 and I don't know how to convert this appropriately into a Magick::Image...

Do I have to convert it first to YUV 444? But that wouldn't be a perfect solution :?

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-21T18:26:11-07:00
by koshiji
I checked source of DPX Coder.
For 10bit YUV 422 data, it seems to support only reading.

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T01:13:56-07:00
by Nicola
koshiji wrote:I checked source of DPX Coder.
For 10bit YUV 422 data, it seems to support only reading.
Is this true? I would appreciate to get some information about that from someone responsible. Many thanks in advance!

EDIT: Anyway, thank you koshiji!

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T06:29:01-07:00
by magick
Can you post a URL to one or two DPX images that are YUV encoded? We will use them to verify that ImageMagick can write proper YUV-encoded DPX images.

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T06:37:03-07:00
by Nicola
magick wrote:Can you post a URL to one or two DPX images that are YUV encoded? We will use them to verify that ImageMagick can write proper YUV-encoded DPX images.
Sorry, but I don't have those images. I want to create some from an array I have in VC++!

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T06:55:39-07:00
by magick
DPX supports YCbCr at 422 and at 444. Is that what you need? If DPX supports ,YUV can you point us to a reference so we can investigate. ImageMagick supports YCbCR (e.g. convert myimage -colorspace ycbcr image.dpx) but we will need to get back to you on whether it supports YCbCr at 422. If it doesn't we add support sometime this week,

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T07:47:39-07:00
by Nicola
OK, let me try to explain again what I have and what I need.

I'm programming in VC++. Having an array of image data (captured from a cam by myself, no stored image exists) I want to place this data into a DPX file. The data is given as 10 Bit YUV 422. This means I have (width x height) Y values and (width x height / 2) U and V values, respectively, all in 10 Bit. Those YUV values I want to store without any conversion!

Till now I tried a lot but didn't get a format so the in the end stored image is displayed all right. Amongst others I put the 10 Bit values into shorts, inserted the shorts array into a Blob, and initialized an image with that Blob. The resulting image shows something that looks like the upper left quarter of the image but in strange colors and not as accurate as it should be, I think.

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T07:58:38-07:00
by magick
You can only store YUV in DPX if the DPX standard permits YUV. We don't have access to the DPX file specification right now. That is why we asked. We do know DPX stores YCbCr but have not heard of it storing YUV. Do you know if the DPX standard supports YUV? If the standard does not support it, you cannot store YUV in DPX without some sort of color conversions (e.g. RGB or YCbCr).

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T08:11:07-07:00
by Nicola
I don't know if the DPX standard supports YUV.

What would be the way, if I'd say my YUV data is YCbCr? I'm not sure, if it is real YUV.

Or can I load the 10 bit YUV 422 data into a Magick::Image anyway, and convert those data to 10 bit RGB and store this?

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T08:38:51-07:00
by magick
Read your data as a YUV blob. It automatically converts the image to the YCbCr colorspace. Now write the image to a DPX image. If all goes well your DPX image remains in the YCbCr colorspace which we believe is what you want. Use the identify -verbose program to list the attributes of your DPX image to verity its in the YCbCr colorspace.

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T08:52:18-07:00
by Nicola
And the 422???

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T08:54:25-07:00
by magick
From our earlier message we mentioned we need to investigate support for YCbCr 422. It may be there we just need time to verify.

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T08:59:11-07:00
by Nicola
magick wrote:From our earlier message we mentioned we need to investigate support for YCbCr 422. It may be there we just need time to verify.
OK, thank you very much. Then good luck with this job ;-)

Re: How to put 10 bit YUV 422 data into a DPX file?

Posted: 2009-06-22T09:11:59-07:00
by fmw42
Don't know if this will help or perhaps you have seen this, but some information may be available or ordered at references at http://en.wikipedia.org/wiki/Digital_Picture_Exchange

see also

http://www.fileformat.info/format/dpx/egff.htm
http://www.imagemagick.org/script/motion-picture.php
http://www.digitalpreservation.gov/form ... 0178.shtml