Commit 93509622 authored by Jean-Paul Saman's avatar Jean-Paul Saman

davinci encoder: cleanup

parent 9994ce52
...@@ -122,7 +122,7 @@ int OpenAudioDecoder( vlc_object_t *p_this ) ...@@ -122,7 +122,7 @@ int OpenAudioDecoder( vlc_object_t *p_this )
goto error; goto error;
} }
PrintAvailableAlgorithms( p_this, p_sys->psz_ti_engine ); davinci_PrintAvailableAlgorithms( p_this, p_sys->psz_ti_engine );
/* Create audio decoder */ /* Create audio decoder */
params.size = sizeof( params ); params.size = sizeof( params );
...@@ -181,8 +181,8 @@ void CloseAudioDecoder( vlc_object_t *p_this ) ...@@ -181,8 +181,8 @@ void CloseAudioDecoder( vlc_object_t *p_this )
CERuntime_exit(); CERuntime_exit();
/* Free 'DaVinci compliant' buffers */ /* Free 'DaVinci compliant' buffers */
FreeBuffer( &p_sys->in ); davinci_FreeBuffer( &p_sys->in );
FreeBuffer( &p_sys->out ); davinci_FreeBuffer( &p_sys->out );
free( p_sys->psz_ti_engine ); free( p_sys->psz_ti_engine );
free( p_sys ); free( p_sys );
...@@ -215,16 +215,16 @@ static int InitXDMAudioDecoder( decoder_t *p_dec, AUDDEC_DynamicParams *dparams ...@@ -215,16 +215,16 @@ static int InitXDMAudioDecoder( decoder_t *p_dec, AUDDEC_DynamicParams *dparams
} }
/* Allocate input buffer */ /* Allocate input buffer */
if( AllocateBuffer( p_dec, status.bufInfo.minNumInBufs, if( davinci_AllocateBuffer( status.bufInfo.minNumInBufs,
status.bufInfo.minInBufSize, &p_sys->in ) != VLC_SUCCESS ) status.bufInfo.minInBufSize, &p_sys->in ) != VLC_SUCCESS )
{ {
msg_Err( p_dec, "Failed to allocate input buffer" ); msg_Err( p_dec, "Failed to allocate input buffer" );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
/* Allocate output buffer */ /* Allocate output buffer */
if( AllocateBuffer( p_dec, status.bufInfo.minNumOutBufs, if( davinci_AllocateBuffer( status.bufInfo.minNumOutBufs,
status.bufInfo.minOutBufSize, &p_sys->out ) != VLC_SUCCESS ) status.bufInfo.minOutBufSize, &p_sys->out ) != VLC_SUCCESS )
{ {
msg_Err( p_dec, "Failed to allocate output buffer" ); msg_Err( p_dec, "Failed to allocate output buffer" );
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* $Id$ * $Id$
* *
* Authors: Antoine Cellerier <dionoea at videolan dot org> * Authors: Antoine Cellerier <dionoea at videolan dot org>
* Jean-Paul Saman <jean-paul.saman at m2x dot nl>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -143,8 +144,8 @@ vlc_module_end() ...@@ -143,8 +144,8 @@ vlc_module_end()
*****************************************************************************/ *****************************************************************************/
#include <ti/sdo/ce/osal/Memory.h> #include <ti/sdo/ce/osal/Memory.h>
int __AllocateBuffer( vlc_object_t *p_this, XDAS_Int32 i_num, int davinci_AllocateBuffer( XDAS_Int32 i_num, XDAS_Int32 *pi_sizes,
XDAS_Int32 *pi_sizes, XDM_BufDesc *buf ) XDM_BufDesc *buf )
{ {
int i; int i;
...@@ -171,7 +172,6 @@ int __AllocateBuffer( vlc_object_t *p_this, XDAS_Int32 i_num, ...@@ -171,7 +172,6 @@ int __AllocateBuffer( vlc_object_t *p_this, XDAS_Int32 i_num,
buf->bufs[i] = Memory_contigAlloc( pi_sizes[i], Memory_DEFAULTALIGNMENT ); buf->bufs[i] = Memory_contigAlloc( pi_sizes[i], Memory_DEFAULTALIGNMENT );
if( !buf->bufs[i] ) if( !buf->bufs[i] )
{ {
msg_Err( p_this, "Failed to allocate buffer" );
for( i--; i >= 0; i-- ) for( i--; i >= 0; i-- )
Memory_contigFree( buf->bufs[i], buf->bufSizes[i] ); Memory_contigFree( buf->bufs[i], buf->bufSizes[i] );
...@@ -184,7 +184,7 @@ int __AllocateBuffer( vlc_object_t *p_this, XDAS_Int32 i_num, ...@@ -184,7 +184,7 @@ int __AllocateBuffer( vlc_object_t *p_this, XDAS_Int32 i_num,
return VLC_SUCCESS; return VLC_SUCCESS;
} }
void FreeBuffer( XDM_BufDesc *buf ) void davinci_FreeBuffer( XDM_BufDesc *buf )
{ {
if( buf->numBufs != 0 ) if( buf->numBufs != 0 )
{ {
...@@ -239,7 +239,7 @@ const char * davinci_GetExtendedError( XDAS_Int32 error ) ...@@ -239,7 +239,7 @@ const char * davinci_GetExtendedError( XDAS_Int32 error )
return "Unkown error"; return "Unkown error";
} }
void __PrintAvailableAlgorithms( vlc_object_t *p_this, const char *psz_engine ) void davinci_PrintAvailableAlgorithms( vlc_object_t *p_this, const char *psz_engine )
{ {
int i = 0; int i = 0;
Engine_AlgInfo info; Engine_AlgInfo info;
......
...@@ -47,18 +47,16 @@ void CloseAudioDecoder( vlc_object_t * ); ...@@ -47,18 +47,16 @@ void CloseAudioDecoder( vlc_object_t * );
int OpenVideoEncoder( vlc_object_t * ); int OpenVideoEncoder( vlc_object_t * );
void CloseVideoEncoder( vlc_object_t * ); void CloseVideoEncoder( vlc_object_t * );
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( XDM_BufDesc * );
const char *davinci_GetExtendedError( XDAS_Int32 );
void __PrintAvailableAlgorithms( vlc_object_t *, const char * );
#define PrintAvailableAlgorithms( a, b ) __PrintAvailableAlgorithms( VLC_OBJECT( a ), b )
/***************************************************************************** /*****************************************************************************
* Common stuff * Common stuff
*****************************************************************************/ *****************************************************************************/
extern const char *ppsz_engine_error[]; extern const char *ppsz_engine_error[];
int davinci_AllocateBuffer( XDAS_Int32, XDAS_Int32 *, XDM_BufDesc * );
void davinci_FreeBuffer( XDM_BufDesc * );
const char *davinci_GetExtendedError( XDAS_Int32 );
void davinci_PrintAvailableAlgorithms( vlc_object_t *, const char * );
bool GetDavinciDecoder( vlc_fourcc_t, int *, const char **, const char ** ); bool GetDavinciDecoder( vlc_fourcc_t, int *, const char **, const char ** );
bool GetDavinciEncoder( vlc_fourcc_t, int *, const char **, const char ** ); bool GetDavinciEncoder( vlc_fourcc_t, int *, const char **, const char ** );
bool GetVlcFourcc( const char *, int *, vlc_fourcc_t *, const char ** ); bool GetVlcFourcc( const char *, int *, vlc_fourcc_t *, const char ** );
......
...@@ -116,7 +116,7 @@ int OpenVideoEncoder( vlc_object_t *p_this ) ...@@ -116,7 +116,7 @@ int OpenVideoEncoder( vlc_object_t *p_this )
goto error; goto error;
} }
PrintAvailableAlgorithms( p_this, p_sys->psz_ti_engine ); davinci_PrintAvailableAlgorithms( p_this, p_sys->psz_ti_engine );
/* Configure encoder */ /* Configure encoder */
params.size = sizeof( params ); params.size = sizeof( params );
...@@ -213,8 +213,8 @@ void CloseVideoEncoder( vlc_object_t *p_this ) ...@@ -213,8 +213,8 @@ void CloseVideoEncoder( vlc_object_t *p_this )
CERuntime_exit(); /* XXX: Should this be done only once (if we have encoder + decoder runing) */ CERuntime_exit(); /* XXX: Should this be done only once (if we have encoder + decoder runing) */
/* Free 'DaVinci compliant' buffers */ /* Free 'DaVinci compliant' buffers */
FreeBuffer( &p_sys->in ); davinci_FreeBuffer( &p_sys->in );
FreeBuffer( &p_sys->out ); davinci_FreeBuffer( &p_sys->out );
free( p_sys->psz_ti_engine ); free( p_sys->psz_ti_engine );
free( p_sys ); free( p_sys );
...@@ -291,8 +291,8 @@ static int davinci_InitBuffers( encoder_t *p_enc ) ...@@ -291,8 +291,8 @@ static int davinci_InitBuffers( encoder_t *p_enc )
} }
/* Allocate input buffer(s) */ /* Allocate input buffer(s) */
if( i_ret = AllocateBuffer( p_enc, status.bufInfo.minNumInBufs, if( (i_ret = davinci_AllocateBuffer( status.bufInfo.minNumInBufs,
status.bufInfo.minInBufSize, &p_sys->in ) status.bufInfo.minInBufSize, &p_sys->in ))
!= VLC_SUCCESS ) != VLC_SUCCESS )
{ {
msg_Err( p_enc, "Failed to allocate input buffers" ); msg_Err( p_enc, "Failed to allocate input buffers" );
...@@ -300,8 +300,8 @@ static int davinci_InitBuffers( encoder_t *p_enc ) ...@@ -300,8 +300,8 @@ static int davinci_InitBuffers( encoder_t *p_enc )
} }
/* Allocate output buffer */ /* Allocate output buffer */
if( i_ret = AllocateBuffer( p_enc, status.bufInfo.minNumOutBufs, if( (i_ret = davinci_AllocateBuffer( status.bufInfo.minNumOutBufs,
status.bufInfo.minOutBufSize, &p_sys->out ) status.bufInfo.minOutBufSize, &p_sys->out ))
!= VLC_SUCCESS ) != VLC_SUCCESS )
{ {
msg_Err( p_enc, "Failed to allocate input buffers" ); msg_Err( p_enc, "Failed to allocate input buffers" );
......
...@@ -160,7 +160,7 @@ int OpenVideoDecoder( vlc_object_t *p_this ) ...@@ -160,7 +160,7 @@ int OpenVideoDecoder( vlc_object_t *p_this )
goto error; goto error;
} }
PrintAvailableAlgorithms( p_this, p_sys->psz_ti_engine ); davinci_PrintAvailableAlgorithms( p_this, p_sys->psz_ti_engine );
/* Get user supplied chroma setting */ /* Get user supplied chroma setting */
psz_chroma = config_GetPsz( p_dec, DEC_CFG_PREFIX "chroma" ); psz_chroma = config_GetPsz( p_dec, DEC_CFG_PREFIX "chroma" );
...@@ -270,8 +270,8 @@ void CloseVideoDecoder( vlc_object_t *p_this ) ...@@ -270,8 +270,8 @@ void CloseVideoDecoder( vlc_object_t *p_this )
#endif #endif
/* Free 'DaVinci compliant' buffers */ /* Free 'DaVinci compliant' buffers */
FreeBuffer( &p_sys->in ); davinci_FreeBuffer( &p_sys->in );
FreeBuffer( &p_sys->out ); davinci_FreeBuffer( &p_sys->out );
free( p_sys->psz_ti_engine ); free( p_sys->psz_ti_engine );
free( p_sys ); free( p_sys );
...@@ -353,8 +353,8 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i ...@@ -353,8 +353,8 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
} }
/* Allocate input buffer */ /* Allocate input buffer */
if( AllocateBuffer( p_dec, status.bufInfo.minNumInBufs, if( davinci_AllocateBuffer( status.bufInfo.minNumInBufs,
status.bufInfo.minInBufSize, &p_sys->in ) status.bufInfo.minInBufSize, &p_sys->in )
!= VLC_SUCCESS ) != VLC_SUCCESS )
{ {
msg_Err( p_dec, "Failed to allocate input buffers" ); msg_Err( p_dec, "Failed to allocate input buffers" );
...@@ -362,11 +362,11 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i ...@@ -362,11 +362,11 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
} }
/* Allocate output buffer(s) */ /* Allocate output buffer(s) */
if( AllocateBuffer( p_dec, status.bufInfo.minNumOutBufs, if( davinci_AllocateBuffer( status.bufInfo.minNumOutBufs,
status.bufInfo.minOutBufSize, &p_sys->out ) status.bufInfo.minOutBufSize, &p_sys->out )
!= VLC_SUCCESS ) != VLC_SUCCESS )
{ {
FreeBuffer( &p_sys->in ); davinci_FreeBuffer( &p_sys->in );
msg_Err( p_dec, "Failed to allocate output buffers" ); msg_Err( p_dec, "Failed to allocate output buffers" );
goto error; goto error;
} }
......
...@@ -68,9 +68,9 @@ static void Resize_coeff( decoder_t *p_dec, ...@@ -68,9 +68,9 @@ static void Resize_coeff( decoder_t *p_dec,
*i_height = ((i_vidh - i_vtap) * 256 - (i_vtap == 7 ? 32 : 16)) / i_vrsz + 1; *i_height = ((i_vidh - i_vtap) * 256 - (i_vtap == 7 ? 32 : 16)) / i_vrsz + 1;
/* width must be a factor of 16 : davinci resizer limitation when doing /* width must be a factor of 16 : davinci resizer limitation when doing
* * vertical upscaling, 16 bytes per output line * vertical upscaling, 16 bytes per output line
* * the bpp is 2 so a factor of 8 should be good but not in practice * the bpp is 2 so a factor of 8 should be good but not in practice
* */ */
*i_width = ( *i_width + 15 ) & ~15; *i_width = ( *i_width + 15 ) & ~15;
msg_Dbg( p_dec, "Destination fixed to %dx%d", *i_width, *i_height ); msg_Dbg( p_dec, "Destination fixed to %dx%d", *i_width, *i_height );
......
...@@ -107,7 +107,7 @@ int OpenVideoDecoder( vlc_object_t *p_this ) ...@@ -107,7 +107,7 @@ int OpenVideoDecoder( vlc_object_t *p_this )
goto error; goto error;
} }
PrintAvailableAlgorithms( p_this, p_sys->psz_ti_engine ); davinci_PrintAvailableAlgorithms( p_this, p_sys->psz_ti_engine );
/* Get user supplied chroma setting */ /* Get user supplied chroma setting */
psz_chroma = var_CreateGetString( p_dec, DEC_CFG_PREFIX "fourcc" ); psz_chroma = var_CreateGetString( p_dec, DEC_CFG_PREFIX "fourcc" );
...@@ -200,8 +200,8 @@ void CloseVideoDecoder( vlc_object_t *p_this ) ...@@ -200,8 +200,8 @@ void CloseVideoDecoder( vlc_object_t *p_this )
CERuntime_exit(); CERuntime_exit();
/* Free 'DaVinci compliant' buffers */ /* Free 'DaVinci compliant' buffers */
FreeBuffer( &p_sys->in ); davinci_FreeBuffer( &p_sys->in );
FreeBuffer( &p_sys->out ); davinci_FreeBuffer( &p_sys->out );
free( p_sys->psz_ti_engine ); free( p_sys->psz_ti_engine );
free( p_sys ); free( p_sys );
...@@ -296,8 +296,8 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i ...@@ -296,8 +296,8 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
} }
/* Allocate input buffer */ /* Allocate input buffer */
if( AllocateBuffer( p_dec, status.bufInfo.minNumInBufs, if( davinci_AllocateBuffer( status.bufInfo.minNumInBufs,
status.bufInfo.minInBufSize, &p_sys->in ) status.bufInfo.minInBufSize, &p_sys->in )
!= VLC_SUCCESS ) != VLC_SUCCESS )
{ {
msg_Err( p_dec, "Failed to allocate input buffers" ); msg_Err( p_dec, "Failed to allocate input buffers" );
...@@ -305,11 +305,11 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i ...@@ -305,11 +305,11 @@ static picture_t *DecodeVideoBlockInner( decoder_t *p_dec, block_t **pp_block, i
} }
/* Allocate output buffer(s) */ /* Allocate output buffer(s) */
if( AllocateBuffer( p_dec, status.bufInfo.minNumOutBufs, if( davinci_AllocateBuffer( status.bufInfo.minNumOutBufs,
status.bufInfo.minOutBufSize, &p_sys->out ) status.bufInfo.minOutBufSize, &p_sys->out )
!= VLC_SUCCESS ) != VLC_SUCCESS )
{ {
FreeBuffer( &p_sys->in ); davinci_FreeBuffer( &p_sys->in );
msg_Err( p_dec, "Failed to allocate output buffers" ); msg_Err( p_dec, "Failed to allocate output buffers" );
goto error; goto error;
} }
......
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