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 <array>
8#include <memory>
9
10namespace openmsx {
11
12class AviRecorder;
13class CliComm;
14class Deflicker;
15class DeinterlacedFrame;
16class Display;
17class DoubledFrame;
18class EventDistributor;
19class FrameSource;
20class RawFrame;
21class RenderSettings;
22class SuperImposedFrame;
23
30class PostProcessor : public VideoLayer, private Schedulable
31{
32public:
33 ~PostProcessor() override;
34
45 [[nodiscard]] 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 [[nodiscard]] bool isRecording() const { return recorder != nullptr; }
78
82 [[nodiscard]] unsigned getBpp() const;
83
88 [[nodiscard]] FrameSource* getPaintFrame() const { return paintFrame; }
89
90 // VideoLayer
91 void takeRawScreenShot(unsigned height, const std::string& filename) override;
92
93 [[nodiscard]] CliComm& getCliComm();
94
95protected:
98 [[nodiscard]] 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
105protected:
108
111
113 std::array<std::unique_ptr<RawFrame>, 4> lastFrames;
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 = 0; // for interleave-black-frame
142 int lastFramesCount = 0; // How many items in lastFrames[] are up-to-date
143 unsigned maxWidth; // we lazily create RawFrame objects in lastFrames[]
144 unsigned height; // these two vars remember how big those should be
145
146private:
147 // Schedulable
148 void executeUntil(EmuTime::param time) override;
149
150private:
151 Display& display;
152
157 const bool canDoInterlace;
158
159 EmuTime lastRotate;
160 EventDistributor& eventDistributor;
161};
162
163} // namespace openmsx
164
165#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:20
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-post-processed) screenshot.
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::array< std::unique_ptr< RawFrame >, 4 > lastFrames
The last 4 fully rendered (unscaled) MSX frames.
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
This file implemented 3 utility functions:
Definition: Autofire.cc:9