Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
aom-rav1e
Commits
156d9120
Commit
156d9120
authored
Apr 23, 2013
by
Dmitry Kovalev
Committed by
Gerrit Code Review
Apr 23, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Code cleanup inside vp9_get_pred_context function." into experimental
parents
97ac785e
de7c25c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
53 deletions
+42
-53
vp9/common/vp9_pred_common.c
vp9/common/vp9_pred_common.c
+42
-53
No files found.
vp9/common/vp9_pred_common.c
View file @
156d9120
...
@@ -23,83 +23,72 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
...
@@ -23,83 +23,72 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
const
MACROBLOCKD
*
const
xd
,
const
MACROBLOCKD
*
const
xd
,
PRED_ID
pred_id
)
{
PRED_ID
pred_id
)
{
int
pred_context
;
int
pred_context
;
MODE_INFO
*
m
=
xd
->
mode_info_context
;
const
MODE_INFO
*
const
mi
=
xd
->
mode_info_context
;
const
MODE_INFO
*
const
above_mi
=
mi
-
cm
->
mode_info_stride
;
const
MODE_INFO
*
const
left_mi
=
mi
-
1
;
// Note:
// Note:
// The mode info data structure has a one element border above and to the
// The mode info data structure has a one element border above and to the
// left of the entries correpsonding to real macroblocks.
// left of the entries correpsonding to real macroblocks.
// The prediction flags in these dummy entries are initialised to 0.
// The prediction flags in these dummy entries are initialised to 0.
switch
(
pred_id
)
{
switch
(
pred_id
)
{
case
PRED_SEG_ID
:
case
PRED_SEG_ID
:
pred_context
=
(
m
-
cm
->
mode_info_stride
)
->
mbmi
.
seg_id_predicted
;
pred_context
=
above_mi
->
mbmi
.
seg_id_predicted
;
if
(
xd
->
left_available
)
if
(
xd
->
left_available
)
pred_context
+=
(
m
-
1
)
->
mbmi
.
seg_id_predicted
;
pred_context
+=
left_mi
->
mbmi
.
seg_id_predicted
;
break
;
break
;
case
PRED_REF
:
case
PRED_REF
:
pred_context
=
(
m
-
cm
->
mode_info_stride
)
->
mbmi
.
ref_predicted
;
pred_context
=
above_mi
->
mbmi
.
ref_predicted
;
if
(
xd
->
left_available
)
if
(
xd
->
left_available
)
pred_context
+=
(
m
-
1
)
->
mbmi
.
ref_predicted
;
pred_context
+=
left_mi
->
mbmi
.
ref_predicted
;
break
;
break
;
case
PRED_COMP
:
case
PRED_COMP
:
// Context based on use of comp pred flag by neighbours
if
(
mi
->
mbmi
.
ref_frame
==
LAST_FRAME
)
// pred_context =
// ((m - 1)->mbmi.second_ref_frame > INTRA_FRAME) +
// ((m - cm->mode_info_stride)->mbmi.second_ref_frame > INTRA_FRAME);
// Context based on mode and reference frame
// if ( m->mbmi.ref_frame == LAST_FRAME )
// pred_context = 0 + (m->mbmi.mode != ZEROMV);
// else if ( m->mbmi.ref_frame == GOLDEN_FRAME )
// pred_context = 2 + (m->mbmi.mode != ZEROMV);
// else
// pred_context = 4 + (m->mbmi.mode != ZEROMV);
if
(
m
->
mbmi
.
ref_frame
==
LAST_FRAME
)
pred_context
=
0
;
pred_context
=
0
;
else
else
pred_context
=
1
;
pred_context
=
1
;
break
;
break
;
case
PRED_MBSKIP
:
case
PRED_MBSKIP
:
pred_context
=
(
m
-
cm
->
mode_info_stride
)
->
mbmi
.
mb_skip_coeff
;
pred_context
=
above_mi
->
mbmi
.
mb_skip_coeff
;
if
(
xd
->
left_available
)
if
(
xd
->
left_available
)
pred_context
+=
(
m
-
1
)
->
mbmi
.
mb_skip_coeff
;
pred_context
+=
left_mi
->
mbmi
.
mb_skip_coeff
;
break
;
break
;
case
PRED_SWITCHABLE_INTERP
:
case
PRED_SWITCHABLE_INTERP
:
{
{
// left
int
left_in_image
=
xd
->
left_available
&&
(
m
-
1
)
->
mbmi
.
mb_in_image
;
const
int
left_in_image
=
xd
->
left_available
&&
left_mi
->
mbmi
.
mb_in_image
;
int
above_in_image
=
(
m
-
cm
->
mode_info_stride
)
->
mbmi
.
mb_in_image
;
const
int
left_mv_pred
=
left_mi
->
mbmi
.
mode
>=
NEARESTMV
&&
int
left_mode
=
(
m
-
1
)
->
mbmi
.
mode
;
left_mi
->
mbmi
.
mode
<=
SPLITMV
;
int
above_mode
=
(
m
-
cm
->
mode_info_stride
)
->
mbmi
.
mode
;
const
int
left_interp
=
left_in_image
&&
left_mv_pred
?
int
left_interp
,
above_interp
;
vp9_switchable_interp_map
[
left_mi
->
mbmi
.
interp_filter
]
:
if
(
left_in_image
&&
left_mode
>=
NEARESTMV
&&
left_mode
<=
SPLITMV
)
VP9_SWITCHABLE_FILTERS
;
left_interp
=
vp9_switchable_interp_map
[(
m
-
1
)
->
mbmi
.
interp_filter
];
else
// above
left_interp
=
VP9_SWITCHABLE_FILTERS
;
const
int
above_in_image
=
above_mi
->
mbmi
.
mb_in_image
;
assert
(
left_interp
!=
-
1
);
const
int
above_mv_pred
=
above_mi
->
mbmi
.
mode
>=
NEARESTMV
&&
if
(
above_in_image
&&
above_mode
>=
NEARESTMV
&&
above_mode
<=
SPLITMV
)
above_mi
->
mbmi
.
mode
<=
SPLITMV
;
above_interp
=
vp9_switchable_interp_map
[
const
int
above_interp
=
above_in_image
&&
above_mv_pred
?
(
m
-
cm
->
mode_info_stride
)
->
mbmi
.
interp_filter
];
vp9_switchable_interp_map
[
above_mi
->
mbmi
.
interp_filter
]
:
else
VP9_SWITCHABLE_FILTERS
;
above_interp
=
VP9_SWITCHABLE_FILTERS
;
assert
(
above_interp
!=
-
1
);
assert
(
left_interp
!=
-
1
);
assert
(
above_interp
!=
-
1
);
if
(
left_interp
==
above_interp
)
pred_context
=
left_interp
;
if
(
left_interp
==
above_interp
)
else
if
(
left_interp
==
VP9_SWITCHABLE_FILTERS
&&
pred_context
=
left_interp
;
above_interp
!=
VP9_SWITCHABLE_FILTERS
)
else
if
(
left_interp
==
VP9_SWITCHABLE_FILTERS
&&
pred_context
=
above_interp
;
above_interp
!=
VP9_SWITCHABLE_FILTERS
)
else
if
(
left_interp
!=
VP9_SWITCHABLE_FILTERS
&&
pred_context
=
above_interp
;
above_interp
==
VP9_SWITCHABLE_FILTERS
)
else
if
(
left_interp
!=
VP9_SWITCHABLE_FILTERS
&&
pred_context
=
left_interp
;
above_interp
==
VP9_SWITCHABLE_FILTERS
)
else
pred_context
=
left_interp
;
pred_context
=
VP9_SWITCHABLE_FILTERS
;
else
}
pred_context
=
VP9_SWITCHABLE_FILTERS
;
break
;
break
;
}
default:
default:
pred_context
=
0
;
// *** add error trap code.
pred_context
=
0
;
// *** add error trap code.
...
...
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