Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
libvpx
Commits
2855d8ae
Commit
2855d8ae
authored
Jul 23, 2013
by
Dmitry Kovalev
Committed by
Gerrit Code Review
Jul 23, 2013
Browse files
Merge "Adding update_tx_counts function."
parents
0d59d6ef
b2fc6fa9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
44 deletions
+46
-44
vp9/common/vp9_pred_common.h
vp9/common/vp9_pred_common.h
+24
-9
vp9/decoder/vp9_decodemv.c
vp9/decoder/vp9_decodemv.c
+17
-23
vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_bitstream.c
+1
-2
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_encodeframe.c
+2
-8
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_rdopt.c
+2
-2
No files found.
vp9/common/vp9_pred_common.h
View file @
2855d8ae
...
...
@@ -108,16 +108,31 @@ static INLINE vp9_prob vp9_get_pred_prob_single_ref_p2(const VP9_COMMON *cm,
unsigned
char
vp9_get_pred_context_tx_size
(
const
MACROBLOCKD
*
xd
);
static
const
vp9_prob
*
vp9_get_pred_probs_tx_size
(
const
MACROBLOCKD
*
xd
,
const
struct
tx_probs
*
tx_probs
)
{
const
MODE_INFO
*
const
mi
=
xd
->
mode_info_context
;
const
int
pred_context
=
vp9_get_pred_context_tx_size
(
xd
);
if
(
mi
->
mbmi
.
sb_type
<
BLOCK_SIZE_MB16X16
)
return
tx_probs
->
p8x8
[
pred_context
];
else
if
(
mi
->
mbmi
.
sb_type
<
BLOCK_SIZE_SB32X32
)
return
tx_probs
->
p16x16
[
pred_context
];
static
const
vp9_prob
*
get_tx_probs
(
BLOCK_SIZE_TYPE
bsize
,
uint8_t
context
,
const
struct
tx_probs
*
tx_probs
)
{
if
(
bsize
<
BLOCK_SIZE_MB16X16
)
return
tx_probs
->
p8x8
[
context
];
else
if
(
bsize
<
BLOCK_SIZE_SB32X32
)
return
tx_probs
->
p16x16
[
context
];
else
return
tx_probs
->
p32x32
[
context
];
}
static
const
vp9_prob
*
get_tx_probs2
(
const
MACROBLOCKD
*
xd
,
const
struct
tx_probs
*
tx_probs
)
{
const
BLOCK_SIZE_TYPE
bsize
=
xd
->
mode_info_context
->
mbmi
.
sb_type
;
const
int
context
=
vp9_get_pred_context_tx_size
(
xd
);
return
get_tx_probs
(
bsize
,
context
,
tx_probs
);
}
static
void
update_tx_counts
(
BLOCK_SIZE_TYPE
bsize
,
uint8_t
context
,
TX_SIZE
tx_size
,
struct
tx_counts
*
tx_counts
)
{
if
(
bsize
>=
BLOCK_SIZE_SB32X32
)
tx_counts
->
p32x32
[
context
][
tx_size
]
++
;
else
if
(
bsize
>=
BLOCK_SIZE_MB16X16
)
tx_counts
->
p16x16
[
context
][
tx_size
]
++
;
else
return
tx_probs
->
p32x32
[
pred_context
]
;
tx_counts
->
p8x8
[
context
][
tx_size
]
++
;
}
#endif // VP9_COMMON_VP9_PRED_COMMON_H_
vp9/decoder/vp9_decodemv.c
View file @
2855d8ae
...
...
@@ -38,35 +38,29 @@ static int read_segment_id(vp9_reader *r, const struct segmentation *seg) {
return
treed_read
(
r
,
vp9_segment_tree
,
seg
->
tree_probs
);
}
static
TX_SIZE
read_selected_tx
fm
_size
(
VP9_COMMON
*
cm
,
MACROBLOCKD
*
xd
,
BLOCK_SIZE_TYPE
bsize
,
vp9_reader
*
r
)
{
const
int
context
=
vp9_get_pred_context_tx_size
(
xd
);
const
vp9_prob
*
tx_probs
=
vp9_get_pred_probs_tx_size
(
xd
,
&
cm
->
fc
.
tx_probs
);
TX_SIZE
tx
fm
_size
=
vp9_read
(
r
,
tx_probs
[
0
]);
if
(
tx
fm
_size
!=
TX_4X4
&&
bsize
>=
BLOCK_SIZE_MB16X16
)
{
tx
fm
_size
+=
vp9_read
(
r
,
tx_probs
[
1
]);
if
(
tx
fm
_size
!=
TX_8X8
&&
bsize
>=
BLOCK_SIZE_SB32X32
)
tx
fm
_size
+=
vp9_read
(
r
,
tx_probs
[
2
]);
static
TX_SIZE
read_selected_tx_size
(
VP9_COMMON
*
cm
,
MACROBLOCKD
*
xd
,
BLOCK_SIZE_TYPE
bsize
,
vp9_reader
*
r
)
{
const
u
int
8_t
context
=
vp9_get_pred_context_tx_size
(
xd
);
const
vp9_prob
*
tx_probs
=
get_tx_probs
(
bsize
,
context
,
&
cm
->
fc
.
tx_probs
);
TX_SIZE
tx_size
=
vp9_read
(
r
,
tx_probs
[
0
]);
if
(
tx_size
!=
TX_4X4
&&
bsize
>=
BLOCK_SIZE_MB16X16
)
{
tx_size
+=
vp9_read
(
r
,
tx_probs
[
1
]);
if
(
tx_size
!=
TX_8X8
&&
bsize
>=
BLOCK_SIZE_SB32X32
)
tx_size
+=
vp9_read
(
r
,
tx_probs
[
2
]);
}
if
(
bsize
>=
BLOCK_SIZE_SB32X32
)
cm
->
fc
.
tx_counts
.
p32x32
[
context
][
txfm_size
]
++
;
else
if
(
bsize
>=
BLOCK_SIZE_MB16X16
)
cm
->
fc
.
tx_counts
.
p16x16
[
context
][
txfm_size
]
++
;
else
cm
->
fc
.
tx_counts
.
p8x8
[
context
][
txfm_size
]
++
;
return
txfm_size
;
update_tx_counts
(
bsize
,
context
,
tx_size
,
&
cm
->
fc
.
tx_counts
);
return
tx_size
;
}
static
TX_SIZE
read_tx
fm
_size
(
VP9D_COMP
*
pbi
,
TX_MODE
tx_mode
,
BLOCK_SIZE_TYPE
bsize
,
int
select_cond
,
vp9_reader
*
r
)
{
static
TX_SIZE
read_tx_size
(
VP9D_COMP
*
pbi
,
TX_MODE
tx_mode
,
BLOCK_SIZE_TYPE
bsize
,
int
select_cond
,
vp9_reader
*
r
)
{
VP9_COMMON
*
const
cm
=
&
pbi
->
common
;
MACROBLOCKD
*
const
xd
=
&
pbi
->
mb
;
if
(
tx_mode
==
TX_MODE_SELECT
&&
bsize
>=
BLOCK_SIZE_SB8X8
&&
select_cond
)
return
read_selected_tx
fm
_size
(
cm
,
xd
,
bsize
,
r
);
return
read_selected_tx_size
(
cm
,
xd
,
bsize
,
r
);
else
if
(
tx_mode
>=
ALLOW_32X32
&&
bsize
>=
BLOCK_SIZE_SB32X32
)
return
TX_32X32
;
else
if
(
tx_mode
>=
ALLOW_16X16
&&
bsize
>=
BLOCK_SIZE_MB16X16
)
...
...
@@ -162,7 +156,7 @@ static void read_intra_mode_info(VP9D_COMP *pbi, MODE_INFO *m,
mbmi
->
segment_id
=
read_intra_segment_id
(
pbi
,
mi_row
,
mi_col
,
r
);
mbmi
->
mb_skip_coeff
=
read_skip_coeff
(
pbi
,
mbmi
->
segment_id
,
r
);
mbmi
->
txfm_size
=
read_tx
fm
_size
(
pbi
,
cm
->
tx_mode
,
bsize
,
1
,
r
);
mbmi
->
txfm_size
=
read_tx_size
(
pbi
,
cm
->
tx_mode
,
bsize
,
1
,
r
);
mbmi
->
ref_frame
[
0
]
=
INTRA_FRAME
;
if
(
bsize
>=
BLOCK_SIZE_SB8X8
)
{
...
...
@@ -463,7 +457,7 @@ static void read_inter_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
mbmi
->
mb_skip_coeff
=
read_skip_coeff
(
pbi
,
mbmi
->
segment_id
,
r
);
mbmi
->
ref_frame
[
0
]
=
read_reference_frame
(
pbi
,
mbmi
->
segment_id
,
r
);
mbmi
->
ref_frame
[
1
]
=
NONE
;
mbmi
->
txfm_size
=
read_tx
fm
_size
(
pbi
,
cm
->
tx_mode
,
bsize
,
mbmi
->
txfm_size
=
read_tx_size
(
pbi
,
cm
->
tx_mode
,
bsize
,
(
!
mbmi
->
mb_skip_coeff
||
mbmi
->
ref_frame
[
0
]
==
INTRA_FRAME
),
r
);
if
(
mbmi
->
ref_frame
[
0
]
!=
INTRA_FRAME
)
{
...
...
vp9/encoder/vp9_bitstream.c
View file @
2855d8ae
...
...
@@ -202,9 +202,8 @@ static void update_mbintra_mode_probs(VP9_COMP* const cpi,
static
void
write_selected_txfm_size
(
const
VP9_COMP
*
cpi
,
TX_SIZE
tx_size
,
BLOCK_SIZE_TYPE
bsize
,
vp9_writer
*
w
)
{
const
VP9_COMMON
*
const
cm
=
&
cpi
->
common
;
const
MACROBLOCKD
*
const
xd
=
&
cpi
->
mb
.
e_mbd
;
const
vp9_prob
*
tx_probs
=
vp9_get_pred_probs_tx_size
(
xd
,
&
cm
->
fc
.
tx_probs
);
const
vp9_prob
*
tx_probs
=
get_tx_probs2
(
xd
,
&
cpi
->
common
.
fc
.
tx_probs
);
vp9_write
(
w
,
tx_size
!=
TX_4X4
,
tx_probs
[
0
]);
if
(
bsize
>=
BLOCK_SIZE_MB16X16
&&
tx_size
!=
TX_4X4
)
{
vp9_write
(
w
,
tx_size
!=
TX_8X8
,
tx_probs
[
1
]);
...
...
vp9/encoder/vp9_encodeframe.c
View file @
2855d8ae
...
...
@@ -2613,14 +2613,8 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
!
(
mbmi
->
ref_frame
[
0
]
!=
INTRA_FRAME
&&
(
mbmi
->
mb_skip_coeff
||
vp9_segfeature_active
(
&
xd
->
seg
,
segment_id
,
SEG_LVL_SKIP
))))
{
const
int
context
=
vp9_get_pred_context_tx_size
(
xd
);
if
(
bsize
>=
BLOCK_SIZE_SB32X32
)
{
cm
->
fc
.
tx_counts
.
p32x32
[
context
][
mbmi
->
txfm_size
]
++
;
}
else
if
(
bsize
>=
BLOCK_SIZE_MB16X16
)
{
cm
->
fc
.
tx_counts
.
p16x16
[
context
][
mbmi
->
txfm_size
]
++
;
}
else
{
cm
->
fc
.
tx_counts
.
p8x8
[
context
][
mbmi
->
txfm_size
]
++
;
}
const
uint8_t
context
=
vp9_get_pred_context_tx_size
(
xd
);
update_tx_counts
(
bsize
,
context
,
mbmi
->
txfm_size
,
&
cm
->
fc
.
tx_counts
);
}
else
{
int
x
,
y
;
TX_SIZE
sz
=
(
cm
->
tx_mode
==
TX_MODE_SELECT
)
?
TX_32X32
:
cm
->
tx_mode
;
...
...
vp9/encoder/vp9_rdopt.c
View file @
2855d8ae
...
...
@@ -861,7 +861,7 @@ static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x,
int
n
,
m
;
int
s0
,
s1
;
const
vp9_prob
*
tx_probs
=
vp9_get_pred_probs_tx_size
(
xd
,
&
cm
->
fc
.
tx_probs
);
const
vp9_prob
*
tx_probs
=
get_tx_probs2
(
xd
,
&
cm
->
fc
.
tx_probs
);
for
(
n
=
TX_4X4
;
n
<=
max_txfm_size
;
n
++
)
{
r
[
n
][
1
]
=
r
[
n
][
0
];
...
...
@@ -968,7 +968,7 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x,
double
scale_rd
[
TX_SIZE_MAX_SB
]
=
{
1
.
73
,
1
.
44
,
1
.
20
,
1
.
00
};
// double scale_r[TX_SIZE_MAX_SB] = {2.82, 2.00, 1.41, 1.00};
const
vp9_prob
*
tx_probs
=
vp9_get_pred_probs_tx_size
(
xd
,
&
cm
->
fc
.
tx_probs
);
const
vp9_prob
*
tx_probs
=
get_tx_probs2
(
xd
,
&
cm
->
fc
.
tx_probs
);
// for (n = TX_4X4; n <= max_txfm_size; n++)
// r[n][0] = (r[n][0] * scale_r[n]);
...
...
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