Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Yushin Cho
aom-rav1e
Commits
0fc4d4e1
Commit
0fc4d4e1
authored
Jul 21, 2015
by
Yaowu Xu
Committed by
Gerrit Code Review
Jul 21, 2015
Browse files
Merge "vpx_dsp/bitreader_buffer.h: vp9_->vpx_"
parents
ac1e1b69
cbce0037
Changes
4
Hide whitespace changes
Inline
Side-by-side
vp9/decoder/vp9_decodeframe.c
View file @
0fc4d4e1
...
...
@@ -75,7 +75,7 @@ static int read_is_valid(const uint8_t *start, size_t len, const uint8_t *end) {
}
static
int
decode_unsigned_max
(
struct
vpx_read_bit_buffer
*
rb
,
int
max
)
{
const
int
data
=
vp
9
_rb_read_literal
(
rb
,
get_unsigned_bits
(
max
));
const
int
data
=
vp
x
_rb_read_literal
(
rb
,
get_unsigned_bits
(
max
));
return
data
>
max
?
max
:
data
;
}
...
...
@@ -1051,21 +1051,21 @@ static void setup_segmentation(struct segmentation *seg,
seg
->
update_map
=
0
;
seg
->
update_data
=
0
;
seg
->
enabled
=
vp
9
_rb_read_bit
(
rb
);
seg
->
enabled
=
vp
x
_rb_read_bit
(
rb
);
if
(
!
seg
->
enabled
)
return
;
// Segmentation map update
seg
->
update_map
=
vp
9
_rb_read_bit
(
rb
);
seg
->
update_map
=
vp
x
_rb_read_bit
(
rb
);
if
(
seg
->
update_map
)
{
for
(
i
=
0
;
i
<
SEG_TREE_PROBS
;
i
++
)
seg
->
tree_probs
[
i
]
=
vp
9
_rb_read_bit
(
rb
)
?
vp
9
_rb_read_literal
(
rb
,
8
)
seg
->
tree_probs
[
i
]
=
vp
x
_rb_read_bit
(
rb
)
?
vp
x
_rb_read_literal
(
rb
,
8
)
:
MAX_PROB
;
seg
->
temporal_update
=
vp
9
_rb_read_bit
(
rb
);
seg
->
temporal_update
=
vp
x
_rb_read_bit
(
rb
);
if
(
seg
->
temporal_update
)
{
for
(
i
=
0
;
i
<
PREDICTION_PROBS
;
i
++
)
seg
->
pred_probs
[
i
]
=
vp
9
_rb_read_bit
(
rb
)
?
vp
9
_rb_read_literal
(
rb
,
8
)
seg
->
pred_probs
[
i
]
=
vp
x
_rb_read_bit
(
rb
)
?
vp
x
_rb_read_literal
(
rb
,
8
)
:
MAX_PROB
;
}
else
{
for
(
i
=
0
;
i
<
PREDICTION_PROBS
;
i
++
)
...
...
@@ -1074,21 +1074,21 @@ static void setup_segmentation(struct segmentation *seg,
}
// Segmentation data update
seg
->
update_data
=
vp
9
_rb_read_bit
(
rb
);
seg
->
update_data
=
vp
x
_rb_read_bit
(
rb
);
if
(
seg
->
update_data
)
{
seg
->
abs_delta
=
vp
9
_rb_read_bit
(
rb
);
seg
->
abs_delta
=
vp
x
_rb_read_bit
(
rb
);
vp9_clearall_segfeatures
(
seg
);
for
(
i
=
0
;
i
<
MAX_SEGMENTS
;
i
++
)
{
for
(
j
=
0
;
j
<
SEG_LVL_MAX
;
j
++
)
{
int
data
=
0
;
const
int
feature_enabled
=
vp
9
_rb_read_bit
(
rb
);
const
int
feature_enabled
=
vp
x
_rb_read_bit
(
rb
);
if
(
feature_enabled
)
{
vp9_enable_segfeature
(
seg
,
i
,
j
);
data
=
decode_unsigned_max
(
rb
,
vp9_seg_feature_data_max
(
j
));
if
(
vp9_is_segfeature_signed
(
j
))
data
=
vp
9
_rb_read_bit
(
rb
)
?
-
data
:
data
;
data
=
vp
x
_rb_read_bit
(
rb
)
?
-
data
:
data
;
}
vp9_set_segdata
(
seg
,
i
,
j
,
data
);
}
...
...
@@ -1098,37 +1098,37 @@ static void setup_segmentation(struct segmentation *seg,
static
void
setup_loopfilter
(
struct
loopfilter
*
lf
,
struct
vpx_read_bit_buffer
*
rb
)
{
lf
->
filter_level
=
vp
9
_rb_read_literal
(
rb
,
6
);
lf
->
sharpness_level
=
vp
9
_rb_read_literal
(
rb
,
3
);
lf
->
filter_level
=
vp
x
_rb_read_literal
(
rb
,
6
);
lf
->
sharpness_level
=
vp
x
_rb_read_literal
(
rb
,
3
);
// Read in loop filter deltas applied at the MB level based on mode or ref
// frame.
lf
->
mode_ref_delta_update
=
0
;
lf
->
mode_ref_delta_enabled
=
vp
9
_rb_read_bit
(
rb
);
lf
->
mode_ref_delta_enabled
=
vp
x
_rb_read_bit
(
rb
);
if
(
lf
->
mode_ref_delta_enabled
)
{
lf
->
mode_ref_delta_update
=
vp
9
_rb_read_bit
(
rb
);
lf
->
mode_ref_delta_update
=
vp
x
_rb_read_bit
(
rb
);
if
(
lf
->
mode_ref_delta_update
)
{
int
i
;
for
(
i
=
0
;
i
<
MAX_REF_LF_DELTAS
;
i
++
)
if
(
vp
9
_rb_read_bit
(
rb
))
lf
->
ref_deltas
[
i
]
=
vp
9
_rb_read_signed_literal
(
rb
,
6
);
if
(
vp
x
_rb_read_bit
(
rb
))
lf
->
ref_deltas
[
i
]
=
vp
x
_rb_read_signed_literal
(
rb
,
6
);
for
(
i
=
0
;
i
<
MAX_MODE_LF_DELTAS
;
i
++
)
if
(
vp
9
_rb_read_bit
(
rb
))
lf
->
mode_deltas
[
i
]
=
vp
9
_rb_read_signed_literal
(
rb
,
6
);
if
(
vp
x
_rb_read_bit
(
rb
))
lf
->
mode_deltas
[
i
]
=
vp
x
_rb_read_signed_literal
(
rb
,
6
);
}
}
}
static
INLINE
int
read_delta_q
(
struct
vpx_read_bit_buffer
*
rb
)
{
return
vp
9
_rb_read_bit
(
rb
)
?
vp
9
_rb_read_signed_literal
(
rb
,
4
)
:
0
;
return
vp
x
_rb_read_bit
(
rb
)
?
vp
x
_rb_read_signed_literal
(
rb
,
4
)
:
0
;
}
static
void
setup_quantization
(
VP9_COMMON
*
const
cm
,
MACROBLOCKD
*
const
xd
,
struct
vpx_read_bit_buffer
*
rb
)
{
cm
->
base_qindex
=
vp
9
_rb_read_literal
(
rb
,
QINDEX_BITS
);
cm
->
base_qindex
=
vp
x
_rb_read_literal
(
rb
,
QINDEX_BITS
);
cm
->
y_dc_delta_q
=
read_delta_q
(
rb
);
cm
->
uv_dc_delta_q
=
read_delta_q
(
rb
);
cm
->
uv_ac_delta_q
=
read_delta_q
(
rb
);
...
...
@@ -1175,14 +1175,14 @@ static INTERP_FILTER read_interp_filter(struct vpx_read_bit_buffer *rb) {
EIGHTTAP
,
EIGHTTAP_SHARP
,
BILINEAR
};
return
vp
9
_rb_read_bit
(
rb
)
?
SWITCHABLE
:
literal_to_filter
[
vp
9
_rb_read_literal
(
rb
,
2
)];
return
vp
x
_rb_read_bit
(
rb
)
?
SWITCHABLE
:
literal_to_filter
[
vp
x
_rb_read_literal
(
rb
,
2
)];
}
static
void
setup_display_size
(
VP9_COMMON
*
cm
,
struct
vpx_read_bit_buffer
*
rb
)
{
cm
->
display_width
=
cm
->
width
;
cm
->
display_height
=
cm
->
height
;
if
(
vp
9
_rb_read_bit
(
rb
))
if
(
vp
x
_rb_read_bit
(
rb
))
vp9_read_frame_size
(
rb
,
&
cm
->
display_width
,
&
cm
->
display_height
);
}
...
...
@@ -1271,7 +1271,7 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
int
has_valid_ref_frame
=
0
;
BufferPool
*
const
pool
=
cm
->
buffer_pool
;
for
(
i
=
0
;
i
<
REFS_PER_FRAME
;
++
i
)
{
if
(
vp
9
_rb_read_bit
(
rb
))
{
if
(
vp
x
_rb_read_bit
(
rb
))
{
YV12_BUFFER_CONFIG
*
const
buf
=
cm
->
frame_refs
[
i
].
buf
;
width
=
buf
->
y_crop_width
;
height
=
buf
->
y_crop_height
;
...
...
@@ -1344,7 +1344,7 @@ static void setup_tile_info(VP9_COMMON *cm, struct vpx_read_bit_buffer *rb) {
// columns
max_ones
=
max_log2_tile_cols
-
min_log2_tile_cols
;
cm
->
log2_tile_cols
=
min_log2_tile_cols
;
while
(
max_ones
--
&&
vp
9
_rb_read_bit
(
rb
))
while
(
max_ones
--
&&
vp
x
_rb_read_bit
(
rb
))
cm
->
log2_tile_cols
++
;
if
(
cm
->
log2_tile_cols
>
6
)
...
...
@@ -1352,9 +1352,9 @@ static void setup_tile_info(VP9_COMMON *cm, struct vpx_read_bit_buffer *rb) {
"Invalid number of tile columns"
);
// rows
cm
->
log2_tile_rows
=
vp
9
_rb_read_bit
(
rb
);
cm
->
log2_tile_rows
=
vp
x
_rb_read_bit
(
rb
);
if
(
cm
->
log2_tile_rows
)
cm
->
log2_tile_rows
+=
vp
9
_rb_read_bit
(
rb
);
cm
->
log2_tile_rows
+=
vp
x
_rb_read_bit
(
rb
);
}
typedef
struct
TileBuffer
{
...
...
@@ -1760,7 +1760,7 @@ static void error_handler(void *data) {
static
void
read_bitdepth_colorspace_sampling
(
VP9_COMMON
*
cm
,
struct
vpx_read_bit_buffer
*
rb
)
{
if
(
cm
->
profile
>=
PROFILE_2
)
{
cm
->
bit_depth
=
vp
9
_rb_read_bit
(
rb
)
?
VPX_BITS_12
:
VPX_BITS_10
;
cm
->
bit_depth
=
vp
x
_rb_read_bit
(
rb
)
?
VPX_BITS_12
:
VPX_BITS_10
;
#if CONFIG_VP9_HIGHBITDEPTH
cm
->
use_highbitdepth
=
1
;
#endif
...
...
@@ -1770,16 +1770,16 @@ static void read_bitdepth_colorspace_sampling(
cm
->
use_highbitdepth
=
0
;
#endif
}
cm
->
color_space
=
vp
9
_rb_read_literal
(
rb
,
3
);
cm
->
color_space
=
vp
x
_rb_read_literal
(
rb
,
3
);
if
(
cm
->
color_space
!=
VPX_CS_SRGB
)
{
vp
9
_rb_read_bit
(
rb
);
// [16,235] (including xvycc) vs [0,255] range
vp
x
_rb_read_bit
(
rb
);
// [16,235] (including xvycc) vs [0,255] range
if
(
cm
->
profile
==
PROFILE_1
||
cm
->
profile
==
PROFILE_3
)
{
cm
->
subsampling_x
=
vp
9
_rb_read_bit
(
rb
);
cm
->
subsampling_y
=
vp
9
_rb_read_bit
(
rb
);
cm
->
subsampling_x
=
vp
x
_rb_read_bit
(
rb
);
cm
->
subsampling_y
=
vp
x
_rb_read_bit
(
rb
);
if
(
cm
->
subsampling_x
==
1
&&
cm
->
subsampling_y
==
1
)
vpx_internal_error
(
&
cm
->
error
,
VPX_CODEC_UNSUP_BITSTREAM
,
"4:2:0 color not supported in profile 1 or 3"
);
if
(
vp
9
_rb_read_bit
(
rb
))
if
(
vp
x
_rb_read_bit
(
rb
))
vpx_internal_error
(
&
cm
->
error
,
VPX_CODEC_UNSUP_BITSTREAM
,
"Reserved bit set"
);
}
else
{
...
...
@@ -1790,7 +1790,7 @@ static void read_bitdepth_colorspace_sampling(
// Note if colorspace is SRGB then 4:4:4 chroma sampling is assumed.
// 4:2:2 or 4:4:0 chroma sampling is not allowed.
cm
->
subsampling_y
=
cm
->
subsampling_x
=
0
;
if
(
vp
9
_rb_read_bit
(
rb
))
if
(
vp
x
_rb_read_bit
(
rb
))
vpx_internal_error
(
&
cm
->
error
,
VPX_CODEC_UNSUP_BITSTREAM
,
"Reserved bit set"
);
}
else
{
...
...
@@ -1811,7 +1811,7 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
cm
->
last_frame_type
=
cm
->
frame_type
;
cm
->
last_intra_only
=
cm
->
intra_only
;
if
(
vp
9
_rb_read_literal
(
rb
,
2
)
!=
VP9_FRAME_MARKER
)
if
(
vp
x
_rb_read_literal
(
rb
,
2
)
!=
VP9_FRAME_MARKER
)
vpx_internal_error
(
&
cm
->
error
,
VPX_CODEC_UNSUP_BITSTREAM
,
"Invalid frame marker"
);
...
...
@@ -1826,10 +1826,10 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
"Unsupported bitstream profile"
);
#endif
cm
->
show_existing_frame
=
vp
9
_rb_read_bit
(
rb
);
cm
->
show_existing_frame
=
vp
x
_rb_read_bit
(
rb
);
if
(
cm
->
show_existing_frame
)
{
// Show an existing frame directly.
const
int
frame_to_show
=
cm
->
ref_frame_map
[
vp
9
_rb_read_literal
(
rb
,
3
)];
const
int
frame_to_show
=
cm
->
ref_frame_map
[
vp
x
_rb_read_literal
(
rb
,
3
)];
lock_buffer_pool
(
pool
);
if
(
frame_to_show
<
0
||
frame_bufs
[
frame_to_show
].
ref_count
<
1
)
{
unlock_buffer_pool
(
pool
);
...
...
@@ -1851,9 +1851,9 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
return
0
;
}
cm
->
frame_type
=
(
FRAME_TYPE
)
vp
9
_rb_read_bit
(
rb
);
cm
->
show_frame
=
vp
9
_rb_read_bit
(
rb
);
cm
->
error_resilient_mode
=
vp
9
_rb_read_bit
(
rb
);
cm
->
frame_type
=
(
FRAME_TYPE
)
vp
x
_rb_read_bit
(
rb
);
cm
->
show_frame
=
vp
x
_rb_read_bit
(
rb
);
cm
->
error_resilient_mode
=
vp
x
_rb_read_bit
(
rb
);
if
(
cm
->
frame_type
==
KEY_FRAME
)
{
if
(
!
vp9_read_sync_code
(
rb
))
...
...
@@ -1874,10 +1874,10 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
pbi
->
need_resync
=
0
;
}
}
else
{
cm
->
intra_only
=
cm
->
show_frame
?
0
:
vp
9
_rb_read_bit
(
rb
);
cm
->
intra_only
=
cm
->
show_frame
?
0
:
vp
x
_rb_read_bit
(
rb
);
cm
->
reset_frame_context
=
cm
->
error_resilient_mode
?
0
:
vp
9
_rb_read_literal
(
rb
,
2
);
0
:
vp
x
_rb_read_literal
(
rb
,
2
);
if
(
cm
->
intra_only
)
{
if
(
!
vp9_read_sync_code
(
rb
))
...
...
@@ -1898,26 +1898,26 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
#endif
}
pbi
->
refresh_frame_flags
=
vp
9
_rb_read_literal
(
rb
,
REF_FRAMES
);
pbi
->
refresh_frame_flags
=
vp
x
_rb_read_literal
(
rb
,
REF_FRAMES
);
setup_frame_size
(
cm
,
rb
);
if
(
pbi
->
need_resync
)
{
memset
(
&
cm
->
ref_frame_map
,
-
1
,
sizeof
(
cm
->
ref_frame_map
));
pbi
->
need_resync
=
0
;
}
}
else
if
(
pbi
->
need_resync
!=
1
)
{
/* Skip if need resync */
pbi
->
refresh_frame_flags
=
vp
9
_rb_read_literal
(
rb
,
REF_FRAMES
);
pbi
->
refresh_frame_flags
=
vp
x
_rb_read_literal
(
rb
,
REF_FRAMES
);
for
(
i
=
0
;
i
<
REFS_PER_FRAME
;
++
i
)
{
const
int
ref
=
vp
9
_rb_read_literal
(
rb
,
REF_FRAMES_LOG2
);
const
int
ref
=
vp
x
_rb_read_literal
(
rb
,
REF_FRAMES_LOG2
);
const
int
idx
=
cm
->
ref_frame_map
[
ref
];
RefBuffer
*
const
ref_frame
=
&
cm
->
frame_refs
[
i
];
ref_frame
->
idx
=
idx
;
ref_frame
->
buf
=
&
frame_bufs
[
idx
].
buf
;
cm
->
ref_frame_sign_bias
[
LAST_FRAME
+
i
]
=
vp
9
_rb_read_bit
(
rb
);
cm
->
ref_frame_sign_bias
[
LAST_FRAME
+
i
]
=
vp
x
_rb_read_bit
(
rb
);
}
setup_frame_size_with_refs
(
cm
,
rb
);
cm
->
allow_high_precision_mv
=
vp
9
_rb_read_bit
(
rb
);
cm
->
allow_high_precision_mv
=
vp
x
_rb_read_bit
(
rb
);
cm
->
interp_filter
=
read_interp_filter
(
rb
);
for
(
i
=
0
;
i
<
REFS_PER_FRAME
;
++
i
)
{
...
...
@@ -1949,8 +1949,8 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
}
if
(
!
cm
->
error_resilient_mode
)
{
cm
->
refresh_frame_context
=
vp
9
_rb_read_bit
(
rb
);
cm
->
frame_parallel_decoding_mode
=
vp
9
_rb_read_bit
(
rb
);
cm
->
refresh_frame_context
=
vp
x
_rb_read_bit
(
rb
);
cm
->
frame_parallel_decoding_mode
=
vp
x
_rb_read_bit
(
rb
);
}
else
{
cm
->
refresh_frame_context
=
0
;
cm
->
frame_parallel_decoding_mode
=
1
;
...
...
@@ -1958,7 +1958,7 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
// This flag will be overridden by the call to vp9_setup_past_independence
// below, forcing the use of context 0 for those frame types.
cm
->
frame_context_idx
=
vp
9
_rb_read_literal
(
rb
,
FRAME_CONTEXTS_LOG2
);
cm
->
frame_context_idx
=
vp
x
_rb_read_literal
(
rb
,
FRAME_CONTEXTS_LOG2
);
// Generate next_ref_frame_map.
lock_buffer_pool
(
pool
);
...
...
@@ -1993,7 +1993,7 @@ static size_t read_uncompressed_header(VP9Decoder *pbi,
setup_segmentation_dequant
(
cm
);
setup_tile_info
(
cm
,
rb
);
sz
=
vp
9
_rb_read_literal
(
rb
,
16
);
sz
=
vp
x
_rb_read_literal
(
rb
,
16
);
if
(
sz
==
0
)
vpx_internal_error
(
&
cm
->
error
,
VPX_CODEC_CORRUPT_FRAME
,
...
...
@@ -2115,22 +2115,22 @@ static struct vpx_read_bit_buffer *init_read_bit_buffer(
//------------------------------------------------------------------------------
int
vp9_read_sync_code
(
struct
vpx_read_bit_buffer
*
const
rb
)
{
return
vp
9
_rb_read_literal
(
rb
,
8
)
==
VP9_SYNC_CODE_0
&&
vp
9
_rb_read_literal
(
rb
,
8
)
==
VP9_SYNC_CODE_1
&&
vp
9
_rb_read_literal
(
rb
,
8
)
==
VP9_SYNC_CODE_2
;
return
vp
x
_rb_read_literal
(
rb
,
8
)
==
VP9_SYNC_CODE_0
&&
vp
x
_rb_read_literal
(
rb
,
8
)
==
VP9_SYNC_CODE_1
&&
vp
x
_rb_read_literal
(
rb
,
8
)
==
VP9_SYNC_CODE_2
;
}
void
vp9_read_frame_size
(
struct
vpx_read_bit_buffer
*
rb
,
int
*
width
,
int
*
height
)
{
*
width
=
vp
9
_rb_read_literal
(
rb
,
16
)
+
1
;
*
height
=
vp
9
_rb_read_literal
(
rb
,
16
)
+
1
;
*
width
=
vp
x
_rb_read_literal
(
rb
,
16
)
+
1
;
*
height
=
vp
x
_rb_read_literal
(
rb
,
16
)
+
1
;
}
BITSTREAM_PROFILE
vp9_read_profile
(
struct
vpx_read_bit_buffer
*
rb
)
{
int
profile
=
vp
9
_rb_read_bit
(
rb
);
profile
|=
vp
9
_rb_read_bit
(
rb
)
<<
1
;
int
profile
=
vp
x
_rb_read_bit
(
rb
);
profile
|=
vp
x
_rb_read_bit
(
rb
)
<<
1
;
if
(
profile
>
2
)
profile
+=
vp
9
_rb_read_bit
(
rb
);
profile
+=
vp
x
_rb_read_bit
(
rb
);
return
(
BITSTREAM_PROFILE
)
profile
;
}
...
...
@@ -2155,7 +2155,7 @@ void vp9_decode_frame(VP9Decoder *pbi,
return
;
}
data
+=
vp
9
_rb_bytes_read
(
&
rb
);
data
+=
vp
x
_rb_bytes_read
(
&
rb
);
if
(
!
read_is_valid
(
data
,
first_partition_size
,
data_end
))
vpx_internal_error
(
&
cm
->
error
,
VPX_CODEC_CORRUPT_FRAME
,
"Truncated packet or corrupt header length"
);
...
...
vp9/vp9_dx_iface.c
View file @
0fc4d4e1
...
...
@@ -149,7 +149,7 @@ static int parse_bitdepth_colorspace_sampling(
vpx_color_space_t
color_space
;
if
(
profile
>=
PROFILE_2
)
rb
->
bit_offset
+=
1
;
// Bit-depth 10 or 12.
color_space
=
(
vpx_color_space_t
)
vp
9
_rb_read_literal
(
rb
,
3
);
color_space
=
(
vpx_color_space_t
)
vp
x
_rb_read_literal
(
rb
,
3
);
if
(
color_space
!=
VPX_CS_SRGB
)
{
rb
->
bit_offset
+=
1
;
// [16,235] (including xvycc) vs [0,255] range.
if
(
profile
==
PROFILE_1
||
profile
==
PROFILE_3
)
{
...
...
@@ -192,7 +192,7 @@ static vpx_codec_err_t decoder_peek_si_internal(const uint8_t *data,
int
show_frame
;
int
error_resilient
;
struct
vpx_read_bit_buffer
rb
=
{
data
,
data
+
data_sz
,
0
,
NULL
,
NULL
};
const
int
frame_marker
=
vp
9
_rb_read_literal
(
&
rb
,
2
);
const
int
frame_marker
=
vp
x
_rb_read_literal
(
&
rb
,
2
);
const
BITSTREAM_PROFILE
profile
=
vp9_read_profile
(
&
rb
);
if
(
frame_marker
!=
VP9_FRAME_MARKER
)
...
...
@@ -204,17 +204,17 @@ static vpx_codec_err_t decoder_peek_si_internal(const uint8_t *data,
if
((
profile
>=
2
&&
data_sz
<=
1
)
||
data_sz
<
1
)
return
VPX_CODEC_UNSUP_BITSTREAM
;
if
(
vp
9
_rb_read_bit
(
&
rb
))
{
// show an existing frame
vp
9
_rb_read_literal
(
&
rb
,
3
);
// Frame buffer to show.
if
(
vp
x
_rb_read_bit
(
&
rb
))
{
// show an existing frame
vp
x
_rb_read_literal
(
&
rb
,
3
);
// Frame buffer to show.
return
VPX_CODEC_OK
;
}
if
(
data_sz
<=
8
)
return
VPX_CODEC_UNSUP_BITSTREAM
;
si
->
is_kf
=
!
vp
9
_rb_read_bit
(
&
rb
);
show_frame
=
vp
9
_rb_read_bit
(
&
rb
);
error_resilient
=
vp
9
_rb_read_bit
(
&
rb
);
si
->
is_kf
=
!
vp
x
_rb_read_bit
(
&
rb
);
show_frame
=
vp
x
_rb_read_bit
(
&
rb
);
error_resilient
=
vp
x
_rb_read_bit
(
&
rb
);
if
(
si
->
is_kf
)
{
if
(
!
vp9_read_sync_code
(
&
rb
))
...
...
@@ -224,7 +224,7 @@ static vpx_codec_err_t decoder_peek_si_internal(const uint8_t *data,
return
VPX_CODEC_UNSUP_BITSTREAM
;
vp9_read_frame_size
(
&
rb
,
(
int
*
)
&
si
->
w
,
(
int
*
)
&
si
->
h
);
}
else
{
intra_only_flag
=
show_frame
?
0
:
vp
9
_rb_read_bit
(
&
rb
);
intra_only_flag
=
show_frame
?
0
:
vp
x
_rb_read_bit
(
&
rb
);
rb
.
bit_offset
+=
error_resilient
?
0
:
2
;
// reset_frame_context
...
...
vpx_dsp/bitreader_buffer.c
View file @
0fc4d4e1
...
...
@@ -9,11 +9,11 @@
*/
#include "./bitreader_buffer.h"
size_t
vp
9
_rb_bytes_read
(
struct
vpx_read_bit_buffer
*
rb
)
{
size_t
vp
x
_rb_bytes_read
(
struct
vpx_read_bit_buffer
*
rb
)
{
return
(
rb
->
bit_offset
+
7
)
>>
3
;
}
int
vp
9
_rb_read_bit
(
struct
vpx_read_bit_buffer
*
rb
)
{
int
vp
x
_rb_read_bit
(
struct
vpx_read_bit_buffer
*
rb
)
{
const
size_t
off
=
rb
->
bit_offset
;
const
size_t
p
=
off
>>
3
;
const
int
q
=
7
-
(
int
)(
off
&
0x7
);
...
...
@@ -27,15 +27,15 @@ int vp9_rb_read_bit(struct vpx_read_bit_buffer *rb) {
}
}
int
vp
9
_rb_read_literal
(
struct
vpx_read_bit_buffer
*
rb
,
int
bits
)
{
int
vp
x
_rb_read_literal
(
struct
vpx_read_bit_buffer
*
rb
,
int
bits
)
{
int
value
=
0
,
bit
;
for
(
bit
=
bits
-
1
;
bit
>=
0
;
bit
--
)
value
|=
vp
9
_rb_read_bit
(
rb
)
<<
bit
;
value
|=
vp
x
_rb_read_bit
(
rb
)
<<
bit
;
return
value
;
}
int
vp
9
_rb_read_signed_literal
(
struct
vpx_read_bit_buffer
*
rb
,
int
vp
x
_rb_read_signed_literal
(
struct
vpx_read_bit_buffer
*
rb
,
int
bits
)
{
const
int
value
=
vp
9
_rb_read_literal
(
rb
,
bits
);
return
vp
9
_rb_read_bit
(
rb
)
?
-
value
:
value
;
const
int
value
=
vp
x
_rb_read_literal
(
rb
,
bits
);
return
vp
x
_rb_read_bit
(
rb
)
?
-
value
:
value
;
}
vpx_dsp/bitreader_buffer.h
View file @
0fc4d4e1
...
...
@@ -19,7 +19,7 @@
extern
"C"
{
#endif
typedef
void
(
*
vp
9
_rb_error_handler
)(
void
*
data
);
typedef
void
(
*
vp
x
_rb_error_handler
)(
void
*
data
);
struct
vpx_read_bit_buffer
{
const
uint8_t
*
bit_buffer
;
...
...
@@ -27,16 +27,16 @@ struct vpx_read_bit_buffer {
size_t
bit_offset
;
void
*
error_handler_data
;
vp
9
_rb_error_handler
error_handler
;
vp
x
_rb_error_handler
error_handler
;
};
size_t
vp
9
_rb_bytes_read
(
struct
vpx_read_bit_buffer
*
rb
);
size_t
vp
x
_rb_bytes_read
(
struct
vpx_read_bit_buffer
*
rb
);
int
vp
9
_rb_read_bit
(
struct
vpx_read_bit_buffer
*
rb
);
int
vp
x
_rb_read_bit
(
struct
vpx_read_bit_buffer
*
rb
);
int
vp
9
_rb_read_literal
(
struct
vpx_read_bit_buffer
*
rb
,
int
bits
);
int
vp
x
_rb_read_literal
(
struct
vpx_read_bit_buffer
*
rb
,
int
bits
);
int
vp
9
_rb_read_signed_literal
(
struct
vpx_read_bit_buffer
*
rb
,
int
bits
);
int
vp
x
_rb_read_signed_literal
(
struct
vpx_read_bit_buffer
*
rb
,
int
bits
);
#ifdef __cplusplus
}
// extern "C"
...
...
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