Merge pull request #1253 from rouault/floating_point_irreversible_encoding

Single-threaded performance improvements in forward DWT for 5-3 and 9-7 (and other improvements)
This commit is contained in:
Even Rouault 2020-10-09 13:25:27 +02:00 committed by GitHub
commit 491299eb07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 3060 additions and 1974 deletions

View File

@ -256,7 +256,9 @@ if(BUILD_JPIP_SERVER)
endif()
add_subdirectory(src/lib)
option(BUILD_LUTS_GENERATOR "Build utility to generate t1_luts.h" OFF)
if(UNIX)
option(BUILD_UNIT_TESTS "Build unit tests (bench_dwt, test_sparse_array, etc..)" OFF)
endif()
#-----------------------------------------------------------------------------
# Build Applications

View File

@ -301,6 +301,10 @@ static void encode_help_display(void)
fprintf(stdout, " Currently supports only RPCL order.\n");
fprintf(stdout, "-C <comment>\n");
fprintf(stdout, " Add <comment> in the comment marker segment.\n");
if (opj_has_thread_support()) {
fprintf(stdout, " -threads <num_threads|ALL_CPUS>\n"
" Number of threads to use for encoding or ALL_CPUS for all available cores.\n");
}
/* UniPG>> */
#ifdef USE_JPWL
fprintf(stdout, "-W <params>\n");
@ -579,7 +583,8 @@ static int parse_cmdline_encoder(int argc, char **argv,
img_fol_t *img_fol, raw_cparameters_t *raw_cp, char *indexfilename,
size_t indexfilename_size,
int* pOutFramerate,
OPJ_BOOL* pOutPLT)
OPJ_BOOL* pOutPLT,
int* pOutNumThreads)
{
OPJ_UINT32 i, j;
int totlen, c;
@ -596,7 +601,8 @@ static int parse_cmdline_encoder(int argc, char **argv,
{"jpip", NO_ARG, NULL, 'J'},
{"mct", REQ_ARG, NULL, 'Y'},
{"IMF", REQ_ARG, NULL, 'Z'},
{"PLT", NO_ARG, NULL, 'A'}
{"PLT", NO_ARG, NULL, 'A'},
{"threads", REQ_ARG, NULL, 'B'}
};
/* parse the command line */
@ -1679,6 +1685,19 @@ static int parse_cmdline_encoder(int argc, char **argv,
}
break;
/* ----------------------------------------------------- */
case 'B': { /* Number of threads */
if (strcmp(opj_optarg, "ALL_CPUS") == 0) {
*pOutNumThreads = opj_get_num_cpus();
if (*pOutNumThreads == 1) {
*pOutNumThreads = 0;
}
} else {
sscanf(opj_optarg, "%d", pOutNumThreads);
}
}
break;
/* ------------------------------------------------------ */
@ -1860,6 +1879,7 @@ int main(int argc, char **argv)
OPJ_FLOAT64 t = opj_clock();
OPJ_BOOL PLT = OPJ_FALSE;
int num_threads = 0;
/* set encoding parameters to default values */
opj_set_default_encoder_parameters(&parameters);
@ -1880,7 +1900,7 @@ int main(int argc, char **argv)
parameters.tcp_mct = (char)
255; /* This will be set later according to the input image or the provided option */
if (parse_cmdline_encoder(argc, argv, &parameters, &img_fol, &raw_cp,
indexfilename, sizeof(indexfilename), &framerate, &PLT) == 1) {
indexfilename, sizeof(indexfilename), &framerate, &PLT, &num_threads) == 1) {
ret = 1;
goto fin;
}
@ -2141,6 +2161,15 @@ int main(int argc, char **argv)
}
}
if (num_threads >= 1 &&
!opj_codec_set_threads(l_codec, num_threads)) {
fprintf(stderr, "failed to set number of threads\n");
opj_destroy_codec(l_codec);
opj_image_destroy(image);
ret = 1;
goto fin;
}
/* open a byte stream for writing and allocate memory for all tiles */
l_stream = opj_stream_create_default_file_stream(parameters.outfile, OPJ_FALSE);
if (! l_stream) {

View File

@ -199,7 +199,7 @@ if(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
TARGET_LINK_LIBRARIES(${OPENJPEG_LIBRARY_NAME} ${CMAKE_THREAD_LIBS_INIT})
endif(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
if(BUILD_UNIT_TESTS)
if(BUILD_UNIT_TESTS AND UNIX)
add_executable(bench_dwt bench_dwt.c)
if(UNIX)
target_link_libraries(bench_dwt m ${OPENJPEG_LIBRARY_NAME})
@ -215,4 +215,4 @@ if(BUILD_UNIT_TESTS)
if(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
target_link_libraries(test_sparse_array ${CMAKE_THREAD_LIBS_INIT})
endif(OPJ_USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
endif(BUILD_UNIT_TESTS)
endif(BUILD_UNIT_TESTS AND UNIX)

View File

@ -49,7 +49,8 @@ void init_tilec(opj_tcd_tilecomp_t * l_tilec,
OPJ_INT32 y0,
OPJ_INT32 x1,
OPJ_INT32 y1,
OPJ_UINT32 numresolutions)
OPJ_UINT32 numresolutions,
OPJ_BOOL irreversible)
{
opj_tcd_resolution_t* l_res;
OPJ_UINT32 resno, l_level_no;
@ -64,9 +65,16 @@ void init_tilec(opj_tcd_tilecomp_t * l_tilec,
(size_t)(l_tilec->y1 - l_tilec->y0);
l_tilec->data = (OPJ_INT32*) opj_malloc(sizeof(OPJ_INT32) * nValues);
for (i = 0; i < nValues; i++) {
l_tilec->data[i] = getValue((OPJ_UINT32)i);
OPJ_INT32 val = getValue((OPJ_UINT32)i);
if (irreversible) {
OPJ_FLOAT32 fVal = (OPJ_FLOAT32)val;
memcpy(&l_tilec->data[i], &fVal, sizeof(OPJ_FLOAT32));
} else {
l_tilec->data[i] = val;
}
}
l_tilec->numresolutions = numresolutions;
l_tilec->minimum_num_resolutions = numresolutions;
l_tilec->resolutions = (opj_tcd_resolution_t*) opj_calloc(
l_tilec->numresolutions,
sizeof(opj_tcd_resolution_t));
@ -98,9 +106,9 @@ void free_tilec(opj_tcd_tilecomp_t * l_tilec)
void usage(void)
{
printf(
"bench_dwt [-size value] [-check] [-display] [-num_resolutions val]\n");
"bench_dwt [-decode|encode] [-I] [-size value] [-check] [-display]\n");
printf(
" [-offset x y] [-num_threads val]\n");
" [-num_resolutions val] [-offset x y] [-num_threads val]\n");
exit(1);
}
@ -131,6 +139,17 @@ OPJ_FLOAT64 opj_clock(void)
#endif
}
static OPJ_FLOAT64 opj_wallclock(void)
{
#ifdef _WIN32
return opj_clock();
#else
struct timeval tv;
gettimeofday(&tv, NULL);
return (OPJ_FLOAT64)tv.tv_sec + 1e-6 * (OPJ_FLOAT64)tv.tv_usec;
#endif
}
int main(int argc, char** argv)
{
int num_threads = 0;
@ -146,16 +165,24 @@ int main(int argc, char** argv)
OPJ_BOOL check = OPJ_FALSE;
OPJ_INT32 size = 16384 - 1;
OPJ_FLOAT64 start, stop;
OPJ_FLOAT64 start_wc, stop_wc;
OPJ_UINT32 offset_x = ((OPJ_UINT32)size + 1) / 2 - 1;
OPJ_UINT32 offset_y = ((OPJ_UINT32)size + 1) / 2 - 1;
OPJ_UINT32 num_resolutions = 6;
OPJ_BOOL bench_decode = OPJ_TRUE;
OPJ_BOOL irreversible = OPJ_FALSE;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
if (strcmp(argv[i], "-encode") == 0) {
bench_decode = OPJ_FALSE;
} else if (strcmp(argv[i], "-decode") == 0) {
bench_decode = OPJ_TRUE;
} else if (strcmp(argv[i], "-display") == 0) {
display = OPJ_TRUE;
check = OPJ_TRUE;
} else if (strcmp(argv[i], "-check") == 0) {
check = OPJ_TRUE;
} else if (strcmp(argv[i], "-I") == 0) {
irreversible = OPJ_TRUE;
} else if (strcmp(argv[i], "-size") == 0 && i + 1 < argc) {
size = atoi(argv[i + 1]);
i ++;
@ -179,18 +206,29 @@ int main(int argc, char** argv)
}
}
if (irreversible && check) {
/* Due to irreversible inverse DWT not being symetric of forward */
/* See BUG_WEIRD_TWO_INVK in dwt.c */
printf("-I and -check aren't compatible\n");
exit(1);
}
tp = opj_thread_pool_create(num_threads);
init_tilec(&tilec, (OPJ_INT32)offset_x, (OPJ_INT32)offset_y,
(OPJ_INT32)offset_x + size, (OPJ_INT32)offset_y + size,
num_resolutions);
num_resolutions, irreversible);
if (display) {
printf("Before\n");
k = 0;
for (j = 0; j < tilec.y1 - tilec.y0; j++) {
for (i = 0; i < tilec.x1 - tilec.x0; i++) {
if (irreversible) {
printf("%f ", ((OPJ_FLOAT32*)tilec.data)[k]);
} else {
printf("%d ", tilec.data[k]);
}
k ++;
}
printf("\n");
@ -223,37 +261,80 @@ int main(int argc, char** argv)
image_comp.dy = 1;
start = opj_clock();
start_wc = opj_wallclock();
if (bench_decode) {
if (irreversible) {
opj_dwt_decode_real(&tcd, &tilec, tilec.numresolutions);
} else {
opj_dwt_decode(&tcd, &tilec, tilec.numresolutions);
}
} else {
if (irreversible) {
opj_dwt_encode_real(&tcd, &tilec);
} else {
opj_dwt_encode(&tcd, &tilec);
}
}
stop = opj_clock();
printf("time for dwt_decode: %.03f s\n", stop - start);
stop_wc = opj_wallclock();
printf("time for %s: total = %.03f s, wallclock = %.03f s\n",
bench_decode ? "dwt_decode" : "dwt_encode",
stop - start,
stop_wc - start_wc);
if (display || check) {
if (display) {
if (bench_decode) {
printf("After IDWT\n");
} else {
printf("After FDWT\n");
}
k = 0;
for (j = 0; j < tilec.y1 - tilec.y0; j++) {
for (i = 0; i < tilec.x1 - tilec.x0; i++) {
if (irreversible) {
printf("%f ", ((OPJ_FLOAT32*)tilec.data)[k]);
} else {
printf("%d ", tilec.data[k]);
}
k ++;
}
printf("\n");
}
}
opj_dwt_encode(&tilec);
if (display) {
if ((display || check) && !irreversible) {
if (bench_decode) {
opj_dwt_encode(&tcd, &tilec);
} else {
opj_dwt_decode(&tcd, &tilec, tilec.numresolutions);
}
if (display && !irreversible) {
if (bench_decode) {
printf("After FDWT\n");
} else {
printf("After IDWT\n");
}
k = 0;
for (j = 0; j < tilec.y1 - tilec.y0; j++) {
for (i = 0; i < tilec.x1 - tilec.x0; i++) {
if (irreversible) {
printf("%f ", ((OPJ_FLOAT32*)tilec.data)[k]);
} else {
printf("%d ", tilec.data[k]);
}
k ++;
}
printf("\n");
}
}
}
if (check) {
size_t idx;
size_t nValues = (size_t)(tilec.x1 - tilec.x0) *
(size_t)(tilec.y1 - tilec.y0);
@ -264,7 +345,6 @@ int main(int argc, char** argv)
}
}
}
}
free_tilec(&tilec);

File diff suppressed because it is too large Load Diff

View File

@ -56,9 +56,11 @@ DWT.C are used by some function in TCD.C.
/**
Forward 5-3 wavelet transform in 2-D.
Apply a reversible DWT transform to a component of an image.
@param p_tcd TCD handle
@param tilec Tile component information (current tile)
*/
OPJ_BOOL opj_dwt_encode(opj_tcd_tilecomp_t * tilec);
OPJ_BOOL opj_dwt_encode(opj_tcd_t *p_tcd,
opj_tcd_tilecomp_t * tilec);
/**
Inverse 5-3 wavelet transform in 2-D.
@ -71,12 +73,6 @@ OPJ_BOOL opj_dwt_decode(opj_tcd_t *p_tcd,
opj_tcd_tilecomp_t* tilec,
OPJ_UINT32 numres);
/**
Get the gain of a subband for the reversible 5-3 DWT.
@param orient Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
@return Returns 0 if orient = 0, returns 1 if orient = 1 or 2, returns 2 otherwise
*/
OPJ_UINT32 opj_dwt_getgain(OPJ_UINT32 orient) ;
/**
Get the norm of a wavelet function of a subband at a specified level for the reversible 5-3 DWT.
@param level Level of the wavelet function
@ -87,9 +83,11 @@ OPJ_FLOAT64 opj_dwt_getnorm(OPJ_UINT32 level, OPJ_UINT32 orient);
/**
Forward 9-7 wavelet transform in 2-D.
Apply an irreversible DWT transform to a component of an image.
@param p_tcd TCD handle
@param tilec Tile component information (current tile)
*/
OPJ_BOOL opj_dwt_encode_real(opj_tcd_tilecomp_t * tilec);
OPJ_BOOL opj_dwt_encode_real(opj_tcd_t *p_tcd,
opj_tcd_tilecomp_t * tilec);
/**
Inverse 9-7 wavelet transform in 2-D.
Apply an irreversible inverse DWT transform to a component of an image.
@ -101,12 +99,6 @@ OPJ_BOOL opj_dwt_decode_real(opj_tcd_t *p_tcd,
opj_tcd_tilecomp_t* OPJ_RESTRICT tilec,
OPJ_UINT32 numres);
/**
Get the gain of a subband for the irreversible 9-7 DWT.
@param orient Number that identifies the subband (0->LL, 1->HL, 2->LH, 3->HH)
@return Returns the gain of the 9-7 wavelet transform
*/
OPJ_UINT32 opj_dwt_getgain_real(OPJ_UINT32 orient);
/**
Get the norm of a wavelet function of a subband at a specified level for the irreversible 9-7 DWT
@param level Level of the wavelet function

View File

@ -7822,6 +7822,14 @@ OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,
*/
if (parameters->tile_size_on) {
if (cp->tdx == 0) {
opj_event_msg(p_manager, EVT_ERROR, "Invalid tile width\n");
return OPJ_FALSE;
}
if (cp->tdy == 0) {
opj_event_msg(p_manager, EVT_ERROR, "Invalid tile height\n");
return OPJ_FALSE;
}
cp->tw = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(image->x1 - cp->tx0),
(OPJ_INT32)cp->tdx);
cp->th = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(image->y1 - cp->ty0),

View File

@ -209,175 +209,72 @@ OPJ_FLOAT64 opj_mct_getnorm(OPJ_UINT32 compno)
/* <summary> */
/* Forward irreversible MCT. */
/* </summary> */
#ifdef __SSE4_1__
void opj_mct_encode_real(
OPJ_INT32* OPJ_RESTRICT c0,
OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2,
OPJ_FLOAT32* OPJ_RESTRICT c0,
OPJ_FLOAT32* OPJ_RESTRICT c1,
OPJ_FLOAT32* OPJ_RESTRICT c2,
OPJ_SIZE_T n)
{
OPJ_SIZE_T i;
const OPJ_SIZE_T len = n;
#ifdef __SSE__
const __m128 YR = _mm_set1_ps(0.299f);
const __m128 YG = _mm_set1_ps(0.587f);
const __m128 YB = _mm_set1_ps(0.114f);
const __m128 UR = _mm_set1_ps(-0.16875f);
const __m128 UG = _mm_set1_ps(-0.331260f);
const __m128 UB = _mm_set1_ps(0.5f);
const __m128 VR = _mm_set1_ps(0.5f);
const __m128 VG = _mm_set1_ps(-0.41869f);
const __m128 VB = _mm_set1_ps(-0.08131f);
for (i = 0; i < (n >> 3); i ++) {
__m128 r, g, b, y, u, v;
const __m128i ry = _mm_set1_epi32(2449);
const __m128i gy = _mm_set1_epi32(4809);
const __m128i by = _mm_set1_epi32(934);
const __m128i ru = _mm_set1_epi32(1382);
const __m128i gu = _mm_set1_epi32(2714);
/* const __m128i bu = _mm_set1_epi32(4096); */
/* const __m128i rv = _mm_set1_epi32(4096); */
const __m128i gv = _mm_set1_epi32(3430);
const __m128i bv = _mm_set1_epi32(666);
const __m128i mulround = _mm_shuffle_epi32(_mm_cvtsi32_si128(4096),
_MM_SHUFFLE(1, 0, 1, 0));
r = _mm_load_ps(c0);
g = _mm_load_ps(c1);
b = _mm_load_ps(c2);
y = _mm_add_ps(_mm_add_ps(_mm_mul_ps(r, YR), _mm_mul_ps(g, YG)),
_mm_mul_ps(b, YB));
u = _mm_add_ps(_mm_add_ps(_mm_mul_ps(r, UR), _mm_mul_ps(g, UG)),
_mm_mul_ps(b, UB));
v = _mm_add_ps(_mm_add_ps(_mm_mul_ps(r, VR), _mm_mul_ps(g, VG)),
_mm_mul_ps(b, VB));
_mm_store_ps(c0, y);
_mm_store_ps(c1, u);
_mm_store_ps(c2, v);
c0 += 4;
c1 += 4;
c2 += 4;
for (i = 0; i < (len & ~3U); i += 4) {
__m128i lo, hi;
__m128i y, u, v;
__m128i r = _mm_load_si128((const __m128i *) & (c0[i]));
__m128i g = _mm_load_si128((const __m128i *) & (c1[i]));
__m128i b = _mm_load_si128((const __m128i *) & (c2[i]));
lo = r;
hi = _mm_shuffle_epi32(r, _MM_SHUFFLE(3, 3, 1, 1));
lo = _mm_mul_epi32(lo, ry);
hi = _mm_mul_epi32(hi, ry);
lo = _mm_add_epi64(lo, mulround);
hi = _mm_add_epi64(hi, mulround);
lo = _mm_srli_epi64(lo, 13);
hi = _mm_slli_epi64(hi, 32 - 13);
y = _mm_blend_epi16(lo, hi, 0xCC);
lo = g;
hi = _mm_shuffle_epi32(g, _MM_SHUFFLE(3, 3, 1, 1));
lo = _mm_mul_epi32(lo, gy);
hi = _mm_mul_epi32(hi, gy);
lo = _mm_add_epi64(lo, mulround);
hi = _mm_add_epi64(hi, mulround);
lo = _mm_srli_epi64(lo, 13);
hi = _mm_slli_epi64(hi, 32 - 13);
y = _mm_add_epi32(y, _mm_blend_epi16(lo, hi, 0xCC));
lo = b;
hi = _mm_shuffle_epi32(b, _MM_SHUFFLE(3, 3, 1, 1));
lo = _mm_mul_epi32(lo, by);
hi = _mm_mul_epi32(hi, by);
lo = _mm_add_epi64(lo, mulround);
hi = _mm_add_epi64(hi, mulround);
lo = _mm_srli_epi64(lo, 13);
hi = _mm_slli_epi64(hi, 32 - 13);
y = _mm_add_epi32(y, _mm_blend_epi16(lo, hi, 0xCC));
_mm_store_si128((__m128i *) & (c0[i]), y);
/*lo = b;
hi = _mm_shuffle_epi32(b, _MM_SHUFFLE(3, 3, 1, 1));
lo = _mm_mul_epi32(lo, mulround);
hi = _mm_mul_epi32(hi, mulround);*/
lo = _mm_cvtepi32_epi64(_mm_shuffle_epi32(b, _MM_SHUFFLE(3, 2, 2, 0)));
hi = _mm_cvtepi32_epi64(_mm_shuffle_epi32(b, _MM_SHUFFLE(3, 2, 3, 1)));
lo = _mm_slli_epi64(lo, 12);
hi = _mm_slli_epi64(hi, 12);
lo = _mm_add_epi64(lo, mulround);
hi = _mm_add_epi64(hi, mulround);
lo = _mm_srli_epi64(lo, 13);
hi = _mm_slli_epi64(hi, 32 - 13);
u = _mm_blend_epi16(lo, hi, 0xCC);
lo = r;
hi = _mm_shuffle_epi32(r, _MM_SHUFFLE(3, 3, 1, 1));
lo = _mm_mul_epi32(lo, ru);
hi = _mm_mul_epi32(hi, ru);
lo = _mm_add_epi64(lo, mulround);
hi = _mm_add_epi64(hi, mulround);
lo = _mm_srli_epi64(lo, 13);
hi = _mm_slli_epi64(hi, 32 - 13);
u = _mm_sub_epi32(u, _mm_blend_epi16(lo, hi, 0xCC));
lo = g;
hi = _mm_shuffle_epi32(g, _MM_SHUFFLE(3, 3, 1, 1));
lo = _mm_mul_epi32(lo, gu);
hi = _mm_mul_epi32(hi, gu);
lo = _mm_add_epi64(lo, mulround);
hi = _mm_add_epi64(hi, mulround);
lo = _mm_srli_epi64(lo, 13);
hi = _mm_slli_epi64(hi, 32 - 13);
u = _mm_sub_epi32(u, _mm_blend_epi16(lo, hi, 0xCC));
_mm_store_si128((__m128i *) & (c1[i]), u);
/*lo = r;
hi = _mm_shuffle_epi32(r, _MM_SHUFFLE(3, 3, 1, 1));
lo = _mm_mul_epi32(lo, mulround);
hi = _mm_mul_epi32(hi, mulround);*/
lo = _mm_cvtepi32_epi64(_mm_shuffle_epi32(r, _MM_SHUFFLE(3, 2, 2, 0)));
hi = _mm_cvtepi32_epi64(_mm_shuffle_epi32(r, _MM_SHUFFLE(3, 2, 3, 1)));
lo = _mm_slli_epi64(lo, 12);
hi = _mm_slli_epi64(hi, 12);
lo = _mm_add_epi64(lo, mulround);
hi = _mm_add_epi64(hi, mulround);
lo = _mm_srli_epi64(lo, 13);
hi = _mm_slli_epi64(hi, 32 - 13);
v = _mm_blend_epi16(lo, hi, 0xCC);
lo = g;
hi = _mm_shuffle_epi32(g, _MM_SHUFFLE(3, 3, 1, 1));
lo = _mm_mul_epi32(lo, gv);
hi = _mm_mul_epi32(hi, gv);
lo = _mm_add_epi64(lo, mulround);
hi = _mm_add_epi64(hi, mulround);
lo = _mm_srli_epi64(lo, 13);
hi = _mm_slli_epi64(hi, 32 - 13);
v = _mm_sub_epi32(v, _mm_blend_epi16(lo, hi, 0xCC));
lo = b;
hi = _mm_shuffle_epi32(b, _MM_SHUFFLE(3, 3, 1, 1));
lo = _mm_mul_epi32(lo, bv);
hi = _mm_mul_epi32(hi, bv);
lo = _mm_add_epi64(lo, mulround);
hi = _mm_add_epi64(hi, mulround);
lo = _mm_srli_epi64(lo, 13);
hi = _mm_slli_epi64(hi, 32 - 13);
v = _mm_sub_epi32(v, _mm_blend_epi16(lo, hi, 0xCC));
_mm_store_si128((__m128i *) & (c2[i]), v);
}
for (; i < len; ++i) {
OPJ_INT32 r = c0[i];
OPJ_INT32 g = c1[i];
OPJ_INT32 b = c2[i];
OPJ_INT32 y = opj_int_fix_mul(r, 2449) + opj_int_fix_mul(g,
4809) + opj_int_fix_mul(b, 934);
OPJ_INT32 u = -opj_int_fix_mul(r, 1382) - opj_int_fix_mul(g,
2714) + opj_int_fix_mul(b, 4096);
OPJ_INT32 v = opj_int_fix_mul(r, 4096) - opj_int_fix_mul(g,
3430) - opj_int_fix_mul(b, 666);
c0[i] = y;
c1[i] = u;
c2[i] = v;
}
}
#else
void opj_mct_encode_real(
OPJ_INT32* OPJ_RESTRICT c0,
OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2,
OPJ_SIZE_T n)
{
OPJ_SIZE_T i;
for (i = 0; i < n; ++i) {
OPJ_INT32 r = c0[i];
OPJ_INT32 g = c1[i];
OPJ_INT32 b = c2[i];
OPJ_INT32 y = opj_int_fix_mul(r, 2449) + opj_int_fix_mul(g,
4809) + opj_int_fix_mul(b, 934);
OPJ_INT32 u = -opj_int_fix_mul(r, 1382) - opj_int_fix_mul(g,
2714) + opj_int_fix_mul(b, 4096);
OPJ_INT32 v = opj_int_fix_mul(r, 4096) - opj_int_fix_mul(g,
3430) - opj_int_fix_mul(b, 666);
c0[i] = y;
c1[i] = u;
c2[i] = v;
}
r = _mm_load_ps(c0);
g = _mm_load_ps(c1);
b = _mm_load_ps(c2);
y = _mm_add_ps(_mm_add_ps(_mm_mul_ps(r, YR), _mm_mul_ps(g, YG)),
_mm_mul_ps(b, YB));
u = _mm_add_ps(_mm_add_ps(_mm_mul_ps(r, UR), _mm_mul_ps(g, UG)),
_mm_mul_ps(b, UB));
v = _mm_add_ps(_mm_add_ps(_mm_mul_ps(r, VR), _mm_mul_ps(g, VG)),
_mm_mul_ps(b, VB));
_mm_store_ps(c0, y);
_mm_store_ps(c1, u);
_mm_store_ps(c2, v);
c0 += 4;
c1 += 4;
c2 += 4;
}
n &= 7;
#endif
for (i = 0; i < n; ++i) {
OPJ_FLOAT32 r = c0[i];
OPJ_FLOAT32 g = c1[i];
OPJ_FLOAT32 b = c2[i];
OPJ_FLOAT32 y = 0.299f * r + 0.587f * g + 0.114f * b;
OPJ_FLOAT32 u = -0.16875f * r - 0.331260f * g + 0.5f * b;
OPJ_FLOAT32 v = 0.5f * r - 0.41869f * g - 0.08131f * b;
c0[i] = y;
c1[i] = u;
c2[i] = v;
}
}
/* <summary> */
/* Inverse irreversible MCT. */

View File

@ -85,8 +85,9 @@ Apply an irreversible multi-component transform to an image
@param c2 Samples blue component
@param n Number of samples for each component
*/
void opj_mct_encode_real(OPJ_INT32* OPJ_RESTRICT c0, OPJ_INT32* OPJ_RESTRICT c1,
OPJ_INT32* OPJ_RESTRICT c2, OPJ_SIZE_T n);
void opj_mct_encode_real(OPJ_FLOAT32* OPJ_RESTRICT c0,
OPJ_FLOAT32* OPJ_RESTRICT c1,
OPJ_FLOAT32* OPJ_RESTRICT c2, OPJ_SIZE_T n);
/**
Apply an irreversible multi-component inverse transform to an image
@param c0 Samples for luminance component

View File

@ -46,27 +46,6 @@
/** @name Local static functions */
/*@{*/
/**
Output a byte, doing bit-stuffing if necessary.
After a 0xff byte, the next byte must be smaller than 0x90.
@param mqc MQC handle
*/
static void opj_mqc_byteout(opj_mqc_t *mqc);
/**
Renormalize mqc->a and mqc->c while encoding, so that mqc->a stays between 0x8000 and 0x10000
@param mqc MQC handle
*/
static void opj_mqc_renorme(opj_mqc_t *mqc);
/**
Encode the most probable symbol
@param mqc MQC handle
*/
static void opj_mqc_codemps(opj_mqc_t *mqc);
/**
Encode the most least symbol
@param mqc MQC handle
*/
static void opj_mqc_codelps(opj_mqc_t *mqc);
/**
Fill mqc->c with 1's for flushing
@param mqc MQC handle
@ -182,80 +161,6 @@ static const opj_mqc_state_t mqc_states[47 * 2] = {
==========================================================
*/
static void opj_mqc_byteout(opj_mqc_t *mqc)
{
/* bp is initialized to start - 1 in opj_mqc_init_enc() */
/* but this is safe, see opj_tcd_code_block_enc_allocate_data() */
assert(mqc->bp >= mqc->start - 1);
if (*mqc->bp == 0xff) {
mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 20);
mqc->c &= 0xfffff;
mqc->ct = 7;
} else {
if ((mqc->c & 0x8000000) == 0) {
mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 19);
mqc->c &= 0x7ffff;
mqc->ct = 8;
} else {
(*mqc->bp)++;
if (*mqc->bp == 0xff) {
mqc->c &= 0x7ffffff;
mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 20);
mqc->c &= 0xfffff;
mqc->ct = 7;
} else {
mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 19);
mqc->c &= 0x7ffff;
mqc->ct = 8;
}
}
}
}
static void opj_mqc_renorme(opj_mqc_t *mqc)
{
do {
mqc->a <<= 1;
mqc->c <<= 1;
mqc->ct--;
if (mqc->ct == 0) {
opj_mqc_byteout(mqc);
}
} while ((mqc->a & 0x8000) == 0);
}
static void opj_mqc_codemps(opj_mqc_t *mqc)
{
mqc->a -= (*mqc->curctx)->qeval;
if ((mqc->a & 0x8000) == 0) {
if (mqc->a < (*mqc->curctx)->qeval) {
mqc->a = (*mqc->curctx)->qeval;
} else {
mqc->c += (*mqc->curctx)->qeval;
}
*mqc->curctx = (*mqc->curctx)->nmps;
opj_mqc_renorme(mqc);
} else {
mqc->c += (*mqc->curctx)->qeval;
}
}
static void opj_mqc_codelps(opj_mqc_t *mqc)
{
mqc->a -= (*mqc->curctx)->qeval;
if (mqc->a < (*mqc->curctx)->qeval) {
mqc->c += (*mqc->curctx)->qeval;
} else {
mqc->a = (*mqc->curctx)->qeval;
}
*mqc->curctx = (*mqc->curctx)->nlps;
opj_mqc_renorme(mqc);
}
static void opj_mqc_setbits(opj_mqc_t *mqc)
{
OPJ_UINT32 tempc = mqc->c + mqc->a;
@ -303,14 +208,6 @@ void opj_mqc_init_enc(opj_mqc_t *mqc, OPJ_BYTE *bp)
mqc->end_of_byte_stream_counter = 0;
}
void opj_mqc_encode(opj_mqc_t *mqc, OPJ_UINT32 d)
{
if ((*mqc->curctx)->mps == d) {
opj_mqc_codemps(mqc);
} else {
opj_mqc_codelps(mqc);
}
}
void opj_mqc_flush(opj_mqc_t *mqc)
{
@ -329,8 +226,6 @@ void opj_mqc_flush(opj_mqc_t *mqc)
}
}
#define BYPASS_CT_INIT 0xDEADBEEF
void opj_mqc_bypass_init_enc(opj_mqc_t *mqc)
{
/* This function is normally called after at least one opj_mqc_flush() */
@ -475,6 +370,43 @@ void opj_mqc_erterm_enc(opj_mqc_t *mqc)
}
}
static INLINE void opj_mqc_renorme(opj_mqc_t *mqc)
{
opj_mqc_renorme_macro(mqc, mqc->a, mqc->c, mqc->ct);
}
/**
Encode the most probable symbol
@param mqc MQC handle
*/
static INLINE void opj_mqc_codemps(opj_mqc_t *mqc)
{
opj_mqc_codemps_macro(mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct);
}
/**
Encode the most least symbol
@param mqc MQC handle
*/
static INLINE void opj_mqc_codelps(opj_mqc_t *mqc)
{
opj_mqc_codelps_macro(mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct);
}
/**
Encode a symbol using the MQ-coder
@param mqc MQC handle
@param d The symbol to be encoded (0 or 1)
*/
static INLINE void opj_mqc_encode(opj_mqc_t *mqc, OPJ_UINT32 d)
{
if ((*mqc->curctx)->mps == d) {
opj_mqc_codemps(mqc);
} else {
opj_mqc_codelps(mqc);
}
}
void opj_mqc_segmark_enc(opj_mqc_t *mqc)
{
OPJ_UINT32 i;
@ -557,4 +489,36 @@ void opj_mqc_setstate(opj_mqc_t *mqc, OPJ_UINT32 ctxno, OPJ_UINT32 msb,
mqc->ctxs[ctxno] = &mqc_states[msb + (OPJ_UINT32)(prob << 1)];
}
void opj_mqc_byteout(opj_mqc_t *mqc)
{
/* bp is initialized to start - 1 in opj_mqc_init_enc() */
/* but this is safe, see opj_tcd_code_block_enc_allocate_data() */
assert(mqc->bp >= mqc->start - 1);
if (*mqc->bp == 0xff) {
mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 20);
mqc->c &= 0xfffff;
mqc->ct = 7;
} else {
if ((mqc->c & 0x8000000) == 0) {
mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 19);
mqc->c &= 0x7ffff;
mqc->ct = 8;
} else {
(*mqc->bp)++;
if (*mqc->bp == 0xff) {
mqc->c &= 0x7ffffff;
mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 20);
mqc->c &= 0xfffff;
mqc->ct = 7;
} else {
mqc->bp++;
*mqc->bp = (OPJ_BYTE)(mqc->c >> 19);
mqc->c &= 0x7ffff;
mqc->ct = 8;
}
}
}
}

View File

@ -96,6 +96,8 @@ typedef struct opj_mqc {
OPJ_BYTE backup[OPJ_COMMON_CBLK_DATA_EXTRA];
} opj_mqc_t;
#define BYPASS_CT_INIT 0xDEADBEEF
#include "mqc_inl.h"
/** @name Exported functions */
@ -135,12 +137,7 @@ Set the current context used for coding/decoding
@param ctxno Number that identifies the context
*/
#define opj_mqc_setcurctx(mqc, ctxno) (mqc)->curctx = &(mqc)->ctxs[(OPJ_UINT32)(ctxno)]
/**
Encode a symbol using the MQ-coder
@param mqc MQC handle
@param d The symbol to be encoded (0 or 1)
*/
void opj_mqc_encode(opj_mqc_t *mqc, OPJ_UINT32 d);
/**
Flush the encoder, so that all remaining data is written
@param mqc MQC handle

View File

@ -156,13 +156,13 @@ static INLINE OPJ_UINT32 opj_mqc_raw_decode(opj_mqc_t *mqc)
} \
}
#define DOWNLOAD_MQC_VARIABLES(mqc, curctx, c, a, ct) \
#define DOWNLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct) \
register const opj_mqc_state_t **curctx = mqc->curctx; \
register OPJ_UINT32 c = mqc->c; \
register OPJ_UINT32 a = mqc->a; \
register OPJ_UINT32 ct = mqc->ct
#define UPLOAD_MQC_VARIABLES(mqc, curctx, c, a, ct) \
#define UPLOAD_MQC_VARIABLES(mqc, curctx, a, c, ct) \
mqc->curctx = curctx; \
mqc->c = c; \
mqc->a = a; \
@ -193,4 +193,90 @@ Decode a symbol
#define opj_mqc_decode(d, mqc) \
opj_mqc_decode_macro(d, mqc, mqc->curctx, mqc->a, mqc->c, mqc->ct)
/**
Output a byte, doing bit-stuffing if necessary.
After a 0xff byte, the next byte must be smaller than 0x90.
@param mqc MQC handle
*/
void opj_mqc_byteout(opj_mqc_t *mqc);
/**
Renormalize mqc->a and mqc->c while encoding, so that mqc->a stays between 0x8000 and 0x10000
@param mqc MQC handle
@param a_ value of mqc->a
@param c_ value of mqc->c_
@param ct_ value of mqc->ct_
*/
#define opj_mqc_renorme_macro(mqc, a_, c_, ct_) \
{ \
do { \
a_ <<= 1; \
c_ <<= 1; \
ct_--; \
if (ct_ == 0) { \
mqc->c = c_; \
opj_mqc_byteout(mqc); \
c_ = mqc->c; \
ct_ = mqc->ct; \
} \
} while( (a_ & 0x8000) == 0); \
}
#define opj_mqc_codemps_macro(mqc, curctx, a, c, ct) \
{ \
a -= (*curctx)->qeval; \
if ((a & 0x8000) == 0) { \
if (a < (*curctx)->qeval) { \
a = (*curctx)->qeval; \
} else { \
c += (*curctx)->qeval; \
} \
*curctx = (*curctx)->nmps; \
opj_mqc_renorme_macro(mqc, a, c, ct); \
} else { \
c += (*curctx)->qeval; \
} \
}
#define opj_mqc_codelps_macro(mqc, curctx, a, c, ct) \
{ \
a -= (*curctx)->qeval; \
if (a < (*curctx)->qeval) { \
c += (*curctx)->qeval; \
} else { \
a = (*curctx)->qeval; \
} \
*curctx = (*curctx)->nlps; \
opj_mqc_renorme_macro(mqc, a, c, ct); \
}
#define opj_mqc_encode_macro(mqc, curctx, a, c, ct, d) \
{ \
if ((*curctx)->mps == (d)) { \
opj_mqc_codemps_macro(mqc, curctx, a, c, ct); \
} else { \
opj_mqc_codelps_macro(mqc, curctx, a, c, ct); \
} \
}
#define opj_mqc_bypass_enc_macro(mqc, c, ct, d) \
{\
if (ct == BYPASS_CT_INIT) {\
ct = 8;\
}\
ct--;\
c = c + ((d) << ct);\
if (ct == 0) {\
*mqc->bp = (OPJ_BYTE)c;\
ct = 8;\
/* If the previous byte was 0xff, make sure that the next msb is 0 */ \
if (*mqc->bp == 0xff) {\
ct = 7;\
}\
mqc->bp++;\
c = 0;\
}\
}
#endif /* OPJ_MQC_INL_H */

View File

@ -657,6 +657,9 @@ opj_codec_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT p_format)
const char* const*,
struct opj_event_mgr *)) opj_j2k_encoder_set_extra_options;
l_codec->opj_set_threads =
(OPJ_BOOL(*)(void * p_codec, OPJ_UINT32 num_threads)) opj_j2k_set_threads;
l_codec->m_codec = opj_j2k_create_compress();
if (! l_codec->m_codec) {
opj_free(l_codec);
@ -700,6 +703,9 @@ opj_codec_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT p_format)
const char* const*,
struct opj_event_mgr *)) opj_jp2_encoder_set_extra_options;
l_codec->opj_set_threads =
(OPJ_BOOL(*)(void * p_codec, OPJ_UINT32 num_threads)) opj_jp2_set_threads;
l_codec->m_codec = opj_jp2_create(OPJ_FALSE);
if (! l_codec->m_codec) {
opj_free(l_codec);

View File

@ -1348,15 +1348,14 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec,
* number, or "ALL_CPUS". If OPJ_NUM_THREADS is set and this function is called,
* this function will override the behaviour of the environment variable.
*
* Currently this function must be called after opj_setup_decoder() and
* before opj_read_header().
* This function must be called after opj_setup_decoder() and
* before opj_read_header() for the decoding side, or after opj_setup_encoder()
* and before opj_start_compress() for the encoding side.
*
* Note: currently only has effect on the decompressor.
*
* @param p_codec decompressor handler
* @param p_codec decompressor or compressor handler
* @param num_threads number of threads.
*
* @return OPJ_TRUE if the decoder is correctly set
* @return OPJ_TRUE if the function is successful.
*/
OPJ_API OPJ_BOOL OPJ_CALLCONV opj_codec_set_threads(opj_codec_t *p_codec,
int num_threads);

File diff suppressed because it is too large Load Diff

View File

@ -198,7 +198,6 @@ typedef struct opj_t1 {
OPJ_UINT32 h;
OPJ_UINT32 datasize;
OPJ_UINT32 flagssize;
OPJ_UINT32 data_stride;
OPJ_BOOL encoder;
/* Thre 3 variables below are only used by the decoder */
@ -216,13 +215,13 @@ typedef struct opj_t1 {
/**
Encode the code-blocks of a tile
@param t1 T1 handle
@param tcd TCD handle
@param tile The tile to encode
@param tcp Tile coding parameters
@param mct_norms FIXME DOC
@param mct_numcomps Number of components used for MCT
*/
OPJ_BOOL opj_t1_encode_cblks(opj_t1_t *t1,
OPJ_BOOL opj_t1_encode_cblks(opj_tcd_t* tcd,
opj_tcd_tile_t *tile,
opj_tcp_t *tcp,
const OPJ_FLOAT64 * mct_norms,

View File

@ -112,7 +112,7 @@ void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t * img)
* Initializes tile coding/decoding
*/
static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
OPJ_BOOL isEncoder, OPJ_FLOAT32 fraction, OPJ_SIZE_T sizeof_block,
OPJ_BOOL isEncoder, OPJ_SIZE_T sizeof_block,
opj_event_mgr_t* manager);
/**
@ -721,10 +721,9 @@ OPJ_BOOL opj_alloc_tile_component_data(opj_tcd_tilecomp_t *l_tilec)
/* ----------------------------------------------------------------------- */
static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
OPJ_BOOL isEncoder, OPJ_FLOAT32 fraction, OPJ_SIZE_T sizeof_block,
OPJ_BOOL isEncoder, OPJ_SIZE_T sizeof_block,
opj_event_mgr_t* manager)
{
OPJ_UINT32(*l_gain_ptr)(OPJ_UINT32) = 00;
OPJ_UINT32 compno, resno, bandno, precno, cblkno;
opj_tcp_t * l_tcp = 00;
opj_cp_t * l_cp = 00;
@ -740,7 +739,6 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
OPJ_UINT32 p, q;
OPJ_UINT32 l_level_no;
OPJ_UINT32 l_pdx, l_pdy;
OPJ_UINT32 l_gain;
OPJ_INT32 l_x0b, l_y0b;
OPJ_UINT32 l_tx0, l_ty0;
/* extent of precincts , top left, bottom right**/
@ -879,11 +877,6 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
l_level_no = l_tilec->numresolutions;
l_res = l_tilec->resolutions;
l_step_size = l_tccp->stepsizes;
if (l_tccp->qmfbid == 0) {
l_gain_ptr = &opj_dwt_getgain_real;
} else {
l_gain_ptr = &opj_dwt_getgain;
}
/*fprintf(stderr, "\tlevel_no=%d\n",l_level_no);*/
for (resno = 0; resno < l_tilec->numresolutions; ++resno) {
@ -970,7 +963,6 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
l_band = l_res->bands;
for (bandno = 0; bandno < l_res->numbands; ++bandno, ++l_band, ++l_step_size) {
OPJ_INT32 numbps;
/*fprintf(stderr, "\t\t\tband_no=%d/%d\n", bandno, l_res->numbands );*/
if (resno == 0) {
@ -1006,11 +998,24 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
}
}
/** avoid an if with storing function pointer */
l_gain = (*l_gain_ptr)(l_band->bandno);
numbps = (OPJ_INT32)(l_image_comp->prec + l_gain);
{
/* Table E-1 - Sub-band gains */
/* BUG_WEIRD_TWO_INVK (look for this identifier in dwt.c): */
/* the test (!isEncoder && l_tccp->qmfbid == 0) is strongly */
/* linked to the use of two_invK instead of invK */
const OPJ_INT32 log2_gain = (!isEncoder &&
l_tccp->qmfbid == 0) ? 0 : (l_band->bandno == 0) ? 0 :
(l_band->bandno == 3) ? 2 : 1;
/* Nominal dynamic range. Equation E-4 */
const OPJ_INT32 Rb = (OPJ_INT32)l_image_comp->prec + log2_gain;
/* Delta_b value of Equation E-3 in "E.1 Inverse quantization
* procedure" of the standard */
l_band->stepsize = (OPJ_FLOAT32)(((1.0 + l_step_size->mant / 2048.0) * pow(2.0,
(OPJ_INT32)(numbps - l_step_size->expn)))) * fraction;
(OPJ_INT32)(Rb - l_step_size->expn))));
}
/* Mb value of Equation E-2 in "E.1 Inverse quantization
* procedure" of the standard */
l_band->numbps = l_step_size->expn + (OPJ_INT32)l_tccp->numgbits -
@ -1193,14 +1198,14 @@ static INLINE OPJ_BOOL opj_tcd_init_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
OPJ_BOOL opj_tcd_init_encode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
opj_event_mgr_t* p_manager)
{
return opj_tcd_init_tile(p_tcd, p_tile_no, OPJ_TRUE, 1.0F,
return opj_tcd_init_tile(p_tcd, p_tile_no, OPJ_TRUE,
sizeof(opj_tcd_cblk_enc_t), p_manager);
}
OPJ_BOOL opj_tcd_init_decode_tile(opj_tcd_t *p_tcd, OPJ_UINT32 p_tile_no,
opj_event_mgr_t* p_manager)
{
return opj_tcd_init_tile(p_tcd, p_tile_no, OPJ_FALSE, 0.5F,
return opj_tcd_init_tile(p_tcd, p_tile_no, OPJ_FALSE,
sizeof(opj_tcd_cblk_dec_t), p_manager);
}
@ -2411,7 +2416,8 @@ static OPJ_BOOL opj_tcd_dc_level_shift_encode(opj_tcd_t *p_tcd)
}
} else {
for (i = 0; i < l_nb_elem; ++i) {
*l_current_ptr = (*l_current_ptr - l_tccp->m_dc_level_shift) * (1 << 11);
*((OPJ_FLOAT32 *) l_current_ptr) = (OPJ_FLOAT32)(*l_current_ptr -
l_tccp->m_dc_level_shift);
++l_current_ptr;
}
}
@ -2469,8 +2475,11 @@ static OPJ_BOOL opj_tcd_mct_encode(opj_tcd_t *p_tcd)
opj_free(l_data);
} else if (l_tcp->tccps->qmfbid == 0) {
opj_mct_encode_real(l_tile->comps[0].data, l_tile->comps[1].data,
l_tile->comps[2].data, samples);
opj_mct_encode_real(
(OPJ_FLOAT32*)l_tile->comps[0].data,
(OPJ_FLOAT32*)l_tile->comps[1].data,
(OPJ_FLOAT32*)l_tile->comps[2].data,
samples);
} else {
opj_mct_encode(l_tile->comps[0].data, l_tile->comps[1].data,
l_tile->comps[2].data, samples);
@ -2488,11 +2497,11 @@ static OPJ_BOOL opj_tcd_dwt_encode(opj_tcd_t *p_tcd)
for (compno = 0; compno < l_tile->numcomps; ++compno) {
if (l_tccp->qmfbid == 1) {
if (! opj_dwt_encode(l_tile_comp)) {
if (! opj_dwt_encode(p_tcd, l_tile_comp)) {
return OPJ_FALSE;
}
} else if (l_tccp->qmfbid == 0) {
if (! opj_dwt_encode_real(l_tile_comp)) {
if (! opj_dwt_encode_real(p_tcd, l_tile_comp)) {
return OPJ_FALSE;
}
}
@ -2506,16 +2515,10 @@ static OPJ_BOOL opj_tcd_dwt_encode(opj_tcd_t *p_tcd)
static OPJ_BOOL opj_tcd_t1_encode(opj_tcd_t *p_tcd)
{
opj_t1_t * l_t1;
const OPJ_FLOAT64 * l_mct_norms;
OPJ_UINT32 l_mct_numcomps = 0U;
opj_tcp_t * l_tcp = p_tcd->tcp;
l_t1 = opj_t1_create(OPJ_TRUE);
if (l_t1 == 00) {
return OPJ_FALSE;
}
if (l_tcp->mct == 1) {
l_mct_numcomps = 3U;
/* irreversible encoding */
@ -2529,13 +2532,9 @@ static OPJ_BOOL opj_tcd_t1_encode(opj_tcd_t *p_tcd)
l_mct_norms = (const OPJ_FLOAT64 *)(l_tcp->mct_norms);
}
if (! opj_t1_encode_cblks(l_t1, p_tcd->tcd_image->tiles, l_tcp, l_mct_norms,
l_mct_numcomps)) {
opj_t1_destroy(l_t1);
return OPJ_FALSE;
}
opj_t1_destroy(l_t1);
return opj_t1_encode_cblks(p_tcd,
p_tcd->tcd_image->tiles, l_tcp, l_mct_norms,
l_mct_numcomps);
return OPJ_TRUE;
}

View File

@ -60,15 +60,13 @@ static double* parseToleranceValues( char* inArg, const int nbcomp)
const char delims[] = ":";
char *result = strtok(inArg, delims);
while( (result != NULL) && (it_comp < nbcomp ))
{
while ((result != NULL) && (it_comp < nbcomp)) {
outArgs[it_comp] = atof(result);
result = strtok(NULL, delims);
it_comp++;
}
if (it_comp != nbcomp)
{
if (it_comp != nbcomp) {
free(outArgs);
return NULL;
}
@ -83,15 +81,23 @@ static void compare_images_help_display(void)
{
fprintf(stdout, "\nList of parameters for the compare_images function \n");
fprintf(stdout, "\n");
fprintf(stdout," -b \t REQUIRED \t filename to the reference/baseline PGX/TIF/PNM image \n");
fprintf(stdout,
" -b \t REQUIRED \t filename to the reference/baseline PGX/TIF/PNM image \n");
fprintf(stdout, " -t \t REQUIRED \t filename to the test PGX/TIF/PNM image\n");
fprintf(stdout," -n \t REQUIRED \t number of component of the image (used to generate correct filename, not used when both input files are TIF)\n");
fprintf(stdout," -m \t OPTIONAL \t list of MSE tolerances, separated by : (size must correspond to the number of component) of \n");
fprintf(stdout," -p \t OPTIONAL \t list of PEAK tolerances, separated by : (size must correspond to the number of component) \n");
fprintf(stdout," -s \t OPTIONAL \t 1 or 2 filename separator to take into account PGX/PNM image with different components, "
fprintf(stdout,
" -n \t REQUIRED \t number of component of the image (used to generate correct filename, not used when both input files are TIF)\n");
fprintf(stdout,
" -m \t OPTIONAL \t list of MSE tolerances, separated by : (size must correspond to the number of component) of \n");
fprintf(stdout,
" -p \t OPTIONAL \t list of PEAK tolerances, separated by : (size must correspond to the number of component) \n");
fprintf(stdout,
" -s \t OPTIONAL \t 1 or 2 filename separator to take into account PGX/PNM image with different components, "
"please indicate b or t before separator to indicate respectively the separator "
"for ref/base file and for test file. \n");
fprintf(stdout," -d \t OPTIONAL \t indicate if you want to run this function as conformance test or as non regression test\n");
fprintf(stdout,
" -d \t OPTIONAL \t indicate if you want to run this function as conformance test or as non regression test\n");
fprintf(stdout,
" -i \t OPTIONAL \t list of features to ignore. Currently 'prec' only supported\n");
fprintf(stdout, "\n");
}
@ -99,9 +105,15 @@ static int get_decod_format_from_string(const char *filename)
{
const int dot = '.';
char * ext = strrchr(filename, dot);
if( strcmp(ext,".pgx") == 0 ) return PGX_DFMT;
if( strcmp(ext,".tif") == 0 ) return TIF_DFMT;
if( strcmp(ext,".ppm") == 0 ) return PXM_DFMT;
if (strcmp(ext, ".pgx") == 0) {
return PGX_DFMT;
}
if (strcmp(ext, ".tif") == 0) {
return TIF_DFMT;
}
if (strcmp(ext, ".ppm") == 0) {
return PXM_DFMT;
}
return -1;
}
@ -110,7 +122,8 @@ static int get_decod_format_from_string(const char *filename)
* Create filenames from a filename using separator and nb components
* (begin from 0)
*******************************************************************************/
static char* createMultiComponentsFilename(const char* inFilename, const int indexF, const char* separator)
static char* createMultiComponentsFilename(const char* inFilename,
const int indexF, const char* separator)
{
char s[255];
char *outFilename, *ptr;
@ -119,13 +132,10 @@ static char* createMultiComponentsFilename(const char* inFilename, const int ind
int decod_format;
/*printf("inFilename = %s\n", inFilename);*/
if ((ptr = strrchr(inFilename, token)) != NULL)
{
if ((ptr = strrchr(inFilename, token)) != NULL) {
posToken = strlen(inFilename) - strlen(ptr);
/*printf("Position of %c character inside inFilename = %d\n", token, posToken);*/
}
else
{
} else {
/*printf("Token %c not found\n", token);*/
outFilename = (char*)malloc(1);
outFilename[0] = '\0';
@ -141,12 +151,9 @@ static char* createMultiComponentsFilename(const char* inFilename, const int ind
strcat(outFilename, s);
decod_format = get_decod_format_from_string(inFilename);
if( decod_format == PGX_DFMT )
{
if (decod_format == PGX_DFMT) {
strcat(outFilename, ".pgx");
}
else if( decod_format == PXM_DFMT )
{
} else if (decod_format == PXM_DFMT) {
strcat(outFilename, ".pgm");
}
@ -157,7 +164,8 @@ static char* createMultiComponentsFilename(const char* inFilename, const int ind
/*******************************************************************************
*
*******************************************************************************/
static opj_image_t* readImageFromFilePPM(const char* filename, int nbFilenamePGX, const char *separator)
static opj_image_t* readImageFromFilePPM(const char* filename,
int nbFilenamePGX, const char *separator)
{
int it_file;
opj_image_t* image_read = NULL;
@ -167,8 +175,9 @@ static opj_image_t* readImageFromFilePPM(const char* filename, int nbFilenamePGX
int** data;
/* If separator is empty => nb file to read is equal to one*/
if ( strlen(separator) == 0 )
if (strlen(separator) == 0) {
nbFilenamePGX = 1;
}
/* set encoding parameters to default values */
opj_set_default_encoder_parameters(&parameters);
@ -179,22 +188,21 @@ static opj_image_t* readImageFromFilePPM(const char* filename, int nbFilenamePGX
param_image_read = malloc((size_t)nbFilenamePGX * sizeof(opj_image_cmptparm_t));
data = malloc((size_t)nbFilenamePGX * sizeof(*data));
for (it_file = 0; it_file < nbFilenamePGX; it_file++)
{
for (it_file = 0; it_file < nbFilenamePGX; it_file++) {
/* Create the right filename*/
char *filenameComponentPGX;
if (strlen(separator) == 0)
{
filenameComponentPGX = malloc((strlen(filename) + 1) * sizeof(*filenameComponentPGX));
if (strlen(separator) == 0) {
filenameComponentPGX = malloc((strlen(filename) + 1) * sizeof(
*filenameComponentPGX));
strcpy(filenameComponentPGX, filename);
} else {
filenameComponentPGX = createMultiComponentsFilename(filename, it_file,
separator);
}
else
filenameComponentPGX = createMultiComponentsFilename(filename, it_file, separator);
/* Read the tif file corresponding to the component */
image_read = pnmtoimage(filenameComponentPGX, &parameters);
if (!image_read)
{
if (!image_read) {
int it_free_data;
fprintf(stderr, "Unable to load ppm file: %s\n", filenameComponentPGX);
@ -222,19 +230,22 @@ static opj_image_t* readImageFromFilePPM(const char* filename, int nbFilenamePGX
param_image_read[it_file].sgnd = image_read->comps->sgnd;
/* Copy data*/
data[it_file] = malloc(param_image_read[it_file].h * param_image_read[it_file].w * sizeof(int));
memcpy(data[it_file], image_read->comps->data, image_read->comps->h * image_read->comps->w * sizeof(int));
data[it_file] = malloc(param_image_read[it_file].h * param_image_read[it_file].w
* sizeof(int));
memcpy(data[it_file], image_read->comps->data,
image_read->comps->h * image_read->comps->w * sizeof(int));
/* Free memory*/
opj_image_destroy(image_read);
free(filenameComponentPGX);
}
image = opj_image_create((OPJ_UINT32)nbFilenamePGX, param_image_read, OPJ_CLRSPC_UNSPECIFIED);
for (it_file = 0; it_file < nbFilenamePGX; it_file++)
{
image = opj_image_create((OPJ_UINT32)nbFilenamePGX, param_image_read,
OPJ_CLRSPC_UNSPECIFIED);
for (it_file = 0; it_file < nbFilenamePGX; it_file++) {
/* Copy data into output image and free memory*/
memcpy(image->comps[it_file].data, data[it_file], image->comps[it_file].h * image->comps[it_file].w * sizeof(int));
memcpy(image->comps[it_file].data, data[it_file],
image->comps[it_file].h * image->comps[it_file].w * sizeof(int));
free(data[it_file]);
}
@ -245,7 +256,8 @@ static opj_image_t* readImageFromFilePPM(const char* filename, int nbFilenamePGX
return image;
}
static opj_image_t* readImageFromFileTIF(const char* filename, int nbFilenamePGX, const char *separator)
static opj_image_t* readImageFromFileTIF(const char* filename,
int nbFilenamePGX, const char *separator)
{
opj_image_t* image_read = NULL;
opj_cparameters_t parameters;
@ -262,7 +274,9 @@ static opj_image_t* readImageFromFileTIF(const char* filename, int nbFilenamePGX
TIFFSetErrorHandler(NULL);
#endif
if ( strlen(separator) != 0 ) return NULL;
if (strlen(separator) != 0) {
return NULL;
}
/* set encoding parameters to default values */
opj_set_default_encoder_parameters(&parameters);
@ -273,8 +287,7 @@ static opj_image_t* readImageFromFileTIF(const char* filename, int nbFilenamePGX
#ifdef OPJ_HAVE_LIBTIFF
image_read = tiftoimage(filename, &parameters);
#endif
if (!image_read)
{
if (!image_read) {
fprintf(stderr, "Unable to load TIF file\n");
return NULL;
}
@ -282,7 +295,8 @@ static opj_image_t* readImageFromFileTIF(const char* filename, int nbFilenamePGX
return image_read;
}
static opj_image_t* readImageFromFilePGX(const char* filename, int nbFilenamePGX, const char *separator)
static opj_image_t* readImageFromFilePGX(const char* filename,
int nbFilenamePGX, const char *separator)
{
int it_file;
opj_image_t* image_read = NULL;
@ -292,8 +306,9 @@ static opj_image_t* readImageFromFilePGX(const char* filename, int nbFilenamePGX
int** data;
/* If separator is empty => nb file to read is equal to one*/
if ( strlen(separator) == 0 )
if (strlen(separator) == 0) {
nbFilenamePGX = 1;
}
/* set encoding parameters to default values */
opj_set_default_encoder_parameters(&parameters);
@ -304,22 +319,21 @@ static opj_image_t* readImageFromFilePGX(const char* filename, int nbFilenamePGX
param_image_read = malloc((size_t)nbFilenamePGX * sizeof(opj_image_cmptparm_t));
data = malloc((size_t)nbFilenamePGX * sizeof(*data));
for (it_file = 0; it_file < nbFilenamePGX; it_file++)
{
for (it_file = 0; it_file < nbFilenamePGX; it_file++) {
/* Create the right filename*/
char *filenameComponentPGX;
if (strlen(separator) == 0)
{
filenameComponentPGX = malloc((strlen(filename) + 1) * sizeof(*filenameComponentPGX));
if (strlen(separator) == 0) {
filenameComponentPGX = malloc((strlen(filename) + 1) * sizeof(
*filenameComponentPGX));
strcpy(filenameComponentPGX, filename);
} else {
filenameComponentPGX = createMultiComponentsFilename(filename, it_file,
separator);
}
else
filenameComponentPGX = createMultiComponentsFilename(filename, it_file, separator);
/* Read the pgx file corresponding to the component */
image_read = pgxtoimage(filenameComponentPGX, &parameters);
if (!image_read)
{
if (!image_read) {
int it_free_data;
fprintf(stderr, "Unable to load pgx file\n");
@ -347,19 +361,22 @@ static opj_image_t* readImageFromFilePGX(const char* filename, int nbFilenamePGX
param_image_read[it_file].sgnd = image_read->comps->sgnd;
/* Copy data*/
data[it_file] = malloc(param_image_read[it_file].h * param_image_read[it_file].w * sizeof(int));
memcpy(data[it_file], image_read->comps->data, image_read->comps->h * image_read->comps->w * sizeof(int));
data[it_file] = malloc(param_image_read[it_file].h * param_image_read[it_file].w
* sizeof(int));
memcpy(data[it_file], image_read->comps->data,
image_read->comps->h * image_read->comps->w * sizeof(int));
/* Free memory*/
opj_image_destroy(image_read);
free(filenameComponentPGX);
}
image = opj_image_create((OPJ_UINT32)nbFilenamePGX, param_image_read, OPJ_CLRSPC_UNSPECIFIED);
for (it_file = 0; it_file < nbFilenamePGX; it_file++)
{
image = opj_image_create((OPJ_UINT32)nbFilenamePGX, param_image_read,
OPJ_CLRSPC_UNSPECIFIED);
for (it_file = 0; it_file < nbFilenamePGX; it_file++) {
/* Copy data into output image and free memory*/
memcpy(image->comps[it_file].data, data[it_file], image->comps[it_file].h * image->comps[it_file].w * sizeof(int));
memcpy(image->comps[it_file].data, data[it_file],
image->comps[it_file].h * image->comps[it_file].w * sizeof(int));
free(data[it_file]);
}
@ -374,7 +391,8 @@ static opj_image_t* readImageFromFilePGX(const char* filename, int nbFilenamePGX
/*******************************************************************************
*
*******************************************************************************/
static int imageToPNG(const opj_image_t* image, const char* filename, int num_comp_select)
static int imageToPNG(const opj_image_t* image, const char* filename,
int num_comp_select)
{
opj_image_cmptparm_t param_image_write;
opj_image_t* image_write = NULL;
@ -390,7 +408,8 @@ static int imageToPNG(const opj_image_t* image, const char* filename, int num_co
param_image_write.sgnd = image->comps[num_comp_select].sgnd;
image_write = opj_image_create(1u, &param_image_write, OPJ_CLRSPC_GRAY);
memcpy(image_write->comps->data, image->comps[num_comp_select].data, param_image_write.h * param_image_write.w * sizeof(int));
memcpy(image_write->comps->data, image->comps[num_comp_select].data,
param_image_write.h * param_image_write.w * sizeof(int));
imagetopng(image_write, filename);
@ -400,8 +419,7 @@ static int imageToPNG(const opj_image_t* image, const char* filename, int num_co
}
#endif
typedef struct test_cmp_parameters
{
typedef struct test_cmp_parameters {
/** */
char* base_filename;
/** */
@ -418,6 +436,8 @@ typedef struct test_cmp_parameters
char separator_base[2];
/** */
char separator_test[2];
/** whether to ignore prec differences */
int ignore_prec;
} test_cmp_parameters;
@ -426,7 +446,9 @@ static int get_decod_format(test_cmp_parameters* param)
{
int base_format = get_decod_format_from_string(param->base_filename);
int test_format = get_decod_format_from_string(param->test_filename);
if( base_format != test_format ) return -1;
if (base_format != test_format) {
return -1;
}
/* handle case -1: */
return base_format;
}
@ -436,11 +458,13 @@ static int get_decod_format(test_cmp_parameters* param)
*******************************************************************************/
static int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
{
char *MSElistvalues = NULL; char *PEAKlistvalues= NULL;
char *MSElistvalues = NULL;
char *PEAKlistvalues = NULL;
char *separatorList = NULL;
size_t sizemembasefile, sizememtestfile;
int index, flagM = 0, flagP = 0;
const char optlist[] = "b:t:n:m:p:s:d";
const char optlist[] = "b:t:n:m:p:s:di:";
char* ignoreList = NULL;
int c;
/* Init parameters*/
@ -452,12 +476,12 @@ static int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
param->nr_flag = 0;
param->separator_base[0] = 0;
param->separator_test[0] = 0;
param->ignore_prec = 0;
opj_opterr = 0;
while ((c = opj_getopt(argc, argv, optlist)) != -1)
switch (c)
{
switch (c) {
case 'b':
sizemembasefile = strlen(opj_optarg) + 1;
param->base_filename = (char*) malloc(sizemembasefile);
@ -487,151 +511,139 @@ static int parse_cmdline_cmp(int argc, char **argv, test_cmp_parameters* param)
case 's':
separatorList = opj_optarg;
break;
case 'i':
ignoreList = opj_optarg;
break;
case '?':
if ((opj_optopt == 'b') || (opj_optopt == 't') || (opj_optopt == 'n') || (opj_optopt == 'p') || (opj_optopt == 'm') || (opj_optopt
== 's'))
if ((opj_optopt == 'b') || (opj_optopt == 't') || (opj_optopt == 'n') ||
(opj_optopt == 'p') || (opj_optopt == 'm') || (opj_optopt
== 's')) {
fprintf(stderr, "Option -%c requires an argument.\n", opj_optopt);
else
if (isprint(opj_optopt)) fprintf(stderr, "Unknown option `-%c'.\n", opj_optopt);
else fprintf(stderr, "Unknown option character `\\x%x'.\n", opj_optopt);
} else if (isprint(opj_optopt)) {
fprintf(stderr, "Unknown option `-%c'.\n", opj_optopt);
} else {
fprintf(stderr, "Unknown option character `\\x%x'.\n", opj_optopt);
}
return 1;
default:
fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c, opj_optarg);
fprintf(stderr, "WARNING -> this option is not valid \"-%c %s\"\n", c,
opj_optarg);
break;
}
if (opj_optind != argc)
{
for (index = opj_optind; index < argc; index++)
if (opj_optind != argc) {
for (index = opj_optind; index < argc; index++) {
fprintf(stderr, "Non-option argument %s\n", argv[index]);
}
return 1;
}
if (param->nbcomp == 0)
{
if (param->nbcomp == 0) {
fprintf(stderr, "Need to indicate the number of components !\n");
return 1;
}
/* else */
if ( flagM && flagP )
{
if (flagM && flagP) {
param->tabMSEvalues = parseToleranceValues(MSElistvalues, param->nbcomp);
param->tabPEAKvalues = parseToleranceValues(PEAKlistvalues, param->nbcomp);
if ( (param->tabMSEvalues == NULL) || (param->tabPEAKvalues == NULL))
{
fprintf(stderr,"MSE and PEAK values are not correct (respectively need %d values)\n",param->nbcomp);
if ((param->tabMSEvalues == NULL) || (param->tabPEAKvalues == NULL)) {
fprintf(stderr,
"MSE and PEAK values are not correct (respectively need %d values)\n",
param->nbcomp);
return 1;
}
}
/* Get separators after corresponding letter (b or t)*/
if (separatorList != NULL)
{
if( (strlen(separatorList) ==2) || (strlen(separatorList) ==4) )
{
if (separatorList != NULL) {
if ((strlen(separatorList) == 2) || (strlen(separatorList) == 4)) {
/* keep original string*/
size_t sizeseplist = strlen(separatorList) + 1;
char* separatorList2 = (char*)malloc(sizeseplist);
strcpy(separatorList2, separatorList);
/*printf("separatorList2 = %s [%d / %d]\n", separatorList2, strlen(separatorList2), sizeseplist);*/
if (strlen(separatorList) == 2) /* one separator behind b or t*/
{
if (strlen(separatorList) == 2) { /* one separator behind b or t*/
char *resultT = NULL;
resultT = strtok(separatorList2, "t");
if (strlen(resultT) == strlen(separatorList)) /* didn't find t character, try to find b*/
{
if (strlen(resultT) == strlen(
separatorList)) { /* didn't find t character, try to find b*/
char *resultB = NULL;
resultB = strtok(resultT, "b");
if (strlen(resultB) == 1)
{
if (strlen(resultB) == 1) {
param->separator_base[0] = separatorList[1];
param->separator_base[1] = 0;
param->separator_test[0] = 0;
}
else /* not found b*/
{
} else { /* not found b*/
free(separatorList2);
return 1;
}
}
else /* found t*/
{
} else { /* found t*/
param->separator_base[0] = 0;
param->separator_test[0] = separatorList[1];
param->separator_test[1] = 0;
}
/*printf("sep b = %s [%d] and sep t = %s [%d]\n",param->separator_base, strlen(param->separator_base), param->separator_test, strlen(param->separator_test) );*/
}
else /* == 4 characters we must found t and b*/
{
} else { /* == 4 characters we must found t and b*/
char *resultT = NULL;
resultT = strtok(separatorList2, "t");
if (strlen(resultT) == 3) /* found t in first place*/
{
if (strlen(resultT) == 3) { /* found t in first place*/
char *resultB = NULL;
resultB = strtok(resultT, "b");
if (strlen(resultB) == 1) /* found b after t*/
{
if (strlen(resultB) == 1) { /* found b after t*/
param->separator_test[0] = separatorList[1];
param->separator_test[1] = 0;
param->separator_base[0] = separatorList[3];
param->separator_base[1] = 0;
}
else /* didn't find b after t*/
{
} else { /* didn't find b after t*/
free(separatorList2);
return 1;
}
}
else /* == 2, didn't find t in first place*/
{
} else { /* == 2, didn't find t in first place*/
char *resultB = NULL;
resultB = strtok(resultT, "b");
if (strlen(resultB) == 1) /* found b in first place*/
{
if (strlen(resultB) == 1) { /* found b in first place*/
param->separator_base[0] = separatorList[1];
param->separator_base[1] = 0;
param->separator_test[0] = separatorList[3];
param->separator_test[1] = 0;
}
else /* didn't found b in first place => problem*/
{
} else { /* didn't found b in first place => problem*/
free(separatorList2);
return 1;
}
}
}
free(separatorList2);
}
else /* wrong number of argument after -s*/
{
} else { /* wrong number of argument after -s*/
return 1;
}
}
else
{
if (param->nbcomp == 1)
{
} else {
if (param->nbcomp == 1) {
assert(param->separator_base[0] == 0);
assert(param->separator_test[0] == 0);
}
else
{
} else {
fprintf(stderr, "If number of component is > 1, we need separator\n");
return 1;
}
}
if ( (param->nr_flag) && (flagP || flagM) )
{
fprintf(stderr,"Wrong input parameters list: it is non-regression test or tolerance comparison\n");
if (ignoreList != NULL) {
if (strcmp(ignoreList, "prec") == 0) {
param->ignore_prec = 1;
} else {
fprintf(stderr, "Unsupported value for -i\n");
return 1;
}
if ( (!param->nr_flag) && (!flagP || !flagM) )
{
fprintf(stderr,"Wrong input parameters list: it is non-regression test or tolerance comparison\n");
}
if ((param->nr_flag) && (flagP || flagM)) {
fprintf(stderr,
"Wrong input parameters list: it is non-regression test or tolerance comparison\n");
return 1;
}
if ((!param->nr_flag) && (!flagP || !flagM)) {
fprintf(stderr,
"Wrong input parameters list: it is non-regression test or tolerance comparison\n");
return 1;
}
@ -650,7 +662,7 @@ int main(int argc, char **argv)
char *filenamePNGtest = NULL, *filenamePNGbase = NULL, *filenamePNGdiff = NULL;
size_t memsizebasefilename, memsizetestfilename;
size_t memsizedifffilename;
int valueDiff = 0, nbPixelDiff = 0;
int nbPixelDiff = 0;
double sumDiff = 0.0;
/* Structures to store image parameters and data*/
opj_image_t *imageBase = NULL, *imageTest = NULL, *imageDiff = NULL;
@ -658,8 +670,7 @@ int main(int argc, char **argv)
int decod_format;
/* Get parameters from command line*/
if( parse_cmdline_cmp(argc, argv, &inParam) )
{
if (parse_cmdline_cmp(argc, argv, &inParam)) {
compare_images_help_display();
goto cleanup;
}
@ -675,25 +686,28 @@ int main(int argc, char **argv)
inParam.base_filename, inParam.test_filename, inParam.nbcomp,
inParam.nr_flag, inParam.separator_base, inParam.separator_test);
if ( (inParam.tabMSEvalues != NULL) && (inParam.tabPEAKvalues != NULL))
{
if ((inParam.tabMSEvalues != NULL) && (inParam.tabPEAKvalues != NULL)) {
int it_comp2;
printf(" MSE values = [");
for (it_comp2 = 0; it_comp2 < inParam.nbcomp; it_comp2++)
for (it_comp2 = 0; it_comp2 < inParam.nbcomp; it_comp2++) {
printf(" %f ", inParam.tabMSEvalues[it_comp2]);
}
printf("]\n");
printf(" PEAK values = [");
for (it_comp2 = 0; it_comp2 < inParam.nbcomp; it_comp2++)
for (it_comp2 = 0; it_comp2 < inParam.nbcomp; it_comp2++) {
printf(" %f ", inParam.tabPEAKvalues[it_comp2]);
}
printf("]\n");
printf(" Non-regression test = %d\n", inParam.nr_flag);
}
if (strlen(inParam.separator_base) != 0)
if (strlen(inParam.separator_base) != 0) {
nbFilenamePGXbase = inParam.nbcomp;
}
if (strlen(inParam.separator_test) != 0)
if (strlen(inParam.separator_test) != 0) {
nbFilenamePGXtest = inParam.nbcomp;
}
printf(" NbFilename to generate from base filename = %d\n", nbFilenamePGXbase);
printf(" NbFilename to generate from test filename = %d\n", nbFilenamePGXtest);
@ -704,31 +718,31 @@ int main(int argc, char **argv)
memsizetestfilename = strlen(inParam.test_filename) + 1 + 5 + 2 + 4;
decod_format = get_decod_format(&inParam);
if( decod_format == -1 )
{
if (decod_format == -1) {
fprintf(stderr, "Unhandled file format\n");
goto cleanup;
}
assert( decod_format == PGX_DFMT || decod_format == TIF_DFMT || decod_format == PXM_DFMT );
assert(decod_format == PGX_DFMT || decod_format == TIF_DFMT ||
decod_format == PXM_DFMT);
if( decod_format == PGX_DFMT )
{
imageBase = readImageFromFilePGX( inParam.base_filename, nbFilenamePGXbase, inParam.separator_base);
if ( imageBase == NULL )
if (decod_format == PGX_DFMT) {
imageBase = readImageFromFilePGX(inParam.base_filename, nbFilenamePGXbase,
inParam.separator_base);
if (imageBase == NULL) {
goto cleanup;
}
else if( decod_format == TIF_DFMT )
{
} else if (decod_format == TIF_DFMT) {
imageBase = readImageFromFileTIF(inParam.base_filename, nbFilenamePGXbase, "");
if ( imageBase == NULL )
if (imageBase == NULL) {
goto cleanup;
}
else if( decod_format == PXM_DFMT )
{
imageBase = readImageFromFilePPM( inParam.base_filename, nbFilenamePGXbase, inParam.separator_base);
if ( imageBase == NULL )
} else if (decod_format == PXM_DFMT) {
imageBase = readImageFromFilePPM(inParam.base_filename, nbFilenamePGXbase,
inParam.separator_base);
if (imageBase == NULL) {
goto cleanup;
}
}
filenamePNGbase = (char*) malloc(memsizebasefilename);
strcpy(filenamePNGbase, inParam.test_filename);
@ -737,24 +751,24 @@ int main(int argc, char **argv)
/*----------TEST IMAGE--------*/
if( decod_format == PGX_DFMT )
{
imageTest = readImageFromFilePGX(inParam.test_filename, nbFilenamePGXtest, inParam.separator_test);
if ( imageTest == NULL )
if (decod_format == PGX_DFMT) {
imageTest = readImageFromFilePGX(inParam.test_filename, nbFilenamePGXtest,
inParam.separator_test);
if (imageTest == NULL) {
goto cleanup;
}
else if( decod_format == TIF_DFMT )
{
} else if (decod_format == TIF_DFMT) {
imageTest = readImageFromFileTIF(inParam.test_filename, nbFilenamePGXtest, "");
if ( imageTest == NULL )
if (imageTest == NULL) {
goto cleanup;
}
else if( decod_format == PXM_DFMT )
{
imageTest = readImageFromFilePPM(inParam.test_filename, nbFilenamePGXtest, inParam.separator_test);
if ( imageTest == NULL )
} else if (decod_format == PXM_DFMT) {
imageTest = readImageFromFilePPM(inParam.test_filename, nbFilenamePGXtest,
inParam.separator_test);
if (imageTest == NULL) {
goto cleanup;
}
}
filenamePNGtest = (char*) malloc(memsizetestfilename);
strcpy(filenamePNGtest, inParam.test_filename);
@ -770,14 +784,13 @@ int main(int argc, char **argv)
printf("Step 1 -> Header comparison\n");
/* check dimensions (issue 286)*/
if(imageBase->numcomps != imageTest->numcomps )
{
printf("ERROR: dim mismatch (%d><%d)\n", imageBase->numcomps, imageTest->numcomps);
if (imageBase->numcomps != imageTest->numcomps) {
printf("ERROR: dim mismatch (%d><%d)\n", imageBase->numcomps,
imageTest->numcomps);
goto cleanup;
}
for (it_comp = 0; it_comp < imageBase->numcomps; it_comp++)
{
for (it_comp = 0; it_comp < imageBase->numcomps; it_comp++) {
param_image_diff[it_comp].x0 = 0;
param_image_diff[it_comp].y0 = 0;
param_image_diff[it_comp].dx = 0;
@ -788,40 +801,44 @@ int main(int argc, char **argv)
param_image_diff[it_comp].h = imageBase->comps[it_comp].h;
param_image_diff[it_comp].w = imageBase->comps[it_comp].w;
if (imageBase->comps[it_comp].sgnd != imageTest->comps[it_comp].sgnd)
{
printf("ERROR: sign mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).sgnd, ((imageTest->comps)[it_comp]).sgnd);
if (imageBase->comps[it_comp].sgnd != imageTest->comps[it_comp].sgnd) {
printf("ERROR: sign mismatch [comp %d] (%d><%d)\n", it_comp,
((imageBase->comps)[it_comp]).sgnd, ((imageTest->comps)[it_comp]).sgnd);
goto cleanup;
}
if (((imageBase->comps)[it_comp]).prec != ((imageTest->comps)[it_comp]).prec)
{
printf("ERROR: prec mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).prec, ((imageTest->comps)[it_comp]).prec);
if (((imageBase->comps)[it_comp]).prec != ((imageTest->comps)[it_comp]).prec &&
!inParam.ignore_prec) {
printf("ERROR: prec mismatch [comp %d] (%d><%d)\n", it_comp,
((imageBase->comps)[it_comp]).prec, ((imageTest->comps)[it_comp]).prec);
goto cleanup;
}
if (((imageBase->comps)[it_comp]).bpp != ((imageTest->comps)[it_comp]).bpp)
{
printf("ERROR: byte per pixel mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).bpp, ((imageTest->comps)[it_comp]).bpp);
if (((imageBase->comps)[it_comp]).bpp != ((imageTest->comps)[it_comp]).bpp &&
!inParam.ignore_prec) {
printf("ERROR: bit per pixel mismatch [comp %d] (%d><%d)\n", it_comp,
((imageBase->comps)[it_comp]).bpp, ((imageTest->comps)[it_comp]).bpp);
goto cleanup;
}
if (((imageBase->comps)[it_comp]).h != ((imageTest->comps)[it_comp]).h)
{
printf("ERROR: height mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).h, ((imageTest->comps)[it_comp]).h);
if (((imageBase->comps)[it_comp]).h != ((imageTest->comps)[it_comp]).h) {
printf("ERROR: height mismatch [comp %d] (%d><%d)\n", it_comp,
((imageBase->comps)[it_comp]).h, ((imageTest->comps)[it_comp]).h);
goto cleanup;
}
if (((imageBase->comps)[it_comp]).w != ((imageTest->comps)[it_comp]).w)
{
printf("ERROR: width mismatch [comp %d] (%d><%d)\n", it_comp, ((imageBase->comps)[it_comp]).w, ((imageTest->comps)[it_comp]).w);
if (((imageBase->comps)[it_comp]).w != ((imageTest->comps)[it_comp]).w) {
printf("ERROR: width mismatch [comp %d] (%d><%d)\n", it_comp,
((imageBase->comps)[it_comp]).w, ((imageTest->comps)[it_comp]).w);
goto cleanup;
}
}
imageDiff = opj_image_create(imageBase->numcomps, param_image_diff, OPJ_CLRSPC_UNSPECIFIED);
imageDiff = opj_image_create(imageBase->numcomps, param_image_diff,
OPJ_CLRSPC_UNSPECIFIED);
/* Free memory*/
free(param_image_diff); param_image_diff = NULL;
free(param_image_diff);
param_image_diff = NULL;
/* Measurement computation*/
printf("Step 2 -> measurement comparison\n");
@ -833,56 +850,71 @@ int main(int argc, char **argv)
/*printf("filenamePNGdiff = %s [%d / %d octets]\n",filenamePNGdiff, strlen(filenamePNGdiff),memsizedifffilename );*/
/* Compute pixel diff*/
for (it_comp = 0; it_comp < imageDiff->numcomps; it_comp++)
{
failed = 0;
for (it_comp = 0; it_comp < imageDiff->numcomps; it_comp++) {
double SE = 0, PEAK = 0;
double MSE = 0;
for (itpxl = 0; itpxl < ((imageDiff->comps)[it_comp]).w * ((imageDiff->comps)[it_comp]).h; itpxl++)
{
if (abs( ((imageBase->comps)[it_comp]).data[itpxl] - ((imageTest->comps)[it_comp]).data[itpxl] ) > 0)
{
valueDiff = ((imageBase->comps)[it_comp]).data[itpxl] - ((imageTest->comps)[it_comp]).data[itpxl];
unsigned right_shift_input = 0;
unsigned right_shift_output = 0;
if (((imageBase->comps)[it_comp]).bpp > ((imageTest->comps)[it_comp]).bpp) {
right_shift_input = ((imageBase->comps)[it_comp]).bpp - ((
imageTest->comps)[it_comp]).bpp;
} else {
right_shift_output = ((imageTest->comps)[it_comp]).bpp - ((
imageBase->comps)[it_comp]).bpp;
}
for (itpxl = 0;
itpxl < ((imageDiff->comps)[it_comp]).w * ((imageDiff->comps)[it_comp]).h;
itpxl++) {
int valueDiff = (((imageBase->comps)[it_comp]).data[itpxl] >> right_shift_input)
- (((imageTest->comps)[it_comp]).data[itpxl] >> right_shift_output);
if (valueDiff != 0) {
((imageDiff->comps)[it_comp]).data[itpxl] = abs(valueDiff);
sumDiff += valueDiff;
nbPixelDiff++;
SE += (double)valueDiff * valueDiff;
PEAK = (PEAK > abs(valueDiff)) ? PEAK : abs(valueDiff);
}
else
} else {
((imageDiff->comps)[it_comp]).data[itpxl] = 0;
}
}/* h*w loop */
MSE = SE / (((imageDiff->comps)[it_comp]).w * ((imageDiff->comps)[it_comp]).h);
if (!inParam.nr_flag && (inParam.tabMSEvalues != NULL) && (inParam.tabPEAKvalues != NULL))
{ /* Conformance test*/
printf("<DartMeasurement name=\"PEAK_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, PEAK);
printf("<DartMeasurement name=\"MSE_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, MSE);
if (!inParam.nr_flag && (inParam.tabMSEvalues != NULL) &&
(inParam.tabPEAKvalues != NULL)) {
/* Conformance test*/
printf("<DartMeasurement name=\"PEAK_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n",
it_comp, PEAK);
printf("<DartMeasurement name=\"MSE_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n",
it_comp, MSE);
if ( (MSE > inParam.tabMSEvalues[it_comp]) || (PEAK > inParam.tabPEAKvalues[it_comp]) )
{
if ((MSE > inParam.tabMSEvalues[it_comp]) ||
(PEAK > inParam.tabPEAKvalues[it_comp])) {
printf("ERROR: MSE (%f) or PEAK (%f) values produced by the decoded file are greater "
"than the allowable error (respectively %f and %f) \n",
MSE, PEAK, inParam.tabMSEvalues[it_comp], inParam.tabPEAKvalues[it_comp]);
goto cleanup;
failed = 1;
}
}
else /* Non regression-test */
{
if ( nbPixelDiff > 0)
{
} else { /* Non regression-test */
if (nbPixelDiff > 0) {
char it_compc[255];
it_compc[0] = 0;
printf("<DartMeasurement name=\"NumberOfPixelsWithDifferences_%d\" type=\"numeric/int\"> %d </DartMeasurement> \n", it_comp, nbPixelDiff);
printf("<DartMeasurement name=\"ComponentError_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, sumDiff);
printf("<DartMeasurement name=\"PEAK_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, PEAK);
printf("<DartMeasurement name=\"MSE_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n", it_comp, MSE);
printf("<DartMeasurement name=\"NumberOfPixelsWithDifferences_%d\" type=\"numeric/int\"> %d </DartMeasurement> \n",
it_comp, nbPixelDiff);
printf("<DartMeasurement name=\"ComponentError_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n",
it_comp, sumDiff);
printf("<DartMeasurement name=\"PEAK_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n",
it_comp, PEAK);
printf("<DartMeasurement name=\"MSE_%d\" type=\"numeric/double\"> %f </DartMeasurement> \n",
it_comp, MSE);
#ifdef OPJ_HAVE_LIBPNG
{
char *filenamePNGbase_it_comp, *filenamePNGtest_it_comp, *filenamePNGdiff_it_comp;
char *filenamePNGbase_it_comp, *filenamePNGtest_it_comp,
*filenamePNGdiff_it_comp;
filenamePNGbase_it_comp = (char*) malloc(memsizebasefilename);
strcpy(filenamePNGbase_it_comp, filenamePNGbase);
@ -924,13 +956,15 @@ int main(int argc, char **argv)
free(filenamePNGdiff_it_comp);
}
#endif
failed = 1;
goto cleanup;
}
}
} /* it_comp loop */
if (!failed) {
printf("---- TEST SUCCEED ----\n");
failed = 0;
}
cleanup:
/*-----------------------------*/
free(param_image_diff);

View File

@ -250,6 +250,32 @@ foreach(OPJ_TEST_CMD_LINE ${OPJ_TEST_CMD_LINE_LIST})
list(REMOVE_AT CMD_ARG_LIST 0)
if(ENC_TEST_FOUND)
# Parse lines like opj_compress lossy-check { -n 3 -m 0:0:0 -p 0:0:0 } ...
set(LOSSY_CHECK_ARG_LIST "")
list(GET CMD_ARG_LIST 0 NEXT_ARG)
string(REGEX MATCH "^lossy-check$" LOSSY_CHECK ${NEXT_ARG})
if(LOSSY_CHECK)
list(REMOVE_AT CMD_ARG_LIST 0)
list(GET CMD_ARG_LIST 0 NEXT_ARG)
string(REGEX MATCH "^{$" FOUND_OPEN_CURL ${NEXT_ARG})
if(NOT FOUND_OPEN_CURL)
message( FATAL_ERROR "'{' expected after lossy-check")
endif()
list(REMOVE_AT CMD_ARG_LIST 0)
while(TRUE)
list(GET CMD_ARG_LIST 0 NEXT_ARG)
list(REMOVE_AT CMD_ARG_LIST 0)
string(REGEX MATCH "^}$" FOUND_CLOSE_CURL ${NEXT_ARG})
if(FOUND_CLOSE_CURL)
break()
endif()
list (APPEND LOSSY_CHECK_ARG_LIST ${NEXT_ARG})
endwhile()
endif()
endif()
endif ()
# Parse the argument list to find the input filename and output filename
@ -322,8 +348,32 @@ foreach(OPJ_TEST_CMD_LINE ${OPJ_TEST_CMD_LINE_LIST})
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-dump)
if(LOSSY_CHECK)
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref
COMMAND opj_decompress
-i ${OUTPUT_FILENAME}
-o ${OUTPUT_FILENAME}.tif
)
set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-encode)
# Compare the decoding file with original one, using tolerance
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dec-ref-out2base
COMMAND compare_images
-b ${INPUT_FILENAME}
-t ${OUTPUT_FILENAME}.tif
-s bXtY
${LOSSY_CHECK_ARG_LIST}
)
set_tests_properties(NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-compare_dec-ref-out2base
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref)
# Decode the encoding file with kakadu expand command
if (KDU_EXPAND_EXECUTABLE)
elseif (KDU_EXPAND_EXECUTABLE)
add_test(NAME NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref
COMMAND ${KDU_EXPAND_EXECUTABLE}
-i ${OUTPUT_FILENAME}
@ -346,7 +396,6 @@ foreach(OPJ_TEST_CMD_LINE ${OPJ_TEST_CMD_LINE_LIST})
PROPERTIES DEPENDS
NR-ENC-${INPUT_FILENAME_NAME}-${IT_TEST_ENC}-decode-ref)
endif()
endif()
# Test the encoded file is a valid JP2 file

View File

@ -32,16 +32,16 @@ opj_compress -i @INPUT_NR_PATH@/random-issue-0005.tif -o @TEMP_PATH@/random-issu
# related to issue 62
opj_compress -i @INPUT_NR_PATH@/tmp-issue-0062.raw -o @TEMP_PATH@/tmp-issue-0062-u.raw.j2k -F 512,512,1,16,u
opj_compress -i @INPUT_NR_PATH@/tmp-issue-0062.raw -o @TEMP_PATH@/tmp-issue-0062-s.raw.j2k -F 512,512,1,16,s
opj_compress -i @INPUT_NR_PATH@/X_4_2K_24_185_CBR_WB_000.tif -o @TEMP_PATH@/X_4_2K_24_185_CBR_WB_000_C2K_24.j2k -cinema2K 24
opj_compress -i @INPUT_NR_PATH@/X_5_2K_24_235_CBR_STEM24_000.tif -o @TEMP_PATH@/X_5_2K_24_235_CBR_STEM24_000_C2K_24.j2k -cinema2K 24
opj_compress -i @INPUT_NR_PATH@/X_6_2K_24_FULL_CBR_CIRCLE_000.tif -o @TEMP_PATH@/X_6_2K_24_FULL_CBR_CIRCLE_000_C2K_24.j2k -cinema2K 24
opj_compress -i @INPUT_NR_PATH@/X_4_2K_24_185_CBR_WB_000.tif -o @TEMP_PATH@/X_4_2K_24_185_CBR_WB_000_C2K_48.j2k -cinema2K 48
opj_compress -i @INPUT_NR_PATH@/X_5_2K_24_235_CBR_STEM24_000.tif -o @TEMP_PATH@/X_5_2K_24_235_CBR_STEM24_000_C2K_48.j2k -cinema2K 48
opj_compress -i @INPUT_NR_PATH@/X_6_2K_24_FULL_CBR_CIRCLE_000.tif -o @TEMP_PATH@/X_6_2K_24_FULL_CBR_CIRCLE_000_C2K_48.j2k -cinema2K 48
opj_compress -i @INPUT_NR_PATH@/ElephantDream_4K.tif -o @TEMP_PATH@/ElephantDream_4K_C4K.j2k -cinema4K
opj_compress lossy-check { -n 3 -i prec -m 175:100:212 -p 79:64:92 } -i @INPUT_NR_PATH@/X_4_2K_24_185_CBR_WB_000.tif -o @TEMP_PATH@/X_4_2K_24_185_CBR_WB_000_C2K_24.j2k -cinema2K 24
opj_compress lossy-check { -n 3 -i prec -m 298:168:363 -p 122:73:164 } -i @INPUT_NR_PATH@/X_5_2K_24_235_CBR_STEM24_000.tif -o @TEMP_PATH@/X_5_2K_24_235_CBR_STEM24_000_C2K_24.j2k -cinema2K 24
opj_compress lossy-check { -n 3 -i prec -m 76:54:140 -p 56:49:74 } -i @INPUT_NR_PATH@/X_6_2K_24_FULL_CBR_CIRCLE_000.tif -o @TEMP_PATH@/X_6_2K_24_FULL_CBR_CIRCLE_000_C2K_24.j2k -cinema2K 24
opj_compress lossy-check { -n 3 -i prec -m 384:385:842 -p 135:144:202 } -i @INPUT_NR_PATH@/X_4_2K_24_185_CBR_WB_000.tif -o @TEMP_PATH@/X_4_2K_24_185_CBR_WB_000_C2K_48.j2k -cinema2K 48
opj_compress lossy-check { -n 3 -i prec -m 933:827:2206 -p 201:184:314 } -i @INPUT_NR_PATH@/X_5_2K_24_235_CBR_STEM24_000.tif -o @TEMP_PATH@/X_5_2K_24_235_CBR_STEM24_000_C2K_48.j2k -cinema2K 48
opj_compress lossy-check { -n 3 -i prec -m 194:173:531 -p 94:79:154 } -i @INPUT_NR_PATH@/X_6_2K_24_FULL_CBR_CIRCLE_000.tif -o @TEMP_PATH@/X_6_2K_24_FULL_CBR_CIRCLE_000_C2K_48.j2k -cinema2K 48
opj_compress lossy-check { -n 3 -i prec -m 6:4:7 -p 141:141:191 } -i @INPUT_NR_PATH@/ElephantDream_4K.tif -o @TEMP_PATH@/ElephantDream_4K_C4K.j2k -cinema4K
# issue 141
opj_compress -i @INPUT_NR_PATH@/issue141.rawl -o @TEMP_PATH@/issue141.rawl.j2k -F 2048,32,1,16,u
opj_compress -i @INPUT_NR_PATH@/issue141.rawl -o @TEMP_PATH@/issue141-I.rawl.j2k -F 2048,32,1,16,u -I
opj_compress lossy-check { -n 1 -m 0.1 -p 2 } -i @INPUT_NR_PATH@/issue141.tif -o @TEMP_PATH@/issue141-I.rawl.j2k -I
# issue 46:
opj_compress -i @INPUT_NR_PATH@/Bretagne2.ppm -o @TEMP_PATH@/Bretagne2_5.j2k -c [64,64]
# issue 316

View File

@ -121,6 +121,9 @@ BUILD_TESTING:BOOL=${BUILD_TESTING}
# Build Thirdparty, useful but not required for test suite
BUILD_THIRDPARTY:BOOL=TRUE
# Build unit tests that test subcomponents of libopenjp2 (e.g. DWT)
BUILD_UNIT_TESTS:BOOL=TRUE
# JPEG2000 test files are available with git clone https://github.com/uclouvain/openjpeg-data.git
OPJ_DATA_ROOT:PATH=$ENV{PWD}/data

View File

@ -1,8 +0,0 @@
NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-15-compare_dec-ref-out2base
NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-16-compare_dec-ref-out2base
NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-17-compare_dec-ref-out2base
NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-18-compare_dec-ref-out2base
NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-19-compare_dec-ref-out2base
NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-20-compare_dec-ref-out2base
NR-ENC-ElephantDream_4K.tif-21-compare_dec-ref-out2base
NR-ENC-issue141.rawl-23-compare_dec-ref-out2base

View File

@ -1,8 +0,0 @@
NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-15-compare_dec-ref-out2base
NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-16-compare_dec-ref-out2base
NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-17-compare_dec-ref-out2base
NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-18-compare_dec-ref-out2base
NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-19-compare_dec-ref-out2base
NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-20-compare_dec-ref-out2base
NR-ENC-ElephantDream_4K.tif-21-compare_dec-ref-out2base
NR-ENC-issue141.rawl-23-compare_dec-ref-out2base

View File

@ -46,11 +46,3 @@ NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
NR-DEC-issue135.j2k-68-decode-md5
NR-DEC-db11217111510058.jp2-306-decode-md5
NR-DEC-tnsot_zero.jp2-307-decode-md5
NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-15-compare_dec-ref-out2base
NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-16-compare_dec-ref-out2base
NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-17-compare_dec-ref-out2base
NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-18-compare_dec-ref-out2base
NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-19-compare_dec-ref-out2base
NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-20-compare_dec-ref-out2base
NR-ENC-ElephantDream_4K.tif-21-compare_dec-ref-out2base
NR-ENC-issue141.rawl-23-compare_dec-ref-out2base

View File

@ -1,8 +0,0 @@
NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-15-compare_dec-ref-out2base
NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-16-compare_dec-ref-out2base
NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-17-compare_dec-ref-out2base
NR-ENC-X_4_2K_24_185_CBR_WB_000.tif-18-compare_dec-ref-out2base
NR-ENC-X_5_2K_24_235_CBR_STEM24_000.tif-19-compare_dec-ref-out2base
NR-ENC-X_6_2K_24_FULL_CBR_CIRCLE_000.tif-20-compare_dec-ref-out2base
NR-ENC-ElephantDream_4K.tif-21-compare_dec-ref-out2base
NR-ENC-issue141.rawl-23-compare_dec-ref-out2base