Commit f6268f60 authored by Sam Hocevar's avatar Sam Hocevar

* vlc.init becomes ~/.vlcrc

  * removed float operations in the video decoder, and all emms asm functions
  * borrowed linuxvideo's MMX motion compensation
  * fixed an undefined symbol in the MMX YUV plugin

Meuuh & Sam.
parent 52d7937c
......@@ -2,8 +2,7 @@
Rgis Duchesne <regis@via.ecp.fr>
Michel Lespinasse <walken@wrs.com>
Olivier Baxa <oli@via.ecp.fr>
Eric Estievenart <eric@via.ecp.fr>
Olivier Pomel <pomel@via.ecp.fr>
Jean-Philippe Grimaldi <jeanphi@via.ecp.fr>
Andres Krapf <dae@via.ecp.fr>
......@@ -14,11 +13,9 @@
Jean-Marc Dressler <polux@via.ecp.fr>
Gal Hendryckx <jimmy@via.ecp.fr>
Samuel Hocevar <sam@via.ecp.fr>
Brieuc Jeunhomme <bbp@via.ecp.fr>
Michel Kaempf <maxx@via.ecp.fr>
Stphane Borel <stef@via.ecp.fr>
Renaud Dartus <reno@via.ecp.fr>
Henri Fallon <henri@via.ecp.fr>
Contributors include Aaron Holtzman for his ac3dec decoder, and the
LiViD team for a few lines of code we borrowed here and there.
......@@ -5,6 +5,10 @@
* "gvlc", "fbvlc", "ggivlc" aliases now work
* fixed functions that weren't properly inlined
* removed bloat from the MMX YUV plugin
* vlc.init becomes ~/.vlcrc
* removed float operations in the video decoder, and all emms asm functions
* borrowed linuxvideo's MMX motion compensation
* fixed an undefined symbol in the MMX YUV plugin
Thu Jul 20 15:14:06 CEST 2000
0.1.99e :
......
......@@ -207,10 +207,16 @@ video_parser_obj = video_parser/video_parser.o \
video_parser/vpar_synchro.o \
video_parser/video_fifo.o
ifneq (,$(findstring mmx,$(ARCH)))
vdec_motion_inner = video_decoder/vdec_motion_inner_mmx.o
else
vdec_motion_inner = video_decoder/vdec_motion_inner.o
endif
video_decoder_obj = video_decoder/video_decoder.o \
video_decoder/vdec_motion.o \
video_decoder/vdec_motion_inner.o \
video_decoder/vdec_idct.o
video_decoder/vdec_idct.o \
$(vdec_motion_inner)
misc_obj = misc/mtime.o \
misc/tests.o \
......
......@@ -127,8 +127,8 @@
*****************************************************************************/
/* Environment variable used to store startup script name and default value */
#define INTF_INIT_SCRIPT_VAR "vlc_init"
#define INTF_INIT_SCRIPT_DEFAULT "vlc.init"
#define INTF_INIT_SCRIPT_VAR "vlcrc"
#define INTF_INIT_SCRIPT_DEFAULT ".vlcrc"
/* Environment variable used to store channels file and default value */
#define INTF_CHANNELS_VAR "vlc_channels"
......@@ -434,6 +434,7 @@
* Synchro configuration
*****************************************************************************/
#define VOUT_SYNCHRO_LEVEL_START 5
#define VOUT_SYNCHRO_LEVEL_MAX 15
#define VOUT_SYNCHRO_LEVEL_START 5 << 10
#define VOUT_SYNCHRO_LEVEL_MAX 15 << 10
#define VOUT_SYNCHRO_HEAP_IDEAL_SIZE 5
......@@ -166,17 +166,4 @@ 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_PictureDataGENERIC( struct vpar_thread_s * p_vpar, int i_mb_base );
#if (VPAR_OPTIM_LEVEL > 0)
void vpar_PictureData2I420F0( struct vpar_thread_s * p_vpar, int i_mb_base );
void vpar_PictureData2P420F0( struct vpar_thread_s * p_vpar, int i_mb_base );
void vpar_PictureData2B420F0( struct vpar_thread_s * p_vpar, int i_mb_base );
#endif
#if (VPAR_OPTIM_LEVEL > 1)
void vpar_PictureData2I420TZ( struct vpar_thread_s * p_vpar, int i_mb_base );
void vpar_PictureData2P420TZ( struct vpar_thread_s * p_vpar, int i_mb_base );
void vpar_PictureData2B420TZ( struct vpar_thread_s * p_vpar, int i_mb_base );
void vpar_PictureData2I420BZ( struct vpar_thread_s * p_vpar, int i_mb_base );
void vpar_PictureData2P420BZ( struct vpar_thread_s * p_vpar, int i_mb_base );
void vpar_PictureData2B420BZ( struct vpar_thread_s * p_vpar, int i_mb_base );
#endif
void vpar_PictureData( struct vpar_thread_s * p_vpar, int i_mb_base );
......@@ -58,7 +58,7 @@ typedef struct sequence_s
/* the same, in macroblock units */
unsigned int i_aspect_ratio; /* height/width display ratio */
unsigned int i_matrix_coefficients;/* coeffs of the YUV transform */
float r_frame_rate; /* theoritical frame rate in fps */
int i_frame_rate; /* theoritical frame rate in fps*1001 */
boolean_t b_mpeg2; /* guess */
boolean_t b_progressive; /* progressive (ie.
* non-interlaced) frame */
......
......@@ -67,9 +67,9 @@ typedef struct video_synchro_s
/* can we display pictures ? */
boolean_t b_all_I;
boolean_t b_all_P;
double displayable_p;
int displayable_p;
boolean_t b_all_B;
double displayable_b;
int displayable_b;
} video_synchro_t;
......@@ -100,7 +100,7 @@ typedef struct video_synchro_s
/* Date Section */
/* Dates needed to compute the date of the current frame
* We also use the stream frame rate (sequence.r_frame_rate) */
* We also use the stream frame rate (sequence.i_frame_rate) */
mtime_t i_current_frame_date;
mtime_t i_backward_frame_date;
......
......@@ -131,12 +131,8 @@ int yuv_MMXReset( vout_thread_t *p_vout )
+ *****************************************************************************/
void SetYUV( vout_thread_t *p_vout )
{
int pi_gamma[256]; /* gamma table */
int i_index; /* index in tables */
/* Build gamma table */
SetGammaTable( pi_gamma, p_vout->f_gamma );
/*
* Set pointers and build YUV tables
*/
......
......@@ -53,7 +53,6 @@ int i_pic_height, int i_pic_line_width, int i_matrix_coefficients
/*****************************************************************************
* Local prototypes
*****************************************************************************/
void SetGammaTable ( int *pi_table, double f_gamma );
void SetYUV ( vout_thread_t *p_vout );
void SetOffset ( int i_width, int i_height, int i_pic_width,
int i_pic_height, boolean_t *pb_h_scaling,
......
......@@ -158,14 +158,23 @@ int intf_ExecScript( char *psz_filename )
FILE * p_file; /* file */
char psz_line[INTF_MAX_CMD_SIZE]; /* line */
char * psz_index; /* index in string */
char * psz_vlcrc; /* full path to vlcrc */
int i_err; /* error indicator */
/* Open file */
i_err = 0;
p_file = fopen( psz_filename, "r" );
if( !( psz_index = getenv("HOME") ) )
{
psz_index = "/";
}
psz_vlcrc = malloc( strlen( psz_index ) + 1 + strlen( psz_filename ) + 1 );
sprintf( psz_vlcrc, "%s/%s", psz_index, psz_filename );
p_file = fopen( psz_vlcrc, "r" );
if( p_file == NULL )
{
intf_DbgMsg("intf warning: %s: %s\n", psz_filename, strerror(errno));
intf_DbgMsg("intf warning: %s: %s\n", psz_vlcrc, strerror(errno));
return( -1 );
}
......@@ -194,7 +203,7 @@ int intf_ExecScript( char *psz_filename )
}
if( !feof( p_file ) )
{
intf_ErrMsg("error: %s: %s\n", psz_filename, strerror(errno));
intf_ErrMsg("error: %s: %s\n", psz_vlcrc, strerror(errno));
return( -1 );
}
......
......@@ -322,7 +322,7 @@ static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
"packuswb %%mm1,%%mm2\n\t"
"movq %%mm2,(%0)\n\t"
"emms"
//"emms"
:"+r" (p_data): "r" (p_block),"r" (i_incr+8));
}
#endif
......@@ -389,7 +389,7 @@ static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
"movq 112(%1),%%mm0\n\t"
"packuswb 120(%1),%%mm0\n\t"
"movq %%mm0,(%0)\n\t"
"emms"
//"emms"
:"+r" (p_data): "r" (p_block),"r" (i_incr+8));
}
#endif
......
......@@ -1691,7 +1691,7 @@ static void RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic )
*/
if( p_vout->c_fps_samples > VOUT_FPS_SAMPLES )
{
sprintf( psz_buffer, "%.2f fps", (double) VOUT_FPS_SAMPLES * 1000000 /
sprintf( psz_buffer, "%.2f fps/10", VOUT_FPS_SAMPLES * 1000000 * 10 /
( p_vout->p_fps_sample[ (p_vout->c_fps_samples - 1) % VOUT_FPS_SAMPLES ] -
p_vout->p_fps_sample[ p_vout->c_fps_samples % VOUT_FPS_SAMPLES ] ) );
Print( p_vout, 0, 0, RIGHT_RALIGN, TOP_RALIGN, psz_buffer );
......@@ -1939,7 +1939,7 @@ static void Synchronize( vout_thread_t *p_vout, s64 i_delay )
/* XXX?? gore following */
static int i_panic_count = 0;
static int i_last_synchro_inc = 0;
static float r_synchro_level = VOUT_SYNCHRO_LEVEL_START;
static int i_synchro_level = VOUT_SYNCHRO_LEVEL_START;
static int i_truc = 10;
if( i_delay < 0 )
......@@ -1965,7 +1965,7 @@ static void Synchronize( vout_thread_t *p_vout, s64 i_delay )
}
}
if( i_truc > VOUT_SYNCHRO_LEVEL_MAX*2*2*2*2*2 ||
if( i_truc > VOUT_SYNCHRO_LEVEL_MAX >> 5 ||
i_synchro_inc*i_last_synchro_inc < 0 )
{
i_truc = 32;
......@@ -1985,17 +1985,17 @@ static void Synchronize( vout_thread_t *p_vout, s64 i_delay )
}
else if( i_delay > 100000 )
{
r_synchro_level += 1;
i_synchro_level += 1 << 10;
if( i_delay > 130000 )
r_synchro_level += 1;
i_synchro_level += 1 << 10;
}
r_synchro_level += (float)i_synchro_inc / i_truc;
p_vout->i_synchro_level = (int)(r_synchro_level+0.5);
i_synchro_level += ( i_synchro_inc << 10 ) / i_truc;
p_vout->i_synchro_level = ( i_synchro_level + (1 << 9) );
if( r_synchro_level > VOUT_SYNCHRO_LEVEL_MAX )
if( i_synchro_level > VOUT_SYNCHRO_LEVEL_MAX )
{
r_synchro_level = VOUT_SYNCHRO_LEVEL_MAX;
i_synchro_level = VOUT_SYNCHRO_LEVEL_MAX;
}
//fprintf( stderr, "synchro level : %d, heap : %d (%d, %d) (%d, %f) - %Ld\n", p_vout->i_synchro_level,
......
......@@ -291,14 +291,14 @@ static int InitThread( vpar_thread_t *p_vpar )
p_vpar->synchro.i_delay = 200000;
p_vpar->synchro.i_theorical_delay = 40000; /* 25 fps */
/* assume we can display all Is and 2 Ps */
p_vpar->synchro.b_all_I = 1;
p_vpar->synchro.b_all_I = 1 << 10;
p_vpar->synchro.b_all_P = 0;
p_vpar->synchro.displayable_p = 2;
p_vpar->synchro.displayable_p = 2 << 10;
p_vpar->synchro.b_all_B = 0;
p_vpar->synchro.displayable_b = 0;
/* assume there were about 3 P and 6 B images between I's */
p_vpar->synchro.i_P_seen = p_vpar->synchro.i_P_kept = 1;
p_vpar->synchro.i_B_seen = p_vpar->synchro.i_B_kept = 1;
p_vpar->synchro.i_P_seen = p_vpar->synchro.i_P_kept = 1 << 10;
p_vpar->synchro.i_B_seen = p_vpar->synchro.i_B_kept = 1 << 10;
#endif
#ifdef MEUUH_SYNCHRO
......
This diff is collapsed.
......@@ -52,11 +52,6 @@
#include "video_parser.h"
#include "video_fifo.h"
/*
* Function pointer
*/
typedef void (*f_picture_data_t)( vpar_thread_t*, int );
/*
* Local prototypes
*/
......@@ -334,17 +329,17 @@ int vpar_ParseHeader( vpar_thread_t * p_vpar )
static void SequenceHeader( vpar_thread_t * p_vpar )
{
#define RESERVED -1
static float r_frame_rate_table[16] =
{
0.0,
((23.0*1000.0)/1001.0),
24.0,
25.0,
((30.0*1000.0)/1001.0),
30.0,
50.0,
((60.0*1000.0)/1001.0),
60.0,
static int i_frame_rate_table[16] =
{
0,
23 * 1000,
24 * 1001,
25 * 1001,
30 * 1000,
30 * 1001,
50 * 1001,
60 * 1000,
60 * 1001,
RESERVED, RESERVED, RESERVED, RESERVED, RESERVED, RESERVED, RESERVED
};
#undef RESERVED
......@@ -357,8 +352,8 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
p_vpar->sequence.i_width = GetBits( &p_vpar->bit_stream, 12 );
p_vpar->sequence.i_height = GetBits( &p_vpar->bit_stream, 12 );
p_vpar->sequence.i_aspect_ratio = GetBits( &p_vpar->bit_stream, 4 );
p_vpar->sequence.r_frame_rate =
r_frame_rate_table[ GetBits( &p_vpar->bit_stream, 4 ) ];
p_vpar->sequence.i_frame_rate =
i_frame_rate_table[ GetBits( &p_vpar->bit_stream, 4 ) ];
/* We don't need bit_rate_value, marker_bit, vbv_buffer_size,
* constrained_parameters_flag */
......@@ -418,7 +413,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
/* frame_rate_extension_n */
i_dummy = GetBits( &p_vpar->bit_stream, 2 );
/* frame_rate_extension_d */
p_vpar->sequence.r_frame_rate *= (i_dummy + 1)
p_vpar->sequence.i_frame_rate *= (i_dummy + 1)
/ (GetBits( &p_vpar->bit_stream, 5 ) + 1);
}
else
......@@ -496,44 +491,6 @@ static void GroupHeader( vpar_thread_t * p_vpar )
*****************************************************************************/
static void PictureHeader( vpar_thread_t * p_vpar )
{
/* Table of optimized PictureData functions. */
static f_picture_data_t ppf_picture_data[4][4] =
{
{
NULL, NULL, NULL, NULL
},
{
/* TOP_FIELD */
#if (VPAR_OPTIM_LEVEL > 1)
NULL, vpar_PictureData2I420TZ, vpar_PictureData2P420TZ,
vpar_PictureData2B420TZ
#else
NULL, vpar_PictureDataGENERIC, vpar_PictureDataGENERIC,
vpar_PictureDataGENERIC
#endif
},
{
/* BOTTOM_FIELD */
#if (VPAR_OPTIM_LEVEL > 1)
NULL, vpar_PictureData2I420BZ, vpar_PictureData2P420BZ,
vpar_PictureData2B420BZ
#else
NULL, vpar_PictureDataGENERIC, vpar_PictureDataGENERIC,
vpar_PictureDataGENERIC
#endif
},
{
/* FRAME_PICTURE */
#if (VPAR_OPTIM_LEVEL > 0)
NULL, vpar_PictureData2I420F0, vpar_PictureData2P420F0,
vpar_PictureData2B420F0
#else
NULL, vpar_PictureDataGENERIC, vpar_PictureDataGENERIC,
vpar_PictureDataGENERIC
#endif
}
};
int i_structure;
int i_mb_base;
boolean_t b_parsable;
......@@ -764,28 +721,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
/* Extension and User data. */
ExtensionAndUserData( p_vpar );
/* Picture data (ISO/IEC 13818-2 6.2.3.7). */
if( p_vpar->sequence.i_chroma_format != CHROMA_420
|| !p_vpar->sequence.b_mpeg2 || p_vpar->sequence.i_height > 2800
|| p_vpar->sequence.i_scalable_mode == SC_DP )
{
/* Weird stream. Use the slower generic function. */
vpar_PictureDataGENERIC( p_vpar, i_mb_base );
}
else
{
/* Try to find an optimized function. */
if( ppf_picture_data[p_vpar->picture.i_structure][p_vpar->picture.i_coding_type] == NULL )
{
intf_ErrMsg( "vpar error: bad ppf_picture_data function pointer (struct:%d, coding type:%d)\n",
p_vpar->picture.i_structure, p_vpar->picture.i_coding_type );
}
else
{
ppf_picture_data[p_vpar->picture.i_structure]
[p_vpar->picture.i_coding_type]( p_vpar, i_mb_base );
}
}
vpar_PictureData( p_vpar, i_mb_base );
if( p_vpar->b_die || p_vpar->b_error )
{
......
......@@ -65,7 +65,7 @@
void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
int i_coding_type, boolean_t b_kept )
{
double i_can_display;
int i_can_display;
mtime_t i_pts;
pes_packet_t * p_pes = p_vpar->bit_stream.p_decoder_fifo->buffer[
p_vpar->bit_stream.p_decoder_fifo->i_start ];
......@@ -100,13 +100,13 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
{
case P_CODING_TYPE:
p_vpar->synchro.i_P_seen++;
if( b_kept ) p_vpar->synchro.i_P_kept++;
p_vpar->synchro.i_P_seen += 1024;
if( b_kept ) p_vpar->synchro.i_P_kept += 1024;
break;
case B_CODING_TYPE:
p_vpar->synchro.i_B_seen++;
if( b_kept ) p_vpar->synchro.i_B_kept++;
p_vpar->synchro.i_B_seen += 1024;
if( b_kept ) p_vpar->synchro.i_B_kept += 1024;
break;
case I_CODING_TYPE:
......@@ -118,8 +118,8 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
if ( p_vpar->synchro.i_last_seen_I_pts )
{
p_vpar->synchro.i_theorical_delay =
( i_pts - p_vpar->synchro.i_last_seen_I_pts )
/ ( 1 + p_vpar->synchro.i_B_seen
1024 * ( i_pts - p_vpar->synchro.i_last_seen_I_pts )
/ ( 1024 + p_vpar->synchro.i_B_seen
+ p_vpar->synchro.i_P_seen);
}
p_vpar->synchro.i_last_seen_I_pts = i_pts;
......@@ -127,7 +127,8 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
/* now we calculated all statistics, it's time to
* decide what we have the time to display */
i_can_display = (float)(i_pts - p_vpar->synchro.i_last_kept_I_pts)
i_can_display =
( (i_pts - p_vpar->synchro.i_last_kept_I_pts) << 10 )
/ p_vpar->synchro.i_delay;
p_vpar->synchro.b_all_I = 0;
......@@ -136,9 +137,9 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
p_vpar->synchro.displayable_p = 0;
p_vpar->synchro.displayable_b = 0;
if( ( p_vpar->synchro.b_all_I = ( i_can_display > 1 ) ) )
if( ( p_vpar->synchro.b_all_I = ( i_can_display >= 1024 ) ) )
{
i_can_display -= 1;
i_can_display -= 1024;
if( !( p_vpar->synchro.b_all_P
= ( i_can_display > p_vpar->synchro.i_P_seen ) ) )
......@@ -159,20 +160,21 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
#if 1
if( p_vpar->synchro.b_all_I )
intf_ErrMsg( " I: 1/1 " );
intf_ErrMsg( " I: 1024/1024 " );
if( p_vpar->synchro.b_all_P )
intf_ErrMsg( "P: %i/%i ", p_vpar->synchro.i_P_seen,
p_vpar->synchro.i_P_seen );
else if( p_vpar->synchro.displayable_p > 0 )
intf_ErrMsg( "P: %.2f/%i ", p_vpar->synchro.displayable_p,
intf_ErrMsg( "P: %i/%i ", p_vpar->synchro.displayable_p,
p_vpar->synchro.i_P_seen );
if( p_vpar->synchro.b_all_B )
intf_ErrMsg( "B: %i/%i", p_vpar->synchro.i_B_seen,
p_vpar->synchro.i_B_seen );
else if( p_vpar->synchro.displayable_b > 0 )
intf_ErrMsg( "B: %.2f/%i", p_vpar->synchro.displayable_b,
intf_ErrMsg( "B: %i/%i", p_vpar->synchro.displayable_b,
p_vpar->synchro.i_B_seen );
intf_ErrMsg( " " );
// intf_ErrMsg( " " );
intf_ErrMsg( "\n" );
#endif
p_vpar->synchro.i_P_seen = 0;
p_vpar->synchro.i_B_seen = 0;
......@@ -197,8 +199,6 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
{
mtime_t i_delay = p_vpar->synchro.i_last_pts - mdate();
//return (i_coding_type == I_CODING_TYPE);
switch( i_coding_type )
{
case I_CODING_TYPE:
......@@ -407,7 +407,8 @@ void vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
{
return( p_vpar->synchro.kludge_date
+ p_vpar->synchro.kludge_nbframes*1000000/(p_vpar->sequence.r_frame_rate ) );
+ p_vpar->synchro.kludge_nbframes * 1000000
/ (p_vpar->sequence.i_frame_rate ) * 1001 );
}
void vpar_SynchroEnd( vpar_thread_t * p_vpar )
......@@ -481,7 +482,7 @@ void vpar_SynchroSetCurrentDate( vpar_thread_t * p_vpar, int i_coding_type )
}
else
{
p_vpar->synchro.i_current_frame_date += 1000000/(p_vpar->sequence.r_frame_rate);
p_vpar->synchro.i_current_frame_date += 1000000 / (p_vpar->sequence.i_frame_rate) * 1001;
}
break;
......@@ -489,7 +490,7 @@ void vpar_SynchroSetCurrentDate( vpar_thread_t * p_vpar, int i_coding_type )
if( p_vpar->synchro.i_backward_frame_date == 0 )
{
p_vpar->synchro.i_current_frame_date += 1000000/(p_vpar->sequence.r_frame_rate);
p_vpar->synchro.i_current_frame_date += 1000000 / (p_vpar->sequence.i_frame_rate) * 1001;
}
else
{
......
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