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:
parent
5710dbf88c
commit
124f0b2f46
@ -634,18 +634,17 @@ static int encode_all_blocks(FlashSV2Context * s, int keyframe)
|
|||||||
for (col = 0; col < s->cols; col++) {
|
for (col = 0; col < s->cols; col++) {
|
||||||
b = s->frame_blocks + (row * s->cols + col);
|
b = s->frame_blocks + (row * s->cols + col);
|
||||||
prev = s->key_blocks + (row * s->cols + col);
|
prev = s->key_blocks + (row * s->cols + col);
|
||||||
|
b->flags = s->use15_7 ? COLORSPACE_15_7 : 0;
|
||||||
if (keyframe) {
|
if (keyframe) {
|
||||||
b->start = 0;
|
b->start = 0;
|
||||||
b->len = b->height;
|
b->len = b->height;
|
||||||
b->flags = s->use15_7 ? COLORSPACE_15_7 : 0;
|
|
||||||
} else if (!b->dirty) {
|
} else if (!b->dirty) {
|
||||||
b->start = 0;
|
b->start = 0;
|
||||||
b->len = 0;
|
b->len = 0;
|
||||||
b->data_size = 0;
|
b->data_size = 0;
|
||||||
b->flags = s->use15_7 ? COLORSPACE_15_7 : 0;
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else if (b->start != 0 || b->len != b->height) {
|
||||||
b->flags = s->use15_7 ? COLORSPACE_15_7 | HAS_DIFF_BLOCKS : HAS_DIFF_BLOCKS;
|
b->flags |= HAS_DIFF_BLOCKS;
|
||||||
}
|
}
|
||||||
data = s->current_frame + s->image_width * 3 * s->block_height * row + s->block_width * col * 3;
|
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);
|
res = encode_block(s, &s->palette, b, prev, data, s->image_width * 3, s->comp, s->dist, keyframe);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
e3403ea852029daf589a7a4dfd8f6cae *tests/data/fate/vsynth1-flashsv2.flv
|
adbbdd25c1ed2f87ea589d2314307cdf *tests/data/fate/vsynth1-flashsv2.flv
|
||||||
9371095 tests/data/fate/vsynth1-flashsv2.flv
|
9368395 tests/data/fate/vsynth1-flashsv2.flv
|
||||||
efa88d09115a2e947eff00ee435ba3f3 *tests/data/fate/vsynth1-flashsv2.out.rawvideo
|
efa88d09115a2e947eff00ee435ba3f3 *tests/data/fate/vsynth1-flashsv2.out.rawvideo
|
||||||
stddev: 3.47 PSNR: 37.31 MAXDIFF: 49 bytes: 7603200/ 7603200
|
stddev: 3.47 PSNR: 37.31 MAXDIFF: 49 bytes: 7603200/ 7603200
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
4baf149705dbbd8084879d692e6acc8a *tests/data/fate/vsynth2-flashsv2.flv
|
01e0aa4da9ccc8e12fd03df63625eea4 *tests/data/fate/vsynth2-flashsv2.flv
|
||||||
9293862 tests/data/fate/vsynth2-flashsv2.flv
|
9291162 tests/data/fate/vsynth2-flashsv2.flv
|
||||||
8f63e24049ba1789a7f8353c695a3d99 *tests/data/fate/vsynth2-flashsv2.out.rawvideo
|
8f63e24049ba1789a7f8353c695a3d99 *tests/data/fate/vsynth2-flashsv2.out.rawvideo
|
||||||
stddev: 2.39 PSNR: 40.55 MAXDIFF: 21 bytes: 7603200/ 7603200
|
stddev: 2.39 PSNR: 40.55 MAXDIFF: 21 bytes: 7603200/ 7603200
|
||||||
|
Loading…
x
Reference in New Issue
Block a user