openMSX
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
openmsx::PostProcessor Class Reference

Abstract base class for post processors. More...

#include <PostProcessor.hh>

Inheritance diagram for openmsx::PostProcessor:
Inheritance graph
[legend]
Collaboration diagram for openmsx::PostProcessor:
Collaboration graph
[legend]

Public Member Functions

virtual ~PostProcessor ()
 
virtual std::unique_ptr< RawFramerotateFrames (std::unique_ptr< RawFrame > finishedFrame, EmuTime::param time)
 Sets up the "abcdFrame" variables for a new frame. More...
 
void setSuperimposeVideoFrame (const RawFrame *videoSource)
 Set the Video frame on which to superimpose the 'normal' output of this PostProcessor. More...
 
void setSuperimposeVdpFrame (const FrameSource *vdpSource)
 Set the VDP frame on which to superimpose the 'normal' output of this PostProcessor. More...
 
void setRecorder (AviRecorder *recorder_)
 Start/stop recording. More...
 
bool isRecording () const
 Is recording active. More...
 
unsigned getBpp () const
 Get the number of bits per pixel for the pixels in these frames. More...
 
FrameSourcegetPaintFrame () const
 Get the frame that would be displayed. More...
 
void takeRawScreenShot (unsigned height, const std::string &filename) override
 Create a raw (=non-postprocessed) screenshot. More...
 
CliCommgetCliComm ()
 
- Public Member Functions inherited from openmsx::VideoLayer
 VideoLayer (const VideoLayer &)=delete
 
VideoLayeroperator= (const VideoLayer &)=delete
 
int getVideoSource () const
 Returns the ID for this videolayer. More...
 
int getVideoSourceSetting () const
 
void setVideo9000Active (int video9000Source_, Video9000Active active)
 
bool needRender () const
 
bool needRecord () const
 
- Public Member Functions inherited from openmsx::Layer
virtual ~Layer ()=default
 
virtual void paint (OutputSurface &output)=0
 Paint this layer. More...
 
ZIndex getZ () const
 Query the Z-index of this layer. More...
 
Coverage getCoverage () const
 Query the coverage of this layer. More...
 
void setDisplay (LayerListener &display_)
 Store pointer to Display. More...
 

Protected Member Functions

 PostProcessor (MSXMotherBoard &motherBoard, Display &display, OutputSurface &screen, const std::string &videoSource, unsigned maxWidth, unsigned height, bool canDoInterlace)
 
- Protected Member Functions inherited from openmsx::VideoLayer
 VideoLayer (MSXMotherBoard &motherBoard, const std::string &videoSource)
 
 ~VideoLayer ()
 
void update (const Setting &setting) override
 
- Protected Member Functions inherited from openmsx::Layer
 Layer (Coverage coverage=COVER_NONE, ZIndex z=Z_DUMMY)
 Construct a layer. More...
 
void setCoverage (Coverage coverage_)
 Changes the current coverage of this layer. More...
 
void setZ (ZIndex z)
 Changes the current Z-index of this layer. More...
 
- Protected Member Functions inherited from openmsx::Observer< Setting >
 ~Observer ()
 
virtual void subjectDeleted (const Setting &)
 

Static Protected Member Functions

static unsigned getLineWidth (FrameSource *frame, unsigned y, unsigned step)
 Returns the maximum width for lines [y..y+step). More...
 

Protected Attributes

RenderSettingsrenderSettings
 Render settings. More...
 
OutputSurfacescreen
 The surface which is visible to the user. More...
 
std::unique_ptr< RawFramelastFrames [4]
 The last 4 fully rendered (unscaled) MSX frames. More...
 
std::unique_ptr< DeinterlacedFramedeinterlacedFrame
 Combined the last two frames in a deinterlaced frame. More...
 
std::unique_ptr< DoubledFrameinterlacedFrame
 Each line of the last frame twice, to get double vertical resolution. More...
 
std::unique_ptr< Deflickerdeflicker
 Combine the last 4 frames into one 'flicker-free' frame. More...
 
std::unique_ptr< SuperImposedFramesuperImposedFrame
 Result of superimposing 2 frames. More...
 
FrameSourcepaintFrame
 Represents a frame as it should be displayed. More...
 
AviRecorderrecorder
 Video recorder, nullptr when not recording. More...
 
const RawFramesuperImposeVideoFrame
 Video frame on which to superimpose the (VDP) output. More...
 
const FrameSourcesuperImposeVdpFrame
 
int interleaveCount
 
int lastFramesCount
 
int maxWidth
 
int height
 

Additional Inherited Members

- Public Types inherited from openmsx::VideoLayer
enum  Video9000Active { INACTIVE, ACTIVE_FRONT, ACTIVE_BACK }
 
- Public Types inherited from openmsx::Layer
enum  ZIndex {
  Z_DUMMY = -1, Z_BACKGROUND = 0, Z_MSX_PASSIVE = 30, Z_MSX_ACTIVE = 40,
  Z_OSDGUI = 50, Z_CONSOLE = 100
}
 Determines stacking order of layers: layers with higher Z-indices are closer to the viewer. More...
 
enum  Coverage { COVER_FULL, COVER_PARTIAL, COVER_NONE }
 Describes how much of the screen is currently covered by a particular layer. More...
 

Detailed Description

Abstract base class for post processors.

A post processor builds the frame that is displayed from the MSX frame, while applying effects such as scalers, noise etc. TODO: With some refactoring, it would be possible to move much or even all of the post processing code here instead of in the subclasses.

Definition at line 30 of file PostProcessor.hh.

Constructor & Destructor Documentation

◆ ~PostProcessor()

openmsx::PostProcessor::~PostProcessor ( )
virtual

◆ PostProcessor()

openmsx::PostProcessor::PostProcessor ( MSXMotherBoard motherBoard,
Display display,
OutputSurface screen,
const std::string &  videoSource,
unsigned  maxWidth,
unsigned  height,
bool  canDoInterlace 
)
protected

Member Function Documentation

◆ getBpp()

unsigned openmsx::PostProcessor::getBpp ( ) const

Get the number of bits per pixel for the pixels in these frames.

Returns
Possible values are 15, 16 or 32

Definition at line 271 of file PostProcessor.cc.

References openmsx::OutputSurface::getSDLFormat(), and screen.

Referenced by isRecording(), and takeRawScreenShot().

◆ getCliComm()

CliComm & openmsx::PostProcessor::getCliComm ( )

Definition at line 78 of file PostProcessor.cc.

References openmsx::Display::getCliComm().

Referenced by getPaintFrame(), rotateFrames(), and ~PostProcessor().

◆ getLineWidth()

unsigned openmsx::PostProcessor::getLineWidth ( FrameSource frame,
unsigned  y,
unsigned  step 
)
staticprotected

Returns the maximum width for lines [y..y+step).

Definition at line 83 of file PostProcessor.cc.

Referenced by getPaintFrame(), openmsx::FBPostProcessor< Pixel >::paint(), and openmsx::GLPostProcessor::~GLPostProcessor().

◆ getPaintFrame()

FrameSource* openmsx::PostProcessor::getPaintFrame ( ) const
inline

Get the frame that would be displayed.

E.g. so that it can be superimposed over the output of another PostProcessor, see setSuperimposeVdpFrame().

Definition at line 88 of file PostProcessor.hh.

References getCliComm(), getLineWidth(), height, paintFrame, and takeRawScreenShot().

◆ isRecording()

bool openmsx::PostProcessor::isRecording ( ) const
inline

Is recording active.

ATM used to keep frameskip constant during recording.

Definition at line 77 of file PostProcessor.hh.

References getBpp(), and recorder.

◆ rotateFrames()

std::unique_ptr< RawFrame > openmsx::PostProcessor::rotateFrames ( std::unique_ptr< RawFrame finishedFrame,
EmuTime::param  time 
)
virtual

Sets up the "abcdFrame" variables for a new frame.

TODO: The point of passing the finished frame in and the new workFrame out is to be able to split off the scaler application as a separate class.

Parameters
finishedFrameFrame that has just become available.
timeThe moment in time the frame becomes available. Used to calculate the framerate for recording (depends on PAL/NTSC, frameskip).
Returns
RawFrame object that can be used for building the next frame.

Reimplemented in openmsx::GLPostProcessor, and openmsx::FBPostProcessor< Pixel >.

Definition at line 93 of file PostProcessor.cc.

References openmsx::AviRecorder::addImage(), deflicker, deinterlacedFrame, openmsx::EventDistributor::distributeEvent(), openmsx::FrameSource::FIELD_NONINTERLACED, openmsx::FrameSource::FIELD_ODD, getCliComm(), openmsx::RenderSettings::getDeflicker(), openmsx::RenderSettings::getDeinterlace(), openmsx::RenderSettings::getInterleaveBlackFrame(), openmsx::MSXException::getMessage(), openmsx::OutputSurface::getSDLFormat(), openmsx::VideoLayer::getVideoSource(), openmsx::VideoLayer::getVideoSourceSetting(), height, interlacedFrame, lastFrames, lastFramesCount, maxWidth, openmsx::VideoLayer::needRecord(), paintFrame, openmsx::CliComm::printWarning(), recorder, renderSettings, screen, openmsx::Schedulable::setSyncPoint(), openmsx::AviRecorder::stop(), superImposedFrame, superImposeVdpFrame, and unlikely.

Referenced by openmsx::FBPostProcessor< Pixel >::rotateFrames(), and openmsx::GLPostProcessor::rotateFrames().

◆ setRecorder()

void openmsx::PostProcessor::setRecorder ( AviRecorder recorder_)
inline

Start/stop recording.

Parameters
recorder_Finished frames should be pushed to this AviRecorder. Can also be nullptr, meaning recording is stopped.

Definition at line 72 of file PostProcessor.hh.

References recorder.

◆ setSuperimposeVdpFrame()

void openmsx::PostProcessor::setSuperimposeVdpFrame ( const FrameSource vdpSource)
inline

Set the VDP frame on which to superimpose the 'normal' output of this PostProcessor.

This is similar to the method above, except that now the superimposing is done before scaling. IOW both frames get scaled.

Definition at line 63 of file PostProcessor.hh.

References superImposeVdpFrame.

◆ setSuperimposeVideoFrame()

void openmsx::PostProcessor::setSuperimposeVideoFrame ( const RawFrame videoSource)
inline

Set the Video frame on which to superimpose the 'normal' output of this PostProcessor.

Superimpose is done (preferably) after the normal output is scaled. IOW the video frame is (preferably) left unchanged, though exceptions are e.g. scalers that render scanlines, those are preferably also visible in the video frame.

Definition at line 54 of file PostProcessor.hh.

References superImposeVideoFrame.

◆ takeRawScreenShot()

void openmsx::PostProcessor::takeRawScreenShot ( unsigned  height,
const std::string &  filename 
)
overridevirtual

Create a raw (=non-postprocessed) screenshot.

The 'height' parameter should be either '240' or '480'. The current image will be scaled to '320x240' or '640x480' and written to a png file.

Implements openmsx::VideoLayer.

Definition at line 258 of file PostProcessor.cc.

References getBpp(), openmsx::FrameSource::getSDLPixelFormat(), paintFrame, openmsx::PNG::save(), and VLA.

Referenced by getPaintFrame().

Member Data Documentation

◆ deflicker

std::unique_ptr<Deflicker> openmsx::PostProcessor::deflicker
protected

Combine the last 4 frames into one 'flicker-free' frame.

Definition at line 122 of file PostProcessor.hh.

Referenced by PostProcessor(), and rotateFrames().

◆ deinterlacedFrame

std::unique_ptr<DeinterlacedFrame> openmsx::PostProcessor::deinterlacedFrame
protected

Combined the last two frames in a deinterlaced frame.

Definition at line 116 of file PostProcessor.hh.

Referenced by PostProcessor(), and rotateFrames().

◆ height

int openmsx::PostProcessor::height
protected

Definition at line 144 of file PostProcessor.hh.

Referenced by getPaintFrame(), and rotateFrames().

◆ interlacedFrame

std::unique_ptr<DoubledFrame> openmsx::PostProcessor::interlacedFrame
protected

Each line of the last frame twice, to get double vertical resolution.

Definition at line 119 of file PostProcessor.hh.

Referenced by PostProcessor(), and rotateFrames().

◆ interleaveCount

int openmsx::PostProcessor::interleaveCount
protected

◆ lastFrames

std::unique_ptr<RawFrame> openmsx::PostProcessor::lastFrames[4]
protected

The last 4 fully rendered (unscaled) MSX frames.

Definition at line 113 of file PostProcessor.hh.

Referenced by PostProcessor(), and rotateFrames().

◆ lastFramesCount

int openmsx::PostProcessor::lastFramesCount
protected

Definition at line 142 of file PostProcessor.hh.

Referenced by rotateFrames().

◆ maxWidth

int openmsx::PostProcessor::maxWidth
protected

Definition at line 143 of file PostProcessor.hh.

Referenced by rotateFrames().

◆ paintFrame

FrameSource* openmsx::PostProcessor::paintFrame
protected

◆ recorder

AviRecorder* openmsx::PostProcessor::recorder
protected

Video recorder, nullptr when not recording.

Definition at line 134 of file PostProcessor.hh.

Referenced by isRecording(), rotateFrames(), setRecorder(), and ~PostProcessor().

◆ renderSettings

RenderSettings& openmsx::PostProcessor::renderSettings
protected

◆ screen

OutputSurface& openmsx::PostProcessor::screen
protected

◆ superImposedFrame

std::unique_ptr<SuperImposedFrame> openmsx::PostProcessor::superImposedFrame
protected

Result of superimposing 2 frames.

Definition at line 125 of file PostProcessor.hh.

Referenced by PostProcessor(), and rotateFrames().

◆ superImposeVdpFrame

const FrameSource* openmsx::PostProcessor::superImposeVdpFrame
protected

Definition at line 139 of file PostProcessor.hh.

Referenced by rotateFrames(), and setSuperimposeVdpFrame().

◆ superImposeVideoFrame

const RawFrame* openmsx::PostProcessor::superImposeVideoFrame
protected

Video frame on which to superimpose the (VDP) output.

nullptr when not superimposing.

Definition at line 138 of file PostProcessor.hh.

Referenced by openmsx::FBPostProcessor< Pixel >::paint(), openmsx::GLPostProcessor::paint(), setSuperimposeVideoFrame(), and openmsx::GLPostProcessor::update().


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