Commit 77c33424 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '4a64e679'

* commit '4a64e679':
  flashsv: Refactor a little
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 8183e332 4a64e679
...@@ -201,12 +201,15 @@ static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt, ...@@ -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].pos = s->keyframedata + (get_bits_count(gb) / 8);
s->blocks[blk_idx].size = block_size; s->blocks[blk_idx].size = block_size;
} }
y_pos += s->diff_start;
if (!s->color_depth) { if (!s->color_depth) {
/* Flash Screen Video stores the image upside down, so copy /* Flash Screen Video stores the image upside down, so copy
* lines to destination in reverse order. */ * lines to destination in reverse order. */
for (k = 1; k <= s->diff_height; k++) { for (k = 1; k <= s->diff_height; k++) {
memcpy(s->frame.data[0] + x_pos * 3 + 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); line, width * 3);
/* advance source pointer to next line */ /* advance source pointer to next line */
line += width * 3; line += width * 3;
...@@ -214,7 +217,7 @@ static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt, ...@@ -214,7 +217,7 @@ static int flashsv_decode_block(AVCodecContext *avctx, AVPacket *avpkt,
} else { } else {
/* hybrid 15-bit/palette mode */ /* hybrid 15-bit/palette mode */
decode_hybrid(s->tmpblock, s->frame.data[0], 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, x_pos, s->diff_height, width,
s->frame.linesize[0], s->pal); s->frame.linesize[0], s->pal);
} }
...@@ -420,11 +423,12 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, ...@@ -420,11 +423,12 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
int k; int k;
int off = (s->image_height - y_pos - 1) * s->frame.linesize[0]; int off = (s->image_height - y_pos - 1) * s->frame.linesize[0];
for (k = 0; k < cur_blk_height; k++) for (k = 0; k < cur_blk_height; k++) {
memcpy(s->frame.data[0] + off - k*s->frame.linesize[0] + x_pos*3, int x = off - k * s->frame.linesize[0] + x_pos * 3;
s->keyframe + off - k*s->frame.linesize[0] + x_pos*3, memcpy(s->frame.data[0] + x, s->keyframe + x,
cur_blk_width * 3); cur_blk_width * 3);
} }
}
/* skip unchanged blocks, which have size 0 */ /* skip unchanged blocks, which have size 0 */
if (size) { if (size) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment