OpenJPEG  2.2.0
OPJ_INTMATH - Implementation of operations on integers

Exported functions (see also openjpeg.h)

static INLINE OPJ_INT32 opj_int_min (OPJ_INT32 a, OPJ_INT32 b)
 Get the minimum of two integers. More...
 
static INLINE OPJ_UINT32 opj_uint_min (OPJ_UINT32 a, OPJ_UINT32 b)
 Get the minimum of two integers. More...
 
static INLINE OPJ_INT32 opj_int_max (OPJ_INT32 a, OPJ_INT32 b)
 Get the maximum of two integers. More...
 
static INLINE OPJ_UINT32 opj_uint_max (OPJ_UINT32 a, OPJ_UINT32 b)
 Get the maximum of two integers. More...
 
static INLINE OPJ_UINT32 opj_uint_adds (OPJ_UINT32 a, OPJ_UINT32 b)
 Get the saturated sum of two unsigned integers. More...
 
static INLINE OPJ_INT32 opj_int_clamp (OPJ_INT32 a, OPJ_INT32 min, OPJ_INT32 max)
 Clamp an integer inside an interval. More...
 
static INLINE OPJ_INT32 opj_int_abs (OPJ_INT32 a)
 
static INLINE OPJ_INT32 opj_int_ceildiv (OPJ_INT32 a, OPJ_INT32 b)
 Divide an integer and round upwards. More...
 
static INLINE OPJ_UINT32 opj_uint_ceildiv (OPJ_UINT32 a, OPJ_UINT32 b)
 Divide an integer and round upwards. More...
 
static INLINE OPJ_INT32 opj_int_ceildivpow2 (OPJ_INT32 a, OPJ_INT32 b)
 Divide an integer by a power of 2 and round upwards. More...
 
static INLINE OPJ_INT32 opj_int64_ceildivpow2 (OPJ_INT64 a, OPJ_INT32 b)
 Divide a 64bits integer by a power of 2 and round upwards. More...
 
static INLINE OPJ_UINT32 opj_uint_ceildivpow2 (OPJ_UINT32 a, OPJ_UINT32 b)
 Divide an integer by a power of 2 and round upwards. More...
 
static INLINE OPJ_INT32 opj_int_floordivpow2 (OPJ_INT32 a, OPJ_INT32 b)
 Divide an integer by a power of 2 and round downwards. More...
 
static INLINE OPJ_INT32 opj_int_floorlog2 (OPJ_INT32 a)
 Get logarithm of an integer and round downwards. More...
 
static INLINE OPJ_UINT32 opj_uint_floorlog2 (OPJ_UINT32 a)
 Get logarithm of an integer and round downwards. More...
 
static INLINE OPJ_INT32 opj_int_fix_mul (OPJ_INT32 a, OPJ_INT32 b)
 Multiply two fixed-precision rational numbers. More...
 
static INLINE OPJ_INT32 opj_int_fix_mul_t1 (OPJ_INT32 a, OPJ_INT32 b)
 

Detailed Description

Function Documentation

static INLINE OPJ_INT32 opj_int64_ceildivpow2 ( OPJ_INT64  a,
OPJ_INT32  b 
)
static

Divide a 64bits integer by a power of 2 and round upwards.

Returns
Returns a divided by 2^b

Referenced by opj_tcd_init_tile().

static INLINE OPJ_INT32 opj_int_abs ( OPJ_INT32  a)
static
Returns
Get absolute value of integer

Referenced by opj_t1_enc_clnpass(), opj_t1_enc_clnpass_step(), opj_t1_enc_refpass_step(), and opj_t1_enc_sigpass_step().

static INLINE OPJ_INT32 opj_int_ceildiv ( OPJ_INT32  a,
OPJ_INT32  b 
)
static
static INLINE OPJ_INT32 opj_int_ceildivpow2 ( OPJ_INT32  a,
OPJ_INT32  b 
)
static

Divide an integer by a power of 2 and round upwards.

Returns
Returns a divided by 2^b

Referenced by init_tilec(), opj_get_all_encoding_parameters(), opj_get_encoding_parameters(), opj_j2k_get_tile(), opj_j2k_set_decode_area(), and opj_tcd_init_tile().

static INLINE OPJ_INT32 opj_int_clamp ( OPJ_INT32  a,
OPJ_INT32  min,
OPJ_INT32  max 
)
static

Clamp an integer inside an interval.

Returns
  • Returns a if (min < a < max)
  • Returns max if (a > max)
  • Returns min if (a < min)

References max(), and min().

Referenced by opj_tcd_dc_level_shift_decode().

static INLINE OPJ_INT32 opj_int_fix_mul ( OPJ_INT32  a,
OPJ_INT32  b 
)
static

Multiply two fixed-precision rational numbers.

Parameters
a
b
Returns
Returns a * b

Referenced by opj_dwt_encode_1_real(), opj_mct_encode_custom(), and opj_mct_encode_real().

static INLINE OPJ_INT32 opj_int_fix_mul_t1 ( OPJ_INT32  a,
OPJ_INT32  b 
)
static

References T1_NMSEDEC_FRACBITS.

Referenced by opj_t1_encode_cblks().

static INLINE OPJ_INT32 opj_int_floordivpow2 ( OPJ_INT32  a,
OPJ_INT32  b 
)
static

Divide an integer by a power of 2 and round downwards.

Returns
Returns a divided by 2^b

Referenced by opj_get_all_encoding_parameters(), opj_get_encoding_parameters(), opj_pi_next_cprl(), opj_pi_next_pcrl(), opj_pi_next_rpcl(), and opj_tcd_init_tile().

static INLINE OPJ_INT32 opj_int_floorlog2 ( OPJ_INT32  a)
static

Get logarithm of an integer and round downwards.

Returns
Returns log2(a)

Referenced by opj_dwt_encode_stepsize(), opj_j2k_setup_encoder(), opj_t1_encode_cblk(), and opj_t2_encode_packet().

static INLINE OPJ_INT32 opj_int_max ( OPJ_INT32  a,
OPJ_INT32  b 
)
static

Get the maximum of two integers.

Returns
Returns a if a > b else b

Referenced by main(), opj_get_encoding_parameters(), opj_j2k_update_rates(), opj_t1_encode_cblk(), opj_t2_encode_packet(), and opj_tcd_init_tile().

static INLINE OPJ_INT32 opj_int_min ( OPJ_INT32  a,
OPJ_INT32  b 
)
static
static INLINE OPJ_UINT32 opj_uint_adds ( OPJ_UINT32  a,
OPJ_UINT32  b 
)
static

Get the saturated sum of two unsigned integers.

Returns
Returns saturated sum of a+b

Referenced by opj_get_all_encoding_parameters(), opj_image_comp_header_update(), opj_j2k_read_siz(), and opj_tcd_init_tile().

static INLINE OPJ_UINT32 opj_uint_ceildiv ( OPJ_UINT32  a,
OPJ_UINT32  b 
)
static

Divide an integer and round upwards.

Returns
Returns a divided by b

Referenced by opj_image_comp_header_update(), and opj_j2k_update_rates().

static INLINE OPJ_UINT32 opj_uint_ceildivpow2 ( OPJ_UINT32  a,
OPJ_UINT32  b 
)
static

Divide an integer by a power of 2 and round upwards.

Returns
Returns a divided by 2^b

Referenced by opj_image_comp_header_update(), and opj_j2k_update_image_data().

static INLINE OPJ_UINT32 opj_uint_floorlog2 ( OPJ_UINT32  a)
static

Get logarithm of an integer and round downwards.

Returns
Returns log2(a)

Referenced by opj_t2_read_packet_header().

static INLINE OPJ_UINT32 opj_uint_max ( OPJ_UINT32  a,
OPJ_UINT32  b 
)
static
static INLINE OPJ_UINT32 opj_uint_min ( OPJ_UINT32  a,
OPJ_UINT32  b 
)
static