Any changes are to allow conversion to BMP

Dependents:   Color_Targeting_Catapult

Fork of BaseJpegDecode by Norimasa Okamoto

Revision:
4:e243fa781e5c
Parent:
3:a7547692071d
Child:
5:85e99ec2e7b5
--- a/BaseJpegDecode.cpp	Mon Nov 05 22:47:05 2012 +0000
+++ b/BaseJpegDecode.cpp	Wed Dec 05 12:38:56 2012 +0000
@@ -9,7 +9,7 @@
 #define DBG_WAIT(A)
 #endif
 
-#if 1
+#if 0
 #define DBG_ASSERT(A) while(!(A)){fprintf(stderr,"\n\n%s@%d %s ASSERT!\n\n",__PRETTY_FUNCTION__,__LINE__,#A);exit(1);};
 #else
 #define DBG_ASSERT(A) 
@@ -49,6 +49,9 @@
     clear();
     pHD = new HuffmanDecode;
     DBG_ASSERT(pHD);
+    if (pHD == NULL) {
+        return;
+    }
     qt[0] = new uint8_t[64];
     qt[1] = new uint8_t[64];
     DBG_ASSERT(qt[0]);
@@ -84,7 +87,11 @@
         m_param1 = c;
         DBG_ASSERT(m_param1 == 0 || m_param1 == 1);
     } else {
-        qt[m_param1][(pos%65)-1] = c;
+        if (m_param1 == 0 || m_param1 == 1) { 
+            if(qt[m_param1]) {
+                qt[m_param1][(pos%65)-1] = c;
+            }
+        }
     }
 }