1 /***************************************************************************** 2 3 Matrix.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_Matrix_HEADER_INCLUDED) 20 #define fmtcavs_Matrix_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/ColorSpaceH265.h" 30 #include "fmtcl/MatrixProc.h" 31 32 #include <memory> 33 #include <string> 34 35 36 37 namespace fmtcavs 38 { 39 40 41 42 class Matrix 43 : public avsutl::VideoFilterBase 44 { 45 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 46 47 public: 48 49 typedef avsutl::VideoFilterBase Inherited; 50 51 enum Param 52 { 53 Param_CLIP_SRC = 0, 54 Param_MAT, 55 Param_MATS, 56 Param_MATD, 57 Param_FULLS, 58 Param_FULLD, 59 Param_COEF, 60 Param_CSP, 61 Param_COL_FAM, 62 Param_BITS, 63 Param_SINGLEOUT, 64 Param_CPUOPT, 65 66 Param_NBR_ELT 67 }; 68 69 explicit Matrix (::IScriptEnvironment &env, const ::AVSValue &args); 70 virtual ~Matrix () = default; 71 72 // VideoFilterBase 73 ::PVideoFrame __stdcall 74 GetFrame (int n, ::IScriptEnvironment *env_ptr) override; 75 76 static fmtcl::ColorSpaceH265 77 find_cs_from_mat_str (::IScriptEnvironment &env, const std::string &mat, bool allow_2020cl_flag); 78 79 80 81 /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 82 83 protected: 84 85 86 87 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 88 89 private: 90 91 static constexpr int _nbr_planes_proc = fmtcl::MatrixProc::_nbr_planes; 92 93 FmtAvs get_output_colorspace (::IScriptEnvironment &env, const ::AVSValue &args, const FmtAvs &fmt_src, int &plane_out, bool &force_col_fam_flag); 94 FmtAvs find_dst_col_fam (fmtcl::ColorSpaceH265 tmp_csp, FmtAvs fmt_dst, const FmtAvs &fmt_src); 95 96 ::PClip _clip_src_sptr; 97 const ::VideoInfo 98 _vi_src; 99 100 int _plane_out = -1; 101 std::unique_ptr <fmtcl::MatrixProc> 102 _proc_uptr; 103 104 std::unique_ptr <fmtcavs::ProcAlpha> 105 _proc_alpha_uptr; 106 107 bool _range_def_flag = false; 108 bool _fulls_flag = false; 109 bool _fulld_flag = false; 110 fmtcl::ColorSpaceH265 111 _csp_out = fmtcl::ColorSpaceH265_UNDEF; 112 113 114 115 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 116 117 private: 118 119 Matrix () = delete; 120 Matrix (const Matrix &other) = delete; 121 Matrix (Matrix &&other) = delete; 122 Matrix & operator = (const Matrix &other) = delete; 123 Matrix & operator = (Matrix &&other) = delete; 124 bool operator == (const Matrix &other) const = delete; 125 bool operator != (const Matrix &other) const = delete; 126 127 }; // class Matrix 128 129 130 131 } // namespace fmtcavs 132 133 134 135 //#include "fmtcavs/Matrix.hpp" 136 137 138 139 #endif // fmtcavs_Matrix_HEADER_INCLUDED 140 141 142 143 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 144