summaryrefslogtreecommitdiff
path: root/libavcodec/screenpresso.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2016-03-29 20:30:48 +0200
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-04-04 15:40:14 +0200
commitec8a69fab657f9cce624e8b0f4069d12696890bf (patch)
treea4a0344f6dae01475e0638263d32d2d1403da370 /libavcodec/screenpresso.c
parent95db8c757cb003a71b040b567f38be74151deb5c (diff)
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>
Diffstat (limited to 'libavcodec/screenpresso.c')
-rw-r--r--libavcodec/screenpresso.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/screenpresso.c b/libavcodec/screenpresso.c
index 41d1755328..819bd600fb 100644
--- a/libavcodec/screenpresso.c
+++ b/libavcodec/screenpresso.c
@@ -115,10 +115,9 @@ static int screenpresso_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
- /* Basic sanity check, but not really harmful */
- if (avpkt->data[0] != 0x73 && avpkt->data[0] != 0x72)
- av_log(avctx, AV_LOG_WARNING, "Unknown header 0x%02X\n", avpkt->data[0]);
- keyframe = (avpkt->data[0] == 0x73);
+ /* Compression level (4 bits) and keyframe information (1 bit) */
+ av_log(avctx, AV_LOG_DEBUG, "Compression level %d\n", avpkt->data[0] >> 4);
+ keyframe = avpkt->data[0] & 1;
/* Pixel size */
component_size = ((avpkt->data[1] >> 2) & 0x03) + 1;