How to use MJPEG hardware decoder in Android with IMX6Q

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use MJPEG hardware decoder in Android with IMX6Q

6,990 Views
jojorong
Contributor IV

Hi,

     RT,

     I am a newbie in Android,

     Someone know about how to use MJPEG hardware decoder in native code in android ?

     I hope i can use middle software to invoke indirectly the hardware decoder also like in linux platform.

     I know about that i can use gstreamer or libvpu directly in Linux platform.

     also, i saw the configure file in /etc/media_codecs.xml, there is not "MJPEG" information, the MJPEG is not supported in "android_jb4.2.2_1.1.0-ga_image_6qsabresd" ?

Labels (3)
0 Kudos
10 Replies

2,026 Views
LeonardoSandova
Specialist I

Hi

Use OpenMax IL, this is a thin layer wrapping all codecs in Android. I am not a Android expert but I would start grepping for openmax strings under Android source folder.

Leo

0 Kudos

2,025 Views
jojorong
Contributor IV

Hi,

     As you said i can use OpenMax IL, what's the component name of MJPEG HW decoder ?

i saw the source code of other chip like TI, it looks like bellow :

     char *tComponentName[MAXCOMP][2] = {

    /*video and image components */

    {"OMX.TI.JPEG.decoder", "image_decoder.jpeg" },

about IMX6Q-SDB, what's the component name of MJPEG HW decoder ?

and which library i can use as the "libopenmax_il.so" in this board ?

0 Kudos

2,026 Views
LeonardoSandova
Specialist I

Hi,

I do not much about the MM Framework on Android.ChucoChe, are there any test units using OpenMax IL layer? Where is it on the source tree?

Leo

0 Kudos

2,026 Views
ChucoChe
NXP Employee
NXP Employee

I don't know. Maybe DaianeAngolini Knows.

:smileyhappy:    

Michel

0 Kudos

2,026 Views
daiane_angolini
NXP Employee
NXP Employee

If you go to Gallery and play a movie it will be accelerated.

If you see Gallery source code, you can learn the media player class (I really do not remember, if it´s media_player, movie_player, movie_start... something like that)

If you´re looking for implementing your own media player, you must use this "media player class", that should be hardware accelerated already.

What do you want to do?

0 Kudos

2,026 Views
jojorong
Contributor IV

i want to use the HW MJPEG decoder to decode my image from internet in NDK space (c code)

0 Kudos

2,026 Views
jojorong
Contributor IV

I have no source code of android platform,


I use the OpenMax IL directly, some error is reported when i do (disable the port):


OMX_SendCommand (comp->handle, OMX_CommandPortDisable,

        port->index, NULL);

  if (err != OMX_ErrorNone) {

    GST_ERROR_OBJECT (comp->parent,

        "Failed to send enable/disable command to %s port %u: %s (0x%08x)",

        comp->name, port->index, gst_omx_error_to_string (err), err);

    goto done;

the error is "OMX_ErrorNotReady", what's something wrong about for this error about for VPU ?

0 Kudos

2,026 Views
DraganOstojic
Contributor V

Daiane, I have a related question. JPEG capture image ends up in the in Android imx6 CameraHAL (ics 4.0) JpegEncoderSoftware.cpp. JPEG encoder is called from DoEncode() method as follows:

return_val = jpeg_enc_init(obj_ptr);

...

return_val = jpeg_enc_encodeframe(obj_ptr, i_buff, y_buff, u_buff, v_buff);

From looking at Android.mk file in libcamera folder, it appears that the functions are in the following library: libfsl_jpeg_enc_arm11_elinux which is in the prebuilt folder device/fsl-proprietary/lib without the source code.

Is this api h/w accelerated?  Also, theses jpeg_... api's don't seem to be documented anywhere, can you point me for the documentation?

A note: I'd expect that the api that should be used is from vpu library with vpu_... prefix.

0 Kudos

2,026 Views
jojorong
Contributor IV

The gstreamer project can use "android media codec" aka "amc" to decode in native code.

BTW, Have you tested with "com.android.media.codec" in the IMX6Q for all HW codec ?

0 Kudos

2,026 Views
jojorong
Contributor IV

Ok, thanks, i also research some ways to invoke the android codec, likes gstreamer project (sdk), it works on android without HW codec :smileysad:,

i check this method first, it's common in cross-platform, is it ?

0 Kudos