1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

avcodec: set AV_FRAME_FLAG_LOSSLESS where supported

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint 2024-12-08 20:56:23 +01:00
parent 2d91f89445
commit 74e04b8921
4 changed files with 11 additions and 0 deletions

View File

@ -2891,6 +2891,10 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture,
}
}
for (int x = 0; x < s->ncomponents && s->codsty[x].transform == FF_DWT53;)
if (++x == s->ncomponents)
picture->flags |= AV_FRAME_FLAG_LOSSLESS;
avctx->execute2(avctx, jpeg2000_decode_tile, picture, NULL, s->numXtiles * s->numYtiles);
jpeg2000_dec_cleanup(s);

View File

@ -2561,6 +2561,8 @@ eoi_parser:
}
if ((ret = av_frame_ref(frame, s->picture_ptr)) < 0)
return ret;
if (s->lossless)
frame->flags |= AV_FRAME_FLAG_LOSSLESS;
*got_frame = 1;
s->got_picture = 0;

View File

@ -1592,6 +1592,10 @@ static int vp9_decode_frame(AVCodecContext *avctx, AVFrame *frame,
f->flags |= AV_FRAME_FLAG_KEY;
else
f->flags &= ~AV_FRAME_FLAG_KEY;
if (s->s.h.lossless)
f->flags |= AV_FRAME_FLAG_LOSSLESS;
else
f->flags &= ~AV_FRAME_FLAG_LOSSLESS;
f->pict_type = (s->s.h.keyframe || s->s.h.intraonly) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
// Non-existent frames have the implicit dimension 0x0 != CUR_FRAME

View File

@ -1191,6 +1191,7 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p,
*got_frame = 1;
p->pict_type = AV_PICTURE_TYPE_I;
p->flags |= AV_FRAME_FLAG_KEY;
p->flags |= AV_FRAME_FLAG_LOSSLESS;
ret = data_size;
free_and_return: