doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
codec.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 #ifndef __codec_h__
29 #define __codec_h__
30 
31 #define MAXERRORMAX 200
32 #define IPSIZE int
33 const float MOTION_MIN = 1.0f;
34 const float MIN_SNR = 3.0f;
35 
36 #define FULLFRAME 0
37 #define JUSTMOTION 1
38 
39 #define VQDATA double
40 
41 #include "gdefs.h"
42 #include "roq.h"
43 #include "quaddefs.h"
44 
45 class codec {
46 public:
47  codec();
48  ~codec();
49 
50  void SparseEncode( void );
51  void EncodeNothing( void );
52  void IRGBtab(void);
53  void InitImages(void);
54  void QuadX( int startX, int startY, int quadSize);
55  void InitQStatus();
56  float Snr(byte *old, byte *bnew, int size);
57  void FvqData( byte *bitmap, int size, int realx, int realy, quadcel *pquad, bool clamp);
58  void GetData( unsigned char *iData, int qSize, int startX, int startY, NSBitmapImageRep *bitmap);
59  int ComputeMotionBlock( byte *old, byte *bnew, int size);
60  void VqData8( byte *cel, quadcel *pquad);
61  void VqData4( byte *cel, quadcel *pquad);
62  void VqData2( byte *cel, quadcel *pquad);
63  int MotMeanY(void);
64  int MotMeanX(void);
65  void SetPreviousImage( const char*filename, NSBitmapImageRep *timage );
66  int BestCodeword( unsigned char *tempvector, int dimension, VQDATA **codebook );
67 private:
68 
69  void VQ( const int numEntries, const int dimension, const unsigned char *vectors, float *snr, VQDATA **codebook, const bool optimize );
70  void Sort( float *list, int *intIndex, int numElements );
71  void Segment( int *alist, float *flist, int numElements, float rmse);
72  void LowestQuad( quadcel*qtemp, int* status, float* snr, int bweigh);
73  void MakePreviousImage( quadcel *pquad );
74  float GetCurrentRMSE( quadcel *pquad );
75  int GetCurrentQuadOutputSize( quadcel *pquad );
76  int AddQuad( quadcel *pquad, int lownum );
77 
80  NSBitmapImageRep *previousImage[2]; // the ones in video ram and offscreen ram
83  int slop;
84  bool detail;
85  int onQuad;
88  int dxMean;
89  int dyMean;
91  int index2[256];
96  bool used2[256];
97  bool used4[256];
100 
101  byte luty[256];
105 
106 };
107 
108 #endif // __codec_h__
int dyMean
Definition: codec.h:89
void SetPreviousImage(const char *filename, NSBitmapImageRep *timage)
Definition: codec.cpp:362
NSBitmapImageRep * previousImage[2]
Definition: codec.h:80
int dimension2
Definition: codec.h:98
VQDATA ** codebook4
Definition: codec.h:104
int numQuadCels
Definition: codec.h:81
int slop
Definition: codec.h:83
bool used2[256]
Definition: codec.h:96
int codebooksize
Definition: codec.h:90
float GetCurrentRMSE(quadcel *pquad)
Definition: codec.cpp:1001
void SparseEncode(void)
Definition: codec.cpp:1091
void MakePreviousImage(quadcel *pquad)
Definition: codec.cpp:385
int ComputeMotionBlock(byte *old, byte *bnew, int size)
Definition: codec.cpp:771
#define VQDATA
Definition: codec.h:39
NSBitmapImageRep * newImage
Definition: codec.h:79
byte * luti
Definition: codec.h:102
void GetData(unsigned char *iData, int qSize, int startX, int startY, NSBitmapImageRep *bitmap)
Definition: codec.cpp:905
void VqData2(byte *cel, quadcel *pquad)
Definition: codec.cpp:708
int dimension4
Definition: codec.h:99
bool used4[256]
Definition: codec.h:97
GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte * bitmap
Definition: qgl.h:183
bool detail
Definition: codec.h:84
int MotMeanY(void)
Definition: codec.cpp:1086
void InitQStatus()
Definition: codec.cpp:627
const float MOTION_MIN
Definition: codec.h:33
void VqData4(byte *cel, quadcel *pquad)
Definition: codec.cpp:679
void VQ(const int numEntries, const int dimension, const unsigned char *vectors, float *snr, VQDATA **codebook, const bool optimize)
Definition: codec.cpp:1456
int pixelsHigh
Definition: codec.h:94
int AddQuad(quadcel *pquad, int lownum)
Definition: codec.cpp:1018
int codebookmade
Definition: codec.h:95
int pixelsWide
Definition: codec.h:93
codec()
Definition: codec.cpp:39
const float MIN_SNR
Definition: codec.h:34
int GetCurrentQuadOutputSize(quadcel *pquad)
Definition: codec.cpp:978
int initRGBtab
Definition: codec.h:86
void LowestQuad(quadcel *qtemp, int *status, float *snr, int bweigh)
Definition: codec.cpp:948
void FvqData(byte *bitmap, int size, int realx, int realy, quadcel *pquad, bool clamp)
Definition: codec.cpp:788
Definition: codec.h:45
void QuadX(int startX, int startY, int quadSize)
Definition: codec.cpp:601
void Segment(int *alist, float *flist, int numElements, float rmse)
Definition: codec.cpp:114
int MotMeanX(void)
Definition: codec.cpp:1081
quadcel * qStatus
Definition: codec.h:87
NSBitmapImageRep * image
Definition: codec.h:78
int dxMean
Definition: codec.h:88
void Sort(float *list, int *intIndex, int numElements)
Definition: codec.cpp:83
int onQuad
Definition: codec.h:85
~codec()
Definition: codec.cpp:63
int BestCodeword(unsigned char *tempvector, int dimension, VQDATA **codebook)
Definition: codec.cpp:321
int overAmount
Definition: codec.h:92
unsigned char byte
Definition: Lib.h:75
void EncodeNothing(void)
Definition: codec.cpp:1355
GLsizeiptr size
Definition: glext.h:3112
VQDATA ** codebook2
Definition: codec.h:103
byte luty[256]
Definition: codec.h:101
int whichFrame
Definition: codec.h:82
void IRGBtab(void)
Definition: codec.cpp:745
void InitImages(void)
Definition: codec.cpp:564
float Snr(byte *old, byte *bnew, int size)
Definition: codec.cpp:750
int index2[256]
Definition: codec.h:91
void VqData8(byte *cel, quadcel *pquad)
Definition: codec.cpp:643