summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1enc.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2016-06-25 14:37:59 +0200
committerLuca Barbato <lu_zero@gentoo.org>2016-06-29 07:21:07 +0200
commitfe6e5cbea7dbd5d2c67d79b5570e26debb70e95b (patch)
tree394e13c894f1743c736916da912d25861db00f49 /libavcodec/ffv1enc.c
parent7c55fac7dfa8bad9644dea5d03309da30be69563 (diff)
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).
Diffstat (limited to 'libavcodec/ffv1enc.c')
-rw-r--r--libavcodec/ffv1enc.c72
1 files changed, 35 insertions, 37 deletions
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 7995376ca0..3bc22ed1e5 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -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;
- 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;
+ 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 = 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++)