Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
bfcef95c
Commit
bfcef95c
authored
11 years ago
by
Dmitry Kovalev
Browse files
Options
Download
Patches
Plain Diff
Adding update_tx_ct function, removing duplicated code.
Change-Id: I8882fe3cd247a5a8304ab8ab2ee9abdb92830133
parent
2ce6b234
v1.14.0-linphone
1.4.X
experimental
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
forest
frame_parallel
highbitdepth
indianrunnerduck
javanwhistlingduck
khakicampbell
linphone
linphone-android
linphone-old
longtailedduck
m31-baseline
m49-2623
m52-2743
m54-2840
m56-2924
m66-3359
m68-3440
mandarinduck
mcw
mcw2
nextgen
nextgenv2
pcs-2013
playground
sandbox/Jingning/experimental
sandbox/Jingning/transcode
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/debargha/playground
sandbox/hkuang/frame_parallel
sandbox/hkuang@google.com/decode
sandbox/jimbankoski@google.com/proposed-aom
sandbox/jingning@google.com/decoder_test_suite
sandbox/jingning@google.com/experimental
sandbox/jzern@google.com/test
sandbox/wangch@google.com/vp9
sandbox/yaowu@google.com/mergeaom
stable-vp9-decoder
v1.12.0-linphone
v1.6.1_linphone
v1.7.0-linphone
v1.9.0-linphone
v1.9.0
v1.9.0-rc1
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.0
v1.3.0
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vp9/common/vp9_entropymode.c
+32
-49
vp9/common/vp9_entropymode.c
with
32 additions
and
49 deletions
vp9/common/vp9_entropymode.c
+
32
−
49
View file @
bfcef95c
...
@@ -304,14 +304,24 @@ void vp9_adapt_mode_context(VP9_COMMON *pc) {
...
@@ -304,14 +304,24 @@ void vp9_adapt_mode_context(VP9_COMMON *pc) {
#define MODE_COUNT_SAT 20
#define MODE_COUNT_SAT 20
#define MODE_MAX_UPDATE_FACTOR 128
#define MODE_MAX_UPDATE_FACTOR 128
static
int
update_mode_ct
(
vp9_prob
pre_prob
,
vp9_prob
prob
,
static
int
update_mode_ct
(
vp9_prob
pre_prob
,
vp9_prob
prob
,
unsigned
int
branch_ct
[
2
])
{
unsigned
int
ct
[
2
])
{
int
factor
,
count
=
branch_ct
[
0
]
+
branch_ct
[
1
];
const
int
count
=
MIN
(
ct
[
0
]
+
ct
[
1
],
MODE_COUNT_SAT
);
count
=
count
>
MODE_COUNT_SAT
?
MODE_COUNT_SAT
:
count
;
const
int
factor
=
MODE_MAX_UPDATE_FACTOR
*
count
/
MODE_COUNT_SAT
;
factor
=
(
MODE_MAX_UPDATE_FACTOR
*
count
/
MODE_COUNT_SAT
);
return
weighted_prob
(
pre_prob
,
prob
,
factor
);
return
weighted_prob
(
pre_prob
,
prob
,
factor
);
}
}
static
int
update_mode_ct2
(
vp9_prob
pre_prob
,
unsigned
int
ct
[
2
])
{
return
update_mode_ct
(
pre_prob
,
get_binary_prob
(
ct
[
0
],
ct
[
1
]),
ct
);
}
static
vp9_prob
update_tx_ct
(
vp9_prob
prob
,
unsigned
int
ct
[
2
])
{
const
int
count
=
MIN
(
ct
[
0
]
+
ct
[
1
],
MODE_COUNT_SAT
);
const
int
factor
=
count
*
MODE_MAX_UPDATE_FACTOR
/
MODE_COUNT_SAT
;
return
weighted_prob
(
prob
,
get_binary_prob
(
ct
[
0
],
ct
[
1
]),
factor
);
}
static
void
update_mode_probs
(
int
n_modes
,
static
void
update_mode_probs
(
int
n_modes
,
const
vp9_tree_index
*
tree
,
unsigned
int
*
cnt
,
const
vp9_tree_index
*
tree
,
unsigned
int
*
cnt
,
vp9_prob
*
pre_probs
,
vp9_prob
*
dst_probs
,
vp9_prob
*
pre_probs
,
vp9_prob
*
dst_probs
,
...
@@ -327,11 +337,6 @@ static void update_mode_probs(int n_modes,
...
@@ -327,11 +337,6 @@ static void update_mode_probs(int n_modes,
dst_probs
[
t
]
=
update_mode_ct
(
pre_probs
[
t
],
probs
[
t
],
branch_ct
[
t
]);
dst_probs
[
t
]
=
update_mode_ct
(
pre_probs
[
t
],
probs
[
t
],
branch_ct
[
t
]);
}
}
static
int
update_mode_ct2
(
vp9_prob
pre_prob
,
unsigned
int
branch_ct
[
2
])
{
return
update_mode_ct
(
pre_prob
,
get_binary_prob
(
branch_ct
[
0
],
branch_ct
[
1
]),
branch_ct
);
}
// #define MODE_COUNT_TESTING
// #define MODE_COUNT_TESTING
void
vp9_adapt_mode_probs
(
VP9_COMMON
*
cm
)
{
void
vp9_adapt_mode_probs
(
VP9_COMMON
*
cm
)
{
int
i
,
j
;
int
i
,
j
;
...
@@ -400,61 +405,39 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
...
@@ -400,61 +405,39 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
fc
->
partition_prob
[
INTER_FRAME
][
i
],
0
);
fc
->
partition_prob
[
INTER_FRAME
][
i
],
0
);
if
(
cm
->
mcomp_filter_type
==
SWITCHABLE
)
{
if
(
cm
->
mcomp_filter_type
==
SWITCHABLE
)
{
for
(
i
=
0
;
i
<=
VP9_SWITCHABLE_FILTERS
;
i
++
)
{
for
(
i
=
0
;
i
<=
VP9_SWITCHABLE_FILTERS
;
i
++
)
update_mode_probs
(
VP9_SWITCHABLE_FILTERS
,
vp9_switchable_interp_tree
,
update_mode_probs
(
VP9_SWITCHABLE_FILTERS
,
vp9_switchable_interp_tree
,
fc
->
switchable_interp_count
[
i
],
fc
->
switchable_interp_count
[
i
],
fc
->
pre_switchable_interp_prob
[
i
],
fc
->
pre_switchable_interp_prob
[
i
],
fc
->
switchable_interp_prob
[
i
],
0
);
fc
->
switchable_interp_prob
[
i
],
0
);
}
}
}
if
(
cm
->
txfm_mode
==
TX_MODE_SELECT
)
{
if
(
cm
->
txfm_mode
==
TX_MODE_SELECT
)
{
int
j
;
int
j
;
unsigned
int
branch_ct_8x8p
[
TX_SIZE_MAX_SB
-
3
][
2
];
unsigned
int
branch_ct_8x8p
[
TX_SIZE_MAX_SB
-
3
][
2
];
unsigned
int
branch_ct_16x16p
[
TX_SIZE_MAX_SB
-
2
][
2
];
unsigned
int
branch_ct_16x16p
[
TX_SIZE_MAX_SB
-
2
][
2
];
unsigned
int
branch_ct_32x32p
[
TX_SIZE_MAX_SB
-
1
][
2
];
unsigned
int
branch_ct_32x32p
[
TX_SIZE_MAX_SB
-
1
][
2
];
for
(
i
=
0
;
i
<
TX_SIZE_CONTEXTS
;
++
i
)
{
for
(
i
=
0
;
i
<
TX_SIZE_CONTEXTS
;
++
i
)
{
tx_counts_to_branch_counts_8x8
(
cm
->
fc
.
tx_count_8x8p
[
i
],
tx_counts_to_branch_counts_8x8
(
fc
->
tx_count_8x8p
[
i
],
branch_ct_8x8p
);
branch_ct_8x8p
);
for
(
j
=
0
;
j
<
TX_SIZE_MAX_SB
-
3
;
++
j
)
for
(
j
=
0
;
j
<
TX_SIZE_MAX_SB
-
3
;
++
j
)
{
fc
->
tx_probs_8x8p
[
i
][
j
]
=
update_tx_ct
(
fc
->
pre_tx_probs_8x8p
[
i
][
j
],
int
factor
;
branch_ct_8x8p
[
j
]);
int
count
=
branch_ct_8x8p
[
j
][
0
]
+
branch_ct_8x8p
[
j
][
1
];
vp9_prob
prob
=
get_binary_prob
(
branch_ct_8x8p
[
j
][
0
],
tx_counts_to_branch_counts_16x16
(
fc
->
tx_count_16x16p
[
i
],
branch_ct_8x8p
[
j
][
1
]);
count
=
count
>
MODE_COUNT_SAT
?
MODE_COUNT_SAT
:
count
;
factor
=
(
MODE_MAX_UPDATE_FACTOR
*
count
/
MODE_COUNT_SAT
);
cm
->
fc
.
tx_probs_8x8p
[
i
][
j
]
=
weighted_prob
(
cm
->
fc
.
pre_tx_probs_8x8p
[
i
][
j
],
prob
,
factor
);
}
}
for
(
i
=
0
;
i
<
TX_SIZE_CONTEXTS
;
++
i
)
{
tx_counts_to_branch_counts_16x16
(
cm
->
fc
.
tx_count_16x16p
[
i
],
branch_ct_16x16p
);
branch_ct_16x16p
);
for
(
j
=
0
;
j
<
TX_SIZE_MAX_SB
-
2
;
++
j
)
{
for
(
j
=
0
;
j
<
TX_SIZE_MAX_SB
-
2
;
++
j
)
int
factor
;
fc
->
tx_probs_16x16p
[
i
][
j
]
=
update_tx_ct
(
fc
->
pre_tx_probs_16x16p
[
i
][
j
],
int
count
=
branch_ct_16x16p
[
j
][
0
]
+
branch_ct_16x16p
[
j
][
1
];
branch_ct_16x16p
[
j
]);
vp9_prob
prob
=
get_binary_prob
(
branch_ct_16x16p
[
j
][
0
],
branch_ct_16x16p
[
j
][
1
]);
tx_counts_to_branch_counts_32x32
(
fc
->
tx_count_32x32p
[
i
],
count
=
count
>
MODE_COUNT_SAT
?
MODE_COUNT_SAT
:
count
;
factor
=
(
MODE_MAX_UPDATE_FACTOR
*
count
/
MODE_COUNT_SAT
);
cm
->
fc
.
tx_probs_16x16p
[
i
][
j
]
=
weighted_prob
(
cm
->
fc
.
pre_tx_probs_16x16p
[
i
][
j
],
prob
,
factor
);
}
}
for
(
i
=
0
;
i
<
TX_SIZE_CONTEXTS
;
++
i
)
{
tx_counts_to_branch_counts_32x32
(
cm
->
fc
.
tx_count_32x32p
[
i
],
branch_ct_32x32p
);
branch_ct_32x32p
);
for
(
j
=
0
;
j
<
TX_SIZE_MAX_SB
-
1
;
++
j
)
{
for
(
j
=
0
;
j
<
TX_SIZE_MAX_SB
-
1
;
++
j
)
int
factor
;
fc
->
tx_probs_32x32p
[
i
][
j
]
=
update_tx_ct
(
fc
->
pre_tx_probs_32x32p
[
i
][
j
],
int
count
=
branch_ct_32x32p
[
j
][
0
]
+
branch_ct_32x32p
[
j
][
1
];
branch_ct_32x32p
[
j
]);
vp9_prob
prob
=
get_binary_prob
(
branch_ct_32x32p
[
j
][
0
],
branch_ct_32x32p
[
j
][
1
]);
count
=
count
>
MODE_COUNT_SAT
?
MODE_COUNT_SAT
:
count
;
factor
=
(
MODE_MAX_UPDATE_FACTOR
*
count
/
MODE_COUNT_SAT
);
cm
->
fc
.
tx_probs_32x32p
[
i
][
j
]
=
weighted_prob
(
cm
->
fc
.
pre_tx_probs_32x32p
[
i
][
j
],
prob
,
factor
);
}
}
}
}
}
for
(
i
=
0
;
i
<
MBSKIP_CONTEXTS
;
++
i
)
for
(
i
=
0
;
i
<
MBSKIP_CONTEXTS
;
++
i
)
fc
->
mbskip_probs
[
i
]
=
update_mode_ct2
(
fc
->
pre_mbskip_probs
[
i
],
fc
->
mbskip_probs
[
i
]
=
update_mode_ct2
(
fc
->
pre_mbskip_probs
[
i
],
fc
->
mbskip_count
[
i
]);
fc
->
mbskip_count
[
i
]);
...
...
This diff is collapsed.
Click to expand it.
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!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets