diff options
author | Diego Biurrun <diego@biurrun.de> | 2011-06-30 00:59:13 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2011-07-08 00:35:17 +0200 |
commit | 51915cfa47e3fba1778673a0772070eaf2a9b742 (patch) | |
tree | b81b063411cebd3a4b983c80f07a74ada90f0454 /libavcodec/flashsv.c | |
parent | 4904995652dbbfc7cb37fef9656b9b86f53449f7 (diff) | |
download | ffmpeg-51915cfa47e3fba1778673a0772070eaf2a9b742.tar.gz |
flashsv: inline copy_region() into flashsv_decode_frame()
Diffstat (limited to 'libavcodec/flashsv.c')
-rw-r--r-- | libavcodec/flashsv.c | 27 |
1 files changed, 11 insertions, 16 deletions
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 */ } } |