summaryrefslogtreecommitdiffstats
path: root/libavcodec/flashsv.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-02 09:31:50 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-02 09:33:34 +0100
commit77c33424c1754d38182880bf320e5a6fcc264611 (patch)
tree73611cd19dab31ccdefcdd2a533b7ccd84f9cbfd /libavcodec/flashsv.c
parent8183e33225af194f4592977913bf9d596c974efe (diff)
parent4a64e67988dd01005efb1ae831bff14c1656b573 (diff)
downloadffmpeg-streaming-77c33424c1754d38182880bf320e5a6fcc264611.zip
ffmpeg-streaming-77c33424c1754d38182880bf320e5a6fcc264611.tar.gz
Merge commit '4a64e67988dd01005efb1ae831bff14c1656b573'
* commit '4a64e67988dd01005efb1ae831bff14c1656b573': flashsv: Refactor a little Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/flashsv.c')
-rw-r--r--libavcodec/flashsv.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index 3d185d5..62b7fae 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -201,12 +201,15 @@ static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt,
s->blocks[blk_idx].pos = s->keyframedata + (get_bits_count(gb) / 8);
s->blocks[blk_idx].size = block_size;
}
+
+ y_pos += s->diff_start;
+
if (!s->color_depth) {
/* Flash Screen Video stores the image upside down, so copy
* lines to destination in reverse order. */
for (k = 1; k <= s->diff_height; k++) {
memcpy(s->frame.data[0] + x_pos * 3 +
- (s->image_height - y_pos - s->diff_start - k) * s->frame.linesize[0],
+ (s->image_height - y_pos - k) * s->frame.linesize[0],
line, width * 3);
/* advance source pointer to next line */
line += width * 3;
@@ -214,7 +217,7 @@ static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt,
} else {
/* hybrid 15-bit/palette mode */
decode_hybrid(s->tmpblock, s->frame.data[0],
- s->image_height - (y_pos + 1 + s->diff_start + s->diff_height),
+ s->image_height - (y_pos + 1 + s->diff_height),
x_pos, s->diff_height, width,
s->frame.linesize[0], s->pal);
}
@@ -420,10 +423,11 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
int k;
int off = (s->image_height - y_pos - 1) * s->frame.linesize[0];
- for (k = 0; k < cur_blk_height; k++)
- memcpy(s->frame.data[0] + off - k*s->frame.linesize[0] + x_pos*3,
- s->keyframe + off - k*s->frame.linesize[0] + x_pos*3,
+ for (k = 0; k < cur_blk_height; k++) {
+ int x = off - k * s->frame.linesize[0] + x_pos * 3;
+ memcpy(s->frame.data[0] + x, s->keyframe + x,
cur_blk_width * 3);
+ }
}
/* skip unchanged blocks, which have size 0 */
OpenPOWER on IntegriCloud