Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
868ecb55
Commit
868ecb55
authored
12 years ago
by
John Koleszar
Committed by
Gerrit Code Review
12 years ago
Browse files
Options
Download
Plain Diff
Merge "Tokenization code cleanup." into experimental
parents
edb1222a
063628c8
v1.14.0-linphone
1.4.X
experimental
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
forest
frame_parallel
highbitdepth
indianrunnerduck
javanwhistlingduck
khakicampbell
linphone
linphone-android
linphone-old
longtailedduck
m29-baseline
m31-baseline
m49-2623
m52-2743
m54-2840
m56-2924
m66-3359
m68-3440
mandarinduck
mcw
mcw2
nextgen
nextgenv2
pcs-2013
playground
sandbox/Jingning/experimental
sandbox/Jingning/transcode
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/debargha/playground
sandbox/hkuang/frame_parallel
sandbox/hkuang@google.com/decode
sandbox/jimbankoski@google.com/proposed-aom
sandbox/jingning@google.com/decoder_test_suite
sandbox/jingning@google.com/experimental
sandbox/jzern@google.com/test
sandbox/wangch@google.com/vp9
sandbox/yaowu@google.com/mergeaom
stable-vp9-decoder
v1.12.0-linphone
v1.6.1_linphone
v1.7.0-linphone
v1.9.0-linphone
v1.9.0
v1.9.0-rc1
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.0
v1.3.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vp9/decoder/vp9_detokenize.c
+72
-160
vp9/decoder/vp9_detokenize.c
with
72 additions
and
160 deletions
vp9/decoder/vp9_detokenize.c
+
72
−
160
View file @
868ecb55
...
...
@@ -59,10 +59,11 @@ static const vp9_prob cat6_prob[15] = {
DECLARE_ALIGNED
(
16
,
extern
const
uint8_t
,
vp9_norm
[
256
]);
static
int
get_signed
(
BOOL_DECODER
*
br
,
int
value_to_sign
)
{
static
int
16_t
get_signed
(
BOOL_DECODER
*
br
,
int
16_t
value_to_sign
)
{
return
decode_bool
(
br
,
128
)
?
-
value_to_sign
:
value_to_sign
;
}
#define INCREMENT_COUNT(token) \
do { \
coef_counts[type][ref][get_coef_band(scan, txfm_size, c)] \
...
...
@@ -75,26 +76,26 @@ static int get_signed(BOOL_DECODER *br, int value_to_sign) {
#if CONFIG_CODE_NONZEROCOUNT
#define WRITE_COEF_CONTINUE(val, token) \
{ \
qcoeff_ptr[scan[c]] =
(int16_t)
get_signed(br, val); \
qcoeff_ptr[scan[c]] = get_signed(br, val);
\
INCREMENT_COUNT(token); \
c++; \
nzc++; \
nzc++;
\
continue; \
}
#else
#define WRITE_COEF_CONTINUE(val, token)
\
{
\
qcoeff_ptr[scan[c]] =
(int16_t)
get_signed(br, val); \
INCREMENT_COUNT(token);
\
c++;
\
continue;
\
#define WRITE_COEF_CONTINUE(val, token) \
{ \
qcoeff_ptr[scan[c]] = get_signed(br, val);
\
INCREMENT_COUNT(token); \
c++; \
continue; \
}
#endif // CONFIG_CODE_NONZEROCOUNT
#define ADJUST_COEF(prob, bits_count) \
do { \
if (vp9_read(br, prob)) \
val +=
(uint16_t)(
1 << bits_count
)
;\
val += 1 << bits_count;
\
} while (0);
static
int
decode_coefs
(
VP9D_COMP
*
dx
,
const
MACROBLOCKD
*
xd
,
...
...
@@ -369,16 +370,43 @@ static int get_eob(MACROBLOCKD* const xd, int segment_id, int eob_max) {
return
vp9_get_segdata
(
xd
,
segment_id
,
SEG_LVL_SKIP
)
?
0
:
eob_max
;
}
static
INLINE
int
decode_sb
(
VP9D_COMP
*
const
pbi
,
MACROBLOCKD
*
const
xd
,
BOOL_DECODER
*
const
bc
,
int
offset
,
int
count
,
int
inc
,
int
eob_max
,
TX_SIZE
tx_size
)
{
const
int
segment_id
=
xd
->
mode_info_context
->
mbmi
.
segment_id
;
const
int
seg_eob
=
get_eob
(
xd
,
segment_id
,
eob_max
);
int
i
,
eobtotal
=
0
;
// luma blocks
for
(
i
=
0
;
i
<
offset
;
i
+=
inc
)
{
const
int
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_Y_WITH_DC
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
tx_size
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
// chroma blocks
for
(
i
=
offset
;
i
<
count
;
i
+=
inc
)
{
const
int
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
tx_size
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
return
eobtotal
;
}
int
vp9_decode_sb_tokens
(
VP9D_COMP
*
const
pbi
,
MACROBLOCKD
*
const
xd
,
BOOL_DECODER
*
const
bc
)
{
const
int
segment_id
=
xd
->
mode_info_context
->
mbmi
.
segment_id
;
int
i
,
eobtotal
=
0
,
seg_eob
,
c
;
switch
(
xd
->
mode_info_context
->
mbmi
.
txfm_size
)
{
case
TX_32X32
:
// Luma block
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
0
,
PLANE_TYPE_Y_WITH_DC
,
case
TX_32X32
:
{
// 32x32 luma block
const
int
segment_id
=
xd
->
mode_info_context
->
mbmi
.
segment_id
;
int
i
,
eobtotal
=
0
,
seg_eob
;
int
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
0
,
PLANE_TYPE_Y_WITH_DC
,
get_eob
(
xd
,
segment_id
,
1024
),
xd
->
qcoeff
,
TX_32X32
);
xd
->
eobs
[
0
]
=
c
;
eobtotal
+=
c
;
...
...
@@ -391,150 +419,36 @@ int vp9_decode_sb_tokens(VP9D_COMP* const pbi,
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
break
;
return
eobtotal
;
}
case
TX_16X16
:
// 16x16 luma blocks
seg_eob
=
get_eob
(
xd
,
segment_id
,
256
);
for
(
i
=
0
;
i
<
64
;
i
+=
16
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_Y_WITH_DC
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_16X16
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
// 16x16 chroma blocks
for
(
i
=
64
;
i
<
96
;
i
+=
16
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_16X16
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
break
;
return
decode_sb
(
pbi
,
xd
,
bc
,
64
,
96
,
16
,
16
*
16
,
TX_16X16
);
case
TX_8X8
:
// 8x8 luma blocks
seg_eob
=
get_eob
(
xd
,
segment_id
,
64
);
for
(
i
=
0
;
i
<
64
;
i
+=
4
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_Y_WITH_DC
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_8X8
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
// 8x8 chroma blocks
for
(
i
=
64
;
i
<
96
;
i
+=
4
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_8X8
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
break
;
return
decode_sb
(
pbi
,
xd
,
bc
,
64
,
96
,
4
,
8
*
8
,
TX_8X8
);
case
TX_4X4
:
// 4x4 luma blocks
seg_eob
=
get_eob
(
xd
,
segment_id
,
16
);
for
(
i
=
0
;
i
<
64
;
i
++
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_Y_WITH_DC
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_4X4
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
// 4x4 chroma blocks
for
(
i
=
64
;
i
<
96
;
i
++
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_4X4
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
break
;
default:
assert
(
0
);
return
decode_sb
(
pbi
,
xd
,
bc
,
64
,
96
,
1
,
4
*
4
,
TX_4X4
);
default:
assert
(
0
);
return
0
;
}
return
eobtotal
;
}
int
vp9_decode_sb64_tokens
(
VP9D_COMP
*
const
pbi
,
MACROBLOCKD
*
const
xd
,
BOOL_DECODER
*
const
bc
)
{
const
int
segment_id
=
xd
->
mode_info_context
->
mbmi
.
segment_id
;
int
i
,
eobtotal
=
0
,
seg_eob
,
c
;
switch
(
xd
->
mode_info_context
->
mbmi
.
txfm_size
)
{
case
TX_32X32
:
// Luma block
seg_eob
=
get_eob
(
xd
,
segment_id
,
1024
);
for
(
i
=
0
;
i
<
256
;
i
+=
64
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_Y_WITH_DC
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_32X32
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
// 32x32 chroma blocks
for
(
i
=
256
;
i
<
384
;
i
+=
64
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_32X32
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
break
;
return
decode_sb
(
pbi
,
xd
,
bc
,
256
,
384
,
64
,
32
*
32
,
TX_32X32
);
case
TX_16X16
:
// 16x16 luma blocks
seg_eob
=
get_eob
(
xd
,
segment_id
,
256
);
for
(
i
=
0
;
i
<
256
;
i
+=
16
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_Y_WITH_DC
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_16X16
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
// 16x16 chroma blocks
for
(
i
=
256
;
i
<
384
;
i
+=
16
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_16X16
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
break
;
return
decode_sb
(
pbi
,
xd
,
bc
,
256
,
384
,
16
,
16
*
16
,
TX_16X16
);
case
TX_8X8
:
// 8x8 luma blocks
seg_eob
=
get_eob
(
xd
,
segment_id
,
64
);
for
(
i
=
0
;
i
<
256
;
i
+=
4
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_Y_WITH_DC
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_8X8
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
// 8x8 chroma blocks
for
(
i
=
256
;
i
<
384
;
i
+=
4
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_8X8
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
break
;
return
decode_sb
(
pbi
,
xd
,
bc
,
256
,
384
,
4
,
8
*
8
,
TX_8X8
);
case
TX_4X4
:
// 4x4 luma blocks
seg_eob
=
get_eob
(
xd
,
segment_id
,
16
);
for
(
i
=
0
;
i
<
256
;
i
++
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_Y_WITH_DC
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_4X4
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
// 4x4 chroma blocks
for
(
i
=
256
;
i
<
384
;
i
++
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
qcoeff
+
i
*
16
,
TX_4X4
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
break
;
default:
assert
(
0
);
return
decode_sb
(
pbi
,
xd
,
bc
,
256
,
384
,
1
,
4
*
4
,
TX_4X4
);
default:
assert
(
0
);
return
0
;
}
return
eobtotal
;
}
static
int
vp9_decode_mb_tokens_16x16
(
VP9D_COMP
*
const
pbi
,
...
...
@@ -563,14 +477,14 @@ static int vp9_decode_mb_tokens_16x16(VP9D_COMP* const pbi,
static
int
vp9_decode_mb_tokens_8x8
(
VP9D_COMP
*
const
pbi
,
MACROBLOCKD
*
const
xd
,
BOOL_DECODER
*
const
bc
)
{
int
c
,
i
,
eobtotal
=
0
,
seg_eob
;
int
i
,
eobtotal
=
0
;
const
int
segment_id
=
xd
->
mode_info_context
->
mbmi
.
segment_id
;
// luma blocks
seg_eob
=
get_eob
(
xd
,
segment_id
,
64
);
int
seg_eob
=
get_eob
(
xd
,
segment_id
,
64
);
for
(
i
=
0
;
i
<
16
;
i
+=
4
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_Y_WITH_DC
,
seg_eob
,
xd
->
block
[
i
].
qcoeff
,
TX_8X8
);
const
int
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_Y_WITH_DC
,
seg_eob
,
xd
->
block
[
i
].
qcoeff
,
TX_8X8
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
...
...
@@ -581,15 +495,15 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
// use 4x4 transform for U, V components in I8X8/splitmv prediction mode
seg_eob
=
get_eob
(
xd
,
segment_id
,
16
);
for
(
i
=
16
;
i
<
24
;
i
++
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
block
[
i
].
qcoeff
,
TX_4X4
);
const
int
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
block
[
i
].
qcoeff
,
TX_4X4
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
}
else
{
for
(
i
=
16
;
i
<
24
;
i
+=
4
)
{
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
block
[
i
].
qcoeff
,
TX_8X8
);
const
int
c
=
decode_coefs
(
pbi
,
xd
,
bc
,
i
,
PLANE_TYPE_UV
,
seg_eob
,
xd
->
block
[
i
].
qcoeff
,
TX_8X8
);
xd
->
eobs
[
i
]
=
c
;
eobtotal
+=
c
;
}
...
...
@@ -601,8 +515,8 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
static
int
decode_coefs_4x4
(
VP9D_COMP
*
dx
,
MACROBLOCKD
*
xd
,
BOOL_DECODER
*
const
bc
,
PLANE_TYPE
type
,
int
i
,
int
seg_eob
)
{
int
c
=
decode_coefs
(
dx
,
xd
,
bc
,
i
,
type
,
seg_eob
,
xd
->
block
[
i
].
qcoeff
,
TX_4X4
);
const
int
c
=
decode_coefs
(
dx
,
xd
,
bc
,
i
,
type
,
seg_eob
,
xd
->
block
[
i
].
qcoeff
,
TX_4X4
);
xd
->
eobs
[
i
]
=
c
;
return
c
;
}
...
...
@@ -620,12 +534,11 @@ static int decode_mb_tokens_4x4_uv(VP9D_COMP* const dx,
MACROBLOCKD
*
const
xd
,
BOOL_DECODER
*
const
bc
,
int
seg_eob
)
{
int
eobtotal
=
0
,
i
;
int
i
,
eobtotal
=
0
;
// chroma blocks
for
(
i
=
16
;
i
<
24
;
i
++
)
{
for
(
i
=
16
;
i
<
24
;
i
++
)
eobtotal
+=
decode_coefs_4x4
(
dx
,
xd
,
bc
,
PLANE_TYPE_UV
,
i
,
seg_eob
);
}
return
eobtotal
;
}
...
...
@@ -647,9 +560,8 @@ static int vp9_decode_mb_tokens_4x4(VP9D_COMP* const dx,
const
int
seg_eob
=
get_eob
(
xd
,
segment_id
,
16
);
// luma blocks
for
(
i
=
0
;
i
<
16
;
++
i
)
{
for
(
i
=
0
;
i
<
16
;
++
i
)
eobtotal
+=
decode_coefs_4x4
(
dx
,
xd
,
bc
,
PLANE_TYPE_Y_WITH_DC
,
i
,
seg_eob
);
}
// chroma blocks
eobtotal
+=
decode_mb_tokens_4x4_uv
(
dx
,
xd
,
bc
,
seg_eob
);
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets