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
Xiph.Org
aom-rav1e
Commits
c2c5ec21
Commit
c2c5ec21
authored
Oct 21, 2016
by
Yaowu Xu
Committed by
Gerrit Code Review
Oct 21, 2016
Browse files
Merge "Unify set_contexts() function for encoder and decoder" into nextgenv2
parents
2f5b9d66
a6923f7f
Changes
7
Hide whitespace changes
Inline
Side-by-side
av1/common/blockd.c
View file @
c2c5ec21
...
...
@@ -92,40 +92,38 @@ void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
}
void
av1_set_contexts
(
const
MACROBLOCKD
*
xd
,
struct
macroblockd_plane
*
pd
,
BLOCK_SIZE
plane_bsize
,
TX_SIZE
tx_size
,
int
has_eob
,
int
aoff
,
int
loff
)
{
TX_SIZE
tx_size
,
int
has_eob
,
int
aoff
,
int
loff
)
{
ENTROPY_CONTEXT
*
const
a
=
pd
->
above_context
+
aoff
;
ENTROPY_CONTEXT
*
const
l
=
pd
->
left_context
+
loff
;
const
int
tx_w_in_blocks
=
num_4x4_blocks_wide_txsize_lookup
[
tx_size
];
const
int
tx_h_in_blocks
=
num_4x4_blocks_high_txsize_lookup
[
tx_size
];
const
int
tx_size_in_blocks
=
1
<<
tx_size
;
// above
if
(
has_eob
&&
xd
->
mb_to_right_edge
<
0
)
{
int
i
;
const
int
blocks_wide
=
num_4x4_blocks_wide_lookup
[
plane_bsize
]
+
(
xd
->
mb_to_right_edge
>>
(
5
+
pd
->
subsampling_x
));
int
above_contexts
=
tx_
w
_in_blocks
;
const
int
blocks_wide
=
pd
->
n4_w
+
(
xd
->
mb_to_right_edge
>>
(
5
+
pd
->
subsampling_x
));
int
above_contexts
=
tx_
size
_in_blocks
;
if
(
above_contexts
+
aoff
>
blocks_wide
)
above_contexts
=
blocks_wide
-
aoff
;
for
(
i
=
0
;
i
<
above_contexts
;
++
i
)
a
[
i
]
=
has_eob
;
for
(
i
=
above_contexts
;
i
<
tx_
w
_in_blocks
;
++
i
)
a
[
i
]
=
0
;
for
(
i
=
above_contexts
;
i
<
tx_
size
_in_blocks
;
++
i
)
a
[
i
]
=
0
;
}
else
{
memset
(
a
,
has_eob
,
sizeof
(
ENTROPY_CONTEXT
)
*
tx_
w
_in_blocks
);
memset
(
a
,
has_eob
,
sizeof
(
ENTROPY_CONTEXT
)
*
tx_
size
_in_blocks
);
}
// left
if
(
has_eob
&&
xd
->
mb_to_bottom_edge
<
0
)
{
int
i
;
const
int
blocks_high
=
num_4x4_blocks_high_lookup
[
plane_bsize
]
+
(
xd
->
mb_to_bottom_edge
>>
(
5
+
pd
->
subsampling_y
));
int
left_contexts
=
tx_
h
_in_blocks
;
const
int
blocks_high
=
pd
->
n4_h
+
(
xd
->
mb_to_bottom_edge
>>
(
5
+
pd
->
subsampling_y
));
int
left_contexts
=
tx_
size
_in_blocks
;
if
(
left_contexts
+
loff
>
blocks_high
)
left_contexts
=
blocks_high
-
loff
;
for
(
i
=
0
;
i
<
left_contexts
;
++
i
)
l
[
i
]
=
has_eob
;
for
(
i
=
left_contexts
;
i
<
tx_
h
_in_blocks
;
++
i
)
l
[
i
]
=
0
;
for
(
i
=
left_contexts
;
i
<
tx_
size
_in_blocks
;
++
i
)
l
[
i
]
=
0
;
}
else
{
memset
(
l
,
has_eob
,
sizeof
(
ENTROPY_CONTEXT
)
*
tx_
h
_in_blocks
);
memset
(
l
,
has_eob
,
sizeof
(
ENTROPY_CONTEXT
)
*
tx_
size
_in_blocks
);
}
}
...
...
av1/common/blockd.h
View file @
c2c5ec21
...
...
@@ -757,8 +757,7 @@ void av1_foreach_transformed_block(const MACROBLOCKD *const xd,
void
*
arg
);
void
av1_set_contexts
(
const
MACROBLOCKD
*
xd
,
struct
macroblockd_plane
*
pd
,
BLOCK_SIZE
plane_bsize
,
TX_SIZE
tx_size
,
int
has_eob
,
int
aoff
,
int
loff
);
TX_SIZE
tx_size
,
int
has_eob
,
int
aoff
,
int
loff
);
#if CONFIG_EXT_INTER
static
INLINE
int
is_interintra_allowed_bsize
(
const
BLOCK_SIZE
bsize
)
{
...
...
av1/common/onyxc_int.h
View file @
c2c5ec21
...
...
@@ -520,6 +520,17 @@ static INLINE int calc_mi_size(int len) {
return
len
+
MAX_MIB_SIZE
;
}
static
INLINE
void
set_plane_n4
(
MACROBLOCKD
*
const
xd
,
int
bw
,
int
bh
,
int
bwl
,
int
bhl
)
{
int
i
;
for
(
i
=
0
;
i
<
MAX_MB_PLANE
;
i
++
)
{
xd
->
plane
[
i
].
n4_w
=
(
bw
<<
1
)
>>
xd
->
plane
[
i
].
subsampling_x
;
xd
->
plane
[
i
].
n4_h
=
(
bh
<<
1
)
>>
xd
->
plane
[
i
].
subsampling_y
;
xd
->
plane
[
i
].
n4_wl
=
bwl
-
xd
->
plane
[
i
].
subsampling_x
;
xd
->
plane
[
i
].
n4_hl
=
bhl
-
xd
->
plane
[
i
].
subsampling_y
;
}
}
static
INLINE
void
set_mi_row_col
(
MACROBLOCKD
*
xd
,
const
TileInfo
*
const
tile
,
int
mi_row
,
int
bh
,
int
mi_col
,
int
bw
,
int
mi_rows
,
int
mi_cols
)
{
...
...
av1/decoder/decodeframe.c
View file @
c2c5ec21
...
...
@@ -393,17 +393,6 @@ static INLINE void dec_reset_skip_context(MACROBLOCKD *xd) {
}
}
static
void
set_plane_n4
(
MACROBLOCKD
*
const
xd
,
int
bw
,
int
bh
,
int
bwl
,
int
bhl
)
{
int
i
;
for
(
i
=
0
;
i
<
MAX_MB_PLANE
;
i
++
)
{
xd
->
plane
[
i
].
n4_w
=
(
bw
<<
1
)
>>
xd
->
plane
[
i
].
subsampling_x
;
xd
->
plane
[
i
].
n4_h
=
(
bh
<<
1
)
>>
xd
->
plane
[
i
].
subsampling_y
;
xd
->
plane
[
i
].
n4_wl
=
bwl
-
xd
->
plane
[
i
].
subsampling_x
;
xd
->
plane
[
i
].
n4_hl
=
bhl
-
xd
->
plane
[
i
].
subsampling_y
;
}
}
static
MB_MODE_INFO
*
set_offsets
(
AV1_COMMON
*
const
cm
,
MACROBLOCKD
*
const
xd
,
BLOCK_SIZE
bsize
,
int
mi_row
,
int
mi_col
,
int
bw
,
int
bh
,
int
x_mis
,
int
y_mis
,
int
bwl
,
...
...
av1/decoder/detokenize.c
View file @
c2c5ec21
...
...
@@ -294,47 +294,6 @@ static int decode_coefs(const MACROBLOCKD *xd, PLANE_TYPE type,
return
c
;
}
// TODO(slavarnway): Decode version of av1_set_context. Modify
// av1_set_context
// after testing is complete, then delete this version.
static
void
dec_set_contexts
(
const
MACROBLOCKD
*
xd
,
struct
macroblockd_plane
*
pd
,
TX_SIZE
tx_size
,
int
has_eob
,
int
aoff
,
int
loff
)
{
ENTROPY_CONTEXT
*
const
a
=
pd
->
above_context
+
aoff
;
ENTROPY_CONTEXT
*
const
l
=
pd
->
left_context
+
loff
;
const
int
tx_w_in_blocks
=
num_4x4_blocks_wide_txsize_lookup
[
tx_size
];
const
int
tx_h_in_blocks
=
num_4x4_blocks_high_txsize_lookup
[
tx_size
];
// above
if
(
has_eob
&&
xd
->
mb_to_right_edge
<
0
)
{
int
i
;
const
int
blocks_wide
=
pd
->
n4_w
+
(
xd
->
mb_to_right_edge
>>
(
5
+
pd
->
subsampling_x
));
int
above_contexts
=
tx_w_in_blocks
;
if
(
above_contexts
+
aoff
>
blocks_wide
)
above_contexts
=
blocks_wide
-
aoff
;
for
(
i
=
0
;
i
<
above_contexts
;
++
i
)
a
[
i
]
=
has_eob
;
for
(
i
=
above_contexts
;
i
<
tx_w_in_blocks
;
++
i
)
a
[
i
]
=
0
;
}
else
{
memset
(
a
,
has_eob
,
sizeof
(
ENTROPY_CONTEXT
)
*
tx_w_in_blocks
);
}
// left
if
(
has_eob
&&
xd
->
mb_to_bottom_edge
<
0
)
{
int
i
;
const
int
blocks_high
=
pd
->
n4_h
+
(
xd
->
mb_to_bottom_edge
>>
(
5
+
pd
->
subsampling_y
));
int
left_contexts
=
tx_h_in_blocks
;
if
(
left_contexts
+
loff
>
blocks_high
)
left_contexts
=
blocks_high
-
loff
;
for
(
i
=
0
;
i
<
left_contexts
;
++
i
)
l
[
i
]
=
has_eob
;
for
(
i
=
left_contexts
;
i
<
tx_h_in_blocks
;
++
i
)
l
[
i
]
=
0
;
}
else
{
memset
(
l
,
has_eob
,
sizeof
(
ENTROPY_CONTEXT
)
*
tx_h_in_blocks
);
}
}
#if CONFIG_PALETTE
void
av1_decode_palette_tokens
(
MACROBLOCKD
*
const
xd
,
int
plane
,
aom_reader
*
r
)
{
...
...
@@ -391,11 +350,6 @@ int av1_decode_block_tokens(MACROBLOCKD *const xd, int plane,
#endif // CONFIG_NEW_QUANT
ctx
,
sc
->
scan
,
sc
->
neighbors
,
r
);
#endif // CONFIG_AOM_QM
dec_set_contexts
(
xd
,
pd
,
tx_size
,
eob
>
0
,
x
,
y
);
/*
av1_set_contexts(xd, pd,
get_plane_block_size(xd->mi[0]->mbmi.sb_type, pd),
tx_size, eob > 0, x, y);
*/
av1_set_contexts
(
xd
,
pd
,
tx_size
,
eob
>
0
,
x
,
y
);
return
eob
;
}
av1/encoder/encodeframe.c
View file @
c2c5ec21
...
...
@@ -262,6 +262,8 @@ static void set_offsets_without_segment_id(const AV1_COMP *const cpi,
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
const
int
mi_width
=
num_8x8_blocks_wide_lookup
[
bsize
];
const
int
mi_height
=
num_8x8_blocks_high_lookup
[
bsize
];
const
int
bwl
=
b_width_log2_lookup
[
AOMMAX
(
bsize
,
BLOCK_8X8
)];
const
int
bhl
=
b_height_log2_lookup
[
AOMMAX
(
bsize
,
BLOCK_8X8
)];
set_skip_context
(
xd
,
mi_row
,
mi_col
);
...
...
@@ -284,6 +286,8 @@ static void set_offsets_without_segment_id(const AV1_COMP *const cpi,
x
->
mv_row_max
=
(
cm
->
mi_rows
-
mi_row
)
*
MI_SIZE
+
AOM_INTERP_EXTEND
;
x
->
mv_col_max
=
(
cm
->
mi_cols
-
mi_col
)
*
MI_SIZE
+
AOM_INTERP_EXTEND
;
set_plane_n4
(
xd
,
mi_width
,
mi_height
,
bwl
,
bhl
);
// Set up distance of MB to edge of frame in 1/8th pel units.
assert
(
!
(
mi_col
&
(
mi_width
-
1
))
&&
!
(
mi_row
&
(
mi_height
-
1
)));
set_mi_row_col
(
xd
,
tile
,
mi_row
,
mi_height
,
mi_col
,
mi_width
,
cm
->
mi_rows
,
...
...
av1/encoder/tokenize.c
View file @
c2c5ec21
...
...
@@ -369,8 +369,8 @@ static void cost_coeffs_b(int plane, int block, int blk_row, int blk_col,
int
rate
=
av1_cost_coeffs
(
cm
,
x
,
plane
,
block
,
pt
,
tx_size
,
scan_order
->
scan
,
scan_order
->
neighbors
,
0
);
args
->
this_rate
+=
rate
;
av1_set_contexts
(
xd
,
pd
,
plane_bsize
,
tx_size
,
p
->
eobs
[
block
]
>
0
,
blk_col
,
blk_row
);
(
void
)
plane_bsize
;
av1_set_contexts
(
xd
,
pd
,
tx_size
,
p
->
eobs
[
block
]
>
0
,
blk_col
,
blk_row
);
}
static
void
set_entropy_context_b
(
int
plane
,
int
block
,
int
blk_row
,
...
...
@@ -382,8 +382,8 @@ static void set_entropy_context_b(int plane, int block, int blk_row,
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
struct
macroblock_plane
*
p
=
&
x
->
plane
[
plane
];
struct
macroblockd_plane
*
pd
=
&
xd
->
plane
[
plane
];
av1_set_contexts
(
xd
,
pd
,
plane_bsize
,
tx_size
,
p
->
eobs
[
block
]
>
0
,
blk_col
,
blk_row
);
(
void
)
plane_bsize
;
av1_set_contexts
(
xd
,
pd
,
tx_size
,
p
->
eobs
[
block
]
>
0
,
blk_col
,
blk_row
);
}
static
INLINE
void
add_token
(
TOKENEXTRA
**
t
,
const
aom_prob
*
context_tree
,
...
...
@@ -498,6 +498,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
int
skip_eob
=
0
;
int16_t
token
;
EXTRABIT
extra
;
(
void
)
plane_bsize
;
pt
=
get_entropy_context
(
tx_size
,
pd
->
above_context
+
blk_col
,
pd
->
left_context
+
blk_row
);
scan
=
scan_order
->
scan
;
...
...
@@ -532,7 +533,7 @@ static void tokenize_b(int plane, int block, int blk_row, int blk_col,
*
tp
=
t
;
av1_set_contexts
(
xd
,
pd
,
plane_bsize
,
tx_size
,
c
>
0
,
blk_col
,
blk_row
);
av1_set_contexts
(
xd
,
pd
,
tx_size
,
c
>
0
,
blk_col
,
blk_row
);
}
struct
is_skippable_args
{
...
...
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