Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
ba8d1d4c
Commit
ba8d1d4c
authored
Jan 26, 2000
by
Sam Hocevar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
. nouvelle synchro. �a devrait d�j� fonctionner correctement en monothread
parent
82c00619
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
135 additions
and
52 deletions
+135
-52
include/vpar_synchro.h
include/vpar_synchro.h
+11
-7
src/video_parser/video_parser.c
src/video_parser/video_parser.c
+7
-3
src/video_parser/vpar_synchro.c
src/video_parser/vpar_synchro.c
+117
-42
No files found.
include/vpar_synchro.h
View file @
ba8d1d4c
...
...
@@ -43,15 +43,12 @@ typedef struct video_synchro_s
/* mean decoding time */
mtime_t
i_mean_decode_time
;
/* tells whether we accumulated delay */
mtime_t
i_delay
;
/* dates */
mtime_t
i_last_display_pts
;
mtime_t
i_last_decode_pts
;
mtime_t
i_last_i_pts
;
mtime_t
i_last_display_pts
;
/* pts of the last displayed image */
mtime_t
i_last_decode_pts
;
/* pts of the last decoded image */
mtime_t
i_last_i_pts
;
/* pts of the last I image */
mtime_t
i_last_nondropped_i_pts
;
/* pts of last non-dropped I image */
unsigned
int
i_images_since_pts
;
/* last pts of non-dropped I image */
mtime_t
i_last_nondropped_i_pts
;
/* il manquait un compteur */
unsigned
int
modulo
;
...
...
@@ -65,6 +62,13 @@ typedef struct video_synchro_s
unsigned
int
nondropped_b_count
;
double
b_count_predict
;
/* can we display pictures ? */
unsigned
int
can_display_i
;
unsigned
int
can_display_p
;
double
displayable_p
;
unsigned
int
can_display_b
;
double
displayable_b
;
/* 1 for linear count, 2 for binary count, 3 for ternary count */
video_synchro_tab_t
tab_p
[
6
];
video_synchro_tab_t
tab_b
[
6
];
...
...
src/video_parser/video_parser.c
View file @
ba8d1d4c
...
...
@@ -242,6 +242,7 @@ static int InitThread( vpar_thread_t *p_vpar )
vpar_InitCodedPattern
(
p_vpar
);
vpar_InitDCTTables
(
p_vpar
);
/*
* Initialize the synchro properties
*/
...
...
@@ -260,8 +261,12 @@ static int InitThread( vpar_thread_t *p_vpar )
p_vpar
->
synchro
.
modulo
=
0
;
/* mean decoding time - at least 200 ms for a slow machine */
p_vpar
->
synchro
.
i_mean_decode_time
=
200000
;
/* suppose we have no delay */
p_vpar
->
synchro
.
i_delay
=
0
;
/* assume we can display all Is and 2 Ps */
p_vpar
->
synchro
.
can_display_i
=
1
;
p_vpar
->
synchro
.
can_display_p
=
0
;
p_vpar
->
synchro
.
displayable_p
=
2
;
p_vpar
->
synchro
.
can_display_b
=
0
;
p_vpar
->
synchro
.
displayable_b
=
0
;
/* assume there were about 3 P and 6 B images between I's */
p_vpar
->
synchro
.
current_p_count
=
1
;
p_vpar
->
synchro
.
nondropped_p_count
=
1
;
...
...
@@ -273,7 +278,6 @@ static int InitThread( vpar_thread_t *p_vpar )
{
p_vpar
->
synchro
.
tab_p
[
i_dummy
].
mean
=
3
;
p_vpar
->
synchro
.
tab_p
[
i_dummy
].
deviation
=
.
5
;
p_vpar
->
synchro
.
tab_b
[
i_dummy
].
mean
=
6
;
p_vpar
->
synchro
.
tab_b
[
i_dummy
].
deviation
=
.
5
;
}
...
...
src/video_parser/vpar_synchro.c
View file @
ba8d1d4c
...
...
@@ -66,6 +66,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
float
optimal_deviation
;
float
predict
;
mtime_t
i_current_pts
;
mtime_t
i_delay
;
mtime_t
i_displaydate
;
decoder_fifo_t
*
decoder_fifo
=
p_vpar
->
bit_stream
.
p_decoder_fifo
;
...
...
@@ -93,10 +94,11 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
+
1000000
.
0
/
(
p_vpar
->
synchro
.
theorical_fps
);
//fprintf (stderr, " ");
}
//else fprintf (stderr, "R ");
//if (dropped) fprintf (stderr, " "); else fprintf (stderr, "* ");
//fprintf (stderr, "%i ", i_coding_type);
//fprintf (stderr, "pts %lli delta %lli\n", i_displaydate, i_displaydate - p_vpar->synchro.i_last_display_pts);
/* else fprintf (stderr, "R ");
if (dropped) fprintf (stderr, " "); else fprintf (stderr, "* ");
fprintf (stderr, "%i ", i_coding_type);
fprintf (stderr, "pts %lli delta %lli\n", i_displaydate, i_displaydate - p_vpar->synchro.i_last_display_pts); */
p_vpar
->
synchro
.
i_images_since_pts
--
;
p_vpar
->
synchro
.
i_last_display_pts
=
i_displaydate
;
...
...
@@ -136,9 +138,6 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
p_vpar
->
synchro
.
actual_fps
=
(
p_vpar
->
synchro
.
actual_fps
+
1000000
.
0
*
(
1
+
p_vpar
->
synchro
.
nondropped_b_count
+
p_vpar
->
synchro
.
nondropped_p_count
)
/
(
i_current_pts
-
p_vpar
->
synchro
.
i_last_nondropped_i_pts
))
/
2
;
}
p_vpar
->
synchro
.
i_last_nondropped_i_pts
=
i_current_pts
;
p_vpar
->
synchro
.
nondropped_p_count
=
0
;
p_vpar
->
synchro
.
nondropped_b_count
=
0
;
}
...
...
@@ -205,7 +204,61 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
p_vpar
->
synchro
.
b_count_predict
=
predict
;
p_vpar
->
synchro
.
current_b_count
=
0
;
/* now we calculated all statistics, it's time to
* decide what we have the time to display
*/
i_delay
=
i_current_pts
-
p_vpar
->
synchro
.
i_last_nondropped_i_pts
;
p_vpar
->
synchro
.
can_display_i
=
(
p_vpar
->
synchro
.
i_mean_decode_time
<
i_delay
);
p_vpar
->
synchro
.
can_display_p
=
(
p_vpar
->
synchro
.
i_mean_decode_time
*
(
1
+
p_vpar
->
synchro
.
p_count_predict
)
<
i_delay
);
if
(
!
p_vpar
->
synchro
.
can_display_p
)
{
p_vpar
->
synchro
.
displayable_p
=
-
1
+
i_delay
/
p_vpar
->
synchro
.
i_mean_decode_time
;
if
(
p_vpar
->
synchro
.
displayable_p
<
0
)
p_vpar
->
synchro
.
displayable_p
=
0
;
}
else
p_vpar
->
synchro
.
displayable_p
=
0
;
if
(
p_vpar
->
synchro
.
can_display_p
&&
!
(
p_vpar
->
synchro
.
can_display_b
=
(
p_vpar
->
synchro
.
i_mean_decode_time
*
(
1
+
p_vpar
->
synchro
.
b_count_predict
+
p_vpar
->
synchro
.
p_count_predict
))
<
i_delay
)
)
{
p_vpar
->
synchro
.
displayable_b
=
-
2
.
0
+
i_delay
/
p_vpar
->
synchro
.
i_mean_decode_time
-
p_vpar
->
synchro
.
can_display_p
;
}
else
p_vpar
->
synchro
.
displayable_b
=
0
;
#if 0
fprintf( stderr,
"I %i P %i (%f) B %i (%f)\n",
p_vpar->synchro.can_display_i,
p_vpar->synchro.can_display_p,
p_vpar->synchro.displayable_p,
p_vpar->synchro.can_display_b,
p_vpar->synchro.displayable_b );
#endif
/* update some values */
if
(
!
dropped
)
{
p_vpar
->
synchro
.
i_last_nondropped_i_pts
=
i_current_pts
;
p_vpar
->
synchro
.
nondropped_p_count
=
0
;
p_vpar
->
synchro
.
nondropped_b_count
=
0
;
}
break
;
}
p_vpar
->
synchro
.
modulo
++
;
...
...
@@ -218,41 +271,50 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
boolean_t
vpar_SynchroChoose
(
vpar_thread_t
*
p_vpar
,
int
i_coding_type
,
int
i_structure
)
{
mtime_t
i_delay
;
int
keep
;
mtime_t
i_delay
=
p_vpar
->
synchro
.
i_last_decode_pts
-
mdate
();
i_delay
=
p_vpar
->
synchro
.
i_last_decode_pts
-
mdate
();
//fprintf( stderr, "delay is %lli - ", i_delay);
#if 1
/*if ( i_coding_type == B_CODING_TYPE )
return (0);*/
//return( i_coding_type == I_CODING_TYPE || i_coding_type == P_CODING_TYPE );
if
(
i_delay
>
120000
)
{
keep
=
1
;
}
else
if
(
i_delay
>
100000
)
switch
(
i_coding_type
)
{
keep
=
(
i_coding_type
==
I_CODING_TYPE
||
i_coding_type
==
P_CODING_TYPE
);
}
else
if
(
i_delay
>
50000
)
{
keep
=
(
i_coding_type
==
I_CODING_TYPE
);
}
else
{
keep
=
0
;
}
#endif
case
I_CODING_TYPE
:
return
(
p_vpar
->
synchro
.
can_display_i
);
case
P_CODING_TYPE
:
if
(
p_vpar
->
synchro
.
can_display_p
)
return
(
1
);
if
(
p_vpar
->
synchro
.
displayable_p
*
i_delay
<
p_vpar
->
synchro
.
i_mean_decode_time
)
{
//fprintf( stderr, "trashed a P\n");
return
(
0
);
}
p_vpar
->
synchro
.
displayable_p
--
;
return
(
1
);
case
B_CODING_TYPE
:
if
(
p_vpar
->
synchro
.
can_display_b
)
return
(
1
);
//if (!keep) fprintf( stderr, "trashing a type %i with delay %lli\n", i_coding_type, i_delay);
// else fprintf( stderr, "chooser : ok - displaying a %i \n", i_coding_type);
/* modulo & 0x3 is here to add some randomness */
if
(
i_delay
<
(
1
+
(
p_vpar
->
synchro
.
modulo
&
0x3
))
*
p_vpar
->
synchro
.
i_mean_decode_time
)
{
//fprintf( stderr, "trashed a B\n");
return
(
0
);
}
if
(
p_vpar
->
synchro
.
displayable_b
<=
0
)
return
(
0
);
p_vpar
->
synchro
.
displayable_b
--
;
return
(
1
);
}
return
(
keep
);
return
(
0
);
}
...
...
@@ -296,7 +358,9 @@ void vpar_SynchroEnd( vpar_thread_t * p_vpar )
p_vpar
->
synchro
.
i_mean_decode_time
=
(
7
*
p_vpar
->
synchro
.
i_mean_decode_time
+
i_decode_time
)
/
8
;
//fprintf (stderr, "decoding time is %lli\n", p_vpar->synchro.i_mean_decode_time);
/* fprintf (stderr,
"decoding time was %lli\n",
p_vpar->synchro.i_mean_decode_time); */
p_vpar
->
synchro
.
i_fifo_start
=
(
p_vpar
->
synchro
.
i_fifo_start
+
1
)
&
0xf
;
...
...
@@ -308,12 +372,23 @@ void vpar_SynchroEnd( vpar_thread_t * p_vpar )
mtime_t
vpar_SynchroDate
(
vpar_thread_t
*
p_vpar
)
{
mtime_t
i_displaydate
=
p_vpar
->
synchro
.
i_last_display_pts
;
static
mtime_t
i_delta
=
0
;
//fprintf(stderr, "displaying type %i with delay %lli and delta %lli\n", p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_image_type, i_displaydate - mdate(), i_displaydate - i_delta);
//fprintf (stderr, "theorical fps: %f - actual fps: %f \n", p_vpar->synchro.theorical_fps, p_vpar->synchro.actual_fps);
#if 0
static mtime_t i_delta = 0;
fprintf( stderr,
"displaying type %i with delay %lli and delta %lli\n",
p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_start].i_image_type,
i_displaydate - mdate(),
i_displaydate - i_delta );
fprintf (stderr,
"theorical fps: %f - actual fps: %f \n",
p_vpar->synchro.theorical_fps, p_vpar->synchro.actual_fps );
i_delta = i_displaydate;
#endif
return
i_displaydate
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment