Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer authored on 2013/09/10 01:05:52... | ... |
@@ -353,10 +353,10 @@ static av_always_inline int encode_line(FFV1Context *s, int w, |
353 | 353 |
return 0; |
354 | 354 |
} |
355 | 355 |
|
356 |
-static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, |
|
356 |
+static int encode_plane(FFV1Context *s, uint8_t *src, int w, int h, |
|
357 | 357 |
int stride, int plane_index) |
358 | 358 |
{ |
359 |
- int x, y, i; |
|
359 |
+ int x, y, i, ret; |
|
360 | 360 |
const int ring_size = s->avctx->context_model ? 3 : 2; |
361 | 361 |
int16_t *sample[3]; |
362 | 362 |
s->run_index = 0; |
... | ... |
@@ -373,7 +373,8 @@ static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, |
373 | 373 |
if (s->bits_per_raw_sample <= 8) { |
374 | 374 |
for (x = 0; x < w; x++) |
375 | 375 |
sample[0][x] = src[x + stride * y]; |
376 |
- encode_line(s, w, sample, plane_index, 8); |
|
376 |
+ if((ret = encode_line(s, w, sample, plane_index, 8)) < 0) |
|
377 |
+ return ret; |
|
377 | 378 |
} else { |
378 | 379 |
if (s->packed_at_lsb) { |
379 | 380 |
for (x = 0; x < w; x++) { |
... | ... |
@@ -384,13 +385,15 @@ static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, |
384 | 384 |
sample[0][x] = ((uint16_t*)(src + stride*y))[x] >> (16 - s->bits_per_raw_sample); |
385 | 385 |
} |
386 | 386 |
} |
387 |
- encode_line(s, w, sample, plane_index, s->bits_per_raw_sample); |
|
387 |
+ if((ret = encode_line(s, w, sample, plane_index, s->bits_per_raw_sample)) < 0) |
|
388 |
+ return ret; |
|
388 | 389 |
} |
389 | 390 |
// STOP_TIMER("encode line") } |
390 | 391 |
} |
392 |
+ return 0; |
|
391 | 393 |
} |
392 | 394 |
|
393 |
-static void encode_rgb_frame(FFV1Context *s, uint8_t *src[3], int w, int h, int stride[3]) |
|
395 |
+static int encode_rgb_frame(FFV1Context *s, uint8_t *src[3], int w, int h, int stride[3]) |
|
394 | 396 |
{ |
395 | 397 |
int x, y, p, i; |
396 | 398 |
const int ring_size = s->avctx->context_model ? 3 : 2; |
... | ... |
@@ -435,14 +438,18 @@ static void encode_rgb_frame(FFV1Context *s, uint8_t *src[3], int w, int h, int |
435 | 435 |
sample[3][0][x] = a; |
436 | 436 |
} |
437 | 437 |
for (p = 0; p < 3 + s->transparency; p++) { |
438 |
+ int ret; |
|
438 | 439 |
sample[p][0][-1] = sample[p][1][0 ]; |
439 | 440 |
sample[p][1][ w] = sample[p][1][w-1]; |
440 | 441 |
if (lbd) |
441 |
- encode_line(s, w, sample[p], (p + 1) / 2, 9); |
|
442 |
+ ret = encode_line(s, w, sample[p], (p + 1) / 2, 9); |
|
442 | 443 |
else |
443 |
- encode_line(s, w, sample[p], (p + 1) / 2, bits + 1); |
|
444 |
+ ret = encode_line(s, w, sample[p], (p + 1) / 2, bits + 1); |
|
445 |
+ if (ret < 0) |
|
446 |
+ return ret; |
|
444 | 447 |
} |
445 | 448 |
} |
449 |
+ return 0; |
|
446 | 450 |
} |
447 | 451 |
|
448 | 452 |
static void write_quant_table(RangeCoder *c, int16_t *quant_table) |