[trunk] use new opj prefix and type with raw functions
authorMickael Savinaud <savmickael@users.noreply.github.com>
Wed, 24 Oct 2012 13:18:12 +0000 (13:18 +0000)
committerMickael Savinaud <savmickael@users.noreply.github.com>
Wed, 24 Oct 2012 13:18:12 +0000 (13:18 +0000)
src/lib/openjp2/raw.c
src/lib/openjp2/raw.h
src/lib/openjp2/t1.c

index 3d231bfdc6b3151ea1ca8acf47535dad6818f7b6..1702d36f5b3855f86805ee08503c4b5bfc934fb6 100644 (file)
 ==========================================================
 */
 
-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) {
index 3c4b372f3f6182fbcc2cea57203144db4d2d848b..6ae623963dcf4b93f81f0215db84300a065f550b 100644 (file)
@@ -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);
 /* ----------------------------------------------------------------------- */
 /*@}*/
 
index 41f23b64352b2bde75319189ba4c15f92852165f..e0af094f07e90628c8721a70686864052f564f18 100644 (file)
@@ -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);
                        }