---
 libavcodec/vcr1.c |   38 ++++++++++++++++++--------------------
 1 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/libavcodec/vcr1.c b/libavcodec/vcr1.c
index 8c64afe..4c159cb 100644
--- a/libavcodec/vcr1.c
+++ b/libavcodec/vcr1.c
@@ -35,10 +35,7 @@
 #define CONFIG_VCR1_ENCODER 0
 
 typedef struct VCR1Context{
-    AVCodecContext *avctx;
     AVFrame picture;
-    int delta[16];
-    int offset[4];
 } VCR1Context;
 
 static int decode_frame(AVCodecContext *avctx,
@@ -51,6 +48,7 @@ static int decode_frame(AVCodecContext *avctx,
     AVFrame *picture = data;
     AVFrame * const p= (AVFrame*)&a->picture;
     const uint8_t *bytestream= buf;
+    int delta[16], offset[4];
     int i, x, y;
 
     if(p->data[0])
@@ -65,12 +63,12 @@ static int decode_frame(AVCodecContext *avctx,
     p->key_frame= 1;
 
     for(i=0; i<16; i++){
-        a->delta[i]= *(bytestream++);
+        delta[i] = *(bytestream++);
         bytestream++;
     }
 
     for(y=0; y<avctx->height; y++){
-        int offset;
+        int poffset;
         uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ];
 
         if((y&3) == 0){
@@ -78,14 +76,14 @@ static int decode_frame(AVCodecContext *avctx,
             uint8_t *cr= &a->picture.data[2][ (y>>2)*a->picture.linesize[2] ];
 
             for(i=0; i<4; i++)
-                a->offset[i]= *(bytestream++);
+                offset[i] = *(bytestream++);
 
-            offset= a->offset[0] - a->delta[ bytestream[2]&0xF ];
+            poffset = offset[0] - delta[bytestream[2] & 0xF];
             for(x=0; x<avctx->width; x+=4){
-                luma[0]=( offset += a->delta[ bytestream[2]&0xF ]);
-                luma[1]=( offset += a->delta[ bytestream[2]>>4  ]);
-                luma[2]=( offset += a->delta[ bytestream[0]&0xF ]);
-                luma[3]=( offset += a->delta[ bytestream[0]>>4  ]);
+                luma[0] = (poffset += delta[bytestream[2] & 0xF]);
+                luma[1] = (poffset += delta[bytestream[2] >> 4 ]);
+                luma[2] = (poffset += delta[bytestream[0] & 0xF]);
+                luma[3] = (poffset += delta[bytestream[0] >> 4 ]);
                 luma += 4;
 
                 *(cb++) = bytestream[3];
@@ -94,17 +92,17 @@ static int decode_frame(AVCodecContext *avctx,
                 bytestream+= 4;
             }
         }else{
-            offset= a->offset[y&3] - a->delta[ bytestream[2]&0xF ];
+            poffset = offset[y & 3] - delta[bytestream[2] & 0xF];
 
             for(x=0; x<avctx->width; x+=8){
-                luma[0]=( offset += a->delta[ bytestream[2]&0xF ]);
-                luma[1]=( offset += a->delta[ bytestream[2]>>4  ]);
-                luma[2]=( offset += a->delta[ bytestream[3]&0xF ]);
-                luma[3]=( offset += a->delta[ bytestream[3]>>4  ]);
-                luma[4]=( offset += a->delta[ bytestream[0]&0xF ]);
-                luma[5]=( offset += a->delta[ bytestream[0]>>4  ]);
-                luma[6]=( offset += a->delta[ bytestream[1]&0xF ]);
-                luma[7]=( offset += a->delta[ bytestream[1]>>4  ]);
+                luma[0] = (poffset += delta[bytestream[2] & 0xF]);
+                luma[1] = (poffset += delta[bytestream[2] >> 4 ]);
+                luma[2] = (poffset += delta[bytestream[3] & 0xF]);
+                luma[3] = (poffset += delta[bytestream[3] >> 4 ]);
+                luma[4] = (poffset += delta[bytestream[0] & 0xF]);
+                luma[5] = (poffset += delta[bytestream[0] >> 4 ]);
+                luma[6] = (poffset += delta[bytestream[1] & 0xF]);
+                luma[7] = (poffset += delta[bytestream[1] >> 4 ]);
                 luma += 8;
                 bytestream+= 4;
             }
-- 
1.7.7

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to