diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-03-10 17:12:22 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-03-21 16:41:16 +0000 |
| commit | e293f154260cb8c0118929570098de5f01424ca0 (patch) | |
| tree | aa00a3e2dd61efeb7f84b62973ec6999fda50cdc /test | |
| parent | bd74772f3e8b6e14d5d7045f599b499f6a21f4c2 (diff) | |
Various hacks.
Diffstat (limited to 'test')
| -rw-r--r-- | test/poznan.cc | 51 | ||||
| -rw-r--r-- | test/wscript | 2 |
2 files changed, 42 insertions, 11 deletions
diff --git a/test/poznan.cc b/test/poznan.cc index 713ff0f93..9e43aba2a 100644 --- a/test/poznan.cc +++ b/test/poznan.cc @@ -3,6 +3,7 @@ #include "lib/image.h" #include "lib/colour_conversion.h" #include "lib/config.h" +#include "lib/magick_image_proxy.h" #include <dcp/rgb_xyz.h> using std::vector; @@ -10,17 +11,10 @@ using std::cout; using boost::shared_ptr; using dcp::Data; -int main () +static +void +colour_bars (shared_ptr<Image> rgb) { - JPEG2000Encoder::setup_encoders (); - - shared_ptr<JPEG2000Encoder> openjpeg = JPEG2000Encoder::from_id ("openjpeg"); - shared_ptr<JPEG2000Encoder> poznan = JPEG2000Encoder::from_id ("poznan"); - - shared_ptr<Image> rgb (new Image (AV_PIX_FMT_RGB48LE, dcp::Size (1998, 1080), false)); - - cout << rgb->stride()[0] << "\n"; - int const line_size = rgb->stride()[0] / 2; int const width = rgb->size().width; int const height = rgb->size().height; @@ -50,6 +44,43 @@ int main () p[y * line_size + x * 3 + 2] = 65535; } } +} + +int main () +{ + JPEG2000Encoder::setup_encoders (); + + shared_ptr<JPEG2000Encoder> openjpeg = JPEG2000Encoder::from_id ("openjpeg"); + shared_ptr<JPEG2000Encoder> poznan = JPEG2000Encoder::from_id ("poznan"); + + bool const testcard = false; + + shared_ptr<Image> rgb; + if (testcard) { + rgb.reset (new Image (AV_PIX_FMT_RGB48LE, dcp::Size (1998, 1080), false)); + colour_bars (rgb); + } else { + shared_ptr<MagickImageProxy> mip (new MagickImageProxy ("../dcpomatic-test-private/frame.tiff")); + shared_ptr<Image> raw = mip->image(); + rgb.reset (new Image (AV_PIX_FMT_RGB48LE, raw->size(), false)); + for (int y = 0; y < raw->size().height; ++y) { + uint8_t const * p = raw->data()[0] + y * raw->stride()[0]; + uint8_t* q = rgb->data()[0] + y * rgb->stride()[0]; + if (y == 0) { + for (int x = 0; x < 16; ++x) { + cout << ((int)p[x * 3]) << " " << ((int)p[x * 3 + 1]) << " " << ((int)p[x * 2]) << "\n"; + } + } + for (int x = 0; x < raw->size().width; ++x) { + *q++ = 0; + *q++ = *p++; + *q++ = 0; + *q++ = *p++; + *q++ = 0; + *q++ = *p++; + } + } + } shared_ptr<const dcp::OpenJPEGImage> xyz = dcp::rgb_to_xyz (rgb->data()[0], rgb->size(), rgb->stride()[0], ColourConversion::rec709_to_xyz ()); openjpeg->encode (xyz, 100000000, 24, RESOLUTION_2K, false).write ("openjpeg.j2k"); diff --git a/test/wscript b/test/wscript index fe4a7dfaf..f88b006e0 100644 --- a/test/wscript +++ b/test/wscript @@ -102,7 +102,7 @@ def build(bld): obj = bld(features='cxx cxxprogram') obj.name = 'poznan' - obj.uselib = 'DCP CUDA' + obj.uselib = 'DCP CUDA MAGICK BOOST_FILESYSTEM SNDFILE' obj.use = 'libdcpomatic2' obj.source = "poznan.cc" obj.target = 'poznan' |
