Revision dcfb0cad libavcodec/interplayvideo.c

View differences:

libavcodec/interplayvideo.c
70 70
    int is_16bpp;
71 71
    const unsigned char *stream_ptr;
72 72
    const unsigned char *stream_end;
73
    const uint8_t *mv_ptr;
74
    const uint8_t *mv_end;
73 75
    unsigned char *pixel_ptr;
74 76
    int line_inc;
75 77
    int stride;
......
118 120
    int x, y;
119 121

  
120 122
    /* copy block from 2 frames ago using a motion vector; need 1 more byte */
121
    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
122
    B = *s->stream_ptr++;
123
    if (!s->is_16bpp) {
124
        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
125
        B = *s->stream_ptr++;
126
    } else {
127
        CHECK_STREAM_PTR(s->mv_ptr, s->mv_end, 1);
128
        B = *s->mv_ptr++;
129
    }
123 130

  
124 131
    if (B < 56) {
125 132
        x = 8 + (B % 7);
......
141 148
    /* copy 8x8 block from current frame from an up/left block */
142 149

  
143 150
    /* need 1 more byte for motion */
144
    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
145
    B = *s->stream_ptr++;
151
    if (!s->is_16bpp) {
152
        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
153
        B = *s->stream_ptr++;
154
    } else {
155
        CHECK_STREAM_PTR(s->mv_ptr, s->mv_end, 1);
156
        B = *s->mv_ptr++;
157
    }
146 158

  
147 159
    if (B < 56) {
148 160
        x = -(8 + (B % 7));
......
162 174
    unsigned char B, BL, BH;
163 175

  
164 176
    /* copy a block from the previous frame; need 1 more byte */
165
    CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
177
    if (!s->is_16bpp) {
178
        CHECK_STREAM_PTR(s->stream_ptr, s->stream_end, 1);
179
        B = *s->stream_ptr++;
180
    } else {
181
        CHECK_STREAM_PTR(s->mv_ptr, s->mv_end, 1);
182
        B = *s->mv_ptr++;
183
    }
166 184

  
167
    B = *s->stream_ptr++;
168 185
    BL = B & 0x0F;
169 186
    BH = (B >> 4) & 0x0F;
170 187
    x = -8 + BL;
......
587 604
        s->stream_end = s->buf + s->size;
588 605
    } else {
589 606
        s->stride = s->current_frame.linesize[0] >> 1;
607
        s->stream_ptr = s->buf + 16;
608
        s->stream_end =
609
        s->mv_ptr = s->buf + 14 + AV_RL16(s->buf+14);
610
        s->mv_end = s->buf + s->size;
590 611
    }
591 612
    s->line_inc = s->stride - 8;
592 613
    s->upper_motion_limit_offset = (s->avctx->height - 8) * s->current_frame.linesize[0]

Also available in: Unified diff