Revision 2264c110 libavcodec/svq3.c

View differences:

libavcodec/svq3.c
70 70
    int unknown_flag;
71 71
    int next_slice_index;
72 72
    uint32_t watermark_key;
73
    uint8_t *buf;
74
    int buf_size;
73 75
} SVQ3Context;
74 76

  
75 77
#define FULLPEL_MODE  1
......
927 929
                             void *data, int *data_size,
928 930
                             AVPacket *avpkt)
929 931
{
930
    const uint8_t *buf = avpkt->data;
931 932
    SVQ3Context *svq3 = avctx->priv_data;
932 933
    H264Context *h = &svq3->h;
933 934
    MpegEncContext *s = &h->s;
934 935
    int buf_size = avpkt->size;
935 936
    int m, mb_type, left;
937
    uint8_t *buf;
936 938

  
937 939
    /* special case for last picture */
938 940
    if (buf_size == 0) {
......
944 946
        return 0;
945 947
    }
946 948

  
947
    init_get_bits (&s->gb, buf, 8*buf_size);
948

  
949 949
    s->mb_x = s->mb_y = h->mb_xy = 0;
950 950

  
951
    if (svq3->watermark_key) {
952
        svq3->buf = av_fast_realloc(svq3->buf, &svq3->buf_size,
953
                                    buf_size+FF_INPUT_BUFFER_PADDING_SIZE);
954
        if (!svq3->buf)
955
            return AVERROR(ENOMEM);
956
        memcpy(svq3->buf, avpkt->data, buf_size);
957
        buf = svq3->buf;
958
    } else {
959
        buf = avpkt->data;
960
    }
961

  
962
    init_get_bits(&s->gb, buf, 8*buf_size);
963

  
951 964
    if (svq3_decode_slice_header(avctx))
952 965
        return -1;
953 966

  
......
1092 1105

  
1093 1106
    MPV_common_end(s);
1094 1107

  
1108
    av_freep(&svq3->buf);
1109
    svq3->buf_size = 0;
1110

  
1095 1111
    return 0;
1096 1112
}
1097 1113

  

Also available in: Unified diff