adding H.264 Hardware Codec on Android

3,193 views
Skip to first unread message

Piyush Verma

unread,
Feb 9, 2011, 9:46:35 PM2/9/11
to Doubango
Hello,


I was trying to implement h.264 hardware codec in Doubango for android.

Before I realise Doubango is using ffmpeg so I think ffmpeg is sued for encode decode h.264.

But in "thirdparties/android/lib" I can't fine libavcodec.a file.

Any idea which lib is used to encode and decode and what would be easiest way to forward h.264 codec software call to hardware call.


--
Thanks & Regards

Piyush Verma


Mamadou

unread,
Feb 10, 2011, 6:50:13 AM2/10/11
to Doubango
The ffmpeg binaries for android are under:
"thirdparties/android/lib/armv5te" for ARMv5TE devices and
"thirdparties/android/lib/armv7-a" for ARMv7=a devices.
If you are trying to rebuilt the IMSDroid yourself and don't know
which version to used then, I suggest using the first one which works
on all devices.
FFmpeg is only used for decoding. For encoding, we use x264.
"I think ffmpeg is sued for encode decode h.264" => Do you have any
link?
All codecs are used as plugins and you can off course unregister the
default one and replace it by yours. You can check the source code to
understand how video codec plugins are implemented.

Piyush Verma

unread,
Feb 10, 2011, 10:35:31 PM2/10/11
to doub...@googlegroups.com
Dear Mamadou,

Thanks a lot for information.


Please correct me if I am wrong

I notice /tinyDAV/src/codecs/h264/tdav_codec_h264.c have basic call for Open, Close, Encode, Decode.

I think that the right place to replace call of ffmpeg to hardware codec.


Thanks & Regards

Piyush VErma

Mamadou DIOP

unread,
May 4, 2011, 6:44:18 AM5/4/11
to doub...@googlegroups.com
Hi,
For sure the close() function is always called. This function is not immediately (all sip transactions must end) called because the codec depends on the media session which depends on the sip session. When the sip session is destroyed it call the dtor() of the media session which will call tmedia_session_deinit() which will delete the codecs. The dtor() of the codec will call close() if the codec is opened.
Regards,

Piyush Verma

unread,
May 4, 2011, 10:35:05 PM5/4/11
to doub...@googlegroups.com
Dear Mamadou,


Thanks A lot for clarification.

I have tested it many times with your point.

But the result is it's never calling close function of codec. Even when app is exit.

To release we need to kill the process of doubango from console. only after that codec resource is released.

How ever I got some call sequence idea from your last mail.

I will try my side to debug the error.

If any other small idea which could help is to debug please let us know.



Thanks & Regards

Piyush Verma



Piyush Verma

unread,
May 4, 2011, 10:51:48 PM5/4/11
to doub...@googlegroups.com
Dear Friends,


One another problem I am facing that the received frame is not being decoded.

I have noticed some packet loss over that and after comparing received and transmuted data it's a bit different.

Initially it successfully decode 10 to 25 frame after that all frames are failed to decode.

To ensure problem is not in encoding and decoding. we have dumped frame encoding side before transmitting in file.

And if we try to decode dumped data all data are decoded successfully.

I am transmitting frame using "tdav_codec_h264_encap(h264, output_info.StrmVirAddr, (tsk_size_t)output_info.dataSize);" call.

static void tdav_codec_h264_encap(const tdav_codec_h264_t* h264, const uint8_t* pdata, tsk_size_t size)
{
      fwrite(pdata, 1, size, pvDebugFile);



I am dumping frame inside encap function which ensure that exact data is dump what is transmitted.


Is there something I need to modify in RTP ?



Thanks & Regards

Piyush Verma


phv

unread,
May 5, 2011, 1:58:54 AM5/5/11
to Doubango
Hi Piyush ,

i am very interresting by your work on H264 on hardware, and perhaps
i can help you .
For iot with all H.264 decoder have make a patch on ffmpeg / doubango
(see http://code.google.com/p/imsdroid/issues/detail?id=225) .
But i discovered on android ... , also have a question ?
You work on specific hardware or the h264 hardware codec are include
on the recent terminals ?

Thanks you ,

Best regards
Philippe

Piyush Verma

unread,
May 5, 2011, 4:21:47 AM5/5/11
to doub...@googlegroups.com
Hi Philip,

Thanks a lot for you interest in hardware codec.

We are working for  S5PV210  soc to Integrate hardware codec.

As you dicovered android don't have standard interface for encoding of h264 so diff people diploye  different way.

So how we can cooperate together  ?



Thanks & Regards

Piyush Verma




phv

unread,
May 5, 2011, 5:32:33 AM5/5/11
to Doubango
Very well !!
I d'ont know, and Samsung tablet have this chipset (SLIDEPAD-116C) !
But i dont have this ;-) ..
I think i have understand how the tinyDAV stack is running .
So if you have the API documentation of hardware coder / decoder
(MPEG4/H.263/H.264) on S5PV210 (with sample ? ) , i can propose a
sample of tdav_codec_h264.c ?

Else if you have another propostion .

Bye ,
Philippe

Reply all
Reply to author
Forward
0 new messages