From ea23960c2d7f556ba049c4d603688ca408a0101d Mon Sep 17 00:00:00 2001 From: Christophe Massiot Date: Tue, 4 Jan 2000 00:01:05 +0000 Subject: [PATCH] =?utf8?q?video=5Ffifo.c=20et=20vpar=5Fheaders.c=20compile?= =?utf8?q?nt=20=EF=BF=BD=20peu=20pr=EF=BF=BDs.=20Correction=20d'environ=20?= =?utf8?q?4212=20fautes=20de=20frappe.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- include/video_fifo.h | 4 +- include/vpar_blocks.h | 12 +++ include/vpar_headers.h | 9 +- src/video_parser/video_fifo.c | 67 ++++++++------- src/video_parser/vpar_headers.c | 148 ++++++++++++++++++-------------- 5 files changed, 139 insertions(+), 101 deletions(-) diff --git a/include/video_fifo.h b/include/video_fifo.h index a8021179cb..d72c728ee0 100644 --- a/include/video_fifo.h +++ b/include/video_fifo.h @@ -31,7 +31,7 @@ ***************************************************************************** * This rotative FIFO contains undecoded macroblocks that are to be decoded *****************************************************************************/ -struct video_parser_s; +struct vpar_thread_s; typedef struct video_fifo_s { @@ -43,7 +43,7 @@ typedef struct video_fifo_s int i_start; int i_end; - struct video_parser_s * p_vpar; + struct vpar_thread_s * p_vpar; } video_fifo_t; /***************************************************************************** diff --git a/include/vpar_blocks.h b/include/vpar_blocks.h index 321e5553fe..470503312d 100644 --- a/include/vpar_blocks.h +++ b/include/vpar_blocks.h @@ -77,3 +77,15 @@ typedef struct #define MOTION_FRAME 2 #define MOTION_16X8 2 #define MOTION_DMV 3 + +/***************************************************************************** + * Prototypes + *****************************************************************************/ +void vpar_CodedPattern420( struct vpar_thread_s* p_vpar ); +void vpar_CodedPattern422( struct vpar_thread_s* p_vpar ); +void 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 ); + diff --git a/include/vpar_headers.h b/include/vpar_headers.h index 90140dd9e8..18c3d702cd 100644 --- a/include/vpar_headers.h +++ b/include/vpar_headers.h @@ -20,7 +20,9 @@ *****************************************************************************/ struct vpar_thread_s; -typedef void (*f_slice_header_t)( struct vpar_thread_s*, int*, int, elem_t*, u32); +typedef void (*f_slice_header_t)( struct vpar_thread_s*, int*, int, u32); +typedef void (*f_chroma_pattern_t)( struct vpar_thread_s* ); +typedef int (*f_macroblock_type_t)( struct vpar_thread_s* ); /***************************************************************************** * quant_matrix_t : Quantization Matrix @@ -53,7 +55,7 @@ typedef struct sequence_s quant_matrix_t intra_quant, nonintra_quant; quant_matrix_t chroma_intra_quant, chroma_nonintra_quant; void (*pf_decode_mv)( struct vpar_thread_s *, int ); - void (*pf_decode_pattern)( struct vpar_thread_s * ); + f_chroma_pattern_t pf_decode_pattern; /* Parser context */ picture_t * p_forward; @@ -79,6 +81,7 @@ typedef struct picture_parsing_s int ppi_f_code[2][2]; int i_intra_dc_precision; boolean_t b_frame_pred_frame_dct, b_q_scale_type; + boolean_t b_intra_vlc_format; boolean_t b_alternate_scan, b_progressive_frame; boolean_t b_top_field_first, b_concealment_mv; boolean_t b_repeat_first_field; @@ -93,7 +96,7 @@ typedef struct picture_parsing_s /* Relative to the current field */ int i_coding_type, i_structure; boolean_t b_frame_structure; - int (*pf_macroblock_type)( struct vpar_thread_s * ); + f_macroblock_type_t pf_macroblock_type; boolean_t b_error; } picture_parsing_t; diff --git a/src/video_parser/video_fifo.c b/src/video_parser/video_fifo.c index 0831aa4623..5f680dbcb0 100644 --- a/src/video_parser/video_fifo.c +++ b/src/video_parser/video_fifo.c @@ -28,11 +28,15 @@ #include "decoder_fifo.h" #include "video.h" #include "video_output.h" -#include "video_parser.h" -#include "macroblock.h" -#include "video_fifo.h" +#include "vdec_idct.h" #include "video_decoder.h" +#include "vdec_motion.h" + +#include "vpar_blocks.h" +#include "vpar_headers.h" +#include "video_fifo.h" +#include "video_parser.h" /***************************************************************************** * vpar_InitFIFO : initialize the video FIFO @@ -42,19 +46,20 @@ void vpar_InitFIFO( vpar_thread_t * p_vpar ) int i_dummy; /* Initialize mutex and cond */ - vlc_mutex_init( p_vpar->vfifo.lock ); - vlc_cond_init( p_vpar->vfifo.wait ); - vlc_mutex_init( p_vpar->vbuffer.lock ); + vlc_mutex_init( &p_vpar->vfifo.lock ); + vlc_cond_init( &p_vpar->vfifo.wait ); + vlc_mutex_init( &p_vpar->vbuffer.lock ); /* Initialize FIFO properties */ p_vpar->vfifo.i_start = p_vpar->vfifo.i_end = 0; p_vpar->vfifo.p_vpar = p_vpar; /* Initialize buffer properties */ - i_index = VFIFO_SIZE; /* all structures are available */ + p_vpar->vbuffer.i_index = VFIFO_SIZE; /* all structures are available */ for( i_dummy = 0; i_dummy < VFIFO_SIZE + 1; i_dummy++ ) { - p_vpar->vfifo.pp_mb_free[i_dummy] = p_vpar->vfifo.p_macroblocks + i; + p_vpar->vbuffer.pp_mb_free[i_dummy] = p_vpar->vbuffer.p_macroblocks + + i_dummy; } } @@ -91,18 +96,18 @@ macroblock_t * vpar_NewMacroblock( video_fifo_t * p_fifo ) { macroblock_t * p_mb; -#define P_buffer p_fifo->p_vpar.vbuffer - vlc_mutex_lock( &P_buffer->lock ); +#define P_buffer p_fifo->p_vpar->vbuffer + vlc_mutex_lock( &P_buffer.lock ); if( P_buffer.i_index == -1 ) { /* No more structures available. This should not happen ! */ return NULL; } - p_mb = P_buffer->pp_undec_free[ P_buffer->i_index-- ]; -#undef P_buffer + p_mb = P_buffer.pp_mb_free[ P_buffer.i_index-- ]; - vlc_mutex_unlock( &P_buffer->lock ); + vlc_mutex_unlock( &P_buffer.lock ); +#undef P_buffer return( p_mb ); } @@ -117,7 +122,7 @@ void vpar_DecodeMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb ) /* By construction, the video FIFO cannot be full */ VIDEO_FIFO_END( *p_fifo ) = p_mb; VIDEO_FIFO_INCEND( *p_fifo ); - + vlc_mutex_unlock( &p_fifo->lock ); } @@ -130,19 +135,19 @@ void vpar_ReleaseMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb ) /* Unlink referenced pictures */ if( p_mb->p_forw_top != NULL ) { - vout_UnlinkPicture( p_fifo->p_vpar.p_vout, p_mb->p_forw_top ); + vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forw_top ); } if( p_mb->p_backw_top != NULL ) { - vout_UnlinkPicture( p_fifo->p_vpar.p_vout, p_mb->p_backw_top ); + vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backw_top ); } if( p_mb->p_forw_bot != NULL ) { - vout_UnlinkPicture( p_fifo->p_vpar.p_vout, p_mb->p_forw_bot ); + vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forw_bot ); } if( p_mb->p_backw_bot != NULL ) { - vout_UnlinkPicture( p_fifo->p_vpar.p_vout, p_mb->p_backw_bot ); + vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backw_bot ); } /* Unlink picture buffer */ @@ -151,7 +156,7 @@ void vpar_ReleaseMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb ) if( p_mb->p_picture->i_deccount == 0 ) { /* Mark the picture to be displayed */ - vout_DisplayPicture( p_fifo->p_vpar.p_vout, p_mb->p_picture ); + vout_DisplayPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture ); /* Warn Synchro for its records. */ vpar_SynchroEnd( p_fifo->p_vpar ); @@ -159,10 +164,10 @@ void vpar_ReleaseMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb ) vlc_mutex_unlock( & p_mb->p_picture->lock_deccount ); /* Release the macroblock_t structure */ -#define P_buffer p_fifo->p_vpar.vbuffer - vlc_mutex_lock( &P_buffer->lock ); - P_buffer->pp_mb_free[ ++P_buffer->i_index ] = p_mb; - vlc_mutex_unlock( &P_buffer->lock ); +#define P_buffer p_fifo->p_vpar->vbuffer + vlc_mutex_lock( &P_buffer.lock ); + P_buffer.pp_mb_free[ ++P_buffer.i_index ] = p_mb; + vlc_mutex_unlock( &P_buffer.lock ); #undef P_buffer } @@ -174,25 +179,25 @@ void vpar_DestroyMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb ) /* Unlink referenced pictures */ if( p_mb->p_forw_top != NULL ) { - vout_UnlinkPicture( p_fifo->p_vpar.p_vout, p_mb->p_forw_top ); + vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forw_top ); } if( p_mb->p_backw_top != NULL ) { - vout_UnlinkPicture( p_fifo->p_vpar.p_vout, p_mb->p_backw_top ); + vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backw_top ); } if( p_mb->p_forw_bot != NULL ) { - vout_UnlinkPicture( p_fifo->p_vpar.p_vout, p_mb->p_forw_bot ); + vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forw_bot ); } if( p_mb->p_backw_bot != NULL ) { - vout_UnlinkPicture( p_fifo->p_vpar.p_vout, p_mb->p_backw_bot ); + vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backw_bot ); } /* Release the macroblock_t structure */ -#define P_buffer p_fifo->p_vpar.vbuffer - vlc_mutex_lock( &P_buffer->lock ); - P_buffer->pp_mb_free[ ++P_buffer->i_index ] = p_mb; - vlc_mutex_unlock( &P_buffer->lock ); +#define P_buffer p_fifo->p_vpar->vbuffer + vlc_mutex_lock( &P_buffer.lock ); + P_buffer.pp_mb_free[ ++P_buffer.i_index ] = p_mb; + vlc_mutex_unlock( &P_buffer.lock ); #undef P_buffer } diff --git a/src/video_parser/vpar_headers.c b/src/video_parser/vpar_headers.c index 8ebded6071..fbd26a5a11 100644 --- a/src/video_parser/vpar_headers.c +++ b/src/video_parser/vpar_headers.c @@ -28,41 +28,54 @@ #include "decoder_fifo.h" #include "video.h" #include "video_output.h" -#include "vpar_blocks.h" -#include "video_parser.h" -#include "macroblock.h" -#include "video_fifo.h" +#include "vdec_idct.h" #include "video_decoder.h" +#include "vdec_motion.h" + +#include "vpar_blocks.h" +#include "vpar_headers.h" +#include "video_fifo.h" +#include "video_parser.h" /* * Local prototypes */ static __inline__ void NextStartCode( vpar_thread_t * p_vpar ); -static void GroupHeader( vpar_thread_t * p_vpar ) -static void PictureHeader( vpar_thread_t * p_vpar ) +static void SequenceHeader( vpar_thread_t * p_vpar ); +static void GroupHeader( vpar_thread_t * p_vpar ); +static void PictureHeader( vpar_thread_t * p_vpar ); static void __inline__ ReferenceUpdate( vpar_thread_t * p_vpar, int i_coding_type, - picture_t * p_newref ) + picture_t * p_newref ); static void __inline__ ReferenceReplace( vpar_thread_t * p_vpar, int i_coding_type, - picture_t * p_newref ) + picture_t * p_newref ); static void SliceHeader00( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_base, - elem_t * p_y, p_u, p_v, u32 i_vert_code ) + u32 i_vert_code ); static void SliceHeader01( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_base, - elem_t * p_y, p_u, p_v, u32 i_vert_code ) + u32 i_vert_code ); static void SliceHeader10( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_base, - elem_t * p_y, p_u, p_v, u32 i_vert_code ) + u32 i_vert_code ); static void SliceHeader11( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_base, - elem_t * p_y, p_u, p_v, u32 i_vert_code ) + u32 i_vert_code ); static __inline__ void SliceHeader( vpar_thread_t * p_vpar, int * pi_mb_address, int i_mb_base, - elem_t * p_y, p_u, p_v, u32 i_vert_code ) -static void ExtensionAndUserData( vpar_thread_t * p_vpar ) + u32 i_vert_code ); +static void ExtensionAndUserData( vpar_thread_t * p_vpar ); +static void QuantMatrixExtension( vpar_thread_t * p_vpar ); +static void SequenceScalableExtension( vpar_thread_t * p_vpar ); +static void SequenceDisplayExtension( vpar_thread_t * p_vpar ); +static void PictureDisplayExtension( vpar_thread_t * p_vpar ); +static void PictureSpatialScalableExtension( vpar_thread_t * p_vpar ); +static void PictureTemporalScalableExtension( vpar_thread_t * p_vpar ); +static void CopyrightExtension( vpar_thread_t * p_vpar ); +static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_matrix ); +static __inline__ void LinkMatrix( quant_matrix_t * p_matrix, int * pi_array ); /***************************************************************************** * vpar_NextSequenceHeader : Find the next sequence header @@ -72,7 +85,7 @@ int vpar_NextSequenceHeader( vpar_thread_t * p_vpar ) while( !p_vpar->b_die ) { NextStartCode( p_vpar ); - if( ShowBits( &p_vpar->bit_stream, 32 ) == SEQUENCE_START_CODE ) + if( ShowBits( &p_vpar->bit_stream, 32 ) == SEQUENCE_HEADER_CODE ) return 0; } return 1; @@ -158,20 +171,20 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) i_height_save = p_vpar->sequence.i_height; i_width_save = p_vpar->sequence.i_width; - p_vpar->sequence.i_height = GetBits( p_vpar->bit_stream, 12 ); - p_vpar->sequence.i_width = GetBits( p_vpar->bit_stream, 12 ); - p_vpar->sequence.i_ratio = GetBits( p_vpar->bit_stream, 4 ); + p_vpar->sequence.i_height = GetBits( &p_vpar->bit_stream, 12 ); + p_vpar->sequence.i_width = GetBits( &p_vpar->bit_stream, 12 ); + p_vpar->sequence.i_aspect_ratio = GetBits( &p_vpar->bit_stream, 4 ); p_vpar->sequence.d_frame_rate = - d_frame_rate_table( GetBits( p_vpar->bit_stream, 4 ) ); + d_frame_rate_table[ GetBits( &p_vpar->bit_stream, 4 ) ]; /* We don't need bit_rate_value, marker_bit, vbv_buffer_size, * constrained_parameters_flag */ - DumpBits( p_vpar->bit_stream, 30 ); + DumpBits( &p_vpar->bit_stream, 30 ); /* * Quantization matrices */ - if( GetBits( p_vpar->bit_stream, 1 ) ) /* load_intra_quantizer_matrix */ + if( GetBits( &p_vpar->bit_stream, 1 ) ) /* load_intra_quantizer_matrix */ { LoadMatrix( p_vpar, &p_vpar->sequence.intra_quant ); } @@ -181,7 +194,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) LinkMatrix( &p_vpar->sequence.intra_quant, pi_default_intra_quant ); } - if( GetBits( p_vpar->bit_stream, 1 ) ) /* load_non_intra_quantizer_matrix */ + if( GetBits( &p_vpar->bit_stream, 1 ) ) /* load_non_intra_quantizer_matrix */ { LoadMatrix( p_vpar, &p_vpar->sequence.nonintra_quant ); } @@ -204,9 +217,9 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) NextStartCode( p_vpar ); if( ShowBits( &p_vpar->bit_stream, 32 ) == EXTENSION_START_CODE ) { - int i_dummy; - static int pi_chroma_nb_blocks[4] = {0, 1, 2, 4}; - static (void *) ppf_chroma_pattern[4]( vpar_thread_t * ) = + int i_dummy; + static int pi_chroma_nb_blocks[4] = {0, 1, 2, 4}; + static f_chroma_pattern_t ppf_chroma_pattern[4] = {NULL, vpar_CodedPattern420, vpar_CodedPattern422, vpar_CodedPattern444}; @@ -239,7 +252,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) /* It's an MPEG-1 stream. Put adequate parameters. */ p_vpar->sequence.b_progressive = 1; p_vpar->sequence.i_chroma_format = CHROMA_420; - p_vpar->sequence.i_chroma_width = p_vpar->sequence.i->width >> 2; + p_vpar->sequence.i_chroma_width = p_vpar->sequence.i_width >> 2; p_vpar->sequence.i_chroma_nb_blocks = 2; p_vpar->sequence.pf_decode_pattern = vpar_CodedPattern420; @@ -282,10 +295,9 @@ static void SequenceHeader( vpar_thread_t * p_vpar ) } if( p_vpar->sequence.i_width != i_width_save - || p_vpar->sequence.i_height != i_height_save - || p_vpar->sequence.p_frame_lum_lookup == NULL ) + || p_vpar->sequence.i_height != i_height_save ) { - + /* What do we do in case of a size change ??? */ } /* Extension and User data */ @@ -307,7 +319,8 @@ static void GroupHeader( vpar_thread_t * p_vpar ) *****************************************************************************/ static void PictureHeader( vpar_thread_t * p_vpar ) { - static (int *) ppf_macroblock_type[4] = {vpar_IMBType, vpar_PMBType, + static f_macroblock_type_t ppf_macroblock_type[4] = + {vpar_IMBType, vpar_PMBType, vpar_BMBType, vpar_DMBType}; int i_structure; @@ -358,7 +371,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) p_vpar->picture.b_q_scale_type = GetBits( &p_vpar->bit_stream, 1 ); p_vpar->picture.b_intra_vlc_format = GetBits( &p_vpar->bit_stream, 1 ); p_vpar->picture.b_alternate_scan = GetBits( &p_vpar->bit_stream, 1 ); - p_vpar->picture.b_repeat_first_field = GetBits( &vpar->bit_stream, 1 ); + p_vpar->picture.b_repeat_first_field = GetBits( &p_vpar->bit_stream, 1 ); /* repeat_first_field (ISO/IEC 13818-2 6.3.10 is necessary to know * the length of the picture_display_extension structure. * chroma_420_type (obsolete) */ @@ -376,15 +389,15 @@ static void PictureHeader( vpar_thread_t * p_vpar ) else { /* MPEG-1 compatibility flags */ - p_vpar->i_intra_dc_precision = 0; /* 8 bits */ + p_vpar->picture.i_intra_dc_precision = 0; /* 8 bits */ i_structure = FRAME_STRUCTURE; - p_vpar->b_frame_pred_frame_dct = TRUE; + p_vpar->picture.b_frame_pred_frame_dct = 1; p_vpar->picture.b_concealment_mv = 0; p_vpar->picture.b_q_scale_type = 0; p_vpar->picture.b_intra_vlc_format = 0; p_vpar->picture.b_alternate_scan = 0; /* zigzag */ - b_repeat_first_field = FALSE; - p_vpar->picture.b_progressive_frame = TRUE; + p_vpar->picture.b_repeat_first_field = 0; + p_vpar->picture.b_progressive_frame = 1; } if( p_vpar->picture.i_current_structure && @@ -392,10 +405,10 @@ static void PictureHeader( vpar_thread_t * p_vpar ) i_structure == p_vpar->picture.i_current_structure) ) { /* We don't have the second field of the buffered frame. */ - if( p_pvar->picture.p_picture != NULL ) + if( p_vpar->picture.p_picture != NULL ) { ReferenceReplace( p_vpar, - p_vpar->picture.p_second_field_buffer->i_coding_type, + p_vpar->picture.i_coding_type, NULL ); for( i_mb = 0; i_mb < p_vpar->sequence.i_mb_size >> 1; i_mb++ ) @@ -406,7 +419,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) vout_DestroyPicture( p_vpar->p_vout, p_vpar->picture.p_picture ); } - p_pvar->picture.i_current_structure = 0; + p_vpar->picture.i_current_structure = 0; intf_DbgMsg("vpar debug: odd number of field picture."); } @@ -415,28 +428,32 @@ static void PictureHeader( vpar_thread_t * p_vpar ) { /* Second field of a frame. We will decode it if, and only if we * have decoded the first frame. */ - b_parsable = (p_vpar->picture.p_second_field_buffer != NULL); + b_parsable = (p_vpar->picture.p_picture != NULL); } else { /* Do we have the reference pictures ? */ - b_parsable = !((i_coding_type == P_CODING_TYPE) && + b_parsable = !((p_vpar->picture.i_coding_type == P_CODING_TYPE) && (p_vpar->sequence.p_forward == NULL)) || - ((i_coding_type == B_CODING_TYPE) && + ((p_vpar->picture.i_coding_type == B_CODING_TYPE) && (p_vpar->sequence.p_forward == NULL || p_vpar->sequence.p_backward == NULL)); - /* Does synchro say we have enough time to decode it ? */ - b_parsable &&= vpar_SynchroChoose( p_vpar, i_coding_type, i_structure ); + if( b_parsable ) + { + /* Does synchro say we have enough time to decode it ? */ + b_parsable = vpar_SynchroChoose( p_vpar, + p_vpar->picture.i_coding_type, i_structure ); + } } if( !b_parsable ) { /* Update the reference pointers. */ - ReferenceUpdate( p_vpar, i_coding_type, NULL ); + ReferenceUpdate( p_vpar, p_vpar->picture.i_coding_type, NULL ); /* Warn Synchro we have trashed a picture. */ - vpar_SynchroTrash( p_vpar, i_coding_type, i_structure ); + vpar_SynchroTrash( p_vpar, p_vpar->picture.i_coding_type, i_structure ); /* Update context. */ if( i_structure != FRAME_STRUCTURE ) @@ -448,7 +465,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) /* OK, now we are sure we will decode the picture. */ #define P_picture p_vpar->picture.p_picture - p_vpar->picture.b_error = FALSE; + p_vpar->picture.b_error = 0; if( !p_vpar->picture.i_current_structure ) { @@ -460,7 +477,8 @@ static void PictureHeader( vpar_thread_t * p_vpar ) p_vpar->sequence.i_chroma_format ); /* Initialize values. */ - P_picture->date = vpar_SynchroDecode( p_vpar, i_coding_type, + P_picture->date = vpar_SynchroDecode( p_vpar, + p_vpar->picture.i_coding_type, i_structure ); p_vpar->picture.i_lum_incr = - 8 + ( p_vpar->sequence.i_width << ( i_structure != FRAME_STRUCTURE ) ); @@ -469,7 +487,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) ( 3 - p_vpar->sequence.i_chroma_format )) ); /* Update the reference pointers. */ - ReferenceUpdate( p_vpar, i_coding_type, p_picture ); + ReferenceUpdate( p_vpar, p_vpar->picture.i_coding_type, P_picture ); } p_vpar->picture.i_current_structure |= i_structure; p_vpar->picture.i_structure = i_structure; @@ -499,7 +517,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) (i_dummy > SLICE_START_CODE_MAX) ) { intf_DbgMsg("vpar debug: premature end of picture"); - p_vpar->picture.b_error = TRUE; + p_vpar->picture.b_error = 1; break; } DumpBits32( &p_vpar->bit_stream ); @@ -520,7 +538,7 @@ static void PictureHeader( vpar_thread_t * p_vpar ) vout_DestroyPicture( p_vpar->p_vout, P_picture ); /* Prepare context for the next picture. */ - P_picture = NULL: + P_picture = NULL; } else if( p_vpar->picture.i_current_structure == FRAME_STRUCTURE ) { @@ -640,8 +658,8 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar, /* Reset DC coefficients predictors (ISO/IEC 13818-2 7.2.1). Why * does the reference decoder put 0 instead of the normative values ? */ - p_vpar->slice.pi_dct_pred[0] = p_vpar->slice.pi_dct_pred[1] - = p_vpar->slice.pi_dct_pred[2] + p_vpar->slice.pi_dc_dct_pred[0] = p_vpar->slice.pi_dc_dct_pred[1] + = p_vpar->slice.pi_dc_dct_pred[2] = pi_dc_dct_reinit[p_vpar->picture.i_intra_dc_precision]; /* Reset motion vector predictors (ISO/IEC 13818-2 7.6.3.4). */ @@ -747,7 +765,7 @@ static void QuantMatrixExtension( vpar_thread_t * p_vpar ) if( GetBits( &p_vpar->bit_stream, 1 ) ) { /* Load non_intra_quantiser_matrix for luminance. */ - LoadMatrix( p_vpar, &p_vpar->sequence.non_intra_quant ); + LoadMatrix( p_vpar, &p_vpar->sequence.nonintra_quant ); } else { @@ -764,7 +782,7 @@ static void QuantMatrixExtension( vpar_thread_t * p_vpar ) { /* Link the chrominance intra matrix to the luminance one. */ LinkMatrix( &p_vpar->sequence.chroma_intra_quant, - &p_vpar->sequence.intra_quant ); + p_vpar->sequence.intra_quant.pi_matrix ); } if( GetBits( &p_vpar->bit_stream, 1 ) ) { @@ -775,7 +793,7 @@ static void QuantMatrixExtension( vpar_thread_t * p_vpar ) { /* Link the chrominance intra matrix to the luminance one. */ LinkMatrix( &p_vpar->sequence.chroma_intra_quant, - &p_vpar->sequence.intra_quant ); + p_vpar->sequence.intra_quant.pi_matrix ); } if( GetBits( &p_vpar->bit_stream, 1 ) ) { @@ -786,7 +804,7 @@ static void QuantMatrixExtension( vpar_thread_t * p_vpar ) { /* Link the chrominance nonintra matrix to the luminance one. */ LinkMatrix( &p_vpar->sequence.chroma_nonintra_quant, - &p_vpar->sequence.nonintra_quant ); + p_vpar->sequence.nonintra_quant.pi_matrix ); } } @@ -860,7 +878,7 @@ static void PictureTemporalScalableExtension( vpar_thread_t * p_vpar ) * CopyrightExtension : Keeps some legal informations * *****************************************************************************/ -static void CopytrightExtension( vpar_thread_t * p_vpar ) +static void CopyrightExtension( vpar_thread_t * p_vpar ) { u32 i_copyright_nb_1, i_copyright_nb_2; /* local integers */ p_vpar->sequence.b_copyright_flag = GetBits( &p_vpar->bit_stream, 1 ); @@ -878,16 +896,16 @@ static void CopytrightExtension( vpar_thread_t * p_vpar ) i_copyright_nb_2 = GetBits( &p_vpar->bit_stream, 22 ); DumpBits( &p_vpar->bit_stream, 1 ); /* third part and sum */ - p_vpar->sequence.i_copyright_nb = ( i_copyright_nb_1 << 44 ) + - ( i_copyright_nb_2 << 22 ) + - ( GetBits( &p_vpar->bit_stream, 22 ) ); + p_vpar->sequence.i_copyright_nb = ( (u64)i_copyright_nb_1 << 44 ) + + ( (u64)i_copyright_nb_2 << 22 ) + + ( (u64)GetBits( &p_vpar->bit_stream, 22 ) ); } /***************************************************************************** * LoadMatrix : Load a quantization matrix *****************************************************************************/ -static void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_matrix ) +static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_matrix ) { int i_dummy; @@ -895,13 +913,13 @@ static void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_matrix ) { /* Allocate a piece of memory to load the matrix. */ p_matrix->pi_matrix = (int *)malloc( 64*sizeof(int) ); - p_matrix->b_allocated = TRUE; + p_matrix->b_allocated = 1; } for( i_dummy = 0; i_dummy < 64; i_dummy++ ) { p_matrix->pi_matrix[pi_scan[SCAN_ZIGZAG][i_dummy]] - = GetBits( p_vpar->bit_stream, 8 ); + = GetBits( &p_vpar->bit_stream, 8 ); } #ifdef FOURIER_IDCT @@ -914,7 +932,7 @@ static void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_matrix ) /***************************************************************************** * LinkMatrix : Link a quantization matrix to another *****************************************************************************/ -static void LinkMatrix( quant_matrix_t * p_matrix, int * pi_array ) +static __inline__ void LinkMatrix( quant_matrix_t * p_matrix, int * pi_array ) { int i_dummy; @@ -922,7 +940,7 @@ static void LinkMatrix( quant_matrix_t * p_matrix, int * pi_array ) { /* Deallocate the piece of memory. */ free( p_matrix->pi_matrix ); - p_matrix->b_allocated = FALSE; + p_matrix->b_allocated = 0; } p_matrix->pi_matrix = pi_array; -- 2.39.5