CedarX

CedarX is Allwinner's multimedia decoding technology. It is composed of several parts, including:


 * 1) A hardware video decoding unit
 * 2) Proprietary libraries to communicate with the hardware unit
 * 3) Glue code to use those libraries on an actual system with video playback capabilities (e.g. Android)

Benefits

 * Efficient use of system resources when decoding multimedia.
 * Allows small ARM systems to playback high resolution/bitrate multimedia content, which wouldn't be possible using software-only decoding.

Disadvantages

 * The proprietary libraries have no clear usage license.
 * The android glue code is implemented as a "media player" (parallel to stagefright) instead of as OMX components.
 * This media player has limitations when it comes to playing back content pointed to by Android URIs and some web-based content.
 * There is no glue code for any other multimedia frameworks on GNU/Linux systems. The use of OMX would've rendered this a non-issue, with existing projects like GstOpenMAX.

Reverse Engineering
On June 15 2012 Iain Bullard started reverse engineering the proprietary libraries.


 * open_cdxalloc as an free reimplementation of Allwinner's libcederxalloc.a.
 * CedarXWrapper as a LD_PRELOADed wrapper to help understanding the proprietary libraries.
 * CedarXPlayerTest as a basic player to use when testing.

Object file observations
The linux libcedarv.a (md5sum b846fdd7135fc35743e7b497a8a5cdd5) static lib contains the following object files:

avs.o         h264.o           mp4_dec_divx311.o    mp4_talbe.o    rv_core.o      vc1decbitpltab.o  vc1gentab.o    vp8Dec.o awprintf.o     h264_register.o  mp4_decfrm_normal.o  mp4_vld_311.o  rv_hal.o       vc1dec_drv.o      vc1hrd.o       vp8Hal.o decfile.o      jpeg_dec_lib.o   mp4_dec_h263.o       mp4_vld.o      rv_huffTab.o   vc1decent.o       vc1.o          vp8.o decoder.o      jpeg_hal.o       mp4_dec_vp6.o        mpeg2Dec.o     rv.o           vc1dec.o          vc1register.o  vp8Quantizer.o fbm.o          libve_adapter.o  mp4_hal.o            mpeg2Hal.o     vbv.o          vc1decpic.o       vc1tools.o get_bits.o     libve.o          mp4_header.o         mpeg2.o        vc1debug.o     vc1decpictab.o    vdecoder.o h264dec_drv.o  mjpeg.o          mp4_register.o       mpeg4.o        vc1decbit.o    vc1decseq.o       vp8Coef.o h264_hal.o     mp4_deccommon.o  mp4_tables_311.o     os_adapter.o   vc1decbitpl.o  vc1decslice.o     vp8DecFrm.o

By looking at the object names and some dissassembly. It can be seen that the CedarX should be able to handle decoding of the following codec bitstreams:

RealVideo 8 and 9. (Fourcc RV30 and RV40). rv.o AVS (though it looks incomplete) avs.o MJPEG mjpeg.o VC1 (should be able to handle WMV3 bitstreams also) vc1.o VP8 vp8.o MPEG2 mpeg2.o MPEG4-AVS mpeg4.o DIVX 3.11 mpeg4.o H.263 mpeg4.o VP6 mpeg4.o WMV1 mpeg4.o (there are references to it, might not be correct) WMV2 mpeg4.o (there are references to it, might not be correct) MPEG4-AVC (h264) h264dec_drv.o

The following objects seem to implement the libve api interface:

awprintf.o (source might be available for this object) fbm.o (source might be available for this object) libve_adapter.o (source might be available for this object) libve.o (code is trivial to RE) os_adapter.o (source might be available for this object) vbv.o (source might be available for this object) vdecoder.o (source might be available for this object)

The file libcedarv_osal.a (md5sum 4b3502c947de4ae4d8c489c20e0c2ae8) contains only one object file:

cedarv_osal_linux.o (code is trivial to RE)

It seems to contain the abstract layer for for the Linux CedarX hardware kernel interface.

Possibly irrelevant observations

 * There seems to be a distinction on the android code between audio decoding ("CedarA") and video decoding ("CedarX")