X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fffv1dec_template.c;h=0b1d176ba12a47c6b8fb7c0e29275f55db60edc3;hb=9e13df3776da3a101e895e2840f6f23f5a6f74a0;hp=fecdbd0025c9733d8b5366b790d8cbe11c835d5d;hpb=aebc5b2284db1f40a5b3e2e9a2bf406f606436c7;p=ffmpeg diff --git a/libavcodec/ffv1dec_template.c b/libavcodec/ffv1dec_template.c index fecdbd0025c..0b1d176ba12 100644 --- a/libavcodec/ffv1dec_template.c +++ b/libavcodec/ffv1dec_template.c @@ -50,6 +50,11 @@ static av_always_inline int RENAME(decode_line)(FFV1Context *s, int w, for (x = 0; x < w; x++) { int diff, context, sign; + if (!(x & 1023)) { + if (is_input_end(s)) + return AVERROR_INVALIDDATA; + } + context = RENAME(get_context)(p, sample[1] + x, sample[0] + x, sample[1] + x); if (context < 0) { context = -context; @@ -81,6 +86,19 @@ static av_always_inline int RENAME(decode_line)(FFV1Context *s, int w, run_mode = 2; } } + if (sample[1][x - 1] == sample[0][x - 1]) { + while (run_count > 1 && w-x > 1) { + sample[1][x] = sample[0][x]; + x++; + run_count--; + } + } else { + while (run_count > 1 && w-x > 1) { + sample[1][x] = RENAME(predict)(sample[1] + x, sample[0] + x); + x++; + run_count--; + } + } run_count--; if (run_count < 0) { run_mode = 0;