24 void operator()(std::span<const Pixel> in0, std::span<const Pixel> in1, std::span<const Pixel> in2,
25 std::span<Pixel> out0, std::span<Pixel> out1,
26 std::span<uint16_t> edgeBuf,
EdgeHQLite edgeOp) __restrict;
31 void operator()(std::span<const Pixel> in0, std::span<const Pixel> in1, std::span<const Pixel> in2,
32 std::span<Pixel> out0, std::span<Pixel> out1,
33 std::span<uint16_t> edgeBuf,
EdgeHQLite edgeOp) __restrict;
36template<std::
unsigned_
integral Pixel>
38 std::span<const Pixel> in0, std::span<const Pixel> in1, std::span<const Pixel> in2,
39 std::span<Pixel> out0, std::span<Pixel> out1,
40 std::span<uint16_t> edgeBuf,
43 auto srcWidth = edgeBuf.size();
44 assert(in0.size() == srcWidth);
45 assert(in1.size() == srcWidth);
46 assert(in2.size() == srcWidth);
47 assert(out0.size() == 2 * srcWidth);
48 assert(out1.size() == 2 * srcWidth);
51 auto c5 =
readPixel(in1[0]);
auto c6 = c5;
52 auto c8 =
readPixel(in2[0]);
auto c9 = c8;
55 if (c5 != c8) pattern |= 3 << 6;
56 if (c5 != c2) pattern |= 3 << 9;
58 for (
auto x :
xrange(srcWidth)) {
62 if (x != srcWidth - 1) {
67 pattern = (pattern >> 6) & 0x001F;
76 if (c5 != c8) pattern |= 1 << 5;
77 if (c5 != c9) pattern |= 1 << 6;
78 if (c6 != c8) pattern |= 1 << 7;
79 if (c5 != c6) pattern |= 1 << 8;
84 pattern |= ((edgeBuf[x] & (1 << 5) ) << 6) |
85 ((edgeBuf[x] & ((1 << 6) | (1 << 7))) << 3);
86 edgeBuf[x] = narrow_cast<uint16_t>(pattern);
88 unsigned pixel0, pixel1, pixel2, pixel3;
90#include "HQ2xLiteScaler-1x1to2x2.nn"
92 out0[2 * x + 0] = writePixel<Pixel>(pixel0);
93 out0[2 * x + 1] = writePixel<Pixel>(pixel1);
94 out1[2 * x + 0] = writePixel<Pixel>(pixel2);
95 out1[2 * x + 1] = writePixel<Pixel>(pixel3);
99template<std::
unsigned_
integral Pixel>
101 std::span<const Pixel> in0, std::span<const Pixel> in1, std::span<const Pixel> in2,
102 std::span<Pixel> out0, std::span<Pixel> out1,
103 std::span<uint16_t> edgeBuf,
113 auto srcWidth = edgeBuf.size();
114 assert(in0.size() == srcWidth);
115 assert(in1.size() == srcWidth);
116 assert(in2.size() == srcWidth);
117 assert(out0.size() == srcWidth);
118 assert(out1.size() == srcWidth);
121 auto c5 =
readPixel(in1[0]);
auto c6 = c5;
122 auto c8 =
readPixel(in2[0]);
auto c9 = c8;
124 unsigned pattern = 0;
125 if (c5 != c8) pattern |= 3 << 6;
126 if (c5 != c2) pattern |= 3 << 9;
128 for (
auto x :
xrange(srcWidth)) {
132 if (x != srcWidth - 1) {
137 pattern = (pattern >> 6) & 0x001F;
146 if (c5 != c8) pattern |= 1 << 5;
147 if (c5 != c9) pattern |= 1 << 6;
148 if (c6 != c8) pattern |= 1 << 7;
149 if (c5 != c6) pattern |= 1 << 8;
154 pattern |= ((edgeBuf[x] & (1 << 5) ) << 6) |
155 ((edgeBuf[x] & ((1 << 6) | (1 << 7))) << 3);
156 edgeBuf[x] = narrow_cast<uint16_t>(pattern);
158 unsigned pixel0, pixel1;
160#include "HQ2xLiteScaler-1x1to1x2.nn"
162 out0[x] = writePixel<Pixel>(pixel0);
163 out1[x] = writePixel<Pixel>(pixel1);
169template<std::
unsigned_
integral Pixel>
172 , pixelOps(pixelOps_)
176template<std::
unsigned_
integral Pixel>
178 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
184 src, srcStartY, srcEndY, srcWidth,
185 dst, dstStartY, dstEndY);
188template<std::
unsigned_
integral Pixel>
190 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
196 src, srcStartY, srcEndY, srcWidth,
197 dst, dstStartY, dstEndY);
200template<std::
unsigned_
integral Pixel>
202 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
208 src, srcStartY, srcEndY, srcWidth,
209 dst, dstStartY, dstEndY);
212template<std::
unsigned_
integral Pixel>
214 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
220 src, srcStartY, srcEndY, srcWidth,
221 dst, dstStartY, dstEndY);
224template<std::
unsigned_
integral Pixel>
226 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
232 src, srcStartY, srcEndY, srcWidth,
233 dst, dstStartY, dstEndY);
236template<std::
unsigned_
integral Pixel>
238 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
244 src, srcStartY, srcEndY, srcWidth,
245 dst, dstStartY, dstEndY);
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:
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< uint16_t > edgeBuf, EdgeHQLite edgeOp)
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< uint16_t > edgeBuf, EdgeHQLite edgeOp)
constexpr auto xrange(T e)