avcodec/ffv1: Store remap flag per slice

This allows switching it on conditionally and also for non float,
it may improve compression for RGB data that was paletted
or other synthetic images

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2025-01-18 21:51:27 +01:00
parent 4a0c285dfe
commit 9bad2634ee
5 changed files with 16 additions and 4 deletions

View File

@@ -220,6 +220,14 @@ static int decode_slice_header(const FFV1Context *f,
return AVERROR_INVALIDDATA;
}
}
if (f->combined_version >= 0x40004) {
sc->remap = ff_ffv1_get_symbol(c, state, 0);
if (sc->remap > 1U ||
sc->remap == 1 && !f->flt) {
av_log(f->avctx, AV_LOG_ERROR, "unsupported remap %d\n", sc->remap);
return AVERROR_INVALIDDATA;
}
}
}
return 0;