Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
dav1d
Commits
a72f2679
Commit
a72f2679
authored
Sep 27, 2018
by
Ronald S. Bultje
Browse files
Add flush function
parent
916dc654
Pipeline
#599
passed with stage
in 1 minute and 37 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
include/dav1d/dav1d.h
View file @
a72f2679
...
...
@@ -84,4 +84,9 @@ DAV1D_API int dav1d_decode(Dav1dContext *c, Dav1dData *in, Dav1dPicture *out);
*/
DAV1D_API
void
dav1d_close
(
Dav1dContext
**
c_out
);
/**
* Flush all delayed frames in decoder, to be used when seeking.
*/
DAV1D_API
void
dav1d_flush
(
Dav1dContext
*
c
);
#endif
/* __DAV1D_H__ */
src/decode.c
View file @
a72f2679
...
...
@@ -2688,7 +2688,7 @@ int submit_frame(Dav1dContext *const c) {
&
f
->
frame_thread
.
td
.
lock
);
out_delayed
=
&
c
->
frame_thread
.
out_delayed
[
next
];
if
(
out_delayed
->
p
.
data
[
0
])
{
if
(
out_delayed
->
visible
)
if
(
out_delayed
->
visible
&&
!
out_delayed
->
flushed
)
dav1d_picture_ref
(
&
c
->
out
,
&
out_delayed
->
p
);
dav1d_thread_picture_unref
(
out_delayed
);
}
...
...
src/lib.c
View file @
a72f2679
...
...
@@ -178,7 +178,7 @@ int dav1d_decode(Dav1dContext *const c,
if
(
++
c
->
frame_thread
.
next
==
c
->
n_fc
)
c
->
frame_thread
.
next
=
0
;
if
(
out_delayed
->
p
.
data
[
0
])
{
if
(
out_delayed
->
visible
)
{
if
(
out_delayed
->
visible
&&
!
out_delayed
->
flushed
)
{
dav1d_picture_ref
(
out
,
&
out_delayed
->
p
);
}
dav1d_thread_picture_unref
(
out_delayed
);
...
...
@@ -215,6 +215,13 @@ int dav1d_decode(Dav1dContext *const c,
return
-
EAGAIN
;
}
void
dav1d_flush
(
Dav1dContext
*
const
c
)
{
if
(
c
->
n_fc
==
1
)
return
;
for
(
int
n
=
0
;
n
<
c
->
n_fc
;
n
++
)
c
->
frame_thread
.
out_delayed
[
n
].
flushed
=
1
;
}
void
dav1d_close
(
Dav1dContext
**
const
c_out
)
{
validate_input
(
c_out
!=
NULL
);
...
...
src/obu.c
View file @
a72f2679
...
...
@@ -1088,13 +1088,14 @@ int parse_obus(Dav1dContext *const c, Dav1dData *const in) {
Dav1dThreadPicture
*
const
out_delayed
=
&
c
->
frame_thread
.
out_delayed
[
next
];
if
(
out_delayed
->
p
.
data
[
0
])
{
if
(
out_delayed
->
visible
)
if
(
out_delayed
->
visible
&&
!
out_delayed
->
flushed
)
dav1d_picture_ref
(
&
c
->
out
,
&
out_delayed
->
p
);
dav1d_thread_picture_unref
(
out_delayed
);
}
dav1d_thread_picture_ref
(
out_delayed
,
&
c
->
refs
[
c
->
frame_hdr
.
existing_frame_idx
].
p
);
out_delayed
->
visible
=
1
;
out_delayed
->
flushed
=
0
;
pthread_mutex_unlock
(
&
f
->
frame_thread
.
td
.
lock
);
}
c
->
have_frame_hdr
=
0
;
...
...
src/picture.c
View file @
a72f2679
...
...
@@ -102,6 +102,7 @@ int dav1d_thread_picture_alloc(Dav1dThreadPicture *const p,
(
void
**
)
&
p
->
progress
);
p
->
visible
=
visible
;
p
->
flushed
=
0
;
if
(
t
)
{
atomic_init
(
&
p
->
progress
[
0
],
0
);
atomic_init
(
&
p
->
progress
[
1
],
0
);
...
...
@@ -128,6 +129,7 @@ void dav1d_thread_picture_ref(Dav1dThreadPicture *dst,
dst
->
t
=
src
->
t
;
dst
->
visible
=
src
->
visible
;
dst
->
progress
=
src
->
progress
;
dst
->
flushed
=
src
->
flushed
;
}
void
dav1d_picture_unref
(
Dav1dPicture
*
const
p
)
{
...
...
src/picture.h
View file @
a72f2679
...
...
@@ -44,7 +44,7 @@ enum PlaneType {
typedef
struct
Dav1dThreadPicture
{
Dav1dPicture
p
;
int
visible
;
int
visible
,
flushed
;
struct
thread_data
*
t
;
// [0] block data (including segmentation map and motion vectors)
// [1] pixel data
...
...
Write
Preview
Supports
Markdown
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