Skip to content

Commit

Permalink
Merge branch 'aous72:master' into feature/add-openexr-support
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldsmith authored Jan 28, 2025
2 parents a531e11 + 545acbd commit ae332c6
Show file tree
Hide file tree
Showing 13 changed files with 1,368 additions and 696 deletions.
2 changes: 2 additions & 0 deletions src/core/codestream/ojph_codeblock_fun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ namespace ojph {
tx_from_cb64 = NULL;
}
encode_cb64 = ojph_encode_codeblock64;
bool result = initialize_block_encoder_tables();
assert(result); ojph_unused(result);

#endif // !OJPH_ENABLE_WASM_SIMD

Expand Down
69 changes: 20 additions & 49 deletions src/core/codestream/ojph_tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,15 +287,9 @@ namespace ojph {
if (nlt_type3[comp_num] == type3)
irv_convert_to_float_nlt_type3(line, line_offsets[comp_num],
tc, num_bits[comp_num], is_signed[comp_num], comp_width);
else {
float mul = 1.0f / (float)(1<<num_bits[comp_num]);
const si32 *sp = line->i32 + line_offsets[comp_num];
float *dp = tc->f32;
if (is_signed[comp_num])
cnvrt_si32_to_float(sp, dp, mul, comp_width);
else
cnvrt_si32_to_float_shftd(sp, dp, mul, comp_width);
}
else
irv_convert_to_float(line, line_offsets[comp_num],
tc, num_bits[comp_num], is_signed[comp_num], comp_width);
}
comps[comp_num].push_line();
}
Expand Down Expand Up @@ -331,15 +325,10 @@ namespace ojph {
irv_convert_to_float_nlt_type3(line, line_offsets[comp_num],
lines + comp_num, num_bits[comp_num], is_signed[comp_num],
comp_width);
else {
float mul = 1.0f / (float)(1<<num_bits[comp_num]);
const si32 *sp = line->i32 + line_offsets[comp_num];
float *dp = lines[comp_num].f32;
if (is_signed[comp_num])
cnvrt_si32_to_float(sp, dp, mul, comp_width);
else
cnvrt_si32_to_float_shftd(sp, dp, mul, comp_width);
}
else
irv_convert_to_float(line, line_offsets[comp_num],
lines + comp_num, num_bits[comp_num], is_signed[comp_num],
comp_width);
if (comp_num == 2)
{ // irreversible color transform
ict_forward(lines[0].f32, lines[1].f32, lines[2].f32,
Expand Down Expand Up @@ -387,20 +376,13 @@ namespace ojph {
else
{
if (nlt_type3[comp_num] == type3)
{
irv_convert_to_integer_nlt_type3(src_line, tgt_line,
line_offsets[comp_num], num_bits[comp_num],
is_signed[comp_num], comp_width);
}
else {
float mul = (float)(1 << num_bits[comp_num]);
const float *sp = src_line->f32;
si32 *dp = tgt_line->i32 + line_offsets[comp_num];
if (is_signed[comp_num])
cnvrt_float_to_si32(sp, dp, mul, comp_width);
else
cnvrt_float_to_si32_shftd(sp, dp, mul, comp_width);
}
else
irv_convert_to_integer(src_line, tgt_line,
line_offsets[comp_num], num_bits[comp_num],
is_signed[comp_num], comp_width);
}
}
else
Expand Down Expand Up @@ -437,30 +419,19 @@ namespace ojph {
}
else
{
line_buf* lbp;
if (comp_num < 3)
lbp = lines + comp_num;
else
lbp = comps[comp_num].pull_line();
if (nlt_type3[comp_num] == type3)
{
line_buf* lbp;
if (comp_num < 3)
lbp = lines + comp_num;
else
lbp = comps[comp_num].pull_line();
irv_convert_to_integer_nlt_type3(lbp, tgt_line,
line_offsets[comp_num], num_bits[comp_num],
is_signed[comp_num], comp_width);
}
else {
float mul = (float)(1 << num_bits[comp_num]);
const float *sp;
if (comp_num < 3)
sp = lines[comp_num].f32;
else
sp = comps[comp_num].pull_line()->f32;
si32 *dp = tgt_line->i32 + line_offsets[comp_num];
if (is_signed[comp_num])
cnvrt_float_to_si32(sp, dp, mul, comp_width);
else
cnvrt_float_to_si32_shftd(sp, dp, mul, comp_width);
}
else
irv_convert_to_integer(lbp, tgt_line,
line_offsets[comp_num], num_bits[comp_num],
is_signed[comp_num], comp_width);
}
}

Expand Down
12 changes: 0 additions & 12 deletions src/core/common/ojph_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,6 @@ namespace ojph {
#endif
}

////////////////////////////////////////////////////////////////////////////
static inline si64 ojph_round64(float val)
{
#ifdef OJPH_COMPILER_MSVC
return (si64)(val + (val >= 0.0f ? 0.5f : -0.5f));
#elif (defined OJPH_COMPILER_GNUC)
return (si64)(val + (val >= 0.0f ? 0.5f : -0.5f));
#else
return (si64)round(val);
#endif
}

////////////////////////////////////////////////////////////////////////////
static inline si32 ojph_trunc(float val)
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/common/ojph_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@

#define OPENJPH_VERSION_MAJOR 0
#define OPENJPH_VERSION_MINOR 19
#define OPENJPH_VERSION_PATCH 0
#define OPENJPH_VERSION_PATCH 1
Loading

0 comments on commit ae332c6

Please sign in to comment.