summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-01-03 22:20:30 +0100
committerCarl Hetherington <cth@carlh.net>2024-01-03 22:20:30 +0100
commit369cb235b544c89c68ff86a00b3f8dd92a208d25 (patch)
tree934f781a3aa2847e41571c95b69966618abdff98
parent85b2143644d8faf16252666f738d5fda01fc1869 (diff)
Add hack to make a noisy J2C frame.
-rw-r--r--hacks/noise.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/hacks/noise.cc b/hacks/noise.cc
new file mode 100644
index 000000000..967e1a6da
--- /dev/null
+++ b/hacks/noise.cc
@@ -0,0 +1,18 @@
+#include <dcp/openjpeg_image.h>
+#include <dcp/j2k_transcode.h>
+
+int main()
+{
+ auto image = std::make_shared<dcp::OpenJPEGImage>(dcp::Size(1998, 1080));
+
+ for (int y = 0; y < 1080; ++y) {
+ for (int x = 0; x < 1998; ++x) {
+ for (int c = 0; c < 3; ++c ) {
+ image->data(c)[x + y * 1998] = rand() % 4096;
+ }
+ }
+ }
+
+ dcp::compress_j2k(image, 250000000, 24, false, false).write("noise.j2c");
+ return 0;
+}