OpenJPH
Open-source implementation of JPEG2000 Part-15
|
non-linearity point transformation object (implements NLT marker segment) More...
#include <ojph_params.h>
Public Types | |
enum | special_comp_num : ui16 { ALL_COMPS = 65535 } |
enum | nonlinearity : ui8 { OJPH_NLT_NO_NLT = 0 , OJPH_NLT_GAMMA_STYLE_NLT = 1 , OJPH_NLT_LUT_STYLE_NLT = 2 , OJPH_NLT_BINARY_COMPLEMENT_NLT = 3 , OJPH_NLT_UNDEFINED = 255 } |
Public Member Functions | |
param_nlt (local::param_nlt *p) | |
void | set_nonlinear_transform (ui32 comp_num, ui8 nl_type) |
enables or disables type 3 nonlinearity for a component or the default setting More... | |
bool | get_nonlinear_transform (ui32 comp_num, ui8 &bit_depth, bool &is_signed, ui8 &nl_type) const |
get the nonlinearity type associated with comp_num, which should be one from enum nonlinearity More... | |
Private Attributes | |
local::param_nlt * | state |
non-linearity point transformation object (implements NLT marker segment)
There are a few things to know here.
The NLT marker segment contains the nonlinearity type and the bit depth and signedness of the component to which it applies. There is the default component ALL_COMPS which applies to all components unless it is overridden by another NLT segment marker. The library checks that the settings make sense, and also make sure that bit depth and signedness are correct, creating any missing NLT marker segments in the process. If all components have the same bit depth and signedness, and need nonlinearity type 3 (Binary Complement to Sign Magnitude Conversion), then the best option is to set ALL_COMPS to type 3. Otherwise, the best option is to set type 3 only to components that need it, leaving out the default ALL_COMPS nonlinearity not set. Another option is for the end-user can set the ALL_COMPS to type 3, and then put exception for the components that does not need type 3, by setting them to type 0.
The library, during validity check, which is run when the codestream is created for writing, will do the following: – If ALL_COMPS is set to type 0, it will be ignored, and the codestream will NOT have the corresponding NLT marker segment. – If ALL_COMPS is set to type 3, then the following will happen:
It also worth noting that type 3 nonlinearity has no effect on positive image samples. It is also not recommended for integer-valued types. It is only recommended for floating-point image samples, for which some of the samples are negative, where type 3 nonlinearity should be beneficial. This is because the encoding engine expects two-complement representation for negative values while floating point numbers have a sign bit followed by an exponent, which has a biased integer representation. The core idea is to make floating-point representation more compatible with integer representation.
Definition at line 244 of file ojph_params.h.
enum ojph::param_nlt::nonlinearity : ui8 |
Enumerator | |
---|---|
OJPH_NLT_NO_NLT | |
OJPH_NLT_GAMMA_STYLE_NLT | |
OJPH_NLT_LUT_STYLE_NLT | |
OJPH_NLT_BINARY_COMPLEMENT_NLT | |
OJPH_NLT_UNDEFINED |
Definition at line 248 of file ojph_params.h.
Enumerator | |
---|---|
ALL_COMPS |
Definition at line 247 of file ojph_params.h.
|
inline |
Definition at line 257 of file ojph_params.h.
bool ojph::param_nlt::get_nonlinear_transform | ( | ui32 | comp_num, |
ui8 & | bit_depth, | ||
bool & | is_signed, | ||
ui8 & | nl_type | ||
) | const |
get the nonlinearity type associated with comp_num, which should be one from enum nonlinearity
comp_num | component number, or 65535 for the default setting |
bit_depth | returns the bit depth of the component/default |
is_signed | returns true if the component/default is signed |
type | nonlinearity type |
Definition at line 444 of file ojph_params.cpp.
References ojph::local::param_nlt::get_nonlinear_transform(), and state.
enables or disables type 3 nonlinearity for a component or the default setting
When creating a codestream for writing, call this function before you call codestream::write_headers.
comp_num | component number, or 65535 for the default setting |
type | desired non-linearity from enum nonlinearity |
Definition at line 438 of file ojph_params.cpp.
References ojph::local::param_nlt::set_nonlinear_transform(), and state.
Referenced by main().
|
private |
Definition at line 286 of file ojph_params.h.
Referenced by get_nonlinear_transform(), and set_nonlinear_transform().