~ubuntu-branches/ubuntu/lucid/ffmpeg/lucid-updates

« back to all changes in this revision

Viewing changes to libavcodec/wnv1.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-02-05 21:45:05 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090205214505-fvn0jkiv3lrkaaq4
Tags: 3:0.svn20090204-2ubuntu1+unstripped1
rebuild using a clean, uncrippled ffmpeg tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
 
22
22
/**
23
 
 * @file wnv1.c
 
23
 * @file libavcodec/wnv1.c
24
24
 * Winnov WNV1 codec.
25
25
 */
26
26
 
58
58
 
59
59
static int decode_frame(AVCodecContext *avctx,
60
60
                        void *data, int *data_size,
61
 
                        uint8_t *buf, int buf_size)
 
61
                        const uint8_t *buf, int buf_size)
62
62
{
63
63
    WNV1Context * const l = avctx->priv_data;
64
64
    AVFrame * const p= (AVFrame*)&l->pic;
65
65
    unsigned char *Y,*U,*V;
66
66
    int i, j;
67
67
    int prev_y = 0, prev_u = 0, prev_v = 0;
 
68
    uint8_t *rbuf;
 
69
 
 
70
    rbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
 
71
    if(!rbuf){
 
72
        av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
 
73
        return -1;
 
74
    }
68
75
 
69
76
    if(p->data[0])
70
77
        avctx->release_buffer(avctx, p);
72
79
    p->reference = 0;
73
80
    if(avctx->get_buffer(avctx, p) < 0){
74
81
        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
 
82
        av_free(rbuf);
75
83
        return -1;
76
84
    }
77
85
    p->key_frame = 1;
78
86
 
79
87
    for(i=8; i<buf_size; i++)
80
 
        buf[i]= ff_reverse[ buf[i] ]; //FIXME ensure that the buffer is modifyable or use a temp one
81
 
    init_get_bits(&l->gb, buf+8, (buf_size-8)*8);
 
88
        rbuf[i]= ff_reverse[ buf[i] ];
 
89
    init_get_bits(&l->gb, rbuf+8, (buf_size-8)*8);
82
90
 
83
91
    if (buf[2] >> 4 == 6)
84
92
        l->shift = 2;
112
120
 
113
121
    *data_size = sizeof(AVFrame);
114
122
    *(AVFrame*)data = l->pic;
 
123
    av_free(rbuf);
115
124
 
116
125
    return buf_size;
117
126
}