openMSX
PostProcessor.hh
Go to the documentation of this file.
1 #ifndef POSTPROCESSOR_HH
2 #define POSTPROCESSOR_HH
3 
4 #include "FrameSource.hh"
5 #include "VideoLayer.hh"
6 #include "Schedulable.hh"
7 #include "EmuTime.hh"
8 #include <memory>
9 #include <vector>
10 
11 namespace openmsx {
12 
13 class Display;
14 class RenderSettings;
15 class RawFrame;
16 class DeinterlacedFrame;
17 class DoubledFrame;
18 class Deflicker;
19 class SuperImposedFrame;
20 class AviRecorder;
21 class CliComm;
22 class EventDistributor;
23 
30 class PostProcessor : public VideoLayer, private Schedulable
31 {
32 public:
33  ~PostProcessor() override;
34 
45  virtual std::unique_ptr<RawFrame> rotateFrames(
46  std::unique_ptr<RawFrame> finishedFrame, EmuTime::param time);
47 
54  void setSuperimposeVideoFrame(const RawFrame* videoSource) {
55  superImposeVideoFrame = videoSource;
56  }
57 
63  void setSuperimposeVdpFrame(const FrameSource* vdpSource) {
64  superImposeVdpFrame = vdpSource;
65  }
66 
72  void setRecorder(AviRecorder* recorder_) { recorder = recorder_; }
73 
77  bool isRecording() const { return recorder != nullptr; }
78 
82  unsigned getBpp() const;
83 
88  FrameSource* getPaintFrame() const { return paintFrame; }
89 
90  // VideoLayer
91  void takeRawScreenShot(unsigned height, const std::string& filename) override;
92 
93 
95 
96 protected:
99  static unsigned getLineWidth(FrameSource* frame, unsigned y, unsigned step);
100 
102  MSXMotherBoard& motherBoard, Display& display,
103  OutputSurface& screen, const std::string& videoSource,
104  unsigned maxWidth, unsigned height, bool canDoInterlace);
105 
108 
111 
113  std::unique_ptr<RawFrame> lastFrames[4];
114 
116  std::unique_ptr<DeinterlacedFrame> deinterlacedFrame;
117 
119  std::unique_ptr<DoubledFrame> interlacedFrame;
120 
122  std::unique_ptr<Deflicker> deflicker;
123 
125  std::unique_ptr<SuperImposedFrame> superImposedFrame;
126 
132 
135 
140 
141  int interleaveCount; // for interleave-black-frame
142  int lastFramesCount; // How many items in lastFrames[] are up-to-date
143  int maxWidth; // we lazily create RawFrame objects in lastFrames[]
144  int height; // these two vars remember how big those should be
145 
146 private:
147  // Schedulable
148  void executeUntil(EmuTime::param time) override;
149 
150  Display& display;
151 
156  const bool canDoInterlace;
157 
158  EmuTime lastRotate;
159  EventDistributor& eventDistributor;
160 };
161 
162 } // namespace openmsx
163 
164 #endif // POSTPROCESSOR_HH
std::unique_ptr< DoubledFrame > interlacedFrame
Each line of the last frame twice, to get double vertical resolution.
Represents the output window/screen of openMSX.
Definition: Display.hh:31
static unsigned getLineWidth(FrameSource *frame, unsigned y, unsigned step)
Returns the maximum width for lines [y..y+step).
void setSuperimposeVideoFrame(const RawFrame *videoSource)
Set the Video frame on which to superimpose the &#39;normal&#39; output of this PostProcessor.
std::unique_ptr< RawFrame > lastFrames[4]
The last 4 fully rendered (unscaled) MSX frames.
A frame buffer where pixels can be written to.
std::unique_ptr< DeinterlacedFrame > deinterlacedFrame
Combined the last two frames in a deinterlaced frame.
Interface for getting lines from a video frame.
Definition: FrameSource.hh:14
void setSuperimposeVdpFrame(const FrameSource *vdpSource)
Set the VDP frame on which to superimpose the &#39;normal&#39; output of this PostProcessor.
const FrameSource * superImposeVdpFrame
bool isRecording() const
Is recording active.
RenderSettings & renderSettings
Render settings.
Every class that wants to get scheduled at some point must inherit from this class.
Definition: Schedulable.hh:31
A video frame as output by the VDP scanline conversion unit, before any postprocessing filters are ap...
Definition: RawFrame.hh:25
std::unique_ptr< SuperImposedFrame > superImposedFrame
Result of superimposing 2 frames.
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
void takeRawScreenShot(unsigned height, const std::string &filename) override
Create a raw (=non-postprocessed) screenshot.
OutputSurface & screen
The surface which is visible to the user.
unsigned getBpp() const
Get the number of bits per pixel for the pixels in these frames.
void setRecorder(AviRecorder *recorder_)
Start/stop recording.
std::unique_ptr< Deflicker > deflicker
Combine the last 4 frames into one &#39;flicker-free&#39; frame.
AviRecorder * recorder
Video recorder, nullptr when not recording.
Abstract base class for post processors.
FrameSource * paintFrame
Represents a frame as it should be displayed.
FrameSource * getPaintFrame() const
Get the frame that would be displayed.
const RawFrame * superImposeVideoFrame
Video frame on which to superimpose the (VDP) output.
Class containing all settings for renderers.
PostProcessor(MSXMotherBoard &motherBoard, Display &display, OutputSurface &screen, const std::string &videoSource, unsigned maxWidth, unsigned height, bool canDoInterlace)
virtual std::unique_ptr< RawFrame > rotateFrames(std::unique_ptr< RawFrame > finishedFrame, EmuTime::param time)
Sets up the "abcdFrame" variables for a new frame.