Commit 0175a1e6 authored by Rafaël Carré's avatar Rafaël Carré Committed by Jean-Paul Saman

Revert "Update audio decoder and video decoder and encoder to xDM1.00 and xDM1.20"

This reverts commit cd86c147027f5432f96fa8eb0de0b62180fa1b50.

Stick to xDM 0.9
Signed-off-by: Jean-Paul Saman's avatarJean-Paul Saman <jean-paul.saman@m2x.nl>
parent b9f04dc7
This diff is collapsed.
......@@ -113,35 +113,47 @@ vlc_module_end();
#include <ti/sdo/ce/osal/Memory.h>
int __AllocateBuffer( vlc_object_t *p_this, XDAS_Int32 i_num,
XDAS_Int32 *pi_sizes, XDM1_BufDesc *buf )
XDAS_Int32 *pi_sizes, XDM_BufDesc *buf )
{
int i;
#ifdef DEBUG_DAVINCI
msg_Info( p_this, "Allocating buffers:" );
#endif
buf->numBufs = i_num;
if( i_num > XDM_MAX_IO_BUFFERS )
i_num = XDM_MAX_IO_BUFFERS;
buf->bufs = (XDAS_Int8 **)malloc( buf->numBufs * sizeof( XDAS_Int8 * ) );
if( !buf->bufs )
{
buf->numBufs = 0;
return VLC_ENOMEM;
}
buf->numBufs = i_num;
buf->bufSizes = (XDAS_Int32 *)malloc( buf->numBufs * sizeof( XDAS_Int32 ) );
if( !buf->bufSizes )
{
free( buf->bufs );
buf->numBufs = 0;
return VLC_ENOMEM;
}
int i;
for( i = 0; i < i_num; i++ )
{
#ifdef DEBUG_DAVINCI
msg_Info( p_this, " %d: size %d Bytes", i, (int)pi_sizes[i] );
#endif
buf->descs[i].bufSize = pi_sizes[i];
buf->descs[i].buf = Memory_contigAlloc( pi_sizes[i], Memory_DEFAULTALIGNMENT );
if( !buf->descs[i].buf )
buf->bufSizes[i] = pi_sizes[i];
buf->bufs[i] = Memory_contigAlloc( pi_sizes[i], Memory_DEFAULTALIGNMENT );
if( !buf->bufs[i] )
{
#ifdef DEBUG_DAVINCI
msg_Err( p_this, "Failed to allocate buffer" );
#endif
while( i > 0 )
for( i--; i >= 0; i-- )
{
i--;
Memory_contigFree( buf->descs[i].buf, buf->descs[i].bufSize );
free( buf->descs[i].buf );
Memory_contigFree( buf->bufs[i], buf->bufSizes[i] );
free( buf->bufs );
free( buf->bufSizes );
buf->numBufs = 0;
return VLC_ENOMEM;
}
......@@ -150,18 +162,17 @@ int __AllocateBuffer( vlc_object_t *p_this, XDAS_Int32 i_num,
return VLC_SUCCESS;
}
void FreeBuffer( XDM1_BufDesc *buf )
void FreeBuffer( XDM_BufDesc *buf )
{
if( buf->numBufs == 0 ) return;
int i;
for( i = 0; i < buf->numBufs; i++ )
if( buf->numBufs != 0 )
{
Memory_contigFree( buf->descs[i].buf, buf->descs[i].bufSize );
free( buf->descs[i].buf );
int i;
for( i = 0; i < buf->numBufs; i++ )
Memory_contigFree( buf->bufs[i], buf->bufSizes[i] );
free( buf->bufs );
free( buf->bufSizes );
buf->numBufs = 0;
}
buf->numBufs = 0;
}
/*****************************************************************************
......
......@@ -30,11 +30,14 @@
#include <gnu/targets/std.h>
#include <xdc/std.h>
#include <ti/xdais/xdas.h>
#ifdef VLC_IS_AUDDEC
#include <ti/sdo/ce/audio/auddec.h> /* Needs to be included before XDM for some reason */
#endif
#include <ti/xdais/dm/xdm.h>
#include <ti/sdo/ce/CERuntime.h>
#include <ti/sdo/ce/Engine.h>
#define DEBUG_DAVINCI
/* #define DEBUG_DAVINCI */
int OpenVideoDecoder( vlc_object_t * );
void CloseVideoDecoder( vlc_object_t * );
......@@ -45,9 +48,9 @@ void CloseAudioDecoder( vlc_object_t * );
int OpenVideoEncoder( vlc_object_t * );
void CloseVideoEncoder( vlc_object_t * );
int __AllocateBuffer( vlc_object_t *, XDAS_Int32, XDAS_Int32 *, XDM1_BufDesc * );
int __AllocateBuffer( vlc_object_t *, XDAS_Int32, XDAS_Int32 *, XDM_BufDesc * );
#define AllocateBuffer( a, b, c, d ) __AllocateBuffer( VLC_OBJECT( a ), b, c, d )
void FreeBuffer( XDM1_BufDesc * );
void FreeBuffer( XDM_BufDesc * );
void __PrintExtendedError( vlc_object_t *, XDAS_Int32 );
#define PrintExtendedError( a, b ) __PrintExtendedError( VLC_OBJECT( a ), b )
void __PrintAvailableAlgorithms( vlc_object_t *, const char * );
......@@ -138,7 +141,7 @@ extern const char *ppsz_engine_error[];
case VLC_FOURCC('m','p','4','3'): \
case VLC_FOURCC('D','I','V','3'): \
case VLC_FOURCC('D','I','V','4'): \
/*case VLC_FOURCC('d','i','v','4'): */ \
case VLC_FOURCC('d','i','v','4'): \
case VLC_FOURCC('D','I','V','5'): \
case VLC_FOURCC('d','i','v','5'): \
case VLC_FOURCC('D','I','V','6'): \
......
......@@ -25,8 +25,8 @@
* Preamble
*****************************************************************************/
#include "davinci.h"
#include <assert.h>
#include <ti/sdo/ce/video2/viddec2.h>
#include <ti/sdo/ce/video/viddec.h>
/*****************************************************************************
* Local prototypes
......@@ -40,10 +40,10 @@ static picture_t *DecodeVideoBlockInner( decoder_t *, block_t **, int );
struct decoder_sys_t
{
Engine_Handle e;
VIDDEC2_Handle d;
VIDDEC_Handle d;
XDM1_BufDesc in;
XDM1_BufDesc out;
XDM_BufDesc in;
XDM_BufDesc out;
};
/*****************************************************************************
......@@ -58,7 +58,7 @@ int OpenVideoDecoder( vlc_object_t *p_this )
char *psz_engine = NULL;
char *psz_chroma = NULL;
vlc_fourcc_t i_chroma = VLC_FOURCC('U','Y','V','Y');
VIDDEC2_Params params;
VIDDEC_Params params;
psz_codec = config_GetPsz( p_this, "davinci-viddec-codec" );
if( psz_codec && !*psz_codec )
......@@ -146,13 +146,11 @@ int OpenVideoDecoder( vlc_object_t *p_this )
free( psz_chroma );
/* Create video decoder */
params.size = sizeof( VIDDEC2_Params );
params.size = sizeof( VIDDEC_Params );
params.maxHeight = p_dec->fmt_in.video.i_height?:576;
params.maxWidth = p_dec->fmt_in.video.i_width?:720;
params.maxFrameRate = 0; /* in frames per 1000 seconds */
params.maxBitRate = 0; /* in bits per second */
params.maxFrameRate = 25000;
params.maxBitRate = 1000;
params.dataEndianness = XDM_BYTE;//LE_32;
params.forceChromaFormat = VlcChromaToXdm( i_chroma );
if( params.forceChromaFormat == XDM_CHROMA_NA )
......@@ -162,28 +160,26 @@ int OpenVideoDecoder( vlc_object_t *p_this )
goto error;
}
p_sys->d = VIDDEC2_create( p_sys->e, (String)psz_codec, &params );
p_sys->d = VIDDEC_create( p_sys->e, (String)psz_codec, &params );
if( !p_sys->d )
{
msg_Err( p_dec, "Failed to create video decoder (%s)", psz_codec );
assert( p_sys->d );
goto error;
}
/* Set output properties */
p_dec->fmt_out.i_cat = VIDEO_ES;
p_dec->fmt_out.i_codec =
p_dec->fmt_out.video.i_chroma = i_chroma;
p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
p_dec->fmt_out.video.i_height = p_dec->fmt_in.video.i_height;
p_dec->fmt_out.video.i_aspect = p_dec->fmt_in.video.i_aspect;
#ifdef DEBUG_DAVINCI
msg_Info( p_dec, "fmt_in.video.i_width: %d", p_dec->fmt_in.video.i_width );
msg_Info( p_dec, "fmt_in.video.i_height: %d", p_dec->fmt_in.video.i_height );
msg_Info( p_dec, "fmt_out.video.i_width: %d", p_dec->fmt_out.video.i_width );
msg_Info( p_dec, "fmt_out.video.i_height: %d", p_dec->fmt_out.video.i_height );
#endif
p_dec->fmt_out.i_cat = VIDEO_ES;
p_dec->fmt_out.i_codec =
p_dec->fmt_out.video.i_chroma = i_chroma;
p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
p_dec->fmt_out.video.i_height = p_dec->fmt_in.video.i_height;
p_dec->fmt_out.video.i_aspect = p_dec->fmt_in.video.i_aspect;
/* Set callbacks */
p_dec->pf_decode_video = DecodeVideoBlock;
......@@ -213,7 +209,7 @@ void CloseVideoDecoder( vlc_object_t *p_this )
decoder_sys_t *p_sys = p_dec->p_sys;
/* Close our codec handle */
VIDDEC2_delete( p_sys->d );
VIDDEC_delete( p_sys->d );
/* Close our engine handle */
Engine_close( p_sys->e );
......@@ -241,10 +237,10 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
decoder_sys_t *p_sys = p_dec->p_sys;
block_t *p_block;
picture_t *p_pic = NULL;
VIDDEC2_InArgs in_args;
VIDDEC2_OutArgs out_args;
VIDDEC2_DynamicParams dparams;
VIDDEC2_Status status;
VIDDEC_InArgs in_args;
VIDDEC_OutArgs out_args;
VIDDEC_DynamicParams dparams;
VIDDEC_Status status;
int i;
if( !pp_block || !*pp_block ) return NULL;
......@@ -264,14 +260,14 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
memset( &out_args, 0, sizeof( out_args ) );
/* Configure video decoder */
dparams.size = sizeof( VIDDEC2_DynamicParams );
memset( &status, 0, sizeof( VIDDEC2_Status ) );
status.size = sizeof( VIDDEC2_Status );
dparams.size = sizeof( VIDDEC_DynamicParams );
memset( &status, 0, sizeof( VIDDEC_Status ) );
status.size = sizeof( VIDDEC_Status );
if( p_sys->in.numBufs == 0 || p_sys->out.numBufs == 0 )
{
if( VIDDEC2_control( p_sys->d, XDM_GETBUFINFO, &dparams, &status )
!= VIDDEC2_EOK )
if( VIDDEC_control( p_sys->d, XDM_GETBUFINFO, &dparams, &status )
!= VIDDEC_EOK )
{
msg_Err( p_dec, "Failed to get buffer info" );
goto error;
......@@ -297,8 +293,8 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
}
}
if( VIDDEC2_control( p_sys->d, XDM_GETSTATUS, &dparams, &status )
!= VIDDEC2_EOK )
if( VIDDEC_control( p_sys->d, XDM_GETSTATUS, &dparams, &status )
!= VIDDEC_EOK )
{
msg_Err( p_dec, "Failed to get decoder status" );
goto error;
......@@ -307,19 +303,19 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
/* Setup input arguments */
in_args.size = sizeof( in_args );
in_args.numBytes = __MIN( i_extra + p_block->i_buffer,
p_sys->in.descs[0].bufSize );
p_sys->in.bufSizes[0] );
in_args.inputID = 0; /* FIXME? */
/* Setup input buffer */
#ifdef DEBUG_DAVINCI
if( p_block->i_buffer > p_sys->in.descs[0].bufSize )
if( p_block->i_buffer > p_sys->in.bufSizes[0] )
msg_Dbg( p_dec, "Woah! Not enough room to store the whole block" );
#endif
if( i_extra > 0 )
{
memcpy( p_sys->in.descs[0].buf, p_dec->fmt_in.p_extra, i_extra );
memcpy( p_sys->in.bufs[0], p_dec->fmt_in.p_extra, i_extra );
}
memcpy( p_sys->in.descs[0].buf + i_extra, p_block->p_buffer,
memcpy( p_sys->in.bufs[0] + i_extra, p_block->p_buffer,
in_args.numBytes - i_extra );
#ifdef DEBUG_DAVINCI
msg_Dbg( p_dec, "Sending %d + %d bytes", i_extra,
......@@ -344,14 +340,12 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
#ifdef DEBUG_DAVINCI
printf("%s %s %d\n", __FILE__, __func__, __LINE__);
#endif
if( ( i = VIDDEC2_process( p_sys->d, &p_sys->in, &p_sys->out, &in_args, &out_args ) )
!= VIDDEC2_EOK )
if( ( i = VIDDEC_process( p_sys->d, &p_sys->in, &p_sys->out, &in_args, &out_args ) )
!= VIDDEC_EOK )
{
msg_Err( p_dec, "Video decoding failed (Error code: %d)", i );
#if 0 //not present in v 1.20 API
msg_Err( p_dec, "Video decoding failed (Error code: %d, "
"Extended error: %x)", i, (int)out_args.extendedError );
PrintExtendedError( p_dec, out_args.extendedError );
#endif
if( i_extra == 0 && p_dec->fmt_in.i_extra > 0 )
{
msg_Err( p_dec, "Trying again with p_extra" );
......@@ -363,7 +357,7 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
printf("%s %s %d\n", __FILE__, __func__, __LINE__);
#endif
if( VIDDEC2_control( p_sys->d, XDM_GETSTATUS, &dparams, &status ) != VIDDEC2_EOK )
if( VIDDEC_control( p_sys->d, XDM_GETSTATUS, &dparams, &status ) != VIDDEC_EOK )
{
msg_Err( p_dec, "Failed to get decoder status" );
goto error;
......@@ -397,7 +391,6 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
/* Copy stuff to picture here */
#ifdef DEBUG_DAVINCI
#if 0 //not in v1.20 api
switch( out_args.decodedFrameType )
{
case IVIDEO_NA_FRAME:
......@@ -425,7 +418,6 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
msg_Dbg( p_dec, "Other frame type: %d", (int)out_args.decodedFrameType );
break;
}
#endif
#endif
if( p_pic->i_planes != p_sys->out.numBufs )
......@@ -437,7 +429,7 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
for( i = 0; i < p_pic->i_planes; i++ )
{
plane_t *p = p_pic->p+i;
memcpy( p->p_pixels, p_sys->out.descs[i].buf, p->i_pitch * p->i_visible_lines );
memcpy( p->p_pixels, p_sys->out.bufs[i], p->i_pitch * p->i_visible_lines );
}
p_pic->date = p_block->i_pts > 0 ? p_block->i_pts : p_block->i_dts;
......
......@@ -27,7 +27,7 @@
#include "davinci.h"
#include <ti/sdo/ce/video1/videnc1.h>
#include <ti/sdo/ce/video/videnc.h>
/*****************************************************************************
* Local prototypes
......@@ -40,10 +40,10 @@ static block_t *EncodeVideo( encoder_t *, picture_t * );
struct encoder_sys_t
{
Engine_Handle e;
VIDENC1_Handle c;
VIDENC_Handle c;
XDM1_BufDesc in;
XDM1_BufDesc out;
XDM_BufDesc in;
XDM_BufDesc out;
};
/*****************************************************************************
......@@ -56,7 +56,7 @@ int OpenVideoEncoder( vlc_object_t *p_this )
char *psz_codec = NULL;
char *psz_engine = NULL;
Engine_Error err;
VIDENC1_Params params;
VIDENC_Params params;
psz_codec = config_GetPsz( p_this, "davinci-videnc-codec" );
if( psz_codec && !*psz_codec )
......@@ -158,7 +158,7 @@ int OpenVideoEncoder( vlc_object_t *p_this )
params.inputContentType = IVIDEO_PROGRESSIVE; /* FIXME: we don't know if it's progressive or interlaced until we get the first picture (p_pic->b_progressive) */
/* Create encoder handle */
p_sys->c = VIDENC1_create( p_sys->e, (String)psz_codec, &params );
p_sys->c = VIDENC_create( p_sys->e, (String)psz_codec, &params );
if( !p_sys->c )
{
msg_Err( p_enc, "Failed to create video encoder (%s)", psz_codec );
......@@ -192,7 +192,7 @@ void CloseVideoEncoder( vlc_object_t *p_this )
encoder_sys_t *p_sys = p_enc->p_sys;
/* Delete video encoder */
VIDENC1_delete( p_sys->c );
VIDENC_delete( p_sys->c );
/* Delete codec engine handle */
Engine_close( p_sys->e );
......@@ -215,13 +215,13 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
encoder_sys_t *p_sys = p_enc->p_sys;
block_t *p_block;
int i;
VIDENC1_InArgs in_args;
VIDENC1_OutArgs out_args;
VIDENC_InArgs in_args;
VIDENC_OutArgs out_args;
if( p_sys->in.numBufs == 0 || p_sys->out.numBufs == 0 )
{
VIDENC1_DynamicParams dparams;
VIDENC1_Status status;
VIDENC_DynamicParams dparams;
VIDENC_Status status;
dparams.size = sizeof( dparams );
memset( &status, 0, sizeof( status ) );
......@@ -239,17 +239,17 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
dparams.intraFrameInterval = p_enc->i_iframes;
dparams.generateHeader = XDM_ENCODE_AU; /* FIXME? */
dparams.captureWidth = p_pic->p->i_pitch / p_pic->p->i_pixel_pitch; /* FIXME? */
/* dparams.forceIFrame = 0; not in v1.20 API */
if( VIDENC1_control( p_sys->c, XDM_SETPARAMS, &dparams, &status )
!= VIDENC1_EOK )
dparams.forceIFrame = 0;
if( VIDENC_control( p_sys->c, XDM_SETPARAMS, &dparams, &status )
!= VIDENC_EOK )
{
msg_Err( p_enc, "Failed to set encoder parameters" );
goto error;
}
/* Configure buffers */
if( VIDENC1_control( p_sys->c, XDM_GETBUFINFO, &dparams, &status )
!= VIDENC1_EOK )
if( VIDENC_control( p_sys->c, XDM_GETBUFINFO, &dparams, &status )
!= VIDENC_EOK )
{
msg_Err( p_enc, "Failed to get buffer info" );
goto error;
......@@ -284,7 +284,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
for( i = 0; i < p_pic->i_planes; i++ )
{
plane_t *p = p_pic->p+i;
memcpy( p_sys->in.descs[i].buf, p->p_pixels, p->i_pitch * p->i_visible_lines );
memcpy( p_sys->in.bufs[i], p->p_pixels, p->i_pitch * p->i_visible_lines );
}
/* Configure input */
......@@ -296,9 +296,9 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
out_args.size = sizeof( out_args );
/* Encode the video */
i = VIDENC1_process( p_sys->c, &p_sys->in, &p_sys->out,
i = VIDENC_process( p_sys->c, &p_sys->in, &p_sys->out,
&in_args, &out_args );
if( i != VIDENC1_EOK )
if( i != VIDENC_EOK )
{
msg_Err( p_enc, "Video encoding failed (Error code: %d, "
"Extended erorr: %x)", i, (int)out_args.extendedError );
......@@ -317,7 +317,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pic )
p_block = block_New( p_enc, out_args.bytesGenerated );
if( !p_block ) goto error;
memcpy( p_block->p_buffer, p_sys->out.descs[0].buf, out_args.bytesGenerated );
memcpy( p_block->p_buffer, p_sys->out.bufs[0], out_args.bytesGenerated );
switch( out_args.encodedFrameType )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment