26 unsigned* edgeBuf,
EdgeHQLite edgeOp) __restrict;
33 unsigned* edgeBuf,
EdgeHQLite edgeOp) __restrict;
36 template<std::
unsigned_
integral Pixel>
38 const Pixel* __restrict in0,
const Pixel* __restrict in1,
39 const Pixel* __restrict in2,
40 Pixel* __restrict out0,
Pixel* __restrict out1,
41 unsigned srcWidth,
unsigned* __restrict edgeBuf,
45 unsigned c5 =
readPixel(in1[0]);
unsigned c6 = c5;
46 unsigned c8 =
readPixel(in2[0]);
unsigned c9 = c8;
49 if (c5 != c8) pattern |= 3 << 6;
50 if (c5 != c2) pattern |= 3 << 9;
52 for (
auto x :
xrange(srcWidth)) {
56 if (
x != srcWidth - 1) {
61 pattern = (pattern >> 6) & 0x001F;
70 if (c5 != c8) pattern |= 1 << 5;
71 if (c5 != c9) pattern |= 1 << 6;
72 if (c6 != c8) pattern |= 1 << 7;
73 if (c5 != c6) pattern |= 1 << 8;
78 pattern |= ((edgeBuf[
x] & (1 << 5) ) << 6) |
79 ((edgeBuf[
x] & ((1 << 6) | (1 << 7))) << 3);
82 unsigned pixel0, pixel1, pixel2, pixel3;
84 #include "HQ2xLiteScaler-1x1to2x2.nn"
86 out0[2 *
x + 0] = writePixel<Pixel>(pixel0);
87 out0[2 *
x + 1] = writePixel<Pixel>(pixel1);
88 out1[2 *
x + 0] = writePixel<Pixel>(pixel2);
89 out1[2 *
x + 1] = writePixel<Pixel>(pixel3);
93 template<std::
unsigned_
integral Pixel>
95 const Pixel* __restrict in0,
const Pixel* __restrict in1,
96 const Pixel* __restrict in2,
97 Pixel* __restrict out0,
Pixel* __restrict out1,
98 unsigned srcWidth,
unsigned* __restrict edgeBuf,
109 unsigned c5 =
readPixel(in1[0]);
unsigned c6 = c5;
110 unsigned c8 =
readPixel(in2[0]);
unsigned c9 = c8;
112 unsigned pattern = 0;
113 if (c5 != c8) pattern |= 3 << 6;
114 if (c5 != c2) pattern |= 3 << 9;
116 for (
auto x :
xrange(srcWidth)) {
120 if (
x != srcWidth - 1) {
125 pattern = (pattern >> 6) & 0x001F;
134 if (c5 != c8) pattern |= 1 << 5;
135 if (c5 != c9) pattern |= 1 << 6;
136 if (c6 != c8) pattern |= 1 << 7;
137 if (c5 != c6) pattern |= 1 << 8;
142 pattern |= ((edgeBuf[
x] & (1 << 5) ) << 6) |
143 ((edgeBuf[
x] & ((1 << 6) | (1 << 7))) << 3);
144 edgeBuf[
x] = pattern;
146 unsigned pixel0, pixel1;
148 #include "HQ2xLiteScaler-1x1to1x2.nn"
150 out0[
x] = writePixel<Pixel>(pixel0);
151 out1[
x] = writePixel<Pixel>(pixel1);
157 template<std::
unsigned_
integral Pixel>
160 , pixelOps(pixelOps_)
164 template<std::
unsigned_
integral Pixel>
166 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
172 src, srcStartY, srcEndY, srcWidth,
173 dst, dstStartY, dstEndY, srcWidth * 3);
176 template<std::
unsigned_
integral Pixel>
178 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
184 src, srcStartY, srcEndY, srcWidth,
185 dst, dstStartY, dstEndY, srcWidth * 2);
188 template<std::
unsigned_
integral Pixel>
190 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
196 src, srcStartY, srcEndY, srcWidth,
197 dst, dstStartY, dstEndY, (srcWidth * 3) / 2);
200 template<std::
unsigned_
integral Pixel>
202 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
208 src, srcStartY, srcEndY, srcWidth,
209 dst, dstStartY, dstEndY, srcWidth);
212 template<std::
unsigned_
integral Pixel>
214 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
220 src, srcStartY, srcEndY, srcWidth,
221 dst, dstStartY, dstEndY, (srcWidth * 3) / 4);
224 template<std::
unsigned_
integral Pixel>
226 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
232 src, srcStartY, srcEndY, srcWidth,
233 dst, dstStartY, dstEndY, srcWidth / 2);
Interface for getting lines from a video frame.
void scale2x1to3x2(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
void scale2x1to1x2(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
void scale1x1to3x2(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
HQ2xLiteScaler(const PixelOperations< Pixel > &pixelOps)
void scale4x1to3x2(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
void scale1x1to2x2(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
void scale1x1to1x2(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
Polymorphic wrapper around another line scaler.
Base class for 2x scalers.
This file implemented 3 utility functions:
constexpr KeyMatrixPosition x
Keyboard bindings.
uint32_t readPixel(Pixel p)
void operator()(const Pixel *in0, const Pixel *in1, const Pixel *in2, Pixel *out0, Pixel *out1, unsigned srcWidth, unsigned *edgeBuf, EdgeHQLite edgeOp)
void operator()(const Pixel *in0, const Pixel *in1, const Pixel *in2, Pixel *out0, Pixel *out1, unsigned srcWidth, unsigned *edgeBuf, EdgeHQLite edgeOp)
constexpr auto xrange(T e)