Libav 0.7.1
libavcodec/vp56rac.c
Go to the documentation of this file.
00001 /*
00002  * VP5/6/8 decoder
00003  * Copyright (c) 2010 Jason Garrett-Glaser <darkshikari@gmail.com>
00004  *
00005  * This file is part of Libav.
00006  *
00007  * Libav is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * Libav is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with Libav; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #include "libavutil/common.h"
00023 #include "vp56.h"
00024 
00025 const uint8_t ff_vp56_norm_shift[256]= {
00026  8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,
00027  3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
00028  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
00029  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
00030  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
00031  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
00032  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
00033  1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
00034  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,
00035  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,
00036  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,
00037  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,
00038 };
00039 
00040 void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
00041 {
00042     c->high = 255;
00043     c->bits = -16;
00044     c->buffer = buf;
00045     c->end = buf + buf_size;
00046     c->code_word = bytestream_get_be24(&c->buffer);
00047 }