doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
roq.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 __roq_h__
29 #define __roq_h__
30 
31 #include "gdefs.h"
32 #include "roqParam.h"
33 #include "quaddefs.h"
34 #define JPEG_INTERNALS
35 extern "C" {
36 #include "../../../renderer/jpeg-6/jpeglib.h"
37 }
38 #pragma once
39 
40 class codec;
41 class roqParam;
42 
44 public:
45 
46  NSBitmapImageRep( void );
47  NSBitmapImageRep( const char *filename );
48  NSBitmapImageRep( int wide, int high );
50 
52 
53  int samplesPerPixel( void );
54  int pixelsWide( void );
55  int pixelsHigh( void );
56  byte * bitmapData( void );
57  bool hasAlpha( void );
58  bool isPlanar( void );
59 
60 private:
61 
63  int width;
64  int height;
65  ID_TIME_T timestamp;
66 
67 };
68 
69 class roq {
70 public:
71  roq();
72  ~roq();
73 
74  void WriteLossless( void );
75  void LoadAndDisplayImage( const char *filename );
76  void CloseRoQFile( bool which );
77  void InitRoQFile( const char *roqFilename );
78  void InitRoQPatterns( void );
79  void EncodeStream( const char *paramInputFile );
80  void EncodeQuietly( bool which );
81  bool IsQuiet( void );
82  bool IsLastFrame( void );
84  void MarkQuadx( int xat, int yat, int size, float cerror, int choice );
85  void WritePuzzleFrame( quadcel *pquad );
86  void WriteFrame( quadcel *pquad );
87  void WriteCodeBook( byte *codebook );
88  void WwriteCodeBookToStream( byte *codes, int csize, word cflags );
89  int PreviousFrameSize( void );
90  bool MakingVideo( void );
91  bool ParamNoAlpha( void );
92  bool SearchType( void );
93  bool HasSound( void );
94  const char * CurrentFilename( void );
95  int NormalFrameSize( void );
96  int FirstFrameSize( void );
97  bool Scaleable( void );
98  void WriteHangFrame( void );
99  int NumberOfFrames( void );
100 private:
101  void Write16Word( word *aWord, idFile *stream );
102  void Write32Word( unsigned int *aWord, idFile *stream );
103  int SizeFile( idFile *ftosize );
104  void CloseRoQFile( void );
105  void WriteCodeBookToStream( byte *codebook, int csize, word cflags );
106 
107  static void JPEGInitDestination( j_compress_ptr cinfo );
108  static boolean JPEGEmptyOutputBuffer( j_compress_ptr cinfo );
109  static void JPEGTermDestination( j_compress_ptr cinfo );
110 
111  void JPEGStartCompress( j_compress_ptr cinfo, bool write_all_tables );
112  JDIMENSION JPEGWriteScanlines( j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines );
113  void JPEGDest( j_compress_ptr cinfo, byte* outfile, int size );
114  void JPEGSave( char * filename, int quality, int image_width, int image_height, unsigned char *image_buffer );
115 
118 
122  bool quietMode;
123  bool lastFrame;
128  byte codes[4096];
129  bool dataStuff;
130 
131 };
132 
133 extern roq *theRoQ; // current roq
134 
135 #endif /* !__roq_h__ */
int width
Definition: roq.h:63
roqParam * paramFile
Definition: roq.h:117
bool IsLastFrame(void)
Definition: roq.cpp:63
bool IsQuiet(void)
Definition: roq.cpp:58
int previousSize
Definition: roq.h:127
void InitRoQFile(const char *roqFilename)
Definition: roq.cpp:520
int height
Definition: roq.h:64
void Write32Word(unsigned int *aWord, idFile *stream)
Definition: roq.cpp:190
roq * theRoQ
Definition: roq.cpp:34
void WriteCodeBookToStream(byte *codebook, int csize, word cflags)
Definition: roq.cpp:597
void JPEGDest(j_compress_ptr cinfo, byte *outfile, int size)
Definition: roq.cpp:373
void JPEGSave(char *filename, int quality, int image_width, int image_height, unsigned char *image_buffer)
bool SearchType(void)
Definition: roq.cpp:83
void WriteCodeBook(byte *codebook)
Definition: roq.cpp:622
static void JPEGInitDestination(j_compress_ptr cinfo)
Definition: roq.cpp:227
void InitRoQPatterns(void)
Definition: roq.cpp:551
void JPEGStartCompress(j_compress_ptr cinfo, bool write_all_tables)
Definition: roq.cpp:278
int NumberOfFrames(void)
Definition: roq.cpp:840
void LoadAndDisplayImage(const char *filename)
Definition: roq.cpp:810
int numberOfFrames
Definition: roq.h:126
Definition: File.h:50
void WwriteCodeBookToStream(byte *codes, int csize, word cflags)
JDIMENSION JPEGWriteScanlines(j_compress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION num_lines)
Definition: roq.cpp:315
static void JPEGTermDestination(j_compress_ptr cinfo)
Definition: roq.cpp:360
static boolean JPEGEmptyOutputBuffer(j_compress_ptr cinfo)
Definition: roq.cpp:258
bool Scaleable(void)
Definition: roq.cpp:68
const char * CurrentFilename(void)
Definition: roq.cpp:108
byte * bmap
Definition: roq.h:62
ID_TIME_T timestamp
Definition: roq.h:65
void WritePuzzleFrame(quadcel *pquad)
codec * encoder
Definition: roq.h:116
Definition: codec.h:45
NSBitmapImageRep & operator=(const NSBitmapImageRep &a)
GLubyte GLubyte GLubyte a
Definition: glext.h:4662
int FirstFrameSize(void)
Definition: roq.cpp:98
NSBitmapImageRep * CurrentImage(void)
Definition: roq.cpp:835
int SizeFile(idFile *ftosize)
Definition: roq.cpp:205
~roq()
Definition: roq.cpp:46
void EncodeQuietly(bool which)
Definition: roq.cpp:53
void Write16Word(word *aWord, idFile *stream)
Definition: roq.cpp:179
bool HasSound(void)
Definition: roq.cpp:88
JSAMPROW * JSAMPARRAY
Definition: jpeglib.h:80
void MarkQuadx(int xat, int yat, int size, float cerror, int choice)
Definition: roq.cpp:832
bool dataStuff
Definition: roq.h:129
bool quietMode
Definition: roq.h:122
Definition: roq.h:69
unsigned short word
Definition: Lib.h:76
unsigned char byte
Definition: Lib.h:75
void EncodeStream(const char *paramInputFile)
Definition: roq.cpp:113
GLsizeiptr size
Definition: glext.h:3112
Definition: Str.h:116
int PreviousFrameSize(void)
Definition: roq.cpp:93
int NormalFrameSize(void)
Definition: roq.cpp:103
roq()
Definition: roq.cpp:36
idFile * RoQFile
Definition: roq.h:119
idStr currentFile
Definition: roq.h:125
unsigned int JDIMENSION
Definition: jmorecfg.h:177
idStr roqOutfile
Definition: roq.h:124
void CloseRoQFile(void)
Definition: roq.cpp:578
void WriteHangFrame(void)
Definition: roq.cpp:584
void WriteFrame(quadcel *pquad)
Definition: roq.cpp:627
bool MakingVideo(void)
Definition: roq.cpp:78
bool lastFrame
Definition: roq.h:123
bool ParamNoAlpha(void)
Definition: roq.cpp:73
int numQuadCels
Definition: roq.h:121
byte codes[4096]
Definition: roq.h:128
void WriteLossless(void)
Definition: roq.cpp:396
NSBitmapImageRep * image
Definition: roq.h:120
byte * bitmapData(void)