]> granicus.if.org Git - libjpeg-turbo/commitdiff
TJBench Java: Properly handle transform warnings
authorDRC <information@libjpeg-turbo.org>
Wed, 2 Jan 2019 03:16:33 +0000 (21:16 -0600)
committerDRC <information@libjpeg-turbo.org>
Wed, 2 Jan 2019 03:16:33 +0000 (21:16 -0600)
+ warnings from TJDecompressor.decompressHeader()

java/TJBench.java

index bd555626328555cd2d27f41c6a3ffb1700925c1d..7829e53cd419f3ae3b2f9578eb298d48ab9ea500 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C)2009-2014, 2016-2018 D. R. Commander.  All Rights Reserved.
+ * Copyright (C)2009-2014, 2016-2019 D. R. Commander.  All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -202,7 +202,9 @@ final class TJBench {
           int width = doTile ? Math.min(tilew, w - x) : scaledw;
           int height = doTile ? Math.min(tileh, h - y) : scaledh;
 
-          tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]);
+          try {
+            tjd.setSourceImage(jpegBuf[tile], jpegSize[tile]);
+          } catch (TJException e) { handleTJException(e); }
           if (doYUV) {
             yuvImage.setBuf(yuvImage.getBuf(), width, yuvPad, height, subsamp);
             try {
@@ -500,7 +502,9 @@ final class TJBench {
 
     tjt = new TJTransformer();
 
-    tjt.setSourceImage(srcBuf, srcSize);
+    try {
+      tjt.setSourceImage(srcBuf, srcSize);
+    } catch (TJException e) { handleTJException(e); }
     w = tjt.getWidth();
     h = tjt.getHeight();
     subsamp = tjt.getSubsamp();
@@ -607,7 +611,9 @@ final class TJBench {
         elapsed = 0.;
         while (true) {
           start = getTime();
-          tjt.transform(jpegBuf, t, flags);
+          try {
+            tjt.transform(jpegBuf, t, flags);
+          } catch (TJException e) { handleTJException(e); }
           jpegSize = tjt.getTransformedSizes();
           elapsed += getTime() - start;
           if (iter >= 0) {