1 /*****************************************************************************
2 
3         Primaries.h
4         Author: Laurent de Soras, 2021
5 
6 --- Legal stuff ---
7 
8 This program is free software. It comes without any warranty, to
9 the extent permitted by applicable law. You can redistribute it
10 and/or modify it under the terms of the Do What The Fuck You Want
11 To Public License, Version 2, as published by Sam Hocevar. See
12 http://www.wtfpl.net/ for more details.
13 
14 *Tab=3***********************************************************************/
15 
16 
17 
18 #pragma once
19 #if ! defined (fmtcavs_Primaries_HEADER_INCLUDED)
20 #define fmtcavs_Primaries_HEADER_INCLUDED
21 
22 
23 
24 /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
25 
26 #include "avsutl/VideoFilterBase.h"
27 #include "fmtcavs/FmtAvs.h"
28 #include "fmtcavs/ProcAlpha.h"
29 #include "fmtcl/MatrixProc.h"
30 #include "fmtcl/RgbSystem.h"
31 
32 #include <memory>
33 #include <string>
34 
35 
36 
37 namespace fmtcavs
38 {
39 
40 
41 
42 class Primaries
43 :	public avsutl::VideoFilterBase
44 {
45 
46 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
47 
48 public:
49 
50 	typedef avsutl::VideoFilterBase Inherited;
51 
52 	enum Param
53 	{
54 		Param_CLIP_SRC = 0,
55 		Param_RS,
56 		Param_GS,
57 		Param_BS,
58 		Param_WS,
59 		Param_RD,
60 		Param_GD,
61 		Param_BD,
62 		Param_WD,
63 		Param_PRIMS,
64 		Param_PRIMD,
65 		Param_CPUOPT,
66 
67 		Param_NBR_ELT
68 	};
69 
70 	explicit       Primaries (::IScriptEnvironment &env, const ::AVSValue &args);
71 	virtual        ~Primaries () = default;
72 
73 	// VideoFilterBase
74 	::PVideoFrame __stdcall
75 						GetFrame (int n, ::IScriptEnvironment *env_ptr) override;
76 
77 
78 
79 /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
80 
81 protected:
82 
83 
84 
85 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
86 
87 private:
88 
89 	static constexpr int _nbr_planes_proc = fmtcl::RgbSystem::_nbr_planes;
90 
91 	static void    init (fmtcl::RgbSystem &prim, ::IScriptEnvironment &env, const ::AVSValue &args, Param preset);
92 	static void    init (fmtcl::RgbSystem &prim, ::IScriptEnvironment &env, const ::AVSValue &args, Param pr, Param pg, Param pb, Param pw);
93 	static bool    read_coord_tuple (fmtcl::RgbSystem::Vec2 &c, ::IScriptEnvironment &env, const ::AVSValue &args, Param p);
94 
95 	::PClip        _clip_src_sptr;
96 	const ::VideoInfo
97 	               _vi_src;
98 
99 	fmtcl::RgbSystem
100 	               _prim_s;
101 	fmtcl::RgbSystem
102 	               _prim_d;
103 
104 	fmtcl::Mat4    _mat_main { 1.0, fmtcl::Mat4::Preset_DIAGONAL };
105 
106 	std::unique_ptr <fmtcl::MatrixProc>
107 	               _proc_uptr;
108 
109 	std::unique_ptr <fmtcavs::ProcAlpha>
110 	               _proc_alpha_uptr;
111 
112 	bool           _sse_flag  = false;
113 	bool           _sse2_flag = false;
114 	bool           _avx_flag  = false;
115 	bool           _avx2_flag = false;
116 
117 
118 
119 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
120 
121 private:
122 
123 	               Primaries ()                               = delete;
124 	               Primaries (const Primaries &other)         = delete;
125 	               Primaries (Primaries &&other)              = delete;
126 	Primaries &    operator = (const Primaries &other)        = delete;
127 	Primaries &    operator = (Primaries &&other)             = delete;
128 	bool           operator == (const Primaries &other) const = delete;
129 	bool           operator != (const Primaries &other) const = delete;
130 
131 }; // class Primaries
132 
133 
134 
135 }  // namespace fmtcavs
136 
137 
138 
139 //#include "fmtcavs/Primaries.hpp"
140 
141 
142 
143 #endif   // fmtcavs_Primaries_HEADER_INCLUDED
144 
145 
146 
147 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
148