23 void operator()(std::span<const Pixel> in0, std::span<const Pixel> in1, std::span<const Pixel> in2,
24 std::span<Pixel> out0, std::span<Pixel> out1, std::span<Pixel> out2,
25 std::span<uint16_t> edgeBuf,
EdgeHQ edgeOp);
28template<std::
unsigned_
integral Pixel>
30 std::span<const Pixel> in0, std::span<const Pixel> in1, std::span<const Pixel> in2,
31 std::span<Pixel> out0, std::span<Pixel> out1, std::span<Pixel> out2,
32 std::span<uint16_t> edgeBuf,
35 auto srcWidth = edgeBuf.size();
36 assert(in0.size() == srcWidth);
37 assert(in1.size() == srcWidth);
38 assert(in2.size() == srcWidth);
39 assert(out0.size() == 3 * srcWidth);
40 assert(out1.size() == 3 * srcWidth);
41 assert(out2.size() == 3 * srcWidth);
43 auto c2 =
readPixel(in0[0]);
auto c3 = c2;
44 auto c5 =
readPixel(in1[0]);
auto c6 = c5;
45 auto c8 =
readPixel(in2[0]);
auto 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);
83 edgeBuf[x] = narrow_cast<uint16_t>(pattern);
85 unsigned pixel0, pixel1, pixel2, pixel3, pixel4,
86 pixel5, pixel6, pixel7, pixel8;
88#include "HQ3xScaler-1x1to3x3.nn"
90 out0[3 * x + 0] = writePixel<Pixel>(pixel0);
91 out0[3 * x + 1] = writePixel<Pixel>(pixel1);
92 out0[3 * x + 2] = writePixel<Pixel>(pixel2);
93 out1[3 * x + 0] = writePixel<Pixel>(pixel3);
94 out1[3 * x + 1] = writePixel<Pixel>(pixel4);
95 out1[3 * x + 2] = writePixel<Pixel>(pixel5);
96 out2[3 * x + 0] = writePixel<Pixel>(pixel6);
97 out2[3 * x + 1] = writePixel<Pixel>(pixel7);
98 out2[3 * x + 2] = writePixel<Pixel>(pixel8);
104template<std::
unsigned_
integral Pixel>
107 , pixelOps(pixelOps_)
111template<std::
unsigned_
integral Pixel>
113 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
119 src, srcStartY, srcEndY, srcWidth,
120 dst, dstStartY, dstEndY);
123template<std::
unsigned_
integral Pixel>
125 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
131 src, srcStartY, srcEndY, srcWidth,
132 dst, dstStartY, dstEndY);
135template<std::
unsigned_
integral Pixel>
137 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
143 src, srcStartY, srcEndY, srcWidth,
144 dst, dstStartY, dstEndY);
147template<std::
unsigned_
integral Pixel>
149 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
155 src, srcStartY, srcEndY, srcWidth,
156 dst, dstStartY, dstEndY);
159template<std::
unsigned_
integral Pixel>
161 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
167 src, srcStartY, srcEndY, srcWidth,
168 dst, dstStartY, dstEndY);
171template<std::
unsigned_
integral Pixel>
173 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
179 src, srcStartY, srcEndY, srcWidth,
180 dst, dstStartY, dstEndY);
Interface for getting lines from a video frame.
Runs the hq3x scaler algorithm.
void scale1x1to3x3(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
void scale4x1to3x3(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
void scale4x1to9x3(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
void scale2x1to9x3(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
void scale2x1to3x3(FrameSource &src, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, ScalerOutput< Pixel > &dst, unsigned dstStartY, unsigned dstEndY) override
HQ3xScaler(const PixelOperations< Pixel > &pixelOps)
void scale8x1to9x3(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 3x scalers.
This file implemented 3 utility functions:
EdgeHQ createEdgeHQ(const PixelOperations< Pixel > &pixelOps)
uint32_t readPixel(Pixel p)
void operator()(std::span< const Pixel > in0, std::span< const Pixel > in1, std::span< const Pixel > in2, std::span< Pixel > out0, std::span< Pixel > out1, std::span< Pixel > out2, std::span< uint16_t > edgeBuf, EdgeHQ edgeOp)
constexpr auto xrange(T e)