Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

codec37.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2002 Xavier Trochu
00003 
00004 This software is provided 'as-is', without any express or implied warranty. In no event
00005 will the authors be held liable for any damages arising from the use of this software.
00006 
00007 Permission is granted to anyone to use this software for any purpose, including commercial
00008 applications, and to alter it and redistribute it freely, subject to the following
00009 restrictions:
00010 
00011 1. The origin of this software must not be misrepresented; you must not claim that you
00012    wrote the original software. If you use this software in a product, an acknowledgment
00013    in the product documentation would be appreciated but is not required.
00014 
00015 2. Altered source versions must be plainly marked as such, and must not be misrepresented 
00016    as being the original software.
00017 
00018 3. This notice may not be removed or altered from any source distribution.
00019 */
00020 #ifndef __CODEC37_H_
00021 #define __CODEC37_H_
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include "config.h"
00025 #endif
00026 
00027 #ifdef DEBUG
00028 # ifndef NO_DEBUG_CODEC37
00029 #  define DEBUG_CODEC37
00030 # endif
00031 #else
00032 # ifdef DEBUG_CODEC37
00033 #  error DEBUG_CODEC37 defined without DEBUG
00034 # endif
00035 #endif
00036 
00037 #ifdef DEBUG_CODEC37
00038 # ifndef NO_DEBUG_CODEC37_PROCS
00039 #  define DEBUG_CODEC37_PROC1
00040 #  define DEBUG_CODEC37_PROC2
00041 #  define DEBUG_CODEC37_PROC3
00042 #  define DEBUG_CODEC37_PROC4
00043 # endif
00044 #endif
00045 
00046 #include <exception>
00047 #include "decoder.h"
00048 
00052 class codec37_decoder : public decoder {
00053 private:
00054     int _deltaSize;
00055     unsigned char * _deltaBufs[2];
00056     unsigned char * _deltaBuf;
00057     short * _offset_table;
00058     int _curtable;
00059     unsigned short _prev_seq_nb;
00060     int _table_last_pitch;
00061     int _table_last_index;
00062     static const int DELTA_ADD = 0x3E00; // what is this 0x3E00 ?? == 320*200/4 - 128 
00063                             // It looks like it is a safe-guarding protection from bugs., but maybe not...
00064 public:
00065     bool init_size(const point &, const rect &) throw(std::exception);
00066     codec37_decoder() throw();
00067     void clean() throw();
00068     virtual ~codec37_decoder() throw();
00069 protected:
00070     static inline unsigned int expand(unsigned char b) {
00071         unsigned int r = b | (b << 8);
00072         return r | (r << 16);
00073     }
00074     void maketable(int, int);
00075     void proc1(blitter &, chunck &, int, int, int, int);
00076     void proc2(blitter &, chunck &, int);
00077     void proc3_with_fdfe(blitter &, chunck &, int, int, int);
00078     void proc3_without_fdfe(blitter &, chunck &, int, int, int);
00079     void proc4(blitter &, chunck &, int, int, int);
00080 public:
00081     bool decode(blitter &, chunck &) throw(std::exception);
00082 };
00083 
00084 #endif

Generated on Fri Aug 9 22:54:29 2002 for san_player by doxygen1.2.16