aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ffv1enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-12-19 20:06:58 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-12-19 20:42:54 +0100
commit2d2b41d1699646e824418fea6e6cb2a842654875 (patch)
treec28cb224ac48f4abb2af3f8de6a4d89f2f0ebad0 /libavcodec/ffv1enc.c
parentebe1ca01d15372b53e06b919845c480c105fdebc (diff)
downloadffmpeg-2d2b41d1699646e824418fea6e6cb2a842654875.tar.gz
avcodec/ffv1enc: Fix 2 pass mode with the default rc table
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/ffv1enc.c')
-rw-r--r--libavcodec/ffv1enc.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index e4d5ac6708..3830bd46f8 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -155,6 +155,10 @@ static void find_best_state(uint8_t best_state[256][256],
double occ[256] = { 0 };
double len = 0;
occ[j] = 1.0;
+
+ if (!one_state[j])
+ continue;
+
for (k = 0; k < 256; k++) {
double newocc[256] = { 0 };
for (m = 1; m < 256; m++)
@@ -821,9 +825,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
return AVERROR(EINVAL);
}
- if (s->ac == AC_RANGE_CUSTOM_TAB)
+ if (s->ac == AC_RANGE_CUSTOM_TAB) {
for (i = 1; i < 256; i++)
s->state_transition[i] = ver2_state[i];
+ } else {
+ RangeCoder c;
+ ff_build_rac_states(&c, 0.05 * (1LL << 32), 256 - 8);
+ for (i = 1; i < 256; i++)
+ s->state_transition[i] = c.one_state[i];
+ }
for (i = 0; i < 256; i++) {
s->quant_table_count = 2;
@@ -934,7 +944,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (p[0] == 0)
break;
}
- sort_stt(s, s->state_transition);
+ if (s->ac == AC_RANGE_CUSTOM_TAB)
+ sort_stt(s, s->state_transition);
find_best_state(best_state, s->state_transition);