Commit 2c8ca2d5 authored by Gaël Hendryckx's avatar Gaël Hendryckx

CA...

CA MAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARCHE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

--Meuuh
parent 385368db
......@@ -73,7 +73,7 @@
*******************************************************************************/
/* General debugging support */
//#define DEBUG
#define DEBUG
/* Modules specific debugging - this will produce a lot of output, but can be
* usefull to track a bug */
......@@ -273,7 +273,7 @@
#define VOUT_DISPLAY_DELAY 100000
/* Delay (in microseconds) between increments in idle levels */
#define VOUT_IDLE_DELAY 5000000
#define VOUT_IDLE_DELAY 5000000000000
/* Number of pictures required to computes the FPS rate */
#define VOUT_FPS_SAMPLES 20
......
......@@ -69,7 +69,6 @@
/* Video */
#include "video.h"
#include "video_output.h"
#include "vdec_idct.h"
#ifdef OLD_DECODER
#include "video_decoder.h"
......
......@@ -44,7 +44,7 @@
*****************************************************************************/
static void __inline__ MotionComponent( yuv_data_t * p_src, yuv_data_t * p_dest,
int i_width, int i_height, int i_x_step,
int i_select )
int i_x_stride, int i_select )
{
int i_x, i_y, i_x1, i_y1;
unsigned int i_dummy;
......@@ -102,7 +102,7 @@ static void __inline__ MotionComponent( yuv_data_t * p_src, yuv_data_t * p_dest,
{
i_dummy = p_dest[i_x+i_x1]
+ ((unsigned int)(p_src[i_x+i_x1] + 1
+ p_src[i_x+i_x1 + i_x_step]) >> 1);
+ p_src[i_x+i_x1 + i_x_stride]) >> 1);
p_dest[i_x + i_x1] = (i_dummy + 1) >> 1;
}
}
......@@ -123,7 +123,7 @@ static void __inline__ MotionComponent( yuv_data_t * p_src, yuv_data_t * p_dest,
for( i_x1 = 0; i_x1 < 8; i_x1++ )
{
p_dest[i_x+i_x1] = (unsigned int)(p_src[i_x+i_x1] + 1
+ p_src[i_x+i_x1 + i_x_step])
+ p_src[i_x+i_x1 + i_x_stride])
>> 1;
}
}
......@@ -190,8 +190,8 @@ static void __inline__ MotionComponent( yuv_data_t * p_src, yuv_data_t * p_dest,
+ ((unsigned int)(
p_src[i_x+i_x1]
+ p_src[i_x+i_x1 + 1]
+ p_src[i_x+i_x1 + i_x_step]
+ p_src[i_x+i_x1 + i_x_step + 1]
+ p_src[i_x+i_x1 + i_x_stride]
+ p_src[i_x+i_x1 + i_x_stride + 1]
+ 2) >> 2);
p_dest[i_x + i_x1] = (i_dummy + 1) >> 1;
}
......@@ -216,8 +216,8 @@ static void __inline__ MotionComponent( yuv_data_t * p_src, yuv_data_t * p_dest,
= ((unsigned int)(
p_src[i_x+i_x1]
+ p_src[i_x+i_x1 + 1]
+ p_src[i_x+i_x1 + i_x_step]
+ p_src[i_x+i_x1 + i_x_step + 1]
+ p_src[i_x+i_x1 + i_x_stride]
+ p_src[i_x+i_x1 + i_x_stride + 1]
+ 2) >> 2);
}
}
......@@ -282,6 +282,7 @@ typedef struct motion_arg_s
int i_height, i_offset;
int i_mv_x, i_mv_y;
boolean_t b_average;
int i_l_x_step, i_c_x_step;
} motion_arg_t;
/*****************************************************************************
......@@ -297,13 +298,15 @@ void vdec_MotionDummy( macroblock_t * p_mb )
*****************************************************************************/
void vdec_MotionFieldField( macroblock_t * p_mb )
{
#if 0
#if 1
motion_arg_t args;
args.i_height = 16;
args.b_average = 0;
args.b_dest_field = p_mb->b_motion_field;
args.i_offset = 0;
args.i_l_x_step = p_mb->i_l_stride;
args.i_c_x_step = p_mb->i_c_stride;
if( p_mb->i_mb_type & MB_MOTION_FORWARD )
{
......@@ -336,13 +339,15 @@ void vdec_MotionFieldField( macroblock_t * p_mb )
*****************************************************************************/
void vdec_MotionField16x8( macroblock_t * p_mb )
{
#if 0
#if 1
motion_arg_t args;
args.i_height = 8;
args.b_average = 0;
args.b_dest_field = p_mb->b_motion_field;
args.i_offset = 0;
args.i_l_x_step = p_mb->i_l_stride;
args.i_c_x_step = p_mb->i_c_stride;
if( p_mb->i_mb_type & MB_MOTION_FORWARD )
{
......@@ -441,6 +446,8 @@ void vdec_MotionFrameFrame( macroblock_t * p_mb )
args.i_height = 16;
args.b_average = 0;
args.i_offset = 0;
args.i_l_x_step = p_mb->i_l_stride;
args.i_c_x_step = p_mb->i_c_stride;
if( p_mb->i_mb_type & MB_MOTION_FORWARD )
{
......@@ -473,8 +480,8 @@ void vdec_MotionFrameField( macroblock_t * p_mb )
args.i_height = 8;
args.b_average = 0;
args.i_offset = 0;
p_mb->i_l_stride <<= 1;
p_mb->i_c_stride <<= 1;
args.i_l_x_step = p_mb->i_l_stride << 1;
args.i_c_x_step = p_mb->i_c_stride << 1;
if( p_mb->i_mb_type & MB_MOTION_FORWARD )
{
......@@ -483,14 +490,14 @@ void vdec_MotionFrameField( macroblock_t * p_mb )
args.b_source_field = p_mb->ppi_field_select[0][0];
args.b_dest_field = 0;
args.i_mv_x = p_mb->pppi_motion_vectors[0][0][0];
args.i_mv_y = p_mb->pppi_motion_vectors[0][0][1] >> 1;
args.i_mv_y = p_mb->pppi_motion_vectors[0][0][1];
p_mb->pf_chroma_motion( p_mb, &args );
#endif
#if 1
args.b_source_field = p_mb->ppi_field_select[1][0];
args.b_dest_field = 1;
args.i_mv_x = p_mb->pppi_motion_vectors[0][0][0];
args.i_mv_y = p_mb->pppi_motion_vectors[0][0][1] >> 1;
args.i_mv_x = p_mb->pppi_motion_vectors[1][0][0];
args.i_mv_y = p_mb->pppi_motion_vectors[1][0][1];
p_mb->pf_chroma_motion( p_mb, &args );
#endif
args.b_average = 1;
......@@ -503,13 +510,13 @@ void vdec_MotionFrameField( macroblock_t * p_mb )
args.b_source_field = p_mb->ppi_field_select[0][1];
args.b_dest_field = 0;
args.i_mv_x = p_mb->pppi_motion_vectors[0][1][0];
args.i_mv_y = p_mb->pppi_motion_vectors[0][1][1] >> 1;
args.i_mv_y = p_mb->pppi_motion_vectors[0][1][1];
p_mb->pf_chroma_motion( p_mb, &args );
args.b_source_field = p_mb->ppi_field_select[1][1];
args.b_dest_field = 1;
args.i_mv_x = p_mb->pppi_motion_vectors[1][1][0];
args.i_mv_y = p_mb->pppi_motion_vectors[1][1][1] >> 1;
args.i_mv_y = p_mb->pppi_motion_vectors[1][1][1];
p_mb->pf_chroma_motion( p_mb, &args );
}
#endif
......@@ -524,8 +531,8 @@ void vdec_MotionFrameDMV( macroblock_t * p_mb )
motion_arg_t args;
int ppi_dmv[2][2];
p_mb->i_l_stride <<= 1;
p_mb->i_c_stride <<= 1;
args.i_l_x_step = p_mb->i_l_stride << 1;
args.i_c_x_step = p_mb->i_c_stride << 1;
args.i_height = 8;
args.b_average = 0;
args.b_dest_field = 0;
......@@ -587,7 +594,7 @@ void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion )
/* prediction width and height */
16, p_motion->i_height,
/* step */
p_mb->i_l_stride,
p_motion->i_l_x_step, p_mb->i_l_stride,
/* select */
(p_motion->b_average << 2)
| ((p_motion->i_mv_y & 1) << 1)
......@@ -604,7 +611,8 @@ void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion )
+ (p_mb->i_c_x)
+ (p_mb->i_motion_c_y + p_motion->b_dest_field)
* p_mb->p_picture->i_chroma_width,
8, p_motion->i_height >> 1, p_mb->i_c_stride,
8, p_motion->i_height >> 1, p_motion->i_c_x_step,
p_mb->i_c_stride,
(p_motion->b_average << 2)
| (((p_motion->i_mv_y/2) & 1) << 1)
| ((p_motion->i_mv_x/2) & 1) );
......@@ -620,7 +628,8 @@ void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion )
+ (p_mb->i_c_x)
+ (p_mb->i_motion_c_y + p_motion->b_dest_field)
* p_mb->p_picture->i_chroma_width,
8, p_motion->i_height >> 1, p_mb->i_c_stride,
8, p_motion->i_height >> 1, p_motion->i_c_x_step,
p_mb->i_c_stride,
(p_motion->b_average << 2)
| (((p_motion->i_mv_y/2) & 1) << 1)
| ((p_motion->i_mv_x/2) & 1) );
......@@ -631,6 +640,7 @@ void vdec_Motion420( macroblock_t * p_mb, motion_arg_t * p_motion )
*****************************************************************************/
void vdec_Motion422( macroblock_t * p_mb, motion_arg_t * p_motion )
{
#if 0
/* Luminance */
MotionComponent( p_motion->p_source->p_y
+ (p_mb->i_l_x + (p_motion->i_mv_x >> 1))
......@@ -678,6 +688,7 @@ void vdec_Motion422( macroblock_t * p_mb, motion_arg_t * p_motion )
(p_motion->b_average << 2)
| ((p_motion->i_mv_y & 1) << 1)
| ((p_motion->i_mv_x/2) & 1) );
#endif
}
/*****************************************************************************
......@@ -685,6 +696,7 @@ void vdec_Motion422( macroblock_t * p_mb, motion_arg_t * p_motion )
*****************************************************************************/
void vdec_Motion444( macroblock_t * p_mb, motion_arg_t * p_motion )
{
#if 0
/* Luminance */
MotionComponent( p_motion->p_source->p_y
+ (p_mb->i_l_x + (p_motion->i_mv_x >> 1))
......@@ -732,4 +744,5 @@ void vdec_Motion444( macroblock_t * p_mb, motion_arg_t * p_motion )
(p_motion->b_average << 2)
| ((p_motion->i_mv_y & 1) << 1)
| (p_motion->i_mv_x & 1) );
#endif
}
......@@ -256,7 +256,7 @@ 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( !p_mb->b_P_coding_type ) {
/* luminance */
for( i_b = 0; i_b < 4; i_b++ )
{
......@@ -288,7 +288,7 @@ if( !p_mb->b_P_coding_type ) {
(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 );
}
}
/*
* Decoding is finished, release the macroblock and free
* unneeded memory.
......
......@@ -147,7 +147,7 @@ void vpar_ReleaseMacroblock( video_fifo_t * p_fifo, macroblock_t * p_mb )
/* Test if it was the last block of the picture */
if( b_finished )
{
fprintf(stderr, "Image decodee\n");
//fprintf(stderr, "Image decodee\n");
/* Mark the picture to be displayed */
vout_DisplayPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
......
......@@ -704,6 +704,7 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar,
p_mb->pf_motion = pf_motion[p_vpar->picture.b_frame_structure]
[p_vpar->mb.i_motion_type];
}
p_vpar->mb.i_mv_count = ppi_mv_count[p_vpar->picture.b_frame_structure]
[p_vpar->mb.i_motion_type];
p_vpar->mb.i_mv_format = ppi_mv_format[p_vpar->picture.b_frame_structure]
......@@ -767,7 +768,7 @@ i_count++;
static int pi_dc_dct_reinit[4] = {128,256,512,1024};
static f_motion_t pf_motion_skipped[4] = {NULL, vdec_MotionFieldField,
vdec_MotionFieldField, vdec_MotionFrameFrame};
fprintf(stderr, "On sauuuute !\n");
/* Reset DC predictors (7.2.1). */
p_vpar->slice.pi_dc_dct_pred[0] = p_vpar->slice.pi_dc_dct_pred[1]
= p_vpar->slice.pi_dc_dct_pred[2]
......@@ -799,6 +800,7 @@ fprintf(stderr, "On sauuuute !\n");
/* Motion type is picture structure. */
p_mb->pf_motion = pf_motion_skipped[p_vpar->picture.i_structure];
p_mb->i_mb_type = MB_MOTION_FORWARD;
memset( p_mb->pppi_motion_vectors, 0, 8*sizeof(int) );
/* Set the field we use for motion compensation */
p_mb->ppi_field_select[0][0] = p_mb->ppi_field_select[0][1]
......@@ -1272,7 +1274,6 @@ if( i_parse >= 64 )
p_mb->ppi_blocks[i_b][i_pos] = b_sign ? -i_level : i_level;
}
fprintf( stderr, "Non intra MPEG2 end (%d)\n", i_b );
exit(0);
//p_vpar->picture.b_error = 1;
}
......@@ -1513,6 +1514,5 @@ if( i_parse >= 64 )
}
fprintf( stderr, "MPEG2 end (%d)\n", i_b );
exit(0);
//p_vpar->b_error = 1;
}
......@@ -530,8 +530,6 @@ static void PictureHeader( vpar_thread_t * p_vpar )
[p_vpar->picture.i_coding_type];
RemoveBits( &p_vpar->bit_stream, 16 ); /* vbv_delay */
fprintf( stderr, "coding type: %d\n", p_vpar->picture.i_coding_type );
if( p_vpar->picture.i_coding_type == P_CODING_TYPE || p_vpar->picture.i_coding_type == B_CODING_TYPE )
{
p_vpar->picture.pb_full_pel_vector[0] = GetBits( &p_vpar->bit_stream, 1 );
......@@ -755,7 +753,7 @@ memset( P_picture->p_data, 0, (p_vpar->sequence.i_mb_size*384));
if( p_vpar->picture.b_error )
{
/* Trash picture. */
fprintf(stderr, "Image trashee\n");
//fprintf(stderr, "Image trashee\n");
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] );
......@@ -771,7 +769,7 @@ fprintf(stderr, "Image trashee\n");
}
else if( p_vpar->picture.i_current_structure == FRAME_STRUCTURE )
{
fprintf(stderr, "Image parsee (%d)\n", p_vpar->picture.i_coding_type);
//fprintf(stderr, "Image parsee (%d)\n", p_vpar->picture.i_coding_type);
/* Frame completely parsed. */
for( i_mb = 1; p_vpar->picture.pp_mb[i_mb] != NULL; i_mb++ )
{
......
......@@ -145,13 +145,13 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
int i_structure )
{
static int meuh = 0;
static int meuh = 1;
static int truc = 0;
// return( 1 );
if( i_coding_type == 1 )
meuh = 0;
if( i_coding_type == 2 )
meuh++;
// if( i_coding_type == 1 )
// meuh = 0;
// if( i_coding_type == 2 )
// meuh++;
truc++;
if( truc == 3 )
{
......
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