You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Simon MacDonald (JIRA)" <ji...@apache.org> on 2012/06/20 17:11:42 UTC
[jira] [Created] (CB-940) Android image compression algorithm uses
too much memory.
Simon MacDonald created CB-940:
----------------------------------
Summary: Android image compression algorithm uses too much memory.
Key: CB-940
URL: https://issues.apache.org/jira/browse/CB-940
Project: Apache Cordova
Issue Type: Bug
Components: Android
Affects Versions: 1.8.1, 1.8.0, 1.7.0, 1.6.1, 1.6.0, 1.5.0, 1.4.0, 1.3.0, 1.2.0, 1.1.0, 1.0.0, 0.9.6, 0.9.5
Reporter: Simon MacDonald
Assignee: Simon MacDonald
We need to write our own version of jpg compression algorithm as the one that Android has implemented in Bitmap.compress requires the entire image to be loaded in memory which can cause out of memory errors.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-940) Android image compression algorithm
uses too much memory.
Posted by "Simon MacDonald (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13397755#comment-13397755 ]
Simon MacDonald commented on CB-940:
------------------------------------
@Joe, obviously I did not mean we should invent the algorithm from scratch. Rather it looks like we will need to implement an existing algorithm in Java. For more background on this problem I've already looked into the source of Bitmap.compress() and it makes a JNI call so we can't modify that algorithm. Most third party JPEG manipulation libraries written in Java run into one of the following three problems:
1) Their license is not good for us, LGPL or GPL.
2) They make use of java.awt which is not available on Android.
3) They make use of javax.imageIO which is not available on Android.
So that is what led me to write we'll need to implement our own version of the algorithm.
@Jukka, those are good resources, I will look into them in more detail.
@Shaz, mem-mapped files may come into play but it is too early to say right now.
> Android image compression algorithm uses too much memory.
> ---------------------------------------------------------
>
> Key: CB-940
> URL: https://issues.apache.org/jira/browse/CB-940
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 0.9.5, 0.9.6, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.7.0, 1.8.0, 1.8.1
> Reporter: Simon MacDonald
> Assignee: Simon MacDonald
>
> We need to write our own version of jpg compression algorithm as the one that Android has implemented in Bitmap.compress requires the entire image to be loaded in memory which can cause out of memory errors.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-940) Android image compression algorithm
uses too much memory.
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13397719#comment-13397719 ]
Jukka Zitting commented on CB-940:
----------------------------------
If I remember correctly, the now inactive Apache Harmony codebase has some JPEG processing code that might be useful. Also the Commons Imaging codebase (previously Sanselan) has quite a bit of JPEG code though AFAIUI no compression support. Also http://code.google.com/p/appengine-awt/ might contain some useful bits. Porting parts of the OpenJPEG codebase (http://www.openjpeg.org/) to Java might also be an option.
If none of these or other sources prove useful, instead of implementing JPEG compression in Cordova we would probably be better served by contributing such code to Commons Imaging and just reusing the code from there, as that'll likely be a better place for such code to prosper.
> Android image compression algorithm uses too much memory.
> ---------------------------------------------------------
>
> Key: CB-940
> URL: https://issues.apache.org/jira/browse/CB-940
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 0.9.5, 0.9.6, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.7.0, 1.8.0, 1.8.1
> Reporter: Simon MacDonald
> Assignee: Simon MacDonald
>
> We need to write our own version of jpg compression algorithm as the one that Android has implemented in Bitmap.compress requires the entire image to be loaded in memory which can cause out of memory errors.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-940) Android image compression algorithm
uses too much memory.
Posted by "Joe Bowser (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13397668#comment-13397668 ]
Joe Bowser commented on CB-940:
-------------------------------
While I agree with abandoning Bitmap.compress, I'm sure we can find a solution that already exists instead of going down the rabbit hole of making our own JPG compression algorithm. We should try that first.
> Android image compression algorithm uses too much memory.
> ---------------------------------------------------------
>
> Key: CB-940
> URL: https://issues.apache.org/jira/browse/CB-940
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 0.9.5, 0.9.6, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.7.0, 1.8.0, 1.8.1
> Reporter: Simon MacDonald
> Assignee: Simon MacDonald
>
> We need to write our own version of jpg compression algorithm as the one that Android has implemented in Bitmap.compress requires the entire image to be loaded in memory which can cause out of memory errors.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (CB-940) Android image compression algorithm uses
too much memory.
Posted by "Simon MacDonald (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-940?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simon MacDonald resolved CB-940.
--------------------------------
Resolution: Fixed
Fix Version/s: 1.9.0
I spent sometime refactoring the camera code so that it uses less memory. For now I'm going to close this issue and re-open it if the memory errors re-occur.
> Android image compression algorithm uses too much memory.
> ---------------------------------------------------------
>
> Key: CB-940
> URL: https://issues.apache.org/jira/browse/CB-940
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 0.9.5, 0.9.6, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.7.0, 1.8.0, 1.8.1
> Reporter: Simon MacDonald
> Assignee: Simon MacDonald
> Fix For: 1.9.0
>
>
> We need to write our own version of jpg compression algorithm as the one that Android has implemented in Bitmap.compress requires the entire image to be loaded in memory which can cause out of memory errors.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-940) Android image compression algorithm
uses too much memory.
Posted by "Shazron Abdullah (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13397740#comment-13397740 ]
Shazron Abdullah commented on CB-940:
-------------------------------------
@Joe What about memory-mapped files? http://www.linuxtopia.org/online_books/programming_books/thinking_in_java/TIJ314_029.htm
> Android image compression algorithm uses too much memory.
> ---------------------------------------------------------
>
> Key: CB-940
> URL: https://issues.apache.org/jira/browse/CB-940
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android
> Affects Versions: 0.9.5, 0.9.6, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.7.0, 1.8.0, 1.8.1
> Reporter: Simon MacDonald
> Assignee: Simon MacDonald
>
> We need to write our own version of jpg compression algorithm as the one that Android has implemented in Bitmap.compress requires the entire image to be loaded in memory which can cause out of memory errors.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira