
			LIBDIVXDECORE FOR LINUX
			-----------------------

The "decore" project is now available for linux in the form of a standard library.

The libdivxdecore library will allow any linux developer to take advantage of the OpenDivX decoding engine through an easy-to-use API and quickly enable any application with OpenDivX decoding.

The library is provided as a tar.gz source package, and has no dependencies except that you'll need autoconf, automake and libtool installed in order to compile it.


HOW TO INSTALL:
---------------

Run succesively:

./configure [with the options you want, see ./configure --help]
make
make install (as root if needed)


FILES THAT WILL BE INSTALLED:
-----------------------------

After the installation you will have on your system:

* In $prefix/lib

libdivxdecore.so
libdivxdecore.a
libdivxdecore.la

* In $prefix/include/divx

decore.h

Where prefix is /usr/local by default


HOW TO USE THE DECORE LIBRARY:
------------------------------

The decore.h header has only one function:

int decore(unsigned long handle,
	   unsigned long dec_opt,
           void *param1, 
	   void *param2);
												
This single function will be the entry point for all your calls. 
In addition to that decore.h defines 3 structures:

typedef struct _DEC_PARAM_
{
        int x_dim; // x dimension of the frames to be decoded
        int y_dim; // y dimension of the frames to be decoded
        unsigned long color_depth;
} DEC_PARAM;

typedef struct _DEC_FRAME_
{
        void *bmp;       // the 24-bit decoded bitmap 
        void *bitstream; // the decoder buffer
        long length;     // the lenght of the decoder stream
        int render_flag;
} DEC_FRAME;

typedef struct _DEC_SET_
{
        int postproc_level; // valid interval are [0..100]
} DEC_SET;


The library will output the video data in YUV12 format (411 planar).
Using all that, a typical decore session will look like:

#define MY_APP_ID 0x12345

      DEC_PARAM dec_param;
      DEC_SET   dec_set;
      DEC_FRAME dec_frame;

      /*
       * Init the decore
       */ 

      dec_param.x_dim = width_of_the_video; 
      dec_param.y_dim = height_of_the_video;

      decore(MY_APP_ID, DEC_OPT_INIT, &dec_param, NULL);

      /*
       * Set the postprocessing level
       */

      dec_set.postproc_level = use_or_not_postprocessing;
      decore(MY_APP_ID, DEC_OPT_SETPP, &dec_set, NULL);

      /*
       * decode one frame
       */

       dec_frame.length      = size_of_in_buffer;
       dec_frame.bitstream   = in_buffer;
       dec_frame.bmp         = (void *) out_buffer;
       dec_frame.render_flag = 1;

       decore(MY_APP_ID, 0, &dec_frame, NULL);
  

Where out_buffer is:

char *out_buffer[3], an array of tree pointers to the Y, U and V planes.

And don't forget to put 

#include <divx/decore.h>

somewhere, and to link with -ldivxdecore

That's all!
Enjoy,

roy204 for ProjectMayo.


