Fix a bug related to tile based decoding

When the sample size is larger than 1.
The calculation of image's height and width should be rounding up not down.

Change-Id: I6c2ad1f630d1f8f9392594887e23f294ecde2352
diff --git a/jdmaster.c b/jdmaster.c
index e44d662..e3da758 100644
--- a/jdmaster.c
+++ b/jdmaster.c
@@ -103,9 +103,12 @@
 #endif
 
   /* Prevent application from calling me at wrong times */
-  // FIXME
-  //if (cinfo->global_state != DSTATE_READY)
-  //  ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
+#if ANDROID_TILE_BASED_DECODE
+  // Tile based decoding may call this function several times.
+  if (!cinfo->tile_decode)
+#endif
+    if (cinfo->global_state != DSTATE_READY)
+      ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
 
 #ifdef IDCT_SCALING_SUPPORTED