Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
7193f020
Commit
7193f020
authored
Oct 30, 2017
by
Arild Fuldseth (arilfuld)
Committed by
Arild Fuldseth
Nov 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement approved version of FRAME_SIZE experiment
Change-Id: I5b7bb9983e1c613321704a579d459925bd6b9b2b
parent
ca9132d0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
212 additions
and
8 deletions
+212
-8
av1/av1_dx_iface.c
av1/av1_dx_iface.c
+34
-0
av1/common/onyxc_int.h
av1/common/onyxc_int.h
+6
-0
av1/decoder/decodeframe.c
av1/decoder/decodeframe.c
+72
-2
av1/decoder/decodeframe.h
av1/decoder/decodeframe.h
+5
-0
av1/encoder/bitstream.c
av1/encoder/bitstream.c
+95
-6
No files found.
av1/av1_dx_iface.c
View file @
7193f020
...
...
@@ -281,7 +281,11 @@ static aom_codec_err_t decoder_peek_si_internal(
}
error_resilient
=
aom_rb_read_bit
(
&
rb
);
#if CONFIG_REFERENCE_BUFFER
#if CONFIG_FRAME_SIZE
SequenceHeader
seq_params
=
{
0
,
0
,
0
,
0
,
0
,
0
,
0
};
#else
SequenceHeader
seq_params
=
{
0
,
0
,
0
};
#endif
if
(
si
->
is_kf
)
{
/* TODO: Move outside frame loop or inside key-frame branch */
read_sequence_header
(
&
seq_params
,
&
rb
);
...
...
@@ -290,15 +294,33 @@ static aom_codec_err_t decoder_peek_si_internal(
#endif // CONFIG_EXT_TILE
}
#endif // CONFIG_REFERENCE_BUFFER
#if CONFIG_REFERENCE_BUFFER
if
(
seq_params
.
frame_id_numbers_present_flag
)
{
aom_rb_read_literal
(
&
rb
,
seq_params
.
frame_id_length
);
}
#endif // CONFIG_REFERENCE_BUFFER
#if CONFIG_FRAME_SIZE
int
frame_size_override_flag
=
aom_rb_read_bit
(
&
rb
);
#endif
if
(
si
->
is_kf
)
{
if
(
!
parse_bitdepth_colorspace_sampling
(
profile
,
&
rb
))
return
AOM_CODEC_UNSUP_BITSTREAM
;
#if CONFIG_FRAME_SIZE
if
(
frame_size_override_flag
)
{
int
num_bits_width
=
seq_params
.
num_bits_width
;
int
num_bits_height
=
seq_params
.
num_bits_height
;
av1_read_frame_size
(
&
rb
,
num_bits_width
,
num_bits_height
,
(
int
*
)
&
si
->
w
,
(
int
*
)
&
si
->
h
);
}
else
{
si
->
w
=
seq_params
.
max_frame_width
;
si
->
h
=
seq_params
.
max_frame_height
;
}
#else
av1_read_frame_size
(
&
rb
,
(
int
*
)
&
si
->
w
,
(
int
*
)
&
si
->
h
);
#endif
}
else
{
rb
.
bit_offset
+=
error_resilient
?
0
:
2
;
// reset_frame_context
...
...
@@ -308,7 +330,19 @@ static aom_codec_err_t decoder_peek_si_internal(
return
AOM_CODEC_UNSUP_BITSTREAM
;
}
rb
.
bit_offset
+=
REF_FRAMES
;
// refresh_frame_flags
#if CONFIG_FRAME_SIZE
if
(
frame_size_override_flag
)
{
int
num_bits_width
=
seq_params
.
num_bits_width
;
int
num_bits_height
=
seq_params
.
num_bits_height
;
av1_read_frame_size
(
&
rb
,
num_bits_width
,
num_bits_height
,
(
int
*
)
&
si
->
w
,
(
int
*
)
&
si
->
h
);
}
else
{
si
->
w
=
seq_params
.
max_frame_width
;
si
->
h
=
seq_params
.
max_frame_height
;
}
#else
av1_read_frame_size
(
&
rb
,
(
int
*
)
&
si
->
w
,
(
int
*
)
&
si
->
h
);
#endif
}
}
#endif // CONFIG_OBU
...
...
av1/common/onyxc_int.h
View file @
7193f020
...
...
@@ -193,6 +193,12 @@ typedef int BASE_CTX_TABLE[2 /*col*/][3 /*sig_map*/]
#if CONFIG_REFERENCE_BUFFER
/* Initial version of sequence header structure */
typedef
struct
SequenceHeader
{
#if CONFIG_FRAME_SIZE
int
num_bits_width
;
int
num_bits_height
;
int
max_frame_width
;
int
max_frame_height
;
#endif
int
frame_id_numbers_present_flag
;
int
frame_id_length
;
int
delta_frame_id_length
;
...
...
av1/decoder/decodeframe.c
View file @
7193f020
...
...
@@ -1519,7 +1519,11 @@ static void setup_render_size(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
cm
->
render_height
=
cm
->
height
;
#endif // CONFIG_FRAME_SUPERRES
if
(
aom_rb_read_bit
(
rb
))
#if CONFIG_FRAME_SIZE
av1_read_frame_size
(
rb
,
16
,
16
,
&
cm
->
render_width
,
&
cm
->
render_height
);
#else
av1_read_frame_size
(
rb
,
&
cm
->
render_width
,
&
cm
->
render_height
);
#endif
}
#if CONFIG_FRAME_SUPERRES
...
...
@@ -1575,10 +1579,26 @@ static void resize_context_buffers(AV1_COMMON *cm, int width, int height) {
cm
->
cur_frame
->
height
=
cm
->
height
;
}
#if CONFIG_FRAME_SIZE
static
void
setup_frame_size
(
AV1_COMMON
*
cm
,
int
frame_size_override_flag
,
struct
aom_read_bit_buffer
*
rb
)
{
#else
static
void
setup_frame_size
(
AV1_COMMON
*
cm
,
struct
aom_read_bit_buffer
*
rb
)
{
#endif
int
width
,
height
;
BufferPool
*
const
pool
=
cm
->
buffer_pool
;
#if CONFIG_FRAME_SIZE
if
(
frame_size_override_flag
)
{
int
num_bits_width
=
cm
->
seq_params
.
num_bits_width
;
int
num_bits_height
=
cm
->
seq_params
.
num_bits_height
;
av1_read_frame_size
(
rb
,
num_bits_width
,
num_bits_height
,
&
width
,
&
height
);
}
else
{
width
=
cm
->
seq_params
.
max_frame_width
;
height
=
cm
->
seq_params
.
max_frame_height
;
}
#else
av1_read_frame_size
(
rb
,
&
width
,
&
height
);
#endif
#if CONFIG_FRAME_SUPERRES
setup_superres
(
cm
,
rb
,
&
width
,
&
height
);
#endif // CONFIG_FRAME_SUPERRES
...
...
@@ -1655,7 +1675,13 @@ static void setup_frame_size_with_refs(AV1_COMMON *cm,
}
if
(
!
found
)
{
#if CONFIG_FRAME_SIZE
int
num_bits_width
=
cm
->
seq_params
.
num_bits_width
;
int
num_bits_height
=
cm
->
seq_params
.
num_bits_height
;
av1_read_frame_size
(
rb
,
num_bits_width
,
num_bits_height
,
&
width
,
&
height
);
#else
av1_read_frame_size
(
rb
,
&
width
,
&
height
);
#endif
#if CONFIG_FRAME_SUPERRES
setup_superres
(
cm
,
rb
,
&
width
,
&
height
);
#endif // CONFIG_FRAME_SUPERRES
...
...
@@ -2554,6 +2580,18 @@ static void read_bitdepth_colorspace_sampling(AV1_COMMON *cm,
#if CONFIG_REFERENCE_BUFFER
void
read_sequence_header
(
SequenceHeader
*
seq_params
,
struct
aom_read_bit_buffer
*
rb
)
{
#if CONFIG_FRAME_SIZE
int
num_bits_width
=
aom_rb_read_literal
(
rb
,
4
)
+
1
;
int
num_bits_height
=
aom_rb_read_literal
(
rb
,
4
)
+
1
;
int
max_frame_width
=
aom_rb_read_literal
(
rb
,
num_bits_width
)
+
1
;
int
max_frame_height
=
aom_rb_read_literal
(
rb
,
num_bits_height
)
+
1
;
seq_params
->
num_bits_width
=
num_bits_width
;
seq_params
->
num_bits_height
=
num_bits_height
;
seq_params
->
max_frame_width
=
max_frame_width
;
seq_params
->
max_frame_height
=
max_frame_height
;
#endif
/* Placeholder for actually reading from the bitstream */
seq_params
->
frame_id_numbers_present_flag
=
aom_rb_read_bit
(
rb
);
if
(
seq_params
->
frame_id_numbers_present_flag
)
{
...
...
@@ -2876,6 +2914,11 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
}
}
#endif // CONFIG_REFERENCE_BUFFER
#if CONFIG_FRAME_SIZE
int
frame_size_override_flag
=
aom_rb_read_literal
(
rb
,
1
);
#endif
if
(
cm
->
frame_type
==
KEY_FRAME
)
{
cm
->
current_video_frame
=
0
;
#if !CONFIG_OBU
...
...
@@ -2891,7 +2934,11 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
#endif // CONFIG_VAR_REFS
}
#if CONFIG_FRAME_SIZE
setup_frame_size
(
cm
,
frame_size_override_flag
,
rb
);
#else
setup_frame_size
(
cm
,
rb
);
#endif
setup_sb_size
(
cm
,
rb
);
if
(
pbi
->
need_resync
)
{
...
...
@@ -2950,7 +2997,11 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
#endif
pbi
->
refresh_frame_flags
=
aom_rb_read_literal
(
rb
,
REF_FRAMES
);
#if CONFIG_FRAME_SIZE
setup_frame_size
(
cm
,
frame_size_override_flag
,
rb
);
#else
setup_frame_size
(
cm
,
rb
);
#endif
setup_sb_size
(
cm
,
rb
);
if
(
pbi
->
need_resync
)
{
memset
(
&
cm
->
ref_frame_map
,
-
1
,
sizeof
(
cm
->
ref_frame_map
));
...
...
@@ -3029,10 +3080,10 @@ static size_t read_uncompressed_header(AV1Decoder *pbi,
#endif // CONFIG_VAR_REFS
#if CONFIG_FRAME_SIZE
if
(
cm
->
error_resilient_mode
==
0
)
{
if
(
cm
->
error_resilient_mode
==
0
&&
frame_size_override_flag
)
{
setup_frame_size_with_refs
(
cm
,
rb
);
}
else
{
setup_frame_size
(
cm
,
rb
);
setup_frame_size
(
cm
,
frame_size_override_flag
,
rb
);
}
#else
setup_frame_size_with_refs
(
cm
,
rb
);
...
...
@@ -3510,10 +3561,17 @@ static struct aom_read_bit_buffer *init_read_bit_buffer(
//------------------------------------------------------------------------------
#if CONFIG_FRAME_SIZE
void
av1_read_frame_size
(
struct
aom_read_bit_buffer
*
rb
,
int
num_bits_width
,
int
num_bits_height
,
int
*
width
,
int
*
height
)
{
*
width
=
aom_rb_read_literal
(
rb
,
num_bits_width
)
+
1
;
*
height
=
aom_rb_read_literal
(
rb
,
num_bits_height
)
+
1
;
#else
void
av1_read_frame_size
(
struct
aom_read_bit_buffer
*
rb
,
int
*
width
,
int
*
height
)
{
*
width
=
aom_rb_read_literal
(
rb
,
16
)
+
1
;
*
height
=
aom_rb_read_literal
(
rb
,
16
)
+
1
;
#endif
}
BITSTREAM_PROFILE
av1_read_profile
(
struct
aom_read_bit_buffer
*
rb
)
{
...
...
@@ -3890,6 +3948,18 @@ static uint32_t read_sequence_header_obu(AV1Decoder *pbi,
cm
->
profile
=
av1_read_profile
(
rb
);
aom_rb_read_literal
(
rb
,
4
);
// level
#if CONFIG_FRAME_SIZE
int
num_bits_width
=
aom_rb_read_literal
(
rb
,
4
)
+
1
;
int
num_bits_height
=
aom_rb_read_literal
(
rb
,
4
)
+
1
;
int
max_frame_width
=
aom_rb_read_literal
(
rb
,
num_bits_width
)
+
1
;
int
max_frame_height
=
aom_rb_read_literal
(
rb
,
num_bits_height
)
+
1
;
seq_params
->
num_bits_width
=
num_bits_width
;
seq_params
->
num_bits_height
=
num_bits_height
;
seq_params
->
max_frame_width
=
max_frame_width
;
seq_params
->
max_frame_height
=
max_frame_height
;
#endif
seq_params
->
frame_id_numbers_present_flag
=
aom_rb_read_bit
(
rb
);
if
(
seq_params
->
frame_id_numbers_present_flag
)
{
// We must always have delta_frame_id_length < frame_id_length,
...
...
av1/decoder/decodeframe.h
View file @
7193f020
...
...
@@ -25,8 +25,13 @@ void read_sequence_header(SequenceHeader *seq_params,
struct
aom_read_bit_buffer
*
rb
);
#endif
#if CONFIG_FRAME_SIZE
void
av1_read_frame_size
(
struct
aom_read_bit_buffer
*
rb
,
int
num_bits_width
,
int
num_bits_height
,
int
*
width
,
int
*
height
);
#else
void
av1_read_frame_size
(
struct
aom_read_bit_buffer
*
rb
,
int
*
width
,
int
*
height
);
#endif
BITSTREAM_PROFILE
av1_read_profile
(
struct
aom_read_bit_buffer
*
rb
);
// This function is now obsolete
...
...
av1/encoder/bitstream.c
View file @
7193f020
...
...
@@ -3570,15 +3570,30 @@ static void write_superres_scale(const AV1_COMMON *const cm,
}
#endif // CONFIG_FRAME_SUPERRES
#if CONFIG_FRAME_SIZE
static
void
write_frame_size
(
const
AV1_COMMON
*
cm
,
int
frame_size_override
,
struct
aom_write_bit_buffer
*
wb
)
{
#else
static
void
write_frame_size
(
const
AV1_COMMON
*
cm
,
struct
aom_write_bit_buffer
*
wb
)
{
#endif
#if CONFIG_FRAME_SUPERRES
aom_wb_write_literal
(
wb
,
cm
->
superres_upscaled_width
-
1
,
16
);
aom_wb_write_literal
(
wb
,
cm
->
superres_upscaled_height
-
1
,
16
);
write_superres_scale
(
cm
,
wb
);
#else
#if CONFIG_FRAME_SIZE
if
(
frame_size_override
)
{
const
SequenceHeader
*
seq_params
=
&
cm
->
seq_params
;
int
num_bits_width
=
seq_params
->
num_bits_width
;
int
num_bits_height
=
seq_params
->
num_bits_height
;
aom_wb_write_literal
(
wb
,
cm
->
width
-
1
,
num_bits_width
);
aom_wb_write_literal
(
wb
,
cm
->
height
-
1
,
num_bits_height
);
}
#else
aom_wb_write_literal
(
wb
,
cm
->
width
-
1
,
16
);
aom_wb_write_literal
(
wb
,
cm
->
height
-
1
,
16
);
#endif
#endif // CONFIG_FRAME_SUPERRES
write_render_size
(
cm
,
wb
);
}
...
...
@@ -3612,7 +3627,14 @@ static void write_frame_size_with_refs(AV1_COMP *cpi,
}
}
#if CONFIG_FRAME_SIZE
if
(
!
found
)
{
int
frame_size_override
=
1
;
// Allways equal to 1 in this function
write_frame_size
(
cm
,
frame_size_override
,
wb
);
}
#else
if
(
!
found
)
write_frame_size
(
cm
,
wb
);
#endif
}
static
void
write_profile
(
BITSTREAM_PROFILE
profile
,
...
...
@@ -3664,6 +3686,24 @@ static void write_bitdepth_colorspace_sampling(
void
write_sequence_header
(
AV1_COMMON
*
const
cm
,
struct
aom_write_bit_buffer
*
wb
)
{
SequenceHeader
*
seq_params
=
&
cm
->
seq_params
;
#if CONFIG_FRAME_SIZE
int
num_bits_width
=
16
;
int
num_bits_height
=
16
;
int
max_frame_width
=
cm
->
width
;
int
max_frame_height
=
cm
->
height
;
seq_params
->
num_bits_width
=
num_bits_width
;
seq_params
->
num_bits_height
=
num_bits_height
;
seq_params
->
max_frame_width
=
max_frame_width
;
seq_params
->
max_frame_height
=
max_frame_height
;
aom_wb_write_literal
(
wb
,
num_bits_width
-
1
,
4
);
aom_wb_write_literal
(
wb
,
num_bits_height
-
1
,
4
);
aom_wb_write_literal
(
wb
,
max_frame_width
-
1
,
num_bits_width
);
aom_wb_write_literal
(
wb
,
max_frame_height
-
1
,
num_bits_height
);
#endif
/* Placeholder for actually writing to the bitstream */
seq_params
->
frame_id_numbers_present_flag
=
#if CONFIG_EXT_TILE
...
...
@@ -3881,9 +3921,21 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
aom_wb_write_literal
(
wb
,
cm
->
current_frame_id
,
frame_id_len
);
}
#endif // CONFIG_REFERENCE_BUFFER
#if CONFIG_FRAME_SIZE
int
frame_size_override_flag
=
(
cm
->
width
!=
cm
->
seq_params
.
max_frame_width
||
cm
->
height
!=
cm
->
seq_params
.
max_frame_height
);
aom_wb_write_bit
(
wb
,
frame_size_override_flag
);
#endif
if
(
cm
->
frame_type
==
KEY_FRAME
)
{
write_bitdepth_colorspace_sampling
(
cm
,
wb
);
#if CONFIG_FRAME_SIZE
write_frame_size
(
cm
,
frame_size_override_flag
,
wb
);
#else
write_frame_size
(
cm
,
wb
);
#endif
write_sb_size
(
cm
,
wb
);
#if CONFIG_ANS && ANS_MAX_SYMBOLS
...
...
@@ -3924,7 +3976,11 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
write_bitdepth_colorspace_sampling
(
cm
,
wb
);
aom_wb_write_literal
(
wb
,
cpi
->
refresh_frame_mask
,
REF_FRAMES
);
#if CONFIG_FRAME_SIZE
write_frame_size
(
cm
,
frame_size_override_flag
,
wb
);
#else
write_frame_size
(
cm
,
wb
);
#endif
#if CONFIG_ANS && ANS_MAX_SYMBOLS
assert
(
cpi
->
common
.
ans_window_size_log2
>=
8
);
...
...
@@ -3968,10 +4024,10 @@ static void write_uncompressed_header_frame(AV1_COMP *cpi,
}
#if CONFIG_FRAME_SIZE
if
(
cm
->
error_resilient_mode
==
0
)
{
if
(
cm
->
error_resilient_mode
==
0
&&
frame_size_override_flag
)
{
write_frame_size_with_refs
(
cpi
,
wb
);
}
else
{
write_frame_size
(
cm
,
wb
);
write_frame_size
(
cm
,
frame_size_override_flag
,
wb
);
}
#else
write_frame_size_with_refs
(
cpi
,
wb
);
...
...
@@ -4168,8 +4224,20 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
aom_wb_write_literal
(
wb
,
cm
->
current_frame_id
,
frame_id_len
);
}
#endif // CONFIG_REFERENCE_BUFFER
#if CONFIG_FRAME_SIZE
int
frame_size_override_flag
=
(
cm
->
width
!=
cm
->
seq_params
.
max_frame_width
||
cm
->
height
!=
cm
->
seq_params
.
max_frame_height
);
aom_wb_write_bit
(
wb
,
frame_size_override_flag
);
#endif
if
(
cm
->
frame_type
==
KEY_FRAME
)
{
#if CONFIG_FRAME_SIZE
write_frame_size
(
cm
,
frame_size_override_flag
,
wb
);
#else
write_frame_size
(
cm
,
wb
);
#endif
write_sb_size
(
cm
,
wb
);
#if CONFIG_ANS && ANS_MAX_SYMBOLS
...
...
@@ -4202,7 +4270,11 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
if
(
cm
->
intra_only
)
{
aom_wb_write_literal
(
wb
,
cpi
->
refresh_frame_mask
,
REF_FRAMES
);
#if CONFIG_FRAME_SIZE
write_frame_size
(
cm
,
frame_size_override_flag
,
wb
);
#else
write_frame_size
(
cm
,
wb
);
#endif
#if CONFIG_ANS && ANS_MAX_SYMBOLS
assert
(
cpi
->
common
.
ans_window_size_log2
>=
8
);
...
...
@@ -4256,10 +4328,10 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
}
#if CONFIG_FRAME_SIZE
if
(
cm
->
error_resilient_mode
==
0
)
{
if
(
cm
->
error_resilient_mode
==
0
&&
frame_size_override_flag
)
{
write_frame_size_with_refs
(
cpi
,
wb
);
}
else
{
write_frame_size
(
cm
,
wb
);
write_frame_size
(
cm
,
frame_size_override_flag
,
wb
);
}
#else
write_frame_size_with_refs
(
cpi
,
wb
);
...
...
@@ -4321,10 +4393,10 @@ static void write_uncompressed_header_obu(AV1_COMP *cpi,
}
#if CONFIG_FRAME_SIZE
if
(
cm
->
error_resilient_mode
==
0
)
{
if
(
cm
->
error_resilient_mode
==
0
&&
frame_size_override_flag
)
{
write_frame_size_with_refs
(
cpi
,
wb
);
}
else
{
write_frame_size
(
cm
,
wb
);
write_frame_size
(
cm
,
frame_size_override_flag
,
wb
);
}
#else
write_frame_size_with_refs
(
cpi
,
wb
);
...
...
@@ -4744,6 +4816,23 @@ static uint32_t write_sequence_header_obu(AV1_COMP *cpi, uint8_t *const dst) {
aom_wb_write_literal
(
&
wb
,
0
,
4
);
#if CONFIG_FRAME_SIZE
int
num_bits_width
=
16
;
int
num_bits_height
=
16
;
int
max_frame_width
=
cm
->
width
;
int
max_frame_height
=
cm
->
height
;
seq_params
->
num_bits_width
=
num_bits_width
;
seq_params
->
num_bits_height
=
num_bits_height
;
seq_params
->
max_frame_width
=
max_frame_width
;
seq_params
->
max_frame_height
=
max_frame_height
;
aom_wb_write_literal
(
&
wb
,
num_bits_width
-
1
,
4
);
aom_wb_write_literal
(
&
wb
,
num_bits_height
-
1
,
4
);
aom_wb_write_literal
(
&
wb
,
max_frame_width
-
1
,
num_bits_width
);
aom_wb_write_literal
(
&
wb
,
max_frame_height
-
1
,
num_bits_height
);
#endif
seq_params
->
frame_id_numbers_present_flag
=
FRAME_ID_NUMBERS_PRESENT_FLAG
;
aom_wb_write_literal
(
&
wb
,
seq_params
->
frame_id_numbers_present_flag
,
1
);
if
(
seq_params
->
frame_id_numbers_present_flag
)
{
...
...
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