ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

vlc.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program 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
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "common/scummsys.h"
00024 
00025 /* VLC code
00026  *
00027  * Original copyright note: * Intel Indeo 4 (IV41, IV42, etc.) video decoder for ffmpeg
00028  * written, produced, and directed by Alan Smithee
00029  */
00030 
00031 #ifndef IMAGE_CODECS_INDEO_VLC_H
00032 #define IMAGE_CODECS_INDEO_VLC_H
00033 
00034 #include "image/codecs/indeo/get_bits.h"
00035 
00036 namespace Image {
00037 namespace Indeo {
00038 
00039 #define VLC_TYPE int16
00040 
00041 enum VLCFlag {
00042     INIT_VLC_LE             = 2,
00043     INIT_VLC_USE_NEW_STATIC = 4
00044 };
00045 
00046 struct VLCcode {
00047     uint8 bits;
00048     uint16 symbol;
00049 
00054     uint32 code;
00055 };
00056 
00057 struct VLC {
00058 private:
00059     static int compareVlcSpec(const void *a, const void *b);
00060 
00068     static uint getData(const void *table, uint idx, uint wrap, uint size);
00069 public:
00070     int _bits;
00071     VLC_TYPE (*_table)[2];  
00072     int _tableSize, _tableAllocated;
00073 
00074     VLC();
00075 
00076     /* Build VLC decoding tables suitable for use with get_vlc().
00077 
00078     'nbBits' sets the decoding table size (2^nbBits) entries. The
00079     bigger it is, the faster is the decoding. But it should not be too
00080     big to save memory and L1 cache. '9' is a good compromise.
00081 
00082     'nbCodes' : number of vlcs codes
00083 
00084     'bits' : table which gives the size (in bits) of each vlc code.
00085 
00086     'codes' : table which gives the bit pattern of of each vlc code.
00087 
00088     'symbols' : table which gives the values to be returned from get_vlc().
00089 
00090     'xxx_wrap' : give the number of bytes between each entry of the
00091     'bits' or 'codes' tables.
00092 
00093     'xxx_size' : gives the number of bytes of each entry of the 'bits'
00094     or 'codes' tables.
00095 
00096     'wrap' and 'size' make it possible to use any memory configuration and types
00097     (byte/word/long) to store the 'bits', 'codes', and 'symbols' tables.
00098 
00099     'useStatic' should be set to 1 for tables, which should be freed
00100     with av_free_static(), 0 if freeVlc() will be used.
00101     */
00102     int init_vlc(int nbBits, int nbCodes, const void *bits, int bitsWrap,
00103         int bitsSize, const void *codes, int codesWrap, int codesSize,
00104         const void *symbols, int symbolsWrap, int symbolsSize, int flags);
00105 
00106     int init_vlc(int nbBits, int nbCodes, const void *bits, int bitsWrap, int bitsSize,
00107         const void *codes, int codesWrap, int codesSize, int flags);
00108 
00112     void freeVlc();
00113 
00114 
00127     int buildTable(int tableNbBits, int nbCodes, VLCcode *codes, int flags);
00128 
00129     int allocTable(int size, int useStatic);
00130 };
00131 
00132 } // End of namespace Indeo
00133 } // End of namespace Image
00134 
00135 #endif


Generated on Sat Apr 20 2019 05:04:09 for ResidualVM by doxygen 1.7.1
curved edge   curved edge