| OLD | NEW |
| 1 /* | 1 /* |
| 2 * The copyright in this software is being made available under the 2-clauses | 2 * The copyright in this software is being made available under the 2-clauses |
| 3 * BSD License, included below. This software may be subject to other third | 3 * BSD License, included below. This software may be subject to other third |
| 4 * party and contributor rights, including patent rights, and no such rights | 4 * party and contributor rights, including patent rights, and no such rights |
| 5 * are granted under this license. | 5 * are granted under this license. |
| 6 * | 6 * |
| 7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium | 7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium |
| 8 * Copyright (c) 2002-2014, Professor Benoit Macq | 8 * Copyright (c) 2002-2014, Professor Benoit Macq |
| 9 * Copyright (c) 2001-2003, David Janssens | 9 * Copyright (c) 2001-2003, David Janssens |
| 10 * Copyright (c) 2002-2003, Yannick Verschueren | 10 * Copyright (c) 2002-2003, Yannick Verschueren |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 /*@}*/ | 71 /*@}*/ |
| 72 | 72 |
| 73 /*@}*/ | 73 /*@}*/ |
| 74 | 74 |
| 75 /* | 75 /* |
| 76 ========================================================== | 76 ========================================================== |
| 77 local functions | 77 local functions |
| 78 ========================================================== | 78 ========================================================== |
| 79 */ | 79 */ |
| 80 | 80 |
| 81 OPJ_BOOL opj_bio_byteout(opj_bio_t *bio) { | 81 static OPJ_BOOL opj_bio_byteout(opj_bio_t *bio) { |
| 82 bio->buf = (bio->buf << 8) & 0xffff; | 82 bio->buf = (bio->buf << 8) & 0xffff; |
| 83 bio->ct = bio->buf == 0xff00 ? 7 : 8; | 83 bio->ct = bio->buf == 0xff00 ? 7 : 8; |
| 84 if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) { | 84 if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) { |
| 85 return OPJ_FALSE; | 85 return OPJ_FALSE; |
| 86 } | 86 } |
| 87 *bio->bp++ = (OPJ_BYTE)(bio->buf >> 8); | 87 *bio->bp++ = (OPJ_BYTE)(bio->buf >> 8); |
| 88 return OPJ_TRUE; | 88 return OPJ_TRUE; |
| 89 } | 89 } |
| 90 | 90 |
| 91 OPJ_BOOL opj_bio_bytein(opj_bio_t *bio) { | 91 static OPJ_BOOL opj_bio_bytein(opj_bio_t *bio) { |
| 92 bio->buf = (bio->buf << 8) & 0xffff; | 92 bio->buf = (bio->buf << 8) & 0xffff; |
| 93 bio->ct = bio->buf == 0xff00 ? 7 : 8; | 93 bio->ct = bio->buf == 0xff00 ? 7 : 8; |
| 94 if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) { | 94 if ((OPJ_SIZE_T)bio->bp >= (OPJ_SIZE_T)bio->end) { |
| 95 return OPJ_FALSE; | 95 return OPJ_FALSE; |
| 96 } | 96 } |
| 97 bio->buf |= *bio->bp++; | 97 bio->buf |= *bio->bp++; |
| 98 return OPJ_TRUE; | 98 return OPJ_TRUE; |
| 99 } | 99 } |
| 100 | 100 |
| 101 void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) { | 101 static void opj_bio_putbit(opj_bio_t *bio, OPJ_UINT32 b) { |
| 102 if (bio->ct == 0) { | 102 if (bio->ct == 0) { |
| 103 opj_bio_byteout(bio); /* MSD: why not check the return value of
this function ? */ | 103 opj_bio_byteout(bio); /* MSD: why not check the return value of
this function ? */ |
| 104 } | 104 } |
| 105 bio->ct--; | 105 bio->ct--; |
| 106 bio->buf |= b << bio->ct; | 106 bio->buf |= b << bio->ct; |
| 107 } | 107 } |
| 108 | 108 |
| 109 OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio) { | 109 static OPJ_UINT32 opj_bio_getbit(opj_bio_t *bio) { |
| 110 if (bio->ct == 0) { | 110 if (bio->ct == 0) { |
| 111 opj_bio_bytein(bio); /* MSD: why not check the return value of t
his function ? */ | 111 opj_bio_bytein(bio); /* MSD: why not check the return value of t
his function ? */ |
| 112 } | 112 } |
| 113 bio->ct--; | 113 bio->ct--; |
| 114 return (bio->buf >> bio->ct) & 1; | 114 return (bio->buf >> bio->ct) & 1; |
| 115 } | 115 } |
| 116 | 116 |
| 117 /* | 117 /* |
| 118 ========================================================== | 118 ========================================================== |
| 119 Bit Input/Output interface | 119 Bit Input/Output interface |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 OPJ_BOOL opj_bio_inalign(opj_bio_t *bio) { | 183 OPJ_BOOL opj_bio_inalign(opj_bio_t *bio) { |
| 184 if ((bio->buf & 0xff) == 0xff) { | 184 if ((bio->buf & 0xff) == 0xff) { |
| 185 if (! opj_bio_bytein(bio)) { | 185 if (! opj_bio_bytein(bio)) { |
| 186 return OPJ_FALSE; | 186 return OPJ_FALSE; |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 bio->ct = 0; | 189 bio->ct = 0; |
| 190 return OPJ_TRUE; | 190 return OPJ_TRUE; |
| 191 } | 191 } |
| OLD | NEW |