Page MenuHome

Improved DPX/Cineon code
Closed, ResolvedPublicPATCH


Patch for: T27377 T24716

This patch improves the Cineon/DPX code.

It allows Blender to load :
- 1, 8, 10, 12 and 16 bits files. For 10 and 12 bits files, packed or filled type A/B are supported.
- RGB, Log, Luma and YCbCr colorspaces.
- Big and little endian storage.
- Multi-elements (planar) storage.

It allows Blender to save :
- 8, 10, 12 and 16 bits file. For 10 and 12 bits files, the most used type A padding is used.
- RGB and Log colorspaces (Cineon can only be saved in Log colorspace). For Log colorspace, the common default values are used for gamma, reference black and reference white (respectively 1.7, 95 and 685 for 10 bits files).
- Saved DPX/Cineon files now match the viewer.

Some files won't load (mostly because I haven't seen any of them) :
- Compressed files
- 32 and 64 bits files
- Image orientation information are not taken in account. Here too, I haven't seen any file that was not top-bottom/left-right oriented.

I hope it can be useful.

Event Timeline

Thanks for this contribution!
Assigning to Campbell for checking.

This is really a re-write since I'm not all that familiar with DPX I cant really review so well.

I did make some minor update to the patch just to get it building with higher warnings, so attached this.

We need some way to validate the patch, maybe test files or a user who wants to go over it and see it works well?

Added a new version of the patch, should fix a problem rexbron had.

Assigning to Brecht, maybe he can check it sometimes. :)
Should be his area of expertise as he worked on imbuf in the past too.

Submitted a new version that apply without error on rev 38506.
Also, I've uploaded an archive containing some DPX and Cineon files coming from different places to test it :

Can anyone check on that?

I've attached a new version which can be applied on rev 44936.
Files are now converted in linear colorspace on loading, which is now compliant with the rect_float buffer's colorspace.

Sorry, made a mistake in patch v4.

New patch version that fixes a bug with the picture linked by Sebastien Koenig on the mango blog ( and

New version. Fixed a bug when saving 10 bits RGBA files with even width (there was a end of line padding error that should now be fixed).

New version that fixes a bug with log encoding. Also, Cineon file are limited to 10 bits per sample, the UI now reflects that correctly.

Converted some float arithmetic to int only.
Also, I've uploaded an updated DPX/Cineon sample files archive, now containing official pictures from Kodak :

Attaching updated patch. Changes:

- Applies on current trunk
- Updated to new color management system
- Style cleanup
- Use guarded memory allocation

Brecht, this LGTM/ At least it solves issues known by me and can not find a situation when it fails yet.

Sergey, please go ahead and commit it then :)

Thank you for looking at the patch and make it apply on latest revision.
I've re-uploaded the DPX/Cineon samples archive as the latest link has expired, in case someone would like to give the patch a try :
Anyway, I'm still around if there are bug to fix or changes to do in the code.

Pardon for the delay -- somehow comments didn't go to my mailbox =\

Commited the patch now. Thanks everyone here!

Sergey Sharybin (sergey) changed the task status from Unknown Status to Resolved.Oct 22 2012, 2:49 PM