1 /*****************************************************************************
2 
3         Bitdepth.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_Bitdepth_HEADER_INCLUDED)
20 #define fmtcavs_Bitdepth_HEADER_INCLUDED
21 
22 
23 
24 /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
25 
26 #include "fmtcl/Dither.h"
27 #include "avsutl/PlaneProcCbInterface.h"
28 #include "avsutl/PlaneProcessor.h"
29 #include "avsutl/VideoFilterBase.h"
30 
31 #include <memory>
32 #include <string>
33 
34 
35 
36 namespace fmtcavs
37 {
38 
39 
40 
41 class Bitdepth
42 :	public avsutl::VideoFilterBase
43 ,	public avsutl::PlaneProcCbInterface
44 {
45 
46 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
47 
48 public:
49 
50 	typedef avsutl::VideoFilterBase Inherited;
51 
52 	enum Param
53 	{
54 		Param_CLIP_SRC = 0, // 0
55 		Param_BITS,
56 		Param_FLT,
57 		Param_PLANES,
58 		Param_FULLS,
59 		Param_FULLD,
60 		Param_DMODE,
61 		Param_AMPO,
62 		Param_AMPN,
63 		Param_DYN,
64 		Param_STATICNOISE, // 10
65 		Param_CPUOPT,
66 		Param_PATSIZE,
67 		Param_TPDFO,
68 		Param_TPDFN,
69 		Param_CORPLANE,
70 
71 		Param_NBR_ELT,
72 	};
73 
74 	explicit       Bitdepth (::IScriptEnvironment &env, const ::AVSValue &args);
75 	virtual        ~Bitdepth () = default;
76 
77 	// VideoFilterBase
78 	::PVideoFrame __stdcall
79 						GetFrame (int n, ::IScriptEnvironment *env_ptr) override;
80 
81 
82 
83 /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
84 
85 protected:
86 
87 	// PlaneProcCbInterface
88 	void           do_process_plane (::PVideoFrame &dst_sptr, int n, ::IScriptEnvironment &env, int plane_index, int plane_id, void *ctx_ptr) override;
89 
90 
91 
92 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
93 
94 private:
95 
96 	::PClip        _clip_src_sptr;
97 	const ::VideoInfo
98 	               _vi_src;
99 
100 	std::unique_ptr <avsutl::PlaneProcessor>
101 	               _plane_proc_uptr;
102 
103 	std::unique_ptr <fmtcl::Dither>
104 	               _engine_uptr;
105 
106 	bool           _range_def_flag = false;
107 	bool           _fulld_flag     = false;
108 	bool           _fulls_flag     = false;
109 
110 
111 
112 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
113 
114 private:
115 
116 	               Bitdepth ()                               = delete;
117 	               Bitdepth (const Bitdepth &other)          = delete;
118 	               Bitdepth (Bitdepth &&other)               = delete;
119 	Bitdepth &     operator = (const Bitdepth &other)        = delete;
120 	Bitdepth &     operator = (Bitdepth &&other)             = delete;
121 	bool           operator == (const Bitdepth &other) const = delete;
122 	bool           operator != (const Bitdepth &other) const = delete;
123 
124 }; // class Bitdepth
125 
126 
127 
128 }  // namespace fmtcavs
129 
130 
131 
132 //#include "fmtcavs/Bitdepth.hpp"
133 
134 
135 
136 #endif   // fmtcavs_Bitdepth_HEADER_INCLUDED
137 
138 
139 
140 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
141