OpenJPEG 1.5.1
|
Implementation of an MQ-Coder (MQC) More...
Go to the source code of this file.
Data Structures | |
struct | opj_mqc_state |
This struct defines the state of a context. More... | |
struct | opj_mqc |
MQ coder. More... | |
Macros | |
#define | MQC_NUMCTXS 19 |
Typedefs | |
typedef struct opj_mqc_state | opj_mqc_state_t |
This struct defines the state of a context. More... | |
typedef struct opj_mqc | opj_mqc_t |
MQ coder. More... | |
Exported functions | |
#define | mqc_setcurctx(mqc, ctxno) (mqc)->curctx = &(mqc)->ctxs[(int)(ctxno)] |
Set the current context used for coding/decoding. More... | |
opj_mqc_t * | mqc_create (void) |
Create a new MQC handle. More... | |
void | mqc_destroy (opj_mqc_t *mqc) |
Destroy a previously created MQC handle. More... | |
int | mqc_numbytes (opj_mqc_t *mqc) |
Return the number of bytes written/read since initialisation. More... | |
void | mqc_resetstates (opj_mqc_t *mqc) |
Reset the states of all the context of the coder/decoder (each context is set to a state where 0 and 1 are more or less equiprobable) More... | |
void | mqc_setstate (opj_mqc_t *mqc, int ctxno, int msb, int prob) |
Set the state of a particular context. More... | |
void | mqc_init_enc (opj_mqc_t *mqc, unsigned char *bp) |
Initialize the encoder. More... | |
void | mqc_encode (opj_mqc_t *mqc, int d) |
Encode a symbol using the MQ-coder. More... | |
void | mqc_flush (opj_mqc_t *mqc) |
Flush the encoder, so that all remaining data is written. More... | |
void | mqc_bypass_init_enc (opj_mqc_t *mqc) |
BYPASS mode switch, initialization operation. More... | |
void | mqc_bypass_enc (opj_mqc_t *mqc, int d) |
BYPASS mode switch, coding operation. More... | |
int | mqc_bypass_flush_enc (opj_mqc_t *mqc) |
BYPASS mode switch, flush operation. More... | |
void | mqc_reset_enc (opj_mqc_t *mqc) |
RESET mode switch. More... | |
int | mqc_restart_enc (opj_mqc_t *mqc) |
RESTART mode switch (TERMALL) More... | |
void | mqc_restart_init_enc (opj_mqc_t *mqc) |
RESTART mode switch (TERMALL) reinitialisation. More... | |
void | mqc_erterm_enc (opj_mqc_t *mqc) |
ERTERM mode switch (PTERM) More... | |
void | mqc_segmark_enc (opj_mqc_t *mqc) |
SEGMARK mode switch (SEGSYM) More... | |
void | mqc_init_dec (opj_mqc_t *mqc, unsigned char *bp, int len) |
Initialize the decoder. More... | |
int | mqc_decode (opj_mqc_t *const mqc) |
Decode a symbol. More... | |
Implementation of an MQ-Coder (MQC)
The functions in MQC.C have for goal to realize the MQ-coder operations. The functions in MQC.C are used by some function in T1.C.
#define MQC_NUMCTXS 19 |
#define mqc_setcurctx | ( | mqc, | |
ctxno | |||
) | (mqc)->curctx = &(mqc)->ctxs[(int)(ctxno)] |
Set the current context used for coding/decoding.
mqc | MQC handle |
ctxno | Number that identifies the context |
typedef struct opj_mqc_state opj_mqc_state_t |
This struct defines the state of a context.
void mqc_bypass_enc | ( | opj_mqc_t * | mqc, |
int | d | ||
) |
BYPASS mode switch, coding operation.
JPEG 2000 p 505.
mqc | MQC handle |
d | The symbol to be encoded (0 or 1) |
References opj_mqc::bp, opj_mqc::c, and opj_mqc::ct.
Referenced by t1_enc_refpass_step(), and t1_enc_sigpass_step().
int mqc_bypass_flush_enc | ( | opj_mqc_t * | mqc | ) |
BYPASS mode switch, flush operation.
mqc | MQC handle |
References opj_mqc::bp, opj_mqc::c, and opj_mqc::ct.
void mqc_bypass_init_enc | ( | opj_mqc_t * | mqc | ) |
BYPASS mode switch, initialization operation.
JPEG 2000 p 505.
mqc | MQC handle |
References opj_mqc::c, and opj_mqc::ct.
Referenced by t1_encode_cblk().
opj_mqc_t * mqc_create | ( | void | ) |
Create a new MQC handle.
References opj_malloc.
Referenced by t1_create().
int mqc_decode | ( | opj_mqc_t *const | mqc | ) |
Decode a symbol.
mqc | MQC handle |
References opj_mqc::a, opj_mqc::c, opj_mqc::curctx, mqc_lpsexchange(), mqc_mpsexchange(), and mqc_renormd().
Referenced by t1_dec_clnpass(), t1_dec_clnpass_step(), t1_dec_clnpass_step_partial(), t1_dec_clnpass_step_vsc(), t1_dec_refpass_step_mqc(), t1_dec_refpass_step_mqc_vsc(), t1_dec_sigpass_step_mqc(), and t1_dec_sigpass_step_mqc_vsc().
void mqc_destroy | ( | opj_mqc_t * | mqc | ) |
Destroy a previously created MQC handle.
mqc | MQC handle to destroy |
References opj_free.
Referenced by t1_destroy().
void mqc_encode | ( | opj_mqc_t * | mqc, |
int | d | ||
) |
Encode a symbol using the MQ-coder.
mqc | MQC handle |
d | The symbol to be encoded (0 or 1) |
References opj_mqc::curctx, mqc_codelps(), and mqc_codemps().
Referenced by mqc_segmark_enc(), t1_enc_clnpass(), t1_enc_clnpass_step(), t1_enc_refpass_step(), and t1_enc_sigpass_step().
void mqc_erterm_enc | ( | opj_mqc_t * | mqc | ) |
ERTERM mode switch (PTERM)
mqc | MQC handle |
References opj_mqc::bp, opj_mqc::c, opj_mqc::ct, and mqc_byteout().
Referenced by t1_encode_cblk().
void mqc_flush | ( | opj_mqc_t * | mqc | ) |
Flush the encoder, so that all remaining data is written.
mqc | MQC handle |
References opj_mqc::bp, opj_mqc::c, opj_mqc::ct, mqc_byteout(), and mqc_setbits().
Referenced by t1_encode_cblk().
void mqc_init_dec | ( | opj_mqc_t * | mqc, |
unsigned char * | bp, | ||
int | len | ||
) |
Initialize the decoder.
mqc | MQC handle |
bp | Pointer to the start of the buffer from which the bytes will be read |
len | Length of the input buffer |
References opj_mqc::a, opj_mqc::bp, opj_mqc::c, opj_mqc::ct, opj_mqc::end, mqc_bytein(), mqc_setcurctx, opj_realloc, and opj_mqc::start.
Referenced by t1_decode_cblk().
void mqc_init_enc | ( | opj_mqc_t * | mqc, |
unsigned char * | bp | ||
) |
Initialize the encoder.
mqc | MQC handle |
bp | Pointer to the start of the buffer where the bytes will be written |
References opj_mqc::a, opj_mqc::bp, opj_mqc::c, opj_mqc::ct, mqc_setcurctx, and opj_mqc::start.
Referenced by t1_encode_cblk().
int mqc_numbytes | ( | opj_mqc_t * | mqc | ) |
Return the number of bytes written/read since initialisation.
mqc | MQC handle |
References opj_mqc::bp, and opj_mqc::start.
Referenced by t1_encode_cblk().
void mqc_reset_enc | ( | opj_mqc_t * | mqc | ) |
RESET mode switch.
mqc | MQC handle |
References mqc_resetstates(), mqc_setstate(), T1_CTXNO_AGG, T1_CTXNO_UNI, and T1_CTXNO_ZC.
Referenced by t1_encode_cblk().
void mqc_resetstates | ( | opj_mqc_t * | mqc | ) |
Reset the states of all the context of the coder/decoder (each context is set to a state where 0 and 1 are more or less equiprobable)
mqc | MQC handle |
References opj_mqc::ctxs, MQC_NUMCTXS, and mqc_states.
Referenced by mqc_reset_enc(), t1_decode_cblk(), and t1_encode_cblk().
int mqc_restart_enc | ( | opj_mqc_t * | mqc | ) |
RESTART mode switch (TERMALL)
mqc | MQC handle |
References opj_mqc::c, opj_mqc::ct, and mqc_byteout().
void mqc_restart_init_enc | ( | opj_mqc_t * | mqc | ) |
RESTART mode switch (TERMALL) reinitialisation.
mqc | MQC handle |
References opj_mqc::a, opj_mqc::bp, opj_mqc::c, opj_mqc::ct, and mqc_setcurctx.
Referenced by t1_encode_cblk().
void mqc_segmark_enc | ( | opj_mqc_t * | mqc | ) |
SEGMARK mode switch (SEGSYM)
mqc | MQC handle |
References mqc_encode(), and mqc_setcurctx.
Referenced by t1_encode_cblk().
void mqc_setstate | ( | opj_mqc_t * | mqc, |
int | ctxno, | ||
int | msb, | ||
int | prob | ||
) |
Set the state of a particular context.
mqc | MQC handle |
ctxno | Number that identifies the context |
msb | The MSB of the new state of the context |
prob | Number that identifies the probability of the symbols for the new state of the context |
References opj_mqc::ctxs, and mqc_states.
Referenced by mqc_reset_enc(), t1_decode_cblk(), and t1_encode_cblk().