53 [[nodiscard]]
virtual unsigned getLineWidth(
unsigned line)
const = 0;
64 for (
auto line :
xrange(1u, height)) {
75 template<std::
unsigned_
integral Pixel>
79 return reinterpret_cast<const Pixel*
>(
92 template<std::
unsigned_
integral Pixel>
96 unsigned internalWidth;
97 auto* internalData =
reinterpret_cast<const Pixel*
>(
99 if (internalWidth == width) {
104 scaleLine(internalData, buf, internalWidth, width);
114 template<std::
unsigned_
integral Pixel>
116 int line,
unsigned numLines,
unsigned& actualLines,
117 unsigned width,
Pixel* buf)
const
120 if ((line < 0) || (
int(height) <= line)) {
123 unsigned internalWidth;
124 auto* internalData =
reinterpret_cast<const Pixel*
>(
126 if (internalWidth != width) {
127 scaleLine(internalData, buf, internalWidth, width);
135 if ((line ==
int(height)) || (
getLineWidth(line) != width)) {
157 unsigned line,
unsigned& lineWidth,
158 void* buf,
unsigned bufWidth)
const = 0;
165 template<std::
unsigned_
integral Pixel>
172 template<std::
unsigned_
integral Pixel>
179 template<std::
unsigned_
integral Pixel>
209 template<std::
unsigned_
integral Pixel>
void scaleLine(
211 unsigned inWidth,
unsigned outWidth)
const;
Interface for getting lines from a video frame.
virtual bool hasContiguousStorage() const
Returns true when two consecutive rows are also consecutive in memory.
Pixel getLineColor(unsigned line) const
Get the (single) color of the given line.
const Pixel * getLinePtr960_720(unsigned line, Pixel *buf) const
Get a pointer to a given line in this frame, the frame is scaled to 960x720 pixels.
virtual unsigned getLineWidth(unsigned line) const =0
Gets the number of display pixels on the given line.
FieldType getField() const
Gets the role this frame plays in interlacing.
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.
FrameSource(const PixelFormat &format)
virtual const void * getLineInfo(unsigned line, unsigned &lineWidth, void *buf, unsigned bufWidth) const =0
Abstract implementation of getLinePtr().
const PixelFormat & getPixelFormat() const
void setHeight(unsigned height_)
unsigned getWidth() const
Get the width of (all) lines in this frame.
void scaleLine(const Pixel *in, Pixel *out, unsigned inWidth, unsigned outWidth) const
const Pixel * getMultiLinePtr(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.
void init(FieldType fieldType_)
(Re)initialize an existing FrameSource.
virtual unsigned getRowLength() const
Returns the distance (in pixels) between two consecutive lines.
unsigned getHeight() const
Gets the number of lines in this frame.
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.
const Pixel * getLinePtr(int line, unsigned width, Pixel *buf) const
Gets a pointer to the pixels of the given line number.
FieldType
What role does this frame play in interlacing?
@ 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.
constexpr vecN< N, T > max(const vecN< N, T > &x, const vecN< N, T > &y)
This file implemented 3 utility functions:
constexpr auto xrange(T e)