15template<std::
unsigned_
integral Pixel>
33template<std::
unsigned_
integral Pixel>
38 for (
unsigned srcY = srcStartY, dstY = dstStartY;
39 dstY < dstEndY; srcY += 1, dstY += 1) {
45template<std::
unsigned_
integral Pixel>
50 for (
unsigned srcY = srcStartY, dstY = dstStartY;
51 dstY < dstEndY; srcY += 2, dstY += 1) {
54 Pixel color01 = pixelOps.template blend<1, 1>(color0, color1);
59template<std::
unsigned_
integral Pixel>
61 unsigned srcStartY,
unsigned ,
unsigned srcWidth,
66 for (
unsigned srcY = srcStartY, dstY = dstStartY;
67 dstY < dstEndY; ++srcY, ++dstY) {
68 auto srcLine = src.
getLine(srcY, buf);
70 scale(srcLine, dstLine);
75template<std::
unsigned_
integral Pixel>
76static void doScaleDV(FrameSource& src,
77 unsigned srcStartY,
unsigned ,
unsigned srcWidth,
78 ScalerOutput<Pixel>& dst,
unsigned dstStartY,
unsigned dstEndY,
79 PixelOperations<Pixel> ops, PolyLineScaler<Pixel>&
scale)
81 BlendLines<Pixel> blend(ops);
82 unsigned dstWidth = dst.getWidth();
85 auto buf0 = buf02.subspan(0, srcWidth);
86 auto buf2 = buf02.subspan(0, dstWidth);
87 for (
unsigned srcY = srcStartY, dstY = dstStartY;
88 dstY < dstEndY; srcY += 2, dstY += 1) {
89 auto srcLine0 = src.getLine(srcY + 0, buf0);
90 auto srcLine1 = src.getLine(srcY + 1, buf1);
91 auto dstLine = dst.acquireLine(dstY);
92 scale(srcLine0, dstLine);
93 scale(srcLine1, buf2);
94 blend(dstLine, buf0, dstLine);
95 dst.releaseLine(dstY, dstLine);
100template<std::
unsigned_
integral Pixel>
102 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
106 doScale1<Pixel>(src, srcStartY, srcEndY, srcWidth,
107 dst, dstStartY, dstEndY, op);
110template<std::
unsigned_
integral Pixel>
112 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
116 doScaleDV<Pixel>(src, srcStartY, srcEndY, srcWidth,
117 dst, dstStartY, dstEndY, pixelOps, op);
120template<std::
unsigned_
integral Pixel>
122 unsigned srcStartY,
unsigned ,
unsigned srcWidth,
127 assert(dst.
getWidth() == srcWidth); (void)srcWidth;
129 for (
unsigned srcY = srcStartY, dstY = dstStartY;
130 dstY < dstEndY; ++srcY, ++dstY) {
132 auto srcLine = src.
getLine(srcY, dstLine);
133 if (srcLine.data() != dstLine.data())
copy(srcLine, dstLine);
138template<std::
unsigned_
integral Pixel>
140 unsigned srcStartY,
unsigned ,
unsigned srcWidth,
146 for (
auto dstY :
xrange(dstStartY, dstEndY)) {
148 auto srcLine0 = src.
getLine(srcStartY++, dstLine);
149 auto srcLine1 = src.
getLine(srcStartY++, buf);
150 blend(srcLine0, srcLine1, dstLine);
155template<std::
unsigned_
integral Pixel>
157 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
161 doScale1<Pixel>(src, srcStartY, srcEndY, srcWidth,
162 dst, dstStartY, dstEndY, op);
165template<std::
unsigned_
integral Pixel>
167 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
171 doScaleDV<Pixel>(src, srcStartY, srcEndY, srcWidth,
172 dst, dstStartY, dstEndY, pixelOps, op);
175template<std::
unsigned_
integral Pixel>
177 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
181 doScale1<Pixel>(src, srcStartY, srcEndY, srcWidth,
182 dst, dstStartY, dstEndY, op);
185template<std::
unsigned_
integral Pixel>
187 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
191 doScaleDV<Pixel>(src, srcStartY, srcEndY, srcWidth,
192 dst, dstStartY, dstEndY, pixelOps, op);
195template<std::
unsigned_
integral Pixel>
197 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
201 doScale1<Pixel>(src, srcStartY, srcEndY, srcWidth,
202 dst, dstStartY, dstEndY, op);
205template<std::
unsigned_
integral Pixel>
207 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
211 doScaleDV<Pixel>(src, srcStartY, srcEndY, srcWidth,
212 dst, dstStartY, dstEndY, pixelOps, op);
215template<std::
unsigned_
integral Pixel>
217 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
221 doScale1<Pixel>(src, srcStartY, srcEndY, srcWidth,
222 dst, dstStartY, dstEndY, op);
225template<std::
unsigned_
integral Pixel>
227 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
231 doScaleDV<Pixel>(src, srcStartY, srcEndY, srcWidth,
232 dst, dstStartY, dstEndY, pixelOps, op);
235template<std::
unsigned_
integral Pixel>
237 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
243 scaleBlank1to1(src, srcStartY, srcEndY,
244 dst, dstStartY, dstEndY);
247 scale2x1to3x1(src, srcStartY, srcEndY, srcWidth,
248 dst, dstStartY, dstEndY);
251 scale1x1to1x1(src, srcStartY, srcEndY, srcWidth,
252 dst, dstStartY, dstEndY);
255 scale4x1to3x1(src, srcStartY, srcEndY, srcWidth,
256 dst, dstStartY, dstEndY);
259 scale2x1to1x1(src, srcStartY, srcEndY, srcWidth,
260 dst, dstStartY, dstEndY);
263 scale8x1to3x1(src, srcStartY, srcEndY, srcWidth,
264 dst, dstStartY, dstEndY);
267 scale4x1to1x1(src, srcStartY, srcEndY, srcWidth,
268 dst, dstStartY, dstEndY);
277 scaleBlank2to1(src, srcStartY, srcEndY,
278 dst, dstStartY, dstEndY);
281 scale2x2to3x1(src, srcStartY, srcEndY, srcWidth,
282 dst, dstStartY, dstEndY);
285 scale1x2to1x1(src, srcStartY, srcEndY, srcWidth,
286 dst, dstStartY, dstEndY);
289 scale4x2to3x1(src, srcStartY, srcEndY, srcWidth,
290 dst, dstStartY, dstEndY);
293 scale2x2to1x1(src, srcStartY, srcEndY, srcWidth,
294 dst, dstStartY, dstEndY);
297 scale8x2to3x1(src, srcStartY, srcEndY, srcWidth,
298 dst, dstStartY, dstEndY);
301 scale4x2to1x1(src, srcStartY, srcEndY, srcWidth,
302 dst, dstStartY, dstEndY);
310template<std::
unsigned_
integral Pixel>
312 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
317 dst, *superImpose, pixelOps);
318 dispatchScale(src, srcStartY, srcEndY, srcWidth,
319 dst2, dstStartY, dstEndY);
321 dispatchScale(src, srcStartY, srcEndY, srcWidth,
322 dst, dstStartY, dstEndY);
BlendLines functor Generate an output line that is an interpolation of two input lines.
Interface for getting lines from a video frame.
Pixel getLineColor(unsigned line) const
Get the (single) color of the given line.
std::span< const Pixel > getLine(int line, std::span< Pixel > buf) const
Gets a pointer to the pixels of the given line number.
unsigned getHeight() const
Gets the number of lines in this frame.
Polymorphic wrapper around another line scaler.
A video frame as output by the VDP scanline conversion unit, before any postprocessing filters are ap...
virtual void scale4x2to3x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scale1x2to1x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
void scaleImage(FrameSource &src, const RawFrame *superImpose, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
Scales the image in the given area, which must consist of lines which are all equally wide.
virtual void scale2x2to1x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scaleBlank2to1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scale2x1to1x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scale2x1to3x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scale2x2to3x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
void dispatchScale(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scale8x1to3x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scale1x1to1x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scaleBlank1to1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scale4x1to3x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scale8x2to3x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scale4x2to1x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
virtual void scale4x1to1x1(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY)
Scaler1(const PixelOperations< Pixel > &pixelOps)
virtual unsigned getWidth() const =0
virtual void fillLine(unsigned y, Pixel color)=0
virtual void releaseLine(unsigned y, std::span< Pixel > buf)=0
virtual std::span< Pixel > acquireLine(unsigned y)=0
constexpr vecN< N, T > max(const vecN< N, T > &x, const vecN< N, T > &y)
constexpr mat4 scale(const vec3 &xyz)
This file implemented 3 utility functions:
auto copy(InputRange &&range, OutputIter out)
#define VLA_SSE_ALIGNED(TYPE, NAME, LENGTH)
constexpr auto xrange(T e)