From 9166d595e6c074ec0398c594a1cc46a587b0784c Mon Sep 17 00:00:00 2001 From: Mickael Savinaud Date: Wed, 24 Oct 2012 13:18:12 +0000 Subject: [PATCH] [trunk] use new opj prefix and type with raw functions --- src/lib/openjp2/raw.c | 12 ++++++------ src/lib/openjp2/raw.h | 24 ++++++++++++------------ src/lib/openjp2/t1.c | 12 ++++++------ 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/lib/openjp2/raw.c b/src/lib/openjp2/raw.c index 3d231bfd..1702d36f 100644 --- a/src/lib/openjp2/raw.c +++ b/src/lib/openjp2/raw.c @@ -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)); return raw; } -void raw_destroy(opj_raw_t *raw) { +void opj_raw_destroy(opj_raw_t *raw) { if(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; } -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->lenmax = len; raw->len = 0; @@ -65,8 +65,8 @@ void raw_init_dec(opj_raw_t *raw, unsigned char *bp, int len) { raw->ct = 0; } -int raw_decode(opj_raw_t *raw) { - int d; +OPJ_UINT32 opj_raw_decode(opj_raw_t *raw) { + OPJ_UINT32 d; if (raw->ct == 0) { raw->ct = 8; if (raw->len == raw->lenmax) { diff --git a/src/lib/openjp2/raw.h b/src/lib/openjp2/raw.h index 3c4b372f..6ae62396 100644 --- a/src/lib/openjp2/raw.h +++ b/src/lib/openjp2/raw.h @@ -45,19 +45,19 @@ RAW encoding operations */ typedef struct opj_raw { /** temporary buffer where bits are coded or decoded */ - unsigned char c; + OPJ_BYTE c; /** number of bits already read or free to write */ - unsigned int ct; + OPJ_UINT32 ct; /** maximum length to decode */ - unsigned int lenmax; + OPJ_UINT32 lenmax; /** length decoded */ - unsigned int len; + OPJ_UINT32 len; /** pointer to the current position in the buffer */ - unsigned char *bp; + OPJ_BYTE *bp; /** pointer to the start of the buffer */ - unsigned char *start; + OPJ_BYTE *start; /** pointer to the end of the buffer */ - unsigned char *end; + OPJ_BYTE *end; } opj_raw_t; /** @name Exported functions */ @@ -67,31 +67,31 @@ typedef struct opj_raw { Create a new RAW handle @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 @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 @param raw RAW handle to destroy @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 @param raw RAW handle @param bp Pointer to the start of the buffer from which the bytes will be read @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 @param raw RAW handle @return Returns the decoded symbol (0 or 1) */ -int raw_decode(opj_raw_t *raw); +OPJ_UINT32 opj_raw_decode(opj_raw_t *raw); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openjp2/t1.c b/src/lib/openjp2/t1.c index 41f23b64..e0af094f 100644 --- a/src/lib/openjp2/t1.c +++ b/src/lib/openjp2/t1.c @@ -851,7 +851,7 @@ opj_t1_t* opj_t1_create() return 00; } - l_t1->raw = raw_create(); + l_t1->raw = opj_raw_create(); if (! l_t1->raw) { opj_t1_destroy(l_t1); return 00; @@ -875,7 +875,7 @@ void opj_t1_destroy(opj_t1_t *p_t1) /* destroy MQC and RAW handles */ opj_mqc_destroy(p_t1->mqc); p_t1->mqc = 00; - raw_destroy(p_t1->raw); + opj_raw_destroy(p_t1->raw); p_t1->raw = 00; if (p_t1->data) { @@ -1020,7 +1020,7 @@ opj_bool opj_t1_decode_cblk(opj_t1_t *t1, continue; } 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 { if (OPJ_FALSE == opj_mqc_init_dec(mqc, (*seg->data) + seg->dataindex, seg->len)) { 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) { opj_mqc_setcurctx(mqc, opj_t1_getctxno_mag(flag)); /* ESSAI */ if (type == T1_TYPE_RAW) { - v = raw_decode(raw); + v = opj_raw_decode(raw); } else { 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); if ((flag & T1_SIG_OTH) && !(flag & (T1_SIG | T1_VISIT))) { if (type == T1_TYPE_RAW) { - if (raw_decode(raw)) { - v = raw_decode(raw); /* ESSAI */ + if (opj_raw_decode(raw)) { + v = opj_raw_decode(raw); /* ESSAI */ *datap = v ? -oneplushalf : oneplushalf; opj_t1_updateflags(flagsp, v, t1->flags_stride); } -- 2.50.1