📄 p64-huff.h
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: p64-huff.h,v 1.1.8.1 2004/07/09 01:50:08 hubbe Exp $ * * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. * * The contents of this file, and the files included with this file, * are subject to the current version of the RealNetworks Public * Source License (the "RPSL") available at * http://www.helixcommunity.org/content/rpsl unless you have licensed * the file under the current version of the RealNetworks Community * Source License (the "RCSL") available at * http://www.helixcommunity.org/content/rcsl, in which case the RCSL * will apply. You may also obtain the license terms directly from * RealNetworks. You may not use this file except in compliance with * the RPSL or, if you have a valid RCSL with RealNetworks applicable * to this file, the RCSL. Please see the applicable RPSL or RCSL for * the rights, obligations and limitations governing use of the * contents of the file. * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL") in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your version of * this file only under the terms of the GPL, and not to allow others * to use your version of this file under the terms of either the RPSL * or RCSL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient may * use your version of this file under the terms of any one of the * RPSL, the RCSL or the GPL. * * This file is part of the Helix DNA Technology. RealNetworks is the * developer of the Original Code and owns the copyrights in the * portions it created. * * This file, and the files included with this file, is distributed * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET * ENJOYMENT OR NON-INFRINGEMENT. * * Technology Compatibility Kit Test Suite(s) Location: * http://www.helixcommunity.org/content/tck * * Contributor(s): * * ***** END LICENSE BLOCK ***** *//* * Copyright (c) 1993-1994 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the Network Research * Group at Lawrence Berkeley Laboratory. * 4. Neither the name of the University nor of the Laboratory may be used * to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * *//* * This code is derived from the P64 software implementation by the * Stanford PVRG group: * * Copyright (C) 1990, 1991, 1993 Andy C. Hung, all rights reserved. * PUBLIC DOMAIN LICENSE: Stanford University Portable Video Research * Group. If you use this software, you agree to the following: This * program package is purely experimental, and is licensed "as is". * Permission is granted to use, modify, and distribute this program * without charge for any purpose, provided this license/ disclaimer * notice appears in the copies. No warranty or maintenance is given, * either expressed or implied. In no event shall the author(s) be * liable to you or a third party for any special, incidental, * consequential, or other damages, arising out of the use or inability * to use the program for any purpose (or the loss of data), even if we * have been advised of such possibilities. Any public reference or * advertisement of this source code should refer to it as the Portable * Video Research Group (PVRG) code, and not by any author(s) (or * Stanford University) name. */#ifdef __cplusplusextern "C" {#endif#define SYM_ESCAPE 0#define SYM_EOB -1#define SYM_STUFFBITS 0#define SYM_STARTCODE -1#define SYM_ILLEGAL -2#define SYM_EOMB -3/* * Flags that indicate which types of encoding apply * to a given macroblock type code. * * MT_QUANT new quantization factor present * MT_CBP bit vector of which blocks present * MT_INTRA this block is intra-coded (e.g., not differenced) * MT_MFM motion vectors present (e.g., displacement of difference) * MT_FILTER old block should be filtered before summing with xmitted blk * MT_TCOEFF block present */#define MT_TCOEFF 0x01#define MT_CBP 0x02#define MT_MVD 0x04#define MT_MQUANT 0x08#define MT_FILTER 0x10#define MT_INTRA 0x20#ifndef HUFFSTRINGSstruct huffent { int val; int nb;};extern const unsigned char skiptab[];/* * Lookup tables that map an encoded prefix of the bit string, * into the next symbol (for decoding). */extern const short htd_mtype[];extern const short htd_mba[];extern const short htd_cbp[];extern const short htd_dvm[];extern const short htd_tcoeff[];extern const short htd_tcoeff_noeob[];extern const int htd_mtype_width;extern const int htd_mba_width;extern const int htd_cbp_width;extern const int htd_dvm_width;extern const int htd_tcoeff_width;extern const int htd_tcoeff_noeob_width;/* * Look up tables that produce a huffman encoding string * from a symbol or group of symbols (for encoding). */extern struct huffent hte_mba[];extern struct huffent hte_tc[];#elsestruct huffcode { int val; char* str;};static struct huffcode hc_mtype[] = { { MT_CBP|MT_TCOEFF, "1" }, { MT_FILTER|MT_MVD|MT_CBP|MT_TCOEFF, "01" }, { MT_FILTER|MT_MVD, "001" }, { MT_INTRA|MT_TCOEFF, "0001" }, { MT_MQUANT|MT_CBP|MT_TCOEFF, "00001" }, { MT_MQUANT|MT_FILTER|MT_MVD|MT_CBP|MT_TCOEFF, "000001" }, { MT_INTRA|MT_MQUANT|MT_TCOEFF, "0000001" }, { MT_MVD|MT_CBP|MT_TCOEFF, "00000001" }, { MT_MVD, "000000001" }, { MT_MQUANT|MT_CBP|MT_MVD|MT_TCOEFF, "0000000001" }, { 0, 0 }};static struct huffcode hc_mba[] = { { SYM_STUFFBITS, "00000001111" }, { SYM_STARTCODE, "0000000000000001" }, { 1, "1" }, { 2, "011" }, { 3, "010" }, { 4, "0011" }, { 5, "0010" }, { 6, "00011" }, { 7, "00010" }, { 8, "0000111" }, { 9, "0000110" }, { 10, "00001011" }, { 11, "00001010" }, { 12, "00001001" }, { 13, "00001000" }, { 14, "00000111" }, { 15, "00000110" }, { 16, "0000010111" }, { 17, "0000010110" }, { 18, "0000010101" }, { 19, "0000010100" }, { 20, "0000010011" }, { 21, "0000010010" }, { 22, "00000100011" }, { 23, "00000100010" }, { 24, "00000100001" }, { 25, "00000100000" }, { 26, "00000011111" }, { 27, "00000011110" }, { 28, "00000011101" }, { 29, "00000011100" }, { 30, "00000011011" }, { 31, "00000011010" }, { 32, "00000011001" }, { 33, "00000011000" }, { 0, 0 }};static huffcode hc_cbp[] = { { 1, "01011" }, { 2, "01001" }, { 3, "001101" }, { 4, "1101" }, { 5, "0010111" }, { 6, "0010011" }, { 7, "00011111" }, { 8, "1100" }, { 9, "0010110" }, { 10, "0010010" },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -