ChallyCai/doubango

Patch for optimized YUV->RGB ARM transcoding taken from Theorarm

GoogleCodeExporter opened this issue · 5 comments

Hello! I've spent some time and implemented the YUV2RGB conversion 
library(http://wss.co.uk/pinknoise/yuv2rgb) port from the Theorarm code, it 
gives some sensible performance boost on my devices, although I lack the good 
instruments to calculate the exact value of it. Anyway, it can be switched on 
and off using the USE_ASM_YUV2RGB debug switch. Attached is the patch for 469 
revision of doubango although I doubt much has changed since that moment so I 
think it would be applicable with small to no changes to the current trunk. 
Check it out.

Original issue reported on code.google.com by volkov.r...@gmail.com on 12 Oct 2010 at 12:33

Attachments:

Original comment by boss...@yahoo.fr on 13 Oct 2010 at 11:04

  • Changed state: Started
Thanks for your patch. Good job!
It helped me a lot to have an idea about how to integrate theorarm.
Does this work on iOS, Windows Mobile and Symbian?
Is it possible to have more information about the perfs?

My suggestion for the integration:
You can build "theorarm" as a shared library e.g. "libconvert.so". When 
IMSDroid starts, check if "libconvert.so" exist or not. If yes: "static boolean 
hasTheoraARM=true;"

In both IMSDroid and iDoubs you can set which chroma the video consumer 
supports. For IMSDroid, in "VideoConsumer.java" change MyProxyVideoConsumer 
constructor like this:
From:
{{{
private MyProxyVideoConsumer(VideoConsumer consumer){
    super(tmedia_chroma_t.tmedia_rgb565le);
    this.consumer = consumer;
}
}}}
To:
{{{
private MyProxyVideoConsumer(VideoConsumer consumer){
super(hasTheoraARM ? tmedia_chroma_t.tmedia_yuv420p : 
tmedia_chroma_t.tmedia_rgb565le);
    this.consumer = consumer;
}
}}}
This will tell "doubango" that the consumer support YUV420 (if "libconvert.so" 
is present) and that we don't need a converter ==> Will disable YUV2RGB 
functions. This means that VideoConsumer::consume(ProxyVideoFrame _frame) will 
receive YUV420 frames. In this function ("consume") you can call yuv2rgb() to 
convert the buffer.

Any feedback is welcome.

Original comment by boss...@yahoo.fr on 19 Oct 2010 at 6:01

  • Changed state: Accepted
Any news?

Original comment by boss...@yahoo.fr on 9 Nov 2010 at 6:45

Sorry for a lack of answer on my side - I've currently got a load of other work 
so I was unable to implement your way of optimization, but this does not mean I 
haven't spent time on reading your post, be sure of that 8) Was going to 
implement then answer - but as you see was not able to do it in a decent 
timeframe. As I see, your offered way is safer doubango-wise since you shift 
the optimization to the client code although it's going to be a little bit 
slower due to the intercode function calls between Dalvik and compiled asm 
code. So yes it could be done and as soon as I have spare time I might 
implement it. Please keep this issue open for a while in case someone else 
wants to do something useful before I have time 8)

Original comment by volkov.r...@gmail.com on 12 Nov 2010 at 3:17

Can i make it to a single *.so or *.a ?

Original comment by liutao6...@gmail.com on 25 Oct 2011 at 3:09