├── .gitattributes ├── .travis.yml ├── COPYING ├── README.md ├── build ├── unix │ ├── Makefile.am │ ├── autogen.sh │ ├── configure.ac │ └── m4 │ │ ├── ax_check_compile_flag.m4 │ │ └── ax_check_link_flag.m4 └── win │ ├── common │ ├── common.vcxproj │ └── common.vcxproj.filters │ ├── fmtconv.sln │ ├── fmtconv │ ├── fmtconv.vcxproj │ └── fmtconv.vcxproj.filters │ ├── test │ └── test.vcxproj │ └── toolset.props ├── doc ├── colorspace-subsampling.png ├── fmtconv.html ├── license.txt ├── transfer-diag-display.svg ├── transfer-diag-scene.svg └── vapourdoc.css ├── src ├── AvstpFinder.cpp ├── AvstpFinder.h ├── AvstpWrapper.cpp ├── AvstpWrapper.h ├── VapourSynth.h ├── VapourSynth4.h ├── avisynth.h ├── avs │ ├── alignment.h │ ├── capi.h │ ├── config.h │ ├── cpuid.h │ ├── filesystem.h │ ├── minmax.h │ ├── posix.h │ ├── types.h │ └── win.h ├── avstp.h ├── avsutl │ ├── CsPlane.cpp │ ├── CsPlane.h │ ├── PlaneProcCbInterface.h │ ├── PlaneProcCbInterface_avs.cpp │ ├── PlaneProcMode.h │ ├── PlaneProcessor.h │ ├── PlaneProcessor_avs.cpp │ ├── TFlag.h │ ├── VideoFilterBase.cpp │ ├── VideoFilterBase.h │ ├── fnc.h │ ├── fnc.hpp │ └── fnc_avsutl.cpp ├── conc │ ├── AioAdd.h │ ├── AioAdd.hpp │ ├── AioMax.h │ ├── AioMax.hpp │ ├── AioSub.h │ ├── AioSub.hpp │ ├── AtomicInt.h │ ├── AtomicInt.hpp │ ├── AtomicIntOp.h │ ├── AtomicIntOp.hpp │ ├── AtomicMem.h │ ├── AtomicMem.hpp │ ├── AtomicPtr.h │ ├── AtomicPtr.hpp │ ├── AtomicPtrIntPair.h │ ├── AtomicPtrIntPair.hpp │ ├── CellPool.h │ ├── CellPool.hpp │ ├── Interlocked.h │ ├── Interlocked.hpp │ ├── LockFreeCell.h │ ├── LockFreeQueue.h │ ├── LockFreeQueue.hpp │ ├── LockFreeStack.h │ ├── LockFreeStack.hpp │ ├── ObjFactoryDef.h │ ├── ObjFactoryDef.hpp │ ├── ObjFactoryInterface.h │ ├── ObjFactoryInterface.hpp │ ├── ObjPool.h │ ├── ObjPool.hpp │ ├── README.md │ ├── def.h │ ├── fnc.h │ └── fnc.hpp ├── ffft │ ├── FFTReal-readme.txt │ ├── FFTReal.h │ ├── FFTReal.hpp │ ├── OscSinCos.h │ ├── OscSinCos.hpp │ └── def.h ├── fmtc │ ├── Bitdepth.h │ ├── Bitdepth_vs.cpp │ ├── ConvStep.cpp │ ├── ConvStep.h │ ├── Convert.cpp │ ├── Convert.h │ ├── CpuOpt.h │ ├── CpuOpt_vs.cpp │ ├── Matrix.h │ ├── Matrix2020CL.h │ ├── Matrix2020CL_vs.cpp │ ├── Matrix_vs.cpp │ ├── NativeToStack16.cpp │ ├── NativeToStack16.h │ ├── Primaries.h │ ├── Primaries_vs.cpp │ ├── Resample.h │ ├── Resample_vs.cpp │ ├── Stack16ToNative.cpp │ ├── Stack16ToNative.h │ ├── Transfer.h │ ├── Transfer_vs.cpp │ ├── fnc.h │ ├── fnc_fmtc.cpp │ └── version.h ├── fmtcavs │ ├── Bitdepth.h │ ├── Bitdepth_avs.cpp │ ├── CpuOpt.h │ ├── CpuOpt_avs.cpp │ ├── FmtAvs.cpp │ ├── FmtAvs.h │ ├── Matrix.h │ ├── Matrix2020CL.h │ ├── Matrix2020CL_avs.cpp │ ├── Matrix_avs.cpp │ ├── Primaries.h │ ├── Primaries_avs.cpp │ ├── ProcAlpha.cpp │ ├── ProcAlpha.h │ ├── Resample.h │ ├── Resample_avs.cpp │ ├── Transfer.h │ ├── Transfer_avs.cpp │ ├── fnc.h │ ├── fnc_fmtcavs.cpp │ └── function_names.h ├── fmtcl │ ├── ArrayMultiType.cpp │ ├── ArrayMultiType.h │ ├── ArrayMultiType.hpp │ ├── BitBltConv.cpp │ ├── BitBltConv.h │ ├── BitBltConv_avx2.cpp │ ├── ChromaPlacement.cpp │ ├── ChromaPlacement.h │ ├── CoefArrInt.cpp │ ├── CoefArrInt.h │ ├── CoefArrInt.hpp │ ├── ColorFamily.h │ ├── ColorSpaceH265.h │ ├── ContFirBlackman.cpp │ ├── ContFirBlackman.h │ ├── ContFirBlackmanMinLobe.cpp │ ├── ContFirBlackmanMinLobe.h │ ├── ContFirCubic.cpp │ ├── ContFirCubic.h │ ├── ContFirFromDiscrete.cpp │ ├── ContFirFromDiscrete.h │ ├── ContFirGauss.cpp │ ├── ContFirGauss.h │ ├── ContFirInterface.cpp │ ├── ContFirInterface.h │ ├── ContFirLanczos.cpp │ ├── ContFirLanczos.h │ ├── ContFirLinear.cpp │ ├── ContFirLinear.h │ ├── ContFirRect.cpp │ ├── ContFirRect.h │ ├── ContFirSinc.cpp │ ├── ContFirSinc.h │ ├── ContFirSnh.cpp │ ├── ContFirSnh.h │ ├── ContFirSpline.cpp │ ├── ContFirSpline.h │ ├── ContFirSpline16.cpp │ ├── ContFirSpline16.h │ ├── ContFirSpline36.cpp │ ├── ContFirSpline36.h │ ├── ContFirSpline64.cpp │ ├── ContFirSpline64.h │ ├── CpuOptBase.cpp │ ├── CpuOptBase.h │ ├── Cst.h │ ├── Cst_fmtcl.cpp │ ├── DiscreteFirCustom.cpp │ ├── DiscreteFirCustom.h │ ├── DiscreteFirInterface.cpp │ ├── DiscreteFirInterface.h │ ├── Dither.cpp │ ├── Dither.h │ ├── ErrDifBuf.cpp │ ├── ErrDifBuf.h │ ├── ErrDifBuf.hpp │ ├── ErrDifBufFactory.cpp │ ├── ErrDifBufFactory.h │ ├── FilterResize.cpp │ ├── FilterResize.h │ ├── Frame.h │ ├── Frame.hpp │ ├── FrameRO.h │ ├── GammaY.cpp │ ├── GammaY.h │ ├── InterlacingType.h │ ├── KernelData.cpp │ ├── KernelData.h │ ├── LumMatch.h │ ├── Mat3.h │ ├── Mat3.hpp │ ├── Mat4.h │ ├── Mat4.hpp │ ├── MatXyz2Lms.cpp │ ├── MatXyz2Lms.h │ ├── Matrix2020CLProc.cpp │ ├── Matrix2020CLProc.h │ ├── Matrix2020CLProc_macro.h │ ├── MatrixProc.cpp │ ├── MatrixProc.h │ ├── MatrixProc_avx.cpp │ ├── MatrixProc_avx2.cpp │ ├── MatrixProc_macro.h │ ├── MatrixUtil.cpp │ ├── MatrixUtil.h │ ├── MatrixWrap.h │ ├── MatrixWrap.hpp │ ├── PicFmt.h │ ├── Plane.h │ ├── Plane.hpp │ ├── PlaneRO.h │ ├── PrimUtil.cpp │ ├── PrimUtil.h │ ├── PrimariesPreset.h │ ├── ProcComp3Arg.cpp │ ├── ProcComp3Arg.h │ ├── Proxy.h │ ├── Proxy.hpp │ ├── ProxyRwAvx2.h │ ├── ProxyRwAvx2.hpp │ ├── ProxyRwCpp.h │ ├── ProxyRwCpp.hpp │ ├── ProxyRwSse2.h │ ├── ProxyRwSse2.hpp │ ├── ReadWrapperFlt.h │ ├── ReadWrapperFlt.hpp │ ├── ReadWrapperInt.h │ ├── ReadWrapperInt.hpp │ ├── ResamplePlaneData.h │ ├── ResampleSpecPlane.cpp │ ├── ResampleSpecPlane.h │ ├── ResampleUtil.cpp │ ├── ResampleUtil.h │ ├── ResizeData.cpp │ ├── ResizeData.h │ ├── ResizeData.hpp │ ├── ResizeDataFactory.cpp │ ├── ResizeDataFactory.h │ ├── RgbSystem.cpp │ ├── RgbSystem.h │ ├── Scaler.cpp │ ├── Scaler.h │ ├── ScalerCopy.h │ ├── Scaler_avx2.cpp │ ├── SplFmt.h │ ├── SplFmt.hpp │ ├── TransCst.cpp │ ├── TransCst.h │ ├── TransCurve.h │ ├── TransLut.cpp │ ├── TransLut.h │ ├── TransLut_avx2.cpp │ ├── TransModel.cpp │ ├── TransModel.h │ ├── TransOp2084.cpp │ ├── TransOp2084.h │ ├── TransOpAcesCc.cpp │ ├── TransOpAcesCc.h │ ├── TransOpAcesCct.cpp │ ├── TransOpAcesCct.h │ ├── TransOpAffine.cpp │ ├── TransOpAffine.h │ ├── TransOpBypass.h │ ├── TransOpCanonLog.cpp │ ├── TransOpCanonLog.h │ ├── TransOpCompose.h │ ├── TransOpCompose.hpp │ ├── TransOpContrast.h │ ├── TransOpContrast.hpp │ ├── TransOpDaVinci.cpp │ ├── TransOpDaVinci.h │ ├── TransOpErimm.cpp │ ├── TransOpErimm.h │ ├── TransOpFilmStream.cpp │ ├── TransOpFilmStream.h │ ├── TransOpHlg.cpp │ ├── TransOpHlg.h │ ├── TransOpInterface.cpp │ ├── TransOpInterface.h │ ├── TransOpLinPow.cpp │ ├── TransOpLinPow.h │ ├── TransOpLog3G10.cpp │ ├── TransOpLog3G10.h │ ├── TransOpLogC.cpp │ ├── TransOpLogC.h │ ├── TransOpLogTrunc.cpp │ ├── TransOpLogTrunc.h │ ├── TransOpPow.cpp │ ├── TransOpPow.h │ ├── TransOpPowOfs.cpp │ ├── TransOpPowOfs.h │ ├── TransOpSLog.cpp │ ├── TransOpSLog.h │ ├── TransOpSLog3.cpp │ ├── TransOpSLog3.h │ ├── TransOpSigmoid.cpp │ ├── TransOpSigmoid.h │ ├── TransUtil.cpp │ ├── TransUtil.h │ ├── Vec3.h │ ├── Vec3.hpp │ ├── VoidAndCluster.cpp │ ├── VoidAndCluster.h │ ├── VoidAndClusterPrecalc.cpp │ ├── VoidAndClusterPrecalc.h │ ├── fnc.h │ ├── fnc.hpp │ └── fnc_fmtcl.cpp ├── fstb │ ├── AllocAlign.h │ ├── AllocAlign.hpp │ ├── ArrayAlign.h │ ├── ArrayAlign.hpp │ ├── CpuId.cpp │ ├── CpuId.h │ ├── Hash.h │ ├── Hash.hpp │ ├── SingleObj.h │ ├── SingleObj.hpp │ ├── ToolsAvx2.cpp │ ├── ToolsAvx2.h │ ├── ToolsAvx2.hpp │ ├── ToolsSse2.cpp │ ├── ToolsSse2.h │ ├── ToolsSse2.hpp │ ├── Vf32.h │ ├── Vf32.hpp │ ├── Vs32.h │ ├── Vs32.hpp │ ├── Vu32.h │ ├── Vu32.hpp │ ├── def.h │ ├── fnc.h │ ├── fnc.hpp │ └── fnc_fstb.cpp ├── main-avs.cpp ├── main-vs.cpp ├── test │ ├── GenTestPat.cpp │ ├── GenTestPat.h │ ├── PrecalcVoidAndCluster.cpp │ ├── PrecalcVoidAndCluster.h │ ├── TestGammaY.cpp │ ├── TestGammaY.h │ └── main.cpp └── vsutl │ ├── FilterBase.cpp │ ├── FilterBase.h │ ├── FrameRefSPtr.h │ ├── FuncRefSPtr.h │ ├── NodeRefSPtr.h │ ├── ObjRefSPtr.h │ ├── ObjRefSPtr.hpp │ ├── PlaneProcCbInterface.h │ ├── PlaneProcCbInterface_vs.cpp │ ├── PlaneProcMode.h │ ├── PlaneProcessor.h │ ├── PlaneProcessor_vs.cpp │ ├── Redirect.h │ ├── Redirect.hpp │ ├── fnc.h │ └── fnc_vsutl.cpp └── zip-release.bat /.gitattributes: -------------------------------------------------------------------------------- 1 | 2 | *.sh text eol=lf 3 | *.ac text eol=lf 4 | *.am text eol=lf 5 | 6 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### We have moved! 2 | 3 | **This page is now dead, there will not be any update anymore.** 4 | 5 | **The new page is hosted here: https://gitlab.com/EleonoreMizo/fmtconv/** 6 | **Git repository address: https://gitlab.com/EleonoreMizo/fmtconv.git** 7 | 8 | Please update your bookmarks! Repository is kept here for consistency with other projects but probably not indefinitely. 9 | 10 | fmtconv — format conversion tools for Vapoursynth and Avisynth+ 11 | =============================================================== 12 | 13 | Fmtconv is a format-conversion plug-in for the Vapoursynth and Avisynth+ video processing engines. 14 | It does: 15 | * Resizing. 16 | * Bitdepth conversion with dithering. 17 | * Colorspace conversion (matrix, transfer characteristics and chromatic adaptation). 18 | 19 | It supports: 20 | * Pixel data types: 8-–12-, 14- and 16-bit integer, 32-bit float. 21 | * 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. 22 | * Progressive and interlaced content. 23 | 24 | Fmtconv is focussed primarily on quality and exactness rather than execution speed. 25 | This does not mean it is slow or unoptimized, but fmtconv is clearly not on par with the fastest equivalent 8-bit filters. 26 | 27 | See `doc/fmtconv.html` for more information. 28 | 29 | Support on the Doom9 forums: [Vapoursynth](http://forum.doom9.org/showthread.php?t=166504) and [Avisynth+](https://forum.doom9.org/showthread.php?t=183139). 30 | -------------------------------------------------------------------------------- /build/unix/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | autoreconf --verbose --install --force 4 | -------------------------------------------------------------------------------- /build/unix/m4/ax_check_compile_flag.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check whether the given FLAG works with the current language's compiler 12 | # or gives an error. (Warnings, however, are ignored) 13 | # 14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 15 | # success/failure. 16 | # 17 | # If EXTRA-FLAGS is defined, it is added to the current language's default 18 | # flags (e.g. CFLAGS) when the check is done. The check is thus made with 19 | # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to 20 | # force the compiler to issue an error when a bad flag is given. 21 | # 22 | # INPUT gives an alternative input source to AC_COMPILE_IFELSE. 23 | # 24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this 25 | # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. 26 | # 27 | # LICENSE 28 | # 29 | # Copyright (c) 2008 Guido U. Draheim 30 | # Copyright (c) 2011 Maarten Bosmans 31 | # 32 | # Copying and distribution of this file, with or without modification, are 33 | # permitted in any medium without royalty provided the copyright notice 34 | # and this notice are preserved. This file is offered as-is, without any 35 | # warranty. 36 | 37 | #serial 6 38 | 39 | AC_DEFUN([AX_CHECK_COMPILE_FLAG], 40 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF 41 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl 42 | AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ 43 | ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS 44 | _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" 45 | AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], 46 | [AS_VAR_SET(CACHEVAR,[yes])], 47 | [AS_VAR_SET(CACHEVAR,[no])]) 48 | _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) 49 | AS_VAR_IF(CACHEVAR,yes, 50 | [m4_default([$2], :)], 51 | [m4_default([$3], :)]) 52 | AS_VAR_POPDEF([CACHEVAR])dnl 53 | ])dnl AX_CHECK_COMPILE_FLAGS 54 | -------------------------------------------------------------------------------- /build/unix/m4/ax_check_link_flag.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html 3 | # =========================================================================== 4 | # 5 | # SYNOPSIS 6 | # 7 | # AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) 8 | # 9 | # DESCRIPTION 10 | # 11 | # Check whether the given FLAG works with the linker or gives an error. 12 | # (Warnings, however, are ignored) 13 | # 14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on 15 | # success/failure. 16 | # 17 | # If EXTRA-FLAGS is defined, it is added to the linker's default flags 18 | # when the check is done. The check is thus made with the flags: "LDFLAGS 19 | # EXTRA-FLAGS FLAG". This can for example be used to force the linker to 20 | # issue an error when a bad flag is given. 21 | # 22 | # INPUT gives an alternative input source to AC_LINK_IFELSE. 23 | # 24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this 25 | # macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. 26 | # 27 | # LICENSE 28 | # 29 | # Copyright (c) 2008 Guido U. Draheim 30 | # Copyright (c) 2011 Maarten Bosmans 31 | # 32 | # Copying and distribution of this file, with or without modification, are 33 | # permitted in any medium without royalty provided the copyright notice 34 | # and this notice are preserved. This file is offered as-is, without any 35 | # warranty. 36 | 37 | #serial 6 38 | 39 | AC_DEFUN([AX_CHECK_LINK_FLAG], 40 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF 41 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl 42 | AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ 43 | ax_check_save_flags=$LDFLAGS 44 | LDFLAGS="$LDFLAGS $4 $1" 45 | AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], 46 | [AS_VAR_SET(CACHEVAR,[yes])], 47 | [AS_VAR_SET(CACHEVAR,[no])]) 48 | LDFLAGS=$ax_check_save_flags]) 49 | AS_VAR_IF(CACHEVAR,yes, 50 | [m4_default([$2], :)], 51 | [m4_default([$3], :)]) 52 | AS_VAR_POPDEF([CACHEVAR])dnl 53 | ])dnl AX_CHECK_LINK_FLAGS 54 | -------------------------------------------------------------------------------- /build/win/toolset.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>12.0.30501.0 5 | 6 | 7 | v142 8 | 9 | 10 | v142 11 | 12 | -------------------------------------------------------------------------------- /doc/colorspace-subsampling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleonoreMizo/fmtconv/77f26b9a101bf883868a0401f2e89140f4323579/doc/colorspace-subsampling.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/avs/win.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_WIN_H 33 | #define AVSCORE_WIN_H 34 | 35 | // Whenever you need windows headers, start by including this file, then the rest. 36 | 37 | // WWUUT? We require XP now? 38 | #if !defined(NTDDI_VERSION) && !defined(_WIN32_WINNT) 39 | #define NTDDI_VERSION 0x05020000 40 | #define _WIN32_WINNT 0x0502 41 | #endif 42 | 43 | #define WIN32_LEAN_AND_MEAN 44 | #define STRICT 45 | #if !defined(NOMINMAX) 46 | #define NOMINMAX 47 | #endif 48 | 49 | #include 50 | 51 | // Provision for UTF-8 max 4 bytes per code point 52 | #define AVS_MAX_PATH MAX_PATH*4 53 | 54 | #endif // AVSCORE_WIN_H 55 | -------------------------------------------------------------------------------- /src/avsutl/PlaneProcCbInterface.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | PlaneProcCbInterface.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_PlaneProcCbInterface_HEADER_INCLUDED) 20 | #define avsutl_PlaneProcCbInterface_HEADER_INCLUDED 21 | 22 | 23 | 24 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 25 | 26 | 27 | 28 | class IScriptEnvironment; 29 | class PVideoFrame; 30 | 31 | namespace avsutl 32 | { 33 | 34 | 35 | 36 | class PlaneProcCbInterface 37 | { 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | public: 42 | 43 | PlaneProcCbInterface () = default; 44 | virtual ~PlaneProcCbInterface () = default; 45 | 46 | void process_plane (::PVideoFrame &dst_sptr, int n, ::IScriptEnvironment &env, int plane_index, int plane_id, void *ctx_ptr); 47 | 48 | 49 | 50 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 51 | 52 | protected: 53 | 54 | virtual void do_process_plane (::PVideoFrame &dst_sptr, int n, ::IScriptEnvironment &env, int plane_index, int plane_id, void *ctx_ptr) = 0; 55 | 56 | 57 | 58 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | PlaneProcCbInterface (const PlaneProcCbInterface &other) = delete; 63 | PlaneProcCbInterface (PlaneProcCbInterface &&other) = delete; 64 | PlaneProcCbInterface & 65 | operator = (const PlaneProcCbInterface &other) = delete; 66 | PlaneProcCbInterface & 67 | operator = (PlaneProcCbInterface &&other) = delete; 68 | 69 | }; // class PlaneProcCbInterface 70 | 71 | 72 | 73 | } // namespace avsutl 74 | 75 | 76 | 77 | //#include "avsutl/PlaneProcCbInterface.hpp" 78 | 79 | 80 | 81 | #endif // avsutl_PlaneProcCbInterface_HEADER_INCLUDED 82 | 83 | 84 | 85 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 86 | -------------------------------------------------------------------------------- /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 | #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 "avsutl/PlaneProcCbInterface.h" 28 | #include "avisynth.h" 29 | 30 | #include 31 | 32 | 33 | 34 | namespace avsutl 35 | { 36 | 37 | 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | 42 | 43 | void PlaneProcCbInterface::process_plane (::PVideoFrame &dst_sptr, int n, ::IScriptEnvironment &env, int plane_index, int plane_id, void *ctx_ptr) 44 | { 45 | assert (dst_sptr != nullptr); 46 | assert (n >= 0); 47 | assert (plane_index >= 0); 48 | 49 | do_process_plane (dst_sptr, n, env, plane_index, plane_id, ctx_ptr); 50 | } 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | 57 | 58 | } // namespace avsutl 59 | 60 | 61 | 62 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | -------------------------------------------------------------------------------- /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/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/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 | #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 "avsutl/VideoFilterBase.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace avsutl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | VideoFilterBase::VideoFilterBase (::IScriptEnvironment &env, ::PClip c) 43 | : Inherited (c) 44 | { 45 | try 46 | { 47 | env.CheckVersion (8); 48 | _prop_flag = true; 49 | } 50 | catch (const ::AvisynthError &) 51 | { 52 | _prop_flag = false; 53 | } 54 | } 55 | 56 | 57 | 58 | bool VideoFilterBase::supports_props () const noexcept 59 | { 60 | return _prop_flag; 61 | } 62 | 63 | 64 | 65 | ::PVideoFrame VideoFilterBase::build_new_frame (::IScriptEnvironment &env, const ::VideoInfo &vi_n, ::PVideoFrame *src_ptr, int align) 66 | { 67 | if (supports_props ()) 68 | { 69 | return env.NewVideoFrameP (vi_n, src_ptr, align); 70 | } 71 | else 72 | { 73 | return env.NewVideoFrame (vi_n, align); 74 | } 75 | } 76 | 77 | 78 | 79 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 80 | 81 | 82 | 83 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 84 | 85 | 86 | 87 | } // namespace avsutl 88 | 89 | 90 | 91 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 92 | -------------------------------------------------------------------------------- /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/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/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 | #if ! defined (conc_AioAdd_HEADER_INCLUDED) 19 | #define conc_AioAdd_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace conc 33 | { 34 | 35 | 36 | 37 | template 38 | class AioAdd 39 | { 40 | 41 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 42 | 43 | public: 44 | 45 | explicit inline 46 | AioAdd (T operand); 47 | virtual ~AioAdd () = default; 48 | 49 | inline T operator () (T old_val) const noexcept; 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | protected: 56 | 57 | 58 | 59 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 60 | 61 | private: 62 | 63 | T _operand; 64 | 65 | 66 | 67 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 68 | 69 | private: 70 | 71 | AioAdd () = delete; 72 | AioAdd (const AioAdd &other) = delete; 73 | AioAdd (const AioAdd &&other) = delete; 74 | AioAdd & operator = (const AioAdd &other) = delete; 75 | AioAdd & operator = (const AioAdd &&other) = delete; 76 | bool operator == (const AioAdd &other) const = delete; 77 | bool operator != (const AioAdd &other) const = delete; 78 | 79 | }; // class AioAdd 80 | 81 | 82 | 83 | } // namespace conc 84 | 85 | 86 | 87 | #include "conc/AioAdd.hpp" 88 | 89 | 90 | 91 | #endif // conc_AioAdd_HEADER_INCLUDED 92 | 93 | 94 | 95 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 96 | -------------------------------------------------------------------------------- /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/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 | #if ! defined (conc_AioMax_HEADER_INCLUDED) 19 | #define conc_AioMax_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace conc 33 | { 34 | 35 | 36 | 37 | template 38 | class AioMax 39 | { 40 | 41 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 42 | 43 | public: 44 | 45 | explicit inline 46 | AioMax (T operand); 47 | 48 | inline T operator () (T old_val) const noexcept; 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | private: 61 | 62 | T _operand; 63 | 64 | 65 | 66 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | 68 | private: 69 | 70 | AioMax () = delete; 71 | AioMax (const AioMax &other) = delete; 72 | AioMax (const AioMax &&other) = delete; 73 | AioMax & operator = (const AioMax &other) = delete; 74 | AioMax & operator = (const AioMax &&other) = delete; 75 | bool operator == (const AioMax &other) const = delete; 76 | bool operator != (const AioMax &other) const = delete; 77 | 78 | }; // class AioMax 79 | 80 | 81 | 82 | } // namespace conc 83 | 84 | 85 | 86 | #include "conc/AioMax.hpp" 87 | 88 | 89 | 90 | #endif // conc_AioMax_HEADER_INCLUDED 91 | 92 | 93 | 94 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 95 | -------------------------------------------------------------------------------- /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/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/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 | #if ! defined (conc_LockFreeCell_HEADER_INCLUDED) 26 | #define conc_LockFreeCell_HEADER_INCLUDED 27 | 28 | #if defined (_MSC_VER) 29 | #pragma once 30 | #pragma warning (4 : 4250) 31 | #endif 32 | 33 | 34 | 35 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 36 | 37 | #include "conc/AtomicPtr.h" 38 | 39 | 40 | 41 | namespace conc 42 | { 43 | 44 | 45 | 46 | template 47 | class LockFreeCell 48 | { 49 | 50 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 51 | 52 | public: 53 | 54 | typedef T ValueType; 55 | 56 | AtomicPtr > 57 | _next_ptr { nullptr }; 58 | T _val; 59 | 60 | 61 | 62 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | protected: 65 | 66 | 67 | 68 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | 70 | private: 71 | 72 | 73 | 74 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 75 | 76 | private: 77 | 78 | }; // class LockFreeCell 79 | 80 | 81 | 82 | } // namespace conc 83 | 84 | 85 | 86 | //#include "conc/LockFreeCell.hpp" 87 | 88 | 89 | 90 | #endif // conc_LockFreeCell_HEADER_INCLUDED 91 | 92 | 93 | 94 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 95 | -------------------------------------------------------------------------------- /src/conc/LockFreeQueue.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleonoreMizo/fmtconv/77f26b9a101bf883868a0401f2e89140f4323579/src/conc/LockFreeQueue.hpp -------------------------------------------------------------------------------- /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 | #if ! defined (conc_ObjFactoryDef_HEADER_INCLUDED) 21 | #define conc_ObjFactoryDef_HEADER_INCLUDED 22 | 23 | #if defined (_MSC_VER) 24 | #pragma once 25 | #pragma warning (4 : 4250) 26 | #endif 27 | 28 | 29 | 30 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 31 | 32 | #include "conc/ObjFactoryInterface.h" 33 | 34 | 35 | 36 | namespace conc 37 | { 38 | 39 | 40 | 41 | template 42 | class ObjFactoryDef 43 | : public ObjFactoryInterface 44 | { 45 | 46 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | public: 49 | 50 | ObjFactoryDef () = default; 51 | virtual ~ObjFactoryDef () = default; 52 | 53 | static ObjFactoryDef 54 | _fact; 55 | 56 | 57 | 58 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | protected: 61 | 62 | // conc::ObjFactoryInterface 63 | virtual T * do_create (); 64 | 65 | 66 | 67 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 68 | 69 | private: 70 | 71 | 72 | 73 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 74 | 75 | private: 76 | 77 | ObjFactoryDef (const ObjFactoryDef &other) = delete; 78 | ObjFactoryDef& operator = (const ObjFactoryDef &other) = delete; 79 | bool operator == (const ObjFactoryDef &other) const = delete; 80 | bool operator != (const ObjFactoryDef &other) const = delete; 81 | 82 | }; // class ObjFactoryDef 83 | 84 | 85 | 86 | } // namespace conc 87 | 88 | 89 | 90 | #include "conc/ObjFactoryDef.hpp" 91 | 92 | 93 | 94 | #endif // conc_ObjFactoryDef_HEADER_INCLUDED 95 | 96 | 97 | 98 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 99 | -------------------------------------------------------------------------------- /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/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 | #if ! defined (conc_ObjFactoryInterface_HEADER_INCLUDED) 21 | #define conc_ObjFactoryInterface_HEADER_INCLUDED 22 | 23 | #if defined (_MSC_VER) 24 | #pragma once 25 | #pragma warning (4 : 4250) 26 | #endif 27 | 28 | 29 | 30 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 31 | 32 | 33 | 34 | namespace conc 35 | { 36 | 37 | 38 | 39 | template 40 | class ObjFactoryInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | virtual ~ObjFactoryInterface () = default; 48 | 49 | T * create (); 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | protected: 56 | 57 | virtual T * do_create () = 0; 58 | 59 | 60 | 61 | }; // class ObjFactoryInterface 62 | 63 | 64 | 65 | } // namespace conc 66 | 67 | 68 | 69 | #include "conc/ObjFactoryInterface.hpp" 70 | 71 | 72 | 73 | #endif // conc_ObjFactoryInterface_HEADER_INCLUDED 74 | 75 | 76 | 77 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 78 | -------------------------------------------------------------------------------- /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/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/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 | #if ! defined (conc_fnc_HEADER_INCLUDED) 19 | #define conc_fnc_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace conc 33 | { 34 | 35 | 36 | 37 | template 38 | bool is_ptr_aligned (const T *ptr, int align) noexcept; 39 | template 40 | bool is_ptr_aligned_nz (const T *ptr, int align) noexcept; 41 | template 42 | bool is_ptr_aligned_nz (const T *ptr) noexcept; 43 | 44 | 45 | 46 | } // namespace conc 47 | 48 | 49 | 50 | #include "conc/fnc.hpp" 51 | 52 | 53 | 54 | #endif // conc_fnc_HEADER_INCLUDED 55 | 56 | 57 | 58 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | -------------------------------------------------------------------------------- /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/ffft/FFTReal-readme.txt: -------------------------------------------------------------------------------- 1 |  2 | These files are only a subset of the FFTReal library. Please check 3 | http://ldesoras.free.fr/prod.html#src_fftreal for more information. 4 | -------------------------------------------------------------------------------- /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 | #if ! defined (ffft_def_HEADER_INCLUDED) 19 | #define ffft_def_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) // "Inherits via dominance." 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace ffft 33 | { 34 | 35 | 36 | 37 | constexpr double PI = 3.1415926535897932384626433832795; 38 | constexpr double SQRT2 = 1.41421356237309514547462185873883; 39 | 40 | #if defined (_MSC_VER) 41 | 42 | #define ffft_FORCEINLINE __forceinline 43 | 44 | #else 45 | 46 | #define ffft_FORCEINLINE inline 47 | 48 | #endif 49 | 50 | // Compiler type 51 | #define ffft_COMPILER_UNKNOWN (-1) 52 | #define ffft_COMPILER_GCC (1) 53 | #define ffft_COMPILER_MSVC (2) 54 | 55 | #if defined (__GNUC__) || defined (__clang__) 56 | #define ffft_COMPILER ffft_COMPILER_GCC 57 | #elif defined (_MSC_VER) 58 | #define ffft_COMPILER ffft_COMPILER_MSVC 59 | #else 60 | #define ffft_COMPILER ffft_COMPILER_UNKNOWN 61 | #endif 62 | 63 | 64 | 65 | 66 | } // namespace ffft 67 | 68 | 69 | 70 | #endif // ffft_def_HEADER_INCLUDED 71 | 72 | 73 | 74 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 75 | -------------------------------------------------------------------------------- /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 | #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 "fmtc/ConvStep.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtc 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 43 | 44 | 45 | 46 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 47 | 48 | 49 | 50 | } // namespace fmtc 51 | 52 | 53 | 54 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | -------------------------------------------------------------------------------- /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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/CpuOptBase.h" 31 | 32 | #include "VapourSynth4.h" 33 | 34 | 35 | 36 | namespace vsutl 37 | { 38 | class FilterBase; 39 | } 40 | 41 | namespace fmtc 42 | { 43 | 44 | 45 | 46 | class CpuOpt 47 | : public fmtcl::CpuOptBase 48 | { 49 | 50 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 51 | 52 | public: 53 | 54 | explicit CpuOpt (vsutl::FilterBase &filter, const ::VSMap &in, ::VSMap &out, const char *param_name_0 = "cpuopt"); 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 | CpuOpt () = delete; 75 | CpuOpt (const CpuOpt &other) = delete; 76 | CpuOpt (CpuOpt &&other) = delete; 77 | CpuOpt & operator = (const CpuOpt &other) = delete; 78 | CpuOpt & operator = (CpuOpt &&other) = delete; 79 | bool operator == (const CpuOpt &other) const = delete; 80 | bool operator != (const CpuOpt &other) const = delete; 81 | 82 | }; // class CpuOpt 83 | 84 | 85 | 86 | } // namespace fmtc 87 | 88 | 89 | 90 | //#include "fmtc/CpuOpt.hpp" 91 | 92 | 93 | 94 | #endif // fmtc_CpuOpt_HEADER_INCLUDED 95 | 96 | 97 | 98 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 99 | -------------------------------------------------------------------------------- /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 | #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 "fmtc/CpuOpt.h" 28 | #include "vsutl/FilterBase.h" 29 | 30 | #include 31 | 32 | 33 | 34 | namespace fmtc 35 | { 36 | 37 | 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | 42 | 43 | CpuOpt::CpuOpt (vsutl::FilterBase &filter, const ::VSMap &in, ::VSMap &out, const char *param_name_0) 44 | { 45 | assert (param_name_0 != 0); 46 | set_level (static_cast (filter.get_arg_int ( 47 | in, out, param_name_0, Level_ANY_AVAILABLE 48 | ) & Level_MASK)); 49 | } 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | 56 | 57 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 58 | 59 | 60 | 61 | } // namespace fmtc 62 | 63 | 64 | 65 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 66 | -------------------------------------------------------------------------------- /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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/ColorFamily.h" 31 | #include "fmtcl/ColorSpaceH265.h" 32 | #include "fmtcl/ProcComp3Arg.h" 33 | #include "fmtcl/PicFmt.h" 34 | #include "fmtcl/SplFmt.h" 35 | 36 | 37 | 38 | struct VSAPI; 39 | struct VSVideoFormat; 40 | struct VSFrame; 41 | 42 | namespace fmtcl 43 | { 44 | class Mat4; 45 | class MatrixProc; 46 | } 47 | namespace vsutl 48 | { 49 | class FilterBase; 50 | } 51 | 52 | namespace fmtc 53 | { 54 | 55 | 56 | 57 | fmtcl::PicFmt conv_vsfmt_to_picfmt (const ::VSVideoFormat &fmt, bool full_flag); 58 | fmtcl::SplFmt conv_vsfmt_to_splfmt (const ::VSVideoFormat &fmt); 59 | void conv_vsfmt_to_splfmt (fmtcl::SplFmt &type, int &bitdepth, const ::VSVideoFormat &fmt); 60 | fmtcl::ColorFamily conv_vsfmt_to_colfam (const ::VSVideoFormat &fmt); 61 | int conv_fmtcl_colfam_to_vs (fmtcl::ColorFamily cf); 62 | 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); 63 | fmtcl::ProcComp3Arg build_mat_proc (const ::VSAPI &vsapi, ::VSFrame &dst, const ::VSFrame &src, bool single_plane_flag = false); 64 | 65 | 66 | 67 | } // namespace fmtc 68 | 69 | 70 | 71 | //#include "fmtc/fnc.hpp" 72 | 73 | 74 | 75 | #endif // fmtc_fnc_HEADER_INCLUDED 76 | 77 | 78 | 79 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 80 | -------------------------------------------------------------------------------- /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/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/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 | #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 "fmtcavs/CpuOpt.h" 28 | #include "avisynth.h" 29 | 30 | #include 31 | 32 | 33 | 34 | namespace fmtcavs 35 | { 36 | 37 | 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | 42 | 43 | CpuOpt::CpuOpt (const ::AVSValue &arg) 44 | { 45 | set_level (static_cast ( 46 | arg.AsInt (Level_ANY_AVAILABLE) & Level_MASK 47 | )); 48 | } 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | 55 | 56 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 57 | 58 | 59 | 60 | } // namespace fmtcavs 61 | 62 | 63 | 64 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | -------------------------------------------------------------------------------- /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/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 | #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/ArrayMultiType.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | void ArrayMultiType::resize (size_t length) 43 | { 44 | const size_t old_len = _length; 45 | _length = length; 46 | if (_length != old_len) 47 | { 48 | _arr.resize (_length * _data_len); 49 | } 50 | } 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | 61 | 62 | } // namespace fmtcl 63 | 64 | 65 | 66 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | -------------------------------------------------------------------------------- /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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | enum ChromaPlacement 38 | { 39 | ChromaPlacement_INVALID = -2, 40 | ChromaPlacement_UNDEF = -1, 41 | 42 | ChromaPlacement_MPEG1 = 0, // Type 1 43 | ChromaPlacement_MPEG2, // Type 0 44 | ChromaPlacement_DV, 45 | ChromaPlacement_T_L, // Type 2 (top left) 46 | 47 | ChromaPlacement_NBR_ELT 48 | }; 49 | 50 | 51 | 52 | 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); 53 | 54 | 55 | 56 | } // namespace fmtcl 57 | 58 | 59 | 60 | //#include "fmtcl/ChromaPlacement.hpp" 61 | 62 | 63 | 64 | #endif // fmtcl_ChromaPlacement_HEADER_INCLUDED 65 | 66 | 67 | 68 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | -------------------------------------------------------------------------------- /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/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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | enum ColorFamily 38 | { 39 | ColorFamily_INVALID = -1, 40 | 41 | ColorFamily_GRAY = 0, 42 | ColorFamily_RGB, 43 | ColorFamily_YUV, 44 | 45 | ColorFamily_NBR_ELT 46 | 47 | }; // enum ColorFamily 48 | 49 | 50 | 51 | } // namespace fmtcl 52 | 53 | 54 | 55 | //#include "fmtcl/ColorFamily.hpp" 56 | 57 | 58 | 59 | #endif // fmtcl_ColorFamily_HEADER_INCLUDED 60 | 61 | 62 | 63 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 64 | -------------------------------------------------------------------------------- /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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | // ITU-T H.265, High efficiency video coding, 2019-06, p. 415 38 | enum ColorSpaceH265 39 | { 40 | ColorSpaceH265_UNDEF = -1, 41 | 42 | ColorSpaceH265_RGB = 0, // RGB or XYZ 43 | ColorSpaceH265_BT709, 44 | ColorSpaceH265_UNSPECIFIED, 45 | ColorSpaceH265_RESERVED, 46 | ColorSpaceH265_FCC, 47 | ColorSpaceH265_BT470BG, 48 | ColorSpaceH265_SMPTE170M, 49 | ColorSpaceH265_SMPTE240M, 50 | ColorSpaceH265_YCGCO, 51 | ColorSpaceH265_BT2020NCL, 52 | ColorSpaceH265_BT2020CL, 53 | ColorSpaceH265_YDZDX, 54 | ColorSpaceH265_CHRODERNCL, 55 | ColorSpaceH265_CHRODERCL, 56 | ColorSpaceH265_ICTCP, // This matrix depends on the transfer characteristic 57 | 58 | ColorSpaceH265_NBR_ELT, 59 | 60 | ColorSpaceH265_ISO_RANGE_LAST = 255, 61 | 62 | ColorSpaceH265_CUSTOM = 1000, 63 | 64 | ColorSpaceH265_LMS, 65 | ColorSpaceH265_ICTCP_PQ, 66 | ColorSpaceH265_ICTCP_HLG 67 | 68 | }; // enum ColorSpaceH265 69 | 70 | 71 | 72 | } // namespace fmtcl 73 | 74 | 75 | 76 | //#include "fmtcl/ColorSpaceH265.hpp" 77 | 78 | 79 | 80 | #endif // fmtcl_ColorSpaceH265_HEADER_INCLUDED 81 | 82 | 83 | 84 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 85 | -------------------------------------------------------------------------------- /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 | #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/ContFirCubic.h" 28 | 29 | #include 30 | #include 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | 42 | 43 | ContFirCubic::ContFirCubic (double b, double c) 44 | : _p0 (( 6 - 2*b ) / 6) 45 | , _p2 ((-18 + 12*b + 6*c) / 6) 46 | , _p3 (( 12 - 9*b - 6*c) / 6) 47 | , _q0 (( 8*b + 24*c) / 6) 48 | , _q1 (( -12*b - 48*c) / 6) 49 | , _q2 (( 6*b + 30*c) / 6) 50 | , _q3 (( - b - 6*c) / 6) 51 | { 52 | // Nothing 53 | } 54 | 55 | 56 | 57 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 58 | 59 | 60 | 61 | double ContFirCubic::do_get_support () const 62 | { 63 | return (2.0); 64 | } 65 | 66 | 67 | 68 | double ContFirCubic::do_get_val (double x) const 69 | { 70 | x = fabs (x); 71 | 72 | return ( (x < 1) ? (_p0 + x * x * (_p2 + x * _p3)) 73 | : (x < 2) ? (_q0 + x * (_q1 + x * (_q2 + x * _q3))) 74 | : 0.0); 75 | } 76 | 77 | 78 | 79 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 80 | 81 | 82 | 83 | } // namespace fmtcl 84 | 85 | 86 | 87 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 88 | -------------------------------------------------------------------------------- /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 | #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/ContFirGauss.h" 28 | #include "fstb/fnc.h" 29 | 30 | #include 31 | #include 32 | 33 | 34 | 35 | namespace fmtcl 36 | { 37 | 38 | 39 | 40 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 41 | 42 | 43 | 44 | ContFirGauss::ContFirGauss (int taps, double p) 45 | : _taps (taps) 46 | , _p (fstb::limit (p, 1.0, 100.0) / 10) 47 | { 48 | assert (taps >= 1); 49 | assert (taps <= 128); 50 | } 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | 57 | 58 | double ContFirGauss::do_get_support () const 59 | { 60 | return (_taps); 61 | } 62 | 63 | 64 | 65 | double ContFirGauss::do_get_val (double x) const 66 | { 67 | double val = 0; 68 | if (fabs (x) <= _taps) 69 | { 70 | val = pow (2.0, -_p * x * x); 71 | } 72 | 73 | return (val); 74 | } 75 | 76 | 77 | 78 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 79 | 80 | 81 | 82 | } // namespace fmtcl 83 | 84 | 85 | 86 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 87 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_ContFirGauss_HEADER_INCLUDED) 19 | #define fmtcl_ContFirGauss_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/ContFirInterface.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | class ContFirGauss 40 | : public ContFirInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | explicit ContFirGauss (int taps, double p); 48 | virtual ~ContFirGauss () {} 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | // ContFirInterface 57 | virtual double do_get_support () const; 58 | virtual double do_get_val (double x) const; 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | int _taps; 67 | double _p; 68 | 69 | 70 | 71 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 72 | 73 | private: 74 | 75 | ContFirGauss (); 76 | ContFirGauss (const ContFirGauss &other); 77 | ContFirGauss & operator = (const ContFirGauss &other); 78 | bool operator == (const ContFirGauss &other) const; 79 | bool operator != (const ContFirGauss &other) const; 80 | 81 | }; // class ContFirGauss 82 | 83 | 84 | 85 | } // namespace fmtcl 86 | 87 | 88 | 89 | //#include "fmtcl/ContFirGauss.hpp" 90 | 91 | 92 | 93 | #endif // fmtcl_ContFirGauss_HEADER_INCLUDED 94 | 95 | 96 | 97 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 98 | -------------------------------------------------------------------------------- /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 | #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/ContFirInterface.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | double ContFirInterface::get_support () const 43 | { 44 | const double s = do_get_support (); 45 | assert (s >= 0); 46 | 47 | return (s); 48 | } 49 | 50 | 51 | 52 | double ContFirInterface::get_val (double pos) const 53 | { 54 | return (do_get_val (pos)); 55 | } 56 | 57 | 58 | 59 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 60 | 61 | 62 | 63 | } // namespace fmtcl 64 | 65 | 66 | 67 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 68 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_ContFirInterface_HEADER_INCLUDED) 19 | #define fmtcl_ContFirInterface_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | class ContFirInterface 38 | { 39 | 40 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 41 | 42 | public: 43 | 44 | virtual ~ContFirInterface () {} 45 | 46 | double get_support () const; 47 | double get_val (double pos) const; 48 | 49 | 50 | 51 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 52 | 53 | protected: 54 | 55 | virtual double do_get_support () const = 0; 56 | virtual double do_get_val (double pos) const = 0; 57 | 58 | 59 | 60 | }; // class ContFirInterface 61 | 62 | 63 | 64 | } // namespace fmtcl 65 | 66 | 67 | 68 | //#include "fmtcl/ContFirInterface.hpp" 69 | 70 | 71 | 72 | #endif // fmtcl_ContFirInterface_HEADER_INCLUDED 73 | 74 | 75 | 76 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 77 | -------------------------------------------------------------------------------- /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 | #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/ContFirLanczos.h" 28 | #include "fstb/fnc.h" 29 | 30 | #include 31 | #include 32 | 33 | 34 | 35 | namespace fmtcl 36 | { 37 | 38 | 39 | 40 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 41 | 42 | 43 | 44 | ContFirLanczos::ContFirLanczos (int taps) 45 | : _taps (taps) 46 | { 47 | assert (taps >= 1); 48 | assert (taps <= 128); 49 | } 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | 56 | 57 | double ContFirLanczos::do_get_support () const 58 | { 59 | return (_taps); 60 | } 61 | 62 | 63 | 64 | double ContFirLanczos::compute_win_coef (double x) const 65 | { 66 | double win = 0; 67 | if (fabs (x) <= _taps) 68 | { 69 | win = compute_win_coef_no_check (x); 70 | } 71 | 72 | return (win); 73 | } 74 | 75 | 76 | 77 | double ContFirLanczos::do_get_val (double x) const 78 | { 79 | double val = 0; 80 | if (fabs (x) <= _taps) 81 | { 82 | const double win = compute_win_coef_no_check (x); 83 | val = fstb::sinc (x) * win; 84 | } 85 | 86 | return (val); 87 | } 88 | 89 | 90 | 91 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 92 | 93 | 94 | 95 | double ContFirLanczos::compute_win_coef_no_check (double x) const 96 | { 97 | const double win = fstb::sinc (x / _taps); 98 | 99 | return (win); 100 | } 101 | 102 | 103 | 104 | } // namespace fmtcl 105 | 106 | 107 | 108 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 109 | -------------------------------------------------------------------------------- /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 | #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/ContFirLinear.h" 28 | 29 | #include 30 | 31 | #include 32 | 33 | 34 | 35 | namespace fmtcl 36 | { 37 | 38 | 39 | 40 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 41 | 42 | 43 | 44 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 45 | 46 | 47 | 48 | double ContFirLinear::do_get_support () const 49 | { 50 | return (1.0); 51 | } 52 | 53 | 54 | 55 | double ContFirLinear::do_get_val (double pos) const 56 | { 57 | return (std::max (1.0 - fabs (pos), 0.0)); 58 | } 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | 65 | 66 | } // namespace fmtcl 67 | 68 | 69 | 70 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_ContFirLinear_HEADER_INCLUDED) 19 | #define fmtcl_ContFirLinear_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/ContFirInterface.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | class ContFirLinear 40 | : public ContFirInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | ContFirLinear () {} 48 | virtual ~ContFirLinear () {} 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | // ContFirInterface 57 | virtual double do_get_support () const; 58 | virtual double do_get_val (double pos) const; 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | 67 | 68 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | 70 | private: 71 | 72 | ContFirLinear (const ContFirLinear &other); 73 | ContFirLinear& operator = (const ContFirLinear &other); 74 | bool operator == (const ContFirLinear &other) const; 75 | bool operator != (const ContFirLinear &other) const; 76 | 77 | }; // class ContFirLinear 78 | 79 | 80 | 81 | } // namespace fmtcl 82 | 83 | 84 | 85 | //#include "fmtcl/ContFirLinear.hpp" 86 | 87 | 88 | 89 | #endif // fmtcl_ContFirLinear_HEADER_INCLUDED 90 | 91 | 92 | 93 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 94 | -------------------------------------------------------------------------------- /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 | #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/ContFirRect.h" 28 | 29 | 30 | 31 | namespace fmtcl 32 | { 33 | 34 | 35 | 36 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 37 | 38 | 39 | 40 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 41 | 42 | 43 | 44 | double ContFirRect::do_get_support () const 45 | { 46 | return (0.5); 47 | } 48 | 49 | 50 | 51 | double ContFirRect::do_get_val (double x) const 52 | { 53 | return ((x >= -0.5 && x < 0.5) ? 1.0 : 0.0); 54 | } 55 | 56 | 57 | 58 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | 61 | 62 | } // namespace fmtcl 63 | 64 | 65 | 66 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_ContFirRect_HEADER_INCLUDED) 19 | #define fmtcl_ContFirRect_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/ContFirInterface.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | class ContFirRect 40 | : public ContFirInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | ContFirRect () {} 48 | virtual ~ContFirRect () {} 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | // ContFirInterface 57 | virtual double do_get_support () const; 58 | virtual double do_get_val (double x) const; 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | 67 | 68 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | 70 | private: 71 | 72 | ContFirRect (const ContFirRect &other); 73 | ContFirRect & operator = (const ContFirRect &other); 74 | bool operator == (const ContFirRect &other) const; 75 | bool operator != (const ContFirRect &other) const; 76 | 77 | }; // class ContFirRect 78 | 79 | 80 | 81 | } // namespace fmtcl 82 | 83 | 84 | 85 | //#include "fmtcl/ContFirRect.hpp" 86 | 87 | 88 | 89 | #endif // fmtcl_ContFirRect_HEADER_INCLUDED 90 | 91 | 92 | 93 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 94 | -------------------------------------------------------------------------------- /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 | #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/ContFirSinc.h" 28 | #include "fstb/fnc.h" 29 | 30 | #include 31 | #include 32 | 33 | 34 | 35 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 36 | 37 | 38 | 39 | namespace fmtcl 40 | { 41 | 42 | 43 | 44 | ContFirSinc::ContFirSinc (int taps) 45 | : _taps (taps) 46 | { 47 | assert (taps >= 1); 48 | assert (taps <= 128); 49 | } 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | 56 | 57 | double ContFirSinc::do_get_support () const 58 | { 59 | return (_taps); 60 | } 61 | 62 | 63 | 64 | double ContFirSinc::do_get_val (double x) const 65 | { 66 | double val = 0; 67 | if (fabs (x) <= _taps) 68 | { 69 | val = fstb::sinc (x); 70 | } 71 | 72 | return (val); 73 | } 74 | 75 | 76 | 77 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 78 | 79 | 80 | 81 | } // namespace fmtcl 82 | 83 | 84 | 85 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 86 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_ContFirSinc_HEADER_INCLUDED) 19 | #define fmtcl_ContFirSinc_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/ContFirInterface.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | class ContFirSinc 40 | : public ContFirInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | explicit ContFirSinc (int taps); 48 | virtual ~ContFirSinc () {} 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | // ContFirInterface 57 | virtual double do_get_support () const; 58 | virtual double do_get_val (double x) const; 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | int _taps; 67 | 68 | 69 | 70 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | 72 | private: 73 | 74 | ContFirSinc (); 75 | ContFirSinc (const ContFirSinc &other); 76 | ContFirSinc & operator = (const ContFirSinc &other); 77 | bool operator == (const ContFirSinc &other) const; 78 | bool operator != (const ContFirSinc &other) const; 79 | 80 | }; // class ContFirSinc 81 | 82 | 83 | 84 | //#include "fmtcl/ContFirSinc.hpp" 85 | 86 | 87 | 88 | } // namespace fmtcl 89 | 90 | 91 | 92 | #endif // fmtcl_ContFirSinc_HEADER_INCLUDED 93 | 94 | 95 | 96 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 97 | -------------------------------------------------------------------------------- /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 | #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 "fstb/def.h" 28 | #include "fmtcl/ContFirSnh.h" 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 38 | 39 | 40 | 41 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 42 | 43 | 44 | 45 | double ContFirSnh::do_get_support () const 46 | { 47 | return (0); 48 | } 49 | 50 | 51 | 52 | double ContFirSnh::do_get_val (double pos) const 53 | { 54 | fstb::unused (pos); 55 | 56 | return (1); 57 | } 58 | 59 | 60 | 61 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 62 | 63 | 64 | 65 | } // namespace fmtcl 66 | 67 | 68 | 69 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 70 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_ContFirSnh_HEADER_INCLUDED) 19 | #define fmtcl_ContFirSnh_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/ContFirInterface.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | class ContFirSnh 40 | : public ContFirInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | ContFirSnh () {} 48 | virtual ~ContFirSnh () {} 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | // ContFirInterface 57 | virtual double do_get_support () const; 58 | virtual double do_get_val (double pos) const; 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | 67 | 68 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | 70 | private: 71 | 72 | ContFirSnh (const ContFirSnh &other); 73 | ContFirSnh & operator = (const ContFirSnh &other); 74 | bool operator == (const ContFirSnh &other) const; 75 | bool operator != (const ContFirSnh &other) const; 76 | 77 | }; // class ContFirSnh 78 | 79 | 80 | 81 | //#include "fmtcl/ContFirSnh.hpp" 82 | 83 | 84 | 85 | } // namespace fmtcl 86 | 87 | 88 | 89 | #endif // fmtcl_ContFirSnh_HEADER_INCLUDED 90 | 91 | 92 | 93 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 94 | -------------------------------------------------------------------------------- /src/fmtcl/ContFirSpline16.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | ContFirSpline16.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 (_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/ContFirSpline16.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 43 | 44 | 45 | 46 | double ContFirSpline16::do_get_support () const 47 | { 48 | return (2.0); 49 | } 50 | 51 | 52 | 53 | double ContFirSpline16::do_get_val (double x) const 54 | { 55 | x = fabs (x); 56 | 57 | double v = 0; 58 | if (x < 1.0) 59 | { 60 | v = (( x - 9.0/5.0) * x - 1.0/5.0 ) * x + 1.0; 61 | } 62 | else if (x < 2.0) 63 | { 64 | x -= 1.0; 65 | v = ((-1.0/3.0 * x + 4.0/5.0) * x - 7.0/15.0) * x; 66 | } 67 | 68 | return (v); 69 | } 70 | 71 | 72 | 73 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 74 | 75 | 76 | 77 | } // namespace fmtcl 78 | 79 | 80 | 81 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 82 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_ContFirSpline16_HEADER_INCLUDED) 19 | #define fmtcl_ContFirSpline16_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/ContFirInterface.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | class ContFirSpline16 40 | : public ContFirInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | ContFirSpline16 () {} 48 | virtual ~ContFirSpline16 () {} 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | // ContFirInterface 57 | virtual double do_get_support () const; 58 | virtual double do_get_val (double x) const; 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | 67 | 68 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | 70 | private: 71 | 72 | ContFirSpline16 (const ContFirSpline16 &other); 73 | ContFirSpline16 & 74 | operator = (const ContFirSpline16 &other); 75 | bool operator == (const ContFirSpline16 &other) const; 76 | bool operator != (const ContFirSpline16 &other) const; 77 | 78 | }; // class ContFirSpline16 79 | 80 | 81 | 82 | } // namespace fmtcl 83 | 84 | 85 | 86 | //#include "fmtcl/ContFirSpline16.hpp" 87 | 88 | 89 | 90 | #endif // fmtcl_ContFirSpline16_HEADER_INCLUDED 91 | 92 | 93 | 94 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 95 | -------------------------------------------------------------------------------- /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 | #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/ContFirSpline36.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 43 | 44 | 45 | 46 | double ContFirSpline36::do_get_support () const 47 | { 48 | return (3.0); 49 | } 50 | 51 | 52 | 53 | double ContFirSpline36::do_get_val (double x) const 54 | { 55 | x = fabs (x); 56 | 57 | double v = 0; 58 | if (x < 1.0) 59 | { 60 | v = ((13.0/11.0 * x - 453.0/209.0) * x - 3.0/209.0) * x + 1.0; 61 | } 62 | else if (x < 2.0) 63 | { 64 | x -= 1.0; 65 | v = ((-6.0/11.0 * x + 270.0/209.0) * x - 156.0/209.0) * x; 66 | } 67 | else if (x < 3.0) 68 | { 69 | x -= 2.0; 70 | v = (( 1.0/11.0 * x - 45.0/209.0) * x + 26.0/209.0) * x; 71 | } 72 | 73 | return (v); 74 | } 75 | 76 | 77 | 78 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 79 | 80 | 81 | 82 | } // namespace fmtcl 83 | 84 | 85 | 86 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 87 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_ContFirSpline36_HEADER_INCLUDED) 19 | #define fmtcl_ContFirSpline36_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/ContFirInterface.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | class ContFirSpline36 40 | : public ContFirInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | ContFirSpline36 () {} 48 | virtual ~ContFirSpline36 () {} 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | // ContFirInterface 57 | virtual double do_get_support () const; 58 | virtual double do_get_val (double x) const; 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | 67 | 68 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | 70 | private: 71 | 72 | ContFirSpline36 (const ContFirSpline36 &other); 73 | ContFirSpline36 & 74 | operator = (const ContFirSpline36 &other); 75 | bool operator == (const ContFirSpline36 &other) const; 76 | bool operator != (const ContFirSpline36 &other) const; 77 | 78 | }; // class ContFirSpline36 79 | 80 | 81 | 82 | //#include "fmtcl/ContFirSpline36.hpp" 83 | 84 | 85 | 86 | } // namespace fmtcl 87 | 88 | 89 | 90 | #endif // fmtcl_ContFirSpline36_HEADER_INCLUDED 91 | 92 | 93 | 94 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 95 | -------------------------------------------------------------------------------- /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 | #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/ContFirSpline64.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 43 | 44 | 45 | 46 | double ContFirSpline64::do_get_support () const 47 | { 48 | return (4.0); 49 | } 50 | 51 | 52 | 53 | double ContFirSpline64::do_get_val (double x) const 54 | { 55 | x = fabs (x); 56 | 57 | double v = 0; 58 | if (x < 1.0) 59 | { 60 | v = (( 49.0/41.0 * x - 6387.0/2911.0) * x - 3.0/2911.0) * x + 1.0; 61 | } 62 | else if (x < 2.0) 63 | { 64 | x -= 1.0; 65 | v = ((-24.0/41.0 * x + 4032.0/2911.0) * x - 2328.0/2911.0) * x; 66 | } 67 | else if (x < 3.0) 68 | { 69 | x -= 2.0; 70 | v = (( 6.0/41.0 * x - 1008.0/2911.0) * x + 582.0/2911.0) * x; 71 | } 72 | else if (x < 4.0) 73 | { 74 | x -= 3.0; 75 | v = ((- 1.0/41.0 * x + 168.0/2911.0) * x - 97.0/2911.0) * x; 76 | } 77 | 78 | return (v); 79 | } 80 | 81 | 82 | 83 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 84 | 85 | 86 | 87 | } // namespace fmtcl 88 | 89 | 90 | 91 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 92 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_ContFirSpline64_HEADER_INCLUDED) 19 | #define fmtcl_ContFirSpline64_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/ContFirInterface.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | class ContFirSpline64 40 | : public ContFirInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | ContFirSpline64 () {} 48 | virtual ~ContFirSpline64 () {} 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | // ContFirInterface 57 | virtual double do_get_support () const; 58 | virtual double do_get_val (double x) const; 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | 67 | 68 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | 70 | private: 71 | 72 | ContFirSpline64 (const ContFirSpline64 &other); 73 | ContFirSpline64 & 74 | operator = (const ContFirSpline64 &other); 75 | bool operator == (const ContFirSpline64 &other) const; 76 | bool operator != (const ContFirSpline64 &other) const; 77 | 78 | }; // class ContFirSpline64 79 | 80 | 81 | 82 | } // namespace fmtcl 83 | 84 | 85 | 86 | //#include "fmtcl/ContFirSpline64.hpp" 87 | 88 | 89 | 90 | #endif // fmtcl_ContFirSpline64_HEADER_INCLUDED 91 | 92 | 93 | 94 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 95 | -------------------------------------------------------------------------------- /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 | #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/Cst.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | constexpr int Cst::_max_nbr_planes; 43 | 44 | constexpr int Cst::_rtv_imin; 45 | constexpr int Cst::_rtv_emax; 46 | constexpr int Cst::_rtv_lum_blk; 47 | constexpr int Cst::_rtv_lum_wht; 48 | constexpr int Cst::_rtv_chr_gry; 49 | constexpr int Cst::_rtv_chr_dep; 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | 56 | 57 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 58 | 59 | 60 | 61 | } // namespace fmtcl 62 | 63 | 64 | 65 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 66 | -------------------------------------------------------------------------------- /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 | #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/DiscreteFirInterface.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | int DiscreteFirInterface::get_len () const 43 | { 44 | const int len = do_get_len (); 45 | assert (len > 0); 46 | assert ((len & 1) == 1); 47 | 48 | return (len); 49 | } 50 | 51 | 52 | 53 | double DiscreteFirInterface::get_ovrspl () const 54 | { 55 | const double ovrspl = do_get_ovrspl (); 56 | assert (ovrspl > 0); 57 | 58 | return (ovrspl); 59 | } 60 | 61 | 62 | 63 | double DiscreteFirInterface::get_val (int pos) const 64 | { 65 | assert (pos >= 0); 66 | assert (pos < do_get_len ()); 67 | 68 | return (do_get_val (pos)); 69 | } 70 | 71 | 72 | 73 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 74 | 75 | 76 | 77 | } // namespace fmtcl 78 | 79 | 80 | 81 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 82 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_DiscreteFirInterface_HEADER_INCLUDED) 19 | #define fmtcl_DiscreteFirInterface_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | class DiscreteFirInterface 38 | { 39 | 40 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 41 | 42 | public: 43 | 44 | virtual ~DiscreteFirInterface () {} 45 | 46 | int get_len () const; 47 | double get_ovrspl () const; 48 | double get_val (int pos) const; 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | virtual int do_get_len () const = 0; 57 | virtual double do_get_ovrspl () const = 0; 58 | virtual double do_get_val (int pos) const = 0; 59 | 60 | 61 | 62 | }; // class DiscreteFirInterface 63 | 64 | 65 | 66 | } // namespace fmtcl 67 | 68 | 69 | 70 | //#include "fmtcl/DiscreteFirInterface.hpp" 71 | 72 | 73 | 74 | #endif // fmtcl_DiscreteFirInterface_HEADER_INCLUDED 75 | 76 | 77 | 78 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 79 | -------------------------------------------------------------------------------- /src/fmtcl/Dither.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleonoreMizo/fmtconv/77f26b9a101bf883868a0401f2e89140f4323579/src/fmtcl/Dither.cpp -------------------------------------------------------------------------------- /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 | #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/ErrDifBuf.h" 28 | 29 | #include 30 | #include 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | 42 | 43 | ErrDifBuf::ErrDifBuf (long width) 44 | : _buf_ptr (0) 45 | ,/*_mem () 46 | ,*/_width (width) 47 | , _stride (_width + MARGIN * 2) 48 | { 49 | assert (width > 0); 50 | const long buf_len = _stride * MAX_DATA_SIZE * NBR_LINES; 51 | _buf_ptr = new uint8_t [buf_len]; 52 | } 53 | 54 | 55 | 56 | ErrDifBuf::~ErrDifBuf () 57 | { 58 | delete [] _buf_ptr; 59 | _buf_ptr = 0; 60 | } 61 | 62 | 63 | 64 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | 67 | 68 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | 70 | 71 | 72 | } // namespace fmtcl 73 | 74 | 75 | 76 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 77 | -------------------------------------------------------------------------------- /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 | #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/ErrDifBufFactory.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | ErrDifBufFactory::ErrDifBufFactory (long width) 43 | : _width (width) 44 | { 45 | assert (width > 0); 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/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/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/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/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 | #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/MatXyz2Lms.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | constexpr Mat3 MatXyz2Lms::_vonkries_std; 43 | constexpr Mat3 MatXyz2Lms::_vonkries_alt; 44 | constexpr Mat3 MatXyz2Lms::_stockman_sharpe; 45 | 46 | constexpr Mat3 MatXyz2Lms::_bradford; 47 | constexpr Mat3 MatXyz2Lms::_ciecam97s; 48 | constexpr Mat3 MatXyz2Lms::_ciecam02; 49 | constexpr Mat3 MatXyz2Lms::_cam16; 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | 56 | 57 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 58 | 59 | 60 | 61 | } // namespace fmtcl 62 | 63 | 64 | 65 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 66 | -------------------------------------------------------------------------------- /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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | // Dst fmt, dst bits, src fmt, src bits 29 | #define fmtcl_Matrix2020CLProc_TO_YUV_SPAN_I(CI) \ 30 | CI (INT8 , 8, INT16 , 16) \ 31 | CI (INT16 , 9, INT16 , 16) \ 32 | CI (INT16 , 10, INT16 , 16) \ 33 | CI (INT16 , 11, INT16 , 16) \ 34 | CI (INT16 , 12, INT16 , 16) \ 35 | CI (INT16 , 14, INT16 , 16) \ 36 | CI (INT16 , 16, INT16 , 16) 37 | 38 | 39 | 40 | // Dst fmt, dst bits, src fmt, src bits 41 | #define fmtcl_Matrix2020CLProc_TO_RGB_SPAN_I(CI) \ 42 | CI (INT16 , 16, INT8 , 8) \ 43 | CI (INT16 , 16, INT16 , 9) \ 44 | CI (INT16 , 16, INT16 , 10) \ 45 | CI (INT16 , 16, INT16 , 11) \ 46 | CI (INT16 , 16, INT16 , 12) \ 47 | CI (INT16 , 16, INT16 , 14) \ 48 | CI (INT16 , 16, INT16 , 16) 49 | 50 | 51 | 52 | #endif // fmtcl_Matrix2020CLProc_macro_HEADER_INCLUDED 53 | 54 | 55 | 56 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 57 | -------------------------------------------------------------------------------- /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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | // Dst fmt, dst bits, src fmt, src bits 29 | #define fmtcl_MatrixProc_SPAN_I(CI) \ 30 | CI (INT8 , 8, INT8 , 8) \ 31 | \ 32 | CI (INT16 , 9, INT8 , 8) \ 33 | CI (INT16 , 9, INT16 , 9) \ 34 | \ 35 | CI (INT16 , 10, INT8 , 8) \ 36 | CI (INT16 , 10, INT16 , 9) \ 37 | CI (INT16 , 10, INT16 , 10) \ 38 | \ 39 | CI (INT16 , 11, INT8 , 8) \ 40 | CI (INT16 , 11, INT16 , 9) \ 41 | CI (INT16 , 11, INT16 , 10) \ 42 | CI (INT16 , 11, INT16 , 11) \ 43 | \ 44 | CI (INT16 , 12, INT8 , 8) \ 45 | CI (INT16 , 12, INT16 , 9) \ 46 | CI (INT16 , 12, INT16 , 10) \ 47 | CI (INT16 , 12, INT16 , 11) \ 48 | CI (INT16 , 12, INT16 , 12) \ 49 | \ 50 | CI (INT16 , 14, INT8 , 8) \ 51 | CI (INT16 , 14, INT16 , 9) \ 52 | CI (INT16 , 14, INT16 , 10) \ 53 | CI (INT16 , 14, INT16 , 11) \ 54 | CI (INT16 , 14, INT16 , 12) \ 55 | CI (INT16 , 14, INT16 , 14) \ 56 | \ 57 | CI (INT16 , 16, INT8 , 8) \ 58 | CI (INT16 , 16, INT16 , 9) \ 59 | CI (INT16 , 16, INT16 , 10) \ 60 | CI (INT16 , 16, INT16 , 11) \ 61 | CI (INT16 , 16, INT16 , 12) \ 62 | CI (INT16 , 16, INT16 , 16) 63 | 64 | 65 | 66 | #endif // fmtcl_MatrixProc_macro_HEADER_INCLUDED 67 | 68 | 69 | 70 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | -------------------------------------------------------------------------------- /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/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/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 | #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/ProcComp3Arg.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | constexpr int ProcComp3Arg::_nbr_planes; 43 | 44 | 45 | 46 | bool ProcComp3Arg::is_valid (bool single_plane_out_flag) const noexcept 47 | { 48 | if (_w <= 0 || _h <= 0) 49 | { 50 | return false; 51 | } 52 | 53 | const int nbr_planes_chk = (single_plane_out_flag) ? 1 : _nbr_planes; 54 | return ( 55 | _dst.is_valid (nbr_planes_chk, _h) 56 | && _src.is_valid (_nbr_planes , _h) 57 | ); 58 | } 59 | 60 | 61 | 62 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | 65 | 66 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 67 | 68 | 69 | 70 | } // namespace fmtcl 71 | 72 | 73 | 74 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 75 | -------------------------------------------------------------------------------- /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/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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | template 38 | class ReadWrapperFlt 39 | { 40 | public: 41 | 42 | template 43 | static fstb_FORCEINLINE void 44 | read (typename SRC::PtrConst::Type ptr, VF &src0, VF &src1, const VI &zero, int /*len*/); 45 | 46 | }; // class ReadWrapperFlt 47 | 48 | template 49 | class ReadWrapperFlt 50 | { 51 | public: 52 | 53 | template 54 | static fstb_FORCEINLINE void 55 | read (typename SRC::PtrConst::Type ptr, VF &src0, VF &src1, const VI &zero, int len); 56 | }; 57 | 58 | 59 | 60 | } // namespace fmtcl 61 | 62 | 63 | 64 | #include "fmtcl/ReadWrapperFlt.hpp" 65 | 66 | 67 | 68 | #endif // fmtcl_ReadWrapperFlt_HEADER_INCLUDED 69 | 70 | 71 | 72 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | -------------------------------------------------------------------------------- /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.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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | template 38 | class ReadWrapperInt 39 | { 40 | public: 41 | 42 | template 43 | static fstb_FORCEINLINE VI 44 | read (const typename SRC::PtrConst::Type &ptr, const VI &zero, const VI &sign_bit, int /*len*/); 45 | 46 | }; // class ReadWrapperInt 47 | 48 | template 49 | class ReadWrapperInt 50 | { 51 | public: 52 | 53 | template 54 | static fstb_FORCEINLINE VI 55 | read (const typename SRC::PtrConst::Type &ptr, const VI &zero, const VI &sign_bit, int len); 56 | 57 | }; 58 | 59 | 60 | 61 | } // namespace fmtcl 62 | 63 | 64 | 65 | #include "fmtcl/ReadWrapperInt.hpp" 66 | 67 | 68 | 69 | #endif // fmtcl_ReadWrapperInt_HEADER_INCLUDED 70 | 71 | 72 | 73 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 74 | -------------------------------------------------------------------------------- /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/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 | #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/ResampleSpecPlane.h" 28 | 29 | #include 30 | 31 | #include 32 | 33 | 34 | 35 | namespace fmtcl 36 | { 37 | 38 | 39 | 40 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 41 | 42 | 43 | 44 | bool ResampleSpecPlane::operator < (const ResampleSpecPlane &other) const 45 | { 46 | return std::tie ( 47 | _src_width, 48 | _src_height, 49 | _dst_width, 50 | _dst_height, 51 | _win_x, 52 | _win_y, 53 | _win_w, 54 | _win_h, 55 | _center_pos_src_h, 56 | _center_pos_src_v, 57 | _center_pos_dst_h, 58 | _center_pos_dst_v, 59 | _kernel_scale_h, 60 | _kernel_scale_v, 61 | _add_cst, 62 | _kernel_hash_h, 63 | _kernel_hash_v 64 | ) < std::tie ( 65 | other._src_width, 66 | other._src_height, 67 | other._dst_width, 68 | other._dst_height, 69 | other._win_x, 70 | other._win_y, 71 | other._win_w, 72 | other._win_h, 73 | other._center_pos_src_h, 74 | other._center_pos_src_v, 75 | other._center_pos_dst_h, 76 | other._center_pos_dst_v, 77 | other._kernel_scale_h, 78 | other._kernel_scale_v, 79 | other._add_cst, 80 | other._kernel_hash_h, 81 | other._kernel_hash_v 82 | ); 83 | } 84 | 85 | 86 | 87 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 88 | 89 | 90 | 91 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 92 | 93 | 94 | 95 | } // namespace fmtcl 96 | 97 | 98 | 99 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 100 | -------------------------------------------------------------------------------- /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 | #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/ResizeData.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | ResizeData::ResizeData (int w, int h) 43 | { 44 | assert (w >= 0); 45 | assert (h >= 0); 46 | 47 | const int sz = w * h; 48 | for (int cnt = 0; cnt < NBR_BUF; ++cnt) 49 | { 50 | _buf_arr [cnt].resize (sz); 51 | } 52 | } 53 | 54 | 55 | 56 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 57 | 58 | 59 | 60 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 61 | 62 | 63 | 64 | } // namespace fmtcl 65 | 66 | 67 | 68 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | -------------------------------------------------------------------------------- /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/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 | #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/ResizeData.h" 28 | #include "fmtcl/ResizeDataFactory.h" 29 | 30 | #include 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | 42 | 43 | ResizeDataFactory::ResizeDataFactory (int w, int h) 44 | : _w (w) 45 | , _h (h) 46 | { 47 | assert (w >= 0); 48 | assert (h >= 0); 49 | } 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | 56 | 57 | ResizeData * ResizeDataFactory::do_create () 58 | { 59 | ResizeData * data_ptr = 0; 60 | try 61 | { 62 | data_ptr = new ResizeData (_w, _h); 63 | } 64 | catch (...) 65 | { 66 | data_ptr = 0; 67 | } 68 | 69 | return (data_ptr); 70 | } 71 | 72 | 73 | 74 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 75 | 76 | 77 | 78 | } // namespace fmtcl 79 | 80 | 81 | 82 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 83 | -------------------------------------------------------------------------------- /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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fstb/def.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | template 40 | class ScalerCopy 41 | { 42 | public: 43 | static fstb_FORCEINLINE bool can_copy (bool copy_flag) 44 | { 45 | fstb::unused (copy_flag); 46 | return (false); 47 | } 48 | static fstb_FORCEINLINE void copy (typename DST::Ptr::Type dst_ptr, typename SRC::PtrConst::Type src_ptr, int width) 49 | { 50 | fstb::unused (dst_ptr, src_ptr, width); 51 | assert (false); 52 | } 53 | }; 54 | 55 | template 56 | class ScalerCopy 57 | { 58 | public: 59 | static fstb_FORCEINLINE bool can_copy (bool copy_flag) 60 | { 61 | return (copy_flag); 62 | } 63 | static fstb_FORCEINLINE void copy (typename DST::Ptr::Type dst_ptr, typename DST::PtrConst::Type src_ptr, int width) 64 | { 65 | DST::Ptr::copy (dst_ptr, src_ptr, width); 66 | } 67 | }; 68 | 69 | 70 | 71 | } // namespace fmtcl 72 | 73 | 74 | 75 | //#include "fmtcl/ScalerCopy.hpp" 76 | 77 | 78 | 79 | #endif // fmtcl_ScalerCopy_HEADER_INCLUDED 80 | 81 | 82 | 83 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 84 | -------------------------------------------------------------------------------- /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 | #if ! defined (fmtcl_SplFmt_HEADER_INCLUDED) 19 | #define fmtcl_SplFmt_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace fmtcl 33 | { 34 | 35 | 36 | 37 | enum SplFmt 38 | { 39 | SplFmt_ILLEGAL = -1, 40 | 41 | SplFmt_FLOAT = 0, 42 | SplFmt_INT16, 43 | SplFmt_INT8, 44 | 45 | SplFmt_NBR_ELT 46 | 47 | }; // enum SplFmt 48 | 49 | 50 | 51 | inline bool SplFmt_is_float (SplFmt fmt); 52 | inline bool SplFmt_is_int (SplFmt fmt); 53 | inline int SplFmt_get_unit_size (SplFmt fmt); 54 | inline int SplFmt_get_data_size (SplFmt fmt); 55 | 56 | 57 | 58 | } // namespace fmtcl 59 | 60 | 61 | 62 | #include "fmtcl/SplFmt.hpp" 63 | 64 | 65 | 66 | #endif // fmtcl_SplFmt_HEADER_INCLUDED 67 | 68 | 69 | 70 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | -------------------------------------------------------------------------------- /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/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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/TransOpInterface.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | class TransOp2084 40 | : public TransOpInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | explicit TransOp2084 (bool inv_flag); 48 | virtual ~TransOp2084 () {} 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | // TransOpInterface 57 | double do_convert (double x) const override; 58 | LinInfo do_get_info () const override; 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | const bool _inv_flag; 67 | 68 | 69 | 70 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | 72 | private: 73 | 74 | TransOp2084 () = delete; 75 | TransOp2084 (const TransOp2084 &other) = delete; 76 | TransOp2084 & operator = (const TransOp2084 &other) = delete; 77 | bool operator == (const TransOp2084 &other) const = delete; 78 | bool operator != (const TransOp2084 &other) const = delete; 79 | 80 | }; // class TransOp2084 81 | 82 | 83 | 84 | } // namespace fmtcl 85 | 86 | 87 | 88 | //#include "fmtcl/TransOp2084.hpp" 89 | 90 | 91 | 92 | #endif // fmtcl_TransOp2084_HEADER_INCLUDED 93 | 94 | 95 | 96 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 97 | -------------------------------------------------------------------------------- /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/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 | #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/TransOpAffine.h" 28 | #include "fstb/fnc.h" 29 | 30 | #include 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 40 | 41 | 42 | 43 | TransOpAffine::TransOpAffine (double a, double b) 44 | : _a (a) 45 | , _b (b) 46 | { 47 | assert (! fstb::is_null (a)); 48 | } 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | 55 | 56 | double TransOpAffine::do_convert (double x) const 57 | { 58 | return x * _a + _b; 59 | } 60 | 61 | 62 | 63 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 64 | 65 | 66 | 67 | } // namespace fmtcl 68 | 69 | 70 | 71 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 72 | -------------------------------------------------------------------------------- /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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/TransOpInterface.h" 31 | 32 | 33 | 34 | namespace fmtcl 35 | { 36 | 37 | 38 | 39 | class TransOpBypass 40 | : public TransOpInterface 41 | { 42 | 43 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 44 | 45 | public: 46 | 47 | TransOpBypass () = default; 48 | virtual ~TransOpBypass () {} 49 | 50 | 51 | 52 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 53 | 54 | protected: 55 | 56 | // TransOpInterface 57 | double do_convert (double x) const override { return x; } 58 | LinInfo do_get_info () const override { return _unbounded; } 59 | 60 | 61 | 62 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | private: 65 | 66 | 67 | 68 | /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 69 | 70 | private: 71 | 72 | TransOpBypass (const TransOpBypass &other) = delete; 73 | TransOpBypass& operator = (const TransOpBypass &other) = delete; 74 | bool operator == (const TransOpBypass &other) const = delete; 75 | bool operator != (const TransOpBypass &other) const = delete; 76 | 77 | }; // class TransOpBypass 78 | 79 | 80 | 81 | } // namespace fmtcl 82 | 83 | 84 | 85 | //#include "fmtcl/TransOpBypass.hpp" 86 | 87 | 88 | 89 | #endif // fmtcl_TransOpBypass_HEADER_INCLUDED 90 | 91 | 92 | 93 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 94 | -------------------------------------------------------------------------------- /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 | #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/TransOpCanonLog.h" 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | 35 | 36 | namespace fmtcl 37 | { 38 | 39 | 40 | 41 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 42 | 43 | 44 | 45 | TransOpCanonLog::TransOpCanonLog (bool inv_flag) 46 | : _inv_flag (inv_flag) 47 | { 48 | // Nothing 49 | } 50 | 51 | 52 | 53 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 54 | 55 | 56 | 57 | // 1.08676 is log peak white, at 8.00903 in linear scale. 58 | double TransOpCanonLog::do_convert (double x) const 59 | { 60 | static constexpr double a = 10.1596; 61 | static constexpr double b = 0.529136; 62 | static constexpr double c = 0.0730597; 63 | 64 | double y = x; 65 | if (_inv_flag) 66 | { 67 | y = (pow (10, (y - c) / b) - 1) / a; 68 | } 69 | else 70 | { 71 | y = b * log10 (std::max (x, -0.0452664) * a + 1) + c; 72 | } 73 | 74 | return y; 75 | } 76 | 77 | 78 | 79 | TransOpInterface::LinInfo TransOpCanonLog::do_get_info () const 80 | { 81 | return { Type::OETF, Range::UNDEF, 8.00903, 1.0, 0.0, 0.0 }; 82 | } 83 | 84 | 85 | 86 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 87 | 88 | 89 | 90 | } // namespace fmtcl 91 | 92 | 93 | 94 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 95 | -------------------------------------------------------------------------------- /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/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/fmtcl/TransOpDaVinci.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpDaVinci.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/TransOpDaVinci.h" 21 | 22 | #include 23 | #include 24 | 25 | 26 | 27 | namespace fmtcl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | TransOpDaVinci::TransOpDaVinci (bool inv_flag) 37 | : _inv_flag (inv_flag) 38 | { 39 | // Nothing 40 | } 41 | 42 | 43 | 44 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 45 | 46 | 47 | 48 | double TransOpDaVinci::do_convert (double x) const 49 | { 50 | double y = x; 51 | 52 | if (_inv_flag) 53 | { 54 | if (x <= _cut_log) 55 | { 56 | y = x / _m; 57 | } 58 | else 59 | { 60 | y = pow (2, x / _c - _b) - _a; 61 | } 62 | } 63 | else 64 | { 65 | if (x <= _cut_lin) 66 | { 67 | y = x * _m; 68 | } 69 | else 70 | { 71 | y = _c * (log2 (x + _a) + _b); 72 | } 73 | } 74 | 75 | return y; 76 | } 77 | 78 | 79 | 80 | TransOpInterface::LinInfo TransOpDaVinci::do_get_info () const 81 | { 82 | return { Type::OETF, Range::UNDEF, 100.0, 1.0, 100.0, 10000.0 }; 83 | } 84 | 85 | 86 | 87 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 88 | 89 | 90 | 91 | constexpr double TransOpDaVinci::_a; 92 | constexpr double TransOpDaVinci::_b; 93 | constexpr double TransOpDaVinci::_c; 94 | constexpr double TransOpDaVinci::_m; 95 | constexpr double TransOpDaVinci::_cut_lin; 96 | constexpr double TransOpDaVinci::_cut_log; 97 | 98 | 99 | 100 | } // namespace fmtcl 101 | 102 | 103 | 104 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 105 | -------------------------------------------------------------------------------- /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 | #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/TransOpInterface.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fmtcl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | constexpr TransOpInterface::LinInfo TransOpInterface::_unbounded; 43 | 44 | 45 | 46 | double TransOpInterface::operator () (double x) const 47 | { 48 | return do_convert (x); 49 | } 50 | 51 | 52 | 53 | TransOpInterface::LinInfo TransOpInterface::get_info () const 54 | { 55 | const auto info = do_get_info (); 56 | 57 | assert (info._vmax >= 1.0); 58 | assert (info._wref > 0); 59 | assert (info._scale_cdm2 >= 0); 60 | assert (info._wpeak_cdm2 >= 0); 61 | 62 | return info; 63 | } 64 | 65 | 66 | 67 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 68 | 69 | 70 | 71 | } // namespace fmtcl 72 | 73 | 74 | 75 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 76 | -------------------------------------------------------------------------------- /src/fmtcl/TransOpLog3G10.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | TransOpLog3G10.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/TransOpLog3G10.h" 21 | 22 | #include 23 | #include 24 | 25 | 26 | 27 | namespace fmtcl 28 | { 29 | 30 | 31 | 32 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 33 | 34 | 35 | 36 | TransOpLog3G10::TransOpLog3G10 (bool inv_flag) 37 | : _inv_flag (inv_flag) 38 | { 39 | // Nothing 40 | } 41 | 42 | 43 | 44 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 45 | 46 | 47 | 48 | double TransOpLog3G10::do_convert (double x) const 49 | { 50 | return (_inv_flag) ? gamma_to_lin (x) : lin_to_gamma (x); 51 | } 52 | 53 | 54 | 55 | TransOpInterface::LinInfo TransOpLog3G10::do_get_info () const 56 | { 57 | const double lin_max = gamma_to_lin (1); 58 | 59 | return { Type::UNDEF, Range::HDR, lin_max, 1.0, 0, 0 }; 60 | } 61 | 62 | 63 | 64 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 65 | 66 | 67 | 68 | double TransOpLog3G10::gamma_to_lin (double x) const noexcept 69 | { 70 | auto y = (x < 0) ? x / _g : (pow (10.0, x / _a) - 1) / _b; 71 | y -= _c; 72 | 73 | return y; 74 | } 75 | 76 | 77 | 78 | double TransOpLog3G10::lin_to_gamma (double x) const noexcept 79 | { 80 | x += _c; 81 | 82 | if (x < 0) 83 | { 84 | return x * _g; 85 | } 86 | return _a * log10 (x * _b + 1); 87 | } 88 | 89 | 90 | 91 | constexpr double TransOpLog3G10::_a; 92 | constexpr double TransOpLog3G10::_b; 93 | constexpr double TransOpLog3G10::_c; 94 | constexpr double TransOpLog3G10::_g; 95 | 96 | 97 | 98 | } // namespace fmtcl 99 | 100 | 101 | 102 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 103 | -------------------------------------------------------------------------------- /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 | #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/TransOpLogTrunc.h" 28 | #include "fstb/fnc.h" 29 | 30 | #include 31 | #include 32 | 33 | 34 | 35 | namespace fmtcl 36 | { 37 | 38 | 39 | 40 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 41 | 42 | 43 | 44 | TransOpLogTrunc::TransOpLogTrunc (bool inv_flag, double alpha, double beta) 45 | : _inv_flag (inv_flag) 46 | , _alpha (alpha) 47 | , _beta (beta) 48 | { 49 | // Nothing 50 | } 51 | 52 | 53 | 54 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 55 | 56 | 57 | 58 | double TransOpLogTrunc::do_convert (double x) const 59 | { 60 | x = fstb::limit (x, 0.0, 1.0); 61 | double y = x; 62 | 63 | if (_inv_flag) 64 | { 65 | y = pow (10, (x - 1) / _alpha); 66 | } 67 | else 68 | { 69 | if (x >= _beta) 70 | { 71 | y = 1 + _alpha * log10 (x); 72 | } 73 | else 74 | { 75 | y = 0; 76 | } 77 | } 78 | 79 | return y; 80 | } 81 | 82 | 83 | 84 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 85 | 86 | 87 | 88 | } // namespace fmtcl 89 | 90 | 91 | 92 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 93 | -------------------------------------------------------------------------------- /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/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 | #if defined (_MSC_VER) 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fmtcl/ColorFamily.h" 31 | #include "fmtcl/ColorSpaceH265.h" 32 | #include "fmtcl/SplFmt.h" 33 | 34 | #include 35 | #include 36 | 37 | 38 | 39 | namespace fmtcl 40 | { 41 | 42 | class Mat4; 43 | class MatrixProc; 44 | class PicFmt; 45 | 46 | 47 | 48 | int compute_plane_width (ColorFamily col_fam, int ss_h, int base_w, int plane_index); 49 | int compute_plane_height (ColorFamily col_fam, int ss_v, int base_h, int plane_index); 50 | bool has_chroma (ColorFamily col_fam); 51 | bool is_chroma_plane (ColorFamily col_fam, int plane_index); 52 | bool is_full_range_default (ColorFamily col_fam); 53 | double compute_pix_scale (const PicFmt &fmt, int plane_index); 54 | double get_pix_min (const PicFmt &fmt, int plane_index); 55 | void compute_fmt_mac_cst (double &gain, double &add_cst, const PicFmt &dst_fmt, const PicFmt &src_fmt, int plane_index); 56 | 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); 57 | template 58 | std::vector conv_str_to_arr (std::string str); 59 | template 60 | T get_arr_elt (const std::vector &v, int pos, const T &def) noexcept; 61 | 62 | 63 | 64 | } // namespace fmtcl 65 | 66 | 67 | 68 | #include "fmtcl/fnc.hpp" 69 | 70 | 71 | 72 | #endif // fmtcl_fnc_HEADER_INCLUDED 73 | 74 | 75 | 76 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 77 | -------------------------------------------------------------------------------- /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 | #if defined (_MSC_VER) 22 | #pragma warning (1 : 4130 4223 4705 4706) 23 | #pragma warning (4 : 4355 4786 4800) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "fstb/ToolsAvx2.h" 31 | 32 | #include 33 | 34 | 35 | 36 | namespace fstb 37 | { 38 | 39 | 40 | 41 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 42 | 43 | 44 | 45 | const ToolsAvx2::VectI32 ToolsAvx2::_zero = { 0, 0, 0, 0, 0, 0, 0, 0 }; 46 | 47 | const ToolsAvx2::VectI32 ToolsAvx2::_c16_8000 = 48 | { 49 | 0x80008000, 0x80008000, 0x80008000, 0x80008000, 50 | 0x80008000, 0x80008000, 0x80008000, 0x80008000 51 | }; 52 | 53 | const ToolsAvx2::VectI32 ToolsAvx2::_c32_00008000 = 54 | { 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000 }; 55 | 56 | const ToolsAvx2::VectI32 ToolsAvx2::_c32_0000ffff = 57 | { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }; 58 | 59 | const ToolsAvx2::VectI32 ToolsAvx2::_mask_abs = 60 | { 61 | 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 62 | 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF 63 | }; 64 | 65 | 66 | 67 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 68 | 69 | 70 | 71 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 72 | 73 | 74 | 75 | } // namespace fstb 76 | 77 | 78 | 79 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 80 | -------------------------------------------------------------------------------- /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 | #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 "ToolsSse2.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace fstb 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | const ToolsSse2::VectI32 ToolsSse2::_zero = { 0, 0, 0, 0 }; 43 | 44 | const ToolsSse2::VectI32 ToolsSse2::_c16_8000 = 45 | { 0x80008000, 0x80008000, 0x80008000, 0x80008000 }; 46 | 47 | const ToolsSse2::VectI32 ToolsSse2::_c32_00008000 = 48 | { 0x8000, 0x8000, 0x8000, 0x8000 }; 49 | 50 | const ToolsSse2::VectI32 ToolsSse2::_c32_0000ffff = 51 | { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF }; 52 | 53 | const ToolsSse2::VectI32 ToolsSse2::_mask_lo64 = 54 | { 0xFFFFFFFF, 0xFFFFFFFF, 0, 0 }; 55 | 56 | const ToolsSse2::VectI32 ToolsSse2::_mask_abs = 57 | { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF }; 58 | 59 | 60 | 61 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 62 | 63 | 64 | 65 | /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 66 | 67 | 68 | 69 | } // namespace fstb 70 | 71 | 72 | 73 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 74 | -------------------------------------------------------------------------------- /src/fstb/fnc_fstb.cpp: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | 3 | fnc.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 | #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 "fstb/fnc.h" 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | 35 | namespace fstb 36 | { 37 | 38 | 39 | 40 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 41 | 42 | 43 | 44 | // Only for ANSI strings. 45 | void conv_to_lower_case (std::string &str) 46 | { 47 | for (std::string::size_type p = 0; p < str.length (); ++p) 48 | { 49 | str [p] = char (tolower (str [p])); 50 | } 51 | } 52 | 53 | 54 | 55 | int snprintf4all (char *out_0, size_t size, const char *format_0, ...) 56 | { 57 | va_list ap; 58 | va_start (ap, format_0); 59 | int cnt = -1; 60 | 61 | #if defined (_MSC_VER) && (_MSC_VER < 1900) 62 | 63 | if (size != 0) 64 | { 65 | cnt = _vsnprintf_s (out_0, size, _TRUNCATE, format_0, ap); 66 | } 67 | if (cnt == -1) 68 | { 69 | cnt = _vscprintf (format_0, ap); 70 | } 71 | 72 | #else 73 | 74 | cnt = vsnprintf (out_0, size, format_0, ap); 75 | 76 | #endif 77 | 78 | va_end (ap); 79 | 80 | return cnt; 81 | } 82 | 83 | 84 | 85 | } // namespace fstb 86 | 87 | 88 | 89 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 90 | -------------------------------------------------------------------------------- /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/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/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 | #if ! defined (vsutl_FrameRefSPtr_HEADER_INCLUDED) 19 | #define vsutl_FrameRefSPtr_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "vsutl/ObjRefSPtr.h" 31 | #include "VapourSynth4.h" 32 | 33 | 34 | 35 | namespace vsutl 36 | { 37 | 38 | 39 | 40 | class FrameRefSPtr_FncWrapper 41 | { 42 | public: 43 | static inline const ::VSFrame * clone (const ::VSAPI &vsapi, const ::VSFrame *f) VS_NOEXCEPT 44 | { 45 | return (*vsapi.addFrameRef) (f); 46 | } 47 | static inline void free (const ::VSAPI &vsapi, const ::VSFrame *f) VS_NOEXCEPT 48 | { 49 | (*vsapi.freeFrame) (f); 50 | } 51 | }; 52 | 53 | typedef ObjRefSPtr < 54 | const ::VSFrame, 55 | FrameRefSPtr_FncWrapper 56 | > FrameRefSPtr; 57 | 58 | 59 | 60 | } // namespace vsutl 61 | 62 | 63 | 64 | //#include "vsutl/FrameRefSPtr.hpp" 65 | 66 | 67 | 68 | #endif // vsutl_FrameRefSPtr_HEADER_INCLUDED 69 | 70 | 71 | 72 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | -------------------------------------------------------------------------------- /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 | #if ! defined (vsutl_FuncRefSPtr_HEADER_INCLUDED) 19 | #define vsutl_FuncRefSPtr_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "vsutl/ObjRefSPtr.h" 31 | #include "VapourSynth4.h" 32 | 33 | 34 | 35 | namespace vsutl 36 | { 37 | 38 | 39 | 40 | class FuncRefSPtr_FncWrapper 41 | { 42 | public: 43 | static inline ::VSFunction * clone (const ::VSAPI &vsapi, ::VSFunction *func) VS_NOEXCEPT 44 | { 45 | return (*vsapi.addFunctionRef) (func); 46 | } 47 | static inline void free (const ::VSAPI &vsapi, ::VSFunction *func) VS_NOEXCEPT 48 | { 49 | (*vsapi.freeFunc) (func); 50 | } 51 | }; 52 | 53 | typedef ObjRefSPtr < 54 | ::VSFunction, 55 | FuncRefSPtr_FncWrapper 56 | > FuncRefSPtr; 57 | 58 | 59 | 60 | } // namespace vsutl 61 | 62 | 63 | 64 | //#include "vsutl/FuncRefSPtr.hpp" 65 | 66 | 67 | 68 | #endif // vsutl_FuncRefSPtr_HEADER_INCLUDED 69 | 70 | 71 | 72 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | -------------------------------------------------------------------------------- /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 | #if ! defined (vsutl_NodeRefSPtr_HEADER_INCLUDED) 19 | #define vsutl_NodeRefSPtr_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "vsutl/ObjRefSPtr.h" 31 | #include "VapourSynth4.h" 32 | 33 | 34 | 35 | namespace vsutl 36 | { 37 | 38 | 39 | 40 | class NodeRefSPtr_FncWrapper 41 | { 42 | public: 43 | static inline ::VSNode * clone (const ::VSAPI &vsapi, ::VSNode *node) VS_NOEXCEPT 44 | { 45 | return (*vsapi.addNodeRef) (node); 46 | } 47 | static inline void free (const ::VSAPI &vsapi, ::VSNode *node) VS_NOEXCEPT 48 | { 49 | (*vsapi.freeNode) (node); 50 | } 51 | }; 52 | 53 | typedef ObjRefSPtr < 54 | ::VSNode, 55 | NodeRefSPtr_FncWrapper 56 | > NodeRefSPtr; 57 | 58 | 59 | 60 | } // namespace vsutl 61 | 62 | 63 | 64 | //#include "vsutl/NodeRefSPtr.hpp" 65 | 66 | 67 | 68 | #endif // vsutl_NodeRefSPtr_HEADER_INCLUDED 69 | 70 | 71 | 72 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 73 | -------------------------------------------------------------------------------- /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 | #if ! defined (vsutl_PlaneProcCbInterface_HEADER_INCLUDED) 19 | #define vsutl_PlaneProcCbInterface_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "vsutl/NodeRefSPtr.h" 31 | 32 | 33 | 34 | struct VSCore; 35 | struct VSFrameContext; 36 | struct VSFrame; 37 | 38 | 39 | 40 | namespace vsutl 41 | { 42 | 43 | 44 | 45 | class PlaneProcCbInterface 46 | { 47 | 48 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 49 | 50 | public: 51 | 52 | virtual ~PlaneProcCbInterface () = default; 53 | 54 | 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); 55 | 56 | 57 | 58 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 59 | 60 | protected: 61 | 62 | 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; 63 | 64 | 65 | 66 | }; // class PlaneProcCbInterface 67 | 68 | 69 | 70 | } // namespace vsutl 71 | 72 | 73 | 74 | //#include "vsutl/PlaneProcCbInterface.hpp" 75 | 76 | 77 | 78 | #endif // vsutl_PlaneProcCbInterface_HEADER_INCLUDED 79 | 80 | 81 | 82 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 83 | -------------------------------------------------------------------------------- /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 | #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 "vsutl/PlaneProcCbInterface.h" 28 | 29 | #include 30 | 31 | 32 | 33 | namespace vsutl 34 | { 35 | 36 | 37 | 38 | /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 39 | 40 | 41 | 42 | 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) 43 | { 44 | assert (n >= 0); 45 | assert (plane_index >= 0); 46 | 47 | return (do_process_plane ( 48 | dst, 49 | n, 50 | plane_index, 51 | frame_data_ptr, 52 | frame_ctx, 53 | core, 54 | src_node1_sptr, 55 | src_node2_sptr, 56 | src_node3_sptr 57 | )); 58 | } 59 | 60 | 61 | 62 | /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 63 | 64 | 65 | 66 | } // namespace vsutl 67 | 68 | 69 | 70 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | -------------------------------------------------------------------------------- /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 | #if ! defined (vsutl_PlaneProcMode_HEADER_INCLUDED) 19 | #define vsutl_PlaneProcMode_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | 31 | 32 | namespace vsutl 33 | { 34 | 35 | 36 | 37 | enum PlaneProcMode 38 | { 39 | PlaneProcMode_FILL = 0, 40 | PlaneProcMode_GARBAGE, 41 | PlaneProcMode_COPY1, 42 | PlaneProcMode_PROCESS, 43 | PlaneProcMode_COPY2, 44 | PlaneProcMode_COPY3, 45 | 46 | PlaneProcMode_NBR_ELT 47 | 48 | }; // class PlaneProcMode 49 | 50 | 51 | 52 | } // namespace vsutl 53 | 54 | 55 | 56 | #endif // vsutl_PlaneProcMode_HEADER_INCLUDED 57 | 58 | 59 | 60 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 61 | -------------------------------------------------------------------------------- /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 | #if ! defined (vsutl_fnc_HEADER_INCLUDED) 19 | #define vsutl_fnc_HEADER_INCLUDED 20 | 21 | #if defined (_MSC_VER) 22 | #pragma once 23 | #pragma warning (4 : 4250) 24 | #endif 25 | 26 | 27 | 28 | /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 29 | 30 | #include "VapourSynth4.h" 31 | 32 | #include 33 | 34 | 35 | 36 | namespace vsutl 37 | { 38 | 39 | 40 | bool is_vs_gray (int cf); 41 | bool is_vs_rgb (int cf); 42 | bool is_vs_yuv (int cf); 43 | bool is_vs_same_colfam (int lhs, int rhs); 44 | 45 | bool is_constant_format (const ::VSVideoInfo &vi); 46 | bool has_chroma (int cf); 47 | bool has_chroma (const ::VSVideoFormat &fmt); 48 | bool is_chroma_plane (const ::VSVideoFormat &fmt, int plane_index); 49 | bool is_full_range_default (const ::VSVideoFormat &fmt); 50 | double compute_pix_scale (const ::VSVideoFormat &fmt, int plane_index, bool full_flag); 51 | double get_pix_min (const ::VSVideoFormat &fmt, int plane_index, bool full_flag); 52 | 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); 53 | int compute_plane_width (const ::VSVideoFormat &fmt, int plane_index, int base_w); 54 | int compute_plane_height (const ::VSVideoFormat &fmt, int plane_index, int base_h); 55 | 56 | 57 | 58 | } // namespace vsutl 59 | 60 | 61 | 62 | //#include "vsutl/fnc.hpp" 63 | 64 | 65 | 66 | #endif // vsutl_fnc_HEADER_INCLUDED 67 | 68 | 69 | 70 | /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ 71 | --------------------------------------------------------------------------------