Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
François Cartegnie
dav1d
Commits
13f3658b
Verified
Commit
13f3658b
authored
Oct 23, 2018
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
obu: fix parsing of decoder model info bits
Working only for the first Operating Point for now.
parent
4abd6949
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
11 deletions
+27
-11
src/levels.h
src/levels.h
+5
-5
src/obu.c
src/obu.c
+22
-6
No files found.
src/levels.h
View file @
13f3658b
...
...
@@ -315,8 +315,6 @@ typedef struct Av1SequenceHeader {
int
equal_picture_interval
;
int
num_ticks_per_picture
;
int
decoder_model_info_present
;
int
bitrate_scale
;
int
buffer_size_scale
;
int
encoder_decoder_buffer_delay_length
;
int
num_units_in_decoding_tick
;
int
buffer_removal_delay_length
;
...
...
@@ -328,9 +326,6 @@ typedef struct Av1SequenceHeader {
int
major_level
,
minor_level
;
int
tier
;
int
decoder_model_param_present
;
int
bitrate
;
int
buffer_size
;
int
cbr
;
int
decoder_buffer_delay
;
int
encoder_buffer_delay
;
int
low_delay_mode
;
...
...
@@ -414,6 +409,7 @@ typedef struct Av1FrameHeader {
int
show_existing_frame
;
int
existing_frame_idx
;
int
frame_id
;
int
frame_presentation_delay
;
enum
Dav1dFrameType
frame_type
;
int
show_frame
;
int
showable_frame
;
...
...
@@ -424,6 +420,10 @@ typedef struct Av1FrameHeader {
int
frame_size_override
;
#define PRIMARY_REF_NONE 7
int
primary_ref_frame
;
int
buffer_removal_time_present
;
struct
Av1FrameHeaderOperatingPoint
{
int
buffer_removal_time
;
}
operating_points
[
32
];
int
frame_offset
;
int
refresh_frame_flags
;
int
width
,
height
;
...
...
src/obu.c
View file @
13f3658b
...
...
@@ -86,8 +86,6 @@ static int parse_seq_hdr(Dav1dContext *const c, GetBits *const gb) {
hdr
->
decoder_model_info_present
=
dav1d_get_bits
(
gb
,
1
);
if
(
hdr
->
decoder_model_info_present
)
{
hdr
->
bitrate_scale
=
dav1d_get_bits
(
gb
,
4
);
hdr
->
buffer_size_scale
=
dav1d_get_bits
(
gb
,
4
);
hdr
->
encoder_decoder_buffer_delay_length
=
dav1d_get_bits
(
gb
,
5
)
+
1
;
hdr
->
num_units_in_decoding_tick
=
dav1d_get_bits
(
gb
,
32
);
hdr
->
buffer_removal_delay_length
=
dav1d_get_bits
(
gb
,
5
)
+
1
;
...
...
@@ -113,9 +111,6 @@ static int parse_seq_hdr(Dav1dContext *const c, GetBits *const gb) {
op
->
decoder_model_param_present
=
hdr
->
decoder_model_info_present
&&
dav1d_get_bits
(
gb
,
1
);
if
(
op
->
decoder_model_param_present
)
{
op
->
bitrate
=
dav1d_get_vlc
(
gb
)
+
1
;
op
->
buffer_size
=
dav1d_get_vlc
(
gb
)
+
1
;
op
->
cbr
=
dav1d_get_bits
(
gb
,
1
);
op
->
decoder_buffer_delay
=
dav1d_get_bits
(
gb
,
hdr
->
encoder_decoder_buffer_delay_length
);
op
->
encoder_buffer_delay
=
...
...
@@ -335,6 +330,8 @@ static int parse_frame_hdr(Dav1dContext *const c, GetBits *const gb,
#endif
if
(
hdr
->
show_existing_frame
)
{
hdr
->
existing_frame_idx
=
dav1d_get_bits
(
gb
,
3
);
if
(
seqhdr
->
decoder_model_info_present
&&
!
seqhdr
->
equal_picture_interval
)
hdr
->
frame_presentation_delay
=
dav1d_get_bits
(
gb
,
seqhdr
->
frame_presentation_delay_length
);
if
(
seqhdr
->
frame_id_numbers_present
)
hdr
->
frame_id
=
dav1d_get_bits
(
gb
,
seqhdr
->
frame_id_n_bits
);
goto
end
;
...
...
@@ -342,7 +339,10 @@ static int parse_frame_hdr(Dav1dContext *const c, GetBits *const gb,
hdr
->
frame_type
=
seqhdr
->
reduced_still_picture_header
?
DAV1D_FRAME_TYPE_KEY
:
dav1d_get_bits
(
gb
,
2
);
hdr
->
show_frame
=
seqhdr
->
reduced_still_picture_header
||
dav1d_get_bits
(
gb
,
1
);
if
(
!
hdr
->
show_frame
)
if
(
hdr
->
show_frame
)
{
if
(
seqhdr
->
decoder_model_info_present
&&
!
seqhdr
->
equal_picture_interval
)
hdr
->
frame_presentation_delay
=
dav1d_get_bits
(
gb
,
seqhdr
->
frame_presentation_delay_length
);
}
else
hdr
->
showable_frame
=
dav1d_get_bits
(
gb
,
1
);
hdr
->
error_resilient_mode
=
(
hdr
->
frame_type
==
DAV1D_FRAME_TYPE_KEY
&&
hdr
->
show_frame
)
||
...
...
@@ -378,6 +378,22 @@ static int parse_frame_hdr(Dav1dContext *const c, GetBits *const gb,
hdr
->
primary_ref_frame
=
!
hdr
->
error_resilient_mode
&&
hdr
->
frame_type
&
1
?
dav1d_get_bits
(
gb
,
3
)
:
PRIMARY_REF_NONE
;
if
(
seqhdr
->
decoder_model_info_present
)
{
hdr
->
buffer_removal_time_present
=
dav1d_get_bits
(
gb
,
1
);
if
(
hdr
->
buffer_removal_time_present
)
{
for
(
int
i
=
0
;
i
<
c
->
seq_hdr
.
num_operating_points
;
i
++
)
{
const
struct
Av1SequenceHeaderOperatingPoint
*
const
seqop
=
&
seqhdr
->
operating_points
[
i
];
struct
Av1FrameHeaderOperatingPoint
*
const
op
=
&
hdr
->
operating_points
[
i
];
if
(
seqop
->
decoder_model_param_present
)
{
int
in_temporal_layer
=
(
seqop
->
idc
>>
0
/* FIXME: temporal_id */
)
&
1
;
int
in_spatial_layer
=
(
seqop
->
idc
>>
(
0
/* FIXME: spatial_id */
+
8
))
&
1
;
if
(
!
seqop
->
idc
||
in_temporal_layer
||
in_spatial_layer
)
op
->
buffer_removal_time
=
dav1d_get_bits
(
gb
,
seqhdr
->
buffer_removal_delay_length
);
}
}
}
}
if
(
hdr
->
frame_type
==
DAV1D_FRAME_TYPE_KEY
||
hdr
->
frame_type
==
DAV1D_FRAME_TYPE_INTRA
)
{
...
...
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