

pack8bit(wavethresh)                         R Documentation

_P_a_c_k_i_n_g _o_f _8_-_b_i_t _I_n_t_e_g_e_r_s

_D_e_s_c_r_i_p_t_i_o_n_:

     In image processing, often pictures are stored as long
     array of values in `0:255'.  For (file) storage, these
     can be packed into 32 bit integers.  These functions
     are for packing and unpacking.

_U_s_a_g_e_:

     pack8bit(v8)
     unpack8bit(v)

_A_r_g_u_m_e_n_t_s_:

      v8: integer vector with 8-bit elements in 0..255.

       v: integer vector (at least 32 bits).

_D_e_t_a_i_l_s_:

     If the length of `v8' is not a multiple of 4,  `v8' is
     effectively padded with one to three `0's.

     The implementation is straightforward and short; look
     at the function definitions.

_V_a_l_u_e_:

     `pack8bit(v8)' returns an integer vector of length
     `ceiling(length(v8) / 4)'.

     `unpack8bit(v)' returns a vector of values from `0:255'
     of length `4 * length(v)'.

_A_u_t_h_o_r_(_s_)_:

     Martin Maechler

_S_e_e _A_l_s_o_:

     `compress' etc for wavelet compression.

_E_x_a_m_p_l_e_s_:

     pack8bit(0:11)
     all(pack8bit(0:11) == pack8bit(0:9))
     all(0:255 == unpack8bit(pack8bit(0:255)))

