[trunk] use new opj prefix and type with raw functions

This commit is contained in:
Mickael Savinaud
2012-10-24 13:18:12 +00:00
parent f1061c8763
commit 9166d595e6
3 changed files with 24 additions and 24 deletions

View File

@@ -42,22 +42,22 @@
========================================================== ==========================================================
*/ */
opj_raw_t* raw_create(void) { opj_raw_t* opj_raw_create(void) {
opj_raw_t *raw = (opj_raw_t*)opj_malloc(sizeof(opj_raw_t)); opj_raw_t *raw = (opj_raw_t*)opj_malloc(sizeof(opj_raw_t));
return raw; return raw;
} }
void raw_destroy(opj_raw_t *raw) { void opj_raw_destroy(opj_raw_t *raw) {
if(raw) { if(raw) {
opj_free(raw); opj_free(raw);
} }
} }
int raw_numbytes(opj_raw_t *raw) { OPJ_UINT32 opj_raw_numbytes(opj_raw_t *raw) {
return raw->bp - raw->start; return raw->bp - raw->start;
} }
void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len) { void opj_raw_init_dec(opj_raw_t *raw, OPJ_BYTE *bp, OPJ_UINT32 len) {
raw->start = bp; raw->start = bp;
raw->lenmax = len; raw->lenmax = len;
raw->len = 0; raw->len = 0;
@@ -65,8 +65,8 @@ void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len) {
raw->ct = 0; raw->ct = 0;
} }
int raw_decode(opj_raw_t *raw) { OPJ_UINT32 opj_raw_decode(opj_raw_t *raw) {
int d; OPJ_UINT32 d;
if (raw->ct == 0) { if (raw->ct == 0) {
raw->ct = 8; raw->ct = 8;
if (raw->len == raw->lenmax) { if (raw->len == raw->lenmax) {

View File

@@ -45,19 +45,19 @@ RAW encoding operations
*/ */
typedef struct opj_raw { typedef struct opj_raw {
/** temporary buffer where bits are coded or decoded */ /** temporary buffer where bits are coded or decoded */
unsigned char c; OPJ_BYTE c;
/** number of bits already read or free to write */ /** number of bits already read or free to write */
unsigned int ct; OPJ_UINT32 ct;
/** maximum length to decode */ /** maximum length to decode */
unsigned int lenmax; OPJ_UINT32 lenmax;
/** length decoded */ /** length decoded */
unsigned int len; OPJ_UINT32 len;
/** pointer to the current position in the buffer */ /** pointer to the current position in the buffer */
unsigned char *bp; OPJ_BYTE *bp;
/** pointer to the start of the buffer */ /** pointer to the start of the buffer */
unsigned char *start; OPJ_BYTE *start;
/** pointer to the end of the buffer */ /** pointer to the end of the buffer */
unsigned char *end; OPJ_BYTE *end;
} opj_raw_t; } opj_raw_t;
/** @name Exported functions */ /** @name Exported functions */
@@ -67,31 +67,31 @@ typedef struct opj_raw {
Create a new RAW handle Create a new RAW handle
@return Returns a new RAW handle if successful, returns NULL otherwise @return Returns a new RAW handle if successful, returns NULL otherwise
*/ */
opj_raw_t* raw_create(void); opj_raw_t* opj_raw_create(void);
/** /**
Destroy a previously created RAW handle Destroy a previously created RAW handle
@param raw RAW handle to destroy @param raw RAW handle to destroy
*/ */
void raw_destroy(opj_raw_t *raw); void opj_raw_destroy(opj_raw_t *raw);
/** /**
Return the number of bytes written/read since initialisation Return the number of bytes written/read since initialisation
@param raw RAW handle to destroy @param raw RAW handle to destroy
@return Returns the number of bytes already encoded @return Returns the number of bytes already encoded
*/ */
int raw_numbytes(opj_raw_t *raw); OPJ_UINT32 opj_raw_numbytes(opj_raw_t *raw);
/** /**
Initialize the decoder Initialize the decoder
@param raw RAW handle @param raw RAW handle
@param bp Pointer to the start of the buffer from which the bytes will be read @param bp Pointer to the start of the buffer from which the bytes will be read
@param len Length of the input buffer @param len Length of the input buffer
*/ */
void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len); void opj_raw_init_dec(opj_raw_t *raw, OPJ_BYTE *bp, OPJ_UINT32 len);
/** /**
Decode a symbol using raw-decoder. Cfr p.506 TAUBMAN Decode a symbol using raw-decoder. Cfr p.506 TAUBMAN
@param raw RAW handle @param raw RAW handle
@return Returns the decoded symbol (0 or 1) @return Returns the decoded symbol (0 or 1)
*/ */
int raw_decode(opj_raw_t *raw); OPJ_UINT32 opj_raw_decode(opj_raw_t *raw);
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
/*@}*/ /*@}*/

View File

@@ -851,7 +851,7 @@ opj_t1_t* opj_t1_create()
return 00; return 00;
} }
l_t1->raw = raw_create(); l_t1->raw = opj_raw_create();
if (! l_t1->raw) { if (! l_t1->raw) {
opj_t1_destroy(l_t1); opj_t1_destroy(l_t1);
return 00; return 00;
@@ -875,7 +875,7 @@ void opj_t1_destroy(opj_t1_t *p_t1)
/* destroy MQC and RAW handles */ /* destroy MQC and RAW handles */
opj_mqc_destroy(p_t1->mqc); opj_mqc_destroy(p_t1->mqc);
p_t1->mqc = 00; p_t1->mqc = 00;
raw_destroy(p_t1->raw); opj_raw_destroy(p_t1->raw);
p_t1->raw = 00; p_t1->raw = 00;
if (p_t1->data) { if (p_t1->data) {
@@ -1020,7 +1020,7 @@ opj_bool opj_t1_decode_cblk(opj_t1_t *t1,
continue; continue;
} }
if (type == T1_TYPE_RAW) { if (type == T1_TYPE_RAW) {
raw_init_dec(raw, (*seg->data) + seg->dataindex, seg->len); opj_raw_init_dec(raw, (*seg->data) + seg->dataindex, seg->len);
} else { } else {
if (OPJ_FALSE == opj_mqc_init_dec(mqc, (*seg->data) + seg->dataindex, seg->len)) { if (OPJ_FALSE == opj_mqc_init_dec(mqc, (*seg->data) + seg->dataindex, seg->len)) {
return OPJ_FALSE; return OPJ_FALSE;
@@ -1336,7 +1336,7 @@ void opj_t1_dec_refpass_step( opj_t1_t *t1,
if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) { if ((flag & (T1_SIG | T1_VISIT)) == T1_SIG) {
opj_mqc_setcurctx(mqc, opj_t1_getctxno_mag(flag)); /* ESSAI */ opj_mqc_setcurctx(mqc, opj_t1_getctxno_mag(flag)); /* ESSAI */
if (type == T1_TYPE_RAW) { if (type == T1_TYPE_RAW) {
v = raw_decode(raw); v = opj_raw_decode(raw);
} else { } else {
v = opj_mqc_decode(mqc); v = opj_mqc_decode(mqc);
} }
@@ -1390,8 +1390,8 @@ void opj_t1_dec_sigpass_step( opj_t1_t *t1,
flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp); flag = vsc ? ((*flagsp) & (~(T1_SIG_S | T1_SIG_SE | T1_SIG_SW | T1_SGN_S))) : (*flagsp);
if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) { if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) {
if (type == T1_TYPE_RAW) { if (type == T1_TYPE_RAW) {
if (raw_decode(raw)) { if (opj_raw_decode(raw)) {
v = raw_decode(raw); /* ESSAI */ v = opj_raw_decode(raw); /* ESSAI */
*datap = v ? -oneplushalf : oneplushalf; *datap = v ? -oneplushalf : oneplushalf;
opj_t1_updateflags(flagsp, v, t1->flags_stride); opj_t1_updateflags(flagsp, v, t1->flags_stride);
} }