Commit b9dc0c52 authored by Christophe Massiot's avatar Christophe Massiot

Nettoyage global. Le vlc se ferme proprement, elem_t devient dctelem_t, le

macroblock perdu a �t� retrouv�, et bien plus...
parent f0be4ee4
......@@ -45,7 +45,7 @@
/* Program version and copyright message */
#define PROGRAM_VERSION "1.0-dev"
#define COPYRIGHT_MESSAGE "VideoLAN Client v" PROGRAM_VERSION " (" __DATE__ ") - " \
PROGRAM_OPTIONS " - (c)1999 VideoLAN"
PROGRAM_OPTIONS " - (c)1999-2000 VideoLAN"
/*******************************************************************************
* General compilation options
......
......@@ -15,9 +15,9 @@
*****************************************************************************/
#ifndef VDEC_DFT
typedef short elem_t;
typedef short dctelem_t;
#else
typedef int elem_t;
typedef int dctelem_t;
#endif
struct vdec_thread_s;
......@@ -143,12 +143,12 @@ struct vdec_thread_s;
/*****************************************************************************
* Function pointers
*****************************************************************************/
typedef void (*f_idct_t)( struct vdec_thread_s *, elem_t*, int );
typedef void (*f_idct_t)( struct vdec_thread_s *, dctelem_t*, int );
/*****************************************************************************
* Prototypes
*****************************************************************************/
void vdec_DummyIDCT( struct vdec_thread_s *, elem_t*, int );
void vdec_DummyIDCT( struct vdec_thread_s *, dctelem_t*, int );
void vdec_InitIDCT (struct vdec_thread_s * p_vdec);
void vdec_SparseIDCT( struct vdec_thread_s *, elem_t*, int );
void vdec_IDCT( struct vdec_thread_s *, elem_t*, int );
void vdec_SparseIDCT( struct vdec_thread_s *, dctelem_t*, int );
void vdec_IDCT( struct vdec_thread_s *, dctelem_t*, int );
......@@ -34,7 +34,7 @@ typedef struct vdec_thread_s
// int *pi_status;
/* idct iformations */
elem_t p_pre_idct[64*64];
dctelem_t p_pre_idct[64*64];
/* Input properties */
struct vpar_thread_s * p_vpar; /* video_parser thread */
......@@ -59,7 +59,7 @@ typedef struct vdec_thread_s
/*****************************************************************************
* Function pointers
*****************************************************************************/
typedef void (*f_addb_t)( vdec_thread_t *, elem_t*, yuv_data_t*, int );
typedef void (*f_addb_t)( vdec_thread_t *, dctelem_t*, yuv_data_t*, int );
/*****************************************************************************
* Prototypes
......@@ -69,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( vdec_thread_t *, elem_t*, yuv_data_t*, int );
void vdec_CopyBlock( vdec_thread_t *, elem_t*, yuv_data_t*, int );
void vdec_DummyBlock( vdec_thread_t *, elem_t*, yuv_data_t*, int );
void vdec_AddBlock( vdec_thread_t *, dctelem_t*, yuv_data_t*, int );
void vdec_CopyBlock( vdec_thread_t *, dctelem_t*, yuv_data_t*, int );
void vdec_DummyBlock( vdec_thread_t *, dctelem_t*, yuv_data_t*, int );
......@@ -33,7 +33,7 @@ typedef struct macroblock_s
int i_c_stride; /* idem, for chroma */
/* IDCT information */
elem_t ppi_blocks[12][64]; /* blocks */
dctelem_t ppi_blocks[12][64]; /* blocks */
f_idct_t pf_idct[12]; /* sparse IDCT or not ? */
int pi_sparse_pos[12];
......@@ -131,10 +131,17 @@ extern u8 pi_scan[2][64];
* Prototypes
*****************************************************************************/
void vpar_InitCrop( struct vpar_thread_s* p_vpar );
void vpar_InitMbAddrInc( struct vpar_thread_s * p_vpar );
void vpar_InitPMBType( struct vpar_thread_s * p_vpar );
void vpar_InitBMBType( struct vpar_thread_s * p_vpar );
void vpar_InitCodedPattern( struct vpar_thread_s * p_vpar );
void vpar_InitDCTTables( struct vpar_thread_s * p_vpar );
void vpar_ParseMacroblock( struct vpar_thread_s * p_vpar, int * pi_mb_address,
int i_mb_previous, int i_mb_base );
int vpar_CodedPattern420( struct vpar_thread_s* p_vpar );
int vpar_CodedPattern422( struct vpar_thread_s* p_vpar );
int vpar_CodedPattern444( struct vpar_thread_s* p_vpar );
int vpar_IMBType( struct vpar_thread_s* p_vpar );
int vpar_PMBType( struct vpar_thread_s* p_vpar );
int vpar_BMBType( struct vpar_thread_s* p_vpar );
int vpar_DMBType( struct vpar_thread_s* p_vpar );
int vpar_IMBType( struct vpar_thread_s* p_vpar );
int vpar_PMBType( struct vpar_thread_s* p_vpar );
int vpar_BMBType( struct vpar_thread_s* p_vpar );
int vpar_DMBType( struct vpar_thread_s* p_vpar );
......@@ -32,4 +32,4 @@ void vpar_SynchroTrash( struct vpar_thread_s * p_vpar, int i_coding_type,
int i_structure );
mtime_t vpar_SynchroDecode( struct vpar_thread_s * p_vpar, int i_coding_type,
int i_structure );
void vpar_SynchroEnd( struct vpar_thread_s * p_vpar );
......@@ -341,7 +341,7 @@ static void EndThread( input_thread_t * p_input )
{
case MPEG1_VIDEO_ES:
case MPEG2_VIDEO_ES:
vdec_DestroyThread( (vdec_thread_t*)(p_input->pp_selected_es[i_es_loop]->p_dec) /*, NULL */ );
vpar_DestroyThread( (vpar_thread_t*)(p_input->pp_selected_es[i_es_loop]->p_dec) /*, NULL */ );
break;
case MPEG1_AUDIO_ES:
......
......@@ -44,7 +44,7 @@
* Local prototypes
*/
//extern IDCT_mmx(elem_t*);
//extern IDCT_mmx(dctelem_t*);
/* Our current implementation is a fast DCT, we might move to a fast DFT or
* an MMX DCT in the future. */
......@@ -52,7 +52,7 @@
/*****************************************************************************
* vdec_DummyIDCT : dummy function that does nothing
*****************************************************************************/
void vdec_DummyIDCT( vdec_thread_t * p_vdec, elem_t * p_block,
void vdec_DummyIDCT( vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_idontcare )
{
}
......@@ -66,8 +66,8 @@ void vdec_InitIDCT (vdec_thread_t * p_vdec)
{
int i;
elem_t * p_pre = p_vdec->p_pre_idct;
memset( p_pre, 0, 64*64*sizeof(elem_t) );
dctelem_t * p_pre = p_vdec->p_pre_idct;
memset( p_pre, 0, 64*64*sizeof(dctelem_t) );
for( i=0 ; i < 64 ; i++ )
{
......@@ -76,7 +76,7 @@ void vdec_InitIDCT (vdec_thread_t * p_vdec)
}
}
void vdec_SparseIDCT (vdec_thread_t * p_vdec, elem_t * p_block,
void vdec_SparseIDCT (vdec_thread_t * p_vdec, dctelem_t * p_block,
int i_sparse_pos)
{
short int val;
......@@ -135,7 +135,7 @@ void vdec_SparseIDCT (vdec_thread_t * p_vdec, elem_t * p_block,
/*****************************************************************************
* vdec_IDCT : IDCT function for normal matrices
*****************************************************************************/
void vdec_IDCT( vdec_thread_t * p_vdec, elem_t * p_block, int i_idontcare )
void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
{
//IDCT_mmx(p_block);
#if 1
......@@ -143,7 +143,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, elem_t * p_block, int i_idontcare )
s32 tmp10, tmp11, tmp12, tmp13;
s32 z1, z2, z3, z4, z5;
s32 d0, d1, d2, d3, d4, d5, d6, d7;
elem_t * dataptr;
dctelem_t * dataptr;
int rowctr;
SHIFT_TEMPS
......@@ -174,7 +174,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, elem_t * p_block, int i_idontcare )
if (d0)
{
/* Compute a 32 bit value to assign. */
elem_t dcval = (elem_t) (d0 << PASS1_BITS);
dctelem_t dcval = (dctelem_t) (d0 << PASS1_BITS);
register int v = (dcval & 0xffff) | (dcval << 16);
idataptr[0] = v;
......@@ -727,14 +727,14 @@ void vdec_IDCT( vdec_thread_t * p_vdec, elem_t * p_block, int i_idontcare )
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
dataptr[0] = (elem_t) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
dataptr[7] = (elem_t) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
dataptr[1] = (elem_t) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
dataptr[6] = (elem_t) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
dataptr[2] = (elem_t) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
dataptr[5] = (elem_t) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
dataptr[3] = (elem_t) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
dataptr[4] = (elem_t) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
dataptr[0] = (dctelem_t) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
dataptr[7] = (dctelem_t) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
dataptr[1] = (dctelem_t) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
dataptr[6] = (dctelem_t) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
dataptr[2] = (dctelem_t) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
dataptr[5] = (dctelem_t) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
dataptr[3] = (dctelem_t) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
dataptr[4] = (dctelem_t) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */
}
......@@ -1294,21 +1294,21 @@ void vdec_IDCT( vdec_thread_t * p_vdec, elem_t * p_block, int i_idontcare )
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
dataptr[DCTSIZE*0] = (elem_t) DESCALE(tmp10 + tmp3,
dataptr[DCTSIZE*0] = (dctelem_t) DESCALE(tmp10 + tmp3,
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*7] = (elem_t) DESCALE(tmp10 - tmp3,
dataptr[DCTSIZE*7] = (dctelem_t) DESCALE(tmp10 - tmp3,
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*1] = (elem_t) DESCALE(tmp11 + tmp2,
dataptr[DCTSIZE*1] = (dctelem_t) DESCALE(tmp11 + tmp2,
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*6] = (elem_t) DESCALE(tmp11 - tmp2,
dataptr[DCTSIZE*6] = (dctelem_t) DESCALE(tmp11 - tmp2,
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*2] = (elem_t) DESCALE(tmp12 + tmp1,
dataptr[DCTSIZE*2] = (dctelem_t) DESCALE(tmp12 + tmp1,
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*5] = (elem_t) DESCALE(tmp12 - tmp1,
dataptr[DCTSIZE*5] = (dctelem_t) DESCALE(tmp12 - tmp1,
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*3] = (elem_t) DESCALE(tmp13 + tmp0,
dataptr[DCTSIZE*3] = (dctelem_t) DESCALE(tmp13 + tmp0,
CONST_BITS+PASS1_BITS+3);
dataptr[DCTSIZE*4] = (elem_t) DESCALE(tmp13 - tmp0,
dataptr[DCTSIZE*4] = (dctelem_t) DESCALE(tmp13 - tmp0,
CONST_BITS+PASS1_BITS+3);
dataptr++; /* advance pointer to next column */
......
......@@ -111,6 +111,11 @@ void vdec_DestroyThread( vdec_thread_t *p_vdec /*, int *pi_status */ )
/* Ask thread to kill itself */
p_vdec->b_die = 1;
/* Make sure the parser thread leaves the GetByte() function */
vlc_mutex_lock( &(p_vdec->p_vpar->vfifo.lock) );
vlc_cond_signal( &(p_vdec->p_vpar->vfifo.wait) );
vlc_mutex_unlock( &(p_vdec->p_vpar->vfifo.lock) );
/* Waiting for the decoder thread to exit */
/* Remove this as soon as the "status" flag is implemented */
......@@ -128,9 +133,7 @@ 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);
......@@ -144,7 +147,6 @@ 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 >> 1); i_dummy < 0; i_dummy++ )
......@@ -159,7 +161,6 @@ static int InitThread( vdec_thread_t *p_vdec )
{
p_vdec->pi_crop[i_dummy] = 255;
}
//#endif
/* Mark thread as running and return */
intf_DbgMsg("vdec debug: InitThread(%p) succeeded\n", p_vdec);
......@@ -194,7 +195,7 @@ static void RunThread( vdec_thread_t *p_vdec )
while( (!p_vdec->b_die) && (!p_vdec->b_error) )
{
macroblock_t * p_mb;
if( (p_mb = vpar_GetMacroblock( &p_vdec->p_vpar->vfifo )) != NULL )
{
DecodeMacroblock( p_vdec, p_mb );
......@@ -255,9 +256,9 @@ static void DecodeMacroblock( vdec_thread_t *p_vdec, macroblock_t * p_mb )
* Motion Compensation (ISO/IEC 13818-2 section 7.6)
*/
(*p_mb->pf_motion)( p_mb );
//#if 0
/* luminance */
for( i_b = 0; i_b <4; i_b++ )
for( i_b = 0; i_b < 4; i_b++ )
{
/*
* Inverse DCT (ISO/IEC 13818-2 section Annex A)
......@@ -265,29 +266,13 @@ static void DecodeMacroblock( vdec_thread_t *p_vdec, macroblock_t * p_mb )
(p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b],
p_mb->pi_sparse_pos[i_b] );
// if( (i_b & 2) )
/* {
int i, j;
elem_t meuh[64];
for( i = 0; i < 8; i++ )
{
for( j = 0; j < 8; j++ )
{
meuh[8*j + (7-i)] = p_mb->ppi_blocks[i_b][j + 8*i];
}
}
memcpy(p_mb->ppi_blocks[i_b], meuh, 128);
}
*/
/*
* Adding prediction and coefficient data (ISO/IEC 13818-2 section 7.6.8)
*/
(p_mb->pf_addb[i_b])( p_vdec, p_mb->ppi_blocks[i_b],
p_mb->p_data[i_b], p_mb->i_addb_l_stride );
}
//#endif
//#if 0
/* chrominance */
for( i_b = 4; i_b < 4 + p_mb->i_chroma_nb_blocks; i_b++ )
{
......@@ -296,21 +281,6 @@ memcpy(p_mb->ppi_blocks[i_b], meuh, 128);
*/
(p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b],
p_mb->pi_sparse_pos[i_b] );
/*
{
int i, j;
elem_t meuh[64];
for( i = 0; i < 8; i++ )
{
for( j = 0; j < 8; j++ )
{
meuh[8*j + (7-i)] = p_mb->ppi_blocks[i_b][j + 8*i];
}
}
memcpy(p_mb->ppi_blocks[i_b], meuh, 128);
}
*/
/*
* Adding prediction and coefficient data (ISO/IEC 13818-2 section 7.6.8)
......@@ -318,7 +288,7 @@ memcpy(p_mb->ppi_blocks[i_b], meuh, 128);
(p_mb->pf_addb[i_b])( p_vdec, p_mb->ppi_blocks[i_b],
p_mb->p_data[i_b], p_mb->i_addb_c_stride );
}
//#endif
/*
* Decoding is finished, release the macroblock and free
* unneeded memory.
......@@ -329,7 +299,7 @@ memcpy(p_mb->ppi_blocks[i_b], meuh, 128);
/*******************************************************************************
* vdec_AddBlock : add a block
*******************************************************************************/
void vdec_AddBlock( vdec_thread_t * p_vdec, elem_t * p_block, yuv_data_t * p_data, int i_incr )
void vdec_AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, yuv_data_t * p_data, int i_incr )
{
int i_x, i_y;
......@@ -337,12 +307,8 @@ void vdec_AddBlock( vdec_thread_t * p_vdec, elem_t * p_block, yuv_data_t * p_dat
{
for( i_x = 0; i_x < 8; i_x++ )
{
#ifdef MPEG2_COMPLIANT
*p_data = p_vdec->pi_crop[*p_data + *p_block++];
p_data++;
#else
*p_data++ += *p_block++;
#endif
}
p_data += i_incr;
}
......@@ -351,7 +317,7 @@ void vdec_AddBlock( vdec_thread_t * p_vdec, elem_t * p_block, yuv_data_t * p_dat
/*******************************************************************************
* vdec_CopyBlock : copy a block
*******************************************************************************/
void vdec_CopyBlock( vdec_thread_t * p_vdec, elem_t * p_block, yuv_data_t * p_data, int i_incr )
void vdec_CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, yuv_data_t * p_data, int i_incr )
{
int i_y;
//fprintf(stderr, "%d ", i_incr );
......@@ -359,7 +325,7 @@ void vdec_CopyBlock( vdec_thread_t * p_vdec, elem_t * p_block, yuv_data_t * p_da
for( i_y = 0; i_y < 8; i_y++ )
{
#if 0
/* elem_t and yuv_data_t are the same */
/* dctelem_t and yuv_data_t are the same */
memcpy( p_data, p_block, 8*sizeof(yuv_data_t) );
p_data += i_incr+8;
p_block += 8;
......@@ -380,6 +346,6 @@ void vdec_CopyBlock( vdec_thread_t * p_vdec, elem_t * p_block, yuv_data_t * p_da
/*******************************************************************************
* vdec_DummyBlock : dummy function that does nothing
*******************************************************************************/
void vdec_DummyBlock( vdec_thread_t * p_vdec, elem_t * p_block, yuv_data_t * p_data, int i_incr )
void vdec_DummyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block, yuv_data_t * p_data, int i_incr )
{
}
......@@ -84,7 +84,7 @@ macroblock_t * vpar_GetMacroblock( video_fifo_t * p_fifo )
p_mb = VIDEO_FIFO_START( *p_fifo );
VIDEO_FIFO_INCSTART( *p_fifo );
vlc_mutex_unlock( &p_fifo->lock );
return( p_mb );
......@@ -99,12 +99,13 @@ macroblock_t * vpar_NewMacroblock( video_fifo_t * p_fifo )
#define P_buffer p_fifo->p_vpar->vbuffer
vlc_mutex_lock( &P_buffer.lock );
if( P_buffer.i_index == -1 )
while( P_buffer.i_index == -1 )
{
/* No more structures available. This should not happen ! */
msleep(VPAR_IDLE_SLEEP);
return vpar_NewMacroblock( p_fifo );
// return NULL;
intf_DbgMsg("vpar debug: macroblock list is empty, delaying\n");
vlc_mutex_unlock( &P_buffer.lock );
msleep(VPAR_IDLE_SLEEP);
vlc_mutex_lock( &P_buffer.lock );
}
p_mb = P_buffer.pp_mb_free[ P_buffer.i_index-- ];
......@@ -135,12 +136,16 @@ void vpar_DecodeMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb )
*****************************************************************************/
void vpar_ReleaseMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb )
{
boolean_t b_finished;
/* Unlink picture buffer */
vlc_mutex_lock( &p_mb->p_picture->lock_deccount );
p_mb->p_picture->i_deccount--;
b_finished = (p_mb->p_picture->i_deccount == 1);
vlc_mutex_unlock( &p_mb->p_picture->lock_deccount );
//fprintf(stderr, "%d ", p_mb->p_picture->i_deccount);
/* Test if it was the last block of the picture */
if( p_mb->p_picture->i_deccount == 1 )
if( b_finished )
{
fprintf(stderr, "Image decodee\n");
/* Mark the picture to be displayed */
......@@ -159,7 +164,6 @@ fprintf(stderr, "Image decodee\n");
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backward );
}*/
}
vlc_mutex_unlock( &p_mb->p_picture->lock_deccount );
/* Release the macroblock_t structure */
#define P_buffer p_fifo->p_vpar->vbuffer
......@@ -174,6 +178,35 @@ fprintf(stderr, "Image decodee\n");
*****************************************************************************/
void vpar_DestroyMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb )
{
boolean_t b_finished;
/* Unlink picture buffer */
vlc_mutex_lock( &p_mb->p_picture->lock_deccount );
p_mb->p_picture->i_deccount--;
b_finished = (p_mb->p_picture->i_deccount == 1);
vlc_mutex_unlock( &p_mb->p_picture->lock_deccount );
/* Test if it was the last block of the picture */
if( b_finished )
{
fprintf(stderr, "Image trashee\n");
/* Mark the picture to be displayed */
vout_DestroyPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
/* Warn Synchro for its records. */
vpar_SynchroEnd( p_fifo->p_vpar );
/* Unlink referenced pictures */
/* if( p_mb->p_forward != NULL )
{
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
}
if( p_mb->p_backward != NULL )
{
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backward );
}*/
}
/* Release the macroblock_t structure */
#define P_buffer p_fifo->p_vpar->vbuffer
vlc_mutex_lock( &P_buffer.lock );
......
......@@ -175,16 +175,6 @@ static int InitThread( vpar_thread_t *p_vpar )
p_vpar->bit_stream.i_byte = p_vpar->bit_stream.p_ts->i_payload_start;
vlc_mutex_unlock( &p_vpar->fifo.data_lock );
#if 0
/* ?? */
/* Create video stream */
p_vpar->i_stream = vout_CreateStream( p_vpar->p_vout );
if( p_vpar->i_stream < 0 ) /* error */
{
return( 1 );
}
#endif
/* Initialize parsing data */
p_vpar->sequence.p_forward = NULL;
p_vpar->sequence.p_backward = NULL;
......@@ -198,6 +188,9 @@ static int InitThread( vpar_thread_t *p_vpar )
p_vpar->sequence.i_copyright_id = 0;
p_vpar->sequence.i_copyright_nb = 0;
p_vpar->picture.p_picture = NULL;
p_vpar->picture.i_current_structure = 0;
/* Initialize other properties */
#ifdef STATS
p_vpar->c_loops = 0;
......@@ -214,7 +207,7 @@ static int InitThread( vpar_thread_t *p_vpar )
/* Initialize video FIFO */
vpar_InitFIFO( p_vpar );
bzero( p_vpar->p_vdec, NB_VDEC*sizeof(vdec_thread_t *) );
/* Spawn video_decoder threads */
......
This diff is collapsed.
......@@ -238,8 +238,6 @@ static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_ma
*****************************************************************************/
static __inline__ void LinkMatrix( quant_matrix_t * p_matrix, int * pi_array )
{
int i_dummy;
if( p_matrix->b_allocated )
{
/* Deallocate the piece of memory. */
......@@ -280,16 +278,12 @@ int vpar_ParseHeader( vpar_thread_t * p_vpar )
switch( GetBits32( &p_vpar->bit_stream ) )
{
case SEQUENCE_HEADER_CODE:
fprintf( stderr, "begin sequence header\n" );
SequenceHeader( p_vpar );
fprintf( stderr, "end sequence header\n" );
return 0;
break;
case GROUP_START_CODE:
fprintf( stderr, "begin group\n" );
GroupHeader( p_vpar );
fprintf( stderr, "end group\n" );
return 0;
break;
......@@ -299,7 +293,7 @@ int vpar_ParseHeader( vpar_thread_t * p_vpar )
break;
case SEQUENCE_END_CODE:
fprintf( stderr, "sequence header end code\n" );
intf_DbgMsg("vpar debug: sequence end code received\n");
return 1;
break;
......@@ -517,7 +511,6 @@ static void PictureHeader( vpar_thread_t * p_vpar )
int i_structure;
int i_mb_address, i_mb_base, i_mb;
elem_t * p_y, p_u, p_v;
boolean_t b_parsable;
u32 i_dummy;
......@@ -659,7 +652,6 @@ static void PictureHeader( vpar_thread_t * p_vpar )
return;
}
fprintf(stderr, "begin picture\n");
/* OK, now we are sure we will decode the picture. */
#define P_picture p_vpar->picture.p_picture
......@@ -679,7 +671,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
p_vpar->b_error = 1;
return;
}
bzero( P_picture->p_data, 940032 );
/* Initialize values. */
P_picture->date = vpar_SynchroDecode( p_vpar,
p_vpar->picture.i_coding_type,
......@@ -689,6 +681,9 @@ bzero( P_picture->p_data, 940032 );
p_vpar->picture.i_c_stride = - 8 + ( p_vpar->sequence.i_chroma_width
<< ( 1 - p_vpar->picture.b_frame_structure ));
P_picture->i_deccount = p_vpar->sequence.i_mb_size;
memset( p_vpar->picture.pp_mb, 0, MAX_MB );
/* Update the reference pointers. */
ReferenceUpdate( p_vpar, p_vpar->picture.i_coding_type, P_picture );
}
......@@ -723,7 +718,7 @@ bzero( P_picture->p_data, 940032 );
< SLICE_START_CODE_MIN) ||
(i_dummy > SLICE_START_CODE_MAX) )
{
intf_DbgMsg("vpar debug: premature end of picture");
intf_DbgMsg("vpar debug: premature end of picture\n");
p_vpar->picture.b_error = 1;
break;
}
......@@ -737,13 +732,13 @@ bzero( P_picture->p_data, 940032 );
{
/* Trash picture. */
fprintf(stderr, "Image trashee\n");
for( i_mb = 0; p_vpar->picture.pp_mb[i_mb]; i_mb++ )
for( i_mb = 1; p_vpar->picture.pp_mb[i_mb]; i_mb++ )
{
vpar_DestroyMacroblock( &p_vpar->vfifo, p_vpar->picture.pp_mb[i_mb] );
}
vout_DestroyPicture( p_vpar->p_vout, p_vpar->picture.p_picture );
ReferenceReplace( p_vpar, p_vpar->picture.i_coding_type, NULL );
vout_DestroyPicture( p_vpar->p_vout, P_picture );
/* Prepare context for the next picture. */
P_picture = NULL;
......@@ -754,8 +749,7 @@ fprintf(stderr, "Image trashee\n");
{
fprintf(stderr, "Image parsee\n");
/* Frame completely parsed. */
P_picture->i_deccount = p_vpar->sequence.i_mb_size;
for( i_mb = 0; i_mb < p_vpar->sequence.i_mb_size; i_mb++ )
for( i_mb = 1; p_vpar->picture.pp_mb[i_mb]; i_mb++ )
{
vpar_DecodeMacroblock( &p_vpar->vfifo, p_vpar->picture.pp_mb[i_mb] );
}
......@@ -773,7 +767,9 @@ fprintf(stderr, "Image parsee\n");
}
#endif
/* Send signal to the video_decoder. */
vlc_mutex_lock( &p_vpar->vfifo.lock );
vlc_cond_signal( &p_vpar->vfifo.wait );
vlc_mutex_unlock( &p_vpar->vfifo.lock );
/* Prepare context for the next picture. */
P_picture = NULL;
......
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