OpenJPH
Open-source implementation of JPEG2000 Part-15
Loading...
Searching...
No Matches
test_executables.cpp
Go to the documentation of this file.
1//***************************************************************************/
2// This software is released under the 2-Clause BSD license, included
3// below.
4//
5// Copyright (c) 2019, Aous Naman
6// Copyright (c) 2019, Kakadu Software Pty Ltd, Australia
7// Copyright (c) 2019, The University of New South Wales, Australia
8//
9// Redistribution and use in source and binary forms, with or without
10// modification, are permitted provided that the following conditions are
11// met:
12//
13// 1. Redistributions of source code must retain the above copyright
14// notice, this list of conditions and the following disclaimer.
15//
16// 2. Redistributions in binary form must reproduce the above copyright
17// notice, this list of conditions and the following disclaimer in the
18// documentation and/or other materials provided with the distribution.
19//
20// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
26// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31//***************************************************************************/
32// This file is part of the OpenJPH software implementation.
33// File: test_executables.cpp
34// Author: Aous Naman
35// Date: 30 December 2022
36//***************************************************************************/
37
38#include <array>
39#include <string>
40#include "ojph_arch.h"
41#include "gtest/gtest.h"
42
44// STATIC ojph_popen
46static inline
47FILE* ojph_popen(const char* command, const char* modes)
48{
49#ifdef OJPH_COMPILER_MSVC
50 return _popen(command, modes);
51#else
52 return popen(command, modes);
53#endif
54}
55
57// STATIC ojph_pclose
59static inline
60int ojph_pclose(FILE* stream)
61{
62#ifdef OJPH_COMPILER_MSVC
63 return _pclose(stream);
64#else
65 return pclose(stream);
66#endif
67}
68
70// STATIC execute
72static
73int execute(const std::string& cmd, std::string& result)
74{
75 std::array<char, 128> buffer;
76 result.clear();
77
78 FILE* pipe = ojph_popen(cmd.c_str(), "r");
79 if (!pipe)
80 throw std::runtime_error("ojph_popen() failed!");
81
82 while (!feof(pipe))
83 if (fgets(buffer.data(), 128, pipe) != nullptr)
84 result += buffer.data();
85
86 int rc = ojph_pclose(pipe);
87 if (rc != EXIT_SUCCESS)
88 return 1;
89 return 0;
90}
91
93// MACROS
95
96#ifdef OJPH_OS_WINDOWS
97#define SRC_FILE_DIR ".\\jp2k_test_codestreams\\openjph\\"
98#define OUT_FILE_DIR ".\\"
99#define REF_FILE_DIR ".\\jp2k_test_codestreams\\openjph\\references\\"
100#define MSE_PAE_PATH ".\\mse_pae"
101#define COMPARE_FILES_PATH ".\\compare_files"
102#define EXPAND_EXECUTABLE ".\\ojph_expand.exe"
103#define COMPRESS_EXECUTABLE ".\\ojph_compress.exe"
104#else
105#define SRC_FILE_DIR "./jp2k_test_codestreams/openjph/"
106#define OUT_FILE_DIR "./"
107#define REF_FILE_DIR "./jp2k_test_codestreams/openjph/references/"
108#define MSE_PAE_PATH "./mse_pae"
109#define COMPARE_FILES_PATH "./compare_files"
110
111// This is a comment to me, to help with emscripten testing.
112// This is written after the completion of the tests.
113// 1. Compile for the target platform (Linux), selecting from the following
114// code the version that suits you; in particular it should be the one
115// the uses node. Ideally create two versions of test_executables, one
116// for WASM SIMD, and for WASM without SIMD -- use linux cp command to
117// create test_executables_simd and test_executables_no_simd
118// 2. Compile again, without deleting what compiled; this time compile using
119// emscripten, targeting WASM. The compilation is very finicky, do
120// 'make clean && make' after every change in code.
121// 3. cd to tests, and run test_executables_simd or test_executables_no_simd.
122
123#define EXPAND_EXECUTABLE "./ojph_expand"
124#define COMPRESS_EXECUTABLE "./ojph_compress"
125//#define EXPAND_EXECUTABLE "20.18.0_64bit/bin/node ./ojph_expand.js"
126//#define COMPRESS_EXECUTABLE "20.18.0_64bit/bin/node ./ojph_compress.js"
127//#define EXPAND_EXECUTABLE "node-v18.7.0-linux-x64/bin/node ./ojph_expand_simd.js"
128//#define COMPRESS_EXECUTABLE "node-v18.7.0-linux-x64/bin/node ./ojph_compress_simd.js"
129//#define EXPAND_EXECUTABLE "./../../../sde/sde64 -skx -- ./ojph_expand"
130//#define COMPRESS_EXECUTABLE "./../../../sde/sde64 -skx -- ./ojph_compress"
131#endif
132#define TOL_DOUBLE 0.01
133#define TOL_INTEGER 1
134
136// run_ojph_compress
138void run_ojph_compress(const std::string& ref_filename,
139 const std::string& base_filename,
140 const std::string& extended_base_fname,
141 const std::string& out_ext,
142 const std::string& extra_options)
143{
144 try {
145 std::string result, command;
146 command = std::string(COMPRESS_EXECUTABLE)
147 + " -i " + REF_FILE_DIR + ref_filename
148 + " -o " + OUT_FILE_DIR + base_filename + extended_base_fname +
149 "." + out_ext + " " + extra_options;
150 EXPECT_EQ(execute(command, result), 0);
151 }
152 catch (const std::runtime_error& error) {
153 FAIL() << error.what();
154 }
155}
156
158// run_ojph_expand
160void run_ojph_expand(const std::string& base_filename,
161 const std::string& src_ext,
162 const std::string& out_ext)
163{
164 try {
165 std::string result, command;
166 command = std::string(EXPAND_EXECUTABLE)
167 + " -i " + SRC_FILE_DIR + base_filename + "." + src_ext
168 + " -o " + OUT_FILE_DIR + base_filename + "." + out_ext;
169 EXPECT_EQ(execute(command, result), 0);
170 }
171 catch (const std::runtime_error& error) {
172 FAIL() << error.what();
173 }
174}
175
177// run_ojph_compress
179void run_ojph_compress_expand(const std::string& base_filename,
180 const std::string& out_ext,
181 const std::string& decode_ext)
182{
183 try {
184 std::string result, command;
185 command = std::string(EXPAND_EXECUTABLE)
186 + " -i " + OUT_FILE_DIR + base_filename + "." + out_ext
187 + " -o " + OUT_FILE_DIR + base_filename + "." + decode_ext;
188 EXPECT_EQ(execute(command, result), 0);
189 }
190 catch (const std::runtime_error& error) {
191 FAIL() << error.what();
192 }
193}
194
196// run_mse_pae
198void run_mse_pae(const std::string& base_filename,
199 const std::string& out_ext,
200 const std::string& ref_filename,
201 const std::string& yuv_specs,
202 int num_components, double* mse, int* pae)
203{
204 try {
205 std::string result, command;
206 command = std::string(MSE_PAE_PATH)
207 + " " + OUT_FILE_DIR + base_filename + "." + out_ext + yuv_specs
208 + " " + REF_FILE_DIR + ref_filename + yuv_specs;
209 EXPECT_EQ(execute(command, result), 0);
210
211 size_t pos = 0;
212 for (int c = 0; c < num_components; ++c) {
213 if (pos < result.length()) {
214 double valf = atof(result.c_str() + pos);
215 EXPECT_NEAR((valf - mse[c]) / (valf + TOL_DOUBLE), 0.0, TOL_DOUBLE);
216 }
217 else {
218 FAIL() << "mse_pae result string does not have enough entries.";
219 }
220 pos = result.find(" ", pos);
221 if (pos != std::string::npos)
222 ++pos;
223 if (pos < result.length()) {
224 int vali = atoi(result.c_str() + pos);
225 EXPECT_NEAR(vali, pae[c], TOL_INTEGER);
226 }
227 else {
228 FAIL() << "mse_pae result string does not have enough entries.";
229 }
230 pos = result.find("\n", pos);
231 if (pos != std::string::npos)
232 ++pos;
233 }
234 }
235 catch (const std::runtime_error& error) {
236 FAIL() << error.what();
237 }
238}
239
241// compare_files
243void compare_files(const std::string& base_filename,
244 const std::string& extended_base_fname,
245 const std::string& ext)
246{
247 try {
248 std::string result, command;
249 command = std::string(COMPARE_FILES_PATH)
250 + " " + OUT_FILE_DIR + base_filename + extended_base_fname + "." + ext
251 + " " + SRC_FILE_DIR + base_filename + "." + ext;
252 EXPECT_EQ(execute(command, result), 0);
253 }
254 catch (const std::runtime_error& error) {
255 FAIL() << error.what();
256 }
257}
258
260// run_ojph_compress_raw
262// Same as run_ojph_compress, but the input file is one the test generated in
263// OUT_FILE_DIR rather than one of the reference files.
264void run_ojph_compress_raw(const std::string& src_filename,
265 const std::string& base_filename,
266 const std::string& out_ext,
267 const std::string& extra_options)
268{
269 try {
270 std::string result, command;
271 command = std::string(COMPRESS_EXECUTABLE)
272 + " -i " + OUT_FILE_DIR + src_filename
273 + " -o " + OUT_FILE_DIR + base_filename + "." + out_ext
274 + " " + extra_options;
275 EXPECT_EQ(execute(command, result), 0);
276 }
277 catch (const std::runtime_error& error) {
278 FAIL() << error.what();
279 }
280}
281
283// raw_test_sample
285// The .raw tests below all use one frame shape, RAW_TEST_WIDTH by
286// RAW_TEST_HEIGHT, and fill it with a ramp that starts at the smallest and
287// ends at the largest sample the component can hold. The two dimensions
288// multiply to 65536, so for a 16 bit component the ramp's step is exactly 1
289// and one frame sweeps every value a 16 bit sample can take, exactly once;
290// for the other widths the ramp covers the whole range in even steps, and the
291// two ends of the range are always included.
292#define RAW_TEST_WIDTH 256
293#define RAW_TEST_HEIGHT 256
294#define RAW_TEST_NUM_SAMPLES (RAW_TEST_WIDTH * RAW_TEST_HEIGHT)
295
296static
298 bool is_signed)
299{
300 ojph::si64 lower, upper;
301 if (is_signed) {
302 upper = ((ojph::si64)1 << (bit_depth - 1)) - 1;
303 lower = -((ojph::si64)1 << (bit_depth - 1));
304 }
305 else {
306 upper = ((ojph::si64)1 << bit_depth) - 1;
307 lower = 0;
308 }
309 return lower
310 + (ojph::si64)idx * (upper - lower) / (RAW_TEST_NUM_SAMPLES - 1);
311}
312
314// write_raw_test_file
316// Writes the frame described above to OUT_FILE_DIR as a one component .raw
317// file. .raw files hold samples least significant byte first; the bytes are
318// composed with shifts rather than by copying a wider integer, so that the
319// file this writes is identical on little- and big-endian machines.
320void write_raw_test_file(const std::string& filename, ojph::ui32 bit_depth,
321 bool is_signed)
322{
323 std::string name = std::string(OUT_FILE_DIR) + filename;
324 FILE* f = fopen(name.c_str(), "wb");
325 if (f == NULL) {
326 FAIL() << "Unable to open file " << name << " for writing.";
327 return;
328 }
329
330 ojph::ui32 bytes_per_sample = (bit_depth + 7) >> 3;
331 ojph::ui8 line[RAW_TEST_WIDTH * 4];
332 size_t line_size = (size_t)RAW_TEST_WIDTH * bytes_per_sample;
333 for (ojph::ui32 y = 0; y < RAW_TEST_HEIGHT; ++y) {
334 ojph::ui8* dp = line;
335 for (ojph::ui32 x = 0; x < RAW_TEST_WIDTH; ++x) {
336 ojph::ui32 idx = y * RAW_TEST_WIDTH + x;
337 ojph::ui64 val = (ojph::ui64)raw_test_sample(idx, bit_depth, is_signed);
338 for (ojph::ui32 b = 0; b < bytes_per_sample; ++b)
339 *dp++ = (ojph::ui8)((val >> (8 * b)) & 0xFFu);
340 }
341 EXPECT_EQ(fwrite(line, 1, line_size, f), line_size);
342 }
343 fclose(f);
344}
345
347// compare_raw_test_file
349// Checks a decoded one component .raw file against the frame that
350// write_raw_test_file() wrote, sample by sample. The sign of a negative
351// sample is recovered with an explicit subtraction, so that this reads the
352// file the same way on little- and big-endian machines.
353void compare_raw_test_file(const std::string& filename, ojph::ui32 bit_depth,
354 bool is_signed)
355{
356 std::string name = std::string(OUT_FILE_DIR) + filename;
357 FILE* f = fopen(name.c_str(), "rb");
358 if (f == NULL) {
359 FAIL() << "Unable to open file " << name << " for reading.";
360 return;
361 }
362
363 ojph::ui32 bytes_per_sample = (bit_depth + 7) >> 3;
364 ojph::ui64 sign_bit = (ojph::ui64)1 << (8 * bytes_per_sample - 1);
365 ojph::ui32 num_mismatches = 0, first_idx = 0;
366 ojph::si64 first_expected = 0, first_found = 0;
367 ojph::ui8 line[RAW_TEST_WIDTH * 4];
368 size_t line_size = (size_t)RAW_TEST_WIDTH * bytes_per_sample;
369 for (ojph::ui32 y = 0; y < RAW_TEST_HEIGHT; ++y) {
370 if (fread(line, 1, line_size, f) != line_size) {
371 fclose(f);
372 FAIL() << "Not enough data in file " << name << ".";
373 return;
374 }
375 const ojph::ui8* sp = line;
376 for (ojph::ui32 x = 0; x < RAW_TEST_WIDTH; ++x) {
377 ojph::ui64 val = 0;
378 for (ojph::ui32 b = 0; b < bytes_per_sample; ++b)
379 val |= (ojph::ui64)*sp++ << (8 * b);
380 ojph::si64 found = (ojph::si64)val;
381 if (is_signed && (val & sign_bit))
382 found -= (ojph::si64)sign_bit << 1;
383
384 ojph::ui32 idx = y * RAW_TEST_WIDTH + x;
385 ojph::si64 expected = raw_test_sample(idx, bit_depth, is_signed);
386 if (found != expected) {
387 if (num_mismatches == 0) {
388 first_idx = idx;
389 first_expected = expected;
390 first_found = found;
391 }
392 ++num_mismatches;
393 }
394 }
395 }
396 fclose(f);
397
398 EXPECT_EQ(num_mismatches, 0u) << num_mismatches << " of "
399 << RAW_TEST_NUM_SAMPLES << " samples do not survive the round trip; the "
400 "first is sample " << first_idx << ", which should be " << first_expected
401 << " but is " << first_found << ".";
402}
403
405// run_raw_round_trip_test
407// Writes a .raw file of the given width and signedness, encodes it
408// reversibly, decodes it, and requires the round trip to be bit exact.
409void run_raw_round_trip_test(const std::string& base_filename,
410 ojph::ui32 bit_depth, bool is_signed)
411{
412 std::string src_filename = base_filename + "_src.raw";
413 std::string signedness = is_signed ? "true" : "false";
414 char bit_depth_str[16];
415 snprintf(bit_depth_str, sizeof(bit_depth_str), "%d", (int)bit_depth);
416
417 write_raw_test_file(src_filename, bit_depth, is_signed);
418 run_ojph_compress_raw(src_filename, base_filename, "j2c",
419 "-reversible true -dims \"{256,256}\" -num_comps 1"
420 " -downsamp \"{1,1}\" -bit_depth "
421 + std::string(bit_depth_str)
422 + " -signed " + signedness);
423 run_ojph_compress_expand(base_filename, "j2c", "raw");
424 compare_raw_test_file(base_filename + ".raw", bit_depth, is_signed);
425}
426
428// tests
430
432// Test ojph_compress on its own
433TEST(TestExecutables, OpenJPHCompressNoArguments) {
434 try {
435 std::string result;
436 EXPECT_EQ(execute(COMPRESS_EXECUTABLE, result), 1);
437 }
438 catch (const std::runtime_error& error) {
439 FAIL() << error.what();
440 }
441}
442
444// Test ojph_expand on its own
445TEST(TestExecutables, OpenJPHExpandNoArguments) {
446 try {
447 std::string result;
448 EXPECT_EQ(execute(EXPAND_EXECUTABLE, result), 1);
449 }
450 catch (const std::runtime_error& error) {
451 FAIL() << error.what();
452 }
453}
454
456// other tests
458
460// Test ojph_expand with codeblocks when the irv97 wavelet is used.
461// Command-line options used to obtain this file is:
462// -o simple_dec_irv97_64x64.jph -precise -quiet -rate 0.5 -full
463TEST(TestExecutables, SimpleDecIrv9764x64) {
464 double mse[3] = { 39.2812, 36.3819, 47.642};
465 int pae[3] = { 74, 77, 73};
466 run_ojph_expand("simple_dec_irv97_64x64", "jph", "ppm");
467 run_mse_pae("simple_dec_irv97_64x64", "ppm", "Malamute.ppm",
468 "", 3, mse, pae);
469}
470
472// Test ojph_expand with codeblocks when the irv97 wavelet is used.
473// Command-line options used to obtain this file is:
474// -o simple_dec_irv97_32x32.jph -precise -quiet -rate 1 Cblk={32,32} -full
475TEST(TestExecutables, SimpleDecIrv9732x32) {
476 double mse[3] = { 18.6979, 17.1208, 22.7539};
477 int pae[3] = { 51, 48, 46};
478 run_ojph_expand("simple_dec_irv97_32x32", "jph", "ppm");
479 run_mse_pae("simple_dec_irv97_32x32", "ppm", "Malamute.ppm",
480 "", 3, mse, pae);
481}
482
484// Test ojph_expand with codeblocks when the irv97 wavelet is used.
485// Command-line options used to obtain this file is:
486// -o simple_dec_irv97_16x16.jph -precise -quiet -rate 1 Cblk={16,16} -full
487TEST(TestExecutables, SimpleDecIrv9716x16) {
488 double mse[3] = { 20.1706, 18.5427, 24.6146};
489 int pae[3] = { 53, 51, 47};
490 run_ojph_expand("simple_dec_irv97_16x16", "jph", "ppm");
491 run_mse_pae("simple_dec_irv97_16x16", "ppm", "Malamute.ppm",
492 "", 3, mse, pae);
493}
494
496// Test ojph_expand with codeblocks when the irv97 wavelet is used.
497// Command-line options used to obtain this file is:
498// -o simple_dec_irv97_4x4.jph -precise -quiet -rate 1 Cblk={4,4} -full
499TEST(TestExecutables, SimpleDecIrv974x4) {
500 double mse[3] = { 40.8623, 37.9308, 49.7276};
501 int pae[3] = { 75, 77, 80};
502 run_ojph_expand("simple_dec_irv97_4x4", "jph", "ppm");
503 run_mse_pae("simple_dec_irv97_4x4", "ppm", "Malamute.ppm",
504 "", 3, mse, pae);
505}
506
508// Test ojph_expand with codeblocks when the irv97 wavelet is used.
509// Command-line options used to obtain this file is:
510// -o simple_dec_irv97_1024x4.jph -precise -quiet -rate 1 Cblk={1024,4} -full
511TEST(TestExecutables, SimpleDecIrv971024x4) {
512 double mse[3] = { 19.8275, 18.2511, 24.2832};
513 int pae[3] = { 53, 52, 50};
514 run_ojph_expand("simple_dec_irv97_1024x4", "jph", "ppm");
515 run_mse_pae("simple_dec_irv97_1024x4", "ppm", "Malamute.ppm",
516 "", 3, mse, pae);
517}
518
520// Test ojph_expand with codeblocks when the irv97 wavelet is used.
521// Command-line options used to obtain this file is:
522// -o simple_dec_irv97_4x1024.jph -precise -quiet -rate 1 Cblk={4,1024} -full
523TEST(TestExecutables, SimpleDecIrv974x1024) {
524 double mse[3] = { 19.9635, 18.4063, 24.1719};
525 int pae[3] = { 51, 48, 51};
526 run_ojph_expand("simple_dec_irv97_4x1024", "jph", "ppm");
527 run_mse_pae("simple_dec_irv97_4x1024", "ppm", "Malamute.ppm",
528 "", 3, mse, pae);
529}
530
532// Test ojph_expand with codeblocks when the irv97 wavelet is used.
533// Command-line options used to obtain this file is:
534// -o simple_dec_irv97_512x8.jph -precise -quiet -rate 1 Cblk={512,8} -full
535TEST(TestExecutables, SimpleDecIrv97512x8) {
536 double mse[3] = { 18.7929, 17.2026, 22.9922};
537 int pae[3] = { 53, 52, 50};
538 run_ojph_expand("simple_dec_irv97_512x8", "jph", "ppm");
539 run_mse_pae("simple_dec_irv97_512x8", "ppm", "Malamute.ppm",
540 "", 3, mse, pae);
541}
542
544// Test ojph_expand with codeblocks when the irv97 wavelet is used.
545// Command-line options used to obtain this file is:
546// -o simple_dec_irv97_8x512.jph -precise -quiet -rate 1 Cblk={8,512} -full
547TEST(TestExecutables, SimpleDecIrv978x512) {
548 double mse[3] = { 19.3661, 17.8067, 23.4574};
549 int pae[3] = { 51, 48, 52};
550 run_ojph_expand("simple_dec_irv97_8x512", "jph", "ppm");
551 run_mse_pae("simple_dec_irv97_8x512", "ppm", "Malamute.ppm",
552 "", 3, mse, pae);
553}
554
556// Test ojph_expand with codeblocks when the irv97 wavelet is used.
557// Command-line options used to obtain this file is:
558// -o simple_dec_irv97_256x16.jph -precise -quiet -rate 1 Cblk={256,16} -full
559TEST(TestExecutables, SimpleDecIrv97256x16) {
560 double mse[3] = { 18.6355, 17.0963, 22.6076};
561 int pae[3] = { 54, 51, 48};
562 run_ojph_expand("simple_dec_irv97_256x16", "jph", "ppm");
563 run_mse_pae("simple_dec_irv97_256x16", "ppm", "Malamute.ppm",
564 "", 3, mse, pae);
565}
566
568// Test ojph_expand with codeblocks when the irv97 wavelet is used.
569// Command-line options used to obtain this file is:
570// -o simple_dec_irv97_16x256.jph -precise -quiet -rate 1 Cblk={16,256} -full
571TEST(TestExecutables, SimpleDecIrv9716x256) {
572 double mse[3] = { 18.5933, 17.0208, 22.5709};
573 int pae[3] = { 51, 48, 47};
574 run_ojph_expand("simple_dec_irv97_16x256", "jph", "ppm");
575 run_mse_pae("simple_dec_irv97_16x256", "ppm", "Malamute.ppm",
576 "", 3, mse, pae);
577}
578
580// Test ojph_expand with codeblocks when the irv97 wavelet is used.
581// Command-line options used to obtain this file is:
582// -o simple_dec_irv97_128x32.jph -precise -quiet -rate 1 Cblk={128,32} -full
583TEST(TestExecutables, SimpleDecIrv97128x32) {
584 double mse[3] = { 18.4443, 16.9133, 22.4193};
585 int pae[3] = { 52, 50, 46};
586 run_ojph_expand("simple_dec_irv97_128x32", "jph", "ppm");
587 run_mse_pae("simple_dec_irv97_128x32", "ppm", "Malamute.ppm",
588 "", 3, mse, pae);
589}
590
592// Test ojph_expand with codeblocks when the irv97 wavelet is used.
593// Command-line options used to obtain this file is:
594// -o simple_dec_irv97_32x128.jph -precise -quiet -rate 1 Cblk={32,128} -full
595TEST(TestExecutables, SimpleDecIrv9732x128) {
596 double mse[3] = { 18.4874, 16.9379, 22.4855};
597 int pae[3] = { 51, 48, 45};
598 run_ojph_expand("simple_dec_irv97_32x128", "jph", "ppm");
599 run_mse_pae("simple_dec_irv97_32x128", "ppm", "Malamute.ppm",
600 "", 3, mse, pae);
601}
602
604// Test ojph_expand with codeblocks when the rev53 wavelet is used.
605// Command-line options used to obtain this file is:
606// -o simple_dec_rev53_64x64.jph -precise -quiet Creversible=yes -full
607TEST(TestExecutables, SimpleDecRev5364x64) {
608 double mse[3] = { 0, 0, 0};
609 int pae[3] = { 0, 0, 0};
610 run_ojph_expand("simple_dec_rev53_64x64", "jph", "ppm");
611 run_mse_pae("simple_dec_rev53_64x64", "ppm", "Malamute.ppm",
612 "", 3, mse, pae);
613}
614
616// Test ojph_expand with codeblocks when the rev53 wavelet is used.
617// Command-line options used to obtain this file is:
618// -o simple_dec_rev53_32x32.jph -precise -quiet Creversible=yes Cblk={32,32}
619// -full
620TEST(TestExecutables, SimpleDecRev5332x32) {
621 double mse[3] = { 0, 0, 0};
622 int pae[3] = { 0, 0, 0};
623 run_ojph_expand("simple_dec_rev53_32x32", "jph", "ppm");
624 run_mse_pae("simple_dec_rev53_32x32", "ppm", "Malamute.ppm",
625 "", 3, mse, pae);
626}
627
629// Test ojph_expand with codeblocks when the rev53 wavelet is used.
630// Command-line options used to obtain this file is:
631// -o simple_dec_rev53_4x4.jph -precise -quiet Creversible=yes Cblk={4,4}
632// -full
633TEST(TestExecutables, SimpleDecRev534x4) {
634 double mse[3] = { 0, 0, 0};
635 int pae[3] = { 0, 0, 0};
636 run_ojph_expand("simple_dec_rev53_4x4", "jph", "ppm");
637 run_mse_pae("simple_dec_rev53_4x4", "ppm", "Malamute.ppm",
638 "", 3, mse, pae);
639}
640
642// Test ojph_expand with codeblocks when the rev53 wavelet is used.
643// Command-line options used to obtain this file is:
644// -o simple_dec_rev53_1024x4.jph -precise -quiet Creversible=yes
645// Cblk={1024,4} -full
646TEST(TestExecutables, SimpleDecRev531024x4) {
647 double mse[3] = { 0, 0, 0};
648 int pae[3] = { 0, 0, 0};
649 run_ojph_expand("simple_dec_rev53_1024x4", "jph", "ppm");
650 run_mse_pae("simple_dec_rev53_1024x4", "ppm", "Malamute.ppm",
651 "", 3, mse, pae);
652}
653
655// Test ojph_expand with codeblocks when the rev53 wavelet is used.
656// Command-line options used to obtain this file is:
657// -o simple_dec_rev53_4x1024.jph -precise -quiet Creversible=yes
658// Cblk={4,1024} -full
659TEST(TestExecutables, SimpleDecRev534x1024) {
660 double mse[3] = { 0, 0, 0};
661 int pae[3] = { 0, 0, 0};
662 run_ojph_expand("simple_dec_rev53_4x1024", "jph", "ppm");
663 run_mse_pae("simple_dec_rev53_4x1024", "ppm", "Malamute.ppm",
664 "", 3, mse, pae);
665}
666
668// Test ojph_expand with codeblocks when the irv97 wavelet is used.
669// and the color components are subsampled.
670// Command-line options used to obtain this file is:
671// -o simple_dec_irv97_64x64_yuv.jph -precise -quiet -rate 0.5
672// Sdims={288,352},{144,176},{144,176} Ssampling={1,1},{2,2},{2,2}
673// Nprecision={8} Nsigned={no} -full
674TEST(TestExecutables, SimpleDecIrv9764x64Yuv) {
675 double mse[3] = { 20.2778, 6.27912, 4.15937};
676 int pae[3] = { 52, 22, 31};
677 run_ojph_expand("simple_dec_irv97_64x64_yuv", "jph", "yuv");
678 run_mse_pae("simple_dec_irv97_64x64_yuv", "yuv", "foreman_420.yuv",
679 ":352x288x8x420", 3, mse, pae);
680}
681
683// Test ojph_expand with codeblocks when the rev53 wavelet is used.
684// and the color components are subsampled.
685// Command-line options used to obtain this file is:
686// -o simple_dec_rev53_64x64_yuv.jph -precise -quiet Creversible=yes
687// Sdims={288,352},{144,176},{144,176} Ssampling={1,1},{2,2},{2,2}
688// Nprecision={8} Nsigned={no} -full
689TEST(TestExecutables, SimpleDecRev5364x64Yuv) {
690 double mse[3] = { 0, 0, 0};
691 int pae[3] = { 0, 0, 0};
692 run_ojph_expand("simple_dec_rev53_64x64_yuv", "jph", "yuv");
693 run_mse_pae("simple_dec_rev53_64x64_yuv", "yuv", "foreman_420.yuv",
694 ":352x288x8x420", 3, mse, pae);
695}
696
698// Test ojph_expand with codeblocks when the irv97 wavelet is used.
699// and the color components are subsampled.
700// Command-line options used to obtain this file is:
701// -o simple_dec_irv97_64x64_tiles_yuv.jph -precise -quiet -rate 0.5
702// Sdims={288,352},{144,176},{144,176} Ssampling={1,1},{2,2},{2,2}
703// Nprecision={8} Nsigned={no} Stiles={33,257} -full
704TEST(TestExecutables, SimpleDecIrv9764x64TilesYuv) {
705 double mse[3] = { 34.4972, 10.1112, 7.96331};
706 int pae[3] = { 67, 30, 39};
707 run_ojph_expand("simple_dec_irv97_64x64_tiles_yuv", "jph", "yuv");
708 run_mse_pae("simple_dec_irv97_64x64_tiles_yuv", "yuv", "foreman_420.yuv",
709 ":352x288x8x420", 3, mse, pae);
710}
711
713// Test ojph_expand with codeblocks when the rev53 wavelet is used.
714// and the color components are subsampled.
715// Command-line options used to obtain this file is:
716// -o simple_dec_rev53_64x64_tiles_yuv.jph -precise -quiet Creversible=yes
717// Sdims={288,352},{144,176},{144,176} Ssampling={1,1},{2,2},{2,2}
718// Nprecision={8} Nsigned={no} Stiles={33,257} -full
719TEST(TestExecutables, SimpleDecRev5364x64TilesYuv) {
720 double mse[3] = { 0, 0, 0};
721 int pae[3] = { 0, 0, 0};
722 run_ojph_expand("simple_dec_rev53_64x64_tiles_yuv", "jph", "yuv");
723 run_mse_pae("simple_dec_rev53_64x64_tiles_yuv", "yuv", "foreman_420.yuv",
724 ":352x288x8x420", 3, mse, pae);
725}
726
728// Test ojph_expand with codeblocks when the irv97 wavelet is used.
729// Command-line options used to obtain this file is:
730// -o simple_dec_irv97_64x64_tiles_LRCP.jph -precise -quiet -rate 0.5
731// Clevels=5 Corder=LRCP Cprecincts={2,256} Sorigin={374,1717}
732// Stile_origin={374,1717} -full
733TEST(TestExecutables, SimpleDecIrv9764x64TilesLRCP) {
734 double mse[3] = { 71.8149, 68.7115, 89.4001};
735 int pae[3] = { 78, 78, 83};
736 run_ojph_expand("simple_dec_irv97_64x64_tiles_LRCP", "jph", "ppm");
737 run_mse_pae("simple_dec_irv97_64x64_tiles_LRCP", "ppm", "Malamute.ppm",
738 "", 3, mse, pae);
739}
740
742// Test ojph_expand with codeblocks when the irv97 wavelet is used.
743// Command-line options used to obtain this file is:
744// -o simple_dec_irv97_64x64_tiles_RLCP.jph -precise -quiet -rate 0.5
745// Clevels=5 Corder=RLCP Cprecincts={2,256} Sorigin={374,1717}
746// Stile_origin={374,1717} -full
747TEST(TestExecutables, SimpleDecIrv9764x64TilesRLCP) {
748 double mse[3] = { 71.8149, 68.7115, 89.4001};
749 int pae[3] = { 78, 78, 83};
750 run_ojph_expand("simple_dec_irv97_64x64_tiles_RLCP", "jph", "ppm");
751 run_mse_pae("simple_dec_irv97_64x64_tiles_RLCP", "ppm", "Malamute.ppm",
752 "", 3, mse, pae);
753}
754
756// Test ojph_expand with codeblocks when the irv97 wavelet is used.
757// Command-line options used to obtain this file is:
758// -o simple_dec_irv97_64x64_tiles_RPCL.jph -precise -quiet -rate 0.5
759// Clevels=5 Corder=RPCL Cprecincts={2,256} Sorigin={374,1717}
760// Stile_origin={374,1717} -full
761TEST(TestExecutables, SimpleDecIrv9764x64TilesRPCL) {
762 double mse[3] = { 71.8149, 68.7115, 89.4001};
763 int pae[3] = { 78, 78, 83};
764 run_ojph_expand("simple_dec_irv97_64x64_tiles_RPCL", "jph", "ppm");
765 run_mse_pae("simple_dec_irv97_64x64_tiles_RPCL", "ppm", "Malamute.ppm",
766 "", 3, mse, pae);
767}
768
770// Test ojph_expand with codeblocks when the irv97 wavelet is used.
771// Command-line options used to obtain this file is:
772// -o simple_dec_irv97_64x64_tiles_PCRL.jph -precise -quiet -rate 0.5
773// Clevels=5 Corder=PCRL Cprecincts={2,256} Sorigin={374,1717}
774// Stile_origin={374,1717} -full
775TEST(TestExecutables, SimpleDecIrv9764x64TilesPCRL) {
776 double mse[3] = { 71.8149, 68.7115, 89.4001};
777 int pae[3] = { 78, 78, 83};
778 run_ojph_expand("simple_dec_irv97_64x64_tiles_PCRL", "jph", "ppm");
779 run_mse_pae("simple_dec_irv97_64x64_tiles_PCRL", "ppm", "Malamute.ppm",
780 "", 3, mse, pae);
781}
782
784// Test ojph_expand with codeblocks when the irv97 wavelet is used.
785// Command-line options used to obtain this file is:
786// -o simple_dec_irv97_64x64_tiles_CPRL.jph -precise -quiet -rate 0.5
787// Clevels=5 Corder=CPRL Cprecincts={2,256} Sorigin={374,1717}
788// Stile_origin={374,1717} -full
789TEST(TestExecutables, SimpleDecIrv9764x64TilesCPRL) {
790 double mse[3] = { 71.8149, 68.7115, 89.4001};
791 int pae[3] = { 78, 78, 83};
792 run_ojph_expand("simple_dec_irv97_64x64_tiles_CPRL", "jph", "ppm");
793 run_mse_pae("simple_dec_irv97_64x64_tiles_CPRL", "ppm", "Malamute.ppm",
794 "", 3, mse, pae);
795}
796
798// Test ojph_expand with codeblocks when the irv97 wavelet is used.
799// Command-line options used to obtain this file is:
800// -o simple_dec_irv97_64x64_tiles_LRCP33.jph -precise -quiet -rate 0.5
801// Clevels=5 Corder=LRCP Sorigin={5,33} Stile_origin={5,10} Stiles={33,257}
802// -full
803TEST(TestExecutables, SimpleDecIrv9764x64TilesLRCP33) {
804 double mse[3] = { 56.2139, 51.4121, 69.0107};
805 int pae[3] = { 80, 81, 98};
806 run_ojph_expand("simple_dec_irv97_64x64_tiles_LRCP33", "jph", "ppm");
807 run_mse_pae("simple_dec_irv97_64x64_tiles_LRCP33", "ppm", "Malamute.ppm",
808 "", 3, mse, pae);
809}
810
812// Test ojph_expand with codeblocks when the irv97 wavelet is used.
813// Command-line options used to obtain this file is:
814// -o simple_dec_irv97_64x64_tiles_RLCP33.jph -precise -quiet -rate 0.5
815// Clevels=5 Corder=RLCP Sorigin={5,33} Stile_origin={5,10} Stiles={33,257}
816// -full
817TEST(TestExecutables, SimpleDecIrv9764x64TilesRLCP33) {
818 double mse[3] = { 56.2139, 51.4121, 69.0107};
819 int pae[3] = { 80, 81, 98};
820 run_ojph_expand("simple_dec_irv97_64x64_tiles_RLCP33", "jph", "ppm");
821 run_mse_pae("simple_dec_irv97_64x64_tiles_RLCP33", "ppm", "Malamute.ppm",
822 "", 3, mse, pae);
823}
824
826// Test ojph_expand with codeblocks when the irv97 wavelet is used.
827// Command-line options used to obtain this file is:
828// -o simple_dec_irv97_64x64_tiles_RPCL33.jph -precise -quiet -rate 0.5
829// Clevels=5 Corder=RPCL Sorigin={5,33} Stile_origin={5,10} Stiles={33,257}
830// -full
831TEST(TestExecutables, SimpleDecIrv9764x64TilesRPCL33) {
832 double mse[3] = { 56.2139, 51.4121, 69.0107};
833 int pae[3] = { 80, 81, 98};
834 run_ojph_expand("simple_dec_irv97_64x64_tiles_RPCL33", "jph", "ppm");
835 run_mse_pae("simple_dec_irv97_64x64_tiles_RPCL33", "ppm", "Malamute.ppm",
836 "", 3, mse, pae);
837}
838
840// Test ojph_expand with codeblocks when the irv97 wavelet is used.
841// Command-line options used to obtain this file is:
842// -o simple_dec_irv97_64x64_tiles_PCRL33.jph -precise -quiet -rate 0.5
843// Clevels=5 Corder=PCRL Sorigin={5,33} Stile_origin={5,10} Stiles={33,257}
844// -full
845TEST(TestExecutables, SimpleDecIrv9764x64TilesPCRL33) {
846 double mse[3] = { 56.2139, 51.4121, 69.0107};
847 int pae[3] = { 80, 81, 98};
848 run_ojph_expand("simple_dec_irv97_64x64_tiles_PCRL33", "jph", "ppm");
849 run_mse_pae("simple_dec_irv97_64x64_tiles_PCRL33", "ppm", "Malamute.ppm",
850 "", 3, mse, pae);
851}
852
854// Test ojph_expand with codeblocks when the irv97 wavelet is used.
855// Command-line options used to obtain this file is:
856// -o simple_dec_irv97_64x64_tiles_CPRL33.jph -precise -quiet -rate 0.5
857// Clevels=5 Corder=CPRL Sorigin={5,33} Stile_origin={5,10} Stiles={33,257}
858// -full
859TEST(TestExecutables, SimpleDecIrv9764x64TilesCPRL33) {
860 double mse[3] = { 56.2139, 51.4121, 69.0107};
861 int pae[3] = { 80, 81, 98};
862 run_ojph_expand("simple_dec_irv97_64x64_tiles_CPRL33", "jph", "ppm");
863 run_mse_pae("simple_dec_irv97_64x64_tiles_CPRL33", "ppm", "Malamute.ppm",
864 "", 3, mse, pae);
865}
866
868// Test ojph_expand with codeblocks when the irv97 wavelet is used.
869// Command-line options used to obtain this file is:
870// -o simple_dec_irv97_64x64_tiles_LRCP33x33.jph -precise -quiet -rate 0.5
871// Clevels=5 Corder=LRCP Sorigin={5,33} Stile_origin={5,10} Stiles={33,33}
872// -full
873TEST(TestExecutables, SimpleDecIrv9764x64TilesLRCP33x33) {
874 double mse[3] = { 210.283, 210.214, 257.276};
875 int pae[3] = { 165, 161, 166};
876 run_ojph_expand("simple_dec_irv97_64x64_tiles_LRCP33x33", "jph", "ppm");
877 run_mse_pae("simple_dec_irv97_64x64_tiles_LRCP33x33", "ppm", "Malamute.ppm",
878 "", 3, mse, pae);
879}
880
882// Test ojph_expand with codeblocks when the irv97 wavelet is used.
883// Command-line options used to obtain this file is:
884// -o simple_dec_irv97_64x64_tiles_RLCP33x33.jph -precise -quiet -rate 0.5
885// Clevels=5 Corder=RLCP Sorigin={5,33} Stile_origin={5,10} Stiles={33,33}
886// -full
887TEST(TestExecutables, SimpleDecIrv9764x64TilesRLCP33x33) {
888 double mse[3] = { 210.283, 210.214, 257.276};
889 int pae[3] = { 165, 161, 166};
890 run_ojph_expand("simple_dec_irv97_64x64_tiles_RLCP33x33", "jph", "ppm");
891 run_mse_pae("simple_dec_irv97_64x64_tiles_RLCP33x33", "ppm", "Malamute.ppm",
892 "", 3, mse, pae);
893}
894
896// Test ojph_expand with codeblocks when the irv97 wavelet is used.
897// Command-line options used to obtain this file is:
898// -o simple_dec_irv97_64x64_tiles_RPCL33x33.jph -precise -quiet -rate 0.5
899// Clevels=5 Corder=RPCL Sorigin={5,33} Stile_origin={5,10} Stiles={33,33}
900// -full
901TEST(TestExecutables, SimpleDecIrv9764x64TilesRPCL33x33) {
902 double mse[3] = { 210.283, 210.214, 257.276};
903 int pae[3] = { 165, 161, 166};
904 run_ojph_expand("simple_dec_irv97_64x64_tiles_RPCL33x33", "jph", "ppm");
905 run_mse_pae("simple_dec_irv97_64x64_tiles_RPCL33x33", "ppm", "Malamute.ppm",
906 "", 3, mse, pae);
907}
908
910// Test ojph_expand with codeblocks when the irv97 wavelet is used.
911// Command-line options used to obtain this file is:
912// -o simple_dec_irv97_64x64_tiles_PCRL33x33.jph -precise -quiet -rate 0.5
913// Clevels=5 Corder=PCRL Sorigin={5,33} Stile_origin={5,10} Stiles={33,33}
914// -full
915TEST(TestExecutables, SimpleDecIrv9764x64TilesPCRL33x33) {
916 double mse[3] = { 210.283, 210.214, 257.276};
917 int pae[3] = { 165, 161, 166};
918 run_ojph_expand("simple_dec_irv97_64x64_tiles_PCRL33x33", "jph", "ppm");
919 run_mse_pae("simple_dec_irv97_64x64_tiles_PCRL33x33", "ppm", "Malamute.ppm",
920 "", 3, mse, pae);
921}
922
924// Test ojph_expand with codeblocks when the irv97 wavelet is used.
925// Command-line options used to obtain this file is:
926// -o simple_dec_irv97_64x64_tiles_CPRL33x33.jph -precise -quiet -rate 0.5
927// Clevels=5 Corder=CPRL Sorigin={5,33} Stile_origin={5,10} Stiles={33,33}
928// -full
929TEST(TestExecutables, SimpleDecIrv9764x64TilesCPRL33x33) {
930 double mse[3] = { 210.283, 210.214, 257.276};
931 int pae[3] = { 165, 161, 166};
932 run_ojph_expand("simple_dec_irv97_64x64_tiles_CPRL33x33", "jph", "ppm");
933 run_mse_pae("simple_dec_irv97_64x64_tiles_CPRL33x33", "ppm", "Malamute.ppm",
934 "", 3, mse, pae);
935}
936
938// Test ojph_expand with codeblocks when the rev53 wavelet is used.
939// Command-line options used to obtain this file is:
940// -o simple_dec_rev53_64x64_gray_tiles.jph -precise -quiet Creversible=yes
941// Clevels=5 Stiles={33,257} -full
942TEST(TestExecutables, SimpleDecRev5364x64GrayTiles) {
943 double mse[1] = { 0};
944 int pae[1] = { 0};
945 run_ojph_expand("simple_dec_rev53_64x64_gray_tiles", "jph", "pgm");
946 run_mse_pae("simple_dec_rev53_64x64_gray_tiles", "pgm", "monarch.pgm",
947 "", 1, mse, pae);
948}
949
951// Test ojph_expand with codeblocks when the irv97 wavelet is used.
952// Command-line options used to obtain this file is:
953// -o simple_dec_irv97_64x64_gray_tiles.jph -precise -quiet -rate 0.5
954// Clevels=5 Stiles={33,257} -full
955TEST(TestExecutables, SimpleDecIrv9764x64GrayTiles) {
956 double mse[1] = { 18.9601};
957 int pae[1] = { 56};
958 run_ojph_expand("simple_dec_irv97_64x64_gray_tiles", "jph", "pgm");
959 run_mse_pae("simple_dec_irv97_64x64_gray_tiles", "pgm", "monarch.pgm",
960 "", 1, mse, pae);
961}
962
964// Test ojph_expand with codeblocks when the irv97 wavelet is used.
965// Command-line options used to obtain this file is:
966// -o simple_dec_irv97_64x64_16bit.jph -precise -quiet -rate 0.5 -full
967TEST(TestExecutables, SimpleDecIrv9764x6416bit) {
968 double mse[3] = { 60507.2, 36672.5, 64809.8};
969 int pae[3] = { 2547, 1974, 1922};
970 run_ojph_expand("simple_dec_irv97_64x64_16bit", "jph", "ppm");
971 run_mse_pae("simple_dec_irv97_64x64_16bit", "ppm", "mm.ppm",
972 "", 3, mse, pae);
973}
974
976// Test ojph_expand with codeblocks when the irv97 wavelet is used.
977// Command-line options used to obtain this file is:
978// -o simple_dec_irv97_64x64_16bit_gray.jph -precise -quiet -rate 0.5 -full
979TEST(TestExecutables, SimpleDecIrv9764x6416bitGray) {
980 double mse[1] = { 19382.9};
981 int pae[1] = { 1618};
982 run_ojph_expand("simple_dec_irv97_64x64_16bit_gray", "jph", "pgm");
983 run_mse_pae("simple_dec_irv97_64x64_16bit_gray", "pgm", "mm.pgm",
984 "", 1, mse, pae);
985}
986
988// Test ojph_expand with codeblocks when the rev53 wavelet is used.
989// Command-line options used to obtain this file is:
990// -o simple_dec_rev53_64x64_16bit.jph -precise -quiet Creversible=yes -full
991TEST(TestExecutables, SimpleDecRev5364x6416bit) {
992 double mse[3] = { 0, 0, 0};
993 int pae[3] = { 0, 0, 0};
994 run_ojph_expand("simple_dec_rev53_64x64_16bit", "jph", "ppm");
995 run_mse_pae("simple_dec_rev53_64x64_16bit", "ppm", "mm.ppm",
996 "", 3, mse, pae);
997}
998
1000// Test ojph_expand with codeblocks when the rev53 wavelet is used.
1001// Command-line options used to obtain this file is:
1002// -o simple_dec_rev53_64x64_16bit_gray.jph -precise -quiet Creversible=yes
1003// -full
1004TEST(TestExecutables, SimpleDecRev5364x6416bitGray) {
1005 double mse[1] = { 0};
1006 int pae[1] = { 0};
1007 run_ojph_expand("simple_dec_rev53_64x64_16bit_gray", "jph", "pgm");
1008 run_mse_pae("simple_dec_rev53_64x64_16bit_gray", "pgm", "mm.pgm",
1009 "", 1, mse, pae);
1010}
1011
1013// Test ojph_expand with codeblocks when the rev53 wavelet is used.
1014// Command-line options used to obtain this file is:
1015// -o simple_dec_irv53_bhvhb_low_latency.jph -quiet Corder=PCRL Clevels=5
1016// Cmodes=HT|CAUSAL -rate 2 Catk=2 Kkernels:I2=I5X3
1017// Cprecincts={16,8192},{8,8192},{4,8192} Cblk={8,256}
1018// Cdecomp=B(-:-:-),H(-),V(-),H(-),B(-:-:-) Qstep=0.0001 -precise -no_weights
1019// -tolerance 0
1020TEST(TestExecutables, SimpleDecIrv53BhvhbLowLatency) {
1021 double mse[3] = { 5.52392, 4.01405, 6.8166};
1022 int pae[3] = { 16, 17, 23};
1023 run_ojph_expand("simple_dec_irv53_bhvhb_low_latency", "jph", "ppm");
1024 run_mse_pae("simple_dec_irv53_bhvhb_low_latency", "ppm", "Malamute.ppm",
1025 "", 3, mse, pae);
1026}
1027
1029// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1030// We test by comparing MSE and PAE of decoded images.
1031// The compressed file is obtained using these command-line options:
1032// -o simple_enc_irv97_64x64.j2c -qstep 0.1
1033TEST(TestExecutables, SimpleEncIrv9764x64) {
1034 double mse[3] = { 46.2004, 43.622, 56.7452};
1035 int pae[3] = { 48, 46, 52};
1036 run_ojph_compress("Malamute.ppm",
1037 "simple_enc_irv97_64x64", "", "j2c",
1038 "-qstep 0.1");
1039 run_ojph_compress_expand("simple_enc_irv97_64x64", "j2c", "ppm");
1040 run_mse_pae("simple_enc_irv97_64x64", "ppm",
1041 "Malamute.ppm", "", 3, mse, pae);
1042}
1043
1045// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1046// We test by comparing MSE and PAE of decoded images.
1047// The compressed file is obtained using these command-line options:
1048// -o simple_enc_irv97_32x32.j2c -qstep 0.01 -block_size {32,32}
1049TEST(TestExecutables, SimpleEncIrv9732x32) {
1050 double mse[3] = { 1.78779, 1.26001, 2.38395};
1051 int pae[3] = { 7, 6, 9};
1052 run_ojph_compress("Malamute.ppm",
1053 "simple_enc_irv97_32x32", "", "j2c",
1054 "-qstep 0.01 -block_size \"{32,32}\"");
1055 run_ojph_compress_expand("simple_enc_irv97_32x32", "j2c", "ppm");
1056 run_mse_pae("simple_enc_irv97_32x32", "ppm",
1057 "Malamute.ppm", "", 3, mse, pae);
1058}
1059
1061// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1062// We test by comparing MSE and PAE of decoded images.
1063// The compressed file is obtained using these command-line options:
1064// -o simple_enc_irv97_16x16.j2c -qstep 0.01 -block_size {16,16}
1065TEST(TestExecutables, SimpleEncIrv9716x16) {
1066 double mse[3] = { 1.78779, 1.26001, 2.38395};
1067 int pae[3] = { 7, 6, 9};
1068 run_ojph_compress("Malamute.ppm",
1069 "simple_enc_irv97_16x16", "", "j2c",
1070 "-qstep 0.01 -block_size \"{16,16}\"");
1071 run_ojph_compress_expand("simple_enc_irv97_16x16", "j2c", "ppm");
1072 run_mse_pae("simple_enc_irv97_16x16", "ppm",
1073 "Malamute.ppm", "", 3, mse, pae);
1074}
1075
1077// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1078// We test by comparing MSE and PAE of decoded images.
1079// The compressed file is obtained using these command-line options:
1080// -o simple_enc_irv97_4x4.j2c -qstep 0.01 -block_size {4,4}
1081TEST(TestExecutables, SimpleEncIrv974x4) {
1082 double mse[3] = { 1.78779, 1.26001, 2.38395};
1083 int pae[3] = { 7, 6, 9};
1084 run_ojph_compress("Malamute.ppm",
1085 "simple_enc_irv97_4x4", "", "j2c",
1086 "-qstep 0.01 -block_size \"{4,4}\"");
1087 run_ojph_compress_expand("simple_enc_irv97_4x4", "j2c", "ppm");
1088 run_mse_pae("simple_enc_irv97_4x4", "ppm",
1089 "Malamute.ppm", "", 3, mse, pae);
1090}
1091
1093// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1094// We test by comparing MSE and PAE of decoded images.
1095// The compressed file is obtained using these command-line options:
1096// -o simple_enc_irv97_1024x4.j2c -qstep 0.01 -block_size {4,1024}
1097TEST(TestExecutables, SimpleEncIrv971024x4) {
1098 double mse[3] = { 1.78779, 1.26001, 2.38395};
1099 int pae[3] = { 7, 6, 9};
1100 run_ojph_compress("Malamute.ppm",
1101 "simple_enc_irv97_1024x4", "", "j2c",
1102 "-qstep 0.01 -block_size \"{4,1024}\"");
1103 run_ojph_compress_expand("simple_enc_irv97_1024x4", "j2c", "ppm");
1104 run_mse_pae("simple_enc_irv97_1024x4", "ppm",
1105 "Malamute.ppm", "", 3, mse, pae);
1106}
1107
1109// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1110// We test by comparing MSE and PAE of decoded images.
1111// The compressed file is obtained using these command-line options:
1112// -o simple_enc_irv97_4x1024.j2c -qstep 0.01 -block_size {1024,4}
1113TEST(TestExecutables, SimpleEncIrv974x1024) {
1114 double mse[3] = { 1.78779, 1.26001, 2.38395};
1115 int pae[3] = { 7, 6, 9};
1116 run_ojph_compress("Malamute.ppm",
1117 "simple_enc_irv97_4x1024", "", "j2c",
1118 "-qstep 0.01 -block_size \"{1024,4}\"");
1119 run_ojph_compress_expand("simple_enc_irv97_4x1024", "j2c", "ppm");
1120 run_mse_pae("simple_enc_irv97_4x1024", "ppm",
1121 "Malamute.ppm", "", 3, mse, pae);
1122}
1123
1125// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1126// We test by comparing MSE and PAE of decoded images.
1127// The compressed file is obtained using these command-line options:
1128// -o simple_enc_irv97_512x8.j2c -qstep 0.01 -block_size {8,512}
1129TEST(TestExecutables, SimpleEncIrv97512x8) {
1130 double mse[3] = { 1.78779, 1.26001, 2.38395};
1131 int pae[3] = { 7, 6, 9};
1132 run_ojph_compress("Malamute.ppm",
1133 "simple_enc_irv97_512x8", "", "j2c",
1134 "-qstep 0.01 -block_size \"{8,512}\"");
1135 run_ojph_compress_expand("simple_enc_irv97_512x8", "j2c", "ppm");
1136 run_mse_pae("simple_enc_irv97_512x8", "ppm",
1137 "Malamute.ppm", "", 3, mse, pae);
1138}
1139
1141// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1142// We test by comparing MSE and PAE of decoded images.
1143// The compressed file is obtained using these command-line options:
1144// -o simple_enc_irv97_8x512.j2c -qstep 0.01 -block_size {512,8}
1145TEST(TestExecutables, SimpleEncIrv978x512) {
1146 double mse[3] = { 1.78779, 1.26001, 2.38395};
1147 int pae[3] = { 7, 6, 9};
1148 run_ojph_compress("Malamute.ppm",
1149 "simple_enc_irv97_8x512", "", "j2c",
1150 "-qstep 0.01 -block_size \"{512,8}\"");
1151 run_ojph_compress_expand("simple_enc_irv97_8x512", "j2c", "ppm");
1152 run_mse_pae("simple_enc_irv97_8x512", "ppm",
1153 "Malamute.ppm", "", 3, mse, pae);
1154}
1155
1157// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1158// We test by comparing MSE and PAE of decoded images.
1159// The compressed file is obtained using these command-line options:
1160// -o simple_enc_irv97_256x16.j2c -qstep 0.01 -block_size {16,256}
1161TEST(TestExecutables, SimpleEncIrv97256x16) {
1162 double mse[3] = { 1.78779, 1.26001, 2.38395};
1163 int pae[3] = { 7, 6, 9};
1164 run_ojph_compress("Malamute.ppm",
1165 "simple_enc_irv97_256x16", "", "j2c",
1166 "-qstep 0.01 -block_size \"{16,256}\"");
1167 run_ojph_compress_expand("simple_enc_irv97_256x16", "j2c", "ppm");
1168 run_mse_pae("simple_enc_irv97_256x16", "ppm",
1169 "Malamute.ppm", "", 3, mse, pae);
1170}
1171
1173// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1174// We test by comparing MSE and PAE of decoded images.
1175// The compressed file is obtained using these command-line options:
1176// -o simple_enc_irv97_16x256.j2c -qstep 0.01 -block_size {256,16}
1177TEST(TestExecutables, SimpleEncIrv9716x256) {
1178 double mse[3] = { 1.78779, 1.26001, 2.38395};
1179 int pae[3] = { 7, 6, 9};
1180 run_ojph_compress("Malamute.ppm",
1181 "simple_enc_irv97_16x256", "", "j2c",
1182 "-qstep 0.01 -block_size \"{256,16}\"");
1183 run_ojph_compress_expand("simple_enc_irv97_16x256", "j2c", "ppm");
1184 run_mse_pae("simple_enc_irv97_16x256", "ppm",
1185 "Malamute.ppm", "", 3, mse, pae);
1186}
1187
1189// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1190// We test by comparing MSE and PAE of decoded images.
1191// The compressed file is obtained using these command-line options:
1192// -o simple_enc_irv97_128x32.j2c -qstep 0.01 -block_size {32,128}
1193TEST(TestExecutables, SimpleEncIrv97128x32) {
1194 double mse[3] = { 1.78779, 1.26001, 2.38395};
1195 int pae[3] = { 7, 6, 9};
1196 run_ojph_compress("Malamute.ppm",
1197 "simple_enc_irv97_128x32", "", "j2c",
1198 "-qstep 0.01 -block_size \"{32,128}\"");
1199 run_ojph_compress_expand("simple_enc_irv97_128x32", "j2c", "ppm");
1200 run_mse_pae("simple_enc_irv97_128x32", "ppm",
1201 "Malamute.ppm", "", 3, mse, pae);
1202}
1203
1205// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1206// We test by comparing MSE and PAE of decoded images.
1207// The compressed file is obtained using these command-line options:
1208// -o simple_enc_irv97_32x128.j2c -qstep 0.01 -block_size {128,32}
1209TEST(TestExecutables, SimpleEncIrv9732x128) {
1210 double mse[3] = { 1.78779, 1.26001, 2.38395};
1211 int pae[3] = { 7, 6, 9};
1212 run_ojph_compress("Malamute.ppm",
1213 "simple_enc_irv97_32x128", "", "j2c",
1214 "-qstep 0.01 -block_size \"{128,32}\"");
1215 run_ojph_compress_expand("simple_enc_irv97_32x128", "j2c", "ppm");
1216 run_mse_pae("simple_enc_irv97_32x128", "ppm",
1217 "Malamute.ppm", "", 3, mse, pae);
1218}
1219
1221// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1222// We test by comparing MSE and PAE of decoded images.
1223// The compressed file is obtained using these command-line options:
1224// -o simple_enc_irv97_64x64_tiles_33x33_d5.j2c -qstep 0.01 -tile_size {33,33}
1225// -num_decomps 5
1226TEST(TestExecutables, SimpleEncIrv9764x64Tiles33x33D5) {
1227 double mse[3] = { 1.88906, 1.30757, 2.5347};
1228 int pae[3] = { 9, 6, 10};
1229 run_ojph_compress("Malamute.ppm",
1230 "simple_enc_irv97_64x64_tiles_33x33_d5", "", "j2c",
1231 "-qstep 0.01 -tile_size \"{33,33}\" -num_decomps 5");
1232 run_ojph_compress_expand("simple_enc_irv97_64x64_tiles_33x33_d5", "j2c", "ppm");
1233 run_mse_pae("simple_enc_irv97_64x64_tiles_33x33_d5", "ppm",
1234 "Malamute.ppm", "", 3, mse, pae);
1235}
1236
1238// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1239// We test by comparing MSE and PAE of decoded images.
1240// The compressed file is obtained using these command-line options:
1241// -o simple_enc_irv97_64x64_tiles_33x33_d6.j2c -qstep 0.01 -tile_size {33,33}
1242// -num_decomps 6
1243TEST(TestExecutables, SimpleEncIrv9764x64Tiles33x33D6) {
1244 double mse[3] = { 1.88751, 1.30673, 2.53378};
1245 int pae[3] = { 8, 6, 10};
1246 run_ojph_compress("Malamute.ppm",
1247 "simple_enc_irv97_64x64_tiles_33x33_d6", "", "j2c",
1248 "-qstep 0.01 -tile_size \"{33,33}\" -num_decomps 6");
1249 run_ojph_compress_expand("simple_enc_irv97_64x64_tiles_33x33_d6", "j2c", "ppm");
1250 run_mse_pae("simple_enc_irv97_64x64_tiles_33x33_d6", "ppm",
1251 "Malamute.ppm", "", 3, mse, pae);
1252}
1253
1255// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1256// We test by comparing MSE and PAE of decoded images.
1257// The compressed file is obtained using these command-line options:
1258// -o simple_enc_irv97_64x64_16bit.j2c -qstep 0.01
1259TEST(TestExecutables, SimpleEncIrv9764x6416bit) {
1260 double mse[3] = { 51727.3, 32596.4, 45897.8};
1261 int pae[3] = { 1512, 1481, 1778};
1262 run_ojph_compress("mm.ppm",
1263 "simple_enc_irv97_64x64_16bit", "", "j2c",
1264 "-qstep 0.01");
1265 run_ojph_compress_expand("simple_enc_irv97_64x64_16bit", "j2c", "ppm");
1266 run_mse_pae("simple_enc_irv97_64x64_16bit", "ppm",
1267 "mm.ppm", "", 3, mse, pae);
1268}
1269
1271// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1272// We test by comparing MSE and PAE of decoded images.
1273// The compressed file is obtained using these command-line options:
1274// -o simple_enc_irv97_64x64_16bit_gray.j2c -qstep 0.01
1275TEST(TestExecutables, SimpleEncIrv9764x6416bitGray) {
1276 double mse[1] = { 25150.6};
1277 int pae[1] = { 1081};
1278 run_ojph_compress("mm.pgm",
1279 "simple_enc_irv97_64x64_16bit_gray", "", "j2c",
1280 "-qstep 0.01");
1281 run_ojph_compress_expand("simple_enc_irv97_64x64_16bit_gray", "j2c", "pgm");
1282 run_mse_pae("simple_enc_irv97_64x64_16bit_gray", "pgm",
1283 "mm.pgm", "", 1, mse, pae);
1284}
1285
1287// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1288// We test by comparing MSE and PAE of decoded images.
1289// The compressed file is obtained using these command-line options:
1290// -o simple_enc_rev53_64x64_16bit.j2c -reversible true
1291TEST(TestExecutables, SimpleEncRev5364x6416bit) {
1292 double mse[3] = { 0, 0, 0};
1293 int pae[3] = { 0, 0, 0};
1294 run_ojph_compress("mm.ppm",
1295 "simple_enc_rev53_64x64_16bit", "", "j2c",
1296 "-reversible true");
1297 run_ojph_compress_expand("simple_enc_rev53_64x64_16bit", "j2c", "ppm");
1298 run_mse_pae("simple_enc_rev53_64x64_16bit", "ppm",
1299 "mm.ppm", "", 3, mse, pae);
1300}
1301
1303// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1304// We test by comparing MSE and PAE of decoded images.
1305// The compressed file is obtained using these command-line options:
1306// -o simple_enc_rev53_64x64_16bit_gray.j2c -reversible true
1307TEST(TestExecutables, SimpleEncRev5364x6416bitGray) {
1308 double mse[1] = { 0};
1309 int pae[1] = { 0};
1310 run_ojph_compress("mm.pgm",
1311 "simple_enc_rev53_64x64_16bit_gray", "", "j2c",
1312 "-reversible true");
1313 run_ojph_compress_expand("simple_enc_rev53_64x64_16bit_gray", "j2c", "pgm");
1314 run_mse_pae("simple_enc_rev53_64x64_16bit_gray", "pgm",
1315 "mm.pgm", "", 1, mse, pae);
1316}
1317
1319// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1320// We test by comparing MSE and PAE of decoded images.
1321// The compressed file is obtained using these command-line options:
1322// -o simple_enc_rev53_64x64_16bit.j2c -reversible true
1323TEST(TestExecutables, SimpleEncRev5364x64) {
1324 double mse[3] = { 0, 0, 0};
1325 int pae[3] = { 0, 0, 0};
1326 run_ojph_compress("Malamute.ppm",
1327 "simple_enc_rev53_64x64", "", "j2c",
1328 "-reversible true");
1329 run_ojph_compress_expand("simple_enc_rev53_64x64", "j2c", "ppm");
1330 run_mse_pae("simple_enc_rev53_64x64", "ppm",
1331 "Malamute.ppm", "", 3, mse, pae);
1332}
1333
1335// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1336// We test by comparing MSE and PAE of decoded images.
1337// The compressed file is obtained using these command-line options:
1338// -o simple_enc_rev53_32x32.j2c -reversible true -block_size {32,32}
1339TEST(TestExecutables, SimpleEncRev5332x32) {
1340 double mse[3] = { 0, 0, 0};
1341 int pae[3] = { 0, 0, 0};
1342 run_ojph_compress("Malamute.ppm",
1343 "simple_enc_rev53_32x32", "", "j2c",
1344 "-reversible true -block_size \"{32,32}\"");
1345 run_ojph_compress_expand("simple_enc_rev53_32x32", "j2c", "ppm");
1346 run_mse_pae("simple_enc_rev53_32x32", "ppm",
1347 "Malamute.ppm", "", 3, mse, pae);
1348}
1349
1351// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1352// We test by comparing MSE and PAE of decoded images.
1353// The compressed file is obtained using these command-line options:
1354// -o simple_enc_rev53_4x4.j2c -reversible true -block_size {4,4}
1355TEST(TestExecutables, SimpleEncRev534x4) {
1356 double mse[3] = { 0, 0, 0};
1357 int pae[3] = { 0, 0, 0};
1358 run_ojph_compress("Malamute.ppm",
1359 "simple_enc_rev53_4x4", "", "j2c",
1360 "-reversible true -block_size \"{4,4}\"");
1361 run_ojph_compress_expand("simple_enc_rev53_4x4", "j2c", "ppm");
1362 run_mse_pae("simple_enc_rev53_4x4", "ppm",
1363 "Malamute.ppm", "", 3, mse, pae);
1364}
1365
1367// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1368// We test by comparing MSE and PAE of decoded images.
1369// The compressed file is obtained using these command-line options:
1370// -o simple_enc_rev53_1024x4.j2c -reversible true -block_size {4,1024}
1371TEST(TestExecutables, SimpleEncRev531024x4) {
1372 double mse[3] = { 0, 0, 0};
1373 int pae[3] = { 0, 0, 0};
1374 run_ojph_compress("Malamute.ppm",
1375 "simple_enc_rev53_1024x4", "", "j2c",
1376 "-reversible true -block_size \"{4,1024}\"");
1377 run_ojph_compress_expand("simple_enc_rev53_1024x4", "j2c", "ppm");
1378 run_mse_pae("simple_enc_rev53_1024x4", "ppm",
1379 "Malamute.ppm", "", 3, mse, pae);
1380}
1381
1383// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1384// We test by comparing MSE and PAE of decoded images.
1385// The compressed file is obtained using these command-line options:
1386// -o simple_enc_rev53_4x1024.j2c -reversible true -block_size {1024,4}
1387TEST(TestExecutables, SimpleEncRev534x1024) {
1388 double mse[3] = { 0, 0, 0};
1389 int pae[3] = { 0, 0, 0};
1390 run_ojph_compress("Malamute.ppm",
1391 "simple_enc_rev53_4x1024", "", "j2c",
1392 "-reversible true -block_size \"{1024,4}\"");
1393 run_ojph_compress_expand("simple_enc_rev53_4x1024", "j2c", "ppm");
1394 run_mse_pae("simple_enc_rev53_4x1024", "ppm",
1395 "Malamute.ppm", "", 3, mse, pae);
1396}
1397
1399// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1400// We test by comparing MSE and PAE of decoded images.
1401// The compressed file is obtained using these command-line options:
1402// -o simple_enc_rev53_64x64_tiles_33x33_d5.j2c -reversible true -tile_size
1403// {32,32} -num_decomps 5
1404TEST(TestExecutables, SimpleEncRev5364x64Tiles33x33D5) {
1405 double mse[3] = { 0, 0, 0};
1406 int pae[3] = { 0, 0, 0};
1407 run_ojph_compress("Malamute.ppm",
1408 "simple_enc_rev53_64x64_tiles_33x33_d5", "", "j2c",
1409 "-reversible true -tile_size \"{32,32}\" -num_decomps 5");
1410 run_ojph_compress_expand("simple_enc_rev53_64x64_tiles_33x33_d5", "j2c", "ppm");
1411 run_mse_pae("simple_enc_rev53_64x64_tiles_33x33_d5", "ppm",
1412 "Malamute.ppm", "", 3, mse, pae);
1413}
1414
1416// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1417// We test by comparing MSE and PAE of decoded images.
1418// The compressed file is obtained using these command-line options:
1419// -o simple_enc_rev53_64x64_tiles_33x33_d6.j2c -reversible true -tile_size
1420// {32,32} -num_decomps 6
1421TEST(TestExecutables, SimpleEncRev5364x64Tiles33x33D6) {
1422 double mse[3] = { 0, 0, 0};
1423 int pae[3] = { 0, 0, 0};
1424 run_ojph_compress("Malamute.ppm",
1425 "simple_enc_rev53_64x64_tiles_33x33_d6", "", "j2c",
1426 "-reversible true -tile_size \"{32,32}\" -num_decomps 6");
1427 run_ojph_compress_expand("simple_enc_rev53_64x64_tiles_33x33_d6", "j2c", "ppm");
1428 run_mse_pae("simple_enc_rev53_64x64_tiles_33x33_d6", "ppm",
1429 "Malamute.ppm", "", 3, mse, pae);
1430}
1431
1433// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1434// We test by comparing MSE and PAE of decoded images.
1435// The compressed file is obtained using these command-line options:
1436// -o simple_enc_irv97_64x64_yuv.j2c -qstep 0.1 -dims {352,288} -num_comps 3
1437// -downsamp {1,1},{2,2},{2,2} -bit_depth 8,8,8 -signed false,false,false
1438TEST(TestExecutables, SimpleEncIrv9764x64Yuv) {
1439 double mse[3] = { 30.3548, 7.69602, 5.22246};
1440 int pae[3] = { 49, 27, 26};
1441 run_ojph_compress("foreman_420.yuv",
1442 "simple_enc_irv97_64x64_yuv", "", "j2c",
1443 "-qstep 0.1 -dims \"{352,288}\" -num_comps 3 -downsamp"
1444 " \"{1,1}\",\"{2,2}\",\"{2,2}\" -bit_depth 8,8,8"
1445 " -signed false,false,false");
1446 run_ojph_compress_expand("simple_enc_irv97_64x64_yuv", "j2c", "yuv");
1447 run_mse_pae("simple_enc_irv97_64x64_yuv", "yuv",
1448 "foreman_420.yuv", ":352x288x8x420", 3, mse, pae);
1449}
1450
1452// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1453// We test by comparing MSE and PAE of decoded images.
1454// The compressed file is obtained using these command-line options:
1455// -o simple_enc_rev53_64x64_yuv.j2c -reversible true -qstep 0.1 -dims
1456// {352,288} -num_comps 3 -downsamp {1,1},{2,2},{2,2} -bit_depth 8,8,8 -signed
1457// false,false,false
1458TEST(TestExecutables, SimpleEncRev5364x64Yuv) {
1459 double mse[3] = { 0, 0, 0};
1460 int pae[3] = { 0, 0, 0};
1461 run_ojph_compress("foreman_420.yuv",
1462 "simple_enc_rev53_64x64_yuv", "", "j2c",
1463 "-reversible true -qstep 0.1 -dims \"{352,288}\""
1464 " -num_comps 3 -downsamp \"{1,1}\",\"{2,2}\",\"{2,2}\""
1465 " -bit_depth 8,8,8 -signed false,false,false");
1466 run_ojph_compress_expand("simple_enc_rev53_64x64_yuv", "j2c", "yuv");
1467 run_mse_pae("simple_enc_rev53_64x64_yuv", "yuv",
1468 "foreman_420.yuv", ":352x288x8x420", 3, mse, pae);
1469}
1470
1472// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1473// We test by comparing MSE and PAE of decoded images.
1474// The compressed file is obtained using these command-line options:
1475// -o simple_enc_irv97_tall_narrow.j2c -qstep 0.1
1476TEST(TestExecutables, SimpleEncIrv97TallNarrow) {
1477 double mse[3] = { 112.097, 79.2214, 71.1367};
1478 int pae[3] = { 56, 41, 32};
1479 run_ojph_compress("tall_narrow.ppm",
1480 "simple_enc_irv97_tall_narrow", "", "j2c",
1481 "-qstep 0.1");
1482 run_ojph_compress_expand("simple_enc_irv97_tall_narrow", "j2c", "ppm");
1483 run_mse_pae("simple_enc_irv97_tall_narrow", "ppm",
1484 "tall_narrow.ppm", "", 3, mse, pae);
1485}
1486
1488// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1489// We test by comparing MSE and PAE of decoded images.
1490// The compressed file is obtained using these command-line options:
1491// -o simple_enc_irv97_tall_narrow1.j2c -image_offset {1,0} -qstep 0.1
1492TEST(TestExecutables, SimpleEncIrv97TallNarrow1) {
1493 double mse[3] = { 100.906, 76.113, 72.8347};
1494 int pae[3] = { 39, 35, 34};
1495 run_ojph_compress("tall_narrow.ppm",
1496 "simple_enc_irv97_tall_narrow1", "", "j2c",
1497 "-image_offset \"{1,0}\" -qstep 0.1");
1498 run_ojph_compress_expand("simple_enc_irv97_tall_narrow1", "j2c", "ppm");
1499 run_mse_pae("simple_enc_irv97_tall_narrow1", "ppm",
1500 "tall_narrow.ppm", "", 3, mse, pae);
1501}
1502
1504// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1505// We test by comparing MSE and PAE of decoded images.
1506// The compressed file is obtained using these command-line options:
1507// -o simple_enc_rev53_tall_narrow.j2c -reversible true
1508TEST(TestExecutables, SimpleEncRev53TallNarrow) {
1509 double mse[3] = { 0, 0, 0};
1510 int pae[3] = { 0, 0, 0};
1511 run_ojph_compress("tall_narrow.ppm",
1512 "simple_enc_rev53_tall_narrow", "", "j2c",
1513 "-reversible true");
1514 run_ojph_compress_expand("simple_enc_rev53_tall_narrow", "j2c", "ppm");
1515 run_mse_pae("simple_enc_rev53_tall_narrow", "ppm",
1516 "tall_narrow.ppm", "", 3, mse, pae);
1517}
1518
1520// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1521// We test by comparing MSE and PAE of decoded images.
1522// The compressed file is obtained using these command-line options:
1523// -o simple_enc_rev53_tall_narrow1.j2c -image_offset {1,0} -reversible true
1524TEST(TestExecutables, SimpleEncRev53TallNarrow1) {
1525 double mse[3] = { 0, 0, 0};
1526 int pae[3] = { 0, 0, 0};
1527 run_ojph_compress("tall_narrow.ppm",
1528 "simple_enc_rev53_tall_narrow1", "", "j2c",
1529 "-image_offset \"{1,0}\" -reversible true");
1530 run_ojph_compress_expand("simple_enc_rev53_tall_narrow1", "j2c", "ppm");
1531 run_mse_pae("simple_enc_rev53_tall_narrow1", "ppm",
1532 "tall_narrow.ppm", "", 3, mse, pae);
1533}
1534
1536// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1537// We test by comparing MSE and PAE of decoded images.
1538// The compressed file is obtained using these command-line options:
1539// -o dpx_enc_1280x720_10bit_le_nuke11.j2c -reversible true
1540TEST(TestExecutables, DpxEnc1280x72010bitLeNuke11) {
1541 double mse[3] = { 0, 0, 0};
1542 int pae[3] = { 0, 0, 0};
1543 run_ojph_compress("dpx_1280x720_10bit.ppm",
1544 "dpx_enc_1280x720_10bit_le_nuke11", "", "j2c",
1545 "-reversible true");
1546 run_ojph_compress_expand("dpx_enc_1280x720_10bit_le_nuke11", "j2c", "ppm");
1547 run_mse_pae("dpx_enc_1280x720_10bit_le_nuke11", "ppm",
1548 "dpx_1280x720_10bit.ppm", "", 3, mse, pae);
1549}
1550
1552// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1553// We test by comparing MSE and PAE of decoded images.
1554// The compressed file is obtained using these command-line options:
1555// -o dpx_enc_1280x720_10bit_be_nuke11.j2c -reversible true
1556TEST(TestExecutables, DpxEnc1280x72010bitBeNuke11) {
1557 double mse[3] = { 0, 0, 0};
1558 int pae[3] = { 0, 0, 0};
1559 run_ojph_compress("dpx_1280x720_10bit.ppm",
1560 "dpx_enc_1280x720_10bit_be_nuke11", "", "j2c",
1561 "-reversible true");
1562 run_ojph_compress_expand("dpx_enc_1280x720_10bit_be_nuke11", "j2c", "ppm");
1563 run_mse_pae("dpx_enc_1280x720_10bit_be_nuke11", "ppm",
1564 "dpx_1280x720_10bit.ppm", "", 3, mse, pae);
1565}
1566
1568// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1569// We test by comparing MSE and PAE of decoded images.
1570// The compressed file is obtained using these command-line options:
1571// -o dpx_enc_1280x720_16bit_le_nuke11.j2c -reversible true
1572TEST(TestExecutables, DpxEnc1280x72016bitLeNuke11) {
1573 double mse[3] = { 0, 0, 0};
1574 int pae[3] = { 0, 0, 0};
1575 run_ojph_compress("dpx_1280x720_16bit.ppm",
1576 "dpx_enc_1280x720_16bit_le_nuke11", "", "j2c",
1577 "-reversible true");
1578 run_ojph_compress_expand("dpx_enc_1280x720_16bit_le_nuke11", "j2c", "ppm");
1579 run_mse_pae("dpx_enc_1280x720_16bit_le_nuke11", "ppm",
1580 "dpx_1280x720_16bit.ppm", "", 3, mse, pae);
1581}
1582
1584// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1585// We test by comparing MSE and PAE of decoded images.
1586// The compressed file is obtained using these command-line options:
1587// -o dpx_enc_1280x720_16bit_be_nuke11.j2c -reversible true
1588TEST(TestExecutables, DpxEnc1280x72016bitBeNuke11) {
1589 double mse[3] = { 0, 0, 0};
1590 int pae[3] = { 0, 0, 0};
1591 run_ojph_compress("dpx_1280x720_16bit.ppm",
1592 "dpx_enc_1280x720_16bit_be_nuke11", "", "j2c",
1593 "-reversible true");
1594 run_ojph_compress_expand("dpx_enc_1280x720_16bit_be_nuke11", "j2c", "ppm");
1595 run_mse_pae("dpx_enc_1280x720_16bit_be_nuke11", "ppm",
1596 "dpx_1280x720_16bit.ppm", "", 3, mse, pae);
1597}
1598
1600// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1601// We test by comparing MSE and PAE of decoded images.
1602// The compressed file is obtained using these command-line options:
1603// -o dpx_enc_1280x720_10bit_resolve18.j2c -reversible true
1604TEST(TestExecutables, DpxEnc1280x72010bitResolve18) {
1605 double mse[3] = { 0, 0, 0};
1606 int pae[3] = { 0, 0, 0};
1607 run_ojph_compress("dpx_1280x720_10bit.ppm",
1608 "dpx_enc_1280x720_10bit_resolve18", "", "j2c",
1609 "-reversible true");
1610 run_ojph_compress_expand("dpx_enc_1280x720_10bit_resolve18", "j2c", "ppm");
1611 run_mse_pae("dpx_enc_1280x720_10bit_resolve18", "ppm",
1612 "dpx_1280x720_10bit.ppm", "", 3, mse, pae);
1613}
1614
1616// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1617// We test by comparing MSE and PAE of decoded images.
1618// The compressed file is obtained using these command-line options:
1619// -o dpx_enc_1280x720_16bit_resolve18.j2c -reversible true
1620TEST(TestExecutables, DpxEnc1280x72016bitResolve18) {
1621 double mse[3] = { 0, 0, 0};
1622 int pae[3] = { 0, 0, 0};
1623 run_ojph_compress("dpx_1280x720_16bit.ppm",
1624 "dpx_enc_1280x720_16bit_resolve18", "", "j2c",
1625 "-reversible true");
1626 run_ojph_compress_expand("dpx_enc_1280x720_16bit_resolve18", "j2c", "ppm");
1627 run_mse_pae("dpx_enc_1280x720_16bit_resolve18", "ppm",
1628 "dpx_1280x720_16bit.ppm", "", 3, mse, pae);
1629}
1630
1632// Test ojph_compress with qfactor on a 3-component PPM image.
1633// We test by comparing MSE and PAE of decoded images.
1634// The compressed file is obtained using these command-line options:
1635// -o simple_enc_irv97_qfactor50.j2c -qfactor 50
1636TEST(TestExecutables, SimpleEncIrv97Qfactor50) {
1637 double mse[3] = { 34.1747, 31.8416, 41.5334 };
1638 int pae[3] = { 54, 55, 54 };
1639 run_ojph_compress("Malamute.ppm",
1640 "simple_enc_irv97_qfactor50", "", "j2c",
1641 "-qfactor 50");
1642 run_ojph_compress_expand("simple_enc_irv97_qfactor50", "j2c", "ppm");
1643 run_mse_pae("simple_enc_irv97_qfactor50", "ppm",
1644 "Malamute.ppm", "", 3, mse, pae);
1645}
1646
1648// Test ojph_compress with qfactor on a 4:2:0 YUV image.
1649// We test by comparing MSE and PAE of decoded images.
1650// The compressed file is obtained using these command-line options:
1651// -o simple_enc_irv97_qfactor50_yuv.j2c -qfactor 50 -dims {352,288}
1652// -num_comps 3 -downsamp {1,1},{2,2},{2,2} -bit_depth 8,8,8
1653// -signed false,false,false
1654TEST(TestExecutables, SimpleEncIrv97Qfactor50Yuv) {
1655 double mse[3] = { 23.5159, 4.0584, 1.9829 };
1656 int pae[3] = { 60, 17, 23 };
1657 run_ojph_compress("foreman_420.yuv",
1658 "simple_enc_irv97_qfactor50_yuv", "", "j2c",
1659 "-qfactor 50 -dims \"{352,288}\" -num_comps 3 -downsamp"
1660 " \"{1,1}\",\"{2,2}\",\"{2,2}\" -bit_depth 8,8,8"
1661 " -signed false,false,false");
1662 run_ojph_compress_expand("simple_enc_irv97_qfactor50_yuv", "j2c", "yuv");
1663 run_mse_pae("simple_enc_irv97_qfactor50_yuv", "yuv",
1664 "foreman_420.yuv", ":352x288x8x420", 3, mse, pae);
1665}
1666
1668// Test ojph_compress with qfactor on a 1-component PGM image.
1669// We test by comparing MSE and PAE of decoded images.
1670// The compressed file is obtained using these command-line options:
1671// -o simple_enc_irv97_qfactor50_gray.j2c -qfactor 50
1672TEST(TestExecutables, SimpleEncIrv97Qfactor50Gray) {
1673 double mse[1] = { 23.245 };
1674 int pae[1] = { 72 };
1675 run_ojph_compress("monarch.pgm",
1676 "simple_enc_irv97_qfactor50_gray", "", "j2c",
1677 "-qfactor 50");
1678 run_ojph_compress_expand("simple_enc_irv97_qfactor50_gray", "j2c", "pgm");
1679 run_mse_pae("simple_enc_irv97_qfactor50_gray", "pgm",
1680 "monarch.pgm", "", 1, mse, pae);
1681}
1682
1684// Test ojph_compress and ojph_expand on .raw files, which are the only input
1685// for which the readers are told the signedness of the samples rather than
1686// deriving it from the file, and the only input that can carry signed
1687// samples. Each test encodes one frame reversibly and requires the decoded
1688// frame to be bit exact; there is one test per sample width that
1689// raw_in::read() and raw_out::write() handle separately, in both
1690// signednesses, because each of those branches extends samples in its own
1691// way. The 16 bit frames sweep all 65536 sample values, so at the width
1692// where the reader regressed the negative half of the range is covered
1693// exhaustively.
1694// The compressed files are obtained using these command-line options:
1695// -o simple_enc_rev53_raw<width>_<signedness>.j2c -reversible true
1696// -dims {256,256} -num_comps 1 -downsamp {1,1} -bit_depth <width>
1697// -signed <signedness>
1698TEST(TestExecutables, SimpleEncRev53Raw8Signed) {
1699 run_raw_round_trip_test("simple_enc_rev53_raw8_signed", 8, true);
1700}
1701
1702TEST(TestExecutables, SimpleEncRev53Raw8Unsigned) {
1703 run_raw_round_trip_test("simple_enc_rev53_raw8_unsigned", 8, false);
1704}
1705
1706TEST(TestExecutables, SimpleEncRev53Raw16Signed) {
1707 run_raw_round_trip_test("simple_enc_rev53_raw16_signed", 16, true);
1708}
1709
1710TEST(TestExecutables, SimpleEncRev53Raw16Unsigned) {
1711 run_raw_round_trip_test("simple_enc_rev53_raw16_unsigned", 16, false);
1712}
1713
1714TEST(TestExecutables, SimpleEncRev53Raw24Signed) {
1715 run_raw_round_trip_test("simple_enc_rev53_raw24_signed", 24, true);
1716}
1717
1718TEST(TestExecutables, SimpleEncRev53Raw24Unsigned) {
1719 run_raw_round_trip_test("simple_enc_rev53_raw24_unsigned", 24, false);
1720}
1721
1722TEST(TestExecutables, SimpleEncRev53Raw32Signed) {
1723 run_raw_round_trip_test("simple_enc_rev53_raw32_signed", 32, true);
1724}
1725
1726TEST(TestExecutables, SimpleEncRev53Raw32Unsigned) {
1727 run_raw_round_trip_test("simple_enc_rev53_raw32_unsigned", 32, false);
1728}
1729
1731// main
1733int main(int argc, char** argv) {
1734 ::testing::InitGoogleTest(&argc, argv);
1735 return RUN_ALL_TESTS();
1736}
int64_t si64
Definition ojph_defs.h:57
uint64_t ui64
Definition ojph_defs.h:56
uint32_t ui32
Definition ojph_defs.h:54
uint8_t ui8
Definition ojph_defs.h:50
int main(int argc, char *argv[])
#define RAW_TEST_WIDTH
#define REF_FILE_DIR
static int ojph_pclose(FILE *stream)
#define TOL_DOUBLE
void compare_raw_test_file(const std::string &filename, ojph::ui32 bit_depth, bool is_signed)
#define COMPRESS_EXECUTABLE
void run_ojph_compress_expand(const std::string &base_filename, const std::string &out_ext, const std::string &decode_ext)
#define RAW_TEST_HEIGHT
#define COMPARE_FILES_PATH
#define OUT_FILE_DIR
#define RAW_TEST_NUM_SAMPLES
void run_raw_round_trip_test(const std::string &base_filename, ojph::ui32 bit_depth, bool is_signed)
void write_raw_test_file(const std::string &filename, ojph::ui32 bit_depth, bool is_signed)
void run_ojph_expand(const std::string &base_filename, const std::string &src_ext, const std::string &out_ext)
static ojph::si64 raw_test_sample(ojph::ui32 idx, ojph::ui32 bit_depth, bool is_signed)
static int execute(const std::string &cmd, std::string &result)
#define EXPAND_EXECUTABLE
void run_ojph_compress_raw(const std::string &src_filename, const std::string &base_filename, const std::string &out_ext, const std::string &extra_options)
static FILE * ojph_popen(const char *command, const char *modes)
#define TOL_INTEGER
void run_mse_pae(const std::string &base_filename, const std::string &out_ext, const std::string &ref_filename, const std::string &yuv_specs, int num_components, double *mse, int *pae)
#define SRC_FILE_DIR
void compare_files(const std::string &base_filename, const std::string &extended_base_fname, const std::string &ext)
#define MSE_PAE_PATH
TEST(TestExecutables, OpenJPHCompressNoArguments)
void run_ojph_compress(const std::string &ref_filename, const std::string &base_filename, const std::string &extended_base_fname, const std::string &out_ext, const std::string &extra_options)