[FFmpeg-cvslog] jpeg2000/j2k: merge getsigctxno()

Michael Niedermayer git at videolan.org
Sun May 26 18:24:02 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun May 26 17:39:02 2013 +0200| [b67fe48f3418e385acb1b4f6e8d640effa250dab] | committer: Michael Niedermayer

jpeg2000/j2k: merge getsigctxno()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b67fe48f3418e385acb1b4f6e8d640effa250dab
---

 libavcodec/j2k.c      |   68 ++++++++++++++++++++++++-------------------------
 libavcodec/jpeg2000.c |   52 ++++++++++++++-----------------------
 2 files changed, 53 insertions(+), 67 deletions(-)

diff --git a/libavcodec/j2k.c b/libavcodec/j2k.c
index af23ef8..d5591b6 100644
--- a/libavcodec/j2k.c
+++ b/libavcodec/j2k.c
@@ -107,43 +107,43 @@ static int getsigctxno(int flag, int bandno)
 {
     int h, v, d;
 
-    h = ((flag & JPEG2000_T1_SIG_E) ? 1:0)+
-        ((flag & JPEG2000_T1_SIG_W) ? 1:0);
-    v = ((flag & JPEG2000_T1_SIG_N) ? 1:0);
-    v = v + ((flag & JPEG2000_T1_SIG_S) ? 1:0);
-    d = ((flag & JPEG2000_T1_SIG_NE) ? 1:0)+
-        ((flag & JPEG2000_T1_SIG_NW) ? 1:0);
-    d = d + ((flag & JPEG2000_T1_SIG_SE) ? 1:0)+
-            ((flag & JPEG2000_T1_SIG_SW) ? 1:0);
+    h = ((flag & JPEG2000_T1_SIG_E)  ? 1 : 0) +
+        ((flag & JPEG2000_T1_SIG_W)  ? 1 : 0);
+    v = ((flag & JPEG2000_T1_SIG_N)  ? 1 : 0) +
+        ((flag & JPEG2000_T1_SIG_S)  ? 1 : 0);
+    d = ((flag & JPEG2000_T1_SIG_NE) ? 1 : 0) +
+        ((flag & JPEG2000_T1_SIG_NW) ? 1 : 0) +
+        ((flag & JPEG2000_T1_SIG_SE) ? 1 : 0) +
+        ((flag & JPEG2000_T1_SIG_SW) ? 1 : 0);
+
     if (bandno < 3){
-            if (bandno == 1)
-                FFSWAP(int, h, v);
-            if (h == 2) return 8;
-            if (h == 1){
-                if (v >= 1) return 7;
-                if (d >= 1) return 6;
-                return 5;
-            }
-            if (v == 2) return 4;
-            if (v == 1) return 3;
-            if (d >= 2) return 2;
-            if (d == 1) return 1;
-            return 0;
+        if (bandno == 1)
+            FFSWAP(int, h, v);
+        if (h == 2) return 8;
+        if (h == 1){
+            if (v >= 1) return 7;
+            if (d >= 1) return 6;
+            return 5;
+        }
+        if (v == 2) return 4;
+        if (v == 1) return 3;
+        if (d >= 2) return 2;
+        if (d == 1) return 1;
     } else{
-            if (d >= 3) return 8;
-            if (d == 2){
-                if (h+v >= 1) return 7;
-                return 6;
-            }
-            if (d == 1){
-                if (h+v >= 2) return 5;
-                if (h+v == 1) return 4;
-                return 3;
-            }
-            if (h+v >= 2) return 2;
-            if (h+v == 1) return 1;
-            return 0;
+        if (d >= 3) return 8;
+        if (d == 2){
+            if (h+v >= 1) return 7;
+            return 6;
+        }
+        if (d == 1){
+            if (h+v >= 2) return 5;
+            if (h+v == 1) return 4;
+            return 3;
+        }
+        if (h+v >= 2) return 2;
+        if (h+v == 1) return 1;
     }
+    return 0;
 }
 
 static int getsgnctxno(int flag, uint8_t *xorbit)
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c
index 060b1fd..18bf1b6 100644
--- a/libavcodec/jpeg2000.c
+++ b/libavcodec/jpeg2000.c
@@ -95,47 +95,33 @@ static int getsigctxno(int flag, int bandno)
         ((flag & JPEG2000_T1_SIG_NW) ? 1 : 0) +
         ((flag & JPEG2000_T1_SIG_SE) ? 1 : 0) +
         ((flag & JPEG2000_T1_SIG_SW) ? 1 : 0);
-    if (bandno < 3) {
+
+    if (bandno < 3){
         if (bandno == 1)
             FFSWAP(int, h, v);
-        if (h == 2)
-            return 8;
-        if (h == 1) {
-            if (v >= 1)
-                return 7;
-            if (d >= 1)
-                return 6;
+        if (h == 2) return 8;
+        if (h == 1){
+            if (v >= 1) return 7;
+            if (d >= 1) return 6;
             return 5;
         }
-        if (v == 2)
-            return 4;
-        if (v == 1)
-            return 3;
-        if (d >= 2)
-            return 2;
-        if (d == 1)
-            return 1;
-        return 0;
-    } else {
-        if (d >= 3)
-            return 8;
-        if (d == 2) {
-            if (h + v >= 1)
-                return 7;
+        if (v == 2) return 4;
+        if (v == 1) return 3;
+        if (d >= 2) return 2;
+        if (d == 1) return 1;
+    } else{
+        if (d >= 3) return 8;
+        if (d == 2){
+            if (h+v >= 1) return 7;
             return 6;
         }
-        if (d == 1) {
-            if (h + v >= 2)
-                return 5;
-            if (h + v == 1)
-                return 4;
+        if (d == 1){
+            if (h+v >= 2) return 5;
+            if (h+v == 1) return 4;
             return 3;
         }
-        if (h + v >= 2)
-            return 2;
-        if (h + v == 1)
-            return 1;
-        return 0;
+        if (h+v >= 2) return 2;
+        if (h+v == 1) return 1;
     }
     return 0;
 }



More information about the ffmpeg-cvslog mailing list