25 unsigned* edgeBuf,
EdgeHQ edgeOp) __restrict;
32 unsigned* edgeBuf,
EdgeHQ edgeOp) __restrict;
35 template<std::
unsigned_
integral Pixel>
37 const Pixel* __restrict in0,
const Pixel* __restrict in1,
38 const Pixel* __restrict in2,
39 Pixel* __restrict out0,
Pixel* __restrict out1,
40 unsigned srcWidth,
unsigned* __restrict edgeBuf,
43 unsigned c2 =
readPixel(in0[0]);
unsigned c3 = c2;
44 unsigned c5 =
readPixel(in1[0]);
unsigned c6 = c5;
45 unsigned c8 =
readPixel(in2[0]);
unsigned c9 = c8;
48 if (edgeOp(c5, c8)) pattern |= 3 << 6;
49 if (edgeOp(c5, c2)) pattern |= 3 << 9;
51 for (
auto x :
xrange(srcWidth)) {
58 if (
x != srcWidth - 1) {
64 pattern = (pattern >> 6) & 0x001F;
73 if (edgeOp(c5, c8)) pattern |= 1 << 5;
74 if (edgeOp(c5, c9)) pattern |= 1 << 6;
75 if (edgeOp(c6, c8)) pattern |= 1 << 7;
76 if (edgeOp(c5, c6)) pattern |= 1 << 8;
81 pattern |= ((edgeBuf[
x] & (1 << 5) ) << 6) |
82 ((edgeBuf[
x] & ((1 << 6) | (1 << 7))) << 3);
85 unsigned pixel0, pixel1, pixel2, pixel3;
87 #include "HQ2xScaler-1x1to2x2.nn"
89 out0[2 *
x + 0] = writePixel<Pixel>(pixel0);
90 out0[2 *
x + 1] = writePixel<Pixel>(pixel1);
91 out1[2 *
x + 0] = writePixel<Pixel>(pixel2);
92 out1[2 *
x + 1] = writePixel<Pixel>(pixel3);
96 template<std::
unsigned_
integral Pixel>
98 const Pixel* __restrict in0,
const Pixel* __restrict in1,
99 const Pixel* __restrict in2,
100 Pixel* __restrict out0,
Pixel* __restrict out1,
101 unsigned srcWidth,
unsigned* __restrict edgeBuf,
112 unsigned c2 =
readPixel(in0[0]);
unsigned c3 = c2;
113 unsigned c5 =
readPixel(in1[0]);
unsigned c6 = c5;
114 unsigned c8 =
readPixel(in2[0]);
unsigned c9 = c8;
116 unsigned pattern = 0;
117 if (edgeOp(c5, c8)) pattern |= 3 << 6;
118 if (edgeOp(c5, c2)) pattern |= 3 << 9;
120 for (
auto x :
xrange(srcWidth)) {
127 if (
x != srcWidth - 1) {
133 pattern = (pattern >> 6) & 0x001F;
142 if (edgeOp(c5, c8)) pattern |= 1 << 5;
143 if (edgeOp(c5, c9)) pattern |= 1 << 6;
144 if (edgeOp(c6, c8)) pattern |= 1 << 7;
145 if (edgeOp(c5, c6)) pattern |= 1 << 8;
150 pattern |= ((edgeBuf[
x] & (1 << 5) ) << 6) |
151 ((edgeBuf[
x] & ((1 << 6) | (1 << 7))) << 3);
152 edgeBuf[
x] = pattern;
154 unsigned pixel0, pixel1;
156 #include "HQ2xScaler-1x1to1x2.nn"
158 out0[
x] = writePixel<Pixel>(pixel0);
159 out1[
x] = writePixel<Pixel>(pixel1);
165 template<std::
unsigned_
integral Pixel>
168 , pixelOps(pixelOps_)
172 template<std::
unsigned_
integral Pixel>
174 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
180 src, srcStartY, srcEndY, srcWidth,
181 dst, dstStartY, dstEndY, srcWidth * 3);
184 template<std::
unsigned_
integral Pixel>
186 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
192 src, srcStartY, srcEndY, srcWidth,
193 dst, dstStartY, dstEndY, srcWidth * 2);
196 template<std::
unsigned_
integral Pixel>
198 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
204 src, srcStartY, srcEndY, srcWidth,
205 dst, dstStartY, dstEndY, (srcWidth * 3) / 2);
208 template<std::
unsigned_
integral Pixel>
210 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
216 src, srcStartY, srcEndY, srcWidth,
217 dst, dstStartY, dstEndY, srcWidth);
220 template<std::
unsigned_
integral Pixel>
222 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
228 src, srcStartY, srcEndY, srcWidth,
229 dst, dstStartY, dstEndY, (srcWidth * 3) / 4);
232 template<std::
unsigned_
integral Pixel>
234 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
240 src, srcStartY, srcEndY, srcWidth,
241 dst, dstStartY, dstEndY, srcWidth / 2);
Interface for getting lines from a video frame.
Runs the hq2x scaler algorithm.
void scale1x1to3x2(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
HQ2xScaler(const PixelOperations< Pixel > &pixelOps)
void scale2x1to3x2(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
void scale4x1to3x2(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
Polymorphic wrapper around another line scaler.
Base class for 2x scalers.
This file implemented 3 utility functions:
EdgeHQ createEdgeHQ(const PixelOperations< Pixel > &pixelOps)
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, EdgeHQ edgeOp)
void operator()(const Pixel *in0, const Pixel *in1, const Pixel *in2, Pixel *out0, Pixel *out1, unsigned srcWidth, unsigned *edgeBuf, EdgeHQ edgeOp)
constexpr auto xrange(T e)