Using Skia to enable hardware acceleration of image codecs

606 views
Skip to first unread message

Ben Ravin

unread,
Mar 19, 2014, 12:20:42 AM3/19/14
to skia-d...@googlegroups.com
Hi,
 
I have hardware accelerators for PNG & JPEG decoding. How can I use Skia to interface with hardware accelerators. Any example codes/doc  available ?  Since my resolutions of images  are very big how can I load the complete copmpressed image into the buffer ? Does Skia has any memory limitations on loading the compressed images into buffer ?
 
Please provide me the details.
 
-ben

Mike Klein

unread,
Mar 19, 2014, 7:23:53 AM3/19/14
to skia-d...@googlegroups.com
Are you saying you want to pass encoded, compressed images to Skia, have Skia call your hardware decoders, and then further use the resulting uncompressed images with Skia?  I don't believe we have any hooks exposed to allow you to replace our image decoders, but you may find an alternative just as good.

SkBitmap::setPixels() allows you to back a bitmap with externally managed pixels.  So you could call your hardware decoders yourself on some memory you control, pass a pointer to it into an SkBitmap, and run from there using the SkBitmap as you'd normally use in Skia.

If you're looking to have Skia work with compressed images that are partially decoded on the fly by hardware as needed to get pixels, I'm not aware of any support for that in Skia.


--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Ben Ravin

unread,
Mar 19, 2014, 11:14:02 PM3/19/14
to skia-d...@googlegroups.com

Ben Ravin

unread,
Mar 19, 2014, 11:17:29 PM3/19/14
to skia-d...@googlegroups.com
Hi Mike,
 
Yes you are right, my requirement is to replace the soft codecs such as libjpeg, libpng and use hardware codecs.  If Skia has the hooks then with minimal changes to framework this can be done. 
 
Any plans to add these hooks ?
 
-ben.
 

On Wednesday, 19 March 2014 09:50:42 UTC+5:30, Ben Ravin wrote:

Mike Klein

unread,
Mar 20, 2014, 6:18:20 AM3/20/14
to skia-d...@googlegroups.com
Actually, let me step back a second and correct myself: Skia does have at least two layers of hooks for replacing software codecs with hardware codecs.

First, because Skia uses libjpeg, libpng, libwebp, etc., you can drop in an API compatible replacement library with support for your hardware and Skia should make happy use of it without any modifications.  Think libjpeg-turbo replacing libjpeg.

If that's not possible, you probably want to write new SkImageEncoders and SkImageDecoders.  Skia's image codec system uses registration, which will allow you to inject your new codecs with higher priority than the default codecs just by linking them first (or the default ones not at all).


--

Ben Ravin

unread,
Mar 20, 2014, 11:10:15 PM3/20/14
to skia-d...@googlegroups.com
Hi Mike,
 
That's interesting. It would be great if you can share some user doc or app note on how to use the skia APIs.
 
-ben

Ralph Thomas

unread,
Mar 21, 2014, 12:51:39 AM3/21/14
to skia-d...@googlegroups.com
Hi Ben,

This implements a JPEG decoder for (5 years old) Skia using OpenMAX IL: https://gitorious.org/blazetablet/hardware-ti-omap3/commit/5e55eb2f149136433ae2568c2aed99ecbb3b6fe9 (I've previously found OMX super hard work, so if you have a less abstract interface to your hardware then you should probably use that instead...).

Ralph

Ben Ravin

unread,
Mar 24, 2014, 12:55:04 AM3/24/14
to skia-d...@googlegroups.com
Hi Ralph

On Wednesday, 19 March 2014 09:50:42 UTC+5:30, Ben Ravin wrote:

Ben Ravin

unread,
Mar 24, 2014, 12:58:16 AM3/24/14
to skia-d...@googlegroups.com
Hi Ralph,
 
Thanks for sharing the details. Is there any for PNG, replacing lib-png with hardware.
 
-ben


--
You received this message because you are subscribed to a topic in the Google Groups "skia-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/skia-discuss/BwUVk2zgy_4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to skia-discuss...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages