Revision 905ef0d0

View differences:

libavcodec/Makefile
376 376
                                          vorbis_data.o
377 377
OBJS-$(CONFIG_VP3_DECODER)             += vp3.o vp3dsp.o
378 378
OBJS-$(CONFIG_VP5_DECODER)             += vp5.o vp56.o vp56data.o vp56dsp.o \
379
                                          vp3dsp.o cabac.o
379
                                          vp3dsp.o vp56rac.o
380 380
OBJS-$(CONFIG_VP6_DECODER)             += vp6.o vp56.o vp56data.o vp56dsp.o \
381
                                          vp3dsp.o vp6dsp.o huffman.o cabac.o
382
OBJS-$(CONFIG_VP8_DECODER)             += vp8.o vp8dsp.o cabac.o
381
                                          vp3dsp.o vp6dsp.o huffman.o vp56rac.o
382
OBJS-$(CONFIG_VP8_DECODER)             += vp8.o vp8dsp.o vp56rac.o
383 383
OBJS-$(CONFIG_VQA_DECODER)             += vqavideo.o
384 384
OBJS-$(CONFIG_WAVPACK_DECODER)         += wavpack.o
385 385
OBJS-$(CONFIG_WMAPRO_DECODER)          += wmaprodec.o wma.o
libavcodec/vp5.c
39 39
    VP56RangeCoder *c = &s->c;
40 40
    int rows, cols;
41 41

  
42
    vp56_init_range_decoder(&s->c, buf, buf_size);
42
    ff_vp56_init_range_decoder(&s->c, buf, buf_size);
43 43
    s->framep[VP56_FRAME_CURRENT]->key_frame = !vp56_rac_get(c);
44 44
    vp56_rac_get(c);
45 45
    ff_vp56_init_dequant(s, vp56_rac_gets(c, 6));
libavcodec/vp56.h
181 181
 * vp56 specific range coder implementation
182 182
 */
183 183

  
184
static inline void vp56_init_range_decoder(VP56RangeCoder *c,
185
                                           const uint8_t *buf, int buf_size)
186
{
187
    c->high = 255;
188
    c->bits = -8;
189
    c->buffer = buf;
190
    c->end = buf + buf_size;
191
    c->code_word = bytestream_get_be16(&c->buffer);
192
}
184
extern const uint8_t ff_vp56_norm_shift[256];
185
void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size);
193 186

  
194 187
static av_always_inline unsigned int vp56_rac_renorm(VP56RangeCoder *c)
195 188
{
196
    int shift = ff_h264_norm_shift[c->high] - 1;
189
    int shift = ff_vp56_norm_shift[c->high];
197 190
    int bits = c->bits;
198 191
    unsigned int code_word = c->code_word;
199 192

  
libavcodec/vp56rac.c
1
/*
2
 * VP5/6/8 decoder
3
 * Copyright (c) 2010 Jason Garrett-Glaser <darkshikari@gmail.com>
4
 *
5
 * This file is part of FFmpeg.
6
 *
7
 * FFmpeg is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * FFmpeg is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with FFmpeg; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
 */
21

  
22
#include "libavutil/common.h"
23
#include "vp56.h"
24

  
25
const uint8_t ff_vp56_norm_shift[256]= {
26
 8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,
27
 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
28
 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
29
 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
30
 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
31
 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
32
 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
33
 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
34
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
35
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
36
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
37
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
38
};
39

  
40
void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
41
{
42
    c->high = 255;
43
    c->bits = -8;
44
    c->buffer = buf;
45
    c->end = buf + buf_size;
46
    c->code_word = bytestream_get_be16(&c->buffer);
47
}
libavcodec/vp6.c
87 87
            res = 2;
88 88
        }
89 89

  
90
        vp56_init_range_decoder(c, buf+6, buf_size-6);
90
        ff_vp56_init_range_decoder(c, buf+6, buf_size-6);
91 91
        vp56_rac_gets(c, 2);
92 92

  
93 93
        parse_filter_info = s->filter_header;
......
103 103
            buf += 2;
104 104
            buf_size -= 2;
105 105
        }
106
        vp56_init_range_decoder(c, buf+1, buf_size-1);
106
        ff_vp56_init_range_decoder(c, buf+1, buf_size-1);
107 107

  
108 108
        *golden_frame = vp56_rac_get(c);
109 109
        if (s->filter_header) {
......
143 143
            s->parse_coeff = vp6_parse_coeff_huffman;
144 144
            init_get_bits(&s->gb, buf, buf_size<<3);
145 145
        } else {
146
            vp56_init_range_decoder(&s->cc, buf, buf_size);
146
            ff_vp56_init_range_decoder(&s->cc, buf, buf_size);
147 147
            s->ccp = &s->cc;
148 148
        }
149 149
    } else {
libavcodec/vp8.c
305 305
        if (buf_size - size < 0)
306 306
            return -1;
307 307

  
308
        vp56_init_range_decoder(&s->coeff_partition[i], buf, size);
308
        ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, size);
309 309
        buf      += size;
310 310
        buf_size -= size;
311 311
    }
312
    vp56_init_range_decoder(&s->coeff_partition[i], buf, buf_size);
312
    ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, buf_size);
313 313

  
314 314
    return 0;
315 315
}
......
445 445
            return ret;
446 446
    }
447 447

  
448
    vp56_init_range_decoder(c, buf, header_size);
448
    ff_vp56_init_range_decoder(c, buf, header_size);
449 449
    buf      += header_size;
450 450
    buf_size -= header_size;
451 451

  

Also available in: Unified diff