avcodec/ffv1: RCT is only possible with RGB

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-10-03 01:49:09 +02:00
parent 31b5b3badc
commit 2542e9296c
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
2 changed files with 3 additions and 3 deletions

View File

@ -241,7 +241,7 @@ static int decode_slice_header(const FFV1Context *f,
if (f->version > 3) {
sc->slice_reset_contexts = get_rac(c, state);
sc->slice_coding_mode = get_symbol(c, state, 0);
if (sc->slice_coding_mode != 1) {
if (sc->slice_coding_mode != 1 && f->colorspace == 1) {
sc->slice_rct_by_coef = get_symbol(c, state, 0);
sc->slice_rct_ry_coef = get_symbol(c, state, 0);
if ((uint64_t)sc->slice_rct_by_coef + (uint64_t)sc->slice_rct_ry_coef > 4) {

View File

@ -954,7 +954,7 @@ static void encode_slice_header(FFV1Context *f, FFV1SliceContext *sc)
if (sc->slice_coding_mode == 1)
ff_ffv1_clear_slice_state(f, sc);
put_symbol(c, state, sc->slice_coding_mode, 0);
if (sc->slice_coding_mode != 1) {
if (sc->slice_coding_mode != 1 && f->colorspace == 1) {
put_symbol(c, state, sc->slice_rct_by_coef, 0);
put_symbol(c, state, sc->slice_rct_ry_coef, 0);
}
@ -1070,7 +1070,7 @@ static int encode_slice(AVCodecContext *c, void *arg)
p->data[3] ? p->data[3] + ps*x + y*p->linesize[3] : NULL};
sc->slice_coding_mode = 0;
if (f->version > 3) {
if (f->version > 3 && f->colorspace == 1) {
choose_rct_params(f, sc, planes, p->linesize, width, height);
} else {
sc->slice_rct_by_coef = 1;