]> git.sesse.net Git - vlc/blob - include/vpar_synchro.h
Encore un commit venu tout droit des abysses de l'enfer, d�sol� pour
[vlc] / include / vpar_synchro.h
1 /*****************************************************************************
2  * vpar_synchro.h : video parser blocks management
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  *
6  * Authors:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public
19  * License along with this program; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Requires:
26  *  "config.h"
27  *  "common.h"
28  *  "mtime.h"
29  *  "threads.h"
30  *  "input.h"
31  *  "video.h"
32  *  "video_output.h"
33  *  "decoder_fifo.h"
34  *  "video_fifo.h"
35  *****************************************************************************/
36
37 #define POLUX_SYNCHRO
38
39 /*****************************************************************************
40  * video_synchro_t and video_synchro_tab_s : timers for the video synchro
41  *****************************************************************************/
42 #ifdef SAM_SYNCHRO
43 typedef struct video_synchro_tab_s
44 {
45     double mean;
46     double deviation;
47
48 } video_synchro_tab_t;
49
50 typedef struct video_synchro_fifo_s
51 {
52     /* type of image to be decoded, and decoding date */
53     int i_image_type;
54     mtime_t i_decode_date;
55     mtime_t i_pts;
56
57 } video_synchro_fifo_t;
58
59 typedef struct video_synchro_s
60 {
61     /* fifo containing decoding dates */
62     video_synchro_fifo_t fifo[16];
63     unsigned int i_fifo_start;
64     unsigned int i_fifo_stop;
65
66     /* mean decoding time */
67     mtime_t i_mean_decode_time;
68     /* dates */
69     mtime_t i_last_display_pts;           /* pts of the last displayed image */
70     mtime_t i_last_decode_pts;              /* pts of the last decoded image */
71     mtime_t i_last_i_pts;                         /* pts of the last I image */
72     mtime_t i_last_nondropped_i_pts;      /* pts of last non-dropped I image */
73     unsigned int i_images_since_pts;
74
75     /* il manquait un compteur */
76     unsigned int modulo;
77
78     /* P images since the last I */
79     unsigned int current_p_count;
80     unsigned int nondropped_p_count;
81     double p_count_predict;
82     /* B images since the last I */
83     unsigned int current_b_count;
84     unsigned int nondropped_b_count;
85     double b_count_predict;
86
87     /* can we display pictures ? */
88     unsigned int    can_display_i;
89     unsigned int    can_display_p;
90     double          displayable_p;
91     unsigned int    can_display_b;
92     double          displayable_b;
93
94     /* 1 for linear count, 2 for binary count, 3 for ternary count */
95     video_synchro_tab_t tab_p[6];
96     video_synchro_tab_t tab_b[6];
97
98     double theorical_fps;
99     double actual_fps;
100
101 } video_synchro_t;
102 #endif
103
104 #ifdef MEUUH_SYNCHRO
105 typedef struct video_synchro_s
106 {
107     int         kludge_level, kludge_p, kludge_b, kludge_nbp, kludge_nbb;
108     int         kludge_nbframes;
109     mtime_t     kludge_date, kludge_prevdate;
110     int         i_coding_type;
111 } video_synchro_t;
112
113 #define SYNC_TOLERATE   ((int)(0.010*CLOCK_FREQ))                   /* 10 ms */
114 #define SYNC_DELAY      ((int)(0.500*CLOCK_FREQ))                  /* 500 ms */
115 #endif
116
117 #ifdef POLUX_SYNCHRO
118
119 #define SYNC_AVERAGE_COUNT 10
120
121 typedef struct video_synchro_s
122 {
123     /* Date Section */
124
125     /* Dates needed to compute the date of the current frame
126      * We also use the stream frame rate (sequence.r_frame_rate) */
127     mtime_t     i_current_frame_date;
128     mtime_t     i_backward_frame_date;
129
130     /* Frame Trashing Section */
131
132     int         i_b_nb, i_p_nb;   /* number of decoded P and B between two I */
133     float       r_b_average, r_p_average;
134     int         i_b_count, i_p_count, i_i_count;
135     int         i_b_trasher;                /* used for brensenham algorithm */
136
137 } video_synchro_t;
138
139 #endif
140
141 /*****************************************************************************
142  * Prototypes
143  *****************************************************************************/
144 boolean_t vpar_SynchroChoose( struct vpar_thread_s * p_vpar, int i_coding_type,
145                          int i_structure );
146 void vpar_SynchroTrash( struct vpar_thread_s * p_vpar, int i_coding_type,
147                         int i_structure );
148 void vpar_SynchroDecode( struct vpar_thread_s * p_vpar, int i_coding_type,
149                             int i_structure );
150 void vpar_SynchroEnd( struct vpar_thread_s * p_vpar );
151 mtime_t vpar_SynchroDate( struct vpar_thread_s * p_vpar );
152
153 #ifndef SAM_SYNCHRO
154 void vpar_SynchroKludge( struct vpar_thread_s *, mtime_t );
155 #endif