openMSX
PostProcessor.hh
Go to the documentation of this file.
1 #ifndef POSTPROCESSOR_HH
2 #define POSTPROCESSOR_HH
3 
4 #include "VideoLayer.hh"
5 #include "Schedulable.hh"
6 #include "EmuTime.hh"
7 #include <memory>
8 
9 namespace openmsx {
10 
11 class AviRecorder;
12 class CliComm;
13 class Deflicker;
14 class DeinterlacedFrame;
15 class Display;
16 class DoubledFrame;
17 class EventDistributor;
18 class FrameSource;
19 class RawFrame;
20 class RenderSettings;
21 class SuperImposedFrame;
22 
29 class PostProcessor : public VideoLayer, private Schedulable
30 {
31 public:
32  ~PostProcessor() override;
33 
44  virtual std::unique_ptr<RawFrame> rotateFrames(
45  std::unique_ptr<RawFrame> finishedFrame, EmuTime::param time);
46 
53  void setSuperimposeVideoFrame(const RawFrame* videoSource) {
54  superImposeVideoFrame = videoSource;
55  }
56 
62  void setSuperimposeVdpFrame(const FrameSource* vdpSource) {
63  superImposeVdpFrame = vdpSource;
64  }
65 
71  void setRecorder(AviRecorder* recorder_) { recorder = recorder_; }
72 
76  bool isRecording() const { return recorder != nullptr; }
77 
81  unsigned getBpp() const;
82 
87  FrameSource* getPaintFrame() const { return paintFrame; }
88 
89  // VideoLayer
90  void takeRawScreenShot(unsigned height, const std::string& filename) override;
91 
92 
94 
95 protected:
98  static unsigned getLineWidth(FrameSource* frame, unsigned y, unsigned step);
99 
101  MSXMotherBoard& motherBoard, Display& display,
102  OutputSurface& screen, const std::string& videoSource,
103  unsigned maxWidth, unsigned height, bool canDoInterlace);
104 
107 
110 
112  std::unique_ptr<RawFrame> lastFrames[4];
113 
115  std::unique_ptr<DeinterlacedFrame> deinterlacedFrame;
116 
118  std::unique_ptr<DoubledFrame> interlacedFrame;
119 
121  std::unique_ptr<Deflicker> deflicker;
122 
124  std::unique_ptr<SuperImposedFrame> superImposedFrame;
125 
131 
134 
139 
140  int interleaveCount; // for interleave-black-frame
141  int lastFramesCount; // How many items in lastFrames[] are up-to-date
142  int maxWidth; // we lazily create RawFrame objects in lastFrames[]
143  int height; // these two vars remember how big those should be
144 
145 private:
146  // Schedulable
147  void executeUntil(EmuTime::param time) override;
148 
149  Display& display;
150 
155  const bool canDoInterlace;
156 
157  EmuTime lastRotate;
158  EventDistributor& eventDistributor;
159 };
160 
161 } // namespace openmsx
162 
163 #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:33
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.