Commit cf9e7c61 authored by Jean-Marc Dressler's avatar Jean-Marc Dressler

Le debuggage du parser avance ... lentement.
parent e95de90d
...@@ -68,11 +68,11 @@ typedef struct vpar_thread_s ...@@ -68,11 +68,11 @@ typedef struct vpar_thread_s
/* tables for macroblock types 0=P 1=B */ /* tables for macroblock types 0=P 1=B */
lookup_t ppl_mb_type[2][64]; lookup_t ppl_mb_type[2][64];
/* table for coded_block_pattern */ /* table for coded_block_pattern */
lookup_t pl_coded_pattern[512]; lookup_t * pl_coded_pattern;
/* variable length codes for the structure dct_dc_size for intra blocks */ /* variable length codes for the structure dct_dc_size for intra blocks */
lookup_t pppl_dct_dc_size[2][2][32]; lookup_t * pppl_dct_dc_size[2][2];
/* structure to store the tables B14 & B15 */ /* structure to store the tables B14 & B15 */
dct_lookup_t * pppl_dct_coef[2][65536]; dct_lookup_t * pppl_dct_coef[2][65536];
#ifdef STATS #ifdef STATS
/* Statistics */ /* Statistics */
......
...@@ -116,15 +116,15 @@ typedef struct slice_parsing_s ...@@ -116,15 +116,15 @@ typedef struct slice_parsing_s
/***************************************************************************** /*****************************************************************************
* Standard codes * Standard codes
*****************************************************************************/ *****************************************************************************/
#define PICTURE_START_CODE 0x100 #define PICTURE_START_CODE 0x100L
#define SLICE_START_CODE_MIN 0x101 #define SLICE_START_CODE_MIN 0x101L
#define SLICE_START_CODE_MAX 0x1AF #define SLICE_START_CODE_MAX 0x1AFL
#define USER_DATA_START_CODE 0x1B2 #define USER_DATA_START_CODE 0x1B2L
#define SEQUENCE_HEADER_CODE 0x1B3 #define SEQUENCE_HEADER_CODE 0x1B3L
#define SEQUENCE_ERROR_CODE 0x1B4 #define SEQUENCE_ERROR_CODE 0x1B4L
#define EXTENSION_START_CODE 0x1B5 #define EXTENSION_START_CODE 0x1B5L
#define SEQUENCE_END_CODE 0x1B7 #define SEQUENCE_END_CODE 0x1B7L
#define GROUP_START_CODE 0x1B8 #define GROUP_START_CODE 0x1B8L
/* extension start code IDs */ /* extension start code IDs */
#define SEQUENCE_EXTENSION_ID 1 #define SEQUENCE_EXTENSION_ID 1
......
...@@ -58,6 +58,9 @@ static void EndThread ( vpar_thread_t *p_vpar ); ...@@ -58,6 +58,9 @@ static void EndThread ( vpar_thread_t *p_vpar );
* Following configuration properties are used: * Following configuration properties are used:
* ?? * ??
*******************************************************************************/ *******************************************************************************/
#include "main.h"
#include "interface.h"
extern main_t* p_main;
vpar_thread_t * vpar_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_input /*, vpar_thread_t * vpar_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_input /*,
vout_thread_t *p_vout, int *pi_status */ ) vout_thread_t *p_vout, int *pi_status */ )
{ {
...@@ -93,6 +96,9 @@ vpar_thread_t * vpar_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i ...@@ -93,6 +96,9 @@ vpar_thread_t * vpar_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
p_vpar->bit_stream.fifo.buffer = 0; p_vpar->bit_stream.fifo.buffer = 0;
p_vpar->bit_stream.fifo.i_available = 0; p_vpar->bit_stream.fifo.i_available = 0;
/* FIXME !!!! */
p_vpar->p_vout = p_main->p_intf->p_vout;
/* Spawn the video parser thread */ /* Spawn the video parser thread */
if ( vlc_thread_create(&p_vpar->thread_id, "video parser", (vlc_thread_func_t)RunThread, (void *)p_vpar) ) if ( vlc_thread_create(&p_vpar->thread_id, "video parser", (vlc_thread_func_t)RunThread, (void *)p_vpar) )
{ {
......
This diff is collapsed.
...@@ -164,11 +164,10 @@ static __inline__ void NextStartCode( vpar_thread_t * p_vpar ) ...@@ -164,11 +164,10 @@ static __inline__ void NextStartCode( vpar_thread_t * p_vpar )
/* Re-align the buffer on an 8-bit boundary */ /* Re-align the buffer on an 8-bit boundary */
RealignBits( &p_vpar->bit_stream ); RealignBits( &p_vpar->bit_stream );
while( ShowBits( &p_vpar->bit_stream, 16 ) != 0 && !p_vpar->b_die ) while( ShowBits( &p_vpar->bit_stream, 24 ) != 0x01L && !p_vpar->b_die )
{ {
DumpBits( &p_vpar->bit_stream, 8 ); DumpBits( &p_vpar->bit_stream, 8 );
} }
DumpBits( &p_vpar->bit_stream, 16 );
} }
/***************************************************************************** /*****************************************************************************
...@@ -263,8 +262,9 @@ int vpar_NextSequenceHeader( vpar_thread_t * p_vpar ) ...@@ -263,8 +262,9 @@ int vpar_NextSequenceHeader( vpar_thread_t * p_vpar )
while( !p_vpar->b_die ) while( !p_vpar->b_die )
{ {
NextStartCode( p_vpar ); NextStartCode( p_vpar );
if( ShowBits( &p_vpar->bit_stream, 16 ) == SEQUENCE_HEADER_CODE ) if( ShowBits( &p_vpar->bit_stream, 32 ) == SEQUENCE_HEADER_CODE )
return 0; return 0;
DumpBits( &p_vpar->bit_stream, 8 );
} }
return 1; return 1;
} }
...@@ -294,9 +294,7 @@ int vpar_ParseHeader( vpar_thread_t * p_vpar ) ...@@ -294,9 +294,7 @@ int vpar_ParseHeader( vpar_thread_t * p_vpar )
break; break;
case PICTURE_START_CODE: case PICTURE_START_CODE:
fprintf( stderr, "begin picture\n" );
PictureHeader( p_vpar ); PictureHeader( p_vpar );
fprintf( stderr, "end picture\n" );
return 0; return 0;
break; break;
...@@ -513,8 +511,8 @@ static void GroupHeader( vpar_thread_t * p_vpar ) ...@@ -513,8 +511,8 @@ static void GroupHeader( vpar_thread_t * p_vpar )
*****************************************************************************/ *****************************************************************************/
static void PictureHeader( vpar_thread_t * p_vpar ) static void PictureHeader( vpar_thread_t * p_vpar )
{ {
static f_macroblock_type_t ppf_macroblock_type[4] = static f_macroblock_type_t ppf_macroblock_type[5] = {NULL,
{vpar_IMBType, vpar_PMBType, vpar_IMBType, vpar_PMBType,
vpar_BMBType, vpar_DMBType}; vpar_BMBType, vpar_DMBType};
int i_structure; int i_structure;
...@@ -544,7 +542,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -544,7 +542,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
/* /*
* Picture Coding Extension * Picture Coding Extension
*/ */
fprintf( stderr, "picture1\n" );
NextStartCode( p_vpar ); NextStartCode( p_vpar );
if( ShowBits( &p_vpar->bit_stream, 16 ) == EXTENSION_START_CODE ) if( ShowBits( &p_vpar->bit_stream, 16 ) == EXTENSION_START_CODE )
{ {
...@@ -616,7 +614,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -616,7 +614,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
p_vpar->picture.i_current_structure = 0; p_vpar->picture.i_current_structure = 0;
intf_DbgMsg("vpar debug: odd number of field picture."); intf_DbgMsg("vpar debug: odd number of field picture.\n");
} }
if( p_vpar->picture.i_current_structure ) if( p_vpar->picture.i_current_structure )
...@@ -657,6 +655,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -657,6 +655,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
return; return;
} }
fprintf(stderr, "begin picture\n");
/* OK, now we are sure we will decode the picture. */ /* OK, now we are sure we will decode the picture. */
#define P_picture p_vpar->picture.p_picture #define P_picture p_vpar->picture.p_picture
...@@ -722,9 +721,9 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -722,9 +721,9 @@ static void PictureHeader( vpar_thread_t * p_vpar )
DumpBits32( &p_vpar->bit_stream ); DumpBits32( &p_vpar->bit_stream );
/* Decode slice data. */ /* Decode slice data. */
SliceHeader( p_vpar, &i_mb_address, i_mb_base, i_dummy & 255 ); p_vpar->sequence.pf_slice_header( p_vpar, &i_mb_address, i_mb_base, i_dummy & 255 );
} }
/* Link referenced pictures for the decoder /* Link referenced pictures for the decoder
* They are unlinked in vpar_ReleaseMacroblock() & vpar_DestroyMacroblock() */ * They are unlinked in vpar_ReleaseMacroblock() & vpar_DestroyMacroblock() */
if( p_vpar->sequence.p_forward != NULL ) if( p_vpar->sequence.p_forward != NULL )
...@@ -739,6 +738,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -739,6 +738,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
if( p_vpar->picture.b_error ) if( p_vpar->picture.b_error )
{ {
/* Trash picture. */ /* Trash picture. */
fprintf(stderr, "Image trashee\n");
for( i_mb = 0; p_vpar->picture.pp_mb[i_mb]; i_mb++ ) for( i_mb = 0; p_vpar->picture.pp_mb[i_mb]; i_mb++ )
{ {
vpar_DestroyMacroblock( &p_vpar->vfifo, p_vpar->picture.pp_mb[i_mb] ); vpar_DestroyMacroblock( &p_vpar->vfifo, p_vpar->picture.pp_mb[i_mb] );
...@@ -759,9 +759,12 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -759,9 +759,12 @@ static void PictureHeader( vpar_thread_t * p_vpar )
/* Prepare context for the next picture. */ /* Prepare context for the next picture. */
P_picture = NULL; P_picture = NULL;
if( p_vpar->picture.i_current_structure == FRAME_STRUCTURE )
p_vpar->picture.i_current_structure = 0;
} }
else if( p_vpar->picture.i_current_structure == FRAME_STRUCTURE ) else if( p_vpar->picture.i_current_structure == FRAME_STRUCTURE )
{ {
fprintf(stderr, "Image decodee\n");
/* Frame completely parsed. */ /* Frame completely parsed. */
P_picture->i_deccount = p_vpar->sequence.i_mb_size; 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 = 0; i_mb < p_vpar->sequence.i_mb_size; i_mb++ )
...@@ -771,6 +774,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ...@@ -771,6 +774,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
/* Prepare context for the next picture. */ /* Prepare context for the next picture. */
P_picture = NULL; P_picture = NULL;
p_vpar->picture.i_current_structure = 0;
} }
#undef P_picture #undef P_picture
} }
...@@ -786,7 +790,7 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar, ...@@ -786,7 +790,7 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar,
static int pi_dc_dct_reinit[4] = {128,256,512,1024}; static int pi_dc_dct_reinit[4] = {128,256,512,1024};
int i_mb_address_save = *pi_mb_address; int i_mb_address_save = *pi_mb_address;
/* slice_vertical_position_extension and priority_breakpoint already done */ /* slice_vertical_position_extension and priority_breakpoint already done */
LoadQuantizerScale( p_vpar ); LoadQuantizerScale( p_vpar );
...@@ -818,7 +822,8 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar, ...@@ -818,7 +822,8 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar,
i_mb_base ); i_mb_base );
i_mb_address_save = *pi_mb_address; i_mb_address_save = *pi_mb_address;
} }
while( !ShowBits( &p_vpar->bit_stream, 23 ) ); while( ShowBits( &p_vpar->bit_stream, 23 ) );
NextStartCode( p_vpar );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type, boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
int i_structure ) int i_structure )
{ {
return( i_coding_type == I_CODING_TYPE );
} }
/***************************************************************************** /*****************************************************************************
......
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