openMSX
|
Interface for getting lines from a video frame. More...
#include <FrameSource.hh>
Public Types | |
enum | FieldType { FIELD_NONINTERLACED , FIELD_EVEN , FIELD_ODD } |
What role does this frame play in interlacing? More... | |
Public Member Functions | |
void | init (FieldType fieldType_) |
(Re)initialize an existing FrameSource. More... | |
FieldType | getField () const |
Gets the role this frame plays in interlacing. More... | |
unsigned | getHeight () const |
Gets the number of lines in this frame. More... | |
virtual unsigned | getLineWidth (unsigned line) const =0 |
Gets the number of display pixels on the given line. More... | |
unsigned | getWidth () const |
Get the width of (all) lines in this frame. More... | |
template<std::unsigned_integral Pixel> | |
Pixel | getLineColor (unsigned line) const |
Get the (single) color of the given line. More... | |
template<std::unsigned_integral Pixel> | |
std::span< const Pixel > | getLine (int line, std::span< Pixel > buf) const |
Gets a pointer to the pixels of the given line number. More... | |
virtual const void * | getLineInfo (unsigned line, unsigned &lineWidth, void *buf, unsigned bufWidth) const =0 |
Abstract implementation of getLinePtr(). More... | |
template<std::unsigned_integral Pixel> | |
std::span< const Pixel, 320 > | getLinePtr320_240 (unsigned line, std::span< Pixel, 320 > buf) const |
Get a pointer to a given line in this frame, the frame is scaled to 320x240 pixels. More... | |
template<std::unsigned_integral Pixel> | |
std::span< const Pixel, 640 > | getLinePtr640_480 (unsigned line, std::span< Pixel, 640 > buf) const |
Get a pointer to a given line in this frame, the frame is scaled to 640x480 pixels. More... | |
template<std::unsigned_integral Pixel> | |
std::span< const Pixel, 960 > | getLinePtr960_720 (unsigned line, std::span< Pixel, 960 > buf) const |
Get a pointer to a given line in this frame, the frame is scaled to 960x720 pixels. More... | |
const PixelFormat & | getPixelFormat () const |
Protected Member Functions | |
FrameSource (const PixelFormat &format) | |
~FrameSource ()=default | |
void | setHeight (unsigned height_) |
virtual bool | hasContiguousStorage () const |
Returns true when two consecutive rows are also consecutive in memory. More... | |
template<std::unsigned_integral Pixel> | |
void | scaleLine (std::span< const Pixel > in, std::span< Pixel > out) const |
Interface for getting lines from a video frame.
Definition at line 19 of file FrameSource.hh.
What role does this frame play in interlacing?
Enumerator | |
---|---|
FIELD_NONINTERLACED | Interlacing is off for this frame. |
FIELD_EVEN | Interlacing is on and this is an even frame. |
FIELD_ODD | Interlacing is on and this is an odd frame. |
Definition at line 24 of file FrameSource.hh.
|
explicitprotected |
Definition at line 17 of file FrameSource.cc.
References openmsx::DiskImageUtils::format().
|
protecteddefault |
|
inline |
Gets the role this frame plays in interlacing.
Definition at line 43 of file FrameSource.hh.
|
inline |
Gets the number of lines in this frame.
Definition at line 49 of file FrameSource.hh.
Referenced by openmsx::Scaler1< Pixel >::dispatchScale(), openmsx::Scaler2< Pixel >::dispatchScale(), openmsx::Scaler3< Pixel >::dispatchScale(), getLine(), openmsx::RawFrame::getLineDirect(), openmsx::RawFrame::getLineInfo(), getLinePtr320_240(), getLinePtr640_480(), getLinePtr960_720(), openmsx::RawFrame::getLineWidth(), openmsx::RawFrame::getLineWidthDirect(), openmsx::Deflicker::init(), openmsx::SuperImposedFrame::init(), openmsx::DeinterlacedFrame::init(), openmsx::DoubledFrame::init(), openmsx::GLPostProcessor::paint(), openmsx::RawFrame::setBlank(), openmsx::RawFrame::setLineWidth(), and openmsx::SuperImposedVideoFrame< Pixel >::SuperImposedVideoFrame().
|
inline |
Gets a pointer to the pixels of the given line number.
The line returned is guaranteed to have the given width. If the original line had a different width the result will be computed in the provided work buffer. So that buffer should be big enough to hold the scaled line. This also means the lifetime of the result is tied to the lifetime of that work buffer. In any case the return value of this function will point to the line data (some internal buffer or the work buffer).
Definition at line 96 of file FrameSource.hh.
References gl::clamp(), getHeight(), getLineInfo(), and scaleLine().
Referenced by openmsx::doHQScale2(), openmsx::doHQScale3(), getLinePtr320_240(), getLinePtr640_480(), getLinePtr960_720(), openmsx::Scaler1< Pixel >::scale1x1to1x1(), openmsx::Scaler2< Pixel >::scale1x1to1x1(), openmsx::Scaler2< Pixel >::scale1x1to1x2(), openmsx::SaI2xScaler< Pixel >::scale1x1to1x2(), openmsx::Scale2xScaler< Pixel >::scale1x1to1x2(), openmsx::SaI2xScaler< Pixel >::scale1x1to2x2(), openmsx::Scale2xScaler< Pixel >::scale1x1to2x2(), openmsx::Scale3xScaler< Pixel >::scale1x1to3x3(), openmsx::Scaler1< Pixel >::scale1x2to1x1(), openmsx::MLAAScaler< Pixel >::scaleImage(), openmsx::GLHQLiteScaler::uploadBlock(), and openmsx::GLHQScaler::uploadBlock().
|
inline |
Get the (single) color of the given line.
Typically this will be used to get the color of a vertical border line. But it's fine to call this on non-border lines as well, in that case the color of the first pixel of the line is returned.
Definition at line 79 of file FrameSource.hh.
References ALIGNAS_SSE, and getLineInfo().
Referenced by openmsx::Scaler1< Pixel >::scaleBlank1to1(), openmsx::Scaler2< Pixel >::scaleBlank1to1(), openmsx::Scaler2< Pixel >::scaleBlank1to2(), openmsx::SaI2xScaler< Pixel >::scaleBlank1to2(), openmsx::Scaler3< Pixel >::scaleBlank1to3(), openmsx::RGBTriplet3xScaler< Pixel >::scaleBlank1to3(), openmsx::SaI3xScaler< Pixel >::scaleBlank1to3(), openmsx::Scaler1< Pixel >::scaleBlank2to1(), openmsx::Scaler3< Pixel >::scaleBlank2to3(), and openmsx::RGBTriplet3xScaler< Pixel >::scaleBlank2to3().
|
pure virtual |
Abstract implementation of getLinePtr().
Pixel type is unspecified (implementations that care about the exact type should get it via some other mechanism).
line | The line number for the requested line. |
lineWidth | Output parameter, the width of the returned line in pixel units. |
buf | Buffer space that can optionally be used by the implementation. |
bufWidth | The size of the above buffer, in pixel units. |
Implemented in openmsx::RawFrame, and openmsx::SuperImposedVideoFrame< Pixel >.
Referenced by getLine(), and getLineColor().
template std::span< const uint32_t, 320 > openmsx::FrameSource::getLinePtr320_240< uint32_t > | ( | unsigned | line, |
std::span< Pixel, 320 > | buf | ||
) | const |
Get a pointer to a given line in this frame, the frame is scaled to 320x240 pixels.
The difference between this method and getLinePtr() is that this method also does vertical scaling. This is used for video recording.
Definition at line 23 of file FrameSource.cc.
References ALIGNAS_SSE, getHeight(), and getLine().
template std::span< const uint32_t, 640 > openmsx::FrameSource::getLinePtr640_480< uint32_t > | ( | unsigned | line, |
std::span< Pixel, 640 > | buf | ||
) | const |
Get a pointer to a given line in this frame, the frame is scaled to 640x480 pixels.
Same as getLinePtr320_240, but then for a higher resolution output.
Definition at line 42 of file FrameSource.cc.
References getHeight(), and getLine().
template std::span< const uint32_t, 960 > openmsx::FrameSource::getLinePtr960_720< uint32_t > | ( | unsigned | line, |
std::span< Pixel, 960 > | buf | ||
) | const |
Get a pointer to a given line in this frame, the frame is scaled to 960x720 pixels.
Same as getLinePtr320_240, but then for a higher resolution output.
Definition at line 57 of file FrameSource.cc.
References ALIGNAS_SSE, getHeight(), and getLine().
|
pure virtual |
Gets the number of display pixels on the given line.
Implemented in openmsx::Deflicker, openmsx::RawFrame, and openmsx::SuperImposedVideoFrame< Pixel >.
Referenced by getWidth(), openmsx::SaI2xScaler< Pixel >::scaleBlank1to2(), openmsx::RGBTriplet3xScaler< Pixel >::scaleBlank1to3(), and openmsx::SaI3xScaler< Pixel >::scaleBlank1to3().
|
inline |
Definition at line 151 of file FrameSource.hh.
Referenced by openmsx::yuv2rgb::convert(), and openmsx::PostProcessor::takeRawScreenShot().
|
inline |
Get the width of (all) lines in this frame.
This only makes sense when all lines have the same width, so this methods asserts that all lines actually have the same width. This is for example not always the case for MSX frames, but it is for video frames (for superimpose).
Definition at line 64 of file FrameSource.hh.
References getLineWidth(), and xrange().
|
inlineprotectedvirtual |
Returns true when two consecutive rows are also consecutive in memory.
Reimplemented in openmsx::RawFrame.
Definition at line 164 of file FrameSource.hh.
|
inline |
(Re)initialize an existing FrameSource.
This method sets the Fieldtype and flushes the 'getLinePtr' buffers.
Definition at line 39 of file FrameSource.hh.
Referenced by openmsx::Deflicker::init(), openmsx::DeinterlacedFrame::init(), openmsx::DoubledFrame::init(), and openmsx::RawFrame::RawFrame().
|
protected |
Definition at line 81 of file FrameSource.cc.
References ranges::copy(), gl::scale(), UNREACHABLE, and VLA_SSE_ALIGNED.
Referenced by getLine().
|
inlineprotected |
Definition at line 159 of file FrameSource.hh.
Referenced by openmsx::Deflicker::init(), openmsx::SuperImposedFrame::init(), openmsx::DeinterlacedFrame::init(), openmsx::DoubledFrame::init(), openmsx::RawFrame::RawFrame(), and openmsx::SuperImposedVideoFrame< Pixel >::SuperImposedVideoFrame().