qtrle.c: Fix for ticket #226.

In 1bpp mode, interpret skip&0x80 as "start a new line" instead of "go to next line", this is almost the same except for the first line which was always skipped before and caused to try to write an extra line at the end of the frame (ticket #226).

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Alexis Ballier 2011-12-07 09:27:20 -03:00 committed by Michael Niedermayer
parent 0be95fe183
commit 1af91978db
2 changed files with 48 additions and 39 deletions

View File

@ -72,6 +72,15 @@ static void qtrle_decode_1bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
unsigned char *rgb = s->frame.data[0];
int pixel_limit = s->frame.linesize[0] * s->avctx->height;
int skip;
/* skip & 0x80 appears to mean 'start a new line', which can be interpreted
* as 'go to next line' during the decoding of a frame but is 'go to first
* line' at the beginning. Since we always interpret it as 'go to next line'
* in the decoding loop (which makes code simpler/faster), the first line
* would not be counted, so we count one more.
* See: https://ffmpeg.org/trac/ffmpeg/ticket/226
* In the following decoding loop, row_ptr will be the position of the
* _next_ row. */
lines_to_change++;
while (lines_to_change) {
CHECK_STREAM_PTR(2);
@ -81,8 +90,8 @@ static void qtrle_decode_1bpp(QtrleContext *s, int stream_ptr, int row_ptr, int
break;
if(skip & 0x80) {
lines_to_change--;
row_ptr += row_inc;
pixel_ptr = row_ptr + 2 * (skip & 0x7f);
row_ptr += row_inc;
} else
pixel_ptr += 2 * skip;
CHECK_PIXEL_PTR(0); /* make sure pixel_ptr is positive */

View File

@ -1,107 +1,107 @@
0, 0, 9600, 0xc1632102
0, 0, 9600, 0xc5921aa2
1, 0, 2040, 0x0a157db4
1, 4163, 2040, 0x00c63e08
0, 7500, 9600, 0x0f6c0521
0, 7500, 9600, 0x9032fc52
1, 8327, 2040, 0xacf2a25b
1, 12490, 2040, 0xd6189e85
0, 15000, 9600, 0x04b90b5a
0, 15000, 9600, 0x7db0038e
1, 16653, 2040, 0x8276f843
1, 20816, 2040, 0xadebae73
0, 22500, 9600, 0x2ebd4500
0, 22500, 9600, 0x95b73c41
1, 24980, 2040, 0x5da76697
1, 29143, 2040, 0x469d0ea7
0, 30000, 9600, 0x726f46f4
0, 30000, 9600, 0x531e4189
1, 33306, 2040, 0x0d7412e1
1, 37469, 2040, 0x2f2cc63f
0, 37500, 9600, 0x37f6968e
0, 37500, 9600, 0xb73390ec
1, 41633, 2040, 0x10106eb7
0, 45000, 9600, 0x7305872e
0, 45000, 9600, 0x958e8221
1, 45796, 2040, 0x300124c7
1, 49959, 2040, 0xa329f8e8
0, 52500, 9600, 0x222eff5e
0, 52500, 9600, 0xd393f8a6
1, 54122, 2040, 0xcea35ca5
1, 58286, 2040, 0x55105aef
0, 60000, 9600, 0x9317e227
0, 60000, 9600, 0xa085da1c
1, 62449, 2040, 0x08980ce1
1, 66612, 2040, 0x367faf24
0, 67500, 9600, 0x421eee9d
0, 67500, 9600, 0x57ace74f
1, 70776, 2040, 0x75bfef06
1, 74939, 2040, 0x34f1daf4
0, 75000, 9600, 0xcbcfaaff
0, 75000, 9600, 0x5d11a308
1, 79102, 2040, 0x97050317
0, 82500, 9600, 0xe7d43be2
0, 82500, 9600, 0x13e133b7
1, 83265, 2040, 0xd297c536
1, 87429, 2040, 0xa8abad5a
0, 90000, 9600, 0x0b71e28c
0, 90000, 9600, 0x494edb86
1, 91592, 2040, 0x445ce8e0
1, 95755, 2040, 0xa3f4d940
0, 97500, 9600, 0xd6a050ca
0, 97500, 9600, 0x43a448ea
1, 99918, 2040, 0x0ebb7b26
1, 104082, 2040, 0x4372f6f6
0, 105000, 9600, 0x0ac6dbf5
0, 105000, 9600, 0x3562d35b
1, 108245, 2040, 0xd4365079
1, 112408, 2040, 0x56f902f7
0, 112500, 9600, 0x5c036038
0, 112500, 9600, 0x0bc655d2
1, 116571, 2040, 0x4153938a
0, 120000, 9600, 0x6e417ed6
0, 120000, 9600, 0xbece73a1
1, 120735, 2040, 0x14996d86
1, 124898, 2040, 0x3f99c318
0, 127500, 9600, 0x8bd0dc22
0, 127500, 9600, 0x82e7cfa1
1, 129061, 2040, 0x939978a5
1, 133224, 2040, 0x7086bd44
0, 135000, 9600, 0xdf3b0877
0, 135000, 9600, 0xda29fd8f
1, 137388, 276, 0x25b89d22
1, 137951, 2040, 0xf3edb106
1, 142114, 2040, 0x0ca61430
0, 142500, 9600, 0xae6e7823
0, 142500, 9600, 0x70fb700b
1, 146278, 2040, 0x7229c458
0, 150000, 9600, 0x8ff0ac32
0, 150000, 9600, 0xaf57a6b0
1, 150441, 2040, 0xc37edd31
1, 154604, 2040, 0xa3da98b4
0, 157500, 9600, 0xa2d9e2ce
0, 157500, 9600, 0x0a5ed9b9
1, 158767, 2040, 0x69704803
1, 162931, 2040, 0xa79bf334
0, 165000, 9600, 0x5fd92b65
0, 165000, 9600, 0xf7c62c38
1, 167094, 2040, 0x59d8d4c4
1, 171257, 2040, 0xf9ff0271
0, 172500, 9600, 0x81c1c824
0, 172500, 9600, 0x0aa2ccfd
1, 175420, 2040, 0xc4ced9d6
1, 179584, 2040, 0x859f1912
0, 180000, 9600, 0xb8a2ace4
0, 180000, 9600, 0xc9adabae
1, 183747, 2040, 0xe7955aa6
0, 187500, 9600, 0x65b70404
0, 187500, 9600, 0x67ff0aba
1, 187910, 2040, 0x374624fd
1, 192073, 2040, 0x52121097
0, 195000, 9600, 0xc5349eb2
0, 195000, 9600, 0xea79a465
1, 196237, 2040, 0x660fe645
1, 200400, 2040, 0xf624176a
0, 202500, 9600, 0xf60cc2b8
0, 202500, 9600, 0x8928c626
1, 204563, 2040, 0x1f2246dd
1, 208727, 2040, 0x940e0a32
0, 210000, 9600, 0x31474595
0, 210000, 9600, 0x8dab4111
1, 212890, 2040, 0x9c6d338c
1, 217053, 2040, 0xfce0d30a
0, 217500, 9600, 0xf602635b
0, 217500, 9600, 0x81ef63f9
1, 221216, 2040, 0xd0ec9aa5
0, 225000, 9600, 0x873cbd87
0, 225000, 9600, 0xf977bc5e
1, 225380, 2040, 0x58012141
1, 229543, 2040, 0xde67fc43
0, 232500, 9600, 0xb9793ffe
0, 232500, 9600, 0x9e6a3f4a
1, 233706, 2040, 0x6baa0450
1, 237869, 2040, 0xf4f80252
0, 240000, 9600, 0x42eb2831
0, 240000, 9600, 0x77c92865
1, 242033, 2040, 0x0cd47ee3
1, 246196, 2040, 0x129cbaa7
0, 247500, 9600, 0x44cc1dab
0, 247500, 9600, 0x3915170d
1, 250359, 2040, 0x5ef5c0a1
1, 254522, 2040, 0xf660baa7
0, 255000, 9600, 0xbdcbbb87
0, 255000, 9600, 0xbe19b995
1, 258686, 2040, 0xe48bc0a1
0, 262500, 9600, 0x29c22df7
0, 262500, 9600, 0x3e8a3077
1, 262849, 2040, 0xdfeabaa7
1, 267012, 2040, 0xed04c0a1
0, 270000, 9600, 0xde502ef5
0, 270000, 9600, 0x1331342e
1, 271176, 2040, 0xd771baa7
1, 275339, 300, 0x521f24e9
1, 275951, 1476, 0x9b9394b1
0, 277500, 9600, 0xaf311aeb
0, 277500, 9600, 0x4d692175