NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Member Functions | List of all members
video::Compressor Class Reference

Public Member Functions

 Compressor (int width, int height, int mfps, const std::string &filename)
 
 ~Compressor ()
 
void compresstexture (int gltexture)
 
void preparetexture (int gltexture)
 
bool get_output_info (unsigned int frameno, unsigned __int64 *fileoffset, FrameType::FT *frametype)
 

Detailed Description

Warning
The constructor of this class will query the current OpenGL rendering context and the current CUDA context and store both internally. Every time you call a method it will check whether these contexts are still current!
For the CUDA compression to work properly you need to make sure the CUDA context that runs the compression stream is on the same device as the OpenGL context that owns the textures! In debug mode, this class will check for this and barf if not!

When the destructor runs it will unregister textures passed in via preparetexture() from CUDA. This basically assumes that you are not using the textures in the current CUDA context outside of this library.

Constructor & Destructor Documentation

video::Compressor::Compressor ( int  width,
int  height,
int  mfps,
const std::string filename 
)
Parameters
mfpsRefresh rate in milli-Hz, e.g. for NTSC 29.97 Hz this would be 29970.
widthThe input and output width of the video. Needs to be even! All formats in StreamFormat have even widths.
heightThe input and output height of the video. If it's not even then this class automatically pads it. This is because NTSC has an odd height (487) and this class should be able to take it directly.
Exceptions
InteropFailedExceptionif there are problems with CUDA
CompressorFailedExceptionif the compressor engine specifically returns unexpected errors
std::logic_errorif there's no CUDA or OpenGL context, or both are not on the same device
video::Compressor::~Compressor ( )

Member Function Documentation

void video::Compressor::compresstexture ( int  gltexture)
Exceptions
std::logic_errorif you did not call preparetexture() beforehand
bool video::Compressor::get_output_info ( unsigned int  frameno,
unsigned __int64 *  fileoffset,
FrameType::FT frametype 
)

Returns some info you'll if you want to decompress the output.

Returns
true if info is available, false if frame is not finished yet
void video::Compressor::preparetexture ( int  gltexture)
Warning
The textures you pass in here will be unregistered from CUDA when the destructor runs!

The documentation for this class was generated from the following files: