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
0db175ff
Commit
0db175ff
authored
Apr 17, 2013
by
Dmitry Kovalev
Browse files
Changing argument type of vp9_get_mv_joint from MV to MV*.
Change-Id: I28c3026946fc1bde7074e6e0198da93bb0d75dfe
parent
642ac924
Changes
5
Hide whitespace changes
Inline
Side-by-side
vp9/common/vp9_entropymv.c
View file @
0db175ff
...
...
@@ -87,12 +87,12 @@ const nmv_context vp9_default_nmv_context = {
},
};
MV_JOINT_TYPE
vp9_get_mv_joint
(
MV
mv
)
{
if
(
mv
.
row
==
0
&&
mv
.
col
==
0
)
MV_JOINT_TYPE
vp9_get_mv_joint
(
const
MV
*
mv
)
{
if
(
mv
->
row
==
0
&&
mv
->
col
==
0
)
return
MV_JOINT_ZERO
;
else
if
(
mv
.
row
==
0
&&
mv
.
col
!=
0
)
else
if
(
mv
->
row
==
0
&&
mv
->
col
!=
0
)
return
MV_JOINT_HNZVZ
;
else
if
(
mv
.
row
!=
0
&&
mv
.
col
==
0
)
else
if
(
mv
->
row
!=
0
&&
mv
->
col
==
0
)
return
MV_JOINT_HZVNZ
;
else
return
MV_JOINT_HNZVNZ
;
...
...
@@ -209,13 +209,13 @@ static void counts_to_context(nmv_component_counts *mvcomp, int usehp) {
void
vp9_increment_nmv
(
const
MV
*
mv
,
const
MV
*
ref
,
nmv_context_counts
*
mvctx
,
int
usehp
)
{
const
MV_JOINT_TYPE
type
=
vp9_get_mv_joint
(
*
mv
);
mvctx
->
joints
[
type
]
++
;
const
MV_JOINT_TYPE
j
=
vp9_get_mv_joint
(
mv
);
mvctx
->
joints
[
j
]
++
;
usehp
=
usehp
&&
vp9_use_nmv_hp
(
ref
);
if
(
mv_joint_vertical
(
type
))
if
(
mv_joint_vertical
(
j
))
increment_nmv_component_count
(
mv
->
row
,
&
mvctx
->
comps
[
0
],
1
,
usehp
);
if
(
mv_joint_horizontal
(
type
))
if
(
mv_joint_horizontal
(
j
))
increment_nmv_component_count
(
mv
->
col
,
&
mvctx
->
comps
[
1
],
1
,
usehp
);
}
...
...
vp9/common/vp9_entropymv.h
View file @
0db175ff
...
...
@@ -105,7 +105,7 @@ typedef struct {
nmv_component
comps
[
2
];
}
nmv_context
;
MV_JOINT_TYPE
vp9_get_mv_joint
(
MV
mv
);
MV_JOINT_TYPE
vp9_get_mv_joint
(
const
MV
*
mv
);
MV_CLASS_TYPE
vp9_get_mv_class
(
int
z
,
int
*
offset
);
int
vp9_get_mv_mag
(
MV_CLASS_TYPE
c
,
int
offset
);
...
...
vp9/decoder/vp9_decodemv.c
View file @
0db175ff
...
...
@@ -269,7 +269,7 @@ static void read_nmv(vp9_reader *r, MV *mv, const MV *ref,
static
void
read_nmv_fp
(
vp9_reader
*
r
,
MV
*
mv
,
const
MV
*
ref
,
const
nmv_context
*
mvctx
,
int
usehp
)
{
const
MV_JOINT_TYPE
j
=
vp9_get_mv_joint
(
*
mv
);
const
MV_JOINT_TYPE
j
=
vp9_get_mv_joint
(
mv
);
usehp
=
usehp
&&
vp9_use_nmv_hp
(
ref
);
if
(
mv_joint_vertical
(
j
))
mv
->
row
=
read_nmv_component_fp
(
r
,
mv
->
row
,
ref
->
row
,
&
mvctx
->
comps
[
0
],
...
...
vp9/encoder/vp9_encodemv.c
View file @
0db175ff
...
...
@@ -556,30 +556,27 @@ void vp9_write_nmv_probs(VP9_COMP* const cpi, int usehp, vp9_writer* const bc) {
}
}
void
vp9_encode_nmv
(
vp9_writer
*
const
bc
,
const
MV
*
const
mv
,
void
vp9_encode_nmv
(
vp9_writer
*
w
,
const
MV
*
const
mv
,
const
MV
*
const
ref
,
const
nmv_context
*
const
mvctx
)
{
MV_JOINT_TYPE
j
=
vp9_get_mv_joint
(
*
mv
);
write_token
(
bc
,
vp9_mv_joint_tree
,
mvctx
->
joints
,
vp9_mv_joint_encodings
+
j
);
if
(
mv_joint_vertical
(
j
))
{
encode_nmv_component
(
bc
,
mv
->
row
,
ref
->
col
,
&
mvctx
->
comps
[
0
]);
}
if
(
mv_joint_horizontal
(
j
))
{
encode_nmv_component
(
bc
,
mv
->
col
,
ref
->
col
,
&
mvctx
->
comps
[
1
]);
}
const
MV_JOINT_TYPE
j
=
vp9_get_mv_joint
(
mv
);
write_token
(
w
,
vp9_mv_joint_tree
,
mvctx
->
joints
,
vp9_mv_joint_encodings
+
j
);
if
(
mv_joint_vertical
(
j
))
encode_nmv_component
(
w
,
mv
->
row
,
ref
->
col
,
&
mvctx
->
comps
[
0
]);
if
(
mv_joint_horizontal
(
j
))
encode_nmv_component
(
w
,
mv
->
col
,
ref
->
col
,
&
mvctx
->
comps
[
1
]);
}
void
vp9_encode_nmv_fp
(
vp9_writer
*
const
bc
,
const
MV
*
const
mv
,
const
MV
*
const
ref
,
const
nmv_context
*
const
mvctx
,
int
usehp
)
{
MV_JOINT_TYPE
j
=
vp9_get_mv_joint
(
*
mv
);
const
MV_JOINT_TYPE
j
=
vp9_get_mv_joint
(
mv
);
usehp
=
usehp
&&
vp9_use_nmv_hp
(
ref
);
if
(
mv_joint_vertical
(
j
))
{
if
(
mv_joint_vertical
(
j
))
encode_nmv_component_fp
(
bc
,
mv
->
row
,
ref
->
row
,
&
mvctx
->
comps
[
0
],
usehp
);
}
if
(
mv_joint_horizontal
(
j
))
{
if
(
mv_joint_horizontal
(
j
))
encode_nmv_component_fp
(
bc
,
mv
->
col
,
ref
->
col
,
&
mvctx
->
comps
[
1
],
usehp
);
}
}
void
vp9_build_nmv_cost_table
(
int
*
mvjoint
,
...
...
vp9/encoder/vp9_mcomp.c
View file @
0db175ff
...
...
@@ -56,8 +56,9 @@ int vp9_mv_bit_cost(int_mv *mv, int_mv *ref, int *mvjcost, int *mvcost[2],
MV
v
;
v
.
row
=
mv
->
as_mv
.
row
-
ref
->
as_mv
.
row
;
v
.
col
=
mv
->
as_mv
.
col
-
ref
->
as_mv
.
col
;
return
((
mvjcost
[
vp9_get_mv_joint
(
v
)]
+
mvcost
[
0
][
v
.
row
]
+
mvcost
[
1
][
v
.
col
])
*
weight
)
>>
7
;
return
((
mvjcost
[
vp9_get_mv_joint
(
&
v
)]
+
mvcost
[
0
][
v
.
row
]
+
mvcost
[
1
][
v
.
col
])
*
weight
)
>>
7
;
}
static
int
mv_err_cost
(
int_mv
*
mv
,
int_mv
*
ref
,
int
*
mvjcost
,
int
*
mvcost
[
2
],
...
...
@@ -66,9 +67,9 @@ static int mv_err_cost(int_mv *mv, int_mv *ref, int *mvjcost, int *mvcost[2],
MV
v
;
v
.
row
=
mv
->
as_mv
.
row
-
ref
->
as_mv
.
row
;
v
.
col
=
mv
->
as_mv
.
col
-
ref
->
as_mv
.
col
;
return
((
mvjcost
[
vp9_get_mv_joint
(
v
)]
+
mvcost
[
0
][
v
.
row
]
+
mvcost
[
1
][
v
.
col
])
*
error_per_bit
+
4096
)
>>
13
;
return
ROUND_POWER_OF_TWO
((
mvjcost
[
vp9_get_mv_joint
(
&
v
)]
+
mvcost
[
0
][
v
.
row
]
+
mvcost
[
1
][
v
.
col
])
*
error_per_bit
,
13
)
;
}
return
0
;
}
...
...
@@ -79,10 +80,9 @@ static int mvsad_err_cost(int_mv *mv, int_mv *ref, int *mvjsadcost,
MV
v
;
v
.
row
=
mv
->
as_mv
.
row
-
ref
->
as_mv
.
row
;
v
.
col
=
mv
->
as_mv
.
col
-
ref
->
as_mv
.
col
;
return
ROUND_POWER_OF_TWO
((
mvjsadcost
[
vp9_get_mv_joint
(
v
)]
+
mvsadcost
[
0
][
v
.
row
]
+
mvsadcost
[
1
][
v
.
col
])
*
error_per_bit
,
8
);
return
ROUND_POWER_OF_TWO
((
mvjsadcost
[
vp9_get_mv_joint
(
&
v
)]
+
mvsadcost
[
0
][
v
.
row
]
+
mvsadcost
[
1
][
v
.
col
])
*
error_per_bit
,
8
);
}
return
0
;
}
...
...
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