Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guillaume Martres
aom-rav1e
Commits
04d62a98
Commit
04d62a98
authored
Oct 22, 2012
by
Deb Mukherjee
Browse files
Merging in the TX_SELECT experiment
Change-Id: I0d306b0062be59bc785b65882691c956c8b5e7c8
parent
78808ad9
Changes
10
Hide whitespace changes
Inline
Side-by-side
configure
View file @
04d62a98
...
...
@@ -224,7 +224,6 @@ EXPERIMENT_LIST="
switchable_interp
newbestrefmv
new_mvref
tx_select
"
CONFIG_LIST
=
"
external_build
...
...
vp8/common/onyxc_int.h
View file @
04d62a98
...
...
@@ -131,10 +131,8 @@ typedef enum {
ONLY_4X4
=
0
,
ALLOW_8X8
=
1
,
ALLOW_16X16
=
2
,
#if CONFIG_TX_SELECT
TX_MODE_SELECT
=
3
,
#endif
NB_TXFM_MODES
=
3
+
CONFIG_TX_SELECT
,
NB_TXFM_MODES
=
4
,
}
TXFM_MODE
;
typedef
struct
VP8_COMMON_RTCD
{
...
...
@@ -272,10 +270,8 @@ typedef struct VP8Common {
vp8_prob
prob_comppred
[
COMP_PRED_CONTEXTS
];
#if CONFIG_TX_SELECT
// FIXME contextualize
vp8_prob
prob_tx
[
TX_SIZE_MAX
-
1
];
#endif
vp8_prob
mbskip_pred_probs
[
MBSKIP_CONTEXTS
];
...
...
vp8/decoder/decodemv.c
View file @
04d62a98
...
...
@@ -170,16 +170,13 @@ static void kfread_modes(VP8D_COMP *pbi,
m
->
mbmi
.
second_uv_mode
=
(
MB_PREDICTION_MODE
)(
DC_PRED
-
1
);
#endif
#if CONFIG_TX_SELECT
if
(
cm
->
txfm_mode
==
TX_MODE_SELECT
&&
m
->
mbmi
.
mb_skip_coeff
==
0
&&
m
->
mbmi
.
mode
<=
I8X8_PRED
)
{
// FIXME(rbultje) code ternary symbol once all experiments are merged
m
->
mbmi
.
txfm_size
=
vp8_read
(
bc
,
cm
->
prob_tx
[
0
]);
if
(
m
->
mbmi
.
txfm_size
!=
TX_4X4
&&
m
->
mbmi
.
mode
!=
I8X8_PRED
)
m
->
mbmi
.
txfm_size
+=
vp8_read
(
bc
,
cm
->
prob_tx
[
1
]);
}
else
#endif
if
(
cm
->
txfm_mode
>=
ALLOW_16X16
&&
m
->
mbmi
.
mode
<=
TM_PRED
)
{
}
else
if
(
cm
->
txfm_mode
>=
ALLOW_16X16
&&
m
->
mbmi
.
mode
<=
TM_PRED
)
{
m
->
mbmi
.
txfm_size
=
TX_16X16
;
}
else
if
(
cm
->
txfm_mode
>=
ALLOW_8X8
&&
m
->
mbmi
.
mode
!=
B_PRED
)
{
m
->
mbmi
.
txfm_size
=
TX_8X8
;
...
...
@@ -1099,7 +1096,6 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
#endif
}
#if CONFIG_TX_SELECT
if
(
cm
->
txfm_mode
==
TX_MODE_SELECT
&&
mbmi
->
mb_skip_coeff
==
0
&&
((
mbmi
->
ref_frame
==
INTRA_FRAME
&&
mbmi
->
mode
<=
I8X8_PRED
)
||
(
mbmi
->
ref_frame
!=
INTRA_FRAME
&&
!
(
mbmi
->
mode
==
SPLITMV
&&
...
...
@@ -1109,9 +1105,7 @@ static void read_mb_modes_mv(VP8D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
if
(
mbmi
->
txfm_size
!=
TX_4X4
&&
mbmi
->
mode
!=
I8X8_PRED
&&
mbmi
->
mode
!=
SPLITMV
)
mbmi
->
txfm_size
+=
vp8_read
(
bc
,
cm
->
prob_tx
[
1
]);
}
else
#endif
if
(
cm
->
txfm_mode
>=
ALLOW_16X16
&&
}
else
if
(
cm
->
txfm_mode
>=
ALLOW_16X16
&&
((
mbmi
->
ref_frame
==
INTRA_FRAME
&&
mbmi
->
mode
<=
TM_PRED
)
||
(
mbmi
->
ref_frame
!=
INTRA_FRAME
&&
mbmi
->
mode
!=
SPLITMV
)))
{
mbmi
->
txfm_size
=
TX_16X16
;
...
...
vp8/decoder/decodframe.c
View file @
04d62a98
...
...
@@ -1190,17 +1190,11 @@ int vp8_decode_frame(VP8D_COMP *pbi) {
#endif
/* Read the loop filter level and type */
#if CONFIG_TX_SELECT
pc
->
txfm_mode
=
vp8_read_literal
(
&
header_bc
,
2
);
if
(
pc
->
txfm_mode
==
TX_MODE_SELECT
)
{
pc
->
prob_tx
[
0
]
=
vp8_read_literal
(
&
header_bc
,
8
);
pc
->
prob_tx
[
1
]
=
vp8_read_literal
(
&
header_bc
,
8
);
}
#else
pc
->
txfm_mode
=
(
TXFM_MODE
)
vp8_read_bit
(
&
header_bc
);
if
(
pc
->
txfm_mode
==
ALLOW_8X8
)
pc
->
txfm_mode
=
ALLOW_16X16
;
#endif
pc
->
filter_type
=
(
LOOPFILTERTYPE
)
vp8_read_bit
(
&
header_bc
);
pc
->
filter_level
=
vp8_read_literal
(
&
header_bc
,
6
);
...
...
vp8/encoder/bitstream.c
View file @
04d62a98
...
...
@@ -1146,7 +1146,6 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) {
}
}
#if CONFIG_TX_SELECT
if
(((
rf
==
INTRA_FRAME
&&
mode
<=
I8X8_PRED
)
||
(
rf
!=
INTRA_FRAME
&&
!
(
mode
==
SPLITMV
&&
mi
->
partitioning
==
PARTITIONING_4X4
)))
&&
...
...
@@ -1160,7 +1159,6 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi, vp8_writer *const bc) {
if
(
sz
!=
TX_4X4
&&
mode
!=
I8X8_PRED
&&
mode
!=
SPLITMV
)
vp8_write
(
bc
,
sz
!=
TX_8X8
,
pc
->
prob_tx
[
1
]);
}
#endif
#ifdef ENTROPY_STATS
active_section
=
1
;
...
...
@@ -1289,7 +1287,6 @@ static void write_mb_modes_kf(const VP8_COMMON *c,
}
else
write_uv_mode
(
bc
,
m
->
mbmi
.
uv_mode
,
c
->
kf_uv_mode_prob
[
ym
]);
#if CONFIG_TX_SELECT
if
(
ym
<=
I8X8_PRED
&&
c
->
txfm_mode
==
TX_MODE_SELECT
&&
!
((
c
->
mb_no_coeff_skip
&&
m
->
mbmi
.
mb_skip_coeff
)
||
(
segfeature_active
(
xd
,
segment_id
,
SEG_LVL_EOB
)
&&
...
...
@@ -1300,7 +1297,6 @@ static void write_mb_modes_kf(const VP8_COMMON *c,
if
(
sz
!=
TX_4X4
&&
ym
<=
TM_PRED
)
vp8_write
(
bc
,
sz
!=
TX_8X8
,
c
->
prob_tx
[
1
]);
}
#endif
}
static
void
write_kfmodes
(
VP8_COMP
*
const
cpi
,
vp8_writer
*
const
bc
)
{
...
...
@@ -2477,7 +2473,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
}
#endif
#if CONFIG_TX_SELECT
{
if
(
pc
->
txfm_mode
==
TX_MODE_SELECT
)
{
pc
->
prob_tx
[
0
]
=
get_prob
(
cpi
->
txfm_count
[
0
]
+
cpi
->
txfm_count_8x8p
[
0
],
...
...
@@ -2494,9 +2489,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
vp8_write_literal
(
&
header_bc
,
pc
->
prob_tx
[
1
],
8
);
}
}
#else
vp8_write_bit
(
&
header_bc
,
!!
pc
->
txfm_mode
);
#endif
// Encode the loop filter level and type
vp8_write_bit
(
&
header_bc
,
pc
->
filter_type
);
...
...
vp8/encoder/block.h
View file @
04d62a98
...
...
@@ -79,9 +79,7 @@ typedef struct {
int
hybrid_pred_diff
;
int
comp_pred_diff
;
int
single_pred_diff
;
#if CONFIG_TX_SELECT
int64_t
txfm_rd_diff
[
NB_TXFM_MODES
];
#endif
}
PICK_MODE_CONTEXT
;
typedef
struct
{
...
...
vp8/encoder/encodeframe.c
View file @
04d62a98
...
...
@@ -411,7 +411,6 @@ static void update_state(VP8_COMP *cpi, MACROBLOCK *x, PICK_MODE_CONTEXT *ctx) {
mbmi
->
mv
[
1
].
as_int
=
x
->
partition_info
->
bmi
[
15
].
second_mv
.
as_int
;
}
#if CONFIG_TX_SELECT
{
int
segment_id
=
mbmi
->
segment_id
;
if
(
!
segfeature_active
(
xd
,
segment_id
,
SEG_LVL_EOB
)
||
...
...
@@ -421,7 +420,6 @@ static void update_state(VP8_COMP *cpi, MACROBLOCK *x, PICK_MODE_CONTEXT *ctx) {
}
}
}
#endif
if
(
cpi
->
common
.
frame_type
==
KEY_FRAME
)
{
// Restore the coding modes to that held in the coding context
...
...
@@ -1382,11 +1380,9 @@ static void encode_frame_internal(VP8_COMP *cpi) {
vpx_memset
(
cpi
->
rd_comp_pred_diff
,
0
,
sizeof
(
cpi
->
rd_comp_pred_diff
));
vpx_memset
(
cpi
->
single_pred_count
,
0
,
sizeof
(
cpi
->
single_pred_count
));
vpx_memset
(
cpi
->
comp_pred_count
,
0
,
sizeof
(
cpi
->
comp_pred_count
));
#if CONFIG_TX_SELECT
vpx_memset
(
cpi
->
txfm_count
,
0
,
sizeof
(
cpi
->
txfm_count
));
vpx_memset
(
cpi
->
txfm_count_8x8p
,
0
,
sizeof
(
cpi
->
txfm_count_8x8p
));
vpx_memset
(
cpi
->
rd_tx_select_diff
,
0
,
sizeof
(
cpi
->
rd_tx_select_diff
));
#endif
{
struct
vpx_usec_timer
emr_timer
;
vpx_usec_timer_start
(
&
emr_timer
);
...
...
@@ -1446,7 +1442,6 @@ static int check_dual_ref_flags(VP8_COMP *cpi) {
}
}
#if CONFIG_TX_SELECT
static
void
reset_skip_txfm_size
(
VP8_COMP
*
cpi
,
TX_SIZE
txfm_max
)
{
VP8_COMMON
*
cm
=
&
cpi
->
common
;
int
mb_row
,
mb_col
,
mis
=
cm
->
mode_info_stride
;
...
...
@@ -1470,7 +1465,6 @@ static void reset_skip_txfm_size(VP8_COMP *cpi, TX_SIZE txfm_max) {
}
}
}
#endif
void
vp8_encode_frame
(
VP8_COMP
*
cpi
)
{
if
(
cpi
->
sf
.
RD
)
{
...
...
@@ -1516,7 +1510,6 @@ void vp8_encode_frame(VP8_COMP *cpi) {
txfm_type
=
ONLY_4X4
;
}
else
#endif
#if CONFIG_TX_SELECT
/* FIXME (rbultje)
* this is a hack (no really), basically to work around the complete
* nonsense coefficient cost prediction for keyframes. The probabilities
...
...
@@ -1564,16 +1557,11 @@ void vp8_encode_frame(VP8_COMP *cpi) {
cpi
->
rd_tx_select_threshes
[
frame_type
][
TX_MODE_SELECT
]
?
ALLOW_16X16
:
TX_MODE_SELECT
;
#endif
#else
txfm_type
=
ALLOW_16X16
;
#endif // CONFIG_TX_SELECT
cpi
->
common
.
txfm_mode
=
txfm_type
;
#if CONFIG_TX_SELECT
if
(
txfm_type
!=
TX_MODE_SELECT
)
{
cpi
->
common
.
prob_tx
[
0
]
=
128
;
cpi
->
common
.
prob_tx
[
1
]
=
128
;
}
#endif
cpi
->
common
.
comp_pred_mode
=
pred_type
;
encode_frame_internal
(
cpi
);
...
...
@@ -1583,7 +1571,6 @@ void vp8_encode_frame(VP8_COMP *cpi) {
cpi
->
rd_prediction_type_threshes
[
frame_type
][
i
]
>>=
1
;
}
#if CONFIG_TX_SELECT
for
(
i
=
0
;
i
<
NB_TXFM_MODES
;
++
i
)
{
int64_t
pd
=
cpi
->
rd_tx_select_diff
[
i
];
int
diff
;
...
...
@@ -1593,7 +1580,6 @@ void vp8_encode_frame(VP8_COMP *cpi) {
cpi
->
rd_tx_select_threshes
[
frame_type
][
i
]
+=
diff
;
cpi
->
rd_tx_select_threshes
[
frame_type
][
i
]
/=
2
;
}
#endif
if
(
cpi
->
common
.
comp_pred_mode
==
HYBRID_PREDICTION
)
{
int
single_count_zero
=
0
;
...
...
@@ -1611,7 +1597,6 @@ void vp8_encode_frame(VP8_COMP *cpi) {
}
}
#if CONFIG_TX_SELECT
if
(
cpi
->
common
.
txfm_mode
==
TX_MODE_SELECT
)
{
const
int
count4x4
=
cpi
->
txfm_count
[
TX_4X4
]
+
cpi
->
txfm_count_8x8p
[
TX_4X4
];
const
int
count8x8
=
cpi
->
txfm_count
[
TX_8X8
];
...
...
@@ -1628,7 +1613,6 @@ void vp8_encode_frame(VP8_COMP *cpi) {
cpi
->
common
.
txfm_mode
=
ALLOW_16X16
;
}
}
#endif
}
else
{
encode_frame_internal
(
cpi
);
}
...
...
@@ -1946,15 +1930,12 @@ void vp8cx_encode_intra_macro_block(VP8_COMP *cpi,
}
if
(
output_enabled
)
{
#if CONFIG_TX_SELECT
int
segment_id
=
mbmi
->
segment_id
;
#endif
// Tokenize
sum_intra_stats
(
cpi
,
x
);
vp8_tokenize_mb
(
cpi
,
&
x
->
e_mbd
,
t
,
0
);
#if CONFIG_TX_SELECT
if
(
cpi
->
common
.
txfm_mode
==
TX_MODE_SELECT
&&
!
((
cpi
->
common
.
mb_no_coeff_skip
&&
mbmi
->
mb_skip_coeff
)
||
(
segfeature_active
(
&
x
->
e_mbd
,
segment_id
,
SEG_LVL_EOB
)
&&
...
...
@@ -1964,9 +1945,7 @@ void vp8cx_encode_intra_macro_block(VP8_COMP *cpi,
}
else
if
(
mbmi
->
mode
==
I8X8_PRED
)
{
cpi
->
txfm_count_8x8p
[
mbmi
->
txfm_size
]
++
;
}
}
else
#endif
if
(
cpi
->
common
.
txfm_mode
>=
ALLOW_16X16
&&
mbmi
->
mode
<=
TM_PRED
)
{
}
else
if
(
cpi
->
common
.
txfm_mode
>=
ALLOW_16X16
&&
mbmi
->
mode
<=
TM_PRED
)
{
mbmi
->
txfm_size
=
TX_16X16
;
}
else
if
(
cpi
->
common
.
txfm_mode
>=
ALLOW_8X8
&&
mbmi
->
mode
!=
B_PRED
)
{
...
...
@@ -2147,7 +2126,6 @@ void vp8cx_encode_inter_macroblock (VP8_COMP *cpi, MACROBLOCK *x,
}
if
(
output_enabled
)
{
#if CONFIG_TX_SELECT
int
segment_id
=
mbmi
->
segment_id
;
if
(
cpi
->
common
.
txfm_mode
==
TX_MODE_SELECT
&&
!
((
cpi
->
common
.
mb_no_coeff_skip
&&
mbmi
->
mb_skip_coeff
)
||
...
...
@@ -2161,9 +2139,7 @@ void vp8cx_encode_inter_macroblock (VP8_COMP *cpi, MACROBLOCK *x,
mbmi
->
partitioning
!=
PARTITIONING_4X4
))
{
cpi
->
txfm_count_8x8p
[
mbmi
->
txfm_size
]
++
;
}
}
else
#endif
if
(
mbmi
->
mode
!=
B_PRED
&&
mbmi
->
mode
!=
I8X8_PRED
&&
}
else
if
(
mbmi
->
mode
!=
B_PRED
&&
mbmi
->
mode
!=
I8X8_PRED
&&
mbmi
->
mode
!=
SPLITMV
&&
cpi
->
common
.
txfm_mode
>=
ALLOW_16X16
)
{
mbmi
->
txfm_size
=
TX_16X16
;
}
else
if
(
mbmi
->
mode
!=
B_PRED
&&
...
...
vp8/encoder/onyx_if.c
View file @
04d62a98
...
...
@@ -1775,10 +1775,8 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf) {
#endif
for
(
i
=
0
;
i
<
COMP_PRED_CONTEXTS
;
i
++
)
cm
->
prob_comppred
[
i
]
=
128
;
#if CONFIG_TX_SELECT
for
(
i
=
0
;
i
<
TX_SIZE_MAX
-
1
;
i
++
)
cm
->
prob_tx
[
i
]
=
128
;
#endif
// Prime the recent reference frame useage counters.
// Hereafter they will be maintained as a sort of moving average
...
...
vp8/encoder/onyx_int.h
View file @
04d62a98
...
...
@@ -451,13 +451,11 @@ typedef struct VP8_COMP {
int
rd_prediction_type_threshes
[
4
][
NB_PREDICTION_TYPES
];
int
comp_pred_count
[
COMP_PRED_CONTEXTS
];
int
single_pred_count
[
COMP_PRED_CONTEXTS
];
#if CONFIG_TX_SELECT
// FIXME contextualize
int
txfm_count
[
TX_SIZE_MAX
];
int
txfm_count_8x8p
[
TX_SIZE_MAX
-
1
];
int64_t
rd_tx_select_diff
[
NB_TXFM_MODES
];
int
rd_tx_select_threshes
[
4
][
NB_TXFM_MODES
];
#endif
int
RDMULT
;
int
RDDIV
;
...
...
vp8/encoder/rdopt.c
View file @
04d62a98
...
...
@@ -871,8 +871,6 @@ static void macro_block_yrd(VP8_COMP *cpi, MACROBLOCK *x, int *rate,
VP8_COMMON
*
cm
=
&
cpi
->
common
;
MB_MODE_INFO
*
mbmi
=
&
x
->
e_mbd
.
mode_info_context
->
mbmi
;
#if CONFIG_TX_SELECT
MACROBLOCKD
*
xd
=
&
x
->
e_mbd
;
int
can_skip
=
cm
->
mb_no_coeff_skip
;
vp8_prob
skip_prob
=
can_skip
?
get_pred_prob
(
cm
,
xd
,
PRED_MBSKIP
)
:
128
;
...
...
@@ -980,25 +978,6 @@ static void macro_block_yrd(VP8_COMP *cpi, MACROBLOCK *x, int *rate,
else
txfm_cache
[
TX_MODE_SELECT
]
=
rd4x4s
<
rd8x8s
?
rd4x4s
:
rd8x8s
;
#else
/* CONFIG_TX_SELECT */
switch
(
cpi
->
common
.
txfm_mode
)
{
case
ALLOW_16X16
:
macro_block_yrd_16x16
(
x
,
rate
,
distortion
,
IF_RTCD
(
&
cpi
->
rtcd
),
skippable
);
mbmi
->
txfm_size
=
TX_16X16
;
break
;
case
ALLOW_8X8
:
macro_block_yrd_8x8
(
x
,
rate
,
distortion
,
IF_RTCD
(
&
cpi
->
rtcd
),
skippable
);
mbmi
->
txfm_size
=
TX_8X8
;
break
;
default:
case
ONLY_4X4
:
macro_block_yrd_4x4
(
x
,
rate
,
distortion
,
IF_RTCD
(
&
cpi
->
rtcd
),
skippable
);
mbmi
->
txfm_size
=
TX_4X4
;
break
;
}
#endif
/* CONFIG_TX_SELECT */
}
static
void
copy_predictor
(
unsigned
char
*
dst
,
const
unsigned
char
*
predictor
)
{
...
...
@@ -1349,11 +1328,9 @@ static int64_t rd_pick_intra16x16mby_mode(VP8_COMP *cpi,
int64_t
this_rd
;
MACROBLOCKD
*
xd
=
&
x
->
e_mbd
;
#if CONFIG_TX_SELECT
int
i
;
for
(
i
=
0
;
i
<
NB_TXFM_MODES
;
i
++
)
txfm_cache
[
i
]
=
INT64_MAX
;
#endif
// Y Search for 16x16 intra prediction mode
for
(
mode
=
DC_PRED
;
mode
<=
TM_PRED
;
mode
++
)
{
...
...
@@ -1396,7 +1373,6 @@ static int64_t rd_pick_intra16x16mby_mode(VP8_COMP *cpi,
*
skippable
=
skip
;
}
#if CONFIG_TX_SELECT
for
(
i
=
0
;
i
<
NB_TXFM_MODES
;
i
++
)
{
int64_t
adj_rd
=
this_rd
+
local_txfm_cache
[
i
]
-
local_txfm_cache
[
cpi
->
common
.
txfm_mode
];
...
...
@@ -1404,7 +1380,6 @@ static int64_t rd_pick_intra16x16mby_mode(VP8_COMP *cpi,
txfm_cache
[
i
]
=
adj_rd
;
}
}
#endif
#if CONFIG_COMP_INTRA_PRED
}
...
...
@@ -2570,7 +2545,6 @@ static void rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x,
/* 16 = n_blocks */
int_mv
seg_mvs
[
16
][
MAX_REF_FRAMES
-
1
],
int64_t
txfm_cache
[
NB_TXFM_MODES
])
{
#if CONFIG_TX_SELECT
int
i
,
n
,
c
=
vp8_mbsplit_count
[
segmentation
];
if
(
segmentation
==
PARTITIONING_4X4
)
{
...
...
@@ -2658,12 +2632,6 @@ static void rd_check_segment(VP8_COMP *cpi, MACROBLOCK *x,
}
}
}
#else
rd_check_segment_txsize
(
cpi
,
x
,
bsi
,
segmentation
,
(
segmentation
==
PARTITIONING_4X4
||
cpi
->
common
.
txfm_mode
==
ONLY_4X4
)
?
TX_4X4
:
TX_8X8
,
NULL
,
NULL
,
NULL
,
seg_mvs
);
#endif
}
static
__inline
...
...
@@ -3280,9 +3248,7 @@ static void store_coding_context(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
int
hybrid_pred_diff
,
int64_t
txfm_size_diff
[
NB_TXFM_MODES
])
{
MACROBLOCKD
*
xd
=
&
x
->
e_mbd
;
#if CONFIG_TX_SELECT
MB_MODE_INFO
*
mbmi
=
&
xd
->
mode_info_context
->
mbmi
;
#endif
// Take a snapshot of the coding context so it can be
// restored if we decide to encode this way
...
...
@@ -3302,9 +3268,7 @@ static void store_coding_context(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx,
ctx
->
comp_pred_diff
=
comp_pred_diff
;
ctx
->
hybrid_pred_diff
=
hybrid_pred_diff
;
#if CONFIG_TX_SELECT
memcpy
(
ctx
->
txfm_rd_diff
,
txfm_size_diff
,
sizeof
(
ctx
->
txfm_rd_diff
));
#endif
}
static
void
inter_mode_cost
(
VP8_COMP
*
cpi
,
MACROBLOCK
*
x
,
int
this_mode
,
...
...
@@ -3707,11 +3671,9 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
}
break
;
case
I8X8_PRED
:
{
#if CONFIG_TX_SELECT
int
cost0
=
vp8_cost_bit
(
cm
->
prob_tx
[
0
],
0
);
int
cost1
=
vp8_cost_bit
(
cm
->
prob_tx
[
0
],
1
);
int64_t
tmp_rd_4x4s
,
tmp_rd_8x8s
;
#endif
int64_t
tmp_rd_4x4
,
tmp_rd_8x8
,
tmp_rd
;
int
r4x4
,
tok4x4
,
d4x4
,
r8x8
,
tok8x8
,
d8x8
;
mbmi
->
txfm_size
=
TX_4X4
;
...
...
@@ -3733,7 +3695,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
txfm_cache
[
ONLY_4X4
]
=
tmp_rd_4x4
;
txfm_cache
[
ALLOW_8X8
]
=
tmp_rd_8x8
;
txfm_cache
[
ALLOW_16X16
]
=
tmp_rd_8x8
;
#if CONFIG_TX_SELECT
tmp_rd_4x4s
=
tmp_rd_4x4
+
RDCOST
(
x
->
rdmult
,
x
->
rddiv
,
cost0
,
0
);
tmp_rd_8x8s
=
tmp_rd_8x8
+
RDCOST
(
x
->
rdmult
,
x
->
rddiv
,
cost1
,
0
);
txfm_cache
[
TX_MODE_SELECT
]
=
tmp_rd_4x4s
<
tmp_rd_8x8s
?
tmp_rd_4x4s
:
tmp_rd_8x8s
;
...
...
@@ -3762,9 +3723,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
mode8x8
[
1
][
3
]
=
x
->
e_mbd
.
mode_info_context
->
bmi
[
10
].
as_mode
.
second
;
#endif
}
}
else
#endif
if
(
cm
->
txfm_mode
==
ONLY_4X4
)
{
}
else
if
(
cm
->
txfm_mode
==
ONLY_4X4
)
{
rate
=
r4x4
;
rate_y
=
tok4x4
;
distortion
=
d4x4
;
...
...
@@ -4279,11 +4238,9 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
(
cpi
->
oxcf
.
arnr_max_frames
==
0
)
&&
(
best_mbmode
.
mode
!=
ZEROMV
||
best_mbmode
.
ref_frame
!=
ALTREF_FRAME
))
{
mbmi
->
mode
=
ZEROMV
;
#if CONFIG_TX_SELECT
if
(
cm
->
txfm_mode
!=
TX_MODE_SELECT
)
mbmi
->
txfm_size
=
cm
->
txfm_mode
;
else
#endif
mbmi
->
txfm_size
=
TX_16X16
;
mbmi
->
ref_frame
=
ALTREF_FRAME
;
mbmi
->
mv
[
0
].
as_int
=
0
;
...
...
@@ -4333,7 +4290,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
best_pred_diff
[
i
]
=
best_rd
-
best_pred_rd
[
i
];
}
#if CONFIG_TX_SELECT
if
(
!
x
->
skip
)
{
for
(
i
=
0
;
i
<
NB_TXFM_MODES
;
i
++
)
{
if
(
best_txfm_rd
[
i
]
==
INT64_MAX
)
...
...
@@ -4344,7 +4300,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
}
else
{
vpx_memset
(
best_txfm_diff
,
0
,
sizeof
(
best_txfm_diff
));
}
#endif
end:
store_coding_context
(
x
,
&
x
->
mb_context
[
xd
->
mb_index
],
best_mode_index
,
&
best_partition
,
...
...
@@ -4475,10 +4430,8 @@ void vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x,
vp8_cost_bit
(
get_pred_prob
(
cm
,
xd
,
PRED_MBSKIP
),
1
);
dist
=
dist16x16
+
(
distuv8x8
>>
2
);
mbmi
->
txfm_size
=
txfm_size_16x16
;
#if CONFIG_TX_SELECT
memset
(
x
->
mb_context
[
xd
->
mb_index
].
txfm_rd_diff
,
0
,
sizeof
(
x
->
mb_context
[
xd
->
mb_index
].
txfm_rd_diff
));
#endif
}
else
if
(
error8x8
>
error16x16
)
{
if
(
error4x4
<
error16x16
)
{
rate
=
rateuv
;
...
...
@@ -4495,20 +4448,16 @@ void vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x,
mbmi
->
mode
=
B_PRED
;
mbmi
->
txfm_size
=
TX_4X4
;
dist
=
dist4x4
+
(
distuv
>>
2
);
#if CONFIG_TX_SELECT
memset
(
x
->
mb_context
[
xd
->
mb_index
].
txfm_rd_diff
,
0
,
sizeof
(
x
->
mb_context
[
xd
->
mb_index
].
txfm_rd_diff
));
#endif
}
else
{
mbmi
->
txfm_size
=
txfm_size_16x16
;
mbmi
->
mode
=
mode16x16
;
rate
=
rate16x16
+
rateuv8x8
;
dist
=
dist16x16
+
(
distuv8x8
>>
2
);
#if CONFIG_TX_SELECT
for
(
i
=
0
;
i
<
NB_TXFM_MODES
;
i
++
)
{
x
->
mb_context
[
xd
->
mb_index
].
txfm_rd_diff
[
i
]
=
error16x16
-
txfm_cache
[
i
];
}
#endif
}
if
(
cpi
->
common
.
mb_no_coeff_skip
)
rate
+=
vp8_cost_bit
(
get_pred_prob
(
cm
,
xd
,
PRED_MBSKIP
),
0
);
...
...
@@ -4528,10 +4477,8 @@ void vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x,
mbmi
->
mode
=
B_PRED
;
mbmi
->
txfm_size
=
TX_4X4
;
dist
=
dist4x4
+
(
distuv
>>
2
);
#if CONFIG_TX_SELECT
memset
(
x
->
mb_context
[
xd
->
mb_index
].
txfm_rd_diff
,
0
,
sizeof
(
x
->
mb_context
[
xd
->
mb_index
].
txfm_rd_diff
));
#endif
}
else
{
// FIXME(rbultje) support transform-size selection
mbmi
->
mode
=
I8X8_PRED
;
...
...
@@ -4539,10 +4486,8 @@ void vp8_rd_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x,
set_i8x8_block_modes
(
x
,
mode8x8
);
rate
=
rate8x8
+
rateuv
;
dist
=
dist8x8
+
(
distuv
>>
2
);
#if CONFIG_TX_SELECT
memset
(
x
->
mb_context
[
xd
->
mb_index
].
txfm_rd_diff
,
0
,
sizeof
(
x
->
mb_context
[
xd
->
mb_index
].
txfm_rd_diff
));
#endif
}
if
(
cpi
->
common
.
mb_no_coeff_skip
)
rate
+=
vp8_cost_bit
(
get_pred_prob
(
cm
,
xd
,
PRED_MBSKIP
),
0
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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