You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
screenpresso: Correctly handle keyframes
The first byte contains compression level together with keyframe status. When a frame is not interpreted correctly, its data is summed to the reference, and would degrade over time, producing an incorrect result. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
This commit is contained in:
@@ -115,10 +115,9 @@ static int screenpresso_decode_frame(AVCodecContext *avctx, void *data,
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Basic sanity check, but not really harmful */
|
/* Compression level (4 bits) and keyframe information (1 bit) */
|
||||||
if (avpkt->data[0] != 0x73 && avpkt->data[0] != 0x72)
|
av_log(avctx, AV_LOG_DEBUG, "Compression level %d\n", avpkt->data[0] >> 4);
|
||||||
av_log(avctx, AV_LOG_WARNING, "Unknown header 0x%02X\n", avpkt->data[0]);
|
keyframe = avpkt->data[0] & 1;
|
||||||
keyframe = (avpkt->data[0] == 0x73);
|
|
||||||
|
|
||||||
/* Pixel size */
|
/* Pixel size */
|
||||||
component_size = ((avpkt->data[1] >> 2) & 0x03) + 1;
|
component_size = ((avpkt->data[1] >> 2) & 0x03) + 1;
|
||||||
|
Reference in New Issue
Block a user