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
9namespace openmsx {
10
11class AviRecorder;
12class CliComm;
13class Deflicker;
14class DeinterlacedFrame;
15class Display;
16class DoubledFrame;
17class EventDistributor;
18class FrameSource;
19class RawFrame;
20class RenderSettings;
21class SuperImposedFrame;
22
29class PostProcessor : public VideoLayer, private Schedulable
30{
31public:
32 ~PostProcessor() override;
33
44 [[nodiscard]] 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 [[nodiscard]] bool isRecording() const { return recorder != nullptr; }
77
81 [[nodiscard]] unsigned getBpp() const;
82
87 [[nodiscard]] FrameSource* getPaintFrame() const { return paintFrame; }
88
89 // VideoLayer
90 void takeRawScreenShot(unsigned height, const std::string& filename) override;
91
92 [[nodiscard]] CliComm& getCliComm();
93
94protected:
97 [[nodiscard]] static unsigned getLineWidth(FrameSource* frame, unsigned y, unsigned step);
98
100 MSXMotherBoard& motherBoard, Display& display,
101 OutputSurface& screen, const std::string& videoSource,
102 unsigned maxWidth, unsigned height, bool canDoInterlace);
103
104protected:
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
145private:
146 // Schedulable
147 void executeUntil(EmuTime::param time) override;
148
149private:
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
Represents the output window/screen of openMSX.
Definition: Display.hh:33
Interface for getting lines from a video frame.
Definition: FrameSource.hh:17
A frame buffer where pixels can be written to.
Abstract base class for post processors.
virtual std::unique_ptr< RawFrame > rotateFrames(std::unique_ptr< RawFrame > finishedFrame, EmuTime::param time)
Sets up the "abcdFrame" variables for a new frame.
PostProcessor(MSXMotherBoard &motherBoard, Display &display, OutputSurface &screen, const std::string &videoSource, unsigned maxWidth, unsigned height, bool canDoInterlace)
void takeRawScreenShot(unsigned height, const std::string &filename) override
Create a raw (=non-postprocessed) screenshot.
std::unique_ptr< RawFrame > lastFrames[4]
The last 4 fully rendered (unscaled) MSX frames.
FrameSource * paintFrame
Represents a frame as it should be displayed.
std::unique_ptr< SuperImposedFrame > superImposedFrame
Result of superimposing 2 frames.
const RawFrame * superImposeVideoFrame
Video frame on which to superimpose the (VDP) output.
unsigned getBpp() const
Get the number of bits per pixel for the pixels in these frames.
static unsigned getLineWidth(FrameSource *frame, unsigned y, unsigned step)
Returns the maximum width for lines [y..y+step).
void setRecorder(AviRecorder *recorder_)
Start/stop recording.
std::unique_ptr< DeinterlacedFrame > deinterlacedFrame
Combined the last two frames in a deinterlaced frame.
const FrameSource * superImposeVdpFrame
std::unique_ptr< DoubledFrame > interlacedFrame
Each line of the last frame twice, to get double vertical resolution.
RenderSettings & renderSettings
Render settings.
void setSuperimposeVdpFrame(const FrameSource *vdpSource)
Set the VDP frame on which to superimpose the 'normal' output of this PostProcessor.
std::unique_ptr< Deflicker > deflicker
Combine the last 4 frames into one 'flicker-free' frame.
AviRecorder * recorder
Video recorder, nullptr when not recording.
bool isRecording() const
Is recording active.
FrameSource * getPaintFrame() const
Get the frame that would be displayed.
OutputSurface & screen
The surface which is visible to the user.
void setSuperimposeVideoFrame(const RawFrame *videoSource)
Set the Video frame on which to superimpose the 'normal' output of this PostProcessor.
A video frame as output by the VDP scanline conversion unit, before any postprocessing filters are ap...
Definition: RawFrame.hh:15
Class containing all settings for renderers.
Every class that wants to get scheduled at some point must inherit from this class.
Definition: Schedulable.hh:34
constexpr auto step
Definition: eeprom.cc:9
This file implemented 3 utility functions:
Definition: Autofire.cc:9
constexpr const char *const filename