FFmpeg
vp56rac.c
Go to the documentation of this file.
1 /*
2  * VP5/6/8 decoder
3  * Copyright (c) 2010 Fiona Glaser <fiona@x264.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 <stdint.h>
23 #include "libavutil/error.h"
24 #include "bytestream.h"
25 #include "vp56.h"
26 
27 const uint8_t ff_vp56_norm_shift[256]= {
28  8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,
29  3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
30  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
31  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
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  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
35  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
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  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,
39  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,
40 };
41 
42 int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
43 {
44  c->high = 255;
45  c->bits = -16;
46  c->buffer = buf;
47  c->end = buf + buf_size;
48  c->end_reached = 0;
49  if (buf_size < 1)
50  return AVERROR_INVALIDDATA;
51  c->code_word = bytestream_get_be24(&c->buffer);
52  return 0;
53 }
ff_vp56_norm_shift
const uint8_t ff_vp56_norm_shift[256]
vp56 specific range coder implementation
Definition: vp56rac.c:27
vp56.h
ff_vp56_init_range_decoder
int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
Definition: vp56rac.c:42
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
error.h
VP56RangeCoder
Definition: vp56.h:87
bytestream.h
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61