fixup! Playback sort of works.
[dcpomatic.git] / src / lib / j2k_image_proxy.cc
index 67083e6550cb314b7e9a13f166ea1486ffb26bec..f6b3b0373707deb0f553cca8f94e0f2e2bef4bac 100644 (file)
 */
 
 
+#ifdef HAVE_NVJPEG2K_H
+#include "cuda_decoder.h"
+#endif
 #include "dcpomatic_assert.h"
 #include "dcpomatic_socket.h"
 #include "image.h"
 #include "j2k_image_proxy.h"
-#include "warnings.h"
 #include <dcp/colour_conversion.h>
 #include <dcp/j2k_transcode.h>
 #include <dcp/mono_picture_frame.h>
 #include <dcp/raw_convert.h>
 #include <dcp/rgb_xyz.h>
 #include <dcp/stereo_picture_frame.h>
+#include <dcp/warnings.h>
 #include <libcxml/cxml.h>
-DCPOMATIC_DISABLE_WARNINGS
+LIBDCP_DISABLE_WARNINGS
 #include <libxml++/libxml++.h>
-DCPOMATIC_ENABLE_WARNINGS
+LIBDCP_ENABLE_WARNINGS
 #include <iostream>
 
 #include "i18n.h"
@@ -141,6 +144,7 @@ J2KImageProxy::prepare (Image::Alignment alignment, optional<dcp::Size> target_s
        }
 
        try {
+#if 0
                /* XXX: should check that potentially trashing _data here doesn't matter */
                auto decompressed = dcp::decompress_j2k (const_cast<uint8_t*>(_data->data()), _data->size(), reduce);
                _image = make_shared<Image>(_pixel_format, decompressed->size(), alignment);
@@ -166,6 +170,8 @@ J2KImageProxy::prepare (Image::Alignment alignment, optional<dcp::Size> target_s
                                ++p;
                        }
                }
+#endif
+               _image = CUDADecoder::instance()->decode(_data, 0, _pixel_format, alignment);
        } catch (dcp::J2KDecompressionError& e) {
                _image = make_shared<Image>(_pixel_format, _size, alignment);
                _image->make_black ();