summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/mqc_inl.h
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2017-05-31 14:35:56 +0200
committerEven Rouault <even.rouault@spatialys.com>2017-06-02 18:20:35 +0200
commit68557ff5036e68112bcbf194d2a7f48b1f58b752 (patch)
tree1a48e89f42e713ed0a5a09923e29508d327c2ad5 /src/lib/openjp2/mqc_inl.h
parent1957a498b68af12bfa8d382f96e54f8403bb2fb6 (diff)
T1: Transpose coder optimizations to decoder, and cleanup code
Diffstat (limited to 'src/lib/openjp2/mqc_inl.h')
-rw-r--r--src/lib/openjp2/mqc_inl.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/openjp2/mqc_inl.h b/src/lib/openjp2/mqc_inl.h
index ca3991d7..451ce02d 100644
--- a/src/lib/openjp2/mqc_inl.h
+++ b/src/lib/openjp2/mqc_inl.h
@@ -43,14 +43,14 @@ FIXME DOC
@param mqc MQC handle
@return
*/
-static INLINE OPJ_INT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc)
+static INLINE OPJ_UINT32 opj_mqc_mpsexchange(opj_mqc_t *const mqc)
{
- OPJ_INT32 d;
+ OPJ_UINT32 d;
if (mqc->a < (*mqc->curctx)->qeval) {
- d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
+ d = !((*mqc->curctx)->mps);
*mqc->curctx = (*mqc->curctx)->nlps;
} else {
- d = (OPJ_INT32)(*mqc->curctx)->mps;
+ d = (*mqc->curctx)->mps;
*mqc->curctx = (*mqc->curctx)->nmps;
}
@@ -62,16 +62,16 @@ FIXME DOC
@param mqc MQC handle
@return
*/
-static INLINE OPJ_INT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc)
+static INLINE OPJ_UINT32 opj_mqc_lpsexchange(opj_mqc_t *const mqc)
{
- OPJ_INT32 d;
+ OPJ_UINT32 d;
if (mqc->a < (*mqc->curctx)->qeval) {
mqc->a = (*mqc->curctx)->qeval;
- d = (OPJ_INT32)(*mqc->curctx)->mps;
+ d = (*mqc->curctx)->mps;
*mqc->curctx = (*mqc->curctx)->nmps;
} else {
mqc->a = (*mqc->curctx)->qeval;
- d = (OPJ_INT32)(1 - (*mqc->curctx)->mps);
+ d = !((*mqc->curctx)->mps);
*mqc->curctx = (*mqc->curctx)->nlps;
}
@@ -136,13 +136,13 @@ Decode a symbol
@param mqc MQC handle
@return Returns the decoded symbol (0 or 1)
*/
-static INLINE OPJ_INT32 opj_mqc_decode(opj_mqc_t *const mqc)
+static INLINE OPJ_UINT32 opj_mqc_decode(opj_mqc_t *const mqc)
{
/* Implements ISO 15444-1 C.3.2 Decoding a decision (DECODE) */
/* Note: alternate "J.2 - Decoding an MPS or an LPS in the */
/* software-conventions decoder" has been tried, but does not bring any */
/* improvement. See https://github.com/uclouvain/openjpeg/issues/921 */
- OPJ_INT32 d;
+ OPJ_UINT32 d;
mqc->a -= (*mqc->curctx)->qeval;
if ((mqc->c >> 16) < (*mqc->curctx)->qeval) {
d = opj_mqc_lpsexchange(mqc);
@@ -153,7 +153,7 @@ static INLINE OPJ_INT32 opj_mqc_decode(opj_mqc_t *const mqc)
d = opj_mqc_mpsexchange(mqc);
opj_mqc_renormd(mqc);
} else {
- d = (OPJ_INT32)(*mqc->curctx)->mps;
+ d = (*mqc->curctx)->mps;
}
}