56 [[nodiscard]]
virtual unsigned getLineWidth(
unsigned line)
const = 0;
67 for (
auto line :
xrange(1u, height)) {
78 template<std::
unsigned_
integral Pixel>
82 return reinterpret_cast<const Pixel*
>(
95 template<std::
unsigned_
integral Pixel>
96 [[nodiscard]]
inline std::span<const Pixel>
getLine(
int line, std::span<Pixel> buf)
const
99 unsigned internalWidth;
100 auto* internalData =
reinterpret_cast<const Pixel*
>(
101 getLineInfo(line, internalWidth, buf.data(), narrow<unsigned>(buf.size())));
102 if (internalWidth == narrow<unsigned>(buf.size())) {
103 return std::span{internalData, buf.size()};
107 scaleLine(std::span{internalData, internalWidth}, buf);
126 unsigned line,
unsigned& lineWidth,
127 void* buf,
unsigned bufWidth)
const = 0;
134 template<std::
unsigned_
integral Pixel>
135 [[nodiscard]] std::span<const Pixel, 320>
getLinePtr320_240(
unsigned line, std::span<Pixel, 320> buf)
const;
141 template<std::
unsigned_
integral Pixel>
142 [[nodiscard]] std::span<const Pixel, 640>
getLinePtr640_480(
unsigned line, std::span<Pixel, 640> buf)
const;
148 template<std::
unsigned_
integral Pixel>
149 [[nodiscard]] std::span<const Pixel, 960>
getLinePtr960_720(
unsigned line, std::span<Pixel, 960> buf)
const;
168 template<std::
unsigned_
integral Pixel>
void scaleLine(
169 std::span<const Pixel> in, std::span<Pixel> out)
const;
Interface for getting lines from a video frame.
virtual bool hasContiguousStorage() const
Returns true when two consecutive rows are also consecutive in memory.
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.
Pixel getLineColor(unsigned line) const
Get the (single) color of the given line.
void scaleLine(std::span< const Pixel > in, std::span< Pixel > out) const
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.
FrameSource(const PixelFormat &format)
std::span< const Pixel > getLine(int line, std::span< Pixel > buf) const
Gets a pointer to the pixels of the given line number.
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.
void setHeight(unsigned height_)
unsigned getWidth() const
Get the width of (all) lines in this frame.
virtual const void * getLineInfo(unsigned line, unsigned &lineWidth, void *buf, unsigned bufWidth) const =0
Abstract implementation of getLinePtr().
void init(FieldType fieldType_)
(Re)initialize an existing FrameSource.
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.
unsigned getHeight() const
Gets the number of lines in this frame.
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.
const PixelFormat & getPixelFormat() const
constexpr vecN< N, T > clamp(const vecN< N, T > &x, const vecN< N, T > &minVal, const vecN< N, T > &maxVal)
This file implemented 3 utility functions:
constexpr auto xrange(T e)