annotate vp56rac.c @ 12446:10b5a51810f9 libavcodec

Checking return values of av_malloc(z) and report an error in case.
author bindhammer
date Tue, 31 Aug 2010 07:14:47 +0000
parents d0b25641338b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12365
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
1 /*
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
2 * VP5/6/8 decoder
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
3 * Copyright (c) 2010 Jason Garrett-Glaser <darkshikari@gmail.com>
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
4 *
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
5 * This file is part of FFmpeg.
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
6 *
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
11 *
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
15 * Lesser General Public License for more details.
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
16 *
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
20 */
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
21
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
22 #include "libavutil/common.h"
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
23 #include "vp56.h"
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
24
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
25 const uint8_t ff_vp56_norm_shift[256]= {
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
26 8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
27 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
28 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
29 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
30 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
31 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
32 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
33 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
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,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
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,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
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,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
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,
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
38 };
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
39
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
40 void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
41 {
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
42 c->high = 255;
12385
d0b25641338b VP5/6/8: ~7% faster arithmetic decoding
darkshikari
parents: 12365
diff changeset
43 c->bits = -16;
12365
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
44 c->buffer = buf;
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
45 c->end = buf + buf_size;
12385
d0b25641338b VP5/6/8: ~7% faster arithmetic decoding
darkshikari
parents: 12365
diff changeset
46 c->code_word = bytestream_get_be24(&c->buffer);
12365
7c54834209f6 VP5/6/8: eliminate CABAC dependency
darkshikari
parents:
diff changeset
47 }