]> git.sesse.net Git - vlc/blob - include/vpar_synchro.h
. removed the sdlvlc alias
[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
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
21  *****************************************************************************/
22
23 /*****************************************************************************
24  * Requires:
25  *  "config.h"
26  *  "common.h"
27  *  "mtime.h"
28  *  "threads.h"
29  *  "input.h"
30  *  "video.h"
31  *  "video_output.h"
32  *  "decoder_fifo.h"
33  *  "video_fifo.h"
34  *****************************************************************************/
35
36 #define SAM_SYNCHRO
37 //#define POLUX_SYNCHRO
38 //#define MEUUH_SYNCHRO
39
40 /*****************************************************************************
41  * video_synchro_t and video_synchro_tab_s : timers for the video synchro
42  *****************************************************************************/
43 #ifdef SAM_SYNCHRO
44 typedef struct video_synchro_s
45 {
46     /* synchro algorithm */
47     int          i_type;
48
49     /* fifo containing decoding dates */
50     mtime_t      i_date_fifo[16];
51     unsigned int i_start;
52     unsigned int i_stop;
53
54     /* mean decoding time */
55     mtime_t i_delay;
56     mtime_t i_theorical_delay;
57
58     /* dates */
59     mtime_t i_last_pts;                   /* pts of the last displayed image */
60     mtime_t i_last_seen_I_pts;              /* date of the last I we decoded */
61     mtime_t i_last_kept_I_pts;            /* pts of last non-dropped I image */
62
63     /* P images since the last I */
64     unsigned int i_P_seen;
65     unsigned int i_P_kept;
66     /* B images since the last I */
67     unsigned int i_B_seen;
68     unsigned int i_B_kept;
69
70     /* can we display pictures ? */
71     boolean_t     b_all_I;
72     boolean_t     b_all_P;
73     int           displayable_p;
74     boolean_t     b_all_B;
75     int           displayable_b;
76     boolean_t     b_dropped_last_B;
77
78 } video_synchro_t;
79
80 #define FIFO_INCREMENT( i_counter ) \
81     p_vpar->synchro.i_counter = (p_vpar->synchro.i_counter + 1) & 0xf;
82
83 #define VPAR_SYNCHRO_DEFAULT   0
84 #define VPAR_SYNCHRO_I         1
85 #define VPAR_SYNCHRO_IP        2
86 #define VPAR_SYNCHRO_IPplus    3
87 #define VPAR_SYNCHRO_IPB       4
88
89 #endif
90
91 #ifdef MEUUH_SYNCHRO
92 typedef struct video_synchro_s
93 {
94     int         kludge_level, kludge_p, kludge_b, kludge_nbp, kludge_nbb;
95     int         kludge_nbframes;
96     mtime_t     kludge_date, kludge_prevdate;
97     int         i_coding_type;
98 } video_synchro_t;
99
100 #define SYNC_TOLERATE   ((int)(0.010*CLOCK_FREQ))                   /* 10 ms */
101 #define SYNC_DELAY      ((int)(0.500*CLOCK_FREQ))                  /* 500 ms */
102 #endif
103
104 #ifdef POLUX_SYNCHRO
105
106 #define SYNC_AVERAGE_COUNT 10
107
108 typedef struct video_synchro_s
109 {
110     /* Date Section */
111
112     /* Dates needed to compute the date of the current frame
113      * We also use the stream frame rate (sequence.i_frame_rate) */
114     mtime_t     i_current_frame_date;
115     mtime_t     i_backward_frame_date;
116
117     /* Frame Trashing Section */
118
119     int         i_b_nb, i_p_nb;   /* number of decoded P and B between two I */
120     float       r_b_average, r_p_average;
121     int         i_b_count, i_p_count, i_i_count;
122     int         i_b_trasher;                /* used for brensenham algorithm */
123
124 } video_synchro_t;
125
126 #endif
127
128 /*****************************************************************************
129  * Prototypes
130  *****************************************************************************/
131 boolean_t vpar_SynchroChoose    ( struct vpar_thread_s * p_vpar,
132                                   int i_coding_type, int i_structure );
133 void vpar_SynchroTrash          ( struct vpar_thread_s * p_vpar,
134                                   int i_coding_type, int i_structure );
135 void vpar_SynchroDecode         ( struct vpar_thread_s * p_vpar,
136                                   int i_coding_type, int i_structure );
137 void vpar_SynchroEnd            ( struct vpar_thread_s * p_vpar );
138 mtime_t vpar_SynchroDate        ( struct vpar_thread_s * p_vpar );
139
140 #ifndef SAM_SYNCHRO
141 void vpar_SynchroKludge         ( struct vpar_thread_s *, mtime_t );
142 #endif