ffv1: Remove version 2 and mark version 3 as non-experimental

The encoder produces bitstream compatible with the current specification
and version 2 is set as reserved (non-standardizable).
This commit is contained in:
Luca Barbato 2016-06-25 14:37:59 +02:00
parent 7c55fac7df
commit fe6e5cbea7
4 changed files with 59 additions and 61 deletions

View File

@ -380,7 +380,7 @@ static void write_quant_tables(RangeCoder *c,
static void write_header(FFV1Context *f)
{
uint8_t state[CONTEXT_SIZE];
int i, j;
int i;
RangeCoder *const c = &f->slice_context[0]->c;
memset(state, 128, sizeof(state));
@ -402,25 +402,6 @@ static void write_header(FFV1Context *f)
put_rac(c, state, f->transparency);
write_quant_tables(c, f->quant_table);
} else if (f->version < 3) {
put_symbol(c, state, f->slice_count, 0);
for (i = 0; i < f->slice_count; i++) {
FFV1Context *fs = f->slice_context[i];
put_symbol(c, state,
(fs->slice_x + 1) * f->num_h_slices / f->width, 0);
put_symbol(c, state,
(fs->slice_y + 1) * f->num_v_slices / f->height, 0);
put_symbol(c, state,
(fs->slice_width + 1) * f->num_h_slices / f->width - 1,
0);
put_symbol(c, state,
(fs->slice_height + 1) * f->num_v_slices / f->height - 1,
0);
for (j = 0; j < f->plane_count; j++) {
put_symbol(c, state, f->plane[j].quant_table_index, 0);
av_assert0(f->plane[j].quant_table_index == f->context_model);
}
}
}
}
@ -442,7 +423,7 @@ static int write_extradata(FFV1Context *f)
ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
put_symbol(c, state, f->version, 0);
if (f->version > 2) {
if (f->version > 1) {
if (f->version == 3)
f->minor_version = 2;
put_symbol(c, state, f->minor_version, 0);
@ -566,27 +547,44 @@ static av_cold int ffv1_encode_init(AVCodecContext *avctx)
s->version = 0;
switch (avctx->level) {
case 3:
break;
case 2:
av_log(avctx, AV_LOG_ERROR,
"Version 2 had been deemed non-standard and deprecated "
"the support for it had been removed\n");
return AVERROR(ENOSYS);
case 1:
case 0:
if (avctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) {
av_log(avctx, AV_LOG_ERROR,
"Multiple pass encoding requires version 3.\n");
return AVERROR(ENOSYS);
}
if (avctx->slices > 1) {
av_log(avctx, AV_LOG_ERROR,
"Multiple slices support requires version 3.\n");
return AVERROR(ENOSYS);
}
break;
case FF_LEVEL_UNKNOWN:
if ((avctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) ||
avctx->slices > 1)
s->version = FFMAX(s->version, 2);
if (avctx->level == 3) {
s->version = 3;
else
s->version = 0;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Version %d not supported\n",
avctx->level);
return AVERROR(ENOSYS);
}
if (s->ec < 0) {
s->ec = (s->version >= 3);
}
if (s->version >= 2 &&
avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
av_log(avctx, AV_LOG_ERROR,
"Version %d requested, please set -strict experimental in "
"order to enable it\n",
s->version);
return AVERROR(ENOSYS);
}
#if FF_API_CODER_TYPE
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->coder_type != -1)
@ -754,7 +752,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
int gob_count = 0;
char *next;
av_assert0(s->version >= 2);
av_assert0(s->version > 2);
for (;; ) {
for (j = 0; j < 256; j++)

View File

@ -1,46 +1,46 @@
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71768
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5690 size: 71796
ret: 0 st:-1 flags:0 ts:-1.000000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71768
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5690 size: 71796
ret: 0 st:-1 flags:1 ts: 1.894167
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2589296 size: 81788
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2590398 size: 81816
ret: 0 st: 0 flags:0 ts: 0.800000
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1666112 size: 77204
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1666848 size: 77232
ret:-1 st: 0 flags:1 ts:-0.320000
ret:-1 st:-1 flags:0 ts: 2.576668
ret: 0 st:-1 flags:1 ts: 1.470835
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2589296 size: 81788
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2590398 size: 81816
ret: 0 st: 0 flags:0 ts: 0.360000
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 808352 size: 70696
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 808720 size: 70724
ret:-1 st: 0 flags:1 ts:-0.760000
ret:-1 st:-1 flags:0 ts: 2.153336
ret: 0 st:-1 flags:1 ts: 1.047503
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1666112 size: 77204
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1666848 size: 77232
ret: 0 st: 0 flags:0 ts:-0.040000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71768
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5690 size: 71796
ret: 0 st: 0 flags:1 ts: 2.840000
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3550788 size: 83738
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3552258 size: 83766
ret: 0 st:-1 flags:0 ts: 1.730004
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3550788 size: 83738
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3552258 size: 83766
ret: 0 st:-1 flags:1 ts: 0.624171
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 808352 size: 70696
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 808720 size: 70724
ret: 0 st: 0 flags:0 ts:-0.480000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71768
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5690 size: 71796
ret: 0 st: 0 flags:1 ts: 2.400000
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3550788 size: 83738
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3552258 size: 83766
ret: 0 st:-1 flags:0 ts: 1.306672
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2589296 size: 81788
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2590398 size: 81816
ret: 0 st:-1 flags:1 ts: 0.200839
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71768
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5690 size: 71796
ret: 0 st: 0 flags:0 ts:-0.920000
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5688 size: 71768
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 5690 size: 71796
ret: 0 st: 0 flags:1 ts: 2.000000
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3550788 size: 83738
ret: 0 st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos:3552258 size: 83766
ret: 0 st:-1 flags:0 ts: 0.883340
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1666112 size: 77204
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos:1666848 size: 77232
ret:-1 st:-1 flags:1 ts:-0.222493
ret:-1 st: 0 flags:0 ts: 2.680000
ret: 0 st: 0 flags:1 ts: 1.560000
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2589296 size: 81788
ret: 0 st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos:2590398 size: 81816
ret: 0 st:-1 flags:0 ts: 0.460008
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 808352 size: 70696
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 808720 size: 70724
ret:-1 st:-1 flags:1 ts:-0.645825

View File

@ -1,4 +1,4 @@
d236e8441d7e04e24d882bb97faccd36 *tests/data/fate/vsynth1-ffv1.avi
2689718 tests/data/fate/vsynth1-ffv1.avi
a6703280a623fe42de7f7a53c2383073 *tests/data/fate/vsynth1-ffv1.avi
2691264 tests/data/fate/vsynth1-ffv1.avi
c5ccac874dbf808e9088bc3107860042 *tests/data/fate/vsynth1-ffv1.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200

View File

@ -1,4 +1,4 @@
4af788aeb692573717fe205f3ba20a33 *tests/data/fate/vsynth2-ffv1.avi
3716494 tests/data/fate/vsynth2-ffv1.avi
2acd1edd97eb98895bae47770b700f89 *tests/data/fate/vsynth2-ffv1.avi
3718022 tests/data/fate/vsynth2-ffv1.avi
36d7ca943916e1743cefa609eba0205c *tests/data/fate/vsynth2-ffv1.out.rawvideo
stddev: 0.00 PSNR:999.99 MAXDIFF: 0 bytes: 7603200/ 7603200