openMSX
Public Types | Public Member Functions | Protected Member Functions | List of all members
openmsx::FrameSource Class Referenceabstract

Interface for getting lines from a video frame. More...

#include <FrameSource.hh>

Inheritance diagram for openmsx::FrameSource:
Inheritance graph
[legend]

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<typename Pixel >
Pixel getLineColor (unsigned line) const
 Get the (single) color of the given line. More...
 
template<typename Pixel >
const PixelgetLinePtr (int line, unsigned width, Pixel *buf) const
 Gets a pointer to the pixels of the given line number. More...
 
template<typename Pixel >
const PixelgetMultiLinePtr (int line, unsigned numLines, unsigned &actualLines, unsigned width, Pixel *buf) const
 Similar to the above getLinePtr() method, but now tries to get multiple lines at once. More...
 
virtual const void * getLineInfo (unsigned line, unsigned &lineWidth, void *buf, unsigned bufWidth) const =0
 Abstract implementation of getLinePtr(). More...
 
template<typename Pixel >
const PixelgetLinePtr320_240 (unsigned line, Pixel *buf) const
 Get a pointer to a given line in this frame, the frame is scaled to 320x240 pixels. More...
 
template<typename Pixel >
const PixelgetLinePtr640_480 (unsigned line, Pixel *buf) const
 Get a pointer to a given line in this frame, the frame is scaled to 640x480 pixels. More...
 
template<typename Pixel >
const PixelgetLinePtr960_720 (unsigned line, Pixel *buf) const
 Get a pointer to a given line in this frame, the frame is scaled to 960x720 pixels. More...
 
virtual unsigned getRowLength () const
 Returns the distance (in pixels) between two consecutive lines. More...
 
const SDL_PixelFormat & getSDLPixelFormat () const
 

Protected Member Functions

 FrameSource (const SDL_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<typename Pixel >
void scaleLine (const Pixel *in, Pixel *out, unsigned inWidth, unsigned outWidth) const
 

Detailed Description

Interface for getting lines from a video frame.

Definition at line 14 of file FrameSource.hh.

Member Enumeration Documentation

◆ FieldType

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 19 of file FrameSource.hh.

Constructor & Destructor Documentation

◆ FrameSource()

openmsx::FrameSource::FrameSource ( const SDL_PixelFormat &  format)
explicitprotected

Definition at line 15 of file FrameSource.cc.

Referenced by getSDLPixelFormat().

◆ ~FrameSource()

openmsx::FrameSource::~FrameSource ( )
protecteddefault

Referenced by getSDLPixelFormat().

Member Function Documentation

◆ getField()

FieldType openmsx::FrameSource::getField ( ) const
inline

Gets the role this frame plays in interlacing.

Definition at line 38 of file FrameSource.hh.

◆ getHeight()

unsigned openmsx::FrameSource::getHeight ( ) const
inline

◆ getLineColor()

template<typename Pixel >
Pixel openmsx::FrameSource::getLineColor ( unsigned  line) const
inline

◆ getLineInfo()

virtual const void* openmsx::FrameSource::getLineInfo ( unsigned  line,
unsigned &  lineWidth,
void *  buf,
unsigned  bufWidth 
) const
pure virtual

Abstract implementation of getLinePtr().

Pixel type is unspecified (implementations that care about the exact type should get it via some other mechanism).

Parameters
lineThe line number for the requisted line.
lineWidthOutput parameter, the width of the returned line in pixel units.
bufBuffer space that can optionally be used by the implementation.
bufWidthThe size of the above buffer, in pixel units.
Returns
Pointer to the first pixel of the requested line. This might be the same as the given 'buf' parameter or it might be some internal buffer.

Implemented in openmsx::RawFrame, and openmsx::SuperImposedVideoFrame< Pixel >.

Referenced by getLineColor(), openmsx::SuperImposedVideoFrame< Pixel >::getLineInfo(), getLinePtr(), getMultiLinePtr(), openmsx::DeinterlacedFrame::init(), and openmsx::DoubledFrame::init().

◆ getLinePtr()

template<typename Pixel >
const Pixel* openmsx::FrameSource::getLinePtr ( int  line,
unsigned  width,
Pixel buf 
) const
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 91 of file FrameSource.hh.

References getHeight(), getLineInfo(), gl::max(), and scaleLine().

Referenced by openmsx::calcEdgesGL(), openmsx::SuperImposedVideoFrame< Pixel >::getLineInfo(), getLinePtr320_240(), getLinePtr640_480(), getLinePtr960_720(), getMultiLinePtr(), openmsx::RGBTriplet3xScaler< Pixel >::RGBTriplet3xScaler(), openmsx::Scaler1< Pixel >::scale1x1to1x1(), openmsx::Scaler2< Pixel >::scale1x1to1x1(), openmsx::Scale2xScaler< Pixel >::scale1x1to1x2(), openmsx::SaI2xScaler< Pixel >::scale1x1to1x2(), openmsx::Scaler2< Pixel >::scale1x1to1x2(), openmsx::Scale2xScaler< Pixel >::scale1x1to2x2(), openmsx::SaI2xScaler< Pixel >::scale1x1to2x2(), openmsx::Scale3xScaler< Pixel >::scale1x1to3x3(), openmsx::Scaler1< Pixel >::scale1x2to1x1(), openmsx::Scaler2< Pixel >::scaleBlank1to1(), openmsx::Scaler1< Pixel >::scaleBlank2to1(), openmsx::Scaler3< Pixel >::scaleBlank2to3(), openmsx::LineRepeater< 0 >::scaleFixedLine(), openmsx::MLAAScaler< Pixel >::scaleImage(), openmsx::Simple2xScaler< Pixel >::Simple2xScaler(), openmsx::Simple3xScaler< Pixel >::Simple3xScaler(), openmsx::SuperImposedFrameImpl< Pixel >::SuperImposedFrameImpl(), openmsx::GLPostProcessor::update(), openmsx::GLHQScaler::uploadBlock(), and openmsx::GLHQLiteScaler::uploadBlock().

◆ getLinePtr320_240()

template<typename Pixel >
template const uint32_t * openmsx::FrameSource::getLinePtr320_240< uint32_t > ( unsigned  line,
Pixel 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 21 of file FrameSource.cc.

References getHeight(), getLinePtr(), and SSE_ALIGNMENT.

Referenced by openmsx::SuperImposeScalerOutput< Pixel >::fillLine(), getMultiLinePtr(), and openmsx::ZMBVEncoder::ZMBVEncoder().

◆ getLinePtr640_480()

template<typename Pixel >
template const uint32_t * openmsx::FrameSource::getLinePtr640_480< uint32_t > ( unsigned  line,
Pixel 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 38 of file FrameSource.cc.

References getHeight(), and getLinePtr().

Referenced by openmsx::SuperImposeScalerOutput< Pixel >::fillLine(), getMultiLinePtr(), and openmsx::ZMBVEncoder::ZMBVEncoder().

◆ getLinePtr960_720()

template<typename Pixel >
template const uint32_t * openmsx::FrameSource::getLinePtr960_720< uint32_t > ( unsigned  line,
Pixel 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 49 of file FrameSource.cc.

References getHeight(), getLinePtr(), and SSE_ALIGNMENT.

Referenced by openmsx::SuperImposeScalerOutput< Pixel >::fillLine(), getMultiLinePtr(), and openmsx::ZMBVEncoder::ZMBVEncoder().

◆ getLineWidth()

virtual unsigned openmsx::FrameSource::getLineWidth ( unsigned  line) const
pure virtual

◆ getMultiLinePtr()

template<typename Pixel >
const Pixel* openmsx::FrameSource::getMultiLinePtr ( int  line,
unsigned  numLines,
unsigned &  actualLines,
unsigned  width,
Pixel buf 
) const
inline

Similar to the above getLinePtr() method, but now tries to get multiple lines at once.

This is not always possible, so the actual number of lines is returned in 'actualLines', it will always be at least 1.

Definition at line 113 of file FrameSource.hh.

References getLineInfo(), getLinePtr(), getLinePtr320_240(), getLinePtr640_480(), getLinePtr960_720(), getLineWidth(), hasContiguousStorage(), and scaleLine().

Referenced by openmsx::GLPostProcessor::update().

◆ getRowLength()

virtual unsigned openmsx::FrameSource::getRowLength ( ) const
inlinevirtual

Returns the distance (in pixels) between two consecutive lines.

Is meant to be used in combination with getMultiLinePtr(). The result is only meaningful when hasContiguousStorage() returns true (also only in that case does getMultiLinePtr() return more than 1 line).

Reimplemented in openmsx::RawFrame.

Definition at line 186 of file FrameSource.hh.

Referenced by openmsx::GLPostProcessor::update().

◆ getSDLPixelFormat()

const SDL_PixelFormat& openmsx::FrameSource::getSDLPixelFormat ( ) const
inline

◆ getWidth()

unsigned openmsx::FrameSource::getWidth ( ) const
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 59 of file FrameSource.hh.

References getLineWidth().

Referenced by openmsx::GLPostProcessor::update().

◆ hasContiguousStorage()

virtual bool openmsx::FrameSource::hasContiguousStorage ( ) const
inlineprotectedvirtual

Returns true when two consecutive rows are also consecutive in memory.

Reimplemented in openmsx::RawFrame.

Definition at line 203 of file FrameSource.hh.

References scaleLine().

Referenced by getMultiLinePtr().

◆ init()

void openmsx::FrameSource::init ( FieldType  fieldType_)
inline

(Re)initialize an existing FrameSource.

This method sets the Fieldtype and flushes the 'getLinePtr' buffers.

Definition at line 34 of file FrameSource.hh.

Referenced by openmsx::DeinterlacedFrame::init(), openmsx::DoubledFrame::init(), openmsx::Deflicker::init(), and openmsx::RawFrame::RawFrame().

◆ scaleLine()

template<typename Pixel >
template void openmsx::FrameSource::scaleLine< uint32_t > ( const Pixel in,
Pixel out,
unsigned  inWidth,
unsigned  outWidth 
) const
protected

◆ setHeight()

void openmsx::FrameSource::setHeight ( unsigned  height_)
inlineprotected

The documentation for this class was generated from the following files: