JDK-8100252 : Use native ImageIO.framework for loading images on Mac OS X
  • Type: Sub-task
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: fx1.2
  • Priority: P3
  • Status: Resolved
  • Resolution: Won't Fix
  • Submitted: 2008-12-01
  • Updated: 2015-06-16
  • Resolved: 2011-04-15
Description
This is being split off from RT-2365, where the idea was first pitched.

Since 10.4, Mac OS X has provided a native ImageIO.framework for reading and writing images, similar to Java's Image I/O framework.  Measurements show that performance of ImageIO.framework can be much better than using the core JDK plugins, especially when producing high-quality thumbnails since support for scaling is built-in and well optimized.

I wrote a small native adapter library under javafxgui/opt/javafxgui-iio that uses ImageIO.framework to load JPEG and PNG images when running on Mac OS X.  I decided to punt on GIF images for now since multi-frame GIF images are best handled by our existing Java-level ImageLoader code.  Also, ImageIO.framework does not have native support for loading images from URLs using the "jar:" protocol, so I'm punting on those as well.

Here is some initial data showing performance of this approach compared to the existing ImageLoader code using Java's Image I/O framework, for loading a 3888x2592 pixel JPEG image.  (Note that these numbers reflect performance on JavaFX 1.0, before we optimized image loading in RT-2362.)

JavaFX 1.0 (unoptimized, using Java's Image I/O framework)
  no scaling:  932 ms
  scaling [1]: 2352 ms

JavaFX 1.5 (unoptimized, using Apple's native ImageIO.framework)
  no scaling: 742 ms
  scaling [1]:  74 ms

[1] downscaling to width=100, preserveRatio=true...


Comments
No plan to address this.
15-04-2011

Not a presidio deliverable
09-09-2010

Changeset: d02a52dc8a2b Author: campbell Date: Wed Sep 30 11:45:52 2009 -0700 URL: http://jfxsrc.sfbay.sun.com/javafx/soma/scrum/graphics/runtime/rev/d02a52dc8a2b Description: Partial RT-2465: Moved native Mac OS X ImageIO.framework based image loader into javafx-iio[-native], and updated it to return ImageFrame instead of BufferedImage. This codepath is disabled by default, only enabled if -Djfxiio.macloader=true is specified on the command line. Removed javafx-iio-macosx[-native] projects as they are no longer needed.
30-09-2009

My current thinking is that since there is only a small amount of code in the javafx-iio-macosx[-native] projects, it would be better to integrate it into the new javafx-iio project as an alternate macosx-only codepath. So for now I've removed those projects from the build and will work on moving the sources later: Changeset: 18311488927e Author: campbell Date: Wed Sep 30 09:56:19 2009 -0700 URL: http://jfxsrc.sfbay.sun.com/javafx/soma/scrum/graphics/runtime/rev/18311488927e Description: Partial RT-2465: Removed javafx-iio-macosx from the build (sources will be moved to a different project later). Changeset: 8d3798bc1f13 Author: campbell Date: Wed Sep 30 09:54:13 2009 -0700 URL: http://jfxsrc.sfbay.sun.com/javafx/soma/scrum/graphics/jfx/rev/8d3798bc1f13 Description: Partial RT-2465: Removed javafx-iio-macosx from build inventory and classpaths
30-09-2009

Since this codepath didn't undergo a full review beyond the initial JavaOne prototype, I'm temporarily disabling it in AWTImageLoader. We can revisit this in the near future. details: http://jfxsrc.sfbay.sun.com/javafx/soma/scrum/graphics/runtime/rev/0bcc527534f7 changeset: 3627:0bcc527534f7 user: campbell date: Tue Sep 08 15:03:35 2009 -0700 description: Partial RT-2465: Disabled javafx-iio-macosx codepath in AWTImageLoader, pending further review.
08-09-2009

I've committed most of the changes required into the 1.next repo (see javafx-iio-macosx[-native] projects) and hooked it up to the current AWTImageLoader, enough to get some performance numbers. Running the attached ImagePerf testcase with "-Xms256m -Xmx512m" on both JDK 5 (32-bit) and JDK 6 (64-bit): JDK 5 before after no scaling, no profile: 682 719 no scaling, with profile: 1219 583 downscaling, no profile: 1947 61 downscaling, with profile: 2708 63 JDK 6u7 before after no scaling, no profile: 410 567 no scaling, with profile: 605 421 downscaling, no profile: 457 47 downscaling, with profile: 752 50
18-05-2009