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
9febfc16
Commit
9febfc16
authored
Dec 07, 2016
by
Debargha Mukherjee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some refactoring/cleanup of global motion costing
Change-Id: Ib44c713ebcccc621d4f3b9f22e8dbb638c50ff52
parent
49a76560
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
24 deletions
+25
-24
av1/common/mv.h
av1/common/mv.h
+7
-0
av1/encoder/encoder.h
av1/encoder/encoder.h
+3
-0
av1/encoder/rd.c
av1/encoder/rd.c
+4
-0
av1/encoder/rdopt.c
av1/encoder/rdopt.c
+11
-24
No files found.
av1/common/mv.h
View file @
9febfc16
...
@@ -128,6 +128,13 @@ typedef struct {
...
@@ -128,6 +128,13 @@ typedef struct {
#define GM_ALPHA_MIN -GM_ALPHA_MAX
#define GM_ALPHA_MIN -GM_ALPHA_MAX
#define GM_ROW3HOMO_MIN -GM_ROW3HOMO_MAX
#define GM_ROW3HOMO_MIN -GM_ROW3HOMO_MAX
// Bits used for different models
#define GM_IDENTITY_BITS 0
#define GM_TRANSLATION_BITS ((GM_ABS_TRANS_BITS + 1) * 2)
#define GM_ROTZOOM_BITS (GM_TRANSLATION_BITS + (GM_ABS_ALPHA_BITS + 1) * 2)
#define GM_AFFINE_BITS (GM_ROTZOOM_BITS + (GM_ABS_ALPHA_BITS + 1) * 2)
#define GM_HOMOGRAPHY_BITS (GM_AFFINE_BITS + (GM_ABS_ROW3HOMO_BITS + 1) * 2)
// Convert a global motion translation vector (which may have more bits than a
// Convert a global motion translation vector (which may have more bits than a
// regular motion vector) into a motion vector
// regular motion vector) into a motion vector
static
INLINE
int_mv
gm_get_motion_vector
(
const
WarpedMotionParams
*
gm
,
static
INLINE
int_mv
gm_get_motion_vector
(
const
WarpedMotionParams
*
gm
,
...
...
av1/encoder/encoder.h
View file @
9febfc16
...
@@ -570,6 +570,9 @@ typedef struct AV1_COMP {
...
@@ -570,6 +570,9 @@ typedef struct AV1_COMP {
#if CONFIG_LOOP_RESTORATION
#if CONFIG_LOOP_RESTORATION
int
switchable_restore_cost
[
RESTORE_SWITCHABLE_TYPES
];
int
switchable_restore_cost
[
RESTORE_SWITCHABLE_TYPES
];
#endif // CONFIG_LOOP_RESTORATION
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_GLOBAL_MOTION
int
gmtype_cost
[
TRANS_TYPES
];
#endif // CONFIG_GLOBAL_MOTION
int
multi_arf_allowed
;
int
multi_arf_allowed
;
int
multi_arf_enabled
;
int
multi_arf_enabled
;
...
...
av1/encoder/rd.c
View file @
9febfc16
...
@@ -156,6 +156,10 @@ static void fill_mode_costs(AV1_COMP *cpi) {
...
@@ -156,6 +156,10 @@ static void fill_mode_costs(AV1_COMP *cpi) {
av1_cost_tokens
(
cpi
->
switchable_restore_cost
,
fc
->
switchable_restore_prob
,
av1_cost_tokens
(
cpi
->
switchable_restore_cost
,
fc
->
switchable_restore_prob
,
av1_switchable_restore_tree
);
av1_switchable_restore_tree
);
#endif // CONFIG_LOOP_RESTORATION
#endif // CONFIG_LOOP_RESTORATION
#if CONFIG_GLOBAL_MOTION
av1_cost_tokens
(
cpi
->
gmtype_cost
,
fc
->
global_motion_types_prob
,
av1_global_motion_types_tree
);
#endif // CONFIG_GLOBAL_MOTION
}
}
void
av1_fill_token_costs
(
av1_coeff_cost
*
c
,
void
av1_fill_token_costs
(
av1_coeff_cost
*
c
,
...
...
av1/encoder/rdopt.c
View file @
9febfc16
...
@@ -4336,35 +4336,22 @@ static int get_interinter_compound_type_bits(BLOCK_SIZE bsize,
...
@@ -4336,35 +4336,22 @@ static int get_interinter_compound_type_bits(BLOCK_SIZE bsize,
#define GLOBAL_MOTION_COST_AMORTIZATION_BLKS 8
#define GLOBAL_MOTION_COST_AMORTIZATION_BLKS 8
#if GLOBAL_MOTION_COST_AMORTIZATION_BLKS > 0
#if GLOBAL_MOTION_COST_AMORTIZATION_BLKS > 0
static int get_gmbitcost(const WarpedMotionParams *gm, const aom_prob *probs) {
static int get_gmbitcost(const AV1_COMP *const cpi,
int gmtype_cost[TRANS_TYPES];
const WarpedMotionParams *gm) {
int bits;
static const int gm_params_cost[TRANS_TYPES] = {
TransformationType type = gm->wmtype;
GM_IDENTITY_BITS, GM_TRANSLATION_BITS, GM_ROTZOOM_BITS,
av1_cost_tokens(gmtype_cost, probs, av1_global_motion_types_tree);
GM_AFFINE_BITS, GM_HOMOGRAPHY_BITS,
switch (type) {
};
case HOMOGRAPHY:
const int cost = (gm_params_cost[gm->wmtype] << AV1_PROB_COST_SHIFT) +
bits = (GM_ABS_TRANS_BITS + 1) * 2 + (GM_ABS_ALPHA_BITS + 1) * 4 +
cpi->gmtype_cost[gm->wmtype];
(GM_ABS_ROW3HOMO_BITS + 1) * 2;
assert(gm->wmtype < GLOBAL_TRANS_TYPES);
break;
return cost;
case AFFINE:
bits = (GM_ABS_TRANS_BITS + 1) * 2 + (GM_ABS_ALPHA_BITS + 1) * 4;
break;
case ROTZOOM:
bits = (GM_ABS_TRANS_BITS + 1) * 2 + (GM_ABS_ALPHA_BITS + 1) * 2;
break;
case TRANSLATION: bits = (GM_ABS_TRANS_BITS + 1) * 2; break;
case IDENTITY: bits = 0; break;
default: assert(0); return 0;
}
assert(type < GLOBAL_TRANS_TYPES);
return bits ? (bits << AV1_PROB_COST_SHIFT) + gmtype_cost[type] : 0;
}
}
#define GLOBAL_MOTION_RATE(ref) \
#define GLOBAL_MOTION_RATE(ref) \
(cpi->global_motion_used[ref] >= GLOBAL_MOTION_COST_AMORTIZATION_BLKS \
(cpi->global_motion_used[ref] >= GLOBAL_MOTION_COST_AMORTIZATION_BLKS \
? 0 \
? 0 \
: get_gmbitcost(&cm->global_motion[(ref)], \
: get_gmbitcost(cpi, &cm->global_motion[(ref)]) / \
cm->fc->global_motion_types_prob) / \
GLOBAL_MOTION_COST_AMORTIZATION_BLKS)
GLOBAL_MOTION_COST_AMORTIZATION_BLKS)
#else
#else
#define GLOBAL_MOTION_RATE(ref) 0
#define GLOBAL_MOTION_RATE(ref) 0
...
...
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