1 #include "lib/poznan_encoder.h"
2 #include "lib/jpeg2000_encoder.h"
4 #include "lib/colour_conversion.h"
5 #include "lib/config.h"
6 #include <dcp/rgb_xyz.h>
9 using boost::shared_ptr;
13 JPEG2000Encoder::setup_encoders ();
15 shared_ptr<JPEG2000Encoder> encoder = JPEG2000Encoder::from_id ("poznan");
17 shared_ptr<Image> rgb (new Image (PIX_FMT_RGB24, dcp::Size (1998, 1080), false));
19 int const line_size = 1998 * 3;
21 for (int x = 0; x < 666; ++x) {
22 for (int y = 0; y < 1080; ++y) {
23 rgb->data()[0][y * line_size + x * 3] = 255;
24 rgb->data()[0][y * line_size + x * 3 + 1] = 0;
25 rgb->data()[0][y * line_size + x * 3 + 2] = 0;
29 for (int x = 666; x < 1332; ++x) {
30 for (int y = 0; y < 1080; ++y) {
31 rgb->data()[0][y * line_size + x * 3] = 0;
32 rgb->data()[0][y * line_size + x * 3 + 1] = 255;
33 rgb->data()[0][y * line_size + x * 3 + 2] = 0;
37 for (int x = 1332; x < 1998; ++x) {
38 for (int y = 0; y < 1080; ++y) {
39 rgb->data()[0][y * line_size + x * 3] = 0;
40 rgb->data()[0][y * line_size + x * 3 + 1] = 0;
41 rgb->data()[0][y * line_size + x * 3 + 2] = 255;
45 shared_ptr<const dcp::OpenJPEGImage> xyz = dcp::rgb_to_xyz (rgb->data()[0], rgb->size(), rgb->stride()[0], ColourConversion::rec709_to_xyz ());
46 Data j2k = encoder->encode (xyz, 100000000, 24, RESOLUTION_2K, false);
47 j2k.write ("poznan.j2k");