From 51915cfa47e3fba1778673a0772070eaf2a9b742 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 30 Jun 2011 00:59:13 +0200 Subject: flashsv: inline copy_region() into flashsv_decode_frame() --- libavcodec/flashsv.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'libavcodec/flashsv.c') diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 70c160ecd4..e1033a84cc 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -49,18 +49,6 @@ typedef struct FlashSVContext { } FlashSVContext; -static void copy_region(uint8_t *sptr, uint8_t *dptr, - int dx, int dy, int h, int w, int stride) -{ - int i; - - for (i = dx + h; i > dx; i--) { - memcpy(dptr + i * stride + dy * 3, sptr, w * 3); - sptr += w * 3; - } -} - - static av_cold int flashsv_decode_init(AVCodecContext *avctx) { FlashSVContext *s = avctx->priv_data; @@ -171,6 +159,8 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, /* skip unchanged blocks, which have size 0 */ if (size) { /* decompress block */ + uint8_t *line = s->tmpblock; + int k; int ret = inflateReset(&s->zstream); if (ret != Z_OK) { av_log(avctx, AV_LOG_ERROR, @@ -193,10 +183,15 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, "error in decompression of block %dx%d: %d\n", i, j, ret); /* return -1; */ } - copy_region(s->tmpblock, s->frame.data[0], - s->image_height - (y_pos + cur_blk_height + 1), - x_pos, cur_blk_height, cur_blk_width, - s->frame.linesize[0]); + /* Flash Screen Video stores the image upside down, so copy + * lines to destination in reverse order. */ + for (k = 1; k <= cur_blk_height; k++) { + memcpy(s->frame.data[0] + x_pos * 3 + + (s->image_height - y_pos - k) * s->frame.linesize[0], + line, cur_blk_width * 3); + /* advance source pointer to next line */ + line += cur_blk_width * 3; + } skip_bits_long(&gb, 8 * size); /* skip the consumed bits */ } } -- cgit v1.2.3