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
0b44624c
Commit
0b44624c
authored
Apr 19, 2013
by
Dmitry Kovalev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finally removing BOOL_DECODER and using vp9_reader instead.
Change-Id: I03d5b6f22f0930893709c6db5f1b06762ad3354e
parent
2a1efafd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
43 deletions
+42
-43
test/vp9_boolcoder_test.cc
test/vp9_boolcoder_test.cc
+2
-2
vp9/decoder/vp9_dboolhuff.c
vp9/decoder/vp9_dboolhuff.c
+24
-15
vp9/decoder/vp9_dboolhuff.h
vp9/decoder/vp9_dboolhuff.h
+10
-18
vp9/decoder/vp9_decodframe.c
vp9/decoder/vp9_decodframe.c
+6
-6
vp9/decoder/vp9_treereader.h
vp9/decoder/vp9_treereader.h
+0
-2
No files found.
test/vp9_boolcoder_test.cc
View file @
0b44624c
...
...
@@ -68,8 +68,8 @@ TEST(VP9, TestBitIO) {
vp9_stop_encode
(
&
bw
);
BOOL_DECODER
br
;
vp9_
start_decode
(
&
br
,
bw_buffer
,
buffer_size
);
vp9_reader
br
;
vp9_
reader_init
(
&
br
,
bw_buffer
,
buffer_size
);
bit_rnd
.
Reset
(
random_seed
);
for
(
int
i
=
0
;
i
<
bits_to_test
;
++
i
)
{
if
(
bit_method
==
2
)
{
...
...
vp9/decoder/vp9_dboolhuff.c
View file @
0b44624c
...
...
@@ -13,25 +13,25 @@
#include "vp9/decoder/vp9_dboolhuff.h"
int
vp9_
start_decode
(
BOOL_DECODER
*
b
r
,
const
uint8_t
*
buffer
,
size_t
size
)
{
b
r
->
buffer_end
=
buffer
+
size
;
b
r
->
buffer
=
buffer
;
b
r
->
value
=
0
;
b
r
->
count
=
-
8
;
b
r
->
range
=
255
;
int
vp9_
reader_init
(
vp9_reader
*
r
,
const
uint8_t
*
buffer
,
size_t
size
)
{
r
->
buffer_end
=
buffer
+
size
;
r
->
buffer
=
buffer
;
r
->
value
=
0
;
r
->
count
=
-
8
;
r
->
range
=
255
;
if
(
size
&&
!
buffer
)
return
1
;
vp9_reader_fill
(
b
r
);
vp9_reader_fill
(
r
);
return
0
;
}
void
vp9_reader_fill
(
BOOL_DECODER
*
b
r
)
{
const
uint8_t
*
const
buffer_end
=
b
r
->
buffer_end
;
const
uint8_t
*
buffer
=
b
r
->
buffer
;
VP9_BD_VALUE
value
=
b
r
->
value
;
int
count
=
b
r
->
count
;
void
vp9_reader_fill
(
vp9_reader
*
r
)
{
const
uint8_t
*
const
buffer_end
=
r
->
buffer_end
;
const
uint8_t
*
buffer
=
r
->
buffer
;
VP9_BD_VALUE
value
=
r
->
value
;
int
count
=
r
->
count
;
int
shift
=
VP9_BD_VALUE_SIZE
-
8
-
(
count
+
8
);
int
loop_end
=
0
;
const
int
bits_left
=
(
int
)((
buffer_end
-
buffer
)
*
CHAR_BIT
);
...
...
@@ -50,8 +50,17 @@ void vp9_reader_fill(BOOL_DECODER *br) {
}
}
br
->
buffer
=
buffer
;
br
->
value
=
value
;
br
->
count
=
count
;
r
->
buffer
=
buffer
;
r
->
value
=
value
;
r
->
count
=
count
;
}
const
uint8_t
*
vp9_reader_find_end
(
vp9_reader
*
r
)
{
// Find the end of the coded buffer
while
(
r
->
count
>
CHAR_BIT
&&
r
->
count
<
VP9_BD_VALUE_SIZE
)
{
r
->
count
-=
CHAR_BIT
;
r
->
buffer
--
;
}
return
r
->
buffer
;
}
vp9/decoder/vp9_dboolhuff.h
View file @
0b44624c
...
...
@@ -33,24 +33,17 @@ typedef struct {
VP9_BD_VALUE
value
;
int
count
;
unsigned
int
range
;
}
BOOL_DECODER
;
}
vp9_reader
;
DECLARE_ALIGNED
(
16
,
extern
const
uint8_t
,
vp9_norm
[
256
]);
int
vp9_
start_decode
(
BOOL_DECODER
*
b
r
,
const
uint8_t
*
buffer
,
size_t
size
);
int
vp9_
reader_init
(
vp9_reader
*
r
,
const
uint8_t
*
buffer
,
size_t
size
);
void
vp9_reader_fill
(
BOOL_DECODER
*
b
r
);
void
vp9_reader_fill
(
vp9_reader
*
r
);
static
INLINE
const
uint8_t
*
vp9_reader_find_end
(
BOOL_DECODER
*
br
)
{
// Find the end of the coded buffer
while
(
br
->
count
>
CHAR_BIT
&&
br
->
count
<
VP9_BD_VALUE_SIZE
)
{
br
->
count
-=
CHAR_BIT
;
br
->
buffer
--
;
}
return
br
->
buffer
;
}
const
uint8_t
*
vp9_reader_find_end
(
vp9_reader
*
r
);
static
int
vp9_read
(
BOOL_DECODER
*
br
,
int
probability
)
{
static
int
vp9_read
(
vp9_reader
*
br
,
int
probability
)
{
unsigned
int
bit
=
0
;
VP9_BD_VALUE
value
;
VP9_BD_VALUE
bigsplit
;
...
...
@@ -87,21 +80,20 @@ static int vp9_read(BOOL_DECODER *br, int probability) {
return
bit
;
}
static
int
vp9_read_bit
(
BOOL_DECODER
*
r
)
{
static
int
vp9_read_bit
(
vp9_reader
*
r
)
{
return
vp9_read
(
r
,
128
);
// vp9_prob_half
}
static
int
vp9_read_literal
(
BOOL_DECODER
*
br
,
int
bits
)
{
static
int
vp9_read_literal
(
vp9_reader
*
br
,
int
bits
)
{
int
z
=
0
,
bit
;
for
(
bit
=
bits
-
1
;
bit
>=
0
;
bit
--
)
{
for
(
bit
=
bits
-
1
;
bit
>=
0
;
bit
--
)
z
|=
vp9_read_bit
(
br
)
<<
bit
;
}
return
z
;
}
static
int
bool_error
(
BOOL_DECODER
*
b
r
)
{
static
int
vp9_reader_has_error
(
vp9_reader
*
r
)
{
// Check if we have reached the end of the buffer.
//
// Variable 'count' stores the number of bits in the 'value' buffer, minus
...
...
@@ -116,7 +108,7 @@ static int bool_error(BOOL_DECODER *br) {
//
// 1 if we have tried to decode bits after the end of stream was encountered.
// 0 No error.
return
b
r
->
count
>
VP9_BD_VALUE_SIZE
&&
b
r
->
count
<
VP9_LOTS_OF_BITS
;
return
r
->
count
>
VP9_BD_VALUE_SIZE
&&
r
->
count
<
VP9_LOTS_OF_BITS
;
}
#endif // VP9_DECODER_VP9_DBOOLHUFF_H_
vp9/decoder/vp9_decodframe.c
View file @
0b44624c
...
...
@@ -715,7 +715,7 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
if
(
xd
->
segmentation_enabled
)
mb_init_dequantizer
(
pbi
,
xd
);
if
(
!
bool
_error
(
r
))
{
if
(
!
vp9_reader_has
_error
(
r
))
{
#if CONFIG_NEWBINTRAMODES
if
(
mode
!=
I4X4_PRED
)
#endif
...
...
@@ -727,7 +727,7 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
mode
!=
I4X4_PRED
&&
mode
!=
SPLITMV
&&
mode
!=
I8X8_PRED
&&
!
bool
_error
(
r
))
{
!
vp9_reader_has
_error
(
r
))
{
xd
->
mode_info_context
->
mbmi
.
mb_skip_coeff
=
1
;
}
else
{
#if 0 // def DEC_DEBUG
...
...
@@ -867,7 +867,7 @@ static void decode_modes_b(VP9D_COMP *pbi, int mb_row, int mb_col,
else
decode_mb
(
pbi
,
xd
,
mb_row
,
mb_col
,
r
);
xd
->
corrupted
|=
bool
_error
(
r
);
xd
->
corrupted
|=
vp9_reader_has
_error
(
r
);
}
static
void
decode_modes_sb
(
VP9D_COMP
*
pbi
,
int
mb_row
,
int
mb_col
,
...
...
@@ -958,7 +958,7 @@ static void setup_token_decoder(VP9D_COMP *pbi,
"Truncated packet or corrupt partition "
"%d length"
,
1
);
if
(
vp9_
start_decode
(
r
,
data
,
partition_size
))
if
(
vp9_
reader_init
(
r
,
data
,
partition_size
))
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_MEM_ERROR
,
"Failed to allocate bool decoder %d"
,
1
);
}
...
...
@@ -1533,7 +1533,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
pc
->
width
,
pc
->
height
,
VP9BORDERINPIXELS
);
if
(
vp9_
start_decode
(
&
header_bc
,
data
,
first_partition_size
))
if
(
vp9_
reader_init
(
&
header_bc
,
data
,
first_partition_size
))
vpx_internal_error
(
&
pc
->
error
,
VPX_CODEC_MEM_ERROR
,
"Failed to allocate bool decoder 0"
);
...
...
@@ -1684,7 +1684,7 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
// Collect information about decoder corruption.
// 1. Check first boolean decoder for errors.
// 2. Check the macroblock information
pc
->
yv12_fb
[
pc
->
new_fb_idx
].
corrupted
=
bool
_error
(
&
header_bc
)
|
pc
->
yv12_fb
[
pc
->
new_fb_idx
].
corrupted
=
vp9_reader_has
_error
(
&
header_bc
)
|
corrupt_tokens
;
if
(
!
pbi
->
decoded_key_frame
)
{
...
...
vp9/decoder/vp9_treereader.h
View file @
0b44624c
...
...
@@ -15,8 +15,6 @@
#include "vp9/common/vp9_treecoder.h"
#include "vp9/decoder/vp9_dboolhuff.h"
typedef
BOOL_DECODER
vp9_reader
;
#define vp9_read_prob(r) ((vp9_prob)vp9_read_literal(r, 8))
#define vp9_read_and_apply_sign(r, value) (vp9_read_bit(r) ? -(value) : (value))
...
...
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