Fix failure to verify when the XSD/DTD path has a space in it.
[libdcp.git] / src / rgb_xyz.cc
index d299340ef7536ff5f0dfbaeb8b1cf17a7972bfd6..d0774e7c1bcd142b002a9850a8058643b1190728 100644 (file)
@@ -33,7 +33,6 @@
 
 #include "rgb_xyz.h"
 #include "openjpeg_image.h"
-#include "colour_matrix.h"
 #include "colour_conversion.h"
 #include "transfer_function.h"
 #include "dcp_assert.h"
@@ -68,7 +67,8 @@ void
 dcp::xyz_to_rgba (
        boost::shared_ptr<const OpenJPEGImage> xyz_image,
        ColourConversion const & conversion,
-       uint8_t* argb
+       uint8_t* argb,
+       int stride
        )
 {
        int const max_colour = pow (2, 16) - 1;
@@ -135,8 +135,7 @@ dcp::xyz_to_rgba (
                        *argb_line++ = 0xff;
                }
 
-               /* 4 bytes per pixel */
-               argb += width * 4;
+               argb += stride;
        }
 }
 
@@ -276,8 +275,8 @@ dcp::combined_rgb_to_xyz (ColourConversion const & conversion, double* matrix)
 /** @param rgb RGB data; packed RGB 16:16:16, 48bpp, 16R, 16G, 16B,
  *  with the 2-byte value for each R/G/B component stored as
  *  little-endian; i.e. AV_PIX_FMT_RGB48LE.
- *  @param size of RGB image in pixels.
- *  @param stride of RGB data in pixels.
+ *  @param size size of RGB image in pixels.
+ *  @param size stride of RGB data in pixels.
  */
 shared_ptr<dcp::OpenJPEGImage>
 dcp::rgb_to_xyz (
@@ -349,28 +348,3 @@ dcp::rgb_to_xyz (
 
        return xyz;
 }
-
-
-/** @param xyz_16 XYZ image data in packed 16:16:16, 48bpp, 16X, 16Y,
- *  16Z, with the 2-byte value for each X/Y/Z component stored as
- *  little-endian.
- */
-shared_ptr<dcp::OpenJPEGImage>
-dcp::xyz_to_xyz (uint8_t const * xyz_16, dcp::Size size, int stride)
-{
-       shared_ptr<OpenJPEGImage> xyz_12 (new OpenJPEGImage (size));
-
-       int jn = 0;
-       for (int y = 0; y < size.height; ++y) {
-               uint16_t const * p = reinterpret_cast<uint16_t const *> (xyz_16 + y * stride);
-               for (int x = 0; x < size.width; ++x) {
-                       /* Truncate 16-bit to 12-bit */
-                       xyz_12->data(0)[jn] = *p++ >> 4;
-                       xyz_12->data(1)[jn] = *p++ >> 4;
-                       xyz_12->data(2)[jn] = *p++ >> 4;
-                       ++jn;
-               }
-       }
-
-       return xyz_12;
-}