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
6a0245c5
Commit
6a0245c5
authored
Jan 17, 2018
by
Rostislav Pehlivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spatial_segmentation: improve edge case handling
Change-Id: If47ac212044a977b12c8df1322759d173dd29ed5
parent
1f309004
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
8 deletions
+14
-8
av1/common/pred_common.h
av1/common/pred_common.h
+8
-2
av1/decoder/decodemv.c
av1/decoder/decodemv.c
+3
-3
av1/encoder/bitstream.c
av1/encoder/bitstream.c
+3
-3
No files found.
av1/common/pred_common.h
View file @
6a0245c5
...
@@ -21,8 +21,10 @@ extern "C" {
...
@@ -21,8 +21,10 @@ extern "C" {
#endif
#endif
#if CONFIG_SPATIAL_SEGMENTATION
#if CONFIG_SPATIAL_SEGMENTATION
/* Picks CDFs based on number of matching segment IDs */
/* Picks CDFs based on number of matching
/out-of-bounds
segment IDs */
static
INLINE
int
pick_spatial_seg_cdf
(
int
prev_ul
,
int
prev_u
,
int
prev_l
)
{
static
INLINE
int
pick_spatial_seg_cdf
(
int
prev_ul
,
int
prev_u
,
int
prev_l
)
{
if
(
prev_ul
<
0
||
prev_u
<
0
||
prev_l
<
0
)
/* Edge case */
return
0
;
if
((
prev_ul
==
prev_u
)
&&
(
prev_ul
==
prev_l
))
if
((
prev_ul
==
prev_u
)
&&
(
prev_ul
==
prev_l
))
return
2
;
return
2
;
else
if
((
prev_ul
==
prev_u
)
||
(
prev_ul
==
prev_l
)
||
(
prev_u
==
prev_l
))
else
if
((
prev_ul
==
prev_u
)
||
(
prev_ul
==
prev_l
)
||
(
prev_u
==
prev_l
))
...
@@ -31,8 +33,12 @@ static INLINE int pick_spatial_seg_cdf(int prev_ul, int prev_u, int prev_l) {
...
@@ -31,8 +33,12 @@ static INLINE int pick_spatial_seg_cdf(int prev_ul, int prev_u, int prev_l) {
return
0
;
return
0
;
}
}
/* If 2 or more are identical returns that as predictor, otherwise prev_l */
static
INLINE
int
pick_spatial_seg_pred
(
int
prev_ul
,
int
prev_u
,
int
prev_l
)
{
static
INLINE
int
pick_spatial_seg_pred
(
int
prev_ul
,
int
prev_u
,
int
prev_l
)
{
/* If 2 or more are identical returns that as predictor, otherwise prev_l */
if
(
prev_u
==
-
1
)
/* Edge case */
return
prev_l
==
-
1
?
0
:
prev_l
;
if
(
prev_l
==
-
1
)
/* Edge case */
return
prev_u
;
return
(
prev_ul
==
prev_u
)
?
prev_u
:
prev_l
;
return
(
prev_ul
==
prev_u
)
?
prev_u
:
prev_l
;
}
}
...
...
av1/decoder/decodemv.c
View file @
6a0245c5
...
@@ -350,9 +350,9 @@ static int read_segment_id(AV1_COMMON *const cm, MACROBLOCKD *const xd,
...
@@ -350,9 +350,9 @@ static int read_segment_id(AV1_COMMON *const cm, MACROBLOCKD *const xd,
int
mi_row
,
int
mi_col
,
aom_reader
*
r
,
int
skip
)
{
int
mi_row
,
int
mi_col
,
aom_reader
*
r
,
int
skip
)
{
FRAME_CONTEXT
*
ec_ctx
=
xd
->
tile_ctx
;
FRAME_CONTEXT
*
ec_ctx
=
xd
->
tile_ctx
;
struct
segmentation_probs
*
const
segp
=
&
ec_ctx
->
seg
;
struct
segmentation_probs
*
const
segp
=
&
ec_ctx
->
seg
;
int
prev_ul
=
0
;
/* Top left segment_id */
int
prev_ul
=
-
1
;
/* Top left segment_id */
int
prev_l
=
0
;
/* Current left segment_id */
int
prev_l
=
-
1
;
/* Current left segment_id */
int
prev_u
=
0
;
/* Current top segment_id */
int
prev_u
=
-
1
;
/* Current top segment_id */
if
((
xd
->
up_available
)
&&
(
xd
->
left_available
))
if
((
xd
->
up_available
)
&&
(
xd
->
left_available
))
prev_ul
=
get_segment_id
(
cm
,
cm
->
current_frame_seg_map
,
BLOCK_4X4
,
prev_ul
=
get_segment_id
(
cm
,
cm
->
current_frame_seg_map
,
BLOCK_4X4
,
...
...
av1/encoder/bitstream.c
View file @
6a0245c5
...
@@ -593,9 +593,9 @@ static void write_segment_id(AV1_COMP *cpi, const MB_MODE_INFO *const mbmi,
...
@@ -593,9 +593,9 @@ static void write_segment_id(AV1_COMP *cpi, const MB_MODE_INFO *const mbmi,
int
mi_col
,
int
skip
)
{
int
mi_col
,
int
skip
)
{
AV1_COMMON
*
const
cm
=
&
cpi
->
common
;
AV1_COMMON
*
const
cm
=
&
cpi
->
common
;
MACROBLOCKD
*
const
xd
=
&
cpi
->
td
.
mb
.
e_mbd
;
MACROBLOCKD
*
const
xd
=
&
cpi
->
td
.
mb
.
e_mbd
;
int
prev_ul
=
0
;
/* Top left segment_id */
int
prev_ul
=
-
1
;
/* Top left segment_id */
int
prev_l
=
0
;
/* Current left segment_id */
int
prev_l
=
-
1
;
/* Current left segment_id */
int
prev_u
=
0
;
/* Current top segment_id */
int
prev_u
=
-
1
;
/* Current top segment_id */
if
(
!
seg
->
enabled
||
!
seg
->
update_map
)
return
;
if
(
!
seg
->
enabled
||
!
seg
->
update_map
)
return
;
...
...
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