summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-03-08 15:59:54 +0000
committerCarl Hetherington <cth@carlh.net>2016-03-21 16:41:15 +0000
commitbd74772f3e8b6e14d5d7045f599b499f6a21f4c2 (patch)
tree6251224416a70aea20b85eb1f0c8a34335125cb7
parent793caf5f747359093e0b6f25847f5f1846160a5e (diff)
Fix poznan test to use the intended input image.
-rw-r--r--test/poznan.cc51
1 files changed, 30 insertions, 21 deletions
diff --git a/test/poznan.cc b/test/poznan.cc
index 588ef754e..713ff0f93 100644
--- a/test/poznan.cc
+++ b/test/poznan.cc
@@ -6,6 +6,7 @@
#include <dcp/rgb_xyz.h>
using std::vector;
+using std::cout;
using boost::shared_ptr;
using dcp::Data;
@@ -13,37 +14,45 @@ int main ()
{
JPEG2000Encoder::setup_encoders ();
- shared_ptr<JPEG2000Encoder> encoder = JPEG2000Encoder::from_id ("poznan");
+ 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_RGB24, dcp::Size (1998, 1080), false));
+ shared_ptr<Image> rgb (new Image (AV_PIX_FMT_RGB48LE, dcp::Size (1998, 1080), false));
- int const line_size = 1998 * 3;
+ cout << rgb->stride()[0] << "\n";
- for (int x = 0; x < 666; ++x) {
- for (int y = 0; y < 1080; ++y) {
- rgb->data()[0][y * line_size + x * 3] = 255;
- rgb->data()[0][y * line_size + x * 3 + 1] = 0;
- rgb->data()[0][y * line_size + x * 3 + 2] = 0;
+ int const line_size = rgb->stride()[0] / 2;
+ int const width = rgb->size().width;
+ int const height = rgb->size().height;
+
+ uint16_t* p = reinterpret_cast<uint16_t*> (rgb->data()[0]);
+
+ for (int x = 0; x < width / 3; ++x) {
+ for (int y = 0; y < height; ++y) {
+ p[y * line_size + x * 3] = 65535;
+ p[y * line_size + x * 3 + 1] = 0;
+ p[y * line_size + x * 3 + 2] = 0;
}
}
- for (int x = 666; x < 1332; ++x) {
- for (int y = 0; y < 1080; ++y) {
- rgb->data()[0][y * line_size + x * 3] = 0;
- rgb->data()[0][y * line_size + x * 3 + 1] = 255;
- rgb->data()[0][y * line_size + x * 3 + 2] = 0;
+ for (int x = width / 3; x < (2 * width / 3); ++x) {
+ for (int y = 0; y < height; ++y) {
+ p[y * line_size + x * 3] = 0;
+ p[y * line_size + x * 3 + 1] = 65535;
+ p[y * line_size + x * 3 + 2] = 0;
}
}
- for (int x = 1332; x < 1998; ++x) {
- for (int y = 0; y < 1080; ++y) {
- rgb->data()[0][y * line_size + x * 3] = 0;
- rgb->data()[0][y * line_size + x * 3 + 1] = 0;
- rgb->data()[0][y * line_size + x * 3 + 2] = 255;
- }
+ for (int x = (2 * width / 3); x < width; ++x) {
+ for (int y = 0; y < height; ++y) {
+ p[y * line_size + x * 3] = 0;
+ p[y * line_size + x * 3 + 1] = 0;
+ p[y * line_size + x * 3 + 2] = 65535;
+ }
}
shared_ptr<const dcp::OpenJPEGImage> xyz = dcp::rgb_to_xyz (rgb->data()[0], rgb->size(), rgb->stride()[0], ColourConversion::rec709_to_xyz ());
- Data j2k = encoder->encode (xyz, 100000000, 24, RESOLUTION_2K, false);
- j2k.write ("poznan.j2k");
+ openjpeg->encode (xyz, 100000000, 24, RESOLUTION_2K, false).write ("openjpeg.j2k");
+ xyz = dcp::rgb_to_xyz (rgb->data()[0], rgb->size(), rgb->stride()[0], ColourConversion::rec709_to_xyz ());
+ poznan->encode (xyz, 100000000, 24, RESOLUTION_2K, false).write ("poznan.j2k");
}