Browse code

cljr: simplify CLJRContext

There is no need to have delta, offset and gb in CLJRContext.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>

Paul B. Mahol authored on 2011/12/07 02:45:37
Showing 1 changed files
... ...
@@ -35,9 +35,6 @@
35 35
 typedef struct CLJRContext{
36 36
     AVCodecContext *avctx;
37 37
     AVFrame picture;
38
-    int delta[16];
39
-    int offset[4];
40
-    GetBitContext gb;
41 38
 } CLJRContext;
42 39
 
43 40
 static int decode_frame(AVCodecContext *avctx,
... ...
@@ -47,6 +44,7 @@ static int decode_frame(AVCodecContext *avctx,
47 47
     const uint8_t *buf = avpkt->data;
48 48
     int buf_size = avpkt->size;
49 49
     CLJRContext * const a = avctx->priv_data;
50
+    GetBitContext gb;
50 51
     AVFrame *picture = data;
51 52
     AVFrame * const p= (AVFrame*)&a->picture;
52 53
     int x, y;
... ...
@@ -67,20 +65,20 @@ static int decode_frame(AVCodecContext *avctx,
67 67
     p->pict_type= AV_PICTURE_TYPE_I;
68 68
     p->key_frame= 1;
69 69
 
70
-    init_get_bits(&a->gb, buf, buf_size * 8);
70
+    init_get_bits(&gb, buf, buf_size * 8);
71 71
 
72 72
     for(y=0; y<avctx->height; y++){
73 73
         uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ];
74 74
         uint8_t *cb= &a->picture.data[1][ y*a->picture.linesize[1] ];
75 75
         uint8_t *cr= &a->picture.data[2][ y*a->picture.linesize[2] ];
76 76
         for(x=0; x<avctx->width; x+=4){
77
-                luma[3] = get_bits(&a->gb, 5) << 3;
78
-            luma[2] = get_bits(&a->gb, 5) << 3;
79
-            luma[1] = get_bits(&a->gb, 5) << 3;
80
-            luma[0] = get_bits(&a->gb, 5) << 3;
77
+            luma[3] = get_bits(&gb, 5) << 3;
78
+            luma[2] = get_bits(&gb, 5) << 3;
79
+            luma[1] = get_bits(&gb, 5) << 3;
80
+            luma[0] = get_bits(&gb, 5) << 3;
81 81
             luma+= 4;
82
-            *(cb++) = get_bits(&a->gb, 6) << 2;
83
-            *(cr++) = get_bits(&a->gb, 6) << 2;
82
+            *(cb++) = get_bits(&gb, 6) << 2;
83
+            *(cr++) = get_bits(&gb, 6) << 2;
84 84
         }
85 85
     }
86 86