]> git.sesse.net Git - vlc/blob - include/vpar_synchro.h
4ebf089351f90df503f9c77637dcb0490dcec9bf
[vlc] / include / vpar_synchro.h
1 /*****************************************************************************
2  * vpar_synchro.h : video parser blocks management
3  * (c)1999 VideoLAN
4  *****************************************************************************
5  *****************************************************************************
6  * Requires:
7  *  "config.h"
8  *  "common.h"
9  *  "mtime.h"
10  *  "vlc_thread.h"
11  *  "input.h"
12  *  "video.h"
13  *  "video_output.h"
14  *  "decoder_fifo.h"
15  *  "video_fifo.h"
16  *****************************************************************************/
17
18 #define POLUX_SYNCHRO
19
20 /*****************************************************************************
21  * video_synchro_t and video_synchro_tab_s : timers for the video synchro
22  *****************************************************************************/
23 #ifdef SAM_SYNCHRO
24 typedef struct video_synchro_tab_s
25 {
26     double mean;
27     double deviation;
28
29 } video_synchro_tab_t;
30
31 typedef struct video_synchro_fifo_s
32 {
33     /* type of image to be decoded, and decoding date */
34     int i_image_type;
35     mtime_t i_decode_date;
36     mtime_t i_pts;
37
38 } video_synchro_fifo_t;
39
40 typedef struct video_synchro_s
41 {
42     /* fifo containing decoding dates */
43     video_synchro_fifo_t fifo[16];
44     unsigned int i_fifo_start;
45     unsigned int i_fifo_stop;
46
47     /* mean decoding time */
48     mtime_t i_mean_decode_time;
49     /* dates */
50     mtime_t i_last_display_pts;           /* pts of the last displayed image */
51     mtime_t i_last_decode_pts;              /* pts of the last decoded image */
52     mtime_t i_last_i_pts;                         /* pts of the last I image */
53     mtime_t i_last_nondropped_i_pts;      /* pts of last non-dropped I image */
54     unsigned int i_images_since_pts;
55
56     /* il manquait un compteur */
57     unsigned int modulo;
58
59     /* P images since the last I */
60     unsigned int current_p_count;
61     unsigned int nondropped_p_count;
62     double p_count_predict;
63     /* B images since the last I */
64     unsigned int current_b_count;
65     unsigned int nondropped_b_count;
66     double b_count_predict;
67
68     /* can we display pictures ? */
69     unsigned int    can_display_i;
70     unsigned int    can_display_p;
71     double          displayable_p;
72     unsigned int    can_display_b;
73     double          displayable_b;
74
75     /* 1 for linear count, 2 for binary count, 3 for ternary count */
76     video_synchro_tab_t tab_p[6];
77     video_synchro_tab_t tab_b[6];
78
79     double theorical_fps;
80     double actual_fps;
81
82 } video_synchro_t;
83 #endif
84
85 #ifdef MEUUH_SYNCHRO
86 typedef struct video_synchro_s
87 {
88     int         kludge_level, kludge_p, kludge_b, kludge_nbp, kludge_nbb;
89     int         kludge_nbframes;
90     mtime_t     kludge_date, kludge_prevdate;
91     int         i_coding_type;
92 } video_synchro_t;
93
94 #define SYNC_TOLERATE   ((int)(0.010*CLOCK_FREQ))                   /* 10 ms */
95 #define SYNC_DELAY      ((int)(0.500*CLOCK_FREQ))                  /* 500 ms */
96 #endif
97
98 #ifdef POLUX_SYNCHRO
99
100 #define SYNC_AVERAGE_COUNT 10
101
102 typedef struct video_synchro_s
103 {
104     /* Date Section */
105
106     /* Dates needed to compute the date of the current frame
107      * We also use the stream frame rate (sequence.r_frame_rate) */
108     mtime_t     i_current_frame_date;
109     mtime_t     i_backward_frame_date;
110
111     /* Frame Trashing Section */
112
113     int         i_b_nb, i_p_nb;   /* number of decoded P and B between two I */
114     float       r_b_average, r_p_average;
115     int         i_b_count, i_p_count, i_i_count;
116     int         i_b_trasher;                /* used for brensenham algorithm */
117
118 } video_synchro_t;
119
120 #endif
121
122 /*****************************************************************************
123  * Prototypes
124  *****************************************************************************/
125 boolean_t vpar_SynchroChoose( struct vpar_thread_s * p_vpar, int i_coding_type,
126                          int i_structure );
127 void vpar_SynchroTrash( struct vpar_thread_s * p_vpar, int i_coding_type,
128                         int i_structure );
129 void vpar_SynchroDecode( struct vpar_thread_s * p_vpar, int i_coding_type,
130                             int i_structure );
131 void vpar_SynchroEnd( struct vpar_thread_s * p_vpar );
132 mtime_t vpar_SynchroDate( struct vpar_thread_s * p_vpar );
133
134 #ifndef SAM_SYNCHRO
135 void vpar_SynchroKludge( struct vpar_thread_s *, mtime_t );
136 #endif