OpenJPH
Open-source implementation of JPEG2000 Part-15
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 ".\\Release\\mse_pae"
101 #define COMPARE_FILES_PATH ".\\Release\\compare_files"
102 #define EXPAND_EXECUTABLE "..\\..\\bin\\ojph_expand.exe"
103 #define COMPRESS_EXECUTABLE "..\\..\\bin\\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 #define EXPAND_EXECUTABLE "../../bin/ojph_expand"
111 #define COMPRESS_EXECUTABLE "../../bin/ojph_compress"
112#endif
113#define TOL_DOUBLE 0.01
114#define TOL_INTEGER 1
115
117// run_ojph_compress
119void run_ojph_compress(const std::string& ref_filename,
120 const std::string& base_filename,
121 const std::string& extended_base_fname,
122 const std::string& out_ext,
123 const std::string& extra_options)
124{
125 try {
126 std::string result, command;
127 command = std::string(COMPRESS_EXECUTABLE)
128 + " -i " + REF_FILE_DIR + ref_filename
129 + " -o " + OUT_FILE_DIR + base_filename + extended_base_fname +
130 "." + out_ext + " " + extra_options;
131 std::cerr << command << std::endl;
132 EXPECT_EQ(execute(command, result), 0);
133 }
134 catch(const std::runtime_error& error) {
135 FAIL() << error.what();
136 }
137}
138
140// run_ojph_expand
142void run_ojph_expand(const std::string& base_filename,
143 const std::string& src_ext,
144 const std::string& out_ext)
145{
146 try {
147 std::string result, command;
148 command = std::string(EXPAND_EXECUTABLE)
149 + " -i " + SRC_FILE_DIR + base_filename + "." + src_ext
150 + " -o " + OUT_FILE_DIR + base_filename + "." + out_ext;
151 EXPECT_EQ(execute(command, result), 0);
152 }
153 catch(const std::runtime_error& error) {
154 FAIL() << error.what();
155 }
156}
157
159// run_ojph_compress
161void run_ojph_compress_expand(const std::string& base_filename,
162 const std::string& out_ext,
163 const std::string& decode_ext)
164{
165 try {
166 std::string result, command;
167 command = std::string(EXPAND_EXECUTABLE)
168 + " -i " + OUT_FILE_DIR + base_filename + "." + out_ext
169 + " -o " + OUT_FILE_DIR + base_filename + "." + decode_ext;
170 EXPECT_EQ(execute(command, result), 0);
171 }
172 catch(const std::runtime_error& error) {
173 FAIL() << error.what();
174 }
175}
176
178// run_mse_pae
180void run_mse_pae(const std::string& base_filename,
181 const std::string& out_ext,
182 const std::string& ref_filename,
183 const std::string& yuv_specs,
184 int num_components, double* mse, int* pae)
185{
186 try {
187 std::string result, command;
188 command = std::string(MSE_PAE_PATH)
189 + " " + OUT_FILE_DIR + base_filename + "." + out_ext + yuv_specs
190 + " " + REF_FILE_DIR + ref_filename + yuv_specs;
191 EXPECT_EQ(execute(command, result), 0);
192
193 size_t pos = 0;
194 for (int c = 0; c < num_components; ++c) {
195 if (pos < result.length()) {
196 double valf = atof(result.c_str() + pos);
197 EXPECT_NEAR((valf - mse[c]) / (valf + TOL_DOUBLE), 0.0, TOL_DOUBLE);
198 }
199 else {
200 FAIL() << "mse_pae result string does not have enough entries.";
201 }
202 pos = result.find(" ", pos);
203 if (pos != std::string::npos)
204 ++pos;
205 if (pos < result.length()) {
206 int vali = atoi(result.c_str() + pos);
207 EXPECT_NEAR(vali, pae[c], TOL_INTEGER);
208 }
209 else {
210 FAIL() << "mse_pae result string does not have enough entries.";
211 }
212 pos = result.find("\n", pos);
213 if (pos != std::string::npos)
214 ++pos;
215 }
216 }
217 catch(const std::runtime_error& error) {
218 FAIL() << error.what();
219 }
220}
221
223// compare_files
225void compare_files(const std::string& base_filename,
226 const std::string& extended_base_fname,
227 const std::string& ext)
228{
229 try {
230 std::string result, command;
231 command = std::string(COMPARE_FILES_PATH)
232 + " " + OUT_FILE_DIR + base_filename + extended_base_fname + "." + ext
233 + " " + SRC_FILE_DIR + base_filename + "." + ext;
234 EXPECT_EQ(execute(command, result), 0);
235 }
236 catch(const std::runtime_error& error) {
237 FAIL() << error.what();
238 }
239}
240
242// tests
244
246// Test ojph_compress on its own
247TEST(TestExecutables, OpenJPHCompressNoArguments) {
248 try {
249 std::string result;
250 EXPECT_EQ(execute(COMPRESS_EXECUTABLE, result), 1);
251 }
252 catch(const std::runtime_error& error) {
253 FAIL() << error.what();
254 }
255}
256
258// Test ojph_expand on its own
259TEST(TestExecutables, OpenJPHExpandNoArguments) {
260 try {
261 std::string result;
262 EXPECT_EQ(execute(EXPAND_EXECUTABLE, result), 1);
263 }
264 catch(const std::runtime_error& error) {
265 FAIL() << error.what();
266 }
267}
268
270// other tests
272
274// Test ojph_expand with codeblocks when the irv97 wavelet is used.
275// Command-line options used to obtain this file is:
276// -o simple_dec_irv97_64x64.jph -precise -quiet -rate 0.5 -full
277TEST(TestExecutables, SimpleDecIrv9764x64) {
278 double mse[3] = { 39.2812, 36.3819, 47.642};
279 int pae[3] = { 74, 77, 73};
280 run_ojph_expand("simple_dec_irv97_64x64", "jph", "ppm");
281 run_mse_pae("simple_dec_irv97_64x64", "ppm", "Malamute.ppm",
282 "", 3, mse, pae);
283}
284
286// Test ojph_expand with codeblocks when the irv97 wavelet is used.
287// Command-line options used to obtain this file is:
288// -o simple_dec_irv97_32x32.jph -precise -quiet -rate 1 Cblk={32,32} -full
289TEST(TestExecutables, SimpleDecIrv9732x32) {
290 double mse[3] = { 18.6979, 17.1208, 22.7539};
291 int pae[3] = { 51, 48, 46};
292 run_ojph_expand("simple_dec_irv97_32x32", "jph", "ppm");
293 run_mse_pae("simple_dec_irv97_32x32", "ppm", "Malamute.ppm",
294 "", 3, mse, pae);
295}
296
298// Test ojph_expand with codeblocks when the irv97 wavelet is used.
299// Command-line options used to obtain this file is:
300// -o simple_dec_irv97_16x16.jph -precise -quiet -rate 1 Cblk={16,16} -full
301TEST(TestExecutables, SimpleDecIrv9716x16) {
302 double mse[3] = { 20.1706, 18.5427, 24.6146};
303 int pae[3] = { 53, 51, 47};
304 run_ojph_expand("simple_dec_irv97_16x16", "jph", "ppm");
305 run_mse_pae("simple_dec_irv97_16x16", "ppm", "Malamute.ppm",
306 "", 3, mse, pae);
307}
308
310// Test ojph_expand with codeblocks when the irv97 wavelet is used.
311// Command-line options used to obtain this file is:
312// -o simple_dec_irv97_4x4.jph -precise -quiet -rate 1 Cblk={4,4} -full
313TEST(TestExecutables, SimpleDecIrv974x4) {
314 double mse[3] = { 40.8623, 37.9308, 49.7276};
315 int pae[3] = { 75, 77, 80};
316 run_ojph_expand("simple_dec_irv97_4x4", "jph", "ppm");
317 run_mse_pae("simple_dec_irv97_4x4", "ppm", "Malamute.ppm",
318 "", 3, mse, pae);
319}
320
322// Test ojph_expand with codeblocks when the irv97 wavelet is used.
323// Command-line options used to obtain this file is:
324// -o simple_dec_irv97_1024x4.jph -precise -quiet -rate 1 Cblk={1024,4} -full
325TEST(TestExecutables, SimpleDecIrv971024x4) {
326 double mse[3] = { 19.8275, 18.2511, 24.2832};
327 int pae[3] = { 53, 52, 50};
328 run_ojph_expand("simple_dec_irv97_1024x4", "jph", "ppm");
329 run_mse_pae("simple_dec_irv97_1024x4", "ppm", "Malamute.ppm",
330 "", 3, mse, pae);
331}
332
334// Test ojph_expand with codeblocks when the irv97 wavelet is used.
335// Command-line options used to obtain this file is:
336// -o simple_dec_irv97_4x1024.jph -precise -quiet -rate 1 Cblk={4,1024} -full
337TEST(TestExecutables, SimpleDecIrv974x1024) {
338 double mse[3] = { 19.9635, 18.4063, 24.1719};
339 int pae[3] = { 51, 48, 51};
340 run_ojph_expand("simple_dec_irv97_4x1024", "jph", "ppm");
341 run_mse_pae("simple_dec_irv97_4x1024", "ppm", "Malamute.ppm",
342 "", 3, mse, pae);
343}
344
346// Test ojph_expand with codeblocks when the irv97 wavelet is used.
347// Command-line options used to obtain this file is:
348// -o simple_dec_irv97_512x8.jph -precise -quiet -rate 1 Cblk={512,8} -full
349TEST(TestExecutables, SimpleDecIrv97512x8) {
350 double mse[3] = { 18.7929, 17.2026, 22.9922};
351 int pae[3] = { 53, 52, 50};
352 run_ojph_expand("simple_dec_irv97_512x8", "jph", "ppm");
353 run_mse_pae("simple_dec_irv97_512x8", "ppm", "Malamute.ppm",
354 "", 3, mse, pae);
355}
356
358// Test ojph_expand with codeblocks when the irv97 wavelet is used.
359// Command-line options used to obtain this file is:
360// -o simple_dec_irv97_8x512.jph -precise -quiet -rate 1 Cblk={8,512} -full
361TEST(TestExecutables, SimpleDecIrv978x512) {
362 double mse[3] = { 19.3661, 17.8067, 23.4574};
363 int pae[3] = { 51, 48, 52};
364 run_ojph_expand("simple_dec_irv97_8x512", "jph", "ppm");
365 run_mse_pae("simple_dec_irv97_8x512", "ppm", "Malamute.ppm",
366 "", 3, mse, pae);
367}
368
370// Test ojph_expand with codeblocks when the irv97 wavelet is used.
371// Command-line options used to obtain this file is:
372// -o simple_dec_irv97_256x16.jph -precise -quiet -rate 1 Cblk={256,16} -full
373TEST(TestExecutables, SimpleDecIrv97256x16) {
374 double mse[3] = { 18.6355, 17.0963, 22.6076};
375 int pae[3] = { 54, 51, 48};
376 run_ojph_expand("simple_dec_irv97_256x16", "jph", "ppm");
377 run_mse_pae("simple_dec_irv97_256x16", "ppm", "Malamute.ppm",
378 "", 3, mse, pae);
379}
380
382// Test ojph_expand with codeblocks when the irv97 wavelet is used.
383// Command-line options used to obtain this file is:
384// -o simple_dec_irv97_16x256.jph -precise -quiet -rate 1 Cblk={16,256} -full
385TEST(TestExecutables, SimpleDecIrv9716x256) {
386 double mse[3] = { 18.5933, 17.0208, 22.5709};
387 int pae[3] = { 51, 48, 47};
388 run_ojph_expand("simple_dec_irv97_16x256", "jph", "ppm");
389 run_mse_pae("simple_dec_irv97_16x256", "ppm", "Malamute.ppm",
390 "", 3, mse, pae);
391}
392
394// Test ojph_expand with codeblocks when the irv97 wavelet is used.
395// Command-line options used to obtain this file is:
396// -o simple_dec_irv97_128x32.jph -precise -quiet -rate 1 Cblk={128,32} -full
397TEST(TestExecutables, SimpleDecIrv97128x32) {
398 double mse[3] = { 18.4443, 16.9133, 22.4193};
399 int pae[3] = { 52, 50, 46};
400 run_ojph_expand("simple_dec_irv97_128x32", "jph", "ppm");
401 run_mse_pae("simple_dec_irv97_128x32", "ppm", "Malamute.ppm",
402 "", 3, mse, pae);
403}
404
406// Test ojph_expand with codeblocks when the irv97 wavelet is used.
407// Command-line options used to obtain this file is:
408// -o simple_dec_irv97_32x128.jph -precise -quiet -rate 1 Cblk={32,128} -full
409TEST(TestExecutables, SimpleDecIrv9732x128) {
410 double mse[3] = { 18.4874, 16.9379, 22.4855};
411 int pae[3] = { 51, 48, 45};
412 run_ojph_expand("simple_dec_irv97_32x128", "jph", "ppm");
413 run_mse_pae("simple_dec_irv97_32x128", "ppm", "Malamute.ppm",
414 "", 3, mse, pae);
415}
416
418// Test ojph_expand with codeblocks when the rev53 wavelet is used.
419// Command-line options used to obtain this file is:
420// -o simple_dec_rev53_64x64.jph -precise -quiet Creversible=yes -full
421TEST(TestExecutables, SimpleDecRev5364x64) {
422 double mse[3] = { 0, 0, 0};
423 int pae[3] = { 0, 0, 0};
424 run_ojph_expand("simple_dec_rev53_64x64", "jph", "ppm");
425 run_mse_pae("simple_dec_rev53_64x64", "ppm", "Malamute.ppm",
426 "", 3, mse, pae);
427}
428
430// Test ojph_expand with codeblocks when the rev53 wavelet is used.
431// Command-line options used to obtain this file is:
432// -o simple_dec_rev53_32x32.jph -precise -quiet Creversible=yes Cblk={32,32}
433// -full
434TEST(TestExecutables, SimpleDecRev5332x32) {
435 double mse[3] = { 0, 0, 0};
436 int pae[3] = { 0, 0, 0};
437 run_ojph_expand("simple_dec_rev53_32x32", "jph", "ppm");
438 run_mse_pae("simple_dec_rev53_32x32", "ppm", "Malamute.ppm",
439 "", 3, mse, pae);
440}
441
443// Test ojph_expand with codeblocks when the rev53 wavelet is used.
444// Command-line options used to obtain this file is:
445// -o simple_dec_rev53_4x4.jph -precise -quiet Creversible=yes Cblk={4,4}
446// -full
447TEST(TestExecutables, SimpleDecRev534x4) {
448 double mse[3] = { 0, 0, 0};
449 int pae[3] = { 0, 0, 0};
450 run_ojph_expand("simple_dec_rev53_4x4", "jph", "ppm");
451 run_mse_pae("simple_dec_rev53_4x4", "ppm", "Malamute.ppm",
452 "", 3, mse, pae);
453}
454
456// Test ojph_expand with codeblocks when the rev53 wavelet is used.
457// Command-line options used to obtain this file is:
458// -o simple_dec_rev53_1024x4.jph -precise -quiet Creversible=yes
459// Cblk={1024,4} -full
460TEST(TestExecutables, SimpleDecRev531024x4) {
461 double mse[3] = { 0, 0, 0};
462 int pae[3] = { 0, 0, 0};
463 run_ojph_expand("simple_dec_rev53_1024x4", "jph", "ppm");
464 run_mse_pae("simple_dec_rev53_1024x4", "ppm", "Malamute.ppm",
465 "", 3, mse, pae);
466}
467
469// Test ojph_expand with codeblocks when the rev53 wavelet is used.
470// Command-line options used to obtain this file is:
471// -o simple_dec_rev53_4x1024.jph -precise -quiet Creversible=yes
472// Cblk={4,1024} -full
473TEST(TestExecutables, SimpleDecRev534x1024) {
474 double mse[3] = { 0, 0, 0};
475 int pae[3] = { 0, 0, 0};
476 run_ojph_expand("simple_dec_rev53_4x1024", "jph", "ppm");
477 run_mse_pae("simple_dec_rev53_4x1024", "ppm", "Malamute.ppm",
478 "", 3, mse, pae);
479}
480
482// Test ojph_expand with codeblocks when the irv97 wavelet is used.
483// and the color components are subsampled.
484// Command-line options used to obtain this file is:
485// -o simple_dec_irv97_64x64_yuv.jph -precise -quiet -rate 0.5
486// Sdims={288,352},{144,176},{144,176} Ssampling={1,1},{2,2},{2,2}
487// Nprecision={8} Nsigned={no} -full
488TEST(TestExecutables, SimpleDecIrv9764x64Yuv) {
489 double mse[3] = { 20.2778, 6.27912, 4.15937};
490 int pae[3] = { 52, 22, 31};
491 run_ojph_expand("simple_dec_irv97_64x64_yuv", "jph", "yuv");
492 run_mse_pae("simple_dec_irv97_64x64_yuv", "yuv", "foreman_420.yuv",
493 ":352x288x8x420", 3, mse, pae);
494}
495
497// Test ojph_expand with codeblocks when the rev53 wavelet is used.
498// and the color components are subsampled.
499// Command-line options used to obtain this file is:
500// -o simple_dec_rev53_64x64_yuv.jph -precise -quiet Creversible=yes
501// Sdims={288,352},{144,176},{144,176} Ssampling={1,1},{2,2},{2,2}
502// Nprecision={8} Nsigned={no} -full
503TEST(TestExecutables, SimpleDecRev5364x64Yuv) {
504 double mse[3] = { 0, 0, 0};
505 int pae[3] = { 0, 0, 0};
506 run_ojph_expand("simple_dec_rev53_64x64_yuv", "jph", "yuv");
507 run_mse_pae("simple_dec_rev53_64x64_yuv", "yuv", "foreman_420.yuv",
508 ":352x288x8x420", 3, mse, pae);
509}
510
512// Test ojph_expand with codeblocks when the irv97 wavelet is used.
513// and the color components are subsampled.
514// Command-line options used to obtain this file is:
515// -o simple_dec_irv97_64x64_tiles_yuv.jph -precise -quiet -rate 0.5
516// Sdims={288,352},{144,176},{144,176} Ssampling={1,1},{2,2},{2,2}
517// Nprecision={8} Nsigned={no} Stiles={33,257} -full
518TEST(TestExecutables, SimpleDecIrv9764x64TilesYuv) {
519 double mse[3] = { 34.4972, 10.1112, 7.96331};
520 int pae[3] = { 67, 30, 39};
521 run_ojph_expand("simple_dec_irv97_64x64_tiles_yuv", "jph", "yuv");
522 run_mse_pae("simple_dec_irv97_64x64_tiles_yuv", "yuv", "foreman_420.yuv",
523 ":352x288x8x420", 3, mse, pae);
524}
525
527// Test ojph_expand with codeblocks when the rev53 wavelet is used.
528// and the color components are subsampled.
529// Command-line options used to obtain this file is:
530// -o simple_dec_rev53_64x64_tiles_yuv.jph -precise -quiet Creversible=yes
531// Sdims={288,352},{144,176},{144,176} Ssampling={1,1},{2,2},{2,2}
532// Nprecision={8} Nsigned={no} Stiles={33,257} -full
533TEST(TestExecutables, SimpleDecRev5364x64TilesYuv) {
534 double mse[3] = { 0, 0, 0};
535 int pae[3] = { 0, 0, 0};
536 run_ojph_expand("simple_dec_rev53_64x64_tiles_yuv", "jph", "yuv");
537 run_mse_pae("simple_dec_rev53_64x64_tiles_yuv", "yuv", "foreman_420.yuv",
538 ":352x288x8x420", 3, mse, pae);
539}
540
542// Test ojph_expand with codeblocks when the irv97 wavelet is used.
543// Command-line options used to obtain this file is:
544// -o simple_dec_irv97_64x64_tiles_LRCP.jph -precise -quiet -rate 0.5
545// Clevels=5 Corder=LRCP Cprecincts={2,256} Sorigin={374,1717}
546// Stile_origin={374,1717} -full
547TEST(TestExecutables, SimpleDecIrv9764x64TilesLRCP) {
548 double mse[3] = { 71.8149, 68.7115, 89.4001};
549 int pae[3] = { 78, 78, 83};
550 run_ojph_expand("simple_dec_irv97_64x64_tiles_LRCP", "jph", "ppm");
551 run_mse_pae("simple_dec_irv97_64x64_tiles_LRCP", "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_64x64_tiles_RLCP.jph -precise -quiet -rate 0.5
559// Clevels=5 Corder=RLCP Cprecincts={2,256} Sorigin={374,1717}
560// Stile_origin={374,1717} -full
561TEST(TestExecutables, SimpleDecIrv9764x64TilesRLCP) {
562 double mse[3] = { 71.8149, 68.7115, 89.4001};
563 int pae[3] = { 78, 78, 83};
564 run_ojph_expand("simple_dec_irv97_64x64_tiles_RLCP", "jph", "ppm");
565 run_mse_pae("simple_dec_irv97_64x64_tiles_RLCP", "ppm", "Malamute.ppm",
566 "", 3, mse, pae);
567}
568
570// Test ojph_expand with codeblocks when the irv97 wavelet is used.
571// Command-line options used to obtain this file is:
572// -o simple_dec_irv97_64x64_tiles_RPCL.jph -precise -quiet -rate 0.5
573// Clevels=5 Corder=RPCL Cprecincts={2,256} Sorigin={374,1717}
574// Stile_origin={374,1717} -full
575TEST(TestExecutables, SimpleDecIrv9764x64TilesRPCL) {
576 double mse[3] = { 71.8149, 68.7115, 89.4001};
577 int pae[3] = { 78, 78, 83};
578 run_ojph_expand("simple_dec_irv97_64x64_tiles_RPCL", "jph", "ppm");
579 run_mse_pae("simple_dec_irv97_64x64_tiles_RPCL", "ppm", "Malamute.ppm",
580 "", 3, mse, pae);
581}
582
584// Test ojph_expand with codeblocks when the irv97 wavelet is used.
585// Command-line options used to obtain this file is:
586// -o simple_dec_irv97_64x64_tiles_PCRL.jph -precise -quiet -rate 0.5
587// Clevels=5 Corder=PCRL Cprecincts={2,256} Sorigin={374,1717}
588// Stile_origin={374,1717} -full
589TEST(TestExecutables, SimpleDecIrv9764x64TilesPCRL) {
590 double mse[3] = { 71.8149, 68.7115, 89.4001};
591 int pae[3] = { 78, 78, 83};
592 run_ojph_expand("simple_dec_irv97_64x64_tiles_PCRL", "jph", "ppm");
593 run_mse_pae("simple_dec_irv97_64x64_tiles_PCRL", "ppm", "Malamute.ppm",
594 "", 3, mse, pae);
595}
596
598// Test ojph_expand with codeblocks when the irv97 wavelet is used.
599// Command-line options used to obtain this file is:
600// -o simple_dec_irv97_64x64_tiles_CPRL.jph -precise -quiet -rate 0.5
601// Clevels=5 Corder=CPRL Cprecincts={2,256} Sorigin={374,1717}
602// Stile_origin={374,1717} -full
603TEST(TestExecutables, SimpleDecIrv9764x64TilesCPRL) {
604 double mse[3] = { 71.8149, 68.7115, 89.4001};
605 int pae[3] = { 78, 78, 83};
606 run_ojph_expand("simple_dec_irv97_64x64_tiles_CPRL", "jph", "ppm");
607 run_mse_pae("simple_dec_irv97_64x64_tiles_CPRL", "ppm", "Malamute.ppm",
608 "", 3, mse, pae);
609}
610
612// Test ojph_expand with codeblocks when the irv97 wavelet is used.
613// Command-line options used to obtain this file is:
614// -o simple_dec_irv97_64x64_tiles_LRCP33.jph -precise -quiet -rate 0.5
615// Clevels=5 Corder=LRCP Sorigin={5,33} Stile_origin={5,10} Stiles={33,257}
616// -full
617TEST(TestExecutables, SimpleDecIrv9764x64TilesLRCP33) {
618 double mse[3] = { 56.2139, 51.4121, 69.0107};
619 int pae[3] = { 80, 81, 98};
620 run_ojph_expand("simple_dec_irv97_64x64_tiles_LRCP33", "jph", "ppm");
621 run_mse_pae("simple_dec_irv97_64x64_tiles_LRCP33", "ppm", "Malamute.ppm",
622 "", 3, mse, pae);
623}
624
626// Test ojph_expand with codeblocks when the irv97 wavelet is used.
627// Command-line options used to obtain this file is:
628// -o simple_dec_irv97_64x64_tiles_RLCP33.jph -precise -quiet -rate 0.5
629// Clevels=5 Corder=RLCP Sorigin={5,33} Stile_origin={5,10} Stiles={33,257}
630// -full
631TEST(TestExecutables, SimpleDecIrv9764x64TilesRLCP33) {
632 double mse[3] = { 56.2139, 51.4121, 69.0107};
633 int pae[3] = { 80, 81, 98};
634 run_ojph_expand("simple_dec_irv97_64x64_tiles_RLCP33", "jph", "ppm");
635 run_mse_pae("simple_dec_irv97_64x64_tiles_RLCP33", "ppm", "Malamute.ppm",
636 "", 3, mse, pae);
637}
638
640// Test ojph_expand with codeblocks when the irv97 wavelet is used.
641// Command-line options used to obtain this file is:
642// -o simple_dec_irv97_64x64_tiles_RPCL33.jph -precise -quiet -rate 0.5
643// Clevels=5 Corder=RPCL Sorigin={5,33} Stile_origin={5,10} Stiles={33,257}
644// -full
645TEST(TestExecutables, SimpleDecIrv9764x64TilesRPCL33) {
646 double mse[3] = { 56.2139, 51.4121, 69.0107};
647 int pae[3] = { 80, 81, 98};
648 run_ojph_expand("simple_dec_irv97_64x64_tiles_RPCL33", "jph", "ppm");
649 run_mse_pae("simple_dec_irv97_64x64_tiles_RPCL33", "ppm", "Malamute.ppm",
650 "", 3, mse, pae);
651}
652
654// Test ojph_expand with codeblocks when the irv97 wavelet is used.
655// Command-line options used to obtain this file is:
656// -o simple_dec_irv97_64x64_tiles_PCRL33.jph -precise -quiet -rate 0.5
657// Clevels=5 Corder=PCRL Sorigin={5,33} Stile_origin={5,10} Stiles={33,257}
658// -full
659TEST(TestExecutables, SimpleDecIrv9764x64TilesPCRL33) {
660 double mse[3] = { 56.2139, 51.4121, 69.0107};
661 int pae[3] = { 80, 81, 98};
662 run_ojph_expand("simple_dec_irv97_64x64_tiles_PCRL33", "jph", "ppm");
663 run_mse_pae("simple_dec_irv97_64x64_tiles_PCRL33", "ppm", "Malamute.ppm",
664 "", 3, mse, pae);
665}
666
668// Test ojph_expand with codeblocks when the irv97 wavelet is used.
669// Command-line options used to obtain this file is:
670// -o simple_dec_irv97_64x64_tiles_CPRL33.jph -precise -quiet -rate 0.5
671// Clevels=5 Corder=CPRL Sorigin={5,33} Stile_origin={5,10} Stiles={33,257}
672// -full
673TEST(TestExecutables, SimpleDecIrv9764x64TilesCPRL33) {
674 double mse[3] = { 56.2139, 51.4121, 69.0107};
675 int pae[3] = { 80, 81, 98};
676 run_ojph_expand("simple_dec_irv97_64x64_tiles_CPRL33", "jph", "ppm");
677 run_mse_pae("simple_dec_irv97_64x64_tiles_CPRL33", "ppm", "Malamute.ppm",
678 "", 3, mse, pae);
679}
680
682// Test ojph_expand with codeblocks when the irv97 wavelet is used.
683// Command-line options used to obtain this file is:
684// -o simple_dec_irv97_64x64_tiles_LRCP33x33.jph -precise -quiet -rate 0.5
685// Clevels=5 Corder=LRCP Sorigin={5,33} Stile_origin={5,10} Stiles={33,33}
686// -full
687TEST(TestExecutables, SimpleDecIrv9764x64TilesLRCP33x33) {
688 double mse[3] = { 210.283, 210.214, 257.276};
689 int pae[3] = { 165, 161, 166};
690 run_ojph_expand("simple_dec_irv97_64x64_tiles_LRCP33x33", "jph", "ppm");
691 run_mse_pae("simple_dec_irv97_64x64_tiles_LRCP33x33", "ppm", "Malamute.ppm",
692 "", 3, mse, pae);
693}
694
696// Test ojph_expand with codeblocks when the irv97 wavelet is used.
697// Command-line options used to obtain this file is:
698// -o simple_dec_irv97_64x64_tiles_RLCP33x33.jph -precise -quiet -rate 0.5
699// Clevels=5 Corder=RLCP Sorigin={5,33} Stile_origin={5,10} Stiles={33,33}
700// -full
701TEST(TestExecutables, SimpleDecIrv9764x64TilesRLCP33x33) {
702 double mse[3] = { 210.283, 210.214, 257.276};
703 int pae[3] = { 165, 161, 166};
704 run_ojph_expand("simple_dec_irv97_64x64_tiles_RLCP33x33", "jph", "ppm");
705 run_mse_pae("simple_dec_irv97_64x64_tiles_RLCP33x33", "ppm", "Malamute.ppm",
706 "", 3, mse, pae);
707}
708
710// Test ojph_expand with codeblocks when the irv97 wavelet is used.
711// Command-line options used to obtain this file is:
712// -o simple_dec_irv97_64x64_tiles_RPCL33x33.jph -precise -quiet -rate 0.5
713// Clevels=5 Corder=RPCL Sorigin={5,33} Stile_origin={5,10} Stiles={33,33}
714// -full
715TEST(TestExecutables, SimpleDecIrv9764x64TilesRPCL33x33) {
716 double mse[3] = { 210.283, 210.214, 257.276};
717 int pae[3] = { 165, 161, 166};
718 run_ojph_expand("simple_dec_irv97_64x64_tiles_RPCL33x33", "jph", "ppm");
719 run_mse_pae("simple_dec_irv97_64x64_tiles_RPCL33x33", "ppm", "Malamute.ppm",
720 "", 3, mse, pae);
721}
722
724// Test ojph_expand with codeblocks when the irv97 wavelet is used.
725// Command-line options used to obtain this file is:
726// -o simple_dec_irv97_64x64_tiles_PCRL33x33.jph -precise -quiet -rate 0.5
727// Clevels=5 Corder=PCRL Sorigin={5,33} Stile_origin={5,10} Stiles={33,33}
728// -full
729TEST(TestExecutables, SimpleDecIrv9764x64TilesPCRL33x33) {
730 double mse[3] = { 210.283, 210.214, 257.276};
731 int pae[3] = { 165, 161, 166};
732 run_ojph_expand("simple_dec_irv97_64x64_tiles_PCRL33x33", "jph", "ppm");
733 run_mse_pae("simple_dec_irv97_64x64_tiles_PCRL33x33", "ppm", "Malamute.ppm",
734 "", 3, mse, pae);
735}
736
738// Test ojph_expand with codeblocks when the irv97 wavelet is used.
739// Command-line options used to obtain this file is:
740// -o simple_dec_irv97_64x64_tiles_CPRL33x33.jph -precise -quiet -rate 0.5
741// Clevels=5 Corder=CPRL Sorigin={5,33} Stile_origin={5,10} Stiles={33,33}
742// -full
743TEST(TestExecutables, SimpleDecIrv9764x64TilesCPRL33x33) {
744 double mse[3] = { 210.283, 210.214, 257.276};
745 int pae[3] = { 165, 161, 166};
746 run_ojph_expand("simple_dec_irv97_64x64_tiles_CPRL33x33", "jph", "ppm");
747 run_mse_pae("simple_dec_irv97_64x64_tiles_CPRL33x33", "ppm", "Malamute.ppm",
748 "", 3, mse, pae);
749}
750
752// Test ojph_expand with codeblocks when the rev53 wavelet is used.
753// Command-line options used to obtain this file is:
754// -o simple_dec_rev53_64x64_gray_tiles.jph -precise -quiet Creversible=yes
755// Clevels=5 Stiles={33,257} -full
756TEST(TestExecutables, SimpleDecRev5364x64GrayTiles) {
757 double mse[1] = { 0};
758 int pae[1] = { 0};
759 run_ojph_expand("simple_dec_rev53_64x64_gray_tiles", "jph", "pgm");
760 run_mse_pae("simple_dec_rev53_64x64_gray_tiles", "pgm", "monarch.pgm",
761 "", 1, mse, pae);
762}
763
765// Test ojph_expand with codeblocks when the irv97 wavelet is used.
766// Command-line options used to obtain this file is:
767// -o simple_dec_irv97_64x64_gray_tiles.jph -precise -quiet -rate 0.5
768// Clevels=5 Stiles={33,257} -full
769TEST(TestExecutables, SimpleDecIrv9764x64GrayTiles) {
770 double mse[1] = { 18.9601};
771 int pae[1] = { 56};
772 run_ojph_expand("simple_dec_irv97_64x64_gray_tiles", "jph", "pgm");
773 run_mse_pae("simple_dec_irv97_64x64_gray_tiles", "pgm", "monarch.pgm",
774 "", 1, mse, pae);
775}
776
778// Test ojph_expand with codeblocks when the irv97 wavelet is used.
779// Command-line options used to obtain this file is:
780// -o simple_dec_irv97_64x64_16bit.jph -precise -quiet -rate 0.5 -full
781TEST(TestExecutables, SimpleDecIrv9764x6416bit) {
782 double mse[3] = { 60507.2, 36672.5, 64809.8};
783 int pae[3] = { 2547, 1974, 1922};
784 run_ojph_expand("simple_dec_irv97_64x64_16bit", "jph", "ppm");
785 run_mse_pae("simple_dec_irv97_64x64_16bit", "ppm", "mm.ppm",
786 "", 3, mse, pae);
787}
788
790// Test ojph_expand with codeblocks when the irv97 wavelet is used.
791// Command-line options used to obtain this file is:
792// -o simple_dec_irv97_64x64_16bit_gray.jph -precise -quiet -rate 0.5 -full
793TEST(TestExecutables, SimpleDecIrv9764x6416bitGray) {
794 double mse[1] = { 19382.9};
795 int pae[1] = { 1618};
796 run_ojph_expand("simple_dec_irv97_64x64_16bit_gray", "jph", "pgm");
797 run_mse_pae("simple_dec_irv97_64x64_16bit_gray", "pgm", "mm.pgm",
798 "", 1, mse, pae);
799}
800
802// Test ojph_expand with codeblocks when the rev53 wavelet is used.
803// Command-line options used to obtain this file is:
804// -o simple_dec_rev53_64x64_16bit.jph -precise -quiet Creversible=yes -full
805TEST(TestExecutables, SimpleDecRev5364x6416bit) {
806 double mse[3] = { 0, 0, 0};
807 int pae[3] = { 0, 0, 0};
808 run_ojph_expand("simple_dec_rev53_64x64_16bit", "jph", "ppm");
809 run_mse_pae("simple_dec_rev53_64x64_16bit", "ppm", "mm.ppm",
810 "", 3, mse, pae);
811}
812
814// Test ojph_expand with codeblocks when the rev53 wavelet is used.
815// Command-line options used to obtain this file is:
816// -o simple_dec_rev53_64x64_16bit_gray.jph -precise -quiet Creversible=yes
817// -full
818TEST(TestExecutables, SimpleDecRev5364x6416bitGray) {
819 double mse[1] = { 0};
820 int pae[1] = { 0};
821 run_ojph_expand("simple_dec_rev53_64x64_16bit_gray", "jph", "pgm");
822 run_mse_pae("simple_dec_rev53_64x64_16bit_gray", "pgm", "mm.pgm",
823 "", 1, mse, pae);
824}
825
827// Test ojph_compress with codeblocks when the irv97 wavelet is used.
828// We test by comparing MSE and PAE of decoded images.
829// The compressed file is obtained using these command-line options:
830// -o simple_enc_irv97_64x64.j2c -qstep 0.1
831TEST(TestExecutables, SimpleEncIrv9764x64) {
832 double mse[3] = { 46.2004, 43.622, 56.7452};
833 int pae[3] = { 48, 46, 52};
834 run_ojph_compress("Malamute.ppm",
835 "simple_enc_irv97_64x64", "", "j2c",
836 "-qstep 0.1");
837 run_ojph_compress_expand("simple_enc_irv97_64x64", "j2c", "ppm");
838 run_mse_pae("simple_enc_irv97_64x64", "ppm",
839 "Malamute.ppm", "", 3, mse, pae);
840}
841
843// Test ojph_compress with codeblocks when the irv97 wavelet is used.
844// We test by comparing MSE and PAE of decoded images.
845// The compressed file is obtained using these command-line options:
846// -o simple_enc_irv97_32x32.j2c -qstep 0.01 -block_size {32,32}
847TEST(TestExecutables, SimpleEncIrv9732x32) {
848 double mse[3] = { 1.78779, 1.26001, 2.38395};
849 int pae[3] = { 7, 6, 9};
850 run_ojph_compress("Malamute.ppm",
851 "simple_enc_irv97_32x32", "", "j2c",
852 "-qstep 0.01 -block_size \"{32,32}\"");
853 run_ojph_compress_expand("simple_enc_irv97_32x32", "j2c", "ppm");
854 run_mse_pae("simple_enc_irv97_32x32", "ppm",
855 "Malamute.ppm", "", 3, mse, pae);
856}
857
859// Test ojph_compress with codeblocks when the irv97 wavelet is used.
860// We test by comparing MSE and PAE of decoded images.
861// The compressed file is obtained using these command-line options:
862// -o simple_enc_irv97_16x16.j2c -qstep 0.01 -block_size {16,16}
863TEST(TestExecutables, SimpleEncIrv9716x16) {
864 double mse[3] = { 1.78779, 1.26001, 2.38395};
865 int pae[3] = { 7, 6, 9};
866 run_ojph_compress("Malamute.ppm",
867 "simple_enc_irv97_16x16", "", "j2c",
868 "-qstep 0.01 -block_size \"{16,16}\"");
869 run_ojph_compress_expand("simple_enc_irv97_16x16", "j2c", "ppm");
870 run_mse_pae("simple_enc_irv97_16x16", "ppm",
871 "Malamute.ppm", "", 3, mse, pae);
872}
873
875// Test ojph_compress with codeblocks when the irv97 wavelet is used.
876// We test by comparing MSE and PAE of decoded images.
877// The compressed file is obtained using these command-line options:
878// -o simple_enc_irv97_4x4.j2c -qstep 0.01 -block_size {4,4}
879TEST(TestExecutables, SimpleEncIrv974x4) {
880 double mse[3] = { 1.78779, 1.26001, 2.38395};
881 int pae[3] = { 7, 6, 9};
882 run_ojph_compress("Malamute.ppm",
883 "simple_enc_irv97_4x4", "", "j2c",
884 "-qstep 0.01 -block_size \"{4,4}\"");
885 run_ojph_compress_expand("simple_enc_irv97_4x4", "j2c", "ppm");
886 run_mse_pae("simple_enc_irv97_4x4", "ppm",
887 "Malamute.ppm", "", 3, mse, pae);
888}
889
891// Test ojph_compress with codeblocks when the irv97 wavelet is used.
892// We test by comparing MSE and PAE of decoded images.
893// The compressed file is obtained using these command-line options:
894// -o simple_enc_irv97_1024x4.j2c -qstep 0.01 -block_size {4,1024}
895TEST(TestExecutables, SimpleEncIrv971024x4) {
896 double mse[3] = { 1.78779, 1.26001, 2.38395};
897 int pae[3] = { 7, 6, 9};
898 run_ojph_compress("Malamute.ppm",
899 "simple_enc_irv97_1024x4", "", "j2c",
900 "-qstep 0.01 -block_size \"{4,1024}\"");
901 run_ojph_compress_expand("simple_enc_irv97_1024x4", "j2c", "ppm");
902 run_mse_pae("simple_enc_irv97_1024x4", "ppm",
903 "Malamute.ppm", "", 3, mse, pae);
904}
905
907// Test ojph_compress with codeblocks when the irv97 wavelet is used.
908// We test by comparing MSE and PAE of decoded images.
909// The compressed file is obtained using these command-line options:
910// -o simple_enc_irv97_4x1024.j2c -qstep 0.01 -block_size {1024,4}
911TEST(TestExecutables, SimpleEncIrv974x1024) {
912 double mse[3] = { 1.78779, 1.26001, 2.38395};
913 int pae[3] = { 7, 6, 9};
914 run_ojph_compress("Malamute.ppm",
915 "simple_enc_irv97_4x1024", "", "j2c",
916 "-qstep 0.01 -block_size \"{1024,4}\"");
917 run_ojph_compress_expand("simple_enc_irv97_4x1024", "j2c", "ppm");
918 run_mse_pae("simple_enc_irv97_4x1024", "ppm",
919 "Malamute.ppm", "", 3, mse, pae);
920}
921
923// Test ojph_compress with codeblocks when the irv97 wavelet is used.
924// We test by comparing MSE and PAE of decoded images.
925// The compressed file is obtained using these command-line options:
926// -o simple_enc_irv97_512x8.j2c -qstep 0.01 -block_size {8,512}
927TEST(TestExecutables, SimpleEncIrv97512x8) {
928 double mse[3] = { 1.78779, 1.26001, 2.38395};
929 int pae[3] = { 7, 6, 9};
930 run_ojph_compress("Malamute.ppm",
931 "simple_enc_irv97_512x8", "", "j2c",
932 "-qstep 0.01 -block_size \"{8,512}\"");
933 run_ojph_compress_expand("simple_enc_irv97_512x8", "j2c", "ppm");
934 run_mse_pae("simple_enc_irv97_512x8", "ppm",
935 "Malamute.ppm", "", 3, mse, pae);
936}
937
939// Test ojph_compress with codeblocks when the irv97 wavelet is used.
940// We test by comparing MSE and PAE of decoded images.
941// The compressed file is obtained using these command-line options:
942// -o simple_enc_irv97_8x512.j2c -qstep 0.01 -block_size {512,8}
943TEST(TestExecutables, SimpleEncIrv978x512) {
944 double mse[3] = { 1.78779, 1.26001, 2.38395};
945 int pae[3] = { 7, 6, 9};
946 run_ojph_compress("Malamute.ppm",
947 "simple_enc_irv97_8x512", "", "j2c",
948 "-qstep 0.01 -block_size \"{512,8}\"");
949 run_ojph_compress_expand("simple_enc_irv97_8x512", "j2c", "ppm");
950 run_mse_pae("simple_enc_irv97_8x512", "ppm",
951 "Malamute.ppm", "", 3, mse, pae);
952}
953
955// Test ojph_compress with codeblocks when the irv97 wavelet is used.
956// We test by comparing MSE and PAE of decoded images.
957// The compressed file is obtained using these command-line options:
958// -o simple_enc_irv97_256x16.j2c -qstep 0.01 -block_size {16,256}
959TEST(TestExecutables, SimpleEncIrv97256x16) {
960 double mse[3] = { 1.78779, 1.26001, 2.38395};
961 int pae[3] = { 7, 6, 9};
962 run_ojph_compress("Malamute.ppm",
963 "simple_enc_irv97_256x16", "", "j2c",
964 "-qstep 0.01 -block_size \"{16,256}\"");
965 run_ojph_compress_expand("simple_enc_irv97_256x16", "j2c", "ppm");
966 run_mse_pae("simple_enc_irv97_256x16", "ppm",
967 "Malamute.ppm", "", 3, mse, pae);
968}
969
971// Test ojph_compress with codeblocks when the irv97 wavelet is used.
972// We test by comparing MSE and PAE of decoded images.
973// The compressed file is obtained using these command-line options:
974// -o simple_enc_irv97_16x256.j2c -qstep 0.01 -block_size {256,16}
975TEST(TestExecutables, SimpleEncIrv9716x256) {
976 double mse[3] = { 1.78779, 1.26001, 2.38395};
977 int pae[3] = { 7, 6, 9};
978 run_ojph_compress("Malamute.ppm",
979 "simple_enc_irv97_16x256", "", "j2c",
980 "-qstep 0.01 -block_size \"{256,16}\"");
981 run_ojph_compress_expand("simple_enc_irv97_16x256", "j2c", "ppm");
982 run_mse_pae("simple_enc_irv97_16x256", "ppm",
983 "Malamute.ppm", "", 3, mse, pae);
984}
985
987// Test ojph_compress with codeblocks when the irv97 wavelet is used.
988// We test by comparing MSE and PAE of decoded images.
989// The compressed file is obtained using these command-line options:
990// -o simple_enc_irv97_128x32.j2c -qstep 0.01 -block_size {32,128}
991TEST(TestExecutables, SimpleEncIrv97128x32) {
992 double mse[3] = { 1.78779, 1.26001, 2.38395};
993 int pae[3] = { 7, 6, 9};
994 run_ojph_compress("Malamute.ppm",
995 "simple_enc_irv97_128x32", "", "j2c",
996 "-qstep 0.01 -block_size \"{32,128}\"");
997 run_ojph_compress_expand("simple_enc_irv97_128x32", "j2c", "ppm");
998 run_mse_pae("simple_enc_irv97_128x32", "ppm",
999 "Malamute.ppm", "", 3, mse, pae);
1000}
1001
1003// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1004// We test by comparing MSE and PAE of decoded images.
1005// The compressed file is obtained using these command-line options:
1006// -o simple_enc_irv97_32x128.j2c -qstep 0.01 -block_size {128,32}
1007TEST(TestExecutables, SimpleEncIrv9732x128) {
1008 double mse[3] = { 1.78779, 1.26001, 2.38395};
1009 int pae[3] = { 7, 6, 9};
1010 run_ojph_compress("Malamute.ppm",
1011 "simple_enc_irv97_32x128", "", "j2c",
1012 "-qstep 0.01 -block_size \"{128,32}\"");
1013 run_ojph_compress_expand("simple_enc_irv97_32x128", "j2c", "ppm");
1014 run_mse_pae("simple_enc_irv97_32x128", "ppm",
1015 "Malamute.ppm", "", 3, mse, pae);
1016}
1017
1019// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1020// We test by comparing MSE and PAE of decoded images.
1021// The compressed file is obtained using these command-line options:
1022// -o simple_enc_irv97_64x64_16bit.j2c -qstep 0.01
1023TEST(TestExecutables, SimpleEncIrv9764x6416bit) {
1024 double mse[3] = { 51727.3, 32596.4, 45897.8};
1025 int pae[3] = { 1512, 1481, 1778};
1026 run_ojph_compress("mm.ppm",
1027 "simple_enc_irv97_64x64_16bit", "", "j2c",
1028 "-qstep 0.01");
1029 run_ojph_compress_expand("simple_enc_irv97_64x64_16bit", "j2c", "ppm");
1030 run_mse_pae("simple_enc_irv97_64x64_16bit", "ppm",
1031 "mm.ppm", "", 3, mse, pae);
1032}
1033
1035// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1036// We test by comparing MSE and PAE of decoded images.
1037// The compressed file is obtained using these command-line options:
1038// -o simple_enc_irv97_64x64_16bit_gray.j2c -qstep 0.01
1039TEST(TestExecutables, SimpleEncIrv9764x6416bitGray) {
1040 double mse[1] = { 25150.6};
1041 int pae[1] = { 1081};
1042 run_ojph_compress("mm.pgm",
1043 "simple_enc_irv97_64x64_16bit_gray", "", "j2c",
1044 "-qstep 0.01");
1045 run_ojph_compress_expand("simple_enc_irv97_64x64_16bit_gray", "j2c", "pgm");
1046 run_mse_pae("simple_enc_irv97_64x64_16bit_gray", "pgm",
1047 "mm.pgm", "", 1, mse, pae);
1048}
1049
1051// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1052// We test by comparing MSE and PAE of decoded images.
1053// The compressed file is obtained using these command-line options:
1054// -o simple_enc_rev53_64x64_16bit.j2c -reversible true
1055TEST(TestExecutables, SimpleEncRev5364x6416bit) {
1056 double mse[3] = { 0, 0, 0};
1057 int pae[3] = { 0, 0, 0};
1058 run_ojph_compress("mm.ppm",
1059 "simple_enc_rev53_64x64_16bit", "", "j2c",
1060 "-reversible true");
1061 run_ojph_compress_expand("simple_enc_rev53_64x64_16bit", "j2c", "ppm");
1062 run_mse_pae("simple_enc_rev53_64x64_16bit", "ppm",
1063 "mm.ppm", "", 3, mse, pae);
1064}
1065
1067// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1068// We test by comparing MSE and PAE of decoded images.
1069// The compressed file is obtained using these command-line options:
1070// -o simple_enc_rev53_64x64_16bit_gray.j2c -reversible true
1071TEST(TestExecutables, SimpleEncRev5364x6416bitGray) {
1072 double mse[1] = { 0};
1073 int pae[1] = { 0};
1074 run_ojph_compress("mm.pgm",
1075 "simple_enc_rev53_64x64_16bit_gray", "", "j2c",
1076 "-reversible true");
1077 run_ojph_compress_expand("simple_enc_rev53_64x64_16bit_gray", "j2c", "pgm");
1078 run_mse_pae("simple_enc_rev53_64x64_16bit_gray", "pgm",
1079 "mm.pgm", "", 1, mse, pae);
1080}
1081
1083// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1084// We test by comparing MSE and PAE of decoded images.
1085// The compressed file is obtained using these command-line options:
1086// -o simple_enc_rev53_64x64_16bit.j2c -reversible true
1087TEST(TestExecutables, SimpleEncRev5364x64) {
1088 double mse[3] = { 0, 0, 0};
1089 int pae[3] = { 0, 0, 0};
1090 run_ojph_compress("Malamute.ppm",
1091 "simple_enc_rev53_64x64", "", "j2c",
1092 "-reversible true");
1093 run_ojph_compress_expand("simple_enc_rev53_64x64", "j2c", "ppm");
1094 run_mse_pae("simple_enc_rev53_64x64", "ppm",
1095 "Malamute.ppm", "", 3, mse, pae);
1096}
1097
1099// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1100// We test by comparing MSE and PAE of decoded images.
1101// The compressed file is obtained using these command-line options:
1102// -o simple_enc_rev53_32x32.j2c -reversible true -block_size {32,32}
1103TEST(TestExecutables, SimpleEncRev5332x32) {
1104 double mse[3] = { 0, 0, 0};
1105 int pae[3] = { 0, 0, 0};
1106 run_ojph_compress("Malamute.ppm",
1107 "simple_enc_rev53_32x32", "", "j2c",
1108 "-reversible true -block_size \"{32,32}\"");
1109 run_ojph_compress_expand("simple_enc_rev53_32x32", "j2c", "ppm");
1110 run_mse_pae("simple_enc_rev53_32x32", "ppm",
1111 "Malamute.ppm", "", 3, mse, pae);
1112}
1113
1115// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1116// We test by comparing MSE and PAE of decoded images.
1117// The compressed file is obtained using these command-line options:
1118// -o simple_enc_rev53_4x4.j2c -reversible true -block_size {4,4}
1119TEST(TestExecutables, SimpleEncRev534x4) {
1120 double mse[3] = { 0, 0, 0};
1121 int pae[3] = { 0, 0, 0};
1122 run_ojph_compress("Malamute.ppm",
1123 "simple_enc_rev53_4x4", "", "j2c",
1124 "-reversible true -block_size \"{4,4}\"");
1125 run_ojph_compress_expand("simple_enc_rev53_4x4", "j2c", "ppm");
1126 run_mse_pae("simple_enc_rev53_4x4", "ppm",
1127 "Malamute.ppm", "", 3, mse, pae);
1128}
1129
1131// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1132// We test by comparing MSE and PAE of decoded images.
1133// The compressed file is obtained using these command-line options:
1134// -o simple_enc_rev53_1024x4.j2c -reversible true -block_size {4,1024}
1135TEST(TestExecutables, SimpleEncRev531024x4) {
1136 double mse[3] = { 0, 0, 0};
1137 int pae[3] = { 0, 0, 0};
1138 run_ojph_compress("Malamute.ppm",
1139 "simple_enc_rev53_1024x4", "", "j2c",
1140 "-reversible true -block_size \"{4,1024}\"");
1141 run_ojph_compress_expand("simple_enc_rev53_1024x4", "j2c", "ppm");
1142 run_mse_pae("simple_enc_rev53_1024x4", "ppm",
1143 "Malamute.ppm", "", 3, mse, pae);
1144}
1145
1147// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1148// We test by comparing MSE and PAE of decoded images.
1149// The compressed file is obtained using these command-line options:
1150// -o simple_enc_rev53_4x1024.j2c -reversible true -block_size {1024,4}
1151TEST(TestExecutables, SimpleEncRev534x1024) {
1152 double mse[3] = { 0, 0, 0};
1153 int pae[3] = { 0, 0, 0};
1154 run_ojph_compress("Malamute.ppm",
1155 "simple_enc_rev53_4x1024", "", "j2c",
1156 "-reversible true -block_size \"{1024,4}\"");
1157 run_ojph_compress_expand("simple_enc_rev53_4x1024", "j2c", "ppm");
1158 run_mse_pae("simple_enc_rev53_4x1024", "ppm",
1159 "Malamute.ppm", "", 3, mse, pae);
1160}
1161
1163// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1164// We test by comparing MSE and PAE of decoded images.
1165// The compressed file is obtained using these command-line options:
1166// -o simple_enc_irv97_64x64_yuv.j2c -qstep 0.1 -dims {352,288} -num_comps 3
1167// -downsamp {1,1},{2,2},{2,2} -bit_depth 8,8,8 -signed false,false,false
1168TEST(TestExecutables, SimpleEncIrv9764x64Yuv) {
1169 double mse[3] = { 30.3548, 7.69602, 5.22246};
1170 int pae[3] = { 49, 27, 26};
1171 run_ojph_compress("foreman_420.yuv",
1172 "simple_enc_irv97_64x64_yuv", "", "j2c",
1173 "-qstep 0.1 -dims \"{352,288}\" -num_comps 3 -downsamp"
1174 " \"{1,1}\",\"{2,2}\",\"{2,2}\" -bit_depth 8,8,8"
1175 " -signed false,false,false");
1176 run_ojph_compress_expand("simple_enc_irv97_64x64_yuv", "j2c", "yuv");
1177 run_mse_pae("simple_enc_irv97_64x64_yuv", "yuv",
1178 "foreman_420.yuv", ":352x288x8x420", 3, mse, pae);
1179}
1180
1182// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1183// We test by comparing MSE and PAE of decoded images.
1184// The compressed file is obtained using these command-line options:
1185// -o simple_enc_rev53_64x64_yuv.j2c -reversible true -qstep 0.1 -dims
1186// {352,288} -num_comps 3 -downsamp {1,1},{2,2},{2,2} -bit_depth 8,8,8 -signed
1187// false,false,false
1188TEST(TestExecutables, SimpleEncRev5364x64Yuv) {
1189 double mse[3] = { 0, 0, 0};
1190 int pae[3] = { 0, 0, 0};
1191 run_ojph_compress("foreman_420.yuv",
1192 "simple_enc_rev53_64x64_yuv", "", "j2c",
1193 "-reversible true -qstep 0.1 -dims \"{352,288}\""
1194 " -num_comps 3 -downsamp \"{1,1}\",\"{2,2}\",\"{2,2}\""
1195 " -bit_depth 8,8,8 -signed false,false,false");
1196 run_ojph_compress_expand("simple_enc_rev53_64x64_yuv", "j2c", "yuv");
1197 run_mse_pae("simple_enc_rev53_64x64_yuv", "yuv",
1198 "foreman_420.yuv", ":352x288x8x420", 3, mse, pae);
1199}
1200
1202// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1203// We test by comparing MSE and PAE of decoded images.
1204// The compressed file is obtained using these command-line options:
1205// -o simple_enc_irv97_tall_narrow.j2c -qstep 0.1
1206TEST(TestExecutables, SimpleEncIrv97TallNarrow) {
1207 double mse[3] = { 112.097, 79.2214, 71.1367};
1208 int pae[3] = { 56, 41, 32};
1209 run_ojph_compress("tall_narrow.ppm",
1210 "simple_enc_irv97_tall_narrow", "", "j2c",
1211 "-qstep 0.1");
1212 run_ojph_compress_expand("simple_enc_irv97_tall_narrow", "j2c", "ppm");
1213 run_mse_pae("simple_enc_irv97_tall_narrow", "ppm",
1214 "tall_narrow.ppm", "", 3, mse, pae);
1215}
1216
1218// Test ojph_compress with codeblocks when the irv97 wavelet is used.
1219// We test by comparing MSE and PAE of decoded images.
1220// The compressed file is obtained using these command-line options:
1221// -o simple_enc_irv97_tall_narrow1.j2c -image_offset {1,0} -qstep 0.1
1222TEST(TestExecutables, SimpleEncIrv97TallNarrow1) {
1223 double mse[3] = { 96.7935, 69.6824, 66.7822};
1224 int pae[3] = { 41, 39, 35};
1225 run_ojph_compress("tall_narrow.ppm",
1226 "simple_enc_irv97_tall_narrow1", "", "j2c",
1227 "-image_offset \"{1,0}\" -qstep 0.1");
1228 run_ojph_compress_expand("simple_enc_irv97_tall_narrow1", "j2c", "ppm");
1229 run_mse_pae("simple_enc_irv97_tall_narrow1", "ppm",
1230 "tall_narrow.ppm", "", 3, mse, pae);
1231}
1232
1234// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1235// We test by comparing MSE and PAE of decoded images.
1236// The compressed file is obtained using these command-line options:
1237// -o simple_enc_rev53_tall_narrow.j2c -reversible true
1238TEST(TestExecutables, SimpleEncRev53TallNarrow) {
1239 double mse[3] = { 0, 0, 0};
1240 int pae[3] = { 0, 0, 0};
1241 run_ojph_compress("tall_narrow.ppm",
1242 "simple_enc_rev53_tall_narrow", "", "j2c",
1243 "-reversible true");
1244 run_ojph_compress_expand("simple_enc_rev53_tall_narrow", "j2c", "ppm");
1245 run_mse_pae("simple_enc_rev53_tall_narrow", "ppm",
1246 "tall_narrow.ppm", "", 3, mse, pae);
1247}
1248
1250// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1251// We test by comparing MSE and PAE of decoded images.
1252// The compressed file is obtained using these command-line options:
1253// -o simple_enc_rev53_tall_narrow1.j2c -image_offset {1,0} -reversible true
1254TEST(TestExecutables, SimpleEncRev53TallNarrow1) {
1255 double mse[3] = { 0, 0, 0};
1256 int pae[3] = { 0, 0, 0};
1257 run_ojph_compress("tall_narrow.ppm",
1258 "simple_enc_rev53_tall_narrow1", "", "j2c",
1259 "-image_offset \"{1,0}\" -reversible true");
1260 run_ojph_compress_expand("simple_enc_rev53_tall_narrow1", "j2c", "ppm");
1261 run_mse_pae("simple_enc_rev53_tall_narrow1", "ppm",
1262 "tall_narrow.ppm", "", 3, mse, pae);
1263}
1264
1266// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1267// We test by comparing MSE and PAE of decoded images.
1268// The compressed file is obtained using these command-line options:
1269// -o dpx_enc_1280x720_10bit_le_nuke11.j2c -reversible true
1270TEST(TestExecutables, DpxEnc1280x72010bitLeNuke11) {
1271 double mse[3] = { 0, 0, 0};
1272 int pae[3] = { 0, 0, 0};
1273 run_ojph_compress("dpx_1280x720_10bit.ppm",
1274 "dpx_enc_1280x720_10bit_le_nuke11", "", "j2c",
1275 "-reversible true");
1276 run_ojph_compress_expand("dpx_enc_1280x720_10bit_le_nuke11", "j2c", "ppm");
1277 run_mse_pae("dpx_enc_1280x720_10bit_le_nuke11", "ppm",
1278 "dpx_1280x720_10bit.ppm", "", 3, mse, pae);
1279}
1280
1282// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1283// We test by comparing MSE and PAE of decoded images.
1284// The compressed file is obtained using these command-line options:
1285// -o dpx_enc_1280x720_10bit_be_nuke11.j2c -reversible true
1286TEST(TestExecutables, DpxEnc1280x72010bitBeNuke11) {
1287 double mse[3] = { 0, 0, 0};
1288 int pae[3] = { 0, 0, 0};
1289 run_ojph_compress("dpx_1280x720_10bit.ppm",
1290 "dpx_enc_1280x720_10bit_be_nuke11", "", "j2c",
1291 "-reversible true");
1292 run_ojph_compress_expand("dpx_enc_1280x720_10bit_be_nuke11", "j2c", "ppm");
1293 run_mse_pae("dpx_enc_1280x720_10bit_be_nuke11", "ppm",
1294 "dpx_1280x720_10bit.ppm", "", 3, mse, pae);
1295}
1296
1298// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1299// We test by comparing MSE and PAE of decoded images.
1300// The compressed file is obtained using these command-line options:
1301// -o dpx_enc_1280x720_16bit_le_nuke11.j2c -reversible true
1302TEST(TestExecutables, DpxEnc1280x72016bitLeNuke11) {
1303 double mse[3] = { 0, 0, 0};
1304 int pae[3] = { 0, 0, 0};
1305 run_ojph_compress("dpx_1280x720_16bit.ppm",
1306 "dpx_enc_1280x720_16bit_le_nuke11", "", "j2c",
1307 "-reversible true");
1308 run_ojph_compress_expand("dpx_enc_1280x720_16bit_le_nuke11", "j2c", "ppm");
1309 run_mse_pae("dpx_enc_1280x720_16bit_le_nuke11", "ppm",
1310 "dpx_1280x720_16bit.ppm", "", 3, mse, pae);
1311}
1312
1314// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1315// We test by comparing MSE and PAE of decoded images.
1316// The compressed file is obtained using these command-line options:
1317// -o dpx_enc_1280x720_16bit_be_nuke11.j2c -reversible true
1318TEST(TestExecutables, DpxEnc1280x72016bitBeNuke11) {
1319 double mse[3] = { 0, 0, 0};
1320 int pae[3] = { 0, 0, 0};
1321 run_ojph_compress("dpx_1280x720_16bit.ppm",
1322 "dpx_enc_1280x720_16bit_be_nuke11", "", "j2c",
1323 "-reversible true");
1324 run_ojph_compress_expand("dpx_enc_1280x720_16bit_be_nuke11", "j2c", "ppm");
1325 run_mse_pae("dpx_enc_1280x720_16bit_be_nuke11", "ppm",
1326 "dpx_1280x720_16bit.ppm", "", 3, mse, pae);
1327}
1328
1330// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1331// We test by comparing MSE and PAE of decoded images.
1332// The compressed file is obtained using these command-line options:
1333// -o dpx_enc_1280x720_10bit_resolve18.j2c -reversible true
1334TEST(TestExecutables, DpxEnc1280x72010bitResolve18) {
1335 double mse[3] = { 0, 0, 0};
1336 int pae[3] = { 0, 0, 0};
1337 run_ojph_compress("dpx_1280x720_10bit.ppm",
1338 "dpx_enc_1280x720_10bit_resolve18", "", "j2c",
1339 "-reversible true");
1340 run_ojph_compress_expand("dpx_enc_1280x720_10bit_resolve18", "j2c", "ppm");
1341 run_mse_pae("dpx_enc_1280x720_10bit_resolve18", "ppm",
1342 "dpx_1280x720_10bit.ppm", "", 3, mse, pae);
1343}
1344
1346// Test ojph_compress with codeblocks when the rev53 wavelet is used.
1347// We test by comparing MSE and PAE of decoded images.
1348// The compressed file is obtained using these command-line options:
1349// -o dpx_enc_1280x720_16bit_resolve18.j2c -reversible true
1350TEST(TestExecutables, DpxEnc1280x72016bitResolve18) {
1351 double mse[3] = { 0, 0, 0};
1352 int pae[3] = { 0, 0, 0};
1353 run_ojph_compress("dpx_1280x720_16bit.ppm",
1354 "dpx_enc_1280x720_16bit_resolve18", "", "j2c",
1355 "-reversible true");
1356 run_ojph_compress_expand("dpx_enc_1280x720_16bit_resolve18", "j2c", "ppm");
1357 run_mse_pae("dpx_enc_1280x720_16bit_resolve18", "ppm",
1358 "dpx_1280x720_16bit.ppm", "", 3, mse, pae);
1359}
1360
1362// main
1364int main(int argc, char **argv) {
1365 ::testing::InitGoogleTest(&argc, argv);
1366 return RUN_ALL_TESTS();
1367}
message_error error
#define REF_FILE_DIR
static int ojph_pclose(FILE *stream)
#define TOL_DOUBLE
#define COMPRESS_EXECUTABLE
void run_ojph_compress_expand(const std::string &base_filename, const std::string &out_ext, const std::string &decode_ext)
#define COMPARE_FILES_PATH
#define OUT_FILE_DIR
int main(int argc, char **argv)
void run_ojph_expand(const std::string &base_filename, const std::string &src_ext, const std::string &out_ext)
static int execute(const std::string &cmd, std::string &result)
#define EXPAND_EXECUTABLE
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)