[FFmpeg-devel] [PATCH 1/2] vble: move the sign calculation to vble_unpack()

Michael Niedermayer michaelni at gmx.at
Mon Nov 14 03:24:07 CET 2011


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/vble.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vble.c b/libavcodec/vble.c
index b27ec32..70d8942 100644
--- a/libavcodec/vble.c
+++ b/libavcodec/vble.c
@@ -76,8 +76,10 @@ static int vble_unpack(VBLEContext *ctx, GetBitContext *gb)
 
     for (i = 0; i < ctx->size; i++) {
         /* get_bits can't take a length of 0 */
-        if (ctx->val[i])
-            ctx->val[i] = (1 << ctx->val[i]) + get_bits(gb, ctx->val[i]) - 1;
+        if (ctx->val[i]){
+            int v = (1 << ctx->val[i]) + get_bits(gb, ctx->val[i]) - 1;
+            ctx->val[i] = (v >> 1) ^ -(v & 1);
+        }
     }
 
     return 0;
@@ -95,7 +97,7 @@ static void vble_restore_plane(VBLEContext *ctx, int plane, int offset,
 
     for (i = 0; i < height; i++) {
         for (j = 0; j < width; j++) {
-            dst[j] = (val[j] >> 1) ^ -(val[j] & 1);
+            dst[j] = val[j];
 
             /* Top line and left column are not predicted */
             if (!j)
-- 
1.7.4.1



More information about the ffmpeg-devel mailing list