~ubuntu-branches/ubuntu/utopic/ffmpeg-debian/utopic

« back to all changes in this revision

Viewing changes to libavcodec/vp5.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-01-20 09:20:53 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120092053-izz63p40hc98qfgp
Tags: 3:0.svn20090119-1ubuntu1
* merge from debian. LP: #318501
* new version fixes CVE-2008-3230, LP: #253767

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "vp5data.h"
34
34
 
35
35
 
36
 
static int vp5_parse_header(vp56_context_t *s, const uint8_t *buf, int buf_size,
 
36
static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
37
37
                            int *golden_frame)
38
38
{
39
 
    vp56_range_coder_t *c = &s->c;
 
39
    VP56RangeCoder *c = &s->c;
40
40
    int rows, cols;
41
41
 
42
42
    vp56_init_range_decoder(&s->c, buf, buf_size);
58
58
        vp56_rac_gets(c, 8);  /* number of displayed macroblock rows */
59
59
        vp56_rac_gets(c, 8);  /* number of displayed macroblock cols */
60
60
        vp56_rac_gets(c, 2);
61
 
        if (16*cols != s->avctx->coded_width ||
 
61
        if (!s->macroblocks || /* first frame */
 
62
            16*cols != s->avctx->coded_width ||
62
63
            16*rows != s->avctx->coded_height) {
63
64
            avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
64
65
            return 2;
84
85
    return v;
85
86
}
86
87
 
87
 
static void vp5_parse_vector_adjustment(vp56_context_t *s, vp56_mv_t *vect)
 
88
static void vp5_parse_vector_adjustment(VP56Context *s, VP56mv *vect)
88
89
{
89
 
    vp56_range_coder_t *c = &s->c;
90
 
    vp56_model_t *model = s->modelp;
 
90
    VP56RangeCoder *c = &s->c;
 
91
    VP56Model *model = s->modelp;
91
92
    int comp, di;
92
93
 
93
94
    for (comp=0; comp<2; comp++) {
108
109
    }
109
110
}
110
111
 
111
 
static void vp5_parse_vector_models(vp56_context_t *s)
 
112
static void vp5_parse_vector_models(VP56Context *s)
112
113
{
113
 
    vp56_range_coder_t *c = &s->c;
114
 
    vp56_model_t *model = s->modelp;
 
114
    VP56RangeCoder *c = &s->c;
 
115
    VP56Model *model = s->modelp;
115
116
    int comp, node;
116
117
 
117
118
    for (comp=0; comp<2; comp++) {
131
132
                model->vector_pdv[comp][node] = vp56_rac_gets_nn(c, 7);
132
133
}
133
134
 
134
 
static void vp5_parse_coeff_models(vp56_context_t *s)
 
135
static void vp5_parse_coeff_models(VP56Context *s)
135
136
{
136
 
    vp56_range_coder_t *c = &s->c;
137
 
    vp56_model_t *model = s->modelp;
 
137
    VP56RangeCoder *c = &s->c;
 
138
    VP56Model *model = s->modelp;
138
139
    uint8_t def_prob[11];
139
140
    int node, cg, ctx;
140
141
    int ct;    /* code type */
177
178
                        model->coeff_acct[pt][ct][cg][ctx][node] = av_clip(((model->coeff_ract[pt][ct][cg][node] * vp5_ract_lc[ct][cg][node][ctx][0] + 128) >> 8) + vp5_ract_lc[ct][cg][node][ctx][1], 1, 254);
178
179
}
179
180
 
180
 
static void vp5_parse_coeff(vp56_context_t *s)
 
181
static void vp5_parse_coeff(VP56Context *s)
181
182
{
182
 
    vp56_range_coder_t *c = &s->c;
183
 
    vp56_model_t *model = s->modelp;
 
183
    VP56RangeCoder *c = &s->c;
 
184
    VP56Model *model = s->modelp;
184
185
    uint8_t *permute = s->scantable.permutated;
185
186
    uint8_t *model1, *model2;
186
187
    int coeff, sign, coeff_idx;
250
251
    }
251
252
}
252
253
 
253
 
static void vp5_default_models_init(vp56_context_t *s)
 
254
static void vp5_default_models_init(VP56Context *s)
254
255
{
255
 
    vp56_model_t *model = s->modelp;
 
256
    VP56Model *model = s->modelp;
256
257
    int i;
257
258
 
258
259
    for (i=0; i<2; i++) {
267
268
 
268
269
static av_cold int vp5_decode_init(AVCodecContext *avctx)
269
270
{
270
 
    vp56_context_t *s = avctx->priv_data;
 
271
    VP56Context *s = avctx->priv_data;
271
272
 
272
273
    vp56_init(avctx, 1, 0);
273
274
    s->vp56_coord_div = vp5_coord_div;
286
287
    "vp5",
287
288
    CODEC_TYPE_VIDEO,
288
289
    CODEC_ID_VP5,
289
 
    sizeof(vp56_context_t),
 
290
    sizeof(VP56Context),
290
291
    vp5_decode_init,
291
292
    NULL,
292
293
    vp56_free,