Commit 5671a4b5 authored by Christophe Massiot's avatar Christophe Massiot

video_decoder : ajout de la crop table dans AddBlock ;

video_parser : correction d'une erreur dans le commit pr�c�dent (on ne
fera pas la saturation dans le cas d'une DFT, de toute fa�on)
parent bb5805a3
......@@ -249,6 +249,10 @@
* picture. */
#define NB_VDEC 1
/* Maximum range of values out of the IDCT + motion compensation. Only
* used if you define MPEG2_COMPLIANT above. */
#define VDEC_CROPRANGE 2048
/*******************************************************************************
* Generic decoder configuration
*******************************************************************************/
......
......@@ -33,10 +33,15 @@ typedef struct vdec_thread_s
/*??*/
// int *pi_status;
/* Input properties */
struct vpar_thread_s * p_vpar; /* video_parser thread */
/* Lookup tables */
#ifdef MPEG2_COMPLIANT
u8 pi_crop_buf[VDEC_CROPRANGE];
u8 * pi_crop,
#endif
#ifdef STATS
/* Statistics */
count_t c_loops; /* number of loops */
......@@ -54,7 +59,7 @@ typedef struct vdec_thread_s
/*****************************************************************************
* Function pointers
*****************************************************************************/
typedef void (*f_addb_t)( elem_t*, data_t*, int );
typedef void (*f_addb_t)( vdec_thread_t*, elem_t*, data_t*, int );
/*****************************************************************************
* Prototypes
......@@ -64,6 +69,6 @@ struct vpar_thread_s;
/* Thread management functions */
vdec_thread_t * vdec_CreateThread ( struct vpar_thread_s *p_vpar /*, int *pi_status */ );
void vdec_DestroyThread ( vdec_thread_t *p_vdec /*, int *pi_status */ );
void vdec_AddBlock( elem_t*, data_t*, int );
void vdec_CopyBlock( elem_t*, data_t*, int );
void vdec_DummyBlock( elem_t*, data_t*, int );
void vdec_AddBlock( vdec_thread_t*, elem_t*, data_t*, int );
void vdec_CopyBlock( vdec_thread_t*, elem_t*, data_t*, int );
void vdec_DummyBlock( vdec_thread_t*, elem_t*, data_t*, int );
......@@ -126,6 +126,10 @@ void vdec_DestroyThread( vdec_thread_t *p_vdec /*, int *pi_status */ )
*******************************************************************************/
static int InitThread( vdec_thread_t *p_vdec )
{
#ifdef MPEG2_COMPLIANT
int i_dummy;
#endif
intf_DbgMsg("vdec debug: initializing video decoder thread %p\n", p_vdec);
/* Initialize other properties */
......@@ -138,6 +142,23 @@ static int InitThread( vdec_thread_t *p_vdec )
p_vdec->c_decoded_b_pictures = 0;
#endif
#ifdef MPEG2_COMPLIANT
/* Init crop table */
p_vdec->pi_crop = p_vdec->pi_crop_buf + (VDEC_CROPRANGE >> 1);
for( i_dummy = -VDEC_CROPRANGE; i_dummy < -256; i_dummy ++ )
{
p_vdec->pi_crop[i_dummy] = -256;
}
for( ; i_dummy < 255; i_dummy ++ )
{
p_vdec->pi_crop[i_dummy] = i_dummy;
}
for( ; i_dummy < (VDEC_CROPRANGE >> 1) -1; i_dummy++ )
{
p_vdec->pi_crop[i_dummy] = 255;
}
#endif
/* Mark thread as running and return */
intf_DbgMsg("vdec debug: InitThread(%p) succeeded\n", p_vdec);
return( 0 );
......@@ -278,7 +299,8 @@ static void DecodeMacroblock( vdec_thread_t *p_vdec, macroblock_t * p_mb )
/*******************************************************************************
* vdec_AddBlock : add a block
*******************************************************************************/
void vdec_AddBlock( elem_t * p_block, data_t * p_data, int i_incr )
void vdec_AddBlock( vdec_thread_t * p_vdec, elem_t * p_block, data_t * p_data,
int i_incr )
{
int i_x, i_y;
......@@ -286,8 +308,12 @@ void vdec_AddBlock( elem_t * p_block, data_t * p_data, int i_incr )
{
for( i_x = 0; i_x < 8; i_x++ )
{
/* ??? Need clip to be MPEG-2 compliant */
#ifdef MPEG2_COMPLIANT
*p_data = p_vdec->pi_clip[*p_data + *p_block++];
p_data++;
#else
*p_data++ += *p_block++;
#endif
}
p_data += i_incr;
}
......@@ -296,7 +322,8 @@ void vdec_AddBlock( elem_t * p_block, data_t * p_data, int i_incr )
/*******************************************************************************
* vdec_CopyBlock : copy a block
*******************************************************************************/
void vdec_CopyBlock( elem_t * p_block, data_t * p_data, int i_incr )
void vdec_CopyBlock( vdec_thread_t * p_vdec, elem_t * p_block, data_t * p_data,
int i_incr )
{
int i_x, i_y;
......@@ -322,6 +349,7 @@ void vdec_CopyBlock( elem_t * p_block, data_t * p_data, int i_incr )
/*******************************************************************************
* vdec_DummyBlock : dummy function that does nothing
*******************************************************************************/
void vdec_DummyBlock( elem_t * p_block, data_t * p_data, int i_incr )
void vdec_DummyBlock( vdec_thread_t * p_vdec, elem_t * p_block, data_t * p_data,
int i_incr )
{
}
......@@ -81,7 +81,8 @@ vpar_thread_t * vpar_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
/*
* Initialize the input properties
*/
/* Initialize the parser fifo's data lock and conditional variable and set * its buffer as empty */
/* Initialize the decoder fifo's data lock and conditional variable and set
* its buffer as empty */
vlc_mutex_init( &p_vpar->fifo.data_lock );
vlc_cond_init( &p_vpar->fifo.data_wait );
p_vpar->fifo.i_start = 0;
......@@ -221,7 +222,7 @@ static int InitThread( vpar_thread_t *p_vpar )
}
/* Initialize lookup tables */
#ifdef MPEG2_COMPLIANT
#if defined(MPEG2_COMPLIANT) && !defined(VDEC_DFT)
vpar_InitCrop( p_vpar );
#endif
InitMbAddrInc( p_vpar );
......
......@@ -142,7 +142,7 @@ extern int pi_scan[2][64] =
* vpar_InitCrop : Initialize the crop table for saturation
* (ISO/IEC 13818-2 section 7.4.3)
*****************************************************************************/
#ifdef MPEG2_COMPLIANT
#if defined(MPEG2_COMPLIANT) && !defined(VDEC_DFT)
void vpar_InitCrop( vpar_thread_t * p_vpar )
{
int i_dummy;
......
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