flashsv2enc: only encode diff blocks when needed

A flashsv2 block may have a "diff block" to indicate which scan lines of
the block are actually encoded.  However, this diff block need not be
used when the entire block is coded.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Daniel Verkamp
2012-09-07 19:43:56 -07:00
committed by Michael Niedermayer
parent 5710dbf88c
commit 124f0b2f46
3 changed files with 7 additions and 8 deletions

View File

@@ -634,18 +634,17 @@ static int encode_all_blocks(FlashSV2Context * s, int keyframe)
for (col = 0; col < s->cols; col++) {
b = s->frame_blocks + (row * s->cols + col);
prev = s->key_blocks + (row * s->cols + col);
b->flags = s->use15_7 ? COLORSPACE_15_7 : 0;
if (keyframe) {
b->start = 0;
b->len = b->height;
b->flags = s->use15_7 ? COLORSPACE_15_7 : 0;
} else if (!b->dirty) {
b->start = 0;
b->len = 0;
b->data_size = 0;
b->flags = s->use15_7 ? COLORSPACE_15_7 : 0;
continue;
} else {
b->flags = s->use15_7 ? COLORSPACE_15_7 | HAS_DIFF_BLOCKS : HAS_DIFF_BLOCKS;
} else if (b->start != 0 || b->len != b->height) {
b->flags |= HAS_DIFF_BLOCKS;
}
data = s->current_frame + s->image_width * 3 * s->block_height * row + s->block_width * col * 3;
res = encode_block(s, &s->palette, b, prev, data, s->image_width * 3, s->comp, s->dist, keyframe);