Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
2a2a7dde
Commit
2a2a7dde
authored
Apr 25, 2017
by
Angie Chiang
Browse files
Merge RD_COST and RD_STATS
BUG=aomedia:442 Change-Id: I9b304230acd2f64d6eab59418c9535f8c302765b
parent
ddcea395
Changes
6
Hide whitespace changes
Inline
Side-by-side
av1/common/blockd.h
View file @
2a2a7dde
...
...
@@ -281,10 +281,10 @@ typedef struct {
#endif
#endif
// TODO(angiebird): Merge RD_COST and RD_STATS
typedef
struct
RD_STATS
{
int
rate
;
int64_t
dist
;
int64_t
rdcost
;
int64_t
sse
;
int
skip
;
#if CONFIG_RD_DEBUG
...
...
av1/encoder/encodeframe.c
View file @
2a2a7dde
...
...
@@ -1877,7 +1877,7 @@ static int set_segment_rdmult(const AV1_COMP *const cpi, MACROBLOCK *const x,
static
void
rd_pick_sb_modes
(
const
AV1_COMP
*
const
cpi
,
TileDataEnc
*
tile_data
,
MACROBLOCK
*
const
x
,
int
mi_row
,
int
mi_col
,
RD_
CO
ST
*
rd_cost
,
RD_ST
ATS
*
rd_cost
,
#if CONFIG_SUPERTX
int
*
totalrate_nocoef
,
#endif
...
...
@@ -2838,7 +2838,7 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
:
PARTITION_NONE
;
const
BLOCK_SIZE
subsize
=
get_subsize
(
bsize
,
partition
);
RD_SEARCH_MACROBLOCK_CONTEXT
x_ctx
;
RD_
CO
ST
last_part_rdc
,
none_rdc
,
chosen_rdc
;
RD_ST
ATS
last_part_rdc
,
none_rdc
,
chosen_rdc
;
BLOCK_SIZE
sub_subsize
=
BLOCK_4X4
;
int
splits_below
=
0
;
BLOCK_SIZE
bs_type
=
mib
[
0
]
->
mbmi
.
sb_type
;
...
...
@@ -2858,9 +2858,9 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
assert
(
num_4x4_blocks_wide_lookup
[
bsize
]
==
num_4x4_blocks_high_lookup
[
bsize
]);
av1_
rd_cost_reset
(
&
last_part_rdc
);
av1_
rd_cost_reset
(
&
none_rdc
);
av1_
rd_cost_reset
(
&
chosen_rdc
);
av1_
invalid_rd_stats
(
&
last_part_rdc
);
av1_
invalid_rd_stats
(
&
none_rdc
);
av1_
invalid_rd_stats
(
&
chosen_rdc
);
pc_tree
->
partitioning
=
partition
;
...
...
@@ -2951,12 +2951,12 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
subsize
,
&
pc_tree
->
horizontal
[
0
],
INT64_MAX
);
if
(
last_part_rdc
.
rate
!=
INT_MAX
&&
bsize
>=
BLOCK_8X8
&&
mi_row
+
hbs
<
cm
->
mi_rows
)
{
RD_
CO
ST
tmp_rdc
;
RD_ST
ATS
tmp_rdc
;
#if CONFIG_SUPERTX
int
rt_nocoef
=
0
;
#endif
PICK_MODE_CONTEXT
*
ctx_h
=
&
pc_tree
->
horizontal
[
0
];
av1_
rd_cost_init
(
&
tmp_rdc
);
av1_
init_rd_stats
(
&
tmp_rdc
);
update_state
(
cpi
,
td
,
ctx_h
,
mi_row
,
mi_col
,
subsize
,
1
);
encode_superblock
(
cpi
,
td
,
tp
,
DRY_RUN_NORMAL
,
mi_row
,
mi_col
,
subsize
,
ctx_h
,
NULL
);
...
...
@@ -2969,7 +2969,7 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
#endif
subsize
,
&
pc_tree
->
horizontal
[
1
],
INT64_MAX
);
if
(
tmp_rdc
.
rate
==
INT_MAX
||
tmp_rdc
.
dist
==
INT64_MAX
)
{
av1_
rd_cost_reset
(
&
last_part_rdc
);
av1_
invalid_rd_stats
(
&
last_part_rdc
);
#if CONFIG_SUPERTX
last_part_rate_nocoef
=
INT_MAX
;
#endif
...
...
@@ -2994,12 +2994,12 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
subsize
,
&
pc_tree
->
vertical
[
0
],
INT64_MAX
);
if
(
last_part_rdc
.
rate
!=
INT_MAX
&&
bsize
>=
BLOCK_8X8
&&
mi_col
+
hbs
<
cm
->
mi_cols
)
{
RD_
CO
ST
tmp_rdc
;
RD_ST
ATS
tmp_rdc
;
#if CONFIG_SUPERTX
int
rt_nocoef
=
0
;
#endif
PICK_MODE_CONTEXT
*
ctx_v
=
&
pc_tree
->
vertical
[
0
];
av1_
rd_cost_init
(
&
tmp_rdc
);
av1_
init_rd_stats
(
&
tmp_rdc
);
update_state
(
cpi
,
td
,
ctx_v
,
mi_row
,
mi_col
,
subsize
,
1
);
encode_superblock
(
cpi
,
td
,
tp
,
DRY_RUN_NORMAL
,
mi_row
,
mi_col
,
subsize
,
ctx_v
,
NULL
);
...
...
@@ -3013,7 +3013,7 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
subsize
,
&
pc_tree
->
vertical
[
bsize
>
BLOCK_8X8
],
INT64_MAX
);
if
(
tmp_rdc
.
rate
==
INT_MAX
||
tmp_rdc
.
dist
==
INT64_MAX
)
{
av1_
rd_cost_reset
(
&
last_part_rdc
);
av1_
invalid_rd_stats
(
&
last_part_rdc
);
#if CONFIG_SUPERTX
last_part_rate_nocoef
=
INT_MAX
;
#endif
...
...
@@ -3049,14 +3049,14 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
int
x_idx
=
(
i
&
1
)
*
hbs
;
int
y_idx
=
(
i
>>
1
)
*
hbs
;
int
jj
=
i
>>
1
,
ii
=
i
&
0x01
;
RD_
CO
ST
tmp_rdc
;
RD_ST
ATS
tmp_rdc
;
#if CONFIG_SUPERTX
int
rt_nocoef
;
#endif
if
((
mi_row
+
y_idx
>=
cm
->
mi_rows
)
||
(
mi_col
+
x_idx
>=
cm
->
mi_cols
))
continue
;
av1_
rd_cost_init
(
&
tmp_rdc
);
av1_
init_rd_stats
(
&
tmp_rdc
);
rd_use_partition
(
cpi
,
td
,
tile_data
,
mib
+
jj
*
hbs
*
cm
->
mi_stride
+
ii
*
hbs
,
tp
,
mi_row
+
y_idx
,
mi_col
+
x_idx
,
subsize
,
&
tmp_rdc
.
rate
,
...
...
@@ -3066,7 +3066,7 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
#endif
i
!=
3
,
pc_tree
->
split
[
i
]);
if
(
tmp_rdc
.
rate
==
INT_MAX
||
tmp_rdc
.
dist
==
INT64_MAX
)
{
av1_
rd_cost_reset
(
&
last_part_rdc
);
av1_
invalid_rd_stats
(
&
last_part_rdc
);
#if CONFIG_SUPERTX
last_part_rate_nocoef
=
INT_MAX
;
#endif
...
...
@@ -3119,7 +3119,7 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
for
(
i
=
0
;
i
<
4
;
i
++
)
{
int
x_idx
=
(
i
&
1
)
*
hbs
;
int
y_idx
=
(
i
>>
1
)
*
hbs
;
RD_
CO
ST
tmp_rdc
;
RD_ST
ATS
tmp_rdc
;
#if CONFIG_SUPERTX
int
rt_nocoef
=
0
;
#endif
...
...
@@ -3151,7 +3151,7 @@ static void rd_use_partition(AV1_COMP *cpi, ThreadData *td,
restore_context
(
x
,
&
x_ctx
,
mi_row
,
mi_col
,
&
buf
,
bsize
);
#endif
if
(
tmp_rdc
.
rate
==
INT_MAX
||
tmp_rdc
.
dist
==
INT64_MAX
)
{
av1_
rd_cost_reset
(
&
chosen_rdc
);
av1_
invalid_rd_stats
(
&
chosen_rdc
);
#if CONFIG_SUPERTX
chosen_rate_nocoef
=
INT_MAX
;
#endif
...
...
@@ -3540,7 +3540,7 @@ static INLINE int get_motion_inconsistency(MOTION_DIRECTION this_mv,
#if CONFIG_EXT_PARTITION_TYPES
static
void
rd_test_partition3
(
const
AV1_COMP
*
const
cpi
,
ThreadData
*
td
,
TileDataEnc
*
tile_data
,
TOKENEXTRA
**
tp
,
PC_TREE
*
pc_tree
,
RD_
CO
ST
*
best_rdc
,
TOKENEXTRA
**
tp
,
PC_TREE
*
pc_tree
,
RD_ST
ATS
*
best_rdc
,
PICK_MODE_CONTEXT
ctxs
[
3
],
PICK_MODE_CONTEXT
*
ctx
,
int
mi_row
,
int
mi_col
,
BLOCK_SIZE
bsize
,
PARTITION_TYPE
partition
,
#if CONFIG_SUPERTX
...
...
@@ -3550,7 +3550,7 @@ static void rd_test_partition3(
BLOCK_SIZE
subsize1
,
int
mi_row2
,
int
mi_col2
,
BLOCK_SIZE
subsize2
)
{
MACROBLOCK
*
const
x
=
&
td
->
mb
;
MACROBLOCKD
*
const
xd
=
&
x
->
e_mbd
;
RD_
CO
ST
this_rdc
,
sum_rdc
;
RD_ST
ATS
this_rdc
,
sum_rdc
;
#if CONFIG_SUPERTX
const
AV1_COMMON
*
const
cm
=
&
cpi
->
common
;
TileInfo
*
const
tile_info
=
&
tile_data
->
tile_info
;
...
...
@@ -3670,7 +3670,7 @@ static void rd_test_partition3(
if
(
!
check_intra_sb
(
cpi
,
tile_info
,
mi_row
,
mi_col
,
bsize
,
pc_tree
))
{
TX_TYPE
best_tx
=
DCT_DCT
;
RD_
CO
ST
tmp_rdc
=
{
sum_rate_nocoef
,
0
,
0
};
RD_ST
ATS
tmp_rdc
=
{
sum_rate_nocoef
,
0
,
0
};
restore_context
(
x
,
x_ctx
,
mi_row
,
mi_col
,
bsize
);
...
...
@@ -3726,7 +3726,7 @@ static void rd_test_partition3(
static
void
rd_pick_partition
(
const
AV1_COMP
*
const
cpi
,
ThreadData
*
td
,
TileDataEnc
*
tile_data
,
TOKENEXTRA
**
tp
,
int
mi_row
,
int
mi_col
,
BLOCK_SIZE
bsize
,
RD_
CO
ST
*
rd_cost
,
RD_ST
ATS
*
rd_cost
,
#if CONFIG_SUPERTX
int
*
rate_nocoef
,
#endif
...
...
@@ -3747,7 +3747,7 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
int
tmp_partition_cost
[
PARTITION_TYPES
];
#endif
BLOCK_SIZE
subsize
;
RD_
CO
ST
this_rdc
,
sum_rdc
,
best_rdc
;
RD_ST
ATS
this_rdc
,
sum_rdc
,
best_rdc
;
const
int
bsize_at_least_8x8
=
(
bsize
>=
BLOCK_8X8
);
int
do_square_split
=
bsize_at_least_8x8
;
#if CONFIG_CB4X4
...
...
@@ -3844,9 +3844,9 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
assert
(
mi_size_wide
[
bsize
]
==
mi_size_high
[
bsize
]);
av1_
rd_cost_init
(
&
this_rdc
);
av1_
rd_cost_init
(
&
sum_rdc
);
av1_
rd_cost_reset
(
&
best_rdc
);
av1_
init_rd_stats
(
&
this_rdc
);
av1_
init_rd_stats
(
&
sum_rdc
);
av1_
invalid_rd_stats
(
&
best_rdc
);
best_rdc
.
rdcost
=
best_rd
;
set_offsets
(
cpi
,
tile_info
,
x
,
mi_row
,
mi_col
,
bsize
);
...
...
@@ -4108,7 +4108,9 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
if
(
is_inter_mode
(
pc_tree
->
leaf_split
[
0
]
->
mic
.
mbmi
.
mode
))
{
TX_TYPE
best_tx
=
DCT_DCT
;
RD_COST
tmp_rdc
=
{
sum_rate_nocoef
,
0
,
0
};
RD_STATS
tmp_rdc
;
av1_init_rd_stats
(
&
tmp_rdc
);
tmp_rdc
.
rate
=
sum_rate_nocoef
;
restore_context
(
x
,
&
x_ctx
,
mi_row
,
mi_col
,
bsize
);
...
...
@@ -4190,7 +4192,9 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
if
(
!
check_intra_sb
(
cpi
,
tile_info
,
mi_row
,
mi_col
,
bsize
,
pc_tree
))
{
TX_TYPE
best_tx
=
DCT_DCT
;
RD_COST
tmp_rdc
=
{
sum_rate_nocoef
,
0
,
0
};
RD_STATS
tmp_rdc
;
av1_init_rd_stats
(
&
tmp_rdc
);
tmp_rdc
.
rate
=
sum_rate_nocoef
;
restore_context
(
x
,
&
x_ctx
,
mi_row
,
mi_col
,
bsize
);
...
...
@@ -4339,7 +4343,9 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
if
(
!
check_intra_sb
(
cpi
,
tile_info
,
mi_row
,
mi_col
,
bsize
,
pc_tree
))
{
TX_TYPE
best_tx
=
DCT_DCT
;
RD_COST
tmp_rdc
=
{
sum_rate_nocoef
,
0
,
0
};
RD_STATS
tmp_rdc
;
av1_init_rd_stats
(
&
tmp_rdc
);
tmp_rdc
.
rate
=
sum_rate_nocoef
;
restore_context
(
x
,
&
x_ctx
,
mi_row
,
mi_col
,
bsize
);
...
...
@@ -4483,7 +4489,9 @@ static void rd_pick_partition(const AV1_COMP *const cpi, ThreadData *td,
if
(
!
check_intra_sb
(
cpi
,
tile_info
,
mi_row
,
mi_col
,
bsize
,
pc_tree
))
{
TX_TYPE
best_tx
=
DCT_DCT
;
RD_COST
tmp_rdc
=
{
sum_rate_nocoef
,
0
,
0
};
RD_STATS
tmp_rdc
;
av1_init_rd_stats
(
&
tmp_rdc
);
tmp_rdc
.
rate
=
sum_rate_nocoef
;
restore_context
(
x
,
&
x_ctx
,
mi_row
,
mi_col
,
bsize
);
...
...
@@ -4658,7 +4666,7 @@ static void encode_rd_sb_row(AV1_COMP *cpi, ThreadData *td,
const
struct
segmentation
*
const
seg
=
&
cm
->
seg
;
int
dummy_rate
;
int64_t
dummy_dist
;
RD_
CO
ST
dummy_rdc
;
RD_ST
ATS
dummy_rdc
;
#if CONFIG_SUPERTX
int
dummy_rate_nocoef
;
#endif // CONFIG_SUPERTX
...
...
av1/encoder/rd.c
View file @
2a2a7dde
...
...
@@ -46,18 +46,6 @@
// Factor to weigh the rate for switchable interp filters.
#define SWITCHABLE_INTERP_RATE_FACTOR 1
void
av1_rd_cost_reset
(
RD_COST
*
rd_cost
)
{
rd_cost
->
rate
=
INT_MAX
;
rd_cost
->
dist
=
INT64_MAX
;
rd_cost
->
rdcost
=
INT64_MAX
;
}
void
av1_rd_cost_init
(
RD_COST
*
rd_cost
)
{
rd_cost
->
rate
=
0
;
rd_cost
->
dist
=
0
;
rd_cost
->
rdcost
=
0
;
}
// The baseline rd thresholds for breaking out of the rd loop for
// certain modes are assumed to be based on 8x8 blocks.
// This table is used to correct for block size.
...
...
av1/encoder/rd.h
View file @
2a2a7dde
...
...
@@ -348,16 +348,83 @@ typedef struct RD_OPT {
int
RDDIV
;
}
RD_OPT
;
typedef
struct
RD_COST
{
int
rate
;
int64_t
dist
;
int64_t
rdcost
;
}
RD_COST
;
// Reset the rate distortion cost values to maximum (invalid) value.
void
av1_rd_cost_reset
(
RD_COST
*
rd_cost
);
// Initialize the rate distortion cost values to zero.
void
av1_rd_cost_init
(
RD_COST
*
rd_cost
);
static
INLINE
void
av1_init_rd_stats
(
RD_STATS
*
rd_stats
)
{
#if CONFIG_RD_DEBUG
int
plane
;
#endif
rd_stats
->
rate
=
0
;
rd_stats
->
dist
=
0
;
rd_stats
->
rdcost
=
0
;
rd_stats
->
sse
=
0
;
rd_stats
->
skip
=
1
;
#if CONFIG_RD_DEBUG
for
(
plane
=
0
;
plane
<
MAX_MB_PLANE
;
++
plane
)
{
rd_stats
->
txb_coeff_cost
[
plane
]
=
0
;
#if CONFIG_VAR_TX
{
int
r
,
c
;
for
(
r
=
0
;
r
<
TXB_COEFF_COST_MAP_SIZE
;
++
r
)
for
(
c
=
0
;
c
<
TXB_COEFF_COST_MAP_SIZE
;
++
c
)
rd_stats
->
txb_coeff_cost_map
[
plane
][
r
][
c
]
=
0
;
}
#endif
}
#endif
}
static
INLINE
void
av1_invalid_rd_stats
(
RD_STATS
*
rd_stats
)
{
#if CONFIG_RD_DEBUG
int
plane
;
#endif
rd_stats
->
rate
=
INT_MAX
;
rd_stats
->
dist
=
INT64_MAX
;
rd_stats
->
rdcost
=
INT64_MAX
;
rd_stats
->
sse
=
INT64_MAX
;
rd_stats
->
skip
=
0
;
#if CONFIG_RD_DEBUG
for
(
plane
=
0
;
plane
<
MAX_MB_PLANE
;
++
plane
)
{
rd_stats
->
txb_coeff_cost
[
plane
]
=
INT_MAX
;
#if CONFIG_VAR_TX
{
int
r
,
c
;
for
(
r
=
0
;
r
<
TXB_COEFF_COST_MAP_SIZE
;
++
r
)
for
(
c
=
0
;
c
<
TXB_COEFF_COST_MAP_SIZE
;
++
c
)
rd_stats
->
txb_coeff_cost_map
[
plane
][
r
][
c
]
=
INT_MAX
;
}
#endif
}
#endif
}
static
INLINE
void
av1_merge_rd_stats
(
RD_STATS
*
rd_stats_dst
,
const
RD_STATS
*
rd_stats_src
)
{
#if CONFIG_RD_DEBUG
int
plane
;
#endif
rd_stats_dst
->
rate
+=
rd_stats_src
->
rate
;
rd_stats_dst
->
dist
+=
rd_stats_src
->
dist
;
rd_stats_dst
->
sse
+=
rd_stats_src
->
sse
;
rd_stats_dst
->
skip
&=
rd_stats_src
->
skip
;
#if CONFIG_RD_DEBUG
for
(
plane
=
0
;
plane
<
MAX_MB_PLANE
;
++
plane
)
{
rd_stats_dst
->
txb_coeff_cost
[
plane
]
+=
rd_stats_src
->
txb_coeff_cost
[
plane
];
#if CONFIG_VAR_TX
{
// TODO(angiebird): optimize this part
int
r
,
c
;
int
ref_txb_coeff_cost
=
0
;
for
(
r
=
0
;
r
<
TXB_COEFF_COST_MAP_SIZE
;
++
r
)
for
(
c
=
0
;
c
<
TXB_COEFF_COST_MAP_SIZE
;
++
c
)
{
rd_stats_dst
->
txb_coeff_cost_map
[
plane
][
r
][
c
]
+=
rd_stats_src
->
txb_coeff_cost_map
[
plane
][
r
][
c
];
ref_txb_coeff_cost
+=
rd_stats_dst
->
txb_coeff_cost_map
[
plane
][
r
][
c
];
}
assert
(
ref_txb_coeff_cost
==
rd_stats_dst
->
txb_coeff_cost
[
plane
]);
}
#endif
}
#endif
}
struct
TileInfo
;
struct
TileDataEnc
;
...
...
av1/encoder/rdopt.c
View file @
2a2a7dde
...
...
@@ -9068,7 +9068,7 @@ static int64_t handle_inter_mode(
// This is a dummy function that forces intrabc on for testing purposes
// TODO(aconverse@google.com): Implement a real intrabc search
static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
RD_
CO
ST *rd_cost, BLOCK_SIZE bsize,
RD_ST
ATS
*rd_cost, BLOCK_SIZE bsize,
int64_t best_rd) {
MACROBLOCKD *const xd = &x->e_mbd;
(void)best_rd;
...
...
@@ -9105,7 +9105,7 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
#endif // CONFIG_INTRABC
void av1_rd_pick_intra_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
RD_
CO
ST *rd_cost, BLOCK_SIZE bsize,
RD_ST
ATS
*rd_cost, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx, int64_t best_rd) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
...
...
@@ -9310,7 +9310,7 @@ static void pick_filter_intra_interframe(
#if CONFIG_SUPERTX
int *returnrate_nocoef,
#endif // CONFIG_SUPERTX
int64_t *best_pred_rd, MB_MODE_INFO *best_mbmode, RD_
CO
ST *rd_cost) {
int64_t *best_pred_rd, MB_MODE_INFO *best_mbmode, RD_ST
ATS
*rd_cost) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
...
...
@@ -9473,7 +9473,7 @@ static void calc_target_weighted_pred(const AV1_COMMON *cm, const MACROBLOCK *x,
void av1_rd_pick_inter_mode_sb(const AV1_COMP *cpi, TileDataEnc *tile_data,
MACROBLOCK *x, int mi_row, int mi_col,
RD_
CO
ST *rd_cost,
RD_ST
ATS
*rd_cost,
#if CONFIG_SUPERTX
int *returnrate_nocoef,
#endif // CONFIG_SUPERTX
...
...
@@ -11358,7 +11358,7 @@ PALETTE_EXIT:
void av1_rd_pick_inter_mode_sb_seg_skip(const AV1_COMP *cpi,
TileDataEnc *tile_data, MACROBLOCK *x,
int mi_row, int mi_col,
RD_
CO
ST *rd_cost, BLOCK_SIZE bsize,
RD_ST
ATS
*rd_cost, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx,
int64_t best_rd_so_far) {
const AV1_COMMON *const cm = &cpi->common;
...
...
@@ -11498,7 +11498,7 @@ void av1_rd_pick_inter_mode_sb_seg_skip(const AV1_COMP *cpi,
void av1_rd_pick_inter_mode_sub8x8(const struct AV1_COMP *cpi,
TileDataEnc *tile_data, struct macroblock *x,
int mi_row, int mi_col,
struct RD_
CO
ST *rd_cost,
struct RD_ST
ATS
*rd_cost,
#if CONFIG_SUPERTX
int *returnrate_nocoef,
#endif // CONFIG_SUPERTX
...
...
av1/encoder/rdopt.h
View file @
2a2a7dde
...
...
@@ -24,7 +24,7 @@ extern "C" {
struct
TileInfo
;
struct
AV1_COMP
;
struct
macroblock
;
struct
RD_
CO
ST
;
struct
RD_ST
ATS
;
#if CONFIG_RD_DEBUG
static
INLINE
void
av1_update_txb_coeff_cost
(
RD_STATS
*
rd_stats
,
int
plane
,
...
...
@@ -52,82 +52,6 @@ static INLINE void av1_update_txb_coeff_cost(RD_STATS *rd_stats, int plane,
}
#endif
static
INLINE
void
av1_init_rd_stats
(
RD_STATS
*
rd_stats
)
{
#if CONFIG_RD_DEBUG
int
plane
;
#endif
rd_stats
->
rate
=
0
;
rd_stats
->
dist
=
0
;
rd_stats
->
sse
=
0
;
rd_stats
->
skip
=
1
;
#if CONFIG_RD_DEBUG
for
(
plane
=
0
;
plane
<
MAX_MB_PLANE
;
++
plane
)
{
rd_stats
->
txb_coeff_cost
[
plane
]
=
0
;
#if CONFIG_VAR_TX
{
int
r
,
c
;
for
(
r
=
0
;
r
<
TXB_COEFF_COST_MAP_SIZE
;
++
r
)
for
(
c
=
0
;
c
<
TXB_COEFF_COST_MAP_SIZE
;
++
c
)
rd_stats
->
txb_coeff_cost_map
[
plane
][
r
][
c
]
=
0
;
}
#endif
}
#endif
}
static
INLINE
void
av1_invalid_rd_stats
(
RD_STATS
*
rd_stats
)
{
#if CONFIG_RD_DEBUG
int
plane
;
#endif
rd_stats
->
rate
=
INT_MAX
;
rd_stats
->
dist
=
INT64_MAX
;
rd_stats
->
sse
=
INT64_MAX
;
rd_stats
->
skip
=
0
;
#if CONFIG_RD_DEBUG
for
(
plane
=
0
;
plane
<
MAX_MB_PLANE
;
++
plane
)
{
rd_stats
->
txb_coeff_cost
[
plane
]
=
INT_MAX
;
#if CONFIG_VAR_TX
{
int
r
,
c
;
for
(
r
=
0
;
r
<
TXB_COEFF_COST_MAP_SIZE
;
++
r
)
for
(
c
=
0
;
c
<
TXB_COEFF_COST_MAP_SIZE
;
++
c
)
rd_stats
->
txb_coeff_cost_map
[
plane
][
r
][
c
]
=
INT_MAX
;
}
#endif
}
#endif
}
static
INLINE
void
av1_merge_rd_stats
(
RD_STATS
*
rd_stats_dst
,
const
RD_STATS
*
rd_stats_src
)
{
#if CONFIG_RD_DEBUG
int
plane
;
#endif
rd_stats_dst
->
rate
+=
rd_stats_src
->
rate
;
rd_stats_dst
->
dist
+=
rd_stats_src
->
dist
;
rd_stats_dst
->
sse
+=
rd_stats_src
->
sse
;
rd_stats_dst
->
skip
&=
rd_stats_src
->
skip
;
#if CONFIG_RD_DEBUG
for
(
plane
=
0
;
plane
<
MAX_MB_PLANE
;
++
plane
)
{
rd_stats_dst
->
txb_coeff_cost
[
plane
]
+=
rd_stats_src
->
txb_coeff_cost
[
plane
];
#if CONFIG_VAR_TX
{
// TODO(angiebird): optimize this part
int
r
,
c
;
int
ref_txb_coeff_cost
=
0
;
for
(
r
=
0
;
r
<
TXB_COEFF_COST_MAP_SIZE
;
++
r
)
for
(
c
=
0
;
c
<
TXB_COEFF_COST_MAP_SIZE
;
++
c
)
{
rd_stats_dst
->
txb_coeff_cost_map
[
plane
][
r
][
c
]
+=
rd_stats_src
->
txb_coeff_cost_map
[
plane
][
r
][
c
];
ref_txb_coeff_cost
+=
rd_stats_dst
->
txb_coeff_cost_map
[
plane
][
r
][
c
];
}
assert
(
ref_txb_coeff_cost
==
rd_stats_dst
->
txb_coeff_cost
[
plane
]);
}
#endif
}
#endif
}
typedef
enum
OUTPUT_STATUS
{
OUTPUT_HAS_PREDICTED_PIXELS
,
OUTPUT_HAS_DECODED_PIXELS
...
...
@@ -145,7 +69,7 @@ int av1_cost_coeffs(const AV1_COMP *const cpi, MACROBLOCK *x, int plane,
int
use_fast_coef_costing
);
#endif
void
av1_rd_pick_intra_mode_sb
(
const
struct
AV1_COMP
*
cpi
,
struct
macroblock
*
x
,
struct
RD_
CO
ST
*
rd_cost
,
BLOCK_SIZE
bsize
,
struct
RD_ST
ATS
*
rd_cost
,
BLOCK_SIZE
bsize
,
PICK_MODE_CONTEXT
*
ctx
,
int64_t
best_rd
);
unsigned
int
av1_get_sby_perpixel_variance
(
const
AV1_COMP
*
cpi
,
...
...
@@ -160,7 +84,7 @@ unsigned int av1_high_get_sby_perpixel_variance(const AV1_COMP *cpi,
void
av1_rd_pick_inter_mode_sb
(
const
struct
AV1_COMP
*
cpi
,
struct
TileDataEnc
*
tile_data
,
struct
macroblock
*
x
,
int
mi_row
,
int
mi_col
,
struct
RD_
CO
ST
*
rd_cost
,
struct
RD_ST
ATS
*
rd_cost
,
#if CONFIG_SUPERTX
int
*
returnrate_nocoef
,
#endif // CONFIG_SUPERTX
...
...
@@ -169,7 +93,7 @@ void av1_rd_pick_inter_mode_sb(const struct AV1_COMP *cpi,
void
av1_rd_pick_inter_mode_sb_seg_skip
(
const
struct
AV1_COMP
*
cpi
,
struct
TileDataEnc
*
tile_data
,
struct
macroblock
*
x
,
int
mi_row
,
int
mi_col
,
struct
RD_
CO
ST
*
rd_cost
,
struct
macroblock
*
x
,
int
mi_row
,
int
mi_col
,
struct
RD_ST
ATS
*
rd_cost
,
BLOCK_SIZE
bsize
,
PICK_MODE_CONTEXT
*
ctx
,
int64_t
best_rd_so_far
);
int
av1_internal_image_edge
(
const
struct
AV1_COMP
*
cpi
);
...
...
@@ -180,7 +104,7 @@ int av1_active_edge_sb(const struct AV1_COMP *cpi, int mi_row, int mi_col);
void
av1_rd_pick_inter_mode_sub8x8
(
const
struct
AV1_COMP
*
cpi
,
struct
TileDataEnc
*
tile_data
,
struct
macroblock
*
x
,
int
mi_row
,
int
mi_col
,
struct
RD_
CO
ST
*
rd_cost
,
struct
RD_ST
ATS
*
rd_cost
,
#if CONFIG_SUPERTX
int
*
returnrate_nocoef
,
#endif // CONFIG_SUPERTX
...
...
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