33 unsigned maxWidth_,
unsigned height_,
bool canDoInterlace_)
36 , renderSettings(display_.getRenderSettings())
40 , superImposeVideoFrame(nullptr)
41 , superImposeVdpFrame(nullptr)
47 , canDoInterlace(canDoInterlace_)
48 , lastRotate(motherBoard_.getCurrentTime())
49 , eventDistributor(motherBoard_.getReactor().getEventDistributor())
73 "Videorecording stopped, because you "
74 "changed machine or changed a video setting "
96 std::unique_ptr<RawFrame> finishedFrame, EmuTime::param time)
99 auto delta = time - lastRotate;
100 auto middle = time + delta / 2;
108 bool doDeinterlace =
false;
109 bool doInterlace =
false;
110 bool doDeflicker =
false;
111 auto currType = finishedFrame->getField();
112 if (canDoInterlace) {
115 doDeinterlace =
true;
131 assert(recycleIdx < 4);
132 auto recycleFrame = std::move(
lastFrames[recycleIdx]);
154 doDeinterlace =
false;
167 }
else if (doInterlace) {
172 }
else if (doDeflicker) {
189 "Recording stopped with error: ",
197 if (canDoInterlace) {
199 recycleFrame = std::make_unique<RawFrame>(
208 void PostProcessor::executeUntil(EmuTime::param )
212 Event::create<FinishFrameEvent>(
216 using WorkBuffer = std::vector<MemBuffer<char, SSE_ALIGNMENT>>;
217 static void getScaledFrame(
FrameSource& paintFrame,
unsigned bpp,
218 unsigned height,
const void** lines,
221 unsigned width = (height == 240) ? 320 : 640;
222 unsigned pitch = width * ((bpp == 32) ? 4 : 2);
223 const void* line =
nullptr;
224 void* work =
nullptr;
225 for (
auto i :
xrange(height)) {
229 work = workBuffer.emplace_back(pitch).data();
234 auto* work2 =
static_cast<uint32_t*
>(work);
238 assert (height == 480);
246 auto* work2 =
static_cast<uint16_t*
>(work);
250 assert (height == 480);
265 VLA(
const void*, lines, height2);
268 unsigned width = (height2 == 240) ? 320 : 640;
void addImage(FrameSource *frame, EmuTime::param time)
void printWarning(std::string_view message)
static std::unique_ptr< Deflicker > create(const PixelFormat &format, std::unique_ptr< RawFrame > *lastFrames)
Represents the output window/screen of openMSX.
CliComm & getCliComm() const
void distributeEvent(Event &&event)
Schedule the given event for delivery.
Interface for getting lines from a video frame.
virtual unsigned getLineWidth(unsigned line) const =0
Gets the number of display pixels on the given line.
const Pixel * getLinePtr320_240(unsigned line, Pixel *buf) const
Get a pointer to a given line in this frame, the frame is scaled to 320x240 pixels.
const PixelFormat & getPixelFormat() const
const Pixel * getLinePtr640_480(unsigned line, Pixel *buf) const
Get a pointer to a given line in this frame, the frame is scaled to 640x480 pixels.
@ FIELD_NONINTERLACED
Interlacing is off for this frame.
@ FIELD_ODD
Interlacing is on and this is an odd frame.
const std::string & getMessage() const &
A frame buffer where pixels can be written to.
const PixelFormat & getPixelFormat() const
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.
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).
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.
std::unique_ptr< Deflicker > deflicker
Combine the last 4 frames into one 'flicker-free' frame.
AviRecorder * recorder
Video recorder, nullptr when not recording.
~PostProcessor() override
OutputSurface & screen
The surface which is visible to the user.
bool getDeflicker() const
Deflicker [on, off].
bool getDeinterlace() const
Deinterlacing [on, off].
bool getInterleaveBlackFrame() const
Is black frame interleaving enabled?
Every class that wants to get scheduled at some point must inherit from this class.
void setSyncPoint(EmuTime::param timestamp)
static std::unique_ptr< SuperImposedFrame > create(const PixelFormat &format)
int getVideoSource() const
Returns the ID for this videolayer.
int getVideoSourceSetting() const
constexpr vecN< N, T > max(const vecN< N, T > &x, const vecN< N, T > &y)
This file implemented 3 utility functions:
std::vector< MemBuffer< char, SSE_ALIGNMENT > > WorkBuffer
const T & get(const Event &event)
constexpr const char *const filename
#define VLA(TYPE, NAME, LENGTH)
constexpr auto xrange(T e)