JPEG quality control patch, by Zack Middleton (#4673)

This commit is contained in:
Thilo Schulz 2011-02-10 21:18:31 +00:00
parent 614f315ce8
commit 2c57226d9f
2 changed files with 12 additions and 2 deletions

4
README
View file

@ -209,6 +209,10 @@ New cvars
backend being used
r_noborder - Remove window decoration from window
managers, like borders and titlebar.
r_screenshotJpegQuality - Controls quality of jpeg screenshots
captured using screenshotJPEG
r_aviMotionJpegQuality - Controls quality of video capture when
cl_aviMotionJpeg is enabled
New commands
video [filename] - start video capture (use with demo command)

View file

@ -156,6 +156,9 @@ cvar_t *r_saveFontData;
cvar_t *r_marksOnTriangleMeshes;
cvar_t *r_aviMotionJpegQuality;
cvar_t *r_screenshotJpegQuality;
cvar_t *r_maxpolys;
int max_polys;
cvar_t *r_maxpolyverts;
@ -405,7 +408,7 @@ void RB_TakeScreenshotJPEG( int x, int y, int width, int height, char *fileName
}
ri.FS_WriteFile( fileName, buffer, 1 ); // create path
SaveJPG( fileName, 90, glConfig.vidWidth, glConfig.vidHeight, buffer);
SaveJPG( fileName, r_screenshotJpegQuality->integer, glConfig.vidWidth, glConfig.vidHeight, buffer);
ri.Hunk_FreeTempMemory( buffer );
}
@ -709,7 +712,7 @@ const void *RB_TakeVideoFrameCmd( const void *data )
if( cmd->motionJpeg )
{
frameSize = SaveJPGToBuffer( cmd->encodeBuffer, 90,
frameSize = SaveJPGToBuffer( cmd->encodeBuffer, r_aviMotionJpegQuality->integer,
cmd->width, cmd->height, cmd->captureBuffer );
ri.CL_WriteAVIVideoFrame( cmd->encodeBuffer, frameSize );
}
@ -1012,6 +1015,9 @@ void R_Register( void )
r_marksOnTriangleMeshes = ri.Cvar_Get("r_marksOnTriangleMeshes", "0", CVAR_ARCHIVE);
r_aviMotionJpegQuality = ri.Cvar_Get("r_aviMotionJpegQuality", "90", CVAR_ARCHIVE);
r_screenshotJpegQuality = ri.Cvar_Get("r_screenshotJpegQuality", "90", CVAR_ARCHIVE);
r_maxpolys = ri.Cvar_Get( "r_maxpolys", va("%d", MAX_POLYS), 0);
r_maxpolyverts = ri.Cvar_Get( "r_maxpolyverts", va("%d", MAX_POLYVERTS), 0);