Commit 0759c952 authored by Sam Hocevar's avatar Sam Hocevar

. un chti peu plus de synchro video, mais c'est pas encore �a

 . suppression des #include "X11/*" pour que �a compile sans X
 . alban, t'es mortel
parent 01461d52
......@@ -33,11 +33,13 @@
#include <sys/soundcard.h>
#include <sys/uio.h>
#ifdef VIDEO_X11
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/xf86dga.h>
#endif
......
......@@ -23,8 +23,6 @@
#include <stdio.h>
#include <netinet/in.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -16,10 +16,6 @@
#include <sys/uio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include <sys/soundcard.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/ioctl.h>
......
......@@ -20,9 +20,6 @@
#include <stdio.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include <sys/soundcard.h>
#include <netinet/in.h> /* ntohs */
#include "common.h"
......
......@@ -21,8 +21,6 @@
#include <string.h>
#include <netinet/in.h>
#include <sys/soundcard.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "common.h"
#include "config.h"
......
......@@ -17,8 +17,6 @@
#include <netinet/in.h>
#include <sys/soundcard.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -20,8 +20,6 @@
#include <string.h>
#include <sys/soundcard.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -35,8 +35,6 @@
#include <unistd.h>
#include <sys/soundcard.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -13,8 +13,6 @@
#include <unistd.h>
#include <string.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -12,8 +12,6 @@
#include <unistd.h>
#include <string.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -16,8 +16,6 @@
#include <unistd.h>
#include <string.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -12,8 +12,6 @@
#include <unistd.h>
#include <string.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -14,8 +14,6 @@
#include <unistd.h>
#include <string.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......@@ -235,7 +233,13 @@ static int InitThread( vpar_thread_t *p_vpar )
/*
* Initialize the synchro properties
*/
/* the fifo */
p_vpar->synchro.i_fifo_start = 0;
p_vpar->synchro.i_fifo_stop = 0;
/* the counter */
p_vpar->synchro.modulo = 0;
/* mean decoding time - at least 100 ms */
p_vpar->synchro.decode_time = 500000;
/* assume there were about 3 P and 6 B images between I's */
p_vpar->synchro.current_p_count = 1;
p_vpar->synchro.p_count_predict = 3;
......
......@@ -12,8 +12,6 @@
#include <unistd.h>
#include <string.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -12,8 +12,6 @@
#include <unistd.h>
#include <string.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -14,8 +14,6 @@
#include <unistd.h>
#include <string.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......
......@@ -12,8 +12,6 @@
#include <unistd.h>
#include <string.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
#include "config.h"
#include "common.h"
......@@ -51,8 +49,9 @@
float vpar_SynchroUpdateTab( video_synchro_tab_t * tab, int count )
{
tab->mean = ( tab->mean + 3 * count ) / 4;
tab->deviation = ( tab->deviation + 3 * abs (tab->mean - count) ) / 4;
tab->mean = ( tab->mean + MAX_COUNT * count ) / ( MAX_COUNT + 1 );
tab->deviation = ( tab->deviation + MAX_COUNT * abs (tab->mean - count) )
/ ( MAX_COUNT + 1 );
return tab->deviation;
}
......@@ -78,11 +77,14 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
case I_CODING_TYPE:
/* update all the structures for P images */
/* period == 1 */
optimal_deviation = vpar_SynchroUpdateTab(
&p_vpar->synchro.tab_p[0],
p_vpar->synchro.current_p_count);
predict = p_vpar->synchro.tab_p[0].mean;
/* period == 2 */
candidate_deviation = vpar_SynchroUpdateTab(
&p_vpar->synchro.tab_p[1 + (p_vpar->synchro.modulo & 0x1)],
p_vpar->synchro.current_p_count);
......@@ -92,6 +94,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
predict = p_vpar->synchro.tab_p[1 + (p_vpar->synchro.modulo & 0x1)].mean;
}
/* period == 3 */
candidate_deviation = vpar_SynchroUpdateTab(
&p_vpar->synchro.tab_p[3 + (p_vpar->synchro.modulo % 3)],
p_vpar->synchro.current_p_count);
......@@ -106,11 +109,14 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
/* update all the structures for B images */
/* period == 1 */
optimal_deviation = vpar_SynchroUpdateTab(
&p_vpar->synchro.tab_b[0],
p_vpar->synchro.current_b_count);
predict = p_vpar->synchro.tab_b[0].mean;
/* period == 2 */
candidate_deviation = vpar_SynchroUpdateTab(
&p_vpar->synchro.tab_b[1 + (p_vpar->synchro.modulo & 0x1)],
p_vpar->synchro.current_b_count);
......@@ -120,6 +126,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
predict = p_vpar->synchro.tab_b[1 + (p_vpar->synchro.modulo & 0x1)].mean;
}
/* period == 3 */
candidate_deviation = vpar_SynchroUpdateTab(
&p_vpar->synchro.tab_b[3 + (p_vpar->synchro.modulo % 3)],
p_vpar->synchro.current_b_count);
......@@ -148,16 +155,16 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
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 = 1;
if( i_coding_type == 2 )
meuh++;
truc++;
if( truc == 3 )
{
// while(1);
}
return( i_coding_type == I_CODING_TYPE || (i_coding_type == P_CODING_TYPE && meuh == 1) );
return( i_coding_type == I_CODING_TYPE || (i_coding_type == P_CODING_TYPE) && (meuh == 2));
intf_DbgMsg("vpar debug: synchro image %i - modulo is %i\n", i_coding_type, p_vpar->synchro.modulo);
intf_DbgMsg("vpar debug: synchro predict P %e - predict B %e\n", p_vpar->synchro.p_count_predict, p_vpar->synchro.b_count_predict);
......@@ -171,6 +178,8 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
int i_structure )
{
//fprintf ( stderr, "trashing type %i\n", p_vpar->picture.i_coding_type );
vpar_SynchroUpdateStructures (p_vpar, i_coding_type);
}
......@@ -181,7 +190,16 @@ void vpar_SynchroTrash( vpar_thread_t * p_vpar, int i_coding_type,
void vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
int i_structure )
{
//fprintf ( stderr, "decoding type %i\n", p_vpar->picture.i_coding_type );
vpar_SynchroUpdateStructures (p_vpar, i_coding_type);
p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_stop].decode_date = mdate();
p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_stop].i_image_type
= i_coding_type;
p_vpar->synchro.i_fifo_stop = (p_vpar->synchro.i_fifo_stop + 1) & 0xf;
fprintf ( stderr, "%i images in synchro fifo\n", ( p_vpar->synchro.i_fifo_stop - p_vpar->synchro.i_fifo_start ) & 0xf );
}
/*****************************************************************************
......@@ -189,12 +207,35 @@ void vpar_SynchroDecode( vpar_thread_t * p_vpar, int i_coding_type,
*****************************************************************************/
void vpar_SynchroEnd( vpar_thread_t * p_vpar )
{
mtime_t * p_decode_time;
// return mdate() + 700000;
fprintf ( stderr, "type %i decoding time was %lli\n",
p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_image_type,
( mdate()
- p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].decode_date )
/ (( p_vpar->synchro.i_fifo_stop - p_vpar->synchro.i_fifo_start ) & 0xf ));
p_vpar->synchro.decode_time =
( (p_vpar->synchro.decode_time * 3) + (mdate()
- p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].decode_date)
/ (( p_vpar->synchro.i_fifo_stop - p_vpar->synchro.i_fifo_start)
& 0xf) ) >> 2;
p_vpar->synchro.i_fifo_start = (p_vpar->synchro.i_fifo_start + 1) & 0xf;
}
/*****************************************************************************
* vpar_SynchroDate : When an image has been decoded, ask for its date
*****************************************************************************/
mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
{
return mdate() + 700000;
decoder_fifo_t * fifo;
mtime_t displaydate;
fifo = p_vpar->bit_stream.p_decoder_fifo;
displaydate = fifo->buffer[fifo->i_start]->i_pts;
if (displaydate) fprintf(stderr, "displaying type %i at %lli, (time %lli, delta %lli)\n", p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_image_type, displaydate, mdate() + 1000000, displaydate - mdate() - 1000000);
return displaydate;
}
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