[FFmpeg-cvslog] flashsv2enc: only encode diff blocks when needed

Daniel Verkamp git at videolan.org
Sat Sep 8 05:41:23 CEST 2012


ffmpeg | branch: master | Daniel Verkamp <daniel at drv.nu> | Fri Sep  7 19:43:56 2012 -0700| [124f0b2f4687ee8a0d30f0c615e155e72df1df0d] | committer: Michael Niedermayer

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 at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=124f0b2f4687ee8a0d30f0c615e155e72df1df0d
---

 libavcodec/flashsv2enc.c        |    7 +++----
 tests/ref/fate/vsynth1-flashsv2 |    4 ++--
 tests/ref/fate/vsynth2-flashsv2 |    4 ++--
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c
index 9725f29..a33c9bb 100644
--- a/libavcodec/flashsv2enc.c
+++ b/libavcodec/flashsv2enc.c
@@ -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);
diff --git a/tests/ref/fate/vsynth1-flashsv2 b/tests/ref/fate/vsynth1-flashsv2
index f8c2ed1..a01ccbe 100644
--- a/tests/ref/fate/vsynth1-flashsv2
+++ b/tests/ref/fate/vsynth1-flashsv2
@@ -1,4 +1,4 @@
-e3403ea852029daf589a7a4dfd8f6cae *tests/data/fate/vsynth1-flashsv2.flv
-9371095 tests/data/fate/vsynth1-flashsv2.flv
+adbbdd25c1ed2f87ea589d2314307cdf *tests/data/fate/vsynth1-flashsv2.flv
+9368395 tests/data/fate/vsynth1-flashsv2.flv
 efa88d09115a2e947eff00ee435ba3f3 *tests/data/fate/vsynth1-flashsv2.out.rawvideo
 stddev:    3.47 PSNR: 37.31 MAXDIFF:   49 bytes:  7603200/  7603200
diff --git a/tests/ref/fate/vsynth2-flashsv2 b/tests/ref/fate/vsynth2-flashsv2
index 580ad97..d207a8b 100644
--- a/tests/ref/fate/vsynth2-flashsv2
+++ b/tests/ref/fate/vsynth2-flashsv2
@@ -1,4 +1,4 @@
-4baf149705dbbd8084879d692e6acc8a *tests/data/fate/vsynth2-flashsv2.flv
-9293862 tests/data/fate/vsynth2-flashsv2.flv
+01e0aa4da9ccc8e12fd03df63625eea4 *tests/data/fate/vsynth2-flashsv2.flv
+9291162 tests/data/fate/vsynth2-flashsv2.flv
 8f63e24049ba1789a7f8353c695a3d99 *tests/data/fate/vsynth2-flashsv2.out.rawvideo
 stddev:    2.39 PSNR: 40.55 MAXDIFF:   21 bytes:  7603200/  7603200



More information about the ffmpeg-cvslog mailing list