openMSX
Simple3xScaler.hh
Go to the documentation of this file.
1 #ifndef SIMPLE3XSCALER_HH
2 #define SIMPLE3XSCALER_HH
3 
4 #include "Scaler3.hh"
5 #include "Multiply32.hh"
6 #include "PixelOperations.hh"
7 #include "Scanline.hh"
8 
9 namespace openmsx {
10 
11 class RenderSettings;
12 template<typename Pixel> class PolyLineScaler;
13 
14 template<typename Pixel> class Blur_1on3
15 {
16 public:
17  explicit Blur_1on3(const PixelOperations<Pixel>& pixelOps);
18  inline void setBlur(unsigned blur_) { blur = blur_; }
19  void operator()(const Pixel* in, Pixel* out, size_t dstWidth);
20 private:
21  Multiply32<Pixel> mult0;
22  Multiply32<Pixel> mult1;
23  Multiply32<Pixel> mult2;
24  Multiply32<Pixel> mult3;
25  unsigned blur;
26 #ifdef __SSE2__
27  void blur_SSE(const Pixel* in_, Pixel* out_, size_t srcWidth);
28 #endif
29 };
30 
31 template<typename Pixel>
32 class Simple3xScaler final : public Scaler3<Pixel>
33 {
34 public:
35  Simple3xScaler(const PixelOperations<Pixel>& pixelOps,
36  const RenderSettings& settings);
37  ~Simple3xScaler() override;
38 
39 private:
40  void scaleImage(FrameSource& src, const RawFrame* superImpose,
41  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
42  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
43  void scaleBlank1to3(
44  FrameSource& src, unsigned srcStartY, unsigned srcEndY,
45  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
46  void scaleBlank2to3(
47  FrameSource& src, unsigned srcStartY, unsigned srcEndY,
48  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
49  void scale2x1to9x3(FrameSource& src,
50  unsigned srcStartY, unsigned srcEndY, unsigned srcwidth,
51  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
52  void scale2x2to9x3(FrameSource& src,
53  unsigned srcStartY, unsigned srcEndY, unsigned srcwidth,
54  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
55  void scale1x1to3x3(FrameSource& src,
56  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
57  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
58  void scale1x2to3x3(FrameSource& src,
59  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
60  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
61  void scale4x1to9x3(FrameSource& src,
62  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
63  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
64  void scale4x2to9x3(FrameSource& src,
65  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
66  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
67  void scale2x1to3x3(FrameSource& src,
68  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
69  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
70  void scale2x2to3x3(FrameSource& src,
71  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
72  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
73  void scale8x1to9x3(FrameSource& src,
74  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
75  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
76  void scale8x2to9x3(FrameSource& src,
77  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
78  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
79  void scale4x1to3x3(FrameSource& src,
80  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
81  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
82  void scale4x2to3x3(FrameSource& src,
83  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
84  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY) override;
85 
86  void doScale1(FrameSource& src,
87  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
88  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY,
90  void doScale2(FrameSource& src,
91  unsigned srcStartY, unsigned srcEndY, unsigned srcWidth,
92  ScalerOutput<Pixel>& dst, unsigned dstStartY, unsigned dstEndY,
94 
95 private:
96  PixelOperations<Pixel> pixelOps;
97  Scanline<Pixel> scanline;
98 
99  // in 16bpp calculation of LUTs can be expensive, so keep as member
100  Blur_1on3<Pixel> blur_1on3;
101 
102  const RenderSettings& settings;
103 };
104 
105 } // namespace openmsx
106 
107 #endif
void operator()(const Pixel *in, Pixel *out, size_t dstWidth)
void setBlur(unsigned blur_)
Blur_1on3(const PixelOperations< Pixel > &pixelOps)
Interface for getting lines from a video frame.
Definition: FrameSource.hh:16
Helper class to perform 'pixel x scalar' calculations.
Definition: Multiply32.hh:14
Polymorphic line scaler.
Definition: LineScalers.hh:285
A video frame as output by the VDP scanline conversion unit, before any postprocessing filters are ap...
Definition: RawFrame.hh:14
Class containing all settings for renderers.
Base class for 3x scalers.
Definition: Scaler3.hh:12
Helper class to draw scanlines.
Definition: Scanline.hh:44
Simple3xScaler(const PixelOperations< Pixel > &pixelOps, const RenderSettings &settings)
constexpr mat4 scale(const vec3 &xyz)
Definition: gl_transform.hh:19
This file implemented 3 utility functions:
Definition: Autofire.cc:9
uint32_t Pixel