├── .gitattributes ├── src ├── fmtcl │ ├── Dither.cpp │ ├── PlaneRO.h │ ├── VoidAndClusterPrecalc.h │ ├── FrameRO.h │ ├── LumMatch.h │ ├── ColorFamily.h │ ├── ContFirRect.cpp │ ├── ContFirInterface.cpp │ ├── ContFirSnh.cpp │ ├── ArrayMultiType.cpp │ ├── ResizeData.cpp │ ├── SplFmt.h │ ├── Cst_fmtcl.cpp │ ├── ContFirLinear.cpp │ ├── TransOpAffine.cpp │ ├── MatXyz2Lms.cpp │ ├── ResizeData.hpp │ ├── TransOpContrast.hpp │ ├── ErrDifBuf.cpp │ ├── TransOpInterface.cpp │ ├── ProcComp3Arg.cpp │ ├── InterlacingType.h │ ├── ChromaPlacement.h │ ├── Matrix2020CLProc_macro.h │ ├── ResizeDataFactory.cpp │ ├── ReadWrapperFlt.h │ ├── ContFirInterface.h │ ├── DiscreteFirInterface.cpp │ ├── ContFirSinc.cpp │ ├── ErrDifBufFactory.cpp │ ├── ReadWrapperInt.h │ ├── ContFirCustom.cpp │ ├── ContFirGauss.cpp │ ├── TransOpCompose.hpp │ ├── ContFirSpline16.cpp │ ├── DiscreteFirInterface.h │ ├── ContFirSpline36.cpp │ ├── TransOpLogTrunc.cpp │ ├── ReadWrapperFlt.hpp │ ├── ReadWrapperInt.hpp │ ├── ContFirCubic.cpp │ ├── ScalerCopy.h │ ├── ContFirSpline64.cpp │ ├── CoefArrInt.hpp │ ├── ColorSpaceH265.h │ ├── TransOpCanonLog.cpp │ ├── SplFmt.hpp │ ├── Proxy.hpp │ ├── PicFmt.h │ ├── ContFirSnh.h │ ├── ContFirRect.h │ ├── MatrixProc_macro.h │ ├── ResampleSpecPlane.cpp │ ├── ContFirLinear.h │ ├── fnc.h │ ├── TransOpPow.cpp │ ├── ContFirSinc.h │ ├── ContFirSpline16.h │ ├── ContFirSpline36.h │ ├── ContFirSpline64.h │ ├── ContFirGauss.h │ ├── ContFirLanczos.cpp │ ├── TransOpBypass.h │ ├── TransOpAcesCct.cpp │ ├── TransOp2084.h │ ├── ContFirSpline.h │ ├── ResizeData.h │ ├── PrimariesPreset.h │ └── TransOpAcesCc.cpp ├── conc │ ├── LockFreeQueue.hpp │ ├── fnc.h │ ├── README.md │ ├── AioAdd.hpp │ ├── AioSub.hpp │ ├── AioMax.hpp │ ├── ObjFactoryDef.hpp │ ├── fnc.hpp │ ├── ObjFactoryInterface.h │ ├── ObjFactoryInterface.hpp │ ├── LockFreeCell.h │ ├── AioMax.h │ ├── AioAdd.h │ └── ObjFactoryDef.h ├── fmtc │ ├── version.h │ ├── ConvStep.cpp │ ├── CpuOpt_vs.cpp │ ├── fnc.h │ └── CpuOpt.h ├── ffft │ ├── FFTReal-readme.txt │ └── def.h ├── avs │ ├── filesystem.h │ ├── minmax.h │ └── types.h ├── avsutl │ ├── TFlag.h │ ├── PlaneProcMode.h │ ├── PlaneProcCbInterface_avs.cpp │ ├── fnc.h │ ├── VideoFilterBase.cpp │ └── fnc.hpp ├── vsutl │ ├── PlaneProcMode.h │ ├── NodeRefSPtr.h │ ├── FuncRefSPtr.h │ ├── FrameRefSPtr.h │ ├── PlaneProcCbInterface_vs.cpp │ ├── PlaneProcCbInterface.h │ └── fnc.h ├── fmtcavs │ ├── CpuOpt_avs.cpp │ ├── function_names.h │ └── CpuOpt.h ├── fstb │ ├── Vf32Native.h │ ├── Vs32Native.h │ ├── Vu32Native.h │ ├── ToolsSse2.cpp │ ├── fnc_fstb.cpp │ └── ToolsAvx2.cpp └── test │ ├── TestGammaY.h │ └── GenTestPat.h ├── doc ├── colorspace-subsampling.png └── license.txt ├── COPYING ├── .travis.yml ├── README.md └── .github └── workflows └── build.yaml /.gitattributes: -------------------------------------------------------------------------------- 1 | 2 | *.sh text eol=lf 3 | *.ac text eol=lf 4 | *.am text eol=lf 5 | 6 | -------------------------------------------------------------------------------- /src/fmtcl/Dither.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmusementClub/fmtconv/mod/src/fmtcl/Dither.cpp -------------------------------------------------------------------------------- /src/conc/LockFreeQueue.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmusementClub/fmtconv/mod/src/conc/LockFreeQueue.hpp -------------------------------------------------------------------------------- /doc/colorspace-subsampling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AmusementClub/fmtconv/mod/doc/colorspace-subsampling.png -------------------------------------------------------------------------------- /src/fmtc/version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define fmtc_VERSION 30 4 | #define fmtc_PLUGIN_NAME "fmtconv" 5 | #define fmtc_NAMESPACE "fmtc" 6 | -------------------------------------------------------------------------------- /src/ffft/FFTReal-readme.txt: -------------------------------------------------------------------------------- 1 | 2 | These files are only a subset of the FFTReal library. Please check 3 | https://ldesoras.fr/prod.html#src_fftreal for more information. 4 | -------------------------------------------------------------------------------- /src/avs/filesystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Snippet copied from filesystem/README.md 4 | 5 | #if defined(__cplusplus) && __cplusplus >= 201703L && defined(__has_include) 6 | #if __has_include() 7 | #define GHC_USE_STD_FS 8 | #include 9 | namespace fs = std::filesystem; 10 | #endif 11 | #endif 12 | #ifndef GHC_USE_STD_FS 13 | #include 14 | namespace fs = ghc::filesystem; 15 | #endif 16 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | 15 | -------------------------------------------------------------------------------- /doc/license.txt: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Ubuntu 14.04 Trusty support 2 | sudo: required 3 | dist: trusty 4 | 5 | language: cpp 6 | 7 | matrix: 8 | include: 9 | - os: linux 10 | compiler: gcc 11 | addons: 12 | apt: 13 | sources: 14 | - ubuntu-toolchain-r-test 15 | packages: 16 | - g++-4.8 17 | env: COMPILER=g++-4.8 18 | - os: linux 19 | compiler: gcc 20 | addons: 21 | apt: 22 | sources: 23 | - ubuntu-toolchain-r-test 24 | packages: 25 | - g++-5.3 26 | env: COMPILER=g++-5.3 27 | - os: linux 28 | compiler: clang 29 | addons: 30 | apt: 31 | sources: 32 | - ubuntu-toolchain-r-test 33 | - llvm-toolchain-precise-3.7 34 | packages: 35 | - clang-3.7 36 | env: COMPILER=clang++-3.7 37 | - os: osx 38 | osx_image: xcode7.3 39 | compiler: clang 40 | 41 | before_script: 42 | - cd ./build/unix 43 | - ./autogen.sh 44 | 45 | script: "./configure && make" 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | fmtconv — format conversion tools for Vapoursynth and Avisynth+ 2 | =============================================================== 3 | 4 | Fmtconv is a format-conversion plug-in for the Vapoursynth and Avisynth+ video processing engines. 5 | It does: 6 | * Resizing. 7 | * Bitdepth conversion with dithering. 8 | * Colorspace conversion (matrix, transfer characteristics and chromatic adaptation). 9 | 10 | It supports: 11 | * Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float. 12 | * Colorspaces: RGB, Y, YUV, YCoCg, YDzDx and ICtCp in 4:4:4, 4:2:2, 4:2:0 and 4:1:1 chroma subsampling factors. 13 | * Progressive and interlaced content. 14 | 15 | Fmtconv is focussed primarily on quality and exactness rather than execution speed. 16 | This does not mean it is slow or unoptimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters. 17 | 18 | See `doc/fmtconv.html` for more information. 19 | 20 | Support on the Doom9 forums: [Vapoursynth](http://forum.doom9.org/showthread.php?t=166504) and [Avisynth+](https://forum.doom9.org/showthread.php?t=183139). 21 | -------------------------------------------------------------------------------- /src/fmtcl/PlaneRO.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | PlaneRO.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 (fmtcl_PlaneRO_HEADER_INCLUDED) 20 | #define fmtcl_PlaneRO_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/Plane.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | template 36 | using PlaneRO = Plane ; 37 | 38 | 39 | 40 | } // namespace fmtcl 41 | 42 | 43 | 44 | //#include "fmtcl/PlaneRO.hpp" 45 | 46 | 47 | 48 | #endif // fmtcl_PlaneRO_HEADER_INCLUDED 49 | 50 | 51 | 52 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | -------------------------------------------------------------------------------- /src/fmtc/ConvStep.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ConvStep.cpp 4 | Author: Laurent de Soras, 2014 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtc/ConvStep.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtc 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 36 | 37 | 38 | 39 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | 42 | 43 | } // namespace fmtc 44 | 45 | 46 | 47 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 48 | -------------------------------------------------------------------------------- /src/fmtcl/VoidAndClusterPrecalc.h: -------------------------------------------------------------------------------- 1 | // File generated automatically 2 | #pragma once 3 | #include 4 | #include 5 | namespace fmtcl 6 | { 7 | class VoidAndClusterPrecalc 8 | { 9 | public: 10 | static const std::array _pat_2_std; 11 | static const std::array _pat_3_std; 12 | static const std::array _pat_4_std; 13 | static const std::array _pat_5_std; 14 | static const std::array _pat_6_std; 15 | static const std::array _pat_7_std; 16 | static const std::array _pat_8_std; 17 | static const std::array _pat_9_std; 18 | static const std::array _pat_10_std; 19 | static const std::array _pat_2_alt; 20 | static const std::array _pat_3_alt; 21 | static const std::array _pat_4_alt; 22 | static const std::array _pat_5_alt; 23 | static const std::array _pat_6_alt; 24 | static const std::array _pat_7_alt; 25 | static const std::array _pat_8_alt; 26 | static const std::array _pat_9_alt; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /src/avsutl/TFlag.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TFlag.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 (avsutl_TFlag_HEADER_INCLUDED) 20 | #define avsutl_TFlag_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace avsutl 29 | { 30 | 31 | 32 | 33 | enum class TFlag 34 | { 35 | 36 | U = -1, // Undefined 37 | F = 0, // True 38 | T = 1 // False 39 | 40 | }; // enum TFlag 41 | 42 | 43 | 44 | } // namespace avsutl 45 | 46 | 47 | 48 | //#include "avsutl/TFlag.hpp" 49 | 50 | 51 | 52 | #endif // avsutl_TFlag_HEADER_INCLUDED 53 | 54 | 55 | 56 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 57 | -------------------------------------------------------------------------------- /src/fmtcl/FrameRO.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | FrameRO.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 (fmtcl_FrameRO_HEADER_INCLUDED) 20 | #define fmtcl_FrameRO_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/Frame.h" 27 | 28 | #include 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | template 38 | using FrameRO = Frame ; 39 | 40 | 41 | 42 | } // namespace fmtcl 43 | 44 | 45 | 46 | //#include "fmtcl/FrameRO.hpp" 47 | 48 | 49 | 50 | #endif // fmtcl_FrameRO_HEADER_INCLUDED 51 | 52 | 53 | 54 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | -------------------------------------------------------------------------------- /src/fmtcl/LumMatch.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | LumMatch.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 (fmtcl_LumMatch_HEADER_INCLUDED) 20 | #define fmtcl_LumMatch_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | enum LumMatch 34 | { 35 | 36 | LumMatch_UNDEF = -1, 37 | 38 | LumMatch_NONE = 0, 39 | LumMatch_REF_WHITE, 40 | LumMatch_LUMINANCE, 41 | 42 | LumMatch_NBR_ELT 43 | 44 | }; // enum LumMatch 45 | 46 | 47 | 48 | } // namespace fmtcl 49 | 50 | 51 | 52 | //#include "fmtcl/LumMatch.hpp" 53 | 54 | 55 | 56 | #endif // fmtcl_LumMatch_HEADER_INCLUDED 57 | 58 | 59 | 60 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 61 | -------------------------------------------------------------------------------- /src/conc/fnc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | fnc.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (conc_fnc_HEADER_INCLUDED) 20 | #define conc_fnc_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace conc 29 | { 30 | 31 | 32 | 33 | template 34 | bool is_ptr_aligned (const T *ptr, int align) noexcept; 35 | template 36 | bool is_ptr_aligned_nz (const T *ptr, int align) noexcept; 37 | template 38 | bool is_ptr_aligned_nz (const T *ptr) noexcept; 39 | 40 | 41 | 42 | } // namespace conc 43 | 44 | 45 | 46 | #include "conc/fnc.hpp" 47 | 48 | 49 | 50 | #endif // conc_fnc_HEADER_INCLUDED 51 | 52 | 53 | 54 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | -------------------------------------------------------------------------------- /src/fmtcl/ColorFamily.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ColorFamily.h 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ColorFamily_HEADER_INCLUDED) 20 | #define fmtcl_ColorFamily_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | enum ColorFamily 34 | { 35 | ColorFamily_INVALID = -1, 36 | 37 | ColorFamily_GRAY = 0, 38 | ColorFamily_RGB, 39 | ColorFamily_YUV, 40 | 41 | ColorFamily_NBR_ELT 42 | 43 | }; // enum ColorFamily 44 | 45 | 46 | 47 | } // namespace fmtcl 48 | 49 | 50 | 51 | //#include "fmtcl/ColorFamily.hpp" 52 | 53 | 54 | 55 | #endif // fmtcl_ColorFamily_HEADER_INCLUDED 56 | 57 | 58 | 59 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 60 | -------------------------------------------------------------------------------- /src/vsutl/PlaneProcMode.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | PlaneProcMode.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (vsutl_PlaneProcMode_HEADER_INCLUDED) 20 | #define vsutl_PlaneProcMode_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace vsutl 29 | { 30 | 31 | 32 | 33 | enum PlaneProcMode 34 | { 35 | PlaneProcMode_FILL = 0, 36 | PlaneProcMode_GARBAGE, 37 | PlaneProcMode_COPY1, 38 | PlaneProcMode_PROCESS, 39 | PlaneProcMode_COPY2, 40 | PlaneProcMode_COPY3, 41 | 42 | PlaneProcMode_NBR_ELT 43 | 44 | }; // class PlaneProcMode 45 | 46 | 47 | 48 | } // namespace vsutl 49 | 50 | 51 | 52 | #endif // vsutl_PlaneProcMode_HEADER_INCLUDED 53 | 54 | 55 | 56 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 57 | -------------------------------------------------------------------------------- /src/conc/README.md: -------------------------------------------------------------------------------- 1 | # Conc 2 | 3 | A library for lock-free inter-thread communications. It enables easy inter-tread communication and avoids locking critical threads with mutexes or other synchronisation objects. 4 | 5 | Here are the main utility classes, from a user’s point of view: 6 | 7 | - **`LockFreeCell`**: A template class to wrap a message object and use it in `LockFreeStack`, `LockFreeQueue` or `CellPool`. 8 | - **`LockFreeStack`**: Lock-free stack (LIFO), completely thread-safe. 9 | - **`LockFreeQueue`**: Lock-free queue (FIFO). Concurrent N to M threads access. It’s your main communication building block. 10 | - **`CellPool`**: thread-safe storage for unused or recycled `LockFreeCell` objects. 11 | - **`ObjPool`**: Like `CellPool`, but for any kind of object, providing additional control over creation. 12 | 13 | These classes rely on atomic primitives (using Compare-And-Swap instructions). The **`Atomic*`** classes provide basic data storage, with `AtomicPtrIntPair` being the cornerstone of the previous data structures. **`AtomicIntOp`** is a helper wrapping a user-functor into a CAS loop to execute synchronized operations. There are some functor examples in the **`Aio*`** classes. 14 | 15 | Some of these classes are probably less useful since the introduction of the `` header in C++11, anyway the **`Interlocked`** class probably offers stronger lock-free guaranties, especially for 128-bit CAS required by `AtomicPtrIntPair` on 64-bit systems. -------------------------------------------------------------------------------- /src/fmtcavs/CpuOpt_avs.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | CpuOpt.cpp 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 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcavs/CpuOpt.h" 21 | #include "avisynth.h" 22 | 23 | #include 24 | 25 | 26 | 27 | namespace fmtcavs 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | CpuOpt::CpuOpt (const ::AVSValue &arg) 37 | { 38 | set_level (static_cast ( 39 | arg.AsInt (Level_ANY_AVAILABLE) & Level_MASK 40 | )); 41 | } 42 | 43 | 44 | 45 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 46 | 47 | 48 | 49 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 50 | 51 | 52 | 53 | } // namespace fmtcavs 54 | 55 | 56 | 57 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 58 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirRect.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirRect.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ContFirRect.h" 21 | 22 | 23 | 24 | namespace fmtcl 25 | { 26 | 27 | 28 | 29 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 30 | 31 | 32 | 33 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 34 | 35 | 36 | 37 | double ContFirRect::do_get_support () const 38 | { 39 | return (0.5); 40 | } 41 | 42 | 43 | 44 | double ContFirRect::do_get_val (double x) const 45 | { 46 | return ((x >= -0.5 && x < 0.5) ? 1.0 : 0.0); 47 | } 48 | 49 | 50 | 51 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 52 | 53 | 54 | 55 | } // namespace fmtcl 56 | 57 | 58 | 59 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 60 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirInterface.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirInterface.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ContFirInterface.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | double ContFirInterface::get_support () const 36 | { 37 | const double s = do_get_support (); 38 | assert (s >= 0); 39 | 40 | return (s); 41 | } 42 | 43 | 44 | 45 | double ContFirInterface::get_val (double pos) const 46 | { 47 | return (do_get_val (pos)); 48 | } 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | 55 | 56 | } // namespace fmtcl 57 | 58 | 59 | 60 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 61 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSnh.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSnh.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fstb/def.h" 21 | #include "fmtcl/ContFirSnh.h" 22 | 23 | 24 | 25 | namespace fmtcl 26 | { 27 | 28 | 29 | 30 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 31 | 32 | 33 | 34 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 35 | 36 | 37 | 38 | double ContFirSnh::do_get_support () const 39 | { 40 | return (0); 41 | } 42 | 43 | 44 | 45 | double ContFirSnh::do_get_val (double pos) const 46 | { 47 | fstb::unused (pos); 48 | 49 | return (1); 50 | } 51 | 52 | 53 | 54 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | 57 | 58 | } // namespace fmtcl 59 | 60 | 61 | 62 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | -------------------------------------------------------------------------------- /src/fmtcl/ArrayMultiType.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ArrayMultiType.cpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ArrayMultiType.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | void ArrayMultiType::resize (size_t length) 36 | { 37 | const size_t old_len = _length; 38 | _length = length; 39 | if (_length != old_len) 40 | { 41 | _arr.resize (_length * _data_len); 42 | } 43 | } 44 | 45 | 46 | 47 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 48 | 49 | 50 | 51 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 52 | 53 | 54 | 55 | } // namespace fmtcl 56 | 57 | 58 | 59 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 60 | -------------------------------------------------------------------------------- /src/fmtcl/ResizeData.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ResizeData.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ResizeData.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | ResizeData::ResizeData (int w, int h) 36 | { 37 | assert (w >= 0); 38 | assert (h >= 0); 39 | 40 | const int sz = w * h; 41 | for (int cnt = 0; cnt < NBR_BUF; ++cnt) 42 | { 43 | _buf_arr [cnt].resize (sz); 44 | } 45 | } 46 | 47 | 48 | 49 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 50 | 51 | 52 | 53 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | 56 | 57 | } // namespace fmtcl 58 | 59 | 60 | 61 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 62 | -------------------------------------------------------------------------------- /src/fmtcl/SplFmt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | SplFmt.h 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_SplFmt_HEADER_INCLUDED) 20 | #define fmtcl_SplFmt_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | enum SplFmt 34 | { 35 | SplFmt_ILLEGAL = -1, 36 | 37 | SplFmt_FLOAT = 0, 38 | SplFmt_INT16, 39 | SplFmt_INT8, 40 | 41 | SplFmt_NBR_ELT 42 | 43 | }; // enum SplFmt 44 | 45 | 46 | 47 | inline bool SplFmt_is_float (SplFmt fmt); 48 | inline bool SplFmt_is_int (SplFmt fmt); 49 | inline int SplFmt_get_unit_size (SplFmt fmt); 50 | inline int SplFmt_get_data_size (SplFmt fmt); 51 | 52 | 53 | 54 | } // namespace fmtcl 55 | 56 | 57 | 58 | #include "fmtcl/SplFmt.hpp" 59 | 60 | 61 | 62 | #endif // fmtcl_SplFmt_HEADER_INCLUDED 63 | 64 | 65 | 66 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | -------------------------------------------------------------------------------- /src/fmtcl/Cst_fmtcl.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Cst_fmtcl.cpp 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 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/Cst.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | constexpr int Cst::_max_nbr_planes; 36 | 37 | constexpr int Cst::_rtv_imin; 38 | constexpr int Cst::_rtv_emax; 39 | constexpr int Cst::_rtv_lum_blk; 40 | constexpr int Cst::_rtv_lum_wht; 41 | constexpr int Cst::_rtv_chr_gry; 42 | constexpr int Cst::_rtv_chr_dep; 43 | 44 | 45 | 46 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | 49 | 50 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 51 | 52 | 53 | 54 | } // namespace fmtcl 55 | 56 | 57 | 58 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | -------------------------------------------------------------------------------- /src/avsutl/PlaneProcMode.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | PlaneProcMode.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 (avsutl_PlaneProcMode_HEADER_INCLUDED) 20 | #define avsutl_PlaneProcMode_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace avsutl 29 | { 30 | 31 | 32 | 33 | enum PlaneProcMode 34 | { 35 | PlaneProcMode_ILLEGAL = -999666 * 256, // Exact representation in float & int 36 | 37 | PlaneProcMode_FILL = 0, 38 | PlaneProcMode_GARBAGE, 39 | PlaneProcMode_COPY1, 40 | PlaneProcMode_PROCESS, 41 | PlaneProcMode_COPY2, 42 | PlaneProcMode_COPY3, 43 | 44 | PlaneProcMode_NBR_ELT, 45 | }; // enum PlaneProcMode 46 | 47 | 48 | 49 | } // namespace avsutl 50 | 51 | 52 | 53 | //#include "avsutl/PlaneProcMode.hpp" 54 | 55 | 56 | 57 | #endif // avsutl_PlaneProcMode_HEADER_INCLUDED 58 | 59 | 60 | 61 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 62 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirLinear.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirLinear.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ContFirLinear.h" 21 | 22 | #include 23 | 24 | #include 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 34 | 35 | 36 | 37 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 38 | 39 | 40 | 41 | double ContFirLinear::do_get_support () const 42 | { 43 | return (1.0); 44 | } 45 | 46 | 47 | 48 | double ContFirLinear::do_get_val (double pos) const 49 | { 50 | return (std::max (1.0 - fabs (pos), 0.0)); 51 | } 52 | 53 | 54 | 55 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 56 | 57 | 58 | 59 | } // namespace fmtcl 60 | 61 | 62 | 63 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 64 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpAffine.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpAffine.cpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/TransOpAffine.h" 21 | #include "fstb/fnc.h" 22 | 23 | #include 24 | 25 | 26 | 27 | namespace fmtcl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | TransOpAffine::TransOpAffine (double a, double b) 37 | : _a (a) 38 | , _b (b) 39 | { 40 | assert (! fstb::is_null (a)); 41 | } 42 | 43 | 44 | 45 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 46 | 47 | 48 | 49 | double TransOpAffine::do_convert (double x) const 50 | { 51 | return x * _a + _b; 52 | } 53 | 54 | 55 | 56 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 57 | 58 | 59 | 60 | } // namespace fmtcl 61 | 62 | 63 | 64 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | -------------------------------------------------------------------------------- /src/avsutl/PlaneProcCbInterface_avs.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | PlaneProcCbInterface.cpp 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 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "avsutl/PlaneProcCbInterface.h" 21 | #include "avisynth.h" 22 | 23 | #include 24 | 25 | 26 | 27 | namespace avsutl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | void PlaneProcCbInterface::process_plane (::PVideoFrame &dst_sptr, int n, ::IScriptEnvironment &env, int plane_index, int plane_id, void *ctx_ptr) 37 | { 38 | assert (dst_sptr != nullptr); 39 | assert (n >= 0); 40 | assert (plane_index >= 0); 41 | 42 | do_process_plane (dst_sptr, n, env, plane_index, plane_id, ctx_ptr); 43 | } 44 | 45 | 46 | 47 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 48 | 49 | 50 | 51 | } // namespace avsutl 52 | 53 | 54 | 55 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 56 | -------------------------------------------------------------------------------- /src/fmtc/CpuOpt_vs.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | CpuOpt.cpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtc/CpuOpt.h" 21 | #include "vsutl/FilterBase.h" 22 | 23 | #include 24 | 25 | 26 | 27 | namespace fmtc 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | CpuOpt::CpuOpt (vsutl::FilterBase &filter, const ::VSMap &in, ::VSMap &out, const char *param_name_0) 37 | { 38 | assert (param_name_0 != 0); 39 | set_level (static_cast (filter.get_arg_int ( 40 | in, out, param_name_0, Level_ANY_AVAILABLE 41 | ) & Level_MASK)); 42 | } 43 | 44 | 45 | 46 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | 49 | 50 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 51 | 52 | 53 | 54 | } // namespace fmtc 55 | 56 | 57 | 58 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | -------------------------------------------------------------------------------- /src/fmtcl/MatXyz2Lms.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | MatXyz2Lms.cpp 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 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/MatXyz2Lms.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | constexpr Mat3 MatXyz2Lms::_vonkries_std; 36 | constexpr Mat3 MatXyz2Lms::_vonkries_alt; 37 | constexpr Mat3 MatXyz2Lms::_stockman_sharpe; 38 | 39 | constexpr Mat3 MatXyz2Lms::_bradford; 40 | constexpr Mat3 MatXyz2Lms::_ciecam97s; 41 | constexpr Mat3 MatXyz2Lms::_ciecam02; 42 | constexpr Mat3 MatXyz2Lms::_cam16; 43 | 44 | 45 | 46 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | 49 | 50 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 51 | 52 | 53 | 54 | } // namespace fmtcl 55 | 56 | 57 | 58 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | -------------------------------------------------------------------------------- /src/avsutl/fnc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | fnc.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 (avsutl_fnc_HEADER_INCLUDED) 20 | #define avsutl_fnc_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "avsutl/TFlag.h" 27 | 28 | 29 | 30 | class AVSValue; 31 | struct VideoInfo; 32 | 33 | namespace avsutl 34 | { 35 | 36 | 37 | 38 | TFlag set_tristate (const ::AVSValue &val); 39 | bool set_default (TFlag tristate, bool def_flag); 40 | bool has_alpha (const ::VideoInfo &vi); 41 | int get_nbr_comp_non_alpha (const ::VideoInfo &vi); 42 | bool is_rgb (const ::VideoInfo &vi); 43 | bool is_full_range_default (const ::VideoInfo &vi); 44 | 45 | template 46 | void fill_block (void *ptr, T val, int stride, int w, int h); 47 | 48 | 49 | 50 | } // namespace avsutl 51 | 52 | 53 | 54 | #include "avsutl/fnc.hpp" 55 | 56 | 57 | 58 | #endif // avsutl_fnc_HEADER_INCLUDED 59 | 60 | 61 | 62 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | -------------------------------------------------------------------------------- /src/fmtcl/ResizeData.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ResizeData.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (fmtcl_ResizeData_CODEHEADER_INCLUDED) 19 | #define fmtcl_ResizeData_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | 26 | 27 | namespace fmtcl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | template 37 | T * ResizeData::use_buf (int index) 38 | { 39 | assert (index >= 0); 40 | assert (index < NBR_BUF); 41 | 42 | return (reinterpret_cast (&_buf_arr [index] [0])); 43 | } 44 | 45 | 46 | 47 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 48 | 49 | 50 | 51 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 52 | 53 | 54 | 55 | } // namespace fmtcl 56 | 57 | 58 | 59 | #endif // fmtcl_ResizeData_CODEHEADER_INCLUDED 60 | 61 | 62 | 63 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 64 | -------------------------------------------------------------------------------- /src/conc/AioAdd.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | AioAdd.hpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (conc_AioAdd_CODEHEADER_INCLUDED) 19 | #define conc_AioAdd_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | 26 | 27 | namespace conc 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | template 37 | AioAdd ::AioAdd (T operand) 38 | : _operand (operand) 39 | { 40 | // Nothing 41 | } 42 | 43 | 44 | 45 | template 46 | T AioAdd ::operator () (T old_val) const noexcept 47 | { 48 | return old_val + _operand; 49 | } 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | 56 | 57 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 58 | 59 | 60 | 61 | } // namespace conc 62 | 63 | 64 | 65 | #endif // conc_AioAdd_CODEHEADER_INCLUDED 66 | 67 | 68 | 69 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | -------------------------------------------------------------------------------- /src/conc/AioSub.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | AioSub.hpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (conc_AioSub_CODEHEADER_INCLUDED) 19 | #define conc_AioSub_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | 26 | 27 | namespace conc 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | template 37 | AioSub ::AioSub (T operand) 38 | : _operand (operand) 39 | { 40 | // Nothing 41 | } 42 | 43 | 44 | 45 | template 46 | T AioSub ::operator () (T old_val) const noexcept 47 | { 48 | return old_val - _operand; 49 | } 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | 56 | 57 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 58 | 59 | 60 | 61 | } // namespace conc 62 | 63 | 64 | 65 | #endif // conc_AioSub_CODEHEADER_INCLUDED 66 | 67 | 68 | 69 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | -------------------------------------------------------------------------------- /src/vsutl/NodeRefSPtr.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | NodeRefSPtr.h 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (vsutl_NodeRefSPtr_HEADER_INCLUDED) 20 | #define vsutl_NodeRefSPtr_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "vsutl/ObjRefSPtr.h" 27 | #include "VapourSynth4.h" 28 | 29 | 30 | 31 | namespace vsutl 32 | { 33 | 34 | 35 | 36 | class NodeRefSPtr_FncWrapper 37 | { 38 | public: 39 | static inline ::VSNode * clone (const ::VSAPI &vsapi, ::VSNode *node) VS_NOEXCEPT 40 | { 41 | return (*vsapi.addNodeRef) (node); 42 | } 43 | static inline void free (const ::VSAPI &vsapi, ::VSNode *node) VS_NOEXCEPT 44 | { 45 | (*vsapi.freeNode) (node); 46 | } 47 | }; 48 | 49 | typedef ObjRefSPtr < 50 | ::VSNode, 51 | NodeRefSPtr_FncWrapper 52 | > NodeRefSPtr; 53 | 54 | 55 | 56 | } // namespace vsutl 57 | 58 | 59 | 60 | //#include "vsutl/NodeRefSPtr.hpp" 61 | 62 | 63 | 64 | #endif // vsutl_NodeRefSPtr_HEADER_INCLUDED 65 | 66 | 67 | 68 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpContrast.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpContrast.hpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (fmtcl_TransOpContrast_CODEHEADER_INCLUDED) 19 | #define fmtcl_TransOpContrast_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | #include 26 | 27 | 28 | 29 | namespace fmtcl 30 | { 31 | 32 | 33 | 34 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 35 | 36 | 37 | 38 | TransOpContrast::TransOpContrast (double cont) 39 | : _cont (cont) 40 | { 41 | // Nothing 42 | } 43 | 44 | 45 | 46 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | 49 | 50 | double TransOpContrast::do_convert (double x) const 51 | { 52 | return x * _cont; 53 | } 54 | 55 | 56 | 57 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 58 | 59 | 60 | 61 | } // namespace fmtcl 62 | 63 | 64 | 65 | #endif // fmtcl_TransOpContrast_CODEHEADER_INCLUDED 66 | 67 | 68 | 69 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | -------------------------------------------------------------------------------- /src/conc/AioMax.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | AioMax.hpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (conc_AioMax_CODEHEADER_INCLUDED) 19 | #define conc_AioMax_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | #include 26 | 27 | 28 | 29 | namespace conc 30 | { 31 | 32 | 33 | 34 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 35 | 36 | 37 | 38 | template 39 | AioMax ::AioMax (T operand) 40 | : _operand (operand) 41 | { 42 | // Nothing 43 | } 44 | 45 | 46 | 47 | template 48 | T AioMax ::operator () (T old_val) const noexcept 49 | { 50 | return std::max (old_val, _operand); 51 | } 52 | 53 | 54 | 55 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 56 | 57 | 58 | 59 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 60 | 61 | 62 | 63 | } // namespace conc 64 | 65 | 66 | 67 | #endif // conc_AioMax_CODEHEADER_INCLUDED 68 | 69 | 70 | 71 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 72 | -------------------------------------------------------------------------------- /src/vsutl/FuncRefSPtr.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | FuncRefSPtr.h 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (vsutl_FuncRefSPtr_HEADER_INCLUDED) 20 | #define vsutl_FuncRefSPtr_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "vsutl/ObjRefSPtr.h" 27 | #include "VapourSynth4.h" 28 | 29 | 30 | 31 | namespace vsutl 32 | { 33 | 34 | 35 | 36 | class FuncRefSPtr_FncWrapper 37 | { 38 | public: 39 | static inline ::VSFunction * clone (const ::VSAPI &vsapi, ::VSFunction *func) VS_NOEXCEPT 40 | { 41 | return (*vsapi.addFunctionRef) (func); 42 | } 43 | static inline void free (const ::VSAPI &vsapi, ::VSFunction *func) VS_NOEXCEPT 44 | { 45 | (*vsapi.freeFunc) (func); 46 | } 47 | }; 48 | 49 | typedef ObjRefSPtr < 50 | ::VSFunction, 51 | FuncRefSPtr_FncWrapper 52 | > FuncRefSPtr; 53 | 54 | 55 | 56 | } // namespace vsutl 57 | 58 | 59 | 60 | //#include "vsutl/FuncRefSPtr.hpp" 61 | 62 | 63 | 64 | #endif // vsutl_FuncRefSPtr_HEADER_INCLUDED 65 | 66 | 67 | 68 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | -------------------------------------------------------------------------------- /src/fmtcl/ErrDifBuf.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ErrDifBuf.cpp 4 | Author: Laurent de Soras, 2010 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ErrDifBuf.h" 21 | 22 | #include 23 | #include 24 | 25 | 26 | 27 | namespace fmtcl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | ErrDifBuf::ErrDifBuf (long width) 37 | : _buf_ptr (0) 38 | ,/*_mem () 39 | ,*/_width (width) 40 | , _stride (_width + MARGIN * 2) 41 | { 42 | assert (width > 0); 43 | const long buf_len = _stride * MAX_DATA_SIZE * NBR_LINES; 44 | _buf_ptr = new uint8_t [buf_len]; 45 | } 46 | 47 | 48 | 49 | ErrDifBuf::~ErrDifBuf () 50 | { 51 | delete [] _buf_ptr; 52 | _buf_ptr = 0; 53 | } 54 | 55 | 56 | 57 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 58 | 59 | 60 | 61 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 62 | 63 | 64 | 65 | } // namespace fmtcl 66 | 67 | 68 | 69 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpInterface.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpInterface.cpp 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 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/TransOpInterface.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | constexpr TransOpInterface::LinInfo TransOpInterface::_unbounded; 36 | 37 | 38 | 39 | double TransOpInterface::operator () (double x) const 40 | { 41 | return do_convert (x); 42 | } 43 | 44 | 45 | 46 | TransOpInterface::LinInfo TransOpInterface::get_info () const 47 | { 48 | const auto info = do_get_info (); 49 | 50 | assert (info._vmax >= 1.0); 51 | assert (info._wref > 0); 52 | assert (info._scale_cdm2 >= 0); 53 | assert (info._wpeak_cdm2 >= 0); 54 | 55 | return info; 56 | } 57 | 58 | 59 | 60 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 61 | 62 | 63 | 64 | } // namespace fmtcl 65 | 66 | 67 | 68 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | -------------------------------------------------------------------------------- /src/fmtcavs/function_names.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | function_names.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_function_names_HEADER_INCLUDED) 20 | #define fmtcavs_function_names_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcavs 29 | { 30 | 31 | 32 | 33 | #define fmtcavs_NAMESPACE "fmtc" 34 | 35 | #define fmtcavs_BUILD_NAME(x) fmtcavs_NAMESPACE "_" x 36 | 37 | #define fmtcavs_BITDEPTH fmtcavs_BUILD_NAME ("bitdepth") 38 | #define fmtcavs_MATRIX fmtcavs_BUILD_NAME ("matrix") 39 | #define fmtcavs_MATRIX2020CL fmtcavs_BUILD_NAME ("matrix2020cl") 40 | #define fmtcavs_PRIMARIES fmtcavs_BUILD_NAME ("primaries") 41 | #define fmtcavs_RESAMPLE fmtcavs_BUILD_NAME ("resample") 42 | #define fmtcavs_TRANSFER fmtcavs_BUILD_NAME ("transfer") 43 | 44 | 45 | 46 | } // namespace fmtcavs 47 | 48 | 49 | 50 | //#include "fmtcavs/function_names.hpp" 51 | 52 | 53 | 54 | #endif // fmtcavs_function_names_HEADER_INCLUDED 55 | 56 | 57 | 58 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | -------------------------------------------------------------------------------- /src/fmtcl/ProcComp3Arg.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ProcComp3Arg.cpp 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 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ProcComp3Arg.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | constexpr int ProcComp3Arg::_nbr_planes; 36 | 37 | 38 | 39 | bool ProcComp3Arg::is_valid (bool single_plane_out_flag) const noexcept 40 | { 41 | if (_w <= 0 || _h <= 0) 42 | { 43 | return false; 44 | } 45 | 46 | const int nbr_planes_chk = (single_plane_out_flag) ? 1 : _nbr_planes; 47 | return ( 48 | _dst.is_valid (nbr_planes_chk, _h) 49 | && _src.is_valid (_nbr_planes , _h) 50 | ); 51 | } 52 | 53 | 54 | 55 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 56 | 57 | 58 | 59 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 60 | 61 | 62 | 63 | } // namespace fmtcl 64 | 65 | 66 | 67 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 68 | -------------------------------------------------------------------------------- /src/vsutl/FrameRefSPtr.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | FrameRefSPtr.h 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (vsutl_FrameRefSPtr_HEADER_INCLUDED) 20 | #define vsutl_FrameRefSPtr_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "vsutl/ObjRefSPtr.h" 27 | #include "VapourSynth4.h" 28 | 29 | 30 | 31 | namespace vsutl 32 | { 33 | 34 | 35 | 36 | class FrameRefSPtr_FncWrapper 37 | { 38 | public: 39 | static inline const ::VSFrame * clone (const ::VSAPI &vsapi, const ::VSFrame *f) VS_NOEXCEPT 40 | { 41 | return (*vsapi.addFrameRef) (f); 42 | } 43 | static inline void free (const ::VSAPI &vsapi, const ::VSFrame *f) VS_NOEXCEPT 44 | { 45 | (*vsapi.freeFrame) (f); 46 | } 47 | }; 48 | 49 | typedef ObjRefSPtr < 50 | const ::VSFrame, 51 | FrameRefSPtr_FncWrapper 52 | > FrameRefSPtr; 53 | 54 | 55 | 56 | } // namespace vsutl 57 | 58 | 59 | 60 | //#include "vsutl/FrameRefSPtr.hpp" 61 | 62 | 63 | 64 | #endif // vsutl_FrameRefSPtr_HEADER_INCLUDED 65 | 66 | 67 | 68 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | -------------------------------------------------------------------------------- /src/fmtcl/InterlacingType.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | InterlacingType.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 (fmtcl_InterlacingType_HEADER_INCLUDED) 20 | #define fmtcl_InterlacingType_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | enum InterlacingType 34 | { 35 | InterlacingType_INVALID = -1, 36 | 37 | InterlacingType_FRAME = 0, 38 | InterlacingType_TOP, 39 | InterlacingType_BOT, 40 | 41 | InterlacingType_NBR_ELT 42 | 43 | }; // enum InterlacingType 44 | 45 | 46 | 47 | inline InterlacingType InterlacingType_get (bool itl_flag, bool top_flag) 48 | { 49 | return 50 | (itl_flag) ? ((top_flag) ? InterlacingType_TOP 51 | : InterlacingType_BOT) 52 | : InterlacingType_FRAME; 53 | } 54 | 55 | 56 | 57 | } // namespace fmtcl 58 | 59 | 60 | 61 | //#include "fmtcl/InterlacingType.hpp" 62 | 63 | 64 | 65 | #endif // fmtcl_InterlacingType_HEADER_INCLUDED 66 | 67 | 68 | 69 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | 71 | -------------------------------------------------------------------------------- /src/fmtcl/ChromaPlacement.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ChromaPlacement.h 4 | Author: Laurent de Soras, 2014 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ChromaPlacement_HEADER_INCLUDED) 20 | #define fmtcl_ChromaPlacement_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | enum ChromaPlacement 34 | { 35 | ChromaPlacement_INVALID = -2, 36 | ChromaPlacement_UNDEF = -1, 37 | 38 | ChromaPlacement_MPEG1 = 0, // Type 1 39 | ChromaPlacement_MPEG2, // Type 0 40 | ChromaPlacement_DV, 41 | ChromaPlacement_T_L, // Type 2 (top left) 42 | 43 | ChromaPlacement_NBR_ELT 44 | }; 45 | 46 | 47 | 48 | void ChromaPlacement_compute_cplace (double &cp_h, double &cp_v, ChromaPlacement cplace, int plane_index, int ss_h, int ss_v, bool rgb_flag, bool interlaced_flag, bool top_flag); 49 | 50 | 51 | 52 | } // namespace fmtcl 53 | 54 | 55 | 56 | //#include "fmtcl/ChromaPlacement.hpp" 57 | 58 | 59 | 60 | #endif // fmtcl_ChromaPlacement_HEADER_INCLUDED 61 | 62 | 63 | 64 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | -------------------------------------------------------------------------------- /src/fmtcl/Matrix2020CLProc_macro.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Matrix2020CLProc_macro.h 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_Matrix2020CLProc_macro_HEADER_INCLUDED) 20 | #define fmtcl_Matrix2020CLProc_macro_HEADER_INCLUDED 21 | 22 | 23 | 24 | // Dst fmt, dst bits, src fmt, src bits 25 | #define fmtcl_Matrix2020CLProc_TO_YUV_SPAN_I(CI) \ 26 | CI (INT8 , 8, INT16 , 16) \ 27 | CI (INT16 , 9, INT16 , 16) \ 28 | CI (INT16 , 10, INT16 , 16) \ 29 | CI (INT16 , 11, INT16 , 16) \ 30 | CI (INT16 , 12, INT16 , 16) \ 31 | CI (INT16 , 14, INT16 , 16) \ 32 | CI (INT16 , 16, INT16 , 16) 33 | 34 | 35 | 36 | // Dst fmt, dst bits, src fmt, src bits 37 | #define fmtcl_Matrix2020CLProc_TO_RGB_SPAN_I(CI) \ 38 | CI (INT16 , 16, INT8 , 8) \ 39 | CI (INT16 , 16, INT16 , 9) \ 40 | CI (INT16 , 16, INT16 , 10) \ 41 | CI (INT16 , 16, INT16 , 11) \ 42 | CI (INT16 , 16, INT16 , 12) \ 43 | CI (INT16 , 16, INT16 , 14) \ 44 | CI (INT16 , 16, INT16 , 16) 45 | 46 | 47 | 48 | #endif // fmtcl_Matrix2020CLProc_macro_HEADER_INCLUDED 49 | 50 | 51 | 52 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | -------------------------------------------------------------------------------- /src/conc/ObjFactoryDef.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ObjFactoryDef.hpp 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (conc_ObjFactoryDef_CODEHEADER_INCLUDED) 19 | #define conc_ObjFactoryDef_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | 26 | 27 | namespace conc 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | template 37 | ObjFactoryDef ObjFactoryDef ::_fact; 38 | 39 | 40 | 41 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 42 | 43 | 44 | 45 | template 46 | T * ObjFactoryDef ::do_create () 47 | { 48 | T * ptr = 0; 49 | try 50 | { 51 | ptr = new T; 52 | } 53 | catch (...) 54 | { 55 | // Nothing 56 | } 57 | 58 | return (ptr); 59 | } 60 | 61 | 62 | 63 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 64 | 65 | 66 | 67 | } // namespace conc 68 | 69 | 70 | 71 | #endif // conc_ObjFactoryDef_CODEHEADER_INCLUDED 72 | 73 | 74 | 75 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 76 | -------------------------------------------------------------------------------- /src/ffft/def.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | def.h 4 | By Laurent de Soras 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (ffft_def_HEADER_INCLUDED) 20 | #define ffft_def_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace ffft 29 | { 30 | 31 | 32 | 33 | constexpr double PI = 3.1415926535897932384626433832795; 34 | constexpr double SQRT2 = 1.41421356237309514547462185873883; 35 | 36 | #if defined (_MSC_VER) 37 | 38 | #define ffft_FORCEINLINE __forceinline 39 | 40 | #else 41 | 42 | #define ffft_FORCEINLINE inline 43 | 44 | #endif 45 | 46 | // Compiler type 47 | #define ffft_COMPILER_UNKNOWN (-1) 48 | #define ffft_COMPILER_GCC (1) 49 | #define ffft_COMPILER_MSVC (2) 50 | 51 | #if defined (__GNUC__) || defined (__clang__) 52 | #define ffft_COMPILER ffft_COMPILER_GCC 53 | #elif defined (_MSC_VER) 54 | #define ffft_COMPILER ffft_COMPILER_MSVC 55 | #else 56 | #define ffft_COMPILER ffft_COMPILER_UNKNOWN 57 | #endif 58 | 59 | 60 | 61 | 62 | } // namespace ffft 63 | 64 | 65 | 66 | #endif // ffft_def_HEADER_INCLUDED 67 | 68 | 69 | 70 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | -------------------------------------------------------------------------------- /src/vsutl/PlaneProcCbInterface_vs.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | PlaneProcCbInterface.cpp 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "vsutl/PlaneProcCbInterface.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace vsutl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | int PlaneProcCbInterface::process_plane (::VSFrame &dst, int n, int plane_index, void *frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core, const NodeRefSPtr &src_node1_sptr, const NodeRefSPtr &src_node2_sptr, const NodeRefSPtr &src_node3_sptr) 36 | { 37 | assert (n >= 0); 38 | assert (plane_index >= 0); 39 | 40 | return do_process_plane ( 41 | dst, 42 | n, 43 | plane_index, 44 | frame_data_ptr, 45 | frame_ctx, 46 | core, 47 | src_node1_sptr, 48 | src_node2_sptr, 49 | src_node3_sptr 50 | ); 51 | } 52 | 53 | 54 | 55 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 56 | 57 | 58 | 59 | } // namespace vsutl 60 | 61 | 62 | 63 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 64 | -------------------------------------------------------------------------------- /src/conc/fnc.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | fnc.hpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (conc_fnc_CODEHEADER_INCLUDED) 19 | #define conc_fnc_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | #include 26 | #include 27 | 28 | 29 | 30 | namespace conc 31 | { 32 | 33 | 34 | 35 | template 36 | bool is_ptr_aligned (const T *ptr, int align) noexcept 37 | { 38 | assert (align > 0); 39 | assert ((align & -align) == align); 40 | 41 | return ((reinterpret_cast (ptr) & (align - 1)) == 0); 42 | } 43 | 44 | template 45 | bool is_ptr_aligned_nz (const T *ptr, int align) noexcept 46 | { 47 | assert (align > 0); 48 | assert ((align & -align) == align); 49 | 50 | return (ptr != nullptr && is_ptr_aligned (ptr, align)); 51 | } 52 | 53 | template 54 | bool is_ptr_aligned_nz (const T *ptr) noexcept 55 | { 56 | return (is_ptr_aligned_nz (ptr, int (sizeof (T)))); 57 | } 58 | 59 | 60 | 61 | } // namespace conc 62 | 63 | 64 | 65 | #endif // conc_fnc_CODEHEADER_INCLUDED 66 | 67 | 68 | 69 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | -------------------------------------------------------------------------------- /src/fmtcl/ResizeDataFactory.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ResizeDataFactory.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ResizeData.h" 21 | #include "fmtcl/ResizeDataFactory.h" 22 | 23 | #include 24 | 25 | 26 | 27 | namespace fmtcl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | ResizeDataFactory::ResizeDataFactory (int w, int h) 37 | : _w (w) 38 | , _h (h) 39 | { 40 | assert (w >= 0); 41 | assert (h >= 0); 42 | } 43 | 44 | 45 | 46 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | 49 | 50 | ResizeData * ResizeDataFactory::do_create () 51 | { 52 | ResizeData * data_ptr = 0; 53 | try 54 | { 55 | data_ptr = new ResizeData (_w, _h); 56 | } 57 | catch (...) 58 | { 59 | data_ptr = 0; 60 | } 61 | 62 | return (data_ptr); 63 | } 64 | 65 | 66 | 67 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 68 | 69 | 70 | 71 | } // namespace fmtcl 72 | 73 | 74 | 75 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 76 | -------------------------------------------------------------------------------- /src/fstb/Vf32Native.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Vf32Native.h 4 | Author: Laurent de Soras, 2024 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 (fstb_Vf32Native_HEADER_INCLUDED) 20 | #define fstb_Vf32Native_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fstb/def.h" 27 | 28 | #if ! defined (fstb_HAS_SIMD) 29 | #include 30 | #elif (fstb_ARCHI == fstb_ARCHI_X86) 31 | #include 32 | #elif (fstb_ARCHI == fstb_ARCHI_ARM) 33 | #include 34 | #else 35 | #error 36 | #endif 37 | 38 | 39 | 40 | namespace fstb 41 | { 42 | 43 | 44 | 45 | #if ! defined (fstb_HAS_SIMD) 46 | 47 | typedef std::array Vf32Native; 48 | 49 | #elif fstb_ARCHI == fstb_ARCHI_X86 50 | 51 | typedef __m128 Vf32Native; 52 | 53 | #elif fstb_ARCHI == fstb_ARCHI_ARM 54 | 55 | typedef float32x4_t Vf32Native; 56 | 57 | #else // fstb_ARCHI 58 | #error 59 | #endif // fstb_ARCHI 60 | 61 | 62 | 63 | } // namespace fstb 64 | 65 | 66 | 67 | //#include "fstb/Vf32Native.hpp" 68 | 69 | 70 | 71 | #endif // fstb_Vf32Native_HEADER_INCLUDED 72 | 73 | 74 | 75 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 76 | -------------------------------------------------------------------------------- /src/fmtcl/ReadWrapperFlt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ReadWrapperFlt.h 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ReadWrapperFlt_HEADER_INCLUDED) 20 | #define fmtcl_ReadWrapperFlt_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | template 34 | class ReadWrapperFlt 35 | { 36 | public: 37 | 38 | template 39 | static fstb_FORCEINLINE void 40 | read (typename SRC::PtrConst::Type ptr, VF &src0, VF &src1, const VI &zero, int /*len*/); 41 | 42 | }; // class ReadWrapperFlt 43 | 44 | template 45 | class ReadWrapperFlt 46 | { 47 | public: 48 | 49 | template 50 | static fstb_FORCEINLINE void 51 | read (typename SRC::PtrConst::Type ptr, VF &src0, VF &src1, const VI &zero, int len); 52 | }; 53 | 54 | 55 | 56 | } // namespace fmtcl 57 | 58 | 59 | 60 | #include "fmtcl/ReadWrapperFlt.hpp" 61 | 62 | 63 | 64 | #endif // fmtcl_ReadWrapperFlt_HEADER_INCLUDED 65 | 66 | 67 | 68 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirInterface.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirInterface.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ContFirInterface_HEADER_INCLUDED) 20 | #define fmtcl_ContFirInterface_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | class ContFirInterface 34 | { 35 | 36 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 37 | 38 | public: 39 | 40 | virtual ~ContFirInterface () {} 41 | 42 | double get_support () const; 43 | double get_val (double pos) const; 44 | 45 | 46 | 47 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 48 | 49 | protected: 50 | 51 | virtual double do_get_support () const = 0; 52 | virtual double do_get_val (double pos) const = 0; 53 | 54 | 55 | 56 | }; // class ContFirInterface 57 | 58 | 59 | 60 | } // namespace fmtcl 61 | 62 | 63 | 64 | //#include "fmtcl/ContFirInterface.hpp" 65 | 66 | 67 | 68 | #endif // fmtcl_ContFirInterface_HEADER_INCLUDED 69 | 70 | 71 | 72 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | -------------------------------------------------------------------------------- /src/fmtcl/DiscreteFirInterface.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | DiscreteFirInterface.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/DiscreteFirInterface.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | int DiscreteFirInterface::get_len () const 36 | { 37 | const int len = do_get_len (); 38 | assert (len > 0); 39 | assert ((len & 1) == 1); 40 | 41 | return (len); 42 | } 43 | 44 | 45 | 46 | double DiscreteFirInterface::get_ovrspl () const 47 | { 48 | const double ovrspl = do_get_ovrspl (); 49 | assert (ovrspl > 0); 50 | 51 | return (ovrspl); 52 | } 53 | 54 | 55 | 56 | double DiscreteFirInterface::get_val (int pos) const 57 | { 58 | assert (pos >= 0); 59 | assert (pos < do_get_len ()); 60 | 61 | return (do_get_val (pos)); 62 | } 63 | 64 | 65 | 66 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | 68 | 69 | 70 | } // namespace fmtcl 71 | 72 | 73 | 74 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 75 | -------------------------------------------------------------------------------- /src/conc/ObjFactoryInterface.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ObjFactoryInterface.h 4 | Author: Laurent de Soras, 2012 5 | 6 | Implement this interface to construct the objects stored in ObjPool. 7 | 8 | --- Legal stuff --- 9 | 10 | This program is free software. It comes without any warranty, to 11 | the extent permitted by applicable law. You can redistribute it 12 | and/or modify it under the terms of the Do What The Fuck You Want 13 | To Public License, Version 2, as published by Sam Hocevar. See 14 | http://sam.zoy.org/wtfpl/COPYING for more details. 15 | 16 | *Tab=3***********************************************************************/ 17 | 18 | 19 | 20 | #pragma once 21 | #if ! defined (conc_ObjFactoryInterface_HEADER_INCLUDED) 22 | #define conc_ObjFactoryInterface_HEADER_INCLUDED 23 | 24 | 25 | 26 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 27 | 28 | 29 | 30 | namespace conc 31 | { 32 | 33 | 34 | 35 | template 36 | class ObjFactoryInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | virtual ~ObjFactoryInterface () = default; 44 | 45 | T * create (); 46 | 47 | 48 | 49 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 50 | 51 | protected: 52 | 53 | virtual T * do_create () = 0; 54 | 55 | 56 | 57 | }; // class ObjFactoryInterface 58 | 59 | 60 | 61 | } // namespace conc 62 | 63 | 64 | 65 | #include "conc/ObjFactoryInterface.hpp" 66 | 67 | 68 | 69 | #endif // conc_ObjFactoryInterface_HEADER_INCLUDED 70 | 71 | 72 | 73 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 74 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSinc.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSinc.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ContFirSinc.h" 21 | #include "fstb/fnc.h" 22 | 23 | #include 24 | #include 25 | 26 | 27 | 28 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | ContFirSinc::ContFirSinc (int taps) 38 | : _taps (taps) 39 | { 40 | assert (taps >= 1); 41 | assert (taps <= 128); 42 | } 43 | 44 | 45 | 46 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | 49 | 50 | double ContFirSinc::do_get_support () const 51 | { 52 | return (_taps); 53 | } 54 | 55 | 56 | 57 | double ContFirSinc::do_get_val (double x) const 58 | { 59 | double val = 0; 60 | if (fabs (x) <= _taps) 61 | { 62 | val = fstb::sinc (x); 63 | } 64 | 65 | return (val); 66 | } 67 | 68 | 69 | 70 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | 72 | 73 | 74 | } // namespace fmtcl 75 | 76 | 77 | 78 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 79 | -------------------------------------------------------------------------------- /src/fstb/Vs32Native.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Vs32Native.h 4 | Author: Laurent de Soras, 2024 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 (fstb_Vs32Native_HEADER_INCLUDED) 20 | #define fstb_Vs32Native_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fstb/def.h" 27 | 28 | #if ! defined (fstb_HAS_SIMD) 29 | #include 30 | #elif (fstb_ARCHI == fstb_ARCHI_X86) 31 | #include 32 | #elif (fstb_ARCHI == fstb_ARCHI_ARM) 33 | #include 34 | #else 35 | #error 36 | #endif 37 | 38 | #include 39 | 40 | 41 | 42 | namespace fstb 43 | { 44 | 45 | 46 | 47 | #if ! defined (fstb_HAS_SIMD) 48 | 49 | typedef std::array Vs32Native; 50 | 51 | #elif fstb_ARCHI == fstb_ARCHI_X86 52 | 53 | typedef __m128i Vs32Native; 54 | 55 | #elif fstb_ARCHI == fstb_ARCHI_ARM 56 | 57 | typedef int32x4_t Vs32Native; 58 | 59 | #else // fstb_ARCHI 60 | #error 61 | #endif // fstb_ARCHI 62 | 63 | 64 | 65 | } // namespace fstb 66 | 67 | 68 | 69 | //#include "fstb/Vs32Native.hpp" 70 | 71 | 72 | 73 | #endif // fstb_Vs32Native_HEADER_INCLUDED 74 | 75 | 76 | 77 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 78 | -------------------------------------------------------------------------------- /src/fstb/Vu32Native.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Vu32Native.h 4 | Author: Laurent de Soras, 2024 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 (fstb_Vu32Native_HEADER_INCLUDED) 20 | #define fstb_Vu32Native_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fstb/def.h" 27 | 28 | #if ! defined (fstb_HAS_SIMD) 29 | #include 30 | #elif (fstb_ARCHI == fstb_ARCHI_X86) 31 | #include 32 | #elif (fstb_ARCHI == fstb_ARCHI_ARM) 33 | #include 34 | #else 35 | #error 36 | #endif 37 | 38 | #include 39 | 40 | 41 | 42 | namespace fstb 43 | { 44 | 45 | 46 | 47 | #if ! defined (fstb_HAS_SIMD) 48 | 49 | typedef std::array Vu32Native; 50 | 51 | #elif fstb_ARCHI == fstb_ARCHI_X86 52 | 53 | typedef __m128i Vu32Native; 54 | 55 | #elif fstb_ARCHI == fstb_ARCHI_ARM 56 | 57 | typedef uint32x4_t Vu32Native; 58 | 59 | #else // fstb_ARCHI 60 | #error 61 | #endif // fstb_ARCHI 62 | 63 | 64 | 65 | } // namespace fstb 66 | 67 | 68 | 69 | //#include "fstb/Vu32Native.hpp" 70 | 71 | 72 | 73 | #endif // fstb_Vu32Native_HEADER_INCLUDED 74 | 75 | 76 | 77 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 78 | -------------------------------------------------------------------------------- /src/fmtcl/ErrDifBufFactory.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ErrDifBufFactory.cpp 4 | Author: Laurent de Soras, 2010 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ErrDifBufFactory.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | ErrDifBufFactory::ErrDifBufFactory (long width) 36 | : _width (width) 37 | { 38 | assert (width > 0); 39 | } 40 | 41 | 42 | 43 | long ErrDifBufFactory::get_width () const noexcept 44 | { 45 | return _width; 46 | } 47 | 48 | 49 | 50 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 51 | 52 | 53 | 54 | ErrDifBuf * ErrDifBufFactory::do_create () 55 | { 56 | ErrDifBuf * buf_ptr = 0; 57 | try 58 | { 59 | buf_ptr = new ErrDifBuf (_width); 60 | } 61 | catch (...) 62 | { 63 | buf_ptr = 0; 64 | } 65 | 66 | return (buf_ptr); 67 | } 68 | 69 | 70 | 71 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 72 | 73 | 74 | 75 | } // namespace fmtcl 76 | 77 | 78 | 79 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 80 | -------------------------------------------------------------------------------- /src/fmtcl/ReadWrapperInt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ReadWrapperInt.h 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ReadWrapperInt_HEADER_INCLUDED) 20 | #define fmtcl_ReadWrapperInt_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | template 34 | class ReadWrapperInt 35 | { 36 | public: 37 | 38 | template 39 | static fstb_FORCEINLINE VI 40 | read (const typename SRC::PtrConst::Type &ptr, const VI &zero, const VI &sign_bit, int /*len*/); 41 | 42 | }; // class ReadWrapperInt 43 | 44 | template 45 | class ReadWrapperInt 46 | { 47 | public: 48 | 49 | template 50 | static fstb_FORCEINLINE VI 51 | read (const typename SRC::PtrConst::Type &ptr, const VI &zero, const VI &sign_bit, int len); 52 | 53 | }; 54 | 55 | 56 | 57 | } // namespace fmtcl 58 | 59 | 60 | 61 | #include "fmtcl/ReadWrapperInt.hpp" 62 | 63 | 64 | 65 | #endif // fmtcl_ReadWrapperInt_HEADER_INCLUDED 66 | 67 | 68 | 69 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirCustom.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirCustom.cpp 4 | Author: Akarin, 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if defined (_MSC_VER) 19 | #pragma warning (1 : 4130 4223 4705 4706) 20 | #pragma warning (4 : 4355 4786 4800) 21 | #endif 22 | 23 | 24 | 25 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 26 | 27 | #include "fmtcl/ContFirCustom.h" 28 | 29 | #include 30 | #include 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | 42 | 43 | ContFirCustom::ContFirCustom (const std::function &k, double sup) 44 | : _kernel(k) 45 | , _support(sup) 46 | { 47 | // Nothing 48 | } 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | 55 | 56 | double ContFirCustom::do_get_support () const 57 | { 58 | return _support; 59 | } 60 | 61 | 62 | 63 | double ContFirCustom::do_get_val (double x) const 64 | { 65 | return _kernel(x); 66 | } 67 | 68 | 69 | 70 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | 72 | 73 | 74 | } // namespace fmtcl 75 | 76 | 77 | 78 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 79 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirGauss.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirGauss.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ContFirGauss.h" 21 | #include "fstb/fnc.h" 22 | 23 | #include 24 | #include 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 34 | 35 | 36 | 37 | ContFirGauss::ContFirGauss (int taps, double p) 38 | : _taps (taps) 39 | , _p (fstb::limit (p, 1.0, 100.0) / 10) 40 | { 41 | assert (taps >= 1); 42 | assert (taps <= 128); 43 | } 44 | 45 | 46 | 47 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 48 | 49 | 50 | 51 | double ContFirGauss::do_get_support () const 52 | { 53 | return (_taps); 54 | } 55 | 56 | 57 | 58 | double ContFirGauss::do_get_val (double x) const 59 | { 60 | double val = 0; 61 | if (fabs (x) <= _taps) 62 | { 63 | val = pow (2.0, -_p * x * x); 64 | } 65 | 66 | return (val); 67 | } 68 | 69 | 70 | 71 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 72 | 73 | 74 | 75 | } // namespace fmtcl 76 | 77 | 78 | 79 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 80 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpCompose.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpCompose.hpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (fmtcl_TransOpCompose_CODEHEADER_INCLUDED) 19 | #define fmtcl_TransOpCompose_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | #include 26 | 27 | 28 | 29 | namespace fmtcl 30 | { 31 | 32 | 33 | 34 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 35 | 36 | 37 | 38 | TransOpCompose::TransOpCompose (OpSPtr op_1_sptr, OpSPtr op_2_sptr) 39 | : _op_1_sptr (op_1_sptr) 40 | , _op_2_sptr (op_2_sptr) 41 | { 42 | assert (op_1_sptr.get () != 0); 43 | assert (op_2_sptr.get () != 0); 44 | } 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | 51 | 52 | double TransOpCompose::do_convert (double x) const 53 | { 54 | x = (*_op_1_sptr) (x); 55 | x = (*_op_2_sptr) (x); 56 | 57 | return x; 58 | } 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | 65 | 66 | } // namespace fmtcl 67 | 68 | 69 | 70 | #endif // fmtcl_TransOpCompose_CODEHEADER_INCLUDED 71 | 72 | 73 | 74 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 75 | -------------------------------------------------------------------------------- /src/fstb/ToolsSse2.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ToolsSse2.cpp 4 | Author: Laurent de Soras, 2016 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "ToolsSse2.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fstb 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | const ToolsSse2::VectI32 ToolsSse2::_zero = { 0, 0, 0, 0 }; 36 | 37 | const ToolsSse2::VectI32 ToolsSse2::_c16_8000 = 38 | { 0x80008000, 0x80008000, 0x80008000, 0x80008000 }; 39 | 40 | const ToolsSse2::VectI32 ToolsSse2::_c32_00008000 = 41 | { 0x8000, 0x8000, 0x8000, 0x8000 }; 42 | 43 | const ToolsSse2::VectI32 ToolsSse2::_c32_0000ffff = 44 | { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }; 45 | 46 | const ToolsSse2::VectI32 ToolsSse2::_mask_lo64 = 47 | { 0xFFFFFFFF, 0xFFFFFFFF, 0, 0 }; 48 | 49 | const ToolsSse2::VectI32 ToolsSse2::_mask_abs = 50 | { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF }; 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | 61 | 62 | } // namespace fstb 63 | 64 | 65 | 66 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSpline16.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSpline16.cpp 4 | Author: Laurent de Soras, 2011 5 | 6 | C0 continuity only, derivatives are not continuous. 7 | https://forum.doom9.org/showthread.php?t=147117 8 | 9 | --- Legal stuff --- 10 | 11 | This program is free software. It comes without any warranty, to 12 | the extent permitted by applicable law. You can redistribute it 13 | and/or modify it under the terms of the Do What The Fuck You Want 14 | To Public License, Version 2, as published by Sam Hocevar. See 15 | http://sam.zoy.org/wtfpl/COPYING for more details. 16 | 17 | *Tab=3***********************************************************************/ 18 | 19 | 20 | 21 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 22 | 23 | #include "fmtcl/ContFirSpline16.h" 24 | 25 | #include 26 | 27 | 28 | 29 | namespace fmtcl 30 | { 31 | 32 | 33 | 34 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 35 | 36 | 37 | 38 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | double ContFirSpline16::do_get_support () const 43 | { 44 | return (2.0); 45 | } 46 | 47 | 48 | 49 | double ContFirSpline16::do_get_val (double x) const 50 | { 51 | x = fabs (x); 52 | 53 | double v = 0; 54 | if (x < 1.0) 55 | { 56 | v = (( x - 9.0/5.0) * x - 1.0/5.0 ) * x + 1.0; 57 | } 58 | else if (x < 2.0) 59 | { 60 | x -= 1.0; 61 | v = ((-1.0/3.0 * x + 4.0/5.0) * x - 7.0/15.0) * x; 62 | } 63 | 64 | return (v); 65 | } 66 | 67 | 68 | 69 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | 71 | 72 | 73 | } // namespace fmtcl 74 | 75 | 76 | 77 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 78 | -------------------------------------------------------------------------------- /src/fmtcl/DiscreteFirInterface.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | DiscreteFirInterface.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_DiscreteFirInterface_HEADER_INCLUDED) 20 | #define fmtcl_DiscreteFirInterface_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | class DiscreteFirInterface 34 | { 35 | 36 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 37 | 38 | public: 39 | 40 | virtual ~DiscreteFirInterface () {} 41 | 42 | int get_len () const; 43 | double get_ovrspl () const; 44 | double get_val (int pos) const; 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | virtual int do_get_len () const = 0; 53 | virtual double do_get_ovrspl () const = 0; 54 | virtual double do_get_val (int pos) const = 0; 55 | 56 | 57 | 58 | }; // class DiscreteFirInterface 59 | 60 | 61 | 62 | } // namespace fmtcl 63 | 64 | 65 | 66 | //#include "fmtcl/DiscreteFirInterface.hpp" 67 | 68 | 69 | 70 | #endif // fmtcl_DiscreteFirInterface_HEADER_INCLUDED 71 | 72 | 73 | 74 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 75 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSpline36.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSpline36.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ContFirSpline36.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 36 | 37 | 38 | 39 | double ContFirSpline36::do_get_support () const 40 | { 41 | return (3.0); 42 | } 43 | 44 | 45 | 46 | double ContFirSpline36::do_get_val (double x) const 47 | { 48 | x = fabs (x); 49 | 50 | double v = 0; 51 | if (x < 1.0) 52 | { 53 | v = ((13.0/11.0 * x - 453.0/209.0) * x - 3.0/209.0) * x + 1.0; 54 | } 55 | else if (x < 2.0) 56 | { 57 | x -= 1.0; 58 | v = ((-6.0/11.0 * x + 270.0/209.0) * x - 156.0/209.0) * x; 59 | } 60 | else if (x < 3.0) 61 | { 62 | x -= 2.0; 63 | v = (( 1.0/11.0 * x - 45.0/209.0) * x + 26.0/209.0) * x; 64 | } 65 | 66 | return (v); 67 | } 68 | 69 | 70 | 71 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 72 | 73 | 74 | 75 | } // namespace fmtcl 76 | 77 | 78 | 79 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 80 | -------------------------------------------------------------------------------- /src/fstb/fnc_fstb.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | fnc_fstb.cpp 4 | Author: Laurent de Soras, 2010 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | 19 | 20 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 21 | 22 | #include "fstb/fnc.h" 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | 29 | 30 | namespace fstb 31 | { 32 | 33 | 34 | 35 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 36 | 37 | 38 | 39 | // Only for ANSI strings. 40 | void conv_to_lower_case (std::string &str) 41 | { 42 | for (std::string::size_type p = 0; p < str.length (); ++p) 43 | { 44 | str [p] = char (tolower (str [p])); 45 | } 46 | } 47 | 48 | 49 | 50 | int snprintf4all (char *out_0, size_t size, const char *format_0, ...) 51 | { 52 | va_list ap; 53 | va_start (ap, format_0); 54 | int cnt = -1; 55 | 56 | #if defined (_MSC_VER) && (_MSC_VER < 1900) 57 | 58 | if (size != 0) 59 | { 60 | cnt = _vsnprintf_s (out_0, size, _TRUNCATE, format_0, ap); 61 | } 62 | if (cnt == -1) 63 | { 64 | cnt = _vscprintf (format_0, ap); 65 | } 66 | 67 | #else 68 | 69 | cnt = vsnprintf (out_0, size, format_0, ap); 70 | 71 | #endif 72 | 73 | va_end (ap); 74 | 75 | return cnt; 76 | } 77 | 78 | 79 | 80 | } // namespace fstb 81 | 82 | 83 | 84 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 85 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpLogTrunc.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpLogTrunc.cpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/TransOpLogTrunc.h" 21 | #include "fstb/fnc.h" 22 | 23 | #include 24 | #include 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 34 | 35 | 36 | 37 | TransOpLogTrunc::TransOpLogTrunc (bool inv_flag, double alpha, double beta) 38 | : _inv_flag (inv_flag) 39 | , _alpha (alpha) 40 | , _beta (beta) 41 | { 42 | // Nothing 43 | } 44 | 45 | 46 | 47 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 48 | 49 | 50 | 51 | double TransOpLogTrunc::do_convert (double x) const 52 | { 53 | x = fstb::limit (x, 0.0, 1.0); 54 | double y = x; 55 | 56 | if (_inv_flag) 57 | { 58 | y = pow (10, (x - 1) / _alpha); 59 | } 60 | else 61 | { 62 | if (x >= _beta) 63 | { 64 | y = 1 + _alpha * log10 (x); 65 | } 66 | else 67 | { 68 | y = 0; 69 | } 70 | } 71 | 72 | return y; 73 | } 74 | 75 | 76 | 77 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 78 | 79 | 80 | 81 | } // namespace fmtcl 82 | 83 | 84 | 85 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 86 | -------------------------------------------------------------------------------- /src/fmtcl/ReadWrapperFlt.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ReadWrapperFlt.hpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (fmtcl_ReadWrapperFlt_CODEHEADER_INCLUDED) 19 | #define fmtcl_ReadWrapperFlt_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | 26 | 27 | namespace fmtcl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | template 37 | template 38 | void ReadWrapperFlt ::read (typename SRC::PtrConst::Type ptr, VF &src0, VF &src1, const VI &zero, int /*len*/) 39 | { 40 | SRC::read_flt (ptr, src0, src1, zero); 41 | } 42 | 43 | 44 | 45 | template 46 | template 47 | void ReadWrapperFlt ::read (typename SRC::PtrConst::Type ptr, VF &src0, VF &src1, const VI &zero, int len) 48 | { 49 | SRC::read_flt_partial (ptr, src0, src1, zero, len); 50 | } 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | 61 | 62 | } // namespace fmtcl 63 | 64 | 65 | 66 | #endif // fmtcl_ReadWrapperFlt_CODEHEADER_INCLUDED 67 | 68 | 69 | 70 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | -------------------------------------------------------------------------------- /src/fmtcl/ReadWrapperInt.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ReadWrapperInt.hpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (fmtcl_ReadWrapperInt_CODEHEADER_INCLUDED) 19 | #define fmtcl_ReadWrapperInt_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | 26 | 27 | namespace fmtcl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | template 37 | template 38 | VI ReadWrapperInt ::read (const typename SRC::PtrConst::Type &ptr, const VI &zero, const VI &sign_bit, int /*len*/) 39 | { 40 | return (S16R::read (ptr, zero, sign_bit)); 41 | } 42 | 43 | 44 | 45 | template 46 | template 47 | VI ReadWrapperInt ::read (const typename SRC::PtrConst::Type &ptr, const VI &zero, const VI &sign_bit, int len) 48 | { 49 | return (S16R::read_partial (ptr, zero, sign_bit, len)); 50 | } 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | 61 | 62 | } // namespace fmtcl 63 | 64 | 65 | 66 | #endif // fmtcl_ReadWrapperInt_CODEHEADER_INCLUDED 67 | 68 | 69 | 70 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | -------------------------------------------------------------------------------- /src/conc/ObjFactoryInterface.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ObjFactoryInterface.hpp 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (conc_ObjFactoryInterface_CODEHEADER_INCLUDED) 19 | #define conc_ObjFactoryInterface_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | #include 26 | 27 | 28 | 29 | namespace conc 30 | { 31 | 32 | 33 | 34 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 35 | 36 | 37 | 38 | /* 39 | ============================================================================== 40 | Name: create 41 | Description: 42 | Create an object. Please catch any exception, be a good girl and return 43 | 0 upon failure. 44 | Returns: 45 | A pointer on the object, that will be later destroyed just by calling 46 | delete on it. 47 | If the object cannot be created, 0 is returned. 48 | Throws: Nothing. 49 | ============================================================================== 50 | */ 51 | 52 | template 53 | T * ObjFactoryInterface ::create () 54 | { 55 | return (do_create ()); 56 | } 57 | 58 | 59 | 60 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 61 | 62 | 63 | 64 | } // namespace conc 65 | 66 | 67 | 68 | #endif // conc_ObjFactoryInterface_CODEHEADER_INCLUDED 69 | 70 | 71 | 72 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirCubic.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirCubic.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ContFirCubic.h" 21 | 22 | #include 23 | #include 24 | 25 | 26 | 27 | namespace fmtcl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | ContFirCubic::ContFirCubic (double b, double c) 37 | : _p0 (( 6 - 2*b ) / 6) 38 | , _p2 ((-18 + 12*b + 6*c) / 6) 39 | , _p3 (( 12 - 9*b - 6*c) / 6) 40 | , _q0 (( 8*b + 24*c) / 6) 41 | , _q1 (( -12*b - 48*c) / 6) 42 | , _q2 (( 6*b + 30*c) / 6) 43 | , _q3 (( - b - 6*c) / 6) 44 | { 45 | // Nothing 46 | } 47 | 48 | 49 | 50 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 51 | 52 | 53 | 54 | double ContFirCubic::do_get_support () const 55 | { 56 | return (2.0); 57 | } 58 | 59 | 60 | 61 | double ContFirCubic::do_get_val (double x) const 62 | { 63 | x = fabs (x); 64 | 65 | return ( (x < 1) ? (_p0 + x * x * (_p2 + x * _p3)) 66 | : (x < 2) ? (_q0 + x * (_q1 + x * (_q2 + x * _q3))) 67 | : 0.0); 68 | } 69 | 70 | 71 | 72 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | 74 | 75 | 76 | } // namespace fmtcl 77 | 78 | 79 | 80 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 81 | -------------------------------------------------------------------------------- /src/avsutl/VideoFilterBase.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | VideoFilterBase.cpp 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 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "avsutl/VideoFilterBase.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace avsutl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | VideoFilterBase::VideoFilterBase (::IScriptEnvironment &env, ::PClip c) 36 | : Inherited (c) 37 | { 38 | try 39 | { 40 | env.CheckVersion (8); 41 | _prop_flag = true; 42 | } 43 | catch (const ::AvisynthError &) 44 | { 45 | _prop_flag = false; 46 | } 47 | } 48 | 49 | 50 | 51 | bool VideoFilterBase::supports_props () const noexcept 52 | { 53 | return _prop_flag; 54 | } 55 | 56 | 57 | 58 | ::PVideoFrame VideoFilterBase::build_new_frame (::IScriptEnvironment &env, const ::VideoInfo &vi_n, ::PVideoFrame *src_ptr, int align) 59 | { 60 | if (supports_props ()) 61 | { 62 | return env.NewVideoFrameP (vi_n, src_ptr, align); 63 | } 64 | else 65 | { 66 | return env.NewVideoFrame (vi_n, align); 67 | } 68 | } 69 | 70 | 71 | 72 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | 74 | 75 | 76 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 77 | 78 | 79 | 80 | } // namespace avsutl 81 | 82 | 83 | 84 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 85 | -------------------------------------------------------------------------------- /src/fmtcl/ScalerCopy.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ScalerCopy.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ScalerCopy_HEADER_INCLUDED) 20 | #define fmtcl_ScalerCopy_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fstb/def.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | template 36 | class ScalerCopy 37 | { 38 | public: 39 | static fstb_FORCEINLINE bool can_copy (bool copy_flag) 40 | { 41 | fstb::unused (copy_flag); 42 | return (false); 43 | } 44 | static fstb_FORCEINLINE void copy (typename DST::Ptr::Type dst_ptr, typename SRC::PtrConst::Type src_ptr, int width) 45 | { 46 | fstb::unused (dst_ptr, src_ptr, width); 47 | assert (false); 48 | } 49 | }; 50 | 51 | template 52 | class ScalerCopy 53 | { 54 | public: 55 | static fstb_FORCEINLINE bool can_copy (bool copy_flag) 56 | { 57 | return (copy_flag); 58 | } 59 | static fstb_FORCEINLINE void copy (typename DST::Ptr::Type dst_ptr, typename DST::PtrConst::Type src_ptr, int width) 60 | { 61 | DST::Ptr::copy (dst_ptr, src_ptr, width); 62 | } 63 | }; 64 | 65 | 66 | 67 | } // namespace fmtcl 68 | 69 | 70 | 71 | //#include "fmtcl/ScalerCopy.hpp" 72 | 73 | 74 | 75 | #endif // fmtcl_ScalerCopy_HEADER_INCLUDED 76 | 77 | 78 | 79 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 80 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSpline64.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSpline64.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ContFirSpline64.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 36 | 37 | 38 | 39 | double ContFirSpline64::do_get_support () const 40 | { 41 | return (4.0); 42 | } 43 | 44 | 45 | 46 | double ContFirSpline64::do_get_val (double x) const 47 | { 48 | x = fabs (x); 49 | 50 | double v = 0; 51 | if (x < 1.0) 52 | { 53 | v = (( 49.0/41.0 * x - 6387.0/2911.0) * x - 3.0/2911.0) * x + 1.0; 54 | } 55 | else if (x < 2.0) 56 | { 57 | x -= 1.0; 58 | v = ((-24.0/41.0 * x + 4032.0/2911.0) * x - 2328.0/2911.0) * x; 59 | } 60 | else if (x < 3.0) 61 | { 62 | x -= 2.0; 63 | v = (( 6.0/41.0 * x - 1008.0/2911.0) * x + 582.0/2911.0) * x; 64 | } 65 | else if (x < 4.0) 66 | { 67 | x -= 3.0; 68 | v = ((- 1.0/41.0 * x + 168.0/2911.0) * x - 97.0/2911.0) * x; 69 | } 70 | 71 | return (v); 72 | } 73 | 74 | 75 | 76 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 77 | 78 | 79 | 80 | } // namespace fmtcl 81 | 82 | 83 | 84 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 85 | -------------------------------------------------------------------------------- /src/conc/LockFreeCell.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | LockFreeCell.h 4 | Author: Laurent de Soras, 2011 5 | 6 | Template parameters: 7 | 8 | - T. Contained object. Requires: 9 | T::T(); 10 | 11 | The cell must be aligned because of the AtomicPtr. 12 | 13 | --- Legal stuff --- 14 | 15 | This program is free software. It comes without any warranty, to 16 | the extent permitted by applicable law. You can redistribute it 17 | and/or modify it under the terms of the Do What The Fuck You Want 18 | To Public License, Version 2, as published by Sam Hocevar. See 19 | http://sam.zoy.org/wtfpl/COPYING for more details. 20 | 21 | *Tab=3***********************************************************************/ 22 | 23 | 24 | 25 | #pragma once 26 | #if ! defined (conc_LockFreeCell_HEADER_INCLUDED) 27 | #define conc_LockFreeCell_HEADER_INCLUDED 28 | 29 | 30 | 31 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | #include "conc/AtomicPtr.h" 34 | 35 | 36 | 37 | namespace conc 38 | { 39 | 40 | 41 | 42 | template 43 | class LockFreeCell 44 | { 45 | 46 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | public: 49 | 50 | typedef T ValueType; 51 | 52 | AtomicPtr > 53 | _next_ptr { nullptr }; 54 | T _val; 55 | 56 | 57 | 58 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | protected: 61 | 62 | 63 | 64 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | private: 67 | 68 | 69 | 70 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | 72 | private: 73 | 74 | }; // class LockFreeCell 75 | 76 | 77 | 78 | } // namespace conc 79 | 80 | 81 | 82 | //#include "conc/LockFreeCell.hpp" 83 | 84 | 85 | 86 | #endif // conc_LockFreeCell_HEADER_INCLUDED 87 | 88 | 89 | 90 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 91 | -------------------------------------------------------------------------------- /src/fmtcl/CoefArrInt.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | CoefArrInt.hpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (fmtcl_CoefArrInt_CODEHEADER_INCLUDED) 19 | #define fmtcl_CoefArrInt_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | 26 | 27 | namespace fmtcl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | int CoefArrInt::get_size () const 37 | { 38 | return (_size); 39 | } 40 | 41 | 42 | 43 | int CoefArrInt::get_coef (int pos) const 44 | { 45 | assert (pos >= 0); 46 | assert (pos < _size); 47 | 48 | return (_coef_arr [pos << _vect_shift]); 49 | } 50 | 51 | 52 | 53 | const int16_t * CoefArrInt::use_vect_sse2 (int pos) const 54 | { 55 | assert (pos >= 0); 56 | assert (pos < _size); 57 | 58 | return (&_coef_arr [pos * VECT_LEN_SSE2]); 59 | } 60 | 61 | 62 | 63 | const int16_t * CoefArrInt::use_vect_avx2 (int pos) const 64 | { 65 | assert (pos >= 0); 66 | assert (pos < _size); 67 | 68 | return (&_coef_arr [pos * VECT_LEN_AVX2]); 69 | } 70 | 71 | 72 | 73 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 74 | 75 | 76 | 77 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 78 | 79 | 80 | 81 | } // namespace fmtcl 82 | 83 | 84 | 85 | #endif // fmtcl_CoefArrInt_CODEHEADER_INCLUDED 86 | 87 | 88 | 89 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 90 | -------------------------------------------------------------------------------- /src/fstb/ToolsAvx2.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ToolsAvx2.cpp 4 | Author: Laurent de Soras, 2015 5 | 6 | To be compiled with /arch:AVX2 in order to avoid SSE/AVX state switch 7 | slowdown. 8 | 9 | --- Legal stuff --- 10 | 11 | This program is free software. It comes without any warranty, to 12 | the extent permitted by applicable law. You can redistribute it 13 | and/or modify it under the terms of the Do What The Fuck You Want 14 | To Public License, Version 2, as published by Sam Hocevar. See 15 | http://sam.zoy.org/wtfpl/COPYING for more details. 16 | 17 | *Tab=3***********************************************************************/ 18 | 19 | 20 | 21 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 22 | 23 | #include "fstb/ToolsAvx2.h" 24 | 25 | #include 26 | 27 | 28 | 29 | namespace fstb 30 | { 31 | 32 | 33 | 34 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 35 | 36 | 37 | 38 | const ToolsAvx2::VectI32 ToolsAvx2::_zero = { 0, 0, 0, 0, 0, 0, 0, 0 }; 39 | 40 | const ToolsAvx2::VectI32 ToolsAvx2::_c16_8000 = 41 | { 42 | 0x80008000, 0x80008000, 0x80008000, 0x80008000, 43 | 0x80008000, 0x80008000, 0x80008000, 0x80008000 44 | }; 45 | 46 | const ToolsAvx2::VectI32 ToolsAvx2::_c32_00008000 = 47 | { 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000 }; 48 | 49 | const ToolsAvx2::VectI32 ToolsAvx2::_c32_0000ffff = 50 | { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }; 51 | 52 | const ToolsAvx2::VectI32 ToolsAvx2::_mask_abs = 53 | { 54 | 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 55 | 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF 56 | }; 57 | 58 | 59 | 60 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 61 | 62 | 63 | 64 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | 67 | 68 | } // namespace fstb 69 | 70 | 71 | 72 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | -------------------------------------------------------------------------------- /src/fmtcl/ColorSpaceH265.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ColorSpaceH265.h 4 | Author: Laurent de Soras, 2013 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ColorSpaceH265_HEADER_INCLUDED) 20 | #define fmtcl_ColorSpaceH265_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | // ITU-T H.265, High efficiency video coding, 2019-06, p. 415 34 | enum ColorSpaceH265 35 | { 36 | ColorSpaceH265_UNDEF = -1, 37 | 38 | ColorSpaceH265_RGB = 0, // RGB or XYZ 39 | ColorSpaceH265_BT709, 40 | ColorSpaceH265_UNSPECIFIED, 41 | ColorSpaceH265_RESERVED, 42 | ColorSpaceH265_FCC, 43 | ColorSpaceH265_BT470BG, 44 | ColorSpaceH265_SMPTE170M, 45 | ColorSpaceH265_SMPTE240M, 46 | ColorSpaceH265_YCGCO, 47 | ColorSpaceH265_BT2020NCL, 48 | ColorSpaceH265_BT2020CL, 49 | ColorSpaceH265_YDZDX, 50 | ColorSpaceH265_CHRODERNCL, 51 | ColorSpaceH265_CHRODERCL, 52 | ColorSpaceH265_ICTCP, // This matrix depends on the transfer characteristic 53 | 54 | ColorSpaceH265_NBR_ELT, 55 | 56 | ColorSpaceH265_ISO_RANGE_LAST = 255, 57 | 58 | ColorSpaceH265_CUSTOM = 1000, 59 | 60 | ColorSpaceH265_LMS, 61 | ColorSpaceH265_ICTCP_PQ, 62 | ColorSpaceH265_ICTCP_HLG 63 | 64 | }; // enum ColorSpaceH265 65 | 66 | 67 | 68 | } // namespace fmtcl 69 | 70 | 71 | 72 | //#include "fmtcl/ColorSpaceH265.hpp" 73 | 74 | 75 | 76 | #endif // fmtcl_ColorSpaceH265_HEADER_INCLUDED 77 | 78 | 79 | 80 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 81 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpCanonLog.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpCanonLog.cpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/TransOpCanonLog.h" 21 | 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | 28 | 29 | namespace fmtcl 30 | { 31 | 32 | 33 | 34 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 35 | 36 | 37 | 38 | TransOpCanonLog::TransOpCanonLog (bool inv_flag) 39 | : _inv_flag (inv_flag) 40 | { 41 | // Nothing 42 | } 43 | 44 | 45 | 46 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | 49 | 50 | // 1.08676 is log peak white, at 8.00903 in linear scale. 51 | double TransOpCanonLog::do_convert (double x) const 52 | { 53 | static constexpr double a = 10.1596; 54 | static constexpr double b = 0.529136; 55 | static constexpr double c = 0.0730597; 56 | 57 | double y = x; 58 | if (_inv_flag) 59 | { 60 | y = (pow (10, (y - c) / b) - 1) / a; 61 | } 62 | else 63 | { 64 | y = b * log10 (std::max (x, -0.0452664) * a + 1) + c; 65 | } 66 | 67 | return y; 68 | } 69 | 70 | 71 | 72 | TransOpInterface::LinInfo TransOpCanonLog::do_get_info () const 73 | { 74 | return { Type::OETF, Range::UNDEF, 8.00903, 1.0, 0.0, 0.0 }; 75 | } 76 | 77 | 78 | 79 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 80 | 81 | 82 | 83 | } // namespace fmtcl 84 | 85 | 86 | 87 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 88 | -------------------------------------------------------------------------------- /src/fmtcl/SplFmt.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | SplFmt.hpp 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (fmtcl_SplFmt_CODEHEADER_INCLUDED) 19 | #define fmtcl_SplFmt_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | #include 26 | 27 | 28 | 29 | namespace fmtcl 30 | { 31 | 32 | 33 | 34 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 35 | 36 | 37 | 38 | bool SplFmt_is_float (SplFmt fmt) 39 | { 40 | assert (fmt >= 0); 41 | assert (fmt < SplFmt_NBR_ELT); 42 | 43 | return (fmt == SplFmt_FLOAT); 44 | } 45 | 46 | 47 | 48 | bool SplFmt_is_int (SplFmt fmt) 49 | { 50 | assert (fmt >= 0); 51 | assert (fmt < SplFmt_NBR_ELT); 52 | 53 | return (fmt != SplFmt_FLOAT); 54 | } 55 | 56 | 57 | 58 | int SplFmt_get_unit_size (SplFmt fmt) 59 | { 60 | return SplFmt_get_data_size (fmt); 61 | } 62 | 63 | int SplFmt_get_data_size (SplFmt fmt) 64 | { 65 | assert (fmt >= 0); 66 | assert (fmt < SplFmt_NBR_ELT); 67 | 68 | static const int size_arr [SplFmt_NBR_ELT] = { 4, 2, 1 }; 69 | assert (size_arr [SplFmt_NBR_ELT - 1] > 0); 70 | 71 | return (size_arr [fmt]); 72 | } 73 | 74 | 75 | 76 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 77 | 78 | 79 | 80 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 81 | 82 | 83 | 84 | } // namespace fmtcl 85 | 86 | 87 | 88 | #endif // fmtcl_SplFmt_CODEHEADER_INCLUDED 89 | 90 | 91 | 92 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 93 | -------------------------------------------------------------------------------- /src/fmtcl/Proxy.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | Proxy.hpp 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #if ! defined (fmtcl_Proxy_CODEHEADER_INCLUDED) 19 | #define fmtcl_Proxy_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | #include "fstb/fnc.h" 26 | 27 | #include 28 | 29 | 30 | 31 | namespace fmtcl 32 | { 33 | 34 | 35 | 36 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 37 | 38 | 39 | 40 | template 41 | typename Proxy::Ptr1 ::Type Proxy::Ptr1 ::make_ptr (const uint8_t *ptr) 42 | { 43 | return (T *) ptr; 44 | } 45 | 46 | template 47 | void Proxy::Ptr1 ::jump (Type &ptr, ptrdiff_t stride) 48 | { 49 | ptr += stride; 50 | } 51 | 52 | template 53 | bool Proxy::Ptr1 ::check_ptr (const Type &ptr, int align) 54 | { 55 | const ptrdiff_t x = reinterpret_cast (ptr); 56 | 57 | return (x != 0 && (x & (align - 1)) == 0); 58 | } 59 | 60 | template 61 | void Proxy::Ptr1 ::copy (const Type &dst_ptr, const typename Ptr1 ::Type &src_ptr, size_t nbr_elt) 62 | { 63 | memcpy (dst_ptr, src_ptr, nbr_elt * sizeof (DataType)); 64 | } 65 | 66 | 67 | 68 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | 70 | 71 | 72 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | 74 | 75 | 76 | } // namespace fmtcl 77 | 78 | 79 | 80 | #endif // fmtcl_Proxy_CODEHEADER_INCLUDED 81 | 82 | 83 | 84 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 85 | -------------------------------------------------------------------------------- /src/fmtcl/PicFmt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | PicFmt.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 (fmtcl_PicFmt_HEADER_INCLUDED) 20 | #define fmtcl_PicFmt_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ColorFamily.h" 27 | #include "fmtcl/SplFmt.h" 28 | 29 | 30 | 31 | namespace fmtcl 32 | { 33 | 34 | 35 | 36 | class PicFmt 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | bool is_valid () const noexcept 44 | { 45 | return ( 46 | _sf >= 0 && _sf < SplFmt_NBR_ELT 47 | && _res >= 8 48 | && _col_fam >= 0 && _col_fam < ColorFamily_NBR_ELT 49 | ); 50 | } 51 | 52 | SplFmt _sf = SplFmt_ILLEGAL; 53 | int _res = 0; // Number of bits per sample 54 | ColorFamily _col_fam = ColorFamily_INVALID; 55 | bool _full_flag = false; // Full range 56 | 57 | 58 | 59 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 60 | 61 | protected: 62 | 63 | 64 | 65 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 66 | 67 | private: 68 | 69 | 70 | 71 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 72 | 73 | private: 74 | 75 | }; // class PicFmt 76 | 77 | 78 | 79 | } // namespace fmtcl 80 | 81 | 82 | 83 | //#include "fmtcl/PicFmt.hpp" 84 | 85 | 86 | 87 | #endif // fmtcl_PicFmt_HEADER_INCLUDED 88 | 89 | 90 | 91 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 92 | -------------------------------------------------------------------------------- /src/avsutl/fnc.hpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | fnc.hpp 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 | #if ! defined (avsutl_fnc_CODEHEADER_INCLUDED) 19 | #define avsutl_fnc_CODEHEADER_INCLUDED 20 | 21 | 22 | 23 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | 31 | 32 | namespace avsutl 33 | { 34 | 35 | 36 | 37 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 38 | 39 | 40 | 41 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 42 | 43 | 44 | 45 | // Stride in bytes, w and h in pixels 46 | template 47 | void fill_block (void *ptr, T val, int stride, int w, int h) 48 | { 49 | assert (ptr != nullptr); 50 | assert (stride > 0); 51 | assert (w > 0); 52 | assert (h > 0); 53 | 54 | constexpr int min_align = 16; 55 | 56 | if (sizeof (val) == 1 && stride >= 0 && stride - w < min_align) 57 | { 58 | auto u8_ptr = static_cast (ptr); 59 | std::fill (u8_ptr, u8_ptr + stride * (h - 1) + w, uint8_t (val)); 60 | } 61 | 62 | else 63 | { 64 | T * data_ptr = reinterpret_cast (ptr); 65 | const int stride_pix = stride / int (sizeof (val)); 66 | assert (stride_pix * int (sizeof (val)) == stride); 67 | for (int y = 0; y < h; ++y) 68 | { 69 | std::fill (data_ptr, data_ptr + w, val); 70 | data_ptr += stride_pix; 71 | } 72 | } 73 | } 74 | 75 | 76 | 77 | } // namespace avsutl 78 | 79 | 80 | 81 | #endif // avsutl_fnc_CODEHEADER_INCLUDED 82 | 83 | 84 | 85 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 86 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSnh.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSnh.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ContFirSnh_HEADER_INCLUDED) 20 | #define fmtcl_ContFirSnh_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ContFirInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class ContFirSnh 36 | : public ContFirInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | ContFirSnh () {} 44 | virtual ~ContFirSnh () {} 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | // ContFirInterface 53 | virtual double do_get_support () const; 54 | virtual double do_get_val (double pos) const; 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | 63 | 64 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | private: 67 | 68 | ContFirSnh (const ContFirSnh &other); 69 | ContFirSnh & operator = (const ContFirSnh &other); 70 | bool operator == (const ContFirSnh &other) const; 71 | bool operator != (const ContFirSnh &other) const; 72 | 73 | }; // class ContFirSnh 74 | 75 | 76 | 77 | //#include "fmtcl/ContFirSnh.hpp" 78 | 79 | 80 | 81 | } // namespace fmtcl 82 | 83 | 84 | 85 | #endif // fmtcl_ContFirSnh_HEADER_INCLUDED 86 | 87 | 88 | 89 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 90 | -------------------------------------------------------------------------------- /src/vsutl/PlaneProcCbInterface.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | PlaneProcCbInterface.h 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (vsutl_PlaneProcCbInterface_HEADER_INCLUDED) 20 | #define vsutl_PlaneProcCbInterface_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "vsutl/NodeRefSPtr.h" 27 | 28 | 29 | 30 | struct VSCore; 31 | struct VSFrameContext; 32 | struct VSFrame; 33 | 34 | 35 | 36 | namespace vsutl 37 | { 38 | 39 | 40 | 41 | class PlaneProcCbInterface 42 | { 43 | 44 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 45 | 46 | public: 47 | 48 | virtual ~PlaneProcCbInterface () = default; 49 | 50 | int process_plane (::VSFrame &dst, int n, int plane_index, void *frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core, const NodeRefSPtr &src_node1_sptr, const NodeRefSPtr &src_node2_sptr, const NodeRefSPtr &src_node3_sptr); 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | protected: 57 | 58 | virtual int do_process_plane (::VSFrame &dst, int n, int plane_index, void *frame_data_ptr, ::VSFrameContext &frame_ctx, ::VSCore &core, const NodeRefSPtr &src_node1_sptr, const NodeRefSPtr &src_node2_sptr, const NodeRefSPtr &src_node3_sptr) = 0; 59 | 60 | 61 | 62 | }; // class PlaneProcCbInterface 63 | 64 | 65 | 66 | } // namespace vsutl 67 | 68 | 69 | 70 | //#include "vsutl/PlaneProcCbInterface.hpp" 71 | 72 | 73 | 74 | #endif // vsutl_PlaneProcCbInterface_HEADER_INCLUDED 75 | 76 | 77 | 78 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 79 | -------------------------------------------------------------------------------- /src/vsutl/fnc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | fnc.h 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (vsutl_fnc_HEADER_INCLUDED) 20 | #define vsutl_fnc_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "VapourSynth4.h" 27 | 28 | #include 29 | 30 | 31 | 32 | namespace vsutl 33 | { 34 | 35 | 36 | bool is_vs_gray (int cf); 37 | bool is_vs_rgb (int cf); 38 | bool is_vs_yuv (int cf); 39 | bool is_vs_same_colfam (int lhs, int rhs); 40 | 41 | bool is_constant_colorspace (const ::VSVideoInfo &vi); 42 | bool is_constant_format (const ::VSVideoInfo &vi); 43 | bool has_chroma (int cf); 44 | bool has_chroma (const ::VSVideoFormat &fmt); 45 | bool is_chroma_plane (const ::VSVideoFormat &fmt, int plane_index); 46 | bool is_full_range_default (const ::VSVideoFormat &fmt); 47 | double compute_pix_scale (const ::VSVideoFormat &fmt, int plane_index, bool full_flag); 48 | double get_pix_min (const ::VSVideoFormat &fmt, int plane_index, bool full_flag); 49 | void compute_fmt_mac_cst (double &gain, double &add_cst, const ::VSVideoFormat &fmt_dst, bool full_dst_flag, const ::VSVideoFormat &fmt_src, bool full_src_flag, int plane_index); 50 | int compute_plane_width (const ::VSVideoFormat &fmt, int plane_index, int base_w); 51 | int compute_plane_height (const ::VSVideoFormat &fmt, int plane_index, int base_h); 52 | 53 | 54 | 55 | } // namespace vsutl 56 | 57 | 58 | 59 | //#include "vsutl/fnc.hpp" 60 | 61 | 62 | 63 | #endif // vsutl_fnc_HEADER_INCLUDED 64 | 65 | 66 | 67 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 68 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirRect.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirRect.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ContFirRect_HEADER_INCLUDED) 20 | #define fmtcl_ContFirRect_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ContFirInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class ContFirRect 36 | : public ContFirInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | ContFirRect () {} 44 | virtual ~ContFirRect () {} 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | // ContFirInterface 53 | virtual double do_get_support () const; 54 | virtual double do_get_val (double x) const; 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | 63 | 64 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | private: 67 | 68 | ContFirRect (const ContFirRect &other); 69 | ContFirRect & operator = (const ContFirRect &other); 70 | bool operator == (const ContFirRect &other) const; 71 | bool operator != (const ContFirRect &other) const; 72 | 73 | }; // class ContFirRect 74 | 75 | 76 | 77 | } // namespace fmtcl 78 | 79 | 80 | 81 | //#include "fmtcl/ContFirRect.hpp" 82 | 83 | 84 | 85 | #endif // fmtcl_ContFirRect_HEADER_INCLUDED 86 | 87 | 88 | 89 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 90 | -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | name: fmtconv Build 2 | 3 | on: 4 | release: 5 | types: [created] 6 | push: 7 | pull_request: 8 | workflow_dispatch: 9 | 10 | jobs: 11 | build: 12 | runs-on: windows-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v4 16 | with: 17 | submodules: recursive 18 | 19 | - name: Setup MSBuild 20 | uses: microsoft/setup-msbuild@v2 21 | 22 | - name: Install Windows 8.1 SDK 23 | shell: powershell 24 | run: | 25 | Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=323507 -OutFile sdksetup.exe -UseBasicParsing 26 | Start-Process -Wait sdksetup.exe -ArgumentList "/q", "/norestart", "/features", "OptionId.WindowsDesktopSoftwareDevelopmentKit", "OptionId.NetFxSoftwareDevelopmentKit" 27 | 28 | - name: Build Solution 29 | run: | 30 | cd build\win 31 | msbuild.exe fmtconv.sln /nologo /p:DeleteExistingFiles=True /p:platform="x64" /p:configuration="Release" 32 | msbuild.exe fmtconv.sln /nologo /p:DeleteExistingFiles=True /p:platform="Win32" /p:configuration="Release" 33 | 34 | - name: Package Release 35 | shell: bash 36 | run: | 37 | cd "./build/win" 38 | dir="release-$(git describe --tags --always)" 39 | for arch in x64 Win32; do 40 | for d in */Release${arch}; do 41 | echo "d=$d" 42 | dirname="$dir/$arch/$(dirname $d)" 43 | echo "dirname=$dirname" 44 | mkdir -p "$dirname" 45 | for f in "$d"/*.dll "$d"/*.pdb; do 46 | cp "$f" "$dirname" || true 47 | done 48 | done 49 | done 50 | cp -a ../../doc "$dir"/ 51 | git clone https://github.com/AkarinVS/exe/ 52 | exe/zip.exe -9r fmtconv-release.zip "$dir"/ 53 | 54 | - name: Upload artifact 55 | uses: actions/upload-artifact@v4 56 | with: 57 | name: fmtconv-release 58 | path: "build/win/fmtconv-release.zip" 59 | 60 | - name: Release 61 | uses: softprops/action-gh-release@v2 62 | if: github.event_name == 'release' 63 | with: 64 | files: "build/win/fmtconv-release.zip" 65 | env: 66 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 67 | -------------------------------------------------------------------------------- /src/fmtcl/MatrixProc_macro.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | MatrixProc_macro.h 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_MatrixProc_macro_HEADER_INCLUDED) 20 | #define fmtcl_MatrixProc_macro_HEADER_INCLUDED 21 | 22 | 23 | 24 | // Dst fmt, dst bits, src fmt, src bits 25 | #define fmtcl_MatrixProc_SPAN_I(CI) \ 26 | CI (INT8 , 8, INT8 , 8) \ 27 | \ 28 | CI (INT16 , 9, INT8 , 8) \ 29 | CI (INT16 , 9, INT16 , 9) \ 30 | \ 31 | CI (INT16 , 10, INT8 , 8) \ 32 | CI (INT16 , 10, INT16 , 9) \ 33 | CI (INT16 , 10, INT16 , 10) \ 34 | \ 35 | CI (INT16 , 11, INT8 , 8) \ 36 | CI (INT16 , 11, INT16 , 9) \ 37 | CI (INT16 , 11, INT16 , 10) \ 38 | CI (INT16 , 11, INT16 , 11) \ 39 | \ 40 | CI (INT16 , 12, INT8 , 8) \ 41 | CI (INT16 , 12, INT16 , 9) \ 42 | CI (INT16 , 12, INT16 , 10) \ 43 | CI (INT16 , 12, INT16 , 11) \ 44 | CI (INT16 , 12, INT16 , 12) \ 45 | \ 46 | CI (INT16 , 14, INT8 , 8) \ 47 | CI (INT16 , 14, INT16 , 9) \ 48 | CI (INT16 , 14, INT16 , 10) \ 49 | CI (INT16 , 14, INT16 , 11) \ 50 | CI (INT16 , 14, INT16 , 12) \ 51 | CI (INT16 , 14, INT16 , 14) \ 52 | \ 53 | CI (INT16 , 16, INT8 , 8) \ 54 | CI (INT16 , 16, INT16 , 9) \ 55 | CI (INT16 , 16, INT16 , 10) \ 56 | CI (INT16 , 16, INT16 , 11) \ 57 | CI (INT16 , 16, INT16 , 12) \ 58 | CI (INT16 , 16, INT16 , 16) 59 | 60 | 61 | 62 | #endif // fmtcl_MatrixProc_macro_HEADER_INCLUDED 63 | 64 | 65 | 66 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | -------------------------------------------------------------------------------- /src/test/TestGammaY.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TestGammaY.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 (TestGammaY_HEADER_INCLUDED) 20 | #define TestGammaY_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | class TestGammaY 29 | { 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | public: 34 | 35 | static int perform_test (); 36 | 37 | 38 | 39 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | protected: 42 | 43 | 44 | 45 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 46 | 47 | private: 48 | 49 | template 50 | static int test_achrom_row (int src_res, int dst_res, double gamma); 51 | 52 | 53 | 54 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | private: 57 | 58 | TestGammaY () = delete; 59 | TestGammaY (const TestGammaY &other) = delete; 60 | TestGammaY (TestGammaY &&other) = delete; 61 | TestGammaY & operator = (const TestGammaY &other) = delete; 62 | TestGammaY & operator = (TestGammaY &&other) = delete; 63 | bool operator == (const TestGammaY &other) const = delete; 64 | bool operator != (const TestGammaY &other) const = delete; 65 | 66 | }; // class TestGammaY 67 | 68 | 69 | 70 | //#include "test/TestGammaY.hpp" 71 | 72 | 73 | 74 | #endif // TestGammaY_HEADER_INCLUDED 75 | 76 | 77 | 78 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 79 | -------------------------------------------------------------------------------- /src/fmtcl/ResampleSpecPlane.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ResampleSpecPlane.cpp 4 | Author: Laurent de Soras, 2014 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ResampleSpecPlane.h" 21 | 22 | #include 23 | 24 | #include 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 34 | 35 | 36 | 37 | bool ResampleSpecPlane::operator < (const ResampleSpecPlane &other) const 38 | { 39 | return std::tie ( 40 | _src_width, 41 | _src_height, 42 | _dst_width, 43 | _dst_height, 44 | _win_x, 45 | _win_y, 46 | _win_w, 47 | _win_h, 48 | _center_pos_src_h, 49 | _center_pos_src_v, 50 | _center_pos_dst_h, 51 | _center_pos_dst_v, 52 | _kernel_scale_h, 53 | _kernel_scale_v, 54 | _add_cst, 55 | _kernel_hash_h, 56 | _kernel_hash_v 57 | ) < std::tie ( 58 | other._src_width, 59 | other._src_height, 60 | other._dst_width, 61 | other._dst_height, 62 | other._win_x, 63 | other._win_y, 64 | other._win_w, 65 | other._win_h, 66 | other._center_pos_src_h, 67 | other._center_pos_src_v, 68 | other._center_pos_dst_h, 69 | other._center_pos_dst_v, 70 | other._kernel_scale_h, 71 | other._kernel_scale_v, 72 | other._add_cst, 73 | other._kernel_hash_h, 74 | other._kernel_hash_v 75 | ); 76 | } 77 | 78 | 79 | 80 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 81 | 82 | 83 | 84 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 85 | 86 | 87 | 88 | } // namespace fmtcl 89 | 90 | 91 | 92 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 93 | -------------------------------------------------------------------------------- /src/test/GenTestPat.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | GenTestPat.h 4 | Author: Laurent de Soras, 2022 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 (GenTestPat_HEADER_INCLUDED) 20 | #define GenTestPat_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include 27 | 28 | 29 | 30 | class GenTestPat 31 | { 32 | 33 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 34 | 35 | public: 36 | 37 | static int generate_patterns (); 38 | 39 | 40 | 41 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 42 | 43 | protected: 44 | 45 | 46 | 47 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 48 | 49 | private: 50 | 51 | static uint32_t 52 | pack_s (uint16_t v0, uint16_t v1 = 0) noexcept; 53 | 54 | 55 | 56 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 57 | 58 | private: 59 | 60 | GenTestPat () = delete; 61 | GenTestPat (const GenTestPat &other) = delete; 62 | GenTestPat (GenTestPat &&other) = delete; 63 | GenTestPat & operator = (const GenTestPat &other) = delete; 64 | GenTestPat & operator = (GenTestPat &&other) = delete; 65 | bool operator == (const GenTestPat &other) const = delete; 66 | bool operator != (const GenTestPat &other) const = delete; 67 | 68 | }; // class GenTestPat 69 | 70 | 71 | 72 | //#include "test/GenTestPat.hpp" 73 | 74 | 75 | 76 | #endif // GenTestPat_HEADER_INCLUDED 77 | 78 | 79 | 80 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 81 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirLinear.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirLinear.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ContFirLinear_HEADER_INCLUDED) 20 | #define fmtcl_ContFirLinear_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ContFirInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class ContFirLinear 36 | : public ContFirInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | ContFirLinear () {} 44 | virtual ~ContFirLinear () {} 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | // ContFirInterface 53 | virtual double do_get_support () const; 54 | virtual double do_get_val (double pos) const; 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | 63 | 64 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | private: 67 | 68 | ContFirLinear (const ContFirLinear &other); 69 | ContFirLinear& operator = (const ContFirLinear &other); 70 | bool operator == (const ContFirLinear &other) const; 71 | bool operator != (const ContFirLinear &other) const; 72 | 73 | }; // class ContFirLinear 74 | 75 | 76 | 77 | } // namespace fmtcl 78 | 79 | 80 | 81 | //#include "fmtcl/ContFirLinear.hpp" 82 | 83 | 84 | 85 | #endif // fmtcl_ContFirLinear_HEADER_INCLUDED 86 | 87 | 88 | 89 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 90 | -------------------------------------------------------------------------------- /src/fmtcl/fnc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | fnc.h 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_fnc_HEADER_INCLUDED) 20 | #define fmtcl_fnc_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ColorFamily.h" 27 | #include "fmtcl/ColorSpaceH265.h" 28 | #include "fmtcl/SplFmt.h" 29 | 30 | #include 31 | #include 32 | 33 | 34 | 35 | namespace fmtcl 36 | { 37 | 38 | class Mat4; 39 | class MatrixProc; 40 | class PicFmt; 41 | 42 | 43 | 44 | int compute_plane_width (ColorFamily col_fam, int ss_h, int base_w, int plane_index); 45 | int compute_plane_height (ColorFamily col_fam, int ss_v, int base_h, int plane_index); 46 | bool has_chroma (ColorFamily col_fam); 47 | bool is_chroma_plane (ColorFamily col_fam, int plane_index); 48 | bool is_full_range_default (ColorFamily col_fam); 49 | double compute_pix_scale (const PicFmt &fmt, int plane_index); 50 | double get_pix_min (const PicFmt &fmt, int plane_index); 51 | void compute_fmt_mac_cst (double &gain, double &add_cst, const PicFmt &dst_fmt, const PicFmt &src_fmt, int plane_index); 52 | int prepare_matrix_coef (MatrixProc &mat_proc, const Mat4 &mat_main, const PicFmt &dst_fmt, const PicFmt &src_fmt, ColorSpaceH265 csp_out, int plane_out); 53 | template 54 | std::vector conv_str_to_arr (std::string str); 55 | template 56 | T get_arr_elt (const std::vector &v, int pos, const T &def) noexcept; 57 | 58 | 59 | 60 | } // namespace fmtcl 61 | 62 | 63 | 64 | #include "fmtcl/fnc.hpp" 65 | 66 | 67 | 68 | #endif // fmtcl_fnc_HEADER_INCLUDED 69 | 70 | 71 | 72 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpPow.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpPow.cpp 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/TransOpPow.h" 21 | 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | 28 | 29 | namespace fmtcl 30 | { 31 | 32 | 33 | 34 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 35 | 36 | 37 | 38 | // p_i: power curve for the EOTF or OETF^-1 ( > 1) 39 | // alpha: scaling factor after EOTF^-1 or OETF 40 | TransOpPow::TransOpPow (bool inv_flag, double p_i, double alpha, double val_max, double scale_cdm2, double wpeak_cdm2) 41 | : _inv_flag (inv_flag) 42 | , _p_i (p_i) 43 | , _alpha (alpha) 44 | , _p (1 / p_i) 45 | , _val_max (val_max) 46 | , _scale_cdm2 (scale_cdm2) 47 | , _wpeak_cdm2 (wpeak_cdm2) 48 | { 49 | // Nothing 50 | } 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | 57 | 58 | double TransOpPow::do_convert (double x) const 59 | { 60 | x = std::max (x, 0.0); 61 | double y = x; 62 | 63 | if (_inv_flag) 64 | { 65 | y = pow (x / _alpha, _p_i); 66 | y = std::min (y, _val_max); 67 | } 68 | else 69 | { 70 | x = std::min (x, _val_max); 71 | y = _alpha * pow (x, _p); 72 | } 73 | 74 | return y; 75 | } 76 | 77 | 78 | 79 | TransOpInterface::LinInfo TransOpPow::do_get_info () const 80 | { 81 | return { Type::UNDEF, Range::SDR, _val_max, 1.0, _scale_cdm2, _wpeak_cdm2 }; 82 | } 83 | 84 | 85 | 86 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 87 | 88 | 89 | 90 | } // namespace fmtcl 91 | 92 | 93 | 94 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 95 | -------------------------------------------------------------------------------- /src/fmtcavs/CpuOpt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | CpuOpt.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_CpuOpt_HEADER_INCLUDED) 20 | #define fmtcavs_CpuOpt_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/CpuOptBase.h" 27 | 28 | 29 | 30 | class AVSValue; 31 | 32 | namespace fmtcavs 33 | { 34 | 35 | 36 | 37 | class CpuOpt 38 | : public fmtcl::CpuOptBase 39 | { 40 | 41 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 42 | 43 | public: 44 | 45 | explicit CpuOpt (const ::AVSValue &arg); 46 | 47 | 48 | 49 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 50 | 51 | protected: 52 | 53 | 54 | 55 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 56 | 57 | private: 58 | 59 | 60 | 61 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 62 | 63 | private: 64 | 65 | CpuOpt () = delete; 66 | CpuOpt (const CpuOpt &other) = delete; 67 | CpuOpt (CpuOpt &&other) = delete; 68 | CpuOpt & operator = (const CpuOpt &other) = delete; 69 | CpuOpt & operator = (CpuOpt &&other) = delete; 70 | bool operator == (const CpuOpt &other) const = delete; 71 | bool operator != (const CpuOpt &other) const = delete; 72 | 73 | }; // class CpuOpt 74 | 75 | 76 | 77 | } // namespace fmtcavs 78 | 79 | 80 | 81 | //#include "fmtcavs/CpuOpt.hpp" 82 | 83 | 84 | 85 | #endif // fmtcavs_CpuOpt_HEADER_INCLUDED 86 | 87 | 88 | 89 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 90 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSinc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSinc.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ContFirSinc_HEADER_INCLUDED) 20 | #define fmtcl_ContFirSinc_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ContFirInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class ContFirSinc 36 | : public ContFirInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | explicit ContFirSinc (int taps); 44 | virtual ~ContFirSinc () {} 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | // ContFirInterface 53 | virtual double do_get_support () const; 54 | virtual double do_get_val (double x) const; 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | int _taps; 63 | 64 | 65 | 66 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | 68 | private: 69 | 70 | ContFirSinc (); 71 | ContFirSinc (const ContFirSinc &other); 72 | ContFirSinc & operator = (const ContFirSinc &other); 73 | bool operator == (const ContFirSinc &other) const; 74 | bool operator != (const ContFirSinc &other) const; 75 | 76 | }; // class ContFirSinc 77 | 78 | 79 | 80 | //#include "fmtcl/ContFirSinc.hpp" 81 | 82 | 83 | 84 | } // namespace fmtcl 85 | 86 | 87 | 88 | #endif // fmtcl_ContFirSinc_HEADER_INCLUDED 89 | 90 | 91 | 92 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 93 | -------------------------------------------------------------------------------- /src/avs/minmax.h: -------------------------------------------------------------------------------- 1 | // This program is free software; you can redistribute it and/or modify 2 | // it under the terms of the GNU General Public License as published by 3 | // the Free Software Foundation; either version 2 of the License, or 4 | // (at your option) any later version. 5 | // 6 | // This program is distributed in the hope that it will be useful, 7 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 8 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 | // GNU General Public License for more details. 10 | // 11 | // You should have received a copy of the GNU General Public License 12 | // along with this program; if not, write to the Free Software 13 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit 14 | // http://www.gnu.org/copyleft/gpl.html . 15 | // 16 | // Linking Avisynth statically or dynamically with other modules is making a 17 | // combined work based on Avisynth. Thus, the terms and conditions of the GNU 18 | // General Public License cover the whole combination. 19 | // 20 | // As a special exception, the copyright holders of Avisynth give you 21 | // permission to link Avisynth with independent modules that communicate with 22 | // Avisynth solely through the interfaces defined in avisynth.h, regardless of the license 23 | // terms of these independent modules, and to copy and distribute the 24 | // resulting combined work under terms of your choice, provided that 25 | // every copy of the combined work is accompanied by a complete copy of 26 | // the source code of Avisynth (the version of Avisynth used to produce the 27 | // combined work), being distributed under the terms of the GNU General 28 | // Public License plus this exception. An independent module is a module 29 | // which is not derived from or based on Avisynth, such as 3rd-party filters, 30 | // import and export plugins, or graphical user interfaces. 31 | 32 | #ifndef AVSCORE_MINMAX_H 33 | #define AVSCORE_MINMAX_H 34 | 35 | template 36 | T min(T v1, T v2) 37 | { 38 | return v1 < v2 ? v1 : v2; 39 | } 40 | 41 | template 42 | T max(T v1, T v2) 43 | { 44 | return v1 > v2 ? v1 : v2; 45 | } 46 | 47 | template 48 | T clamp(T n, T min, T max) 49 | { 50 | n = n > max ? max : n; 51 | return n < min ? min : n; 52 | } 53 | 54 | #endif // AVSCORE_MINMAX_H 55 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSpline16.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSpline16.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ContFirSpline16_HEADER_INCLUDED) 20 | #define fmtcl_ContFirSpline16_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ContFirInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class ContFirSpline16 36 | : public ContFirInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | ContFirSpline16 () {} 44 | virtual ~ContFirSpline16 () {} 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | // ContFirInterface 53 | virtual double do_get_support () const; 54 | virtual double do_get_val (double x) const; 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | 63 | 64 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | private: 67 | 68 | ContFirSpline16 (const ContFirSpline16 &other); 69 | ContFirSpline16 & 70 | operator = (const ContFirSpline16 &other); 71 | bool operator == (const ContFirSpline16 &other) const; 72 | bool operator != (const ContFirSpline16 &other) const; 73 | 74 | }; // class ContFirSpline16 75 | 76 | 77 | 78 | } // namespace fmtcl 79 | 80 | 81 | 82 | //#include "fmtcl/ContFirSpline16.hpp" 83 | 84 | 85 | 86 | #endif // fmtcl_ContFirSpline16_HEADER_INCLUDED 87 | 88 | 89 | 90 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 91 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSpline36.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSpline36.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ContFirSpline36_HEADER_INCLUDED) 20 | #define fmtcl_ContFirSpline36_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ContFirInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class ContFirSpline36 36 | : public ContFirInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | ContFirSpline36 () {} 44 | virtual ~ContFirSpline36 () {} 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | // ContFirInterface 53 | virtual double do_get_support () const; 54 | virtual double do_get_val (double x) const; 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | 63 | 64 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | private: 67 | 68 | ContFirSpline36 (const ContFirSpline36 &other); 69 | ContFirSpline36 & 70 | operator = (const ContFirSpline36 &other); 71 | bool operator == (const ContFirSpline36 &other) const; 72 | bool operator != (const ContFirSpline36 &other) const; 73 | 74 | }; // class ContFirSpline36 75 | 76 | 77 | 78 | //#include "fmtcl/ContFirSpline36.hpp" 79 | 80 | 81 | 82 | } // namespace fmtcl 83 | 84 | 85 | 86 | #endif // fmtcl_ContFirSpline36_HEADER_INCLUDED 87 | 88 | 89 | 90 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 91 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSpline64.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSpline64.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ContFirSpline64_HEADER_INCLUDED) 20 | #define fmtcl_ContFirSpline64_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ContFirInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class ContFirSpline64 36 | : public ContFirInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | ContFirSpline64 () {} 44 | virtual ~ContFirSpline64 () {} 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | // ContFirInterface 53 | virtual double do_get_support () const; 54 | virtual double do_get_val (double x) const; 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | 63 | 64 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | private: 67 | 68 | ContFirSpline64 (const ContFirSpline64 &other); 69 | ContFirSpline64 & 70 | operator = (const ContFirSpline64 &other); 71 | bool operator == (const ContFirSpline64 &other) const; 72 | bool operator != (const ContFirSpline64 &other) const; 73 | 74 | }; // class ContFirSpline64 75 | 76 | 77 | 78 | } // namespace fmtcl 79 | 80 | 81 | 82 | //#include "fmtcl/ContFirSpline64.hpp" 83 | 84 | 85 | 86 | #endif // fmtcl_ContFirSpline64_HEADER_INCLUDED 87 | 88 | 89 | 90 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 91 | -------------------------------------------------------------------------------- /src/avs/types.h: -------------------------------------------------------------------------------- 1 | // Avisynth C Interface Version 0.20 2 | // Copyright 2003 Kevin Atkinson 3 | 4 | // This program is free software; you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation; either version 2 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program; if not, write to the Free Software 16 | // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit 17 | // http://www.gnu.org/copyleft/gpl.html . 18 | // 19 | // As a special exception, I give you permission to link to the 20 | // Avisynth C interface with independent modules that communicate with 21 | // the Avisynth C interface solely through the interfaces defined in 22 | // avisynth_c.h, regardless of the license terms of these independent 23 | // modules, and to copy and distribute the resulting combined work 24 | // under terms of your choice, provided that every copy of the 25 | // combined work is accompanied by a complete copy of the source code 26 | // of the Avisynth C interface and Avisynth itself (with the version 27 | // used to produce the combined work), being distributed under the 28 | // terms of the GNU General Public License plus this exception. An 29 | // independent module is a module which is not derived from or based 30 | // on Avisynth C Interface, such as 3rd-party filters, import and 31 | // export plugins, or graphical user interfaces. 32 | 33 | #ifndef AVS_TYPES_H 34 | #define AVS_TYPES_H 35 | 36 | // Define all types necessary for interfacing with avisynth.dll 37 | #include 38 | #include 39 | #ifdef __cplusplus 40 | #include 41 | #include 42 | #else 43 | #include 44 | #include 45 | #endif 46 | 47 | // Raster types used by VirtualDub & Avisynth 48 | typedef uint32_t Pixel32; 49 | typedef uint8_t BYTE; 50 | 51 | // Audio Sample information 52 | typedef float SFLOAT; 53 | 54 | #endif //AVS_TYPES_H 55 | -------------------------------------------------------------------------------- /src/fmtc/fnc.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | fnc.h 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtc_fnc_HEADER_INCLUDED) 20 | #define fmtc_fnc_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ColorFamily.h" 27 | #include "fmtcl/ColorSpaceH265.h" 28 | #include "fmtcl/ProcComp3Arg.h" 29 | #include "fmtcl/PicFmt.h" 30 | #include "fmtcl/SplFmt.h" 31 | 32 | 33 | 34 | struct VSAPI; 35 | struct VSVideoFormat; 36 | struct VSFrame; 37 | 38 | namespace fmtcl 39 | { 40 | class Mat4; 41 | class MatrixProc; 42 | } 43 | namespace vsutl 44 | { 45 | class FilterBase; 46 | } 47 | 48 | namespace fmtc 49 | { 50 | 51 | 52 | 53 | fmtcl::PicFmt conv_vsfmt_to_picfmt (const ::VSVideoFormat &fmt, bool full_flag); 54 | fmtcl::SplFmt conv_vsfmt_to_splfmt (const ::VSVideoFormat &fmt); 55 | void conv_vsfmt_to_splfmt (fmtcl::SplFmt &type, int &bitdepth, const ::VSVideoFormat &fmt); 56 | fmtcl::ColorFamily conv_vsfmt_to_colfam (const ::VSVideoFormat &fmt); 57 | int conv_fmtcl_colfam_to_vs (fmtcl::ColorFamily cf); 58 | void prepare_matrix_coef (const vsutl::FilterBase &filter, fmtcl::MatrixProc &mat_proc, const fmtcl::Mat4 &mat_main, const ::VSVideoFormat &fmt_dst, bool full_range_dst_flag, const ::VSVideoFormat &fmt_src, bool full_range_src_flag, fmtcl::ColorSpaceH265 csp_out = fmtcl::ColorSpaceH265_UNSPECIFIED, int plane_out = -1); 59 | fmtcl::ProcComp3Arg build_mat_proc (const ::VSAPI &vsapi, ::VSFrame &dst, const ::VSFrame &src, bool single_plane_flag = false); 60 | 61 | 62 | 63 | } // namespace fmtc 64 | 65 | 66 | 67 | //#include "fmtc/fnc.hpp" 68 | 69 | 70 | 71 | #endif // fmtc_fnc_HEADER_INCLUDED 72 | 73 | 74 | 75 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 76 | -------------------------------------------------------------------------------- /src/conc/AioMax.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | AioMax.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (conc_AioMax_HEADER_INCLUDED) 20 | #define conc_AioMax_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace conc 29 | { 30 | 31 | 32 | 33 | template 34 | class AioMax 35 | { 36 | 37 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 38 | 39 | public: 40 | 41 | explicit inline 42 | AioMax (T operand); 43 | 44 | inline T operator () (T old_val) const noexcept; 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | 53 | 54 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | private: 57 | 58 | T _operand; 59 | 60 | 61 | 62 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | AioMax () = delete; 67 | AioMax (const AioMax &other) = delete; 68 | AioMax (const AioMax &&other) = delete; 69 | AioMax & operator = (const AioMax &other) = delete; 70 | AioMax & operator = (const AioMax &&other) = delete; 71 | bool operator == (const AioMax &other) const = delete; 72 | bool operator != (const AioMax &other) const = delete; 73 | 74 | }; // class AioMax 75 | 76 | 77 | 78 | } // namespace conc 79 | 80 | 81 | 82 | #include "conc/AioMax.hpp" 83 | 84 | 85 | 86 | #endif // conc_AioMax_HEADER_INCLUDED 87 | 88 | 89 | 90 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 91 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirGauss.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirGauss.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ContFirGauss_HEADER_INCLUDED) 20 | #define fmtcl_ContFirGauss_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ContFirInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class ContFirGauss 36 | : public ContFirInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | explicit ContFirGauss (int taps, double p); 44 | virtual ~ContFirGauss () {} 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | // ContFirInterface 53 | virtual double do_get_support () const; 54 | virtual double do_get_val (double x) const; 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | int _taps; 63 | double _p; 64 | 65 | 66 | 67 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 68 | 69 | private: 70 | 71 | ContFirGauss (); 72 | ContFirGauss (const ContFirGauss &other); 73 | ContFirGauss & operator = (const ContFirGauss &other); 74 | bool operator == (const ContFirGauss &other) const; 75 | bool operator != (const ContFirGauss &other) const; 76 | 77 | }; // class ContFirGauss 78 | 79 | 80 | 81 | } // namespace fmtcl 82 | 83 | 84 | 85 | //#include "fmtcl/ContFirGauss.hpp" 86 | 87 | 88 | 89 | #endif // fmtcl_ContFirGauss_HEADER_INCLUDED 90 | 91 | 92 | 93 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 94 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirLanczos.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirLanczos.cpp 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/ContFirLanczos.h" 21 | #include "fstb/fnc.h" 22 | 23 | #include 24 | #include 25 | 26 | 27 | 28 | namespace fmtcl 29 | { 30 | 31 | 32 | 33 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 34 | 35 | 36 | 37 | ContFirLanczos::ContFirLanczos (int taps) 38 | : _taps (taps) 39 | { 40 | assert (taps >= 1); 41 | assert (taps <= 128); 42 | } 43 | 44 | 45 | 46 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | 49 | 50 | double ContFirLanczos::do_get_support () const 51 | { 52 | return (_taps); 53 | } 54 | 55 | 56 | 57 | double ContFirLanczos::compute_win_coef (double x) const 58 | { 59 | double win = 0; 60 | if (fabs (x) <= _taps) 61 | { 62 | win = compute_win_coef_no_check (x); 63 | } 64 | 65 | return (win); 66 | } 67 | 68 | 69 | 70 | double ContFirLanczos::do_get_val (double x) const 71 | { 72 | double val = 0; 73 | if (fabs (x) <= _taps) 74 | { 75 | const double win = compute_win_coef_no_check (x); 76 | val = fstb::sinc (x) * win; 77 | } 78 | 79 | return (val); 80 | } 81 | 82 | 83 | 84 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 85 | 86 | 87 | 88 | double ContFirLanczos::compute_win_coef_no_check (double x) const 89 | { 90 | const double win = fstb::sinc (x / _taps); 91 | 92 | return (win); 93 | } 94 | 95 | 96 | 97 | } // namespace fmtcl 98 | 99 | 100 | 101 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 102 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpBypass.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpBypass.h 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_TransOpBypass_HEADER_INCLUDED) 20 | #define fmtcl_TransOpBypass_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/TransOpInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class TransOpBypass 36 | : public TransOpInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | TransOpBypass () = default; 44 | virtual ~TransOpBypass () {} 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | // TransOpInterface 53 | double do_convert (double x) const override { return x; } 54 | LinInfo do_get_info () const override { return _unbounded; } 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | 63 | 64 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | private: 67 | 68 | TransOpBypass (const TransOpBypass &other) = delete; 69 | TransOpBypass& operator = (const TransOpBypass &other) = delete; 70 | bool operator == (const TransOpBypass &other) const = delete; 71 | bool operator != (const TransOpBypass &other) const = delete; 72 | 73 | }; // class TransOpBypass 74 | 75 | 76 | 77 | } // namespace fmtcl 78 | 79 | 80 | 81 | //#include "fmtcl/TransOpBypass.hpp" 82 | 83 | 84 | 85 | #endif // fmtcl_TransOpBypass_HEADER_INCLUDED 86 | 87 | 88 | 89 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 90 | -------------------------------------------------------------------------------- /src/conc/AioAdd.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | AioAdd.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (conc_AioAdd_HEADER_INCLUDED) 20 | #define conc_AioAdd_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | namespace conc 29 | { 30 | 31 | 32 | 33 | template 34 | class AioAdd 35 | { 36 | 37 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 38 | 39 | public: 40 | 41 | explicit inline 42 | AioAdd (T operand); 43 | virtual ~AioAdd () = default; 44 | 45 | inline T operator () (T old_val) const noexcept; 46 | 47 | 48 | 49 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 50 | 51 | protected: 52 | 53 | 54 | 55 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 56 | 57 | private: 58 | 59 | T _operand; 60 | 61 | 62 | 63 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 64 | 65 | private: 66 | 67 | AioAdd () = delete; 68 | AioAdd (const AioAdd &other) = delete; 69 | AioAdd (const AioAdd &&other) = delete; 70 | AioAdd & operator = (const AioAdd &other) = delete; 71 | AioAdd & operator = (const AioAdd &&other) = delete; 72 | bool operator == (const AioAdd &other) const = delete; 73 | bool operator != (const AioAdd &other) const = delete; 74 | 75 | }; // class AioAdd 76 | 77 | 78 | 79 | } // namespace conc 80 | 81 | 82 | 83 | #include "conc/AioAdd.hpp" 84 | 85 | 86 | 87 | #endif // conc_AioAdd_HEADER_INCLUDED 88 | 89 | 90 | 91 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 92 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpAcesCct.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpAcesCct.cpp 4 | Author: Laurent de Soras, 2022 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/TransOpAcesCct.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | TransOpAcesCct::TransOpAcesCct (bool inv_flag) 36 | : _inv_flag (inv_flag) 37 | { 38 | // Nothing 39 | } 40 | 41 | 42 | 43 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | 46 | 47 | double TransOpAcesCct::do_convert (double x) const 48 | { 49 | constexpr auto a0 = 0.0792055341958355; 50 | constexpr auto a1 = 10.5402377416545; 51 | constexpr auto thr = 0.0078125; 52 | constexpr auto b0 = 9.72; 53 | constexpr auto b1 = 17.52; 54 | 55 | 56 | double y = x; 57 | 58 | if (_inv_flag) 59 | { 60 | if (x <= thr * a1 + a0) 61 | { 62 | y = (x - a0) / a1; 63 | } 64 | else 65 | { 66 | y = exp2 (x * b1 - b0); 67 | } 68 | } 69 | 70 | else 71 | { 72 | if (x <= thr) 73 | { 74 | y = x * a1 + a0; 75 | } 76 | else 77 | { 78 | y = (log2 (x) + b0) / b1; 79 | } 80 | } 81 | 82 | return y; 83 | } 84 | 85 | 86 | 87 | TransOpInterface::LinInfo TransOpAcesCct::do_get_info () const 88 | { 89 | return { Type::OETF, Range::UNDEF, _max_val, 1.0, 0.0, 0.0 }; 90 | } 91 | 92 | 93 | 94 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 95 | 96 | 97 | 98 | constexpr double TransOpAcesCct::_max_val; 99 | 100 | 101 | 102 | } // namespace fmtcl 103 | 104 | 105 | 106 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 107 | -------------------------------------------------------------------------------- /src/fmtcl/TransOp2084.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOp2084.h 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_TransOp2084_HEADER_INCLUDED) 20 | #define fmtcl_TransOp2084_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/TransOpInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class TransOp2084 36 | : public TransOpInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | explicit TransOp2084 (bool inv_flag); 44 | virtual ~TransOp2084 () {} 45 | 46 | 47 | 48 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | protected: 51 | 52 | // TransOpInterface 53 | double do_convert (double x) const override; 54 | LinInfo do_get_info () const override; 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | const bool _inv_flag; 63 | 64 | 65 | 66 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | 68 | private: 69 | 70 | TransOp2084 () = delete; 71 | TransOp2084 (const TransOp2084 &other) = delete; 72 | TransOp2084 & operator = (const TransOp2084 &other) = delete; 73 | bool operator == (const TransOp2084 &other) const = delete; 74 | bool operator != (const TransOp2084 &other) const = delete; 75 | 76 | }; // class TransOp2084 77 | 78 | 79 | 80 | } // namespace fmtcl 81 | 82 | 83 | 84 | //#include "fmtcl/TransOp2084.hpp" 85 | 86 | 87 | 88 | #endif // fmtcl_TransOp2084_HEADER_INCLUDED 89 | 90 | 91 | 92 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 93 | -------------------------------------------------------------------------------- /src/conc/ObjFactoryDef.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ObjFactoryDef.h 4 | Author: Laurent de Soras, 2012 5 | 6 | Simple factory for ObjPool using the class default constructor. 7 | 8 | --- Legal stuff --- 9 | 10 | This program is free software. It comes without any warranty, to 11 | the extent permitted by applicable law. You can redistribute it 12 | and/or modify it under the terms of the Do What The Fuck You Want 13 | To Public License, Version 2, as published by Sam Hocevar. See 14 | http://sam.zoy.org/wtfpl/COPYING for more details. 15 | 16 | *Tab=3***********************************************************************/ 17 | 18 | 19 | 20 | #pragma once 21 | #if ! defined (conc_ObjFactoryDef_HEADER_INCLUDED) 22 | #define conc_ObjFactoryDef_HEADER_INCLUDED 23 | 24 | 25 | 26 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 27 | 28 | #include "conc/ObjFactoryInterface.h" 29 | 30 | 31 | 32 | namespace conc 33 | { 34 | 35 | 36 | 37 | template 38 | class ObjFactoryDef 39 | : public ObjFactoryInterface 40 | { 41 | 42 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 43 | 44 | public: 45 | 46 | ObjFactoryDef () = default; 47 | virtual ~ObjFactoryDef () = default; 48 | 49 | static ObjFactoryDef 50 | _fact; 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | protected: 57 | 58 | // conc::ObjFactoryInterface 59 | virtual T * do_create (); 60 | 61 | 62 | 63 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 64 | 65 | private: 66 | 67 | 68 | 69 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | 71 | private: 72 | 73 | ObjFactoryDef (const ObjFactoryDef &other) = delete; 74 | ObjFactoryDef& operator = (const ObjFactoryDef &other) = delete; 75 | bool operator == (const ObjFactoryDef &other) const = delete; 76 | bool operator != (const ObjFactoryDef &other) const = delete; 77 | 78 | }; // class ObjFactoryDef 79 | 80 | 81 | 82 | } // namespace conc 83 | 84 | 85 | 86 | #include "conc/ObjFactoryDef.hpp" 87 | 88 | 89 | 90 | #endif // conc_ObjFactoryDef_HEADER_INCLUDED 91 | 92 | 93 | 94 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 95 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSpline.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSpline.h 4 | Author: Laurent de Soras, 2012 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ContFirSpline_HEADER_INCLUDED) 20 | #define fmtcl_ContFirSpline_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/ContFirInterface.h" 27 | 28 | 29 | 30 | namespace fmtcl 31 | { 32 | 33 | 34 | 35 | class ContFirSpline 36 | : public ContFirInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | enum { MAX_TAPS = 128 }; 44 | 45 | explicit ContFirSpline (int taps); 46 | virtual ~ContFirSpline () {} 47 | 48 | 49 | 50 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 51 | 52 | protected: 53 | 54 | // ContFirInterface 55 | virtual double do_get_support () const; 56 | virtual double do_get_val (double x) const; 57 | 58 | 59 | 60 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 61 | 62 | private: 63 | 64 | int _taps; 65 | double _coef [MAX_TAPS * 4 + 1]; 66 | 67 | 68 | 69 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | 71 | private: 72 | 73 | ContFirSpline (); 74 | ContFirSpline (const ContFirSpline &other); 75 | ContFirSpline& operator = (const ContFirSpline &other); 76 | bool operator == (const ContFirSpline &other) const; 77 | bool operator != (const ContFirSpline &other) const; 78 | 79 | }; // class ContFirSpline 80 | 81 | 82 | 83 | } // namespace fmtcl 84 | 85 | 86 | 87 | //#include "fmtcl/ContFirSpline.hpp" 88 | 89 | 90 | 91 | #endif // fmtcl_ContFirSpline_HEADER_INCLUDED 92 | 93 | 94 | 95 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 96 | -------------------------------------------------------------------------------- /src/fmtcl/ResizeData.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ResizeData.h 4 | Author: Laurent de Soras, 2011 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtcl_ResizeData_HEADER_INCLUDED) 20 | #define fmtcl_ResizeData_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fstb/AllocAlign.h" 27 | 28 | #include 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | class ResizeData 38 | { 39 | 40 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 41 | 42 | public: 43 | 44 | static const int NBR_BUF = 2; 45 | 46 | explicit ResizeData (int w, int h); 47 | virtual ~ResizeData () {} 48 | 49 | template 50 | inline T * use_buf (int index); 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | protected: 57 | 58 | 59 | 60 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 61 | 62 | private: 63 | 64 | std::vector > 65 | _buf_arr [NBR_BUF]; 66 | 67 | 68 | 69 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | 71 | private: 72 | 73 | ResizeData () = delete; 74 | ResizeData (const ResizeData &other) = delete; 75 | ResizeData & operator = (const ResizeData &other) = delete; 76 | bool operator == (const ResizeData &other) const = delete; 77 | bool operator != (const ResizeData &other) const = delete; 78 | 79 | }; // class ResizeData 80 | 81 | 82 | 83 | } // namespace fmtcl 84 | 85 | 86 | 87 | #include "fmtcl/ResizeData.hpp" 88 | 89 | 90 | 91 | #endif // fmtcl_ResizeData_HEADER_INCLUDED 92 | 93 | 94 | 95 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 96 | -------------------------------------------------------------------------------- /src/fmtcl/PrimariesPreset.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | PrimariesPreset.h 4 | Copyright (c) 2016 Ohm Force 5 | 6 | *Tab=3***********************************************************************/ 7 | 8 | 9 | 10 | #pragma once 11 | #if ! defined (fmtcl_PrimariesPreset_HEADER_INCLUDED) 12 | #define fmtcl_PrimariesPreset_HEADER_INCLUDED 13 | 14 | 15 | 16 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 17 | 18 | 19 | 20 | namespace fmtcl 21 | { 22 | 23 | 24 | 25 | // ITU-T H.265, High efficiency video coding, 2016-06, p. 408 26 | enum PrimariesPreset 27 | { 28 | PrimariesPreset_INVALID = -2, 29 | PrimariesPreset_UNDEF = -1, 30 | 31 | PrimariesPreset_RESERVED0 = 0, 32 | PrimariesPreset_BT709, 33 | PrimariesPreset_UNSPECIFIED, 34 | PrimariesPreset_RESERVED2, 35 | PrimariesPreset_FCC, 36 | PrimariesPreset_BT470BG, 37 | PrimariesPreset_SMPTE170M, 38 | PrimariesPreset_SMPTE240M, 39 | PrimariesPreset_GENERIC_FILM, 40 | PrimariesPreset_BT2020, 41 | PrimariesPreset_CIEXYZ, 42 | PrimariesPreset_P3DCI, 43 | PrimariesPreset_P3D65, 44 | 45 | PrimariesPreset_EBU3213E = 22, 46 | 47 | PrimariesPreset_NBR_ELT, 48 | 49 | PrimariesPreset_ISO_RANGE_LAST = 255, 50 | 51 | PrimariesPreset_NTSCJ, 52 | PrimariesPreset_SCRGB, 53 | PrimariesPreset_ADOBE_RGB_98, 54 | PrimariesPreset_ADOBE_RGB_WIDE, 55 | PrimariesPreset_APPLE_RGB, 56 | PrimariesPreset_ROMM, 57 | PrimariesPreset_CIERGB, 58 | PrimariesPreset_ACES, 59 | PrimariesPreset_ACESAP1, 60 | PrimariesPreset_SGAMUT, 61 | PrimariesPreset_SGAMUT3CINE, 62 | PrimariesPreset_ALEXA, 63 | PrimariesPreset_VGAMUT, 64 | PrimariesPreset_P3D60, 65 | PrimariesPreset_P22, 66 | PrimariesPreset_FREESCALE, 67 | PrimariesPreset_DAVINCI, 68 | PrimariesPreset_DRAGONCOLOR, 69 | PrimariesPreset_DRAGONCOLOR2, 70 | PrimariesPreset_REDCOLOR, 71 | PrimariesPreset_REDCOLOR2, 72 | PrimariesPreset_REDCOLOR3, 73 | PrimariesPreset_REDCOLOR4, 74 | PrimariesPreset_REDWIDE, 75 | PrimariesPreset_P3P, 76 | PrimariesPreset_CINEGAM, 77 | PrimariesPreset_AWG4, 78 | 79 | PrimariesPreset_NBR_ELT_CUSTOM 80 | }; // enum PrimariesPreset 81 | 82 | 83 | 84 | } // namespace fmtcl 85 | 86 | 87 | 88 | //#include "fmtcl/PrimariesPreset.hpp" 89 | 90 | 91 | 92 | #endif // fmtcl_PrimariesPreset_HEADER_INCLUDED 93 | 94 | 95 | 96 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 97 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpAcesCc.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpAcesCc.cpp 4 | Author: Laurent de Soras, 2016 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 19 | 20 | #include "fmtcl/TransOpAcesCc.h" 21 | 22 | #include 23 | 24 | 25 | 26 | namespace fmtcl 27 | { 28 | 29 | 30 | 31 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 32 | 33 | 34 | 35 | TransOpAcesCc::TransOpAcesCc (bool inv_flag) 36 | : _inv_flag (inv_flag) 37 | { 38 | // Nothing 39 | } 40 | 41 | 42 | 43 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | 46 | 47 | double TransOpAcesCc::do_convert (double x) const 48 | { 49 | double y = x; 50 | 51 | if (_inv_flag) 52 | { 53 | x *= 17.52; 54 | x -= 9.72; 55 | if (x <= 15) 56 | { 57 | y = exp2 (x + 1) - 1.0 / (1 << 15); 58 | } 59 | else if (x <= log2 (_max_val)) 60 | { 61 | y = exp2 (x ); 62 | } 63 | else 64 | { 65 | y = _max_val; 66 | } 67 | } 68 | 69 | else 70 | { 71 | if (x < 0) 72 | { 73 | y = -16; 74 | } 75 | else if (x < 1.0 / (1 << 15)) 76 | { 77 | y = log2 (1.0 / (1 << 15) + x) - 1; 78 | } 79 | else 80 | { 81 | y = log2 ( x); 82 | } 83 | y += 9.72; 84 | y /= 17.52; 85 | } 86 | 87 | return y; 88 | } 89 | 90 | 91 | 92 | TransOpInterface::LinInfo TransOpAcesCc::do_get_info () const 93 | { 94 | return { Type::OETF, Range::UNDEF, _max_val, 1.0, 0.0, 0.0 }; 95 | } 96 | 97 | 98 | 99 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 100 | 101 | 102 | 103 | constexpr double TransOpAcesCc::_max_val; 104 | 105 | 106 | 107 | } // namespace fmtcl 108 | 109 | 110 | 111 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 112 | -------------------------------------------------------------------------------- /src/fmtc/CpuOpt.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | CpuOpt.h 4 | Author: Laurent de Soras, 2015 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://sam.zoy.org/wtfpl/COPYING for more details. 13 | 14 | *Tab=3***********************************************************************/ 15 | 16 | 17 | 18 | #pragma once 19 | #if ! defined (fmtc_CpuOpt_HEADER_INCLUDED) 20 | #define fmtc_CpuOpt_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | #include "fmtcl/CpuOptBase.h" 27 | 28 | #include "VapourSynth4.h" 29 | 30 | 31 | 32 | namespace vsutl 33 | { 34 | class FilterBase; 35 | } 36 | 37 | namespace fmtc 38 | { 39 | 40 | 41 | 42 | class CpuOpt 43 | : public fmtcl::CpuOptBase 44 | { 45 | 46 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | public: 49 | 50 | explicit CpuOpt (vsutl::FilterBase &filter, const ::VSMap &in, ::VSMap &out, const char *param_name_0 = "cpuopt"); 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | protected: 57 | 58 | 59 | 60 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 61 | 62 | private: 63 | 64 | 65 | 66 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | 68 | private: 69 | 70 | CpuOpt () = delete; 71 | CpuOpt (const CpuOpt &other) = delete; 72 | CpuOpt (CpuOpt &&other) = delete; 73 | CpuOpt & operator = (const CpuOpt &other) = delete; 74 | CpuOpt & operator = (CpuOpt &&other) = delete; 75 | bool operator == (const CpuOpt &other) const = delete; 76 | bool operator != (const CpuOpt &other) const = delete; 77 | 78 | }; // class CpuOpt 79 | 80 | 81 | 82 | } // namespace fmtc 83 | 84 | 85 | 86 | //#include "fmtc/CpuOpt.hpp" 87 | 88 | 89 | 90 | #endif // fmtc_CpuOpt_HEADER_INCLUDED 91 | 92 | 93 | 94 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 95 | --------------------------------------------------------------------------------