liveMedia/MP3InternalsHuffman.hh

Go to the documentation of this file.
00001 /**********
00002 This library is free software; you can redistribute it and/or modify it under
00003 the terms of the GNU Lesser General Public License as published by the
00004 Free Software Foundation; either version 2.1 of the License, or (at your
00005 option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
00006 
00007 This library is distributed in the hope that it will be useful, but WITHOUT
00008 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00009 FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
00010 more details.
00011 
00012 You should have received a copy of the GNU Lesser General Public License
00013 along with this library; if not, write to the Free Software Foundation, Inc.,
00014 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
00015 **********/
00016 // "liveMedia"
00017 // Copyright (c) 1996-2013 Live Networks, Inc.  All rights reserved.
00018 // MP3 internal implementation details (Huffman encoding)
00019 // C++ header
00020 
00021 #ifndef _MP3_INTERNALS_HUFFMAN_HH
00022 #define _MP3_INTERNALS_HUFFMAN_HH
00023 
00024 #ifndef _MP3_INTERNALS_HH
00025 #include "MP3Internals.hh"
00026 #endif
00027 
00028 void updateSideInfoForHuffman(MP3SideInfo& sideInfo, Boolean isMPEG2,
00029                               unsigned char const* mainDataPtr,
00030                               unsigned p23L0, unsigned p23L1,
00031                               unsigned& part23Length0a,
00032                               unsigned& part23Length0aTruncation,
00033                               unsigned& part23Length0b,
00034                               unsigned& part23Length0bTruncation,
00035                               unsigned& part23Length1a,
00036                               unsigned& part23Length1aTruncation,
00037                               unsigned& part23Length1b,
00038                               unsigned& part23Length1bTruncation);
00039 
00040 #define SSLIMIT 18
00041 
00042 class MP3HuffmanEncodingInfo {
00043 public:
00044   MP3HuffmanEncodingInfo(Boolean includeDecodedValues = False);
00045   ~MP3HuffmanEncodingInfo();
00046 
00047 public:
00048   unsigned numSamples;
00049   unsigned allBitOffsets[SBLIMIT*SSLIMIT + 1];
00050   unsigned reg1Start, reg2Start, bigvalStart; /* special bit offsets */
00051   unsigned* decodedValues;
00052 };
00053 
00054 /* forward */
00055 void MP3HuffmanDecode(MP3SideInfo::gr_info_s_t* gr, Boolean isMPEG2,
00056                       unsigned char const* fromBasePtr,
00057                       unsigned fromBitOffset, unsigned fromLength,
00058                       unsigned& scaleFactorsLength,
00059                       MP3HuffmanEncodingInfo& hei);
00060 
00061 extern unsigned char huffdec[]; // huffman table data
00062 
00063 // The following are used if we process Huffman-decoded values
00064 #ifdef FOUR_BYTE_SAMPLES
00065 #define BYTES_PER_SAMPLE_VALUE 4
00066 #else
00067 #ifdef TWO_BYTE_SAMPLES
00068 #define BYTES_PER_SAMPLE_VALUE 2
00069 #else
00070 // ONE_BYTE_SAMPLES
00071 #define BYTES_PER_SAMPLE_VALUE 1
00072 #endif
00073 #endif
00074 
00075 #ifdef DO_HUFFMAN_ENCODING
00076 unsigned MP3HuffmanEncode(MP3SideInfo::gr_info_s_t const* gr,
00077                           unsigned char const* fromPtr,
00078                           unsigned char* toPtr, unsigned toBitOffset,
00079                           unsigned numHuffBits);
00080 #endif
00081 
00082 #endif

Generated on Mon Apr 29 13:28:02 2013 for live by  doxygen 1.5.2