5 Commits

Author SHA1 Message Date
斑布 3e298925f6 [MetalVideoProcess]: fix export bug. 2020-10-16 14:34:14 +08:00
RenZhu Macro 363816d6ad Add some new transitions.
Erase, Morph, CircleErase...
2020-08-19 10:59:44 +08:00
RenZhu Macro 9d7f65772b Add more video animations. 2020-08-13 10:02:14 +08:00
RenZhu Macro cef6a6188a update readme. 2020-07-29 18:23:36 +08:00
RenZhu Macro 1515f6761b Add new motions
Move up, move right, move left, zoom in ...
2020-07-29 18:19:03 +08:00
79 changed files with 2426 additions and 97 deletions
+1
View File
@@ -12,3 +12,4 @@ Examples/SimpleVideoAnimation/SimpleVIdeoAnimation.xcodeproj/project.xcworkspace
Examples/SimpleVideoAnimation/SimpleVIdeoAnimation.xcodeproj/xcuserdata
Examples/SimpleVideoAnimation/SimpleVideoAnimation.xcworkspace/xcuserdata
Examples/SimpleVideoTransitionSwitch/SimpleVideoTransitionSwitch.xcodeproj/xcuserdata
Examples/SimpleVideoEditor/SimpleVideoEditor.xcodeproj/project.xcworkspace/xcuserdata
@@ -367,7 +367,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = 3BJYKWHMM4;
INFOPLIST_FILE = SimpleFourSquareVideo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -385,7 +385,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = 3BJYKWHMM4;
INFOPLIST_FILE = SimpleFourSquareVideo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
36E063AD2523E25200CCC13B /* PlaygroundVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36E063AC2523E25200CCC13B /* PlaygroundVC.swift */; };
6ADB075A24ADDB0C0010A817 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ADB075924ADDB0C0010A817 /* AppDelegate.swift */; };
6ADB075C24ADDB0C0010A817 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ADB075B24ADDB0C0010A817 /* SceneDelegate.swift */; };
6ADB075E24ADDB0C0010A817 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ADB075D24ADDB0C0010A817 /* ViewController.swift */; };
@@ -51,6 +52,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
36E063AC2523E25200CCC13B /* PlaygroundVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaygroundVC.swift; sourceTree = "<group>"; };
6ADB075624ADDB0C0010A817 /* SimpleRealtimeFilterPlayback.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimpleRealtimeFilterPlayback.app; sourceTree = BUILT_PRODUCTS_DIR; };
6ADB075924ADDB0C0010A817 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
6ADB075B24ADDB0C0010A817 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
@@ -100,6 +102,7 @@
6ADB075924ADDB0C0010A817 /* AppDelegate.swift */,
6ADB075B24ADDB0C0010A817 /* SceneDelegate.swift */,
6ADB075D24ADDB0C0010A817 /* ViewController.swift */,
36E063AC2523E25200CCC13B /* PlaygroundVC.swift */,
6ADB075F24ADDB0C0010A817 /* Main.storyboard */,
6ADB07DB24AED8910010A817 /* 853.mp4 */,
6ADB07D924AED8220010A817 /* cute.mp4 */,
@@ -219,6 +222,7 @@
6ADB075E24ADDB0C0010A817 /* ViewController.swift in Sources */,
6ADB075A24ADDB0C0010A817 /* AppDelegate.swift in Sources */,
6ADB075C24ADDB0C0010A817 /* SceneDelegate.swift in Sources */,
36E063AD2523E25200CCC13B /* PlaygroundVC.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -371,7 +375,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = 3BJYKWHMM4;
INFOPLIST_FILE = SimpleRealtimeFilterPlayback/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -389,7 +393,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = 3BJYKWHMM4;
INFOPLIST_FILE = SimpleRealtimeFilterPlayback/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -1,12 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="omE-bu-A38">
<device id="retina5_9" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="ngz-2E-aVN">
<objects>
<navigationController id="omE-bu-A38" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="d7c-cd-KMe">
<rect key="frame" x="0.0" y="44" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
<segue destination="kKn-PK-K0V" kind="relationship" relationship="rootViewController" id="yse-EQ-xX6"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="daM-ut-0wO" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1237" y="-69"/>
</scene>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
@@ -16,94 +34,95 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Dc5-Dz-opT" customClass="MetalVideoProcessRenderView" customModule="MetalVideoProcess">
<rect key="frame" x="0.0" y="44.000000000000028" width="375" height="468.66666666666674"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<rect key="frame" x="0.0" y="88.000000000000028" width="375" height="468.66666666666674"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="width" secondItem="Dc5-Dz-opT" secondAttribute="height" multiplier="0.8" id="86r-Og-HwX"/>
</constraints>
</view>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="vYk-6H-dKP">
<rect key="frame" x="8" y="517.66666666666663" width="359" height="31"/>
<rect key="frame" x="8" y="561.66666666666663" width="359" height="31"/>
<connections>
<action selector="progressChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="fwh-uk-uYl"/>
</connections>
</slider>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="K6w-Ud-xUK">
<rect key="frame" x="172.66666666666666" y="552.66666666666663" width="30" height="30"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="K6w-Ud-xUK">
<rect key="frame" x="172.66666666666666" y="596.66666666666663" width="30" height="30"/>
<state key="normal" title="Play"/>
<connections>
<action selector="play:" destination="BYZ-38-t0r" eventType="touchUpInside" id="cZ4-2E-l3J"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Blur track1:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ieB-aM-Q6C">
<rect key="frame" x="20" y="663.66666666666663" width="108" height="21"/>
<rect key="frame" x="20" y="707.66666666666663" width="107" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gray video:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Il-25-Tij">
<rect key="frame" x="104" y="709.66666666666663" width="87" height="21"/>
<rect key="frame" x="104" y="753.66666666666663" width="87" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Beauty track1:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9fu-53-ZHp">
<rect key="frame" x="20" y="622.66666666666663" width="109" height="21"/>
<rect key="frame" x="20" y="666.66666666666663" width="109" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="track2:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Y6k-OT-zIp">
<rect key="frame" x="208" y="622.66666666666663" width="54" height="21"/>
<rect key="frame" x="208" y="666.66666666666663" width="54" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="track2:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wCL-xj-Wni">
<rect key="frame" x="207" y="663.66666666666663" width="54" height="21"/>
<rect key="frame" x="206" y="707.66666666666663" width="54" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Lbm-mS-3au">
<rect key="frame" x="139" y="617.66666666666663" width="51" height="31"/>
<rect key="frame" x="139" y="661.66666666666663" width="51" height="31"/>
<connections>
<action selector="filterOn:" destination="BYZ-38-t0r" eventType="valueChanged" id="f2R-IT-cw2"/>
</connections>
</switch>
<switch opaque="NO" tag="1" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="rJO-mU-xYY">
<rect key="frame" x="138" y="658.66666666666663" width="51" height="31"/>
<rect key="frame" x="137" y="702.66666666666663" width="51" height="31"/>
<connections>
<action selector="filterOn:" destination="BYZ-38-t0r" eventType="valueChanged" id="yx1-uC-eEF"/>
</connections>
</switch>
<switch opaque="NO" tag="2" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="eJu-z5-owd">
<rect key="frame" x="272" y="617.66666666666663" width="51" height="31"/>
<rect key="frame" x="272" y="661.66666666666663" width="51" height="31"/>
<connections>
<action selector="filterOn:" destination="BYZ-38-t0r" eventType="valueChanged" id="9Y9-ZR-JFD"/>
</connections>
</switch>
<switch opaque="NO" tag="3" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="Ufa-eY-5ZC">
<rect key="frame" x="271" y="658.66666666666663" width="51" height="31"/>
<rect key="frame" x="270" y="702.66666666666663" width="51" height="31"/>
<connections>
<action selector="filterOn:" destination="BYZ-38-t0r" eventType="valueChanged" id="Bsk-J9-CjP"/>
</connections>
</switch>
<switch opaque="NO" tag="4" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="tbD-8b-LUS">
<rect key="frame" x="201" y="704.66666666666663" width="51" height="31"/>
<rect key="frame" x="201" y="748.66666666666663" width="51" height="31"/>
<connections>
<action selector="filterOn:" destination="BYZ-38-t0r" eventType="valueChanged" id="J3N-K6-5di"/>
</connections>
</switch>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gMy-fV-lJB">
<rect key="frame" x="166.66666666666666" y="587.66666666666663" width="42" height="30"/>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gMy-fV-lJB">
<rect key="frame" x="166.66666666666666" y="631.66666666666663" width="42" height="30"/>
<state key="normal" title="Pause"/>
<connections>
<action selector="pause:" destination="BYZ-38-t0r" eventType="touchUpInside" id="WbY-hn-U3f"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="eJu-z5-owd" firstAttribute="leading" secondItem="Y6k-OT-zIp" secondAttribute="trailing" constant="10" id="0Ih-iu-pAo"/>
<constraint firstItem="Y6k-OT-zIp" firstAttribute="centerY" secondItem="Lbm-mS-3au" secondAttribute="centerY" id="5T7-S9-kXH"/>
@@ -136,8 +155,8 @@
<constraint firstItem="9fu-53-ZHp" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="ynQ-x2-1Fe"/>
<constraint firstItem="eJu-z5-owd" firstAttribute="centerY" secondItem="Y6k-OT-zIp" secondAttribute="centerY" id="z7O-GK-or8"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<navigationItem key="navigationItem" id="INN-Cx-VbS"/>
<connections>
<outlet property="progress" destination="vYk-6H-dKP" id="qNJ-VV-aFL"/>
<outlet property="renderView" destination="Dc5-Dz-opT" id="LzR-68-614"/>
@@ -145,7 +164,111 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="131.8840579710145" y="137.94642857142856"/>
<point key="canvasLocation" x="1065" y="411"/>
</scene>
<!--View Controller-->
<scene sceneID="l41-w0-TrY">
<objects>
<viewController id="kKn-PK-K0V" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Bjp-hz-Fn2">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZjZ-Ux-Ghm">
<rect key="frame" x="148.66666666666666" y="391" width="78" height="30"/>
<state key="normal" title="Playground"/>
<connections>
<segue destination="afR-es-Hbs" kind="show" id="A6B-e2-0n4"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FMM-3O-BgN">
<rect key="frame" x="151" y="431" width="73" height="30"/>
<state key="normal" title="MultiVideo"/>
<connections>
<segue destination="BYZ-38-t0r" kind="show" id="WXt-uP-yZo"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="l6C-up-lB1"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="FMM-3O-BgN" firstAttribute="top" secondItem="ZjZ-Ux-Ghm" secondAttribute="bottom" constant="10" id="3qm-yn-BcB"/>
<constraint firstItem="FMM-3O-BgN" firstAttribute="centerX" secondItem="Bjp-hz-Fn2" secondAttribute="centerX" id="8Km-bN-wp1"/>
<constraint firstItem="ZjZ-Ux-Ghm" firstAttribute="centerX" secondItem="Bjp-hz-Fn2" secondAttribute="centerX" id="8MN-4O-p65"/>
<constraint firstItem="ZjZ-Ux-Ghm" firstAttribute="centerY" secondItem="Bjp-hz-Fn2" secondAttribute="centerY" id="b6n-6P-sux"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="UVZ-3x-Uyx"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="yNO-yo-vzK" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-404" y="-69.458128078817737"/>
</scene>
<!--PlaygroundVC-->
<scene sceneID="5qv-Wk-ccO">
<objects>
<viewController id="afR-es-Hbs" customClass="PlaygroundVC" customModule="SimpleRealtimeFilterPlayback" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="2uZ-cD-AQm">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="T1T-WM-jRk" customClass="MetalVideoProcessRenderView" customModule="MetalVideoProcess">
<rect key="frame" x="0.0" y="88.000000000000028" width="375" height="468.66666666666674"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="width" secondItem="T1T-WM-jRk" secondAttribute="height" multiplier="0.8" id="j6X-Xj-fIT"/>
</constraints>
</view>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="m9P-aS-DOe">
<rect key="frame" x="8" y="561.66666666666663" width="359" height="31"/>
<connections>
<action selector="progressChanged:" destination="afR-es-Hbs" eventType="valueChanged" id="fgH-WE-XlN"/>
</connections>
</slider>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="j6P-6j-YVr">
<rect key="frame" x="172.66666666666666" y="596.66666666666663" width="30" height="30"/>
<state key="normal" title="Play"/>
<connections>
<action selector="play:" destination="afR-es-Hbs" eventType="touchUpInside" id="ruz-mE-tpy"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vAH-WV-nnK">
<rect key="frame" x="166.66666666666666" y="631.66666666666663" width="42" height="30"/>
<state key="normal" title="Pause"/>
<connections>
<action selector="pause:" destination="afR-es-Hbs" eventType="touchUpInside" id="IsH-CI-uaA"/>
</connections>
</button>
</subviews>
<viewLayoutGuide key="safeArea" id="law-Lw-xq9"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="T1T-WM-jRk" firstAttribute="leading" secondItem="law-Lw-xq9" secondAttribute="leading" id="0g4-SY-2dL"/>
<constraint firstItem="j6P-6j-YVr" firstAttribute="top" secondItem="m9P-aS-DOe" secondAttribute="bottom" constant="5" id="50E-VL-Gdw"/>
<constraint firstItem="T1T-WM-jRk" firstAttribute="top" secondItem="law-Lw-xq9" secondAttribute="top" id="5rf-K8-jDy"/>
<constraint firstItem="vAH-WV-nnK" firstAttribute="centerX" secondItem="2uZ-cD-AQm" secondAttribute="centerX" id="5uI-W3-4Qf"/>
<constraint firstItem="m9P-aS-DOe" firstAttribute="leading" secondItem="law-Lw-xq9" secondAttribute="leading" constant="10" id="999-hW-XHL"/>
<constraint firstItem="law-Lw-xq9" firstAttribute="trailing" secondItem="m9P-aS-DOe" secondAttribute="trailing" constant="10" id="Gr4-Q1-U2S"/>
<constraint firstItem="law-Lw-xq9" firstAttribute="trailing" secondItem="T1T-WM-jRk" secondAttribute="trailing" id="IWm-ud-ETw"/>
<constraint firstItem="vAH-WV-nnK" firstAttribute="top" secondItem="j6P-6j-YVr" secondAttribute="bottom" constant="5" id="LQP-Bv-GJ9"/>
<constraint firstItem="m9P-aS-DOe" firstAttribute="top" secondItem="T1T-WM-jRk" secondAttribute="bottom" constant="5" id="S4w-RT-SbR"/>
<constraint firstItem="j6P-6j-YVr" firstAttribute="centerX" secondItem="2uZ-cD-AQm" secondAttribute="centerX" id="XHf-mP-3mo"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="Aqz-co-Lc4"/>
<connections>
<outlet property="progress" destination="m9P-aS-DOe" id="Jjh-H5-Qsf"/>
<outlet property="renderView" destination="T1T-WM-jRk" id="QEN-az-weS"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="6bn-ay-7JA" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1066" y="-263"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
@@ -20,6 +20,8 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>Use</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
@@ -0,0 +1,91 @@
//
// PlaygroundVC.swift
// SimpleRealtimeFilterPlayback
//
// Created by wangrenzhu on 2020/9/30.
// Copyright © 2020 RenZhu Macro. All rights reserved.
//
import UIKit
import AVFoundation
import MetalVideoProcess
class PlaygroundVC: UIViewController {
@IBOutlet weak var renderView: MetalVideoProcessRenderView!
@IBOutlet weak var progress: UISlider!
var grayFilter: MetalVideoProcessLuminance?
var player: MetalVideoProcessPlayer?
override func viewDidLoad() {
super.viewDidLoad()
let asset1 = AVAsset(url: Bundle.main.url(forResource: "853", withExtension: "mp4")!)
let item1 = MetalVideoEditorItem(asset: asset1)
do {
let editor = try MetalVideoEditor(videoItems: [item1],
customVideoCompositorClass: MetalVideoProcessCompositor.self)
let playerItem = editor.buildPlayerItem()
self.progress.maximumValue = Float(playerItem.duration.seconds)
let player = try MetalVideoProcessPlayer(playerItem: playerItem)
let gray = MetalVideoProcessLuminance()
gray.saveUniformSettings(forTimelineRange: CMTimeRange(start: CMTime(seconds: 0.5), duration: CMTime(seconds: 3.0)), trackID: item1.trackID)
gray.isEnable = true
self.grayFilter = gray
player.addTarget(gray, atTargetIndex: nil, trackID: item1.trackID, targetTrackId: 0)
gray --> renderView
player.playerDelegate = self
self.player = player
} catch {
}
}
override func viewDidDisappear(_ animated: Bool) {
self.player?.suspend()
self.player?.dispose()
}
@IBAction func play(_ sender: Any) {
self.player?.play()
}
@IBAction func pause(_ sender: Any) {
self.player?.pause()
}
@IBAction func progressChanged(_ sender: UISlider) {
let value = sender.value
self.player?.seekTo(time: Float64(value))
}
}
extension PlaygroundVC: MetalVideoProcessPlayerDelegate {
func playbackFrameTimeChanged(frameTime time: CMTime, player: AVPlayer) {
DispatchQueue.main.async {
self.progress.value = Float(time.seconds)
}
}
func playEnded(currentPlayer player: AVPlayer) {
}
func finishExport(error: NSError?) {
}
func exportProgressChanged(_ progress: Float) {
}
}
@@ -16,20 +16,55 @@ class NavigateViewController: UIViewController {
var transitionTimeRange = CMTimeRange.init()
let N = 3
let N = 19
private func getTransition(index: Int) -> (titleName: String, transObject: MetalVideoProcessMotion) {
switch index {
case 0:
return (titleName: "向上滑动", transObject: MetalVideoProcessMoveUpMotion())
return (titleName: "渐显", transObject: MetalVideoProcessFadeInMotion())
case 1:
return (titleName: "放大", transObject: MetalVideoProcessMoveInMotion())
return (titleName: "轻微放大", transObject: MetalVideoProcessSlimZoomInMotion())
case 2:
return (titleName: "旋转", transObject: MetalVideoProcessRotateMotion())
return (titleName: "放大", transObject: MetalVideoProcessZoomInMotion())
case 3:
return (titleName: "渐显", transObject: MetalVideoProcessFadeInMotion())
default:
return (titleName: "放大", transObject: MetalVideoProcessMoveInMotion())
return (titleName: "缩小", transObject: MetalVideoProcessZoomOutMotion())
case 4:
return (titleName: "向左滑入", transObject: MetalVideoProcessMoveLeftMotion())
case 5:
return (titleName: "向右滑入", transObject: MetalVideoProcessMoveRightMotion())
case 6:
return (titleName: "向下滑动", transObject: MetalVideoProcessMoveDownMotion())
case 7:
return (titleName: "向上滑动", transObject: MetalVideoProcessMoveUpMotion())
case 8:
return (titleName: "旋转", transObject: MetalVideoProcessRotateMotion())
case 9:
return (titleName: "涡旋旋转", transObject: MetalVideoProcessSwirlMotion())
case 10:
return (titleName: "镜像旋转", transObject: MetalVideoProcessMirrorRotateMotion())
case 11:
return (titleName: "向上旋入", transObject: MetalVideoProcessUpMoveInBlurMotion())
case 12:
return (titleName: "向上旋入II", transObject: MetalVideoProcessUpMoveInBlurIIMotion())
case 13:
return (titleName: "雨刷", transObject: MetalVideoProcessWiperMotion())
case 14:
return (titleName: "摆钟", transObject: MetalVideoProcessPendulumMotion())
case 15:
return (titleName: "向右甩入", transObject: MetalVideoProcessRightDropMotion())
case 16:
return (titleName: "向下甩入", transObject: MetalVideoProcessUpDropMotion())
case 17:
return (titleName: "动感放大", transObject: MetalVideoProcessZoomInBlurMotion())
case 18:
return (titleName: "动感缩小", transObject: MetalVideoProcessZoomOutBlurMotion())
/*
case 15:
return (titleName: "", transObject: MetalVideoProcessRotateInRightMotion())
*/
default:
return (titleName: "放大", transObject: MetalVideoProcessMoveUpMotion())
}
}
private func getButton(index: Int) -> UIButton {
@@ -20,7 +20,7 @@ class ViewController: UIViewController {
var player: MetalVideoProcessPlayer?
var editor: MetalVideoEditor?
public var motionIn: MetalVideoProcessMotion = MetalVideoProcessMoveInMotion()
public var motionIn: MetalVideoProcessMotion = MetalVideoProcessMoveUpMotion()
override func viewDidLoad() {
super.viewDidLoad()
@@ -572,7 +572,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = 3BJYKWHMM4;
INFOPLIST_FILE = SimpleVideoEditor/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -591,7 +591,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = 3BJYKWHMM4;
INFOPLIST_FILE = SimpleVideoEditor/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -136,8 +136,9 @@ extension ViewController: MetalVideoProcessPlayerDelegate {
source --> self.movieWriter!
self.view.isUserInteractionEnabled = false
try? self.player?.startExport()
self.movieWriter?.activateAudioTrack()
self.movieWriter?.startRecording()
try? self.player?.startExport()
}
}
@@ -385,7 +385,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = 3BJYKWHMM4;
INFOPLIST_FILE = SimpleVideoExport/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
@@ -405,7 +405,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = 3BJYKWHMM4;
INFOPLIST_FILE = SimpleVideoExport/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
@@ -118,9 +118,10 @@ class ViewController: UIViewController {
source --> self.movieWriter!
self.view.isUserInteractionEnabled = false
try? self.player?.startExport()
self.movieWriter?.activateAudioTrack()
self.movieWriter?.startRecording()
try? self.player?.startExport()
}
@@ -361,7 +361,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = 3BJYKWHMM4;
INFOPLIST_FILE = SimpleVideoTransition/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
@@ -380,7 +380,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = 3BJYKWHMM4;
INFOPLIST_FILE = SimpleVideoTransition/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
@@ -16,7 +16,7 @@ class NaviViewController: UIViewController {
var transitionTimeRange = CMTimeRange.init()
let N = 7
let N = 14
private func getTransition(index: Int) -> (titleName: String, transObject: MetalVideoProcessTransition) {
switch index {
case 0:
@@ -33,6 +33,18 @@ class NaviViewController: UIViewController {
return (titleName: "燃烧", transObject: MetalVideoProcessBurnTransition())
case 6:
return (titleName: "立方体", transObject: MetalVideoProcessCubeTransition())
case 7:
return (titleName: "向上擦除", transObject: MetalVideoProcessEraseUpTransition())
case 8:
return (titleName: "向左擦除", transObject: MetalVideoProcessEraseLeftTransition())
case 9:
return (titleName: "向右擦除", transObject: MetalVideoProcessEraseRightTransition())
case 10:
return (titleName: "变形", transObject: MetalVideoProcessMorphTransition())
case 11:
return (titleName: "圆形蒙版", transObject: MetalVideoProcessCircleEraseTransition())
case 12:
return (titleName: "上移", transObject: MetalVideoProcessVerticalUpGlitchTransition())
default:
return (titleName: "倒影", transObject: MetalVideoProcessReflectTransition())
}
+186 -10
View File
@@ -7,6 +7,18 @@
objects = {
/* Begin PBXBuildFile section */
6A24CA0724ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24C9FB24ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.metal */; };
6A24CA0824ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24C9FC24ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.metal */; };
6A24CA0924ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24C9FD24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.metal */; };
6A24CA0A24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24C9FE24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.swift */; };
6A24CA0B24ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24C9FF24ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.swift */; };
6A24CA0C24ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0024ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.metal */; };
6A24CA0D24ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0124ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.swift */; };
6A24CA0E24ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0224ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.swift */; };
6A24CA0F24ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0324ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.swift */; };
6A24CA1024ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0424ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.metal */; };
6A24CA1124ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0524ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.swift */; };
6A24CA1224ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6A24CA0624ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.metal */; };
6A3E705924BD9099009A0AC9 /* MetalVideoProcessTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A3E705824BD9099009A0AC9 /* MetalVideoProcessTransition.swift */; };
6A874BC224C594EC00ADFD8A /* MetalVideoProcessMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A874BC124C594EC00ADFD8A /* MetalVideoProcessMotion.swift */; };
6A874BD024C6E1C200ADFD8A /* MetalVideoProcessFadeInMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A874BCF24C6E1C200ADFD8A /* MetalVideoProcessFadeInMotion.swift */; };
@@ -85,6 +97,30 @@
6ADB072A24ADCC250010A817 /* MetalVideoProcessColorFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ADB072724ADCC250010A817 /* MetalVideoProcessColorFilter.swift */; };
6ADB072B24ADCC250010A817 /* MetalVideoProcessColorFilter.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6ADB072824ADCC250010A817 /* MetalVideoProcessColorFilter.metal */; };
6ADB07E124AEDC9B0010A817 /* default.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6ADB07E024AEDC9B0010A817 /* default.metal */; };
AB00F87324D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87124D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.metal */; };
AB00F87424D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87224D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.swift */; };
AB00F87724D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87524D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.metal */; };
AB00F87824D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87624D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.swift */; };
AB00F87B24D7F45E00413EE8 /* MetalVideoProcessUpDropMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87924D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.metal */; };
AB00F87C24D7F45E00413EE8 /* MetalVideoProcessUpDropMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87A24D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.swift */; };
AB00F87F24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87D24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.metal */; };
AB00F88024D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB00F87E24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.swift */; };
AB4C45D024D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45CE24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.swift */; };
AB4C45D124D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45CF24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.metal */; };
AB4C45D524D0125700315A52 /* MetalVideoProcessSwirlMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45D324D0125700315A52 /* MetalVideoProcessSwirlMotion.swift */; };
AB4C45D624D0125700315A52 /* MetalVideoProcessSwirlMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45D424D0125700315A52 /* MetalVideoProcessSwirlMotion.metal */; };
AB4C45D924D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45D724D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.swift */; };
AB4C45DA24D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45D824D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.metal */; };
AB4C45DD24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45DB24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.metal */; };
AB4C45DE24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45DC24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.swift */; };
AB4C45E124D0208C00315A52 /* MetalVideoProcessMoveRightMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45DF24D0208C00315A52 /* MetalVideoProcessMoveRightMotion.metal */; };
AB4C45E224D0208C00315A52 /* MetalVideoProcessMoveRightMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45E024D0208C00315A52 /* MetalVideoProcessMoveRightMotion.swift */; };
AB4C45E524D0255600315A52 /* MetalVideoProcessMoveDownMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45E324D0255600315A52 /* MetalVideoProcessMoveDownMotion.swift */; };
AB4C45E624D0255600315A52 /* MetalVideoProcessMoveDownMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4C45E424D0255600315A52 /* MetalVideoProcessMoveDownMotion.metal */; };
AB4F025F24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4F025D24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.swift */; };
AB4F026024D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4F025E24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.metal */; };
AB4F026324D7BC4600D0C673 /* MetalVideoProcessWiperMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB4F026124D7BC4600D0C673 /* MetalVideoProcessWiperMotion.metal */; };
AB4F026424D7BC4600D0C673 /* MetalVideoProcessWiperMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB4F026224D7BC4600D0C673 /* MetalVideoProcessWiperMotion.swift */; };
AB59B92924C831D900943BE2 /* MetalVideoProcessCubeTransition.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB59B91B24C831D700943BE2 /* MetalVideoProcessCubeTransition.metal */; };
AB59B92A24C831D900943BE2 /* MetalVideoProcessShanBaiTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB59B91C24C831D700943BE2 /* MetalVideoProcessShanBaiTransition.swift */; };
AB59B92B24C831D900943BE2 /* MetalVideoProcessFadeTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB59B91D24C831D700943BE2 /* MetalVideoProcessFadeTransition.swift */; };
@@ -103,11 +139,31 @@
AB59B94224C921F300943BE2 /* MetalVideoProcessRotateMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94024C921F300943BE2 /* MetalVideoProcessRotateMotion.metal */; };
AB59B94924C9672C00943BE2 /* MetalVideoProcessMoveUpMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94724C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.metal */; };
AB59B94A24C9672C00943BE2 /* MetalVideoProcessMoveUpMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94824C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.swift */; };
AB59B94D24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94B24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.metal */; };
AB59B94E24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94C24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.swift */; };
AB59B94D24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94B24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.metal */; };
AB59B94E24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB59B94C24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.swift */; };
AB603FA424D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB603FA224D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.metal */; };
AB603FA524D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB603FA324D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.swift */; };
AB603FE524D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB603FE324D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.swift */; };
AB603FE624D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB603FE424D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.metal */; };
AB7B931E24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB7B931C24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.metal */; };
AB7B931F24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB7B931D24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.swift */; };
AB7B932224D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.metal in Sources */ = {isa = PBXBuildFile; fileRef = AB7B932024D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.metal */; };
AB7B932324D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB7B932124D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
6A24C9FB24ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessEraseLeftTransition.metal; sourceTree = "<group>"; };
6A24C9FC24ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessVerticalUpGlitchTransition.metal; sourceTree = "<group>"; };
6A24C9FD24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessEraseRightTransition.metal; sourceTree = "<group>"; };
6A24C9FE24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessEraseRightTransition.swift; sourceTree = "<group>"; };
6A24C9FF24ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMorphTransition.swift; sourceTree = "<group>"; };
6A24CA0024ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessEraseUpTransition.metal; sourceTree = "<group>"; };
6A24CA0124ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessVerticalUpGlitchTransition.swift; sourceTree = "<group>"; };
6A24CA0224ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessEraseUpTransition.swift; sourceTree = "<group>"; };
6A24CA0324ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessEraseLeftTransition.swift; sourceTree = "<group>"; };
6A24CA0424ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMorphTransition.metal; sourceTree = "<group>"; };
6A24CA0524ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessCircleEraseTransition.swift; sourceTree = "<group>"; };
6A24CA0624ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessCircleEraseTransition.metal; sourceTree = "<group>"; };
6A3E705824BD9099009A0AC9 /* MetalVideoProcessTransition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessTransition.swift; sourceTree = "<group>"; };
6A874BC124C594EC00ADFD8A /* MetalVideoProcessMotion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMotion.swift; sourceTree = "<group>"; };
6A874BCF24C6E1C200ADFD8A /* MetalVideoProcessFadeInMotion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessFadeInMotion.swift; sourceTree = "<group>"; };
@@ -189,6 +245,30 @@
6ADB072824ADCC250010A817 /* MetalVideoProcessColorFilter.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessColorFilter.metal; sourceTree = "<group>"; };
6ADB07D524AED1260010A817 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
6ADB07E024AEDC9B0010A817 /* default.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = default.metal; sourceTree = "<group>"; };
AB00F87124D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessPendulumMotion.metal; sourceTree = "<group>"; };
AB00F87224D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessPendulumMotion.swift; sourceTree = "<group>"; };
AB00F87524D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessRightDropMotion.metal; sourceTree = "<group>"; };
AB00F87624D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessRightDropMotion.swift; sourceTree = "<group>"; };
AB00F87924D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessUpDropMotion.metal; sourceTree = "<group>"; };
AB00F87A24D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessUpDropMotion.swift; sourceTree = "<group>"; };
AB00F87D24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessZoomInBlurMotion.metal; sourceTree = "<group>"; };
AB00F87E24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessZoomInBlurMotion.swift; sourceTree = "<group>"; };
AB4C45CE24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessRotateInRightMotion.swift; sourceTree = "<group>"; };
AB4C45CF24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessRotateInRightMotion.metal; sourceTree = "<group>"; };
AB4C45D324D0125700315A52 /* MetalVideoProcessSwirlMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessSwirlMotion.swift; sourceTree = "<group>"; };
AB4C45D424D0125700315A52 /* MetalVideoProcessSwirlMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessSwirlMotion.metal; sourceTree = "<group>"; };
AB4C45D724D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessZoomOutMotion.swift; sourceTree = "<group>"; };
AB4C45D824D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessZoomOutMotion.metal; sourceTree = "<group>"; };
AB4C45DB24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMoveLeftMotion.metal; sourceTree = "<group>"; };
AB4C45DC24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMoveLeftMotion.swift; sourceTree = "<group>"; };
AB4C45DF24D0208C00315A52 /* MetalVideoProcessMoveRightMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMoveRightMotion.metal; sourceTree = "<group>"; };
AB4C45E024D0208C00315A52 /* MetalVideoProcessMoveRightMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMoveRightMotion.swift; sourceTree = "<group>"; };
AB4C45E324D0255600315A52 /* MetalVideoProcessMoveDownMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMoveDownMotion.swift; sourceTree = "<group>"; };
AB4C45E424D0255600315A52 /* MetalVideoProcessMoveDownMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMoveDownMotion.metal; sourceTree = "<group>"; };
AB4F025D24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessUpMoveInBlurIIMotion.swift; sourceTree = "<group>"; };
AB4F025E24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessUpMoveInBlurIIMotion.metal; sourceTree = "<group>"; };
AB4F026124D7BC4600D0C673 /* MetalVideoProcessWiperMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessWiperMotion.metal; sourceTree = "<group>"; };
AB4F026224D7BC4600D0C673 /* MetalVideoProcessWiperMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessWiperMotion.swift; sourceTree = "<group>"; };
AB59B91B24C831D700943BE2 /* MetalVideoProcessCubeTransition.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessCubeTransition.metal; sourceTree = "<group>"; };
AB59B91C24C831D700943BE2 /* MetalVideoProcessShanBaiTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessShanBaiTransition.swift; sourceTree = "<group>"; };
AB59B91D24C831D700943BE2 /* MetalVideoProcessFadeTransition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessFadeTransition.swift; sourceTree = "<group>"; };
@@ -207,8 +287,16 @@
AB59B94024C921F300943BE2 /* MetalVideoProcessRotateMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessRotateMotion.metal; sourceTree = "<group>"; };
AB59B94724C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMoveUpMotion.metal; sourceTree = "<group>"; };
AB59B94824C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMoveUpMotion.swift; sourceTree = "<group>"; };
AB59B94B24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMoveInMotion.metal; sourceTree = "<group>"; };
AB59B94C24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMoveInMotion.swift; sourceTree = "<group>"; };
AB59B94B24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessZoomInMotion.metal; sourceTree = "<group>"; };
AB59B94C24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessZoomInMotion.swift; sourceTree = "<group>"; };
AB603FA224D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessSlimZoomInMotion.metal; sourceTree = "<group>"; };
AB603FA324D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessSlimZoomInMotion.swift; sourceTree = "<group>"; };
AB603FE324D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessMirrorRotateMotion.swift; sourceTree = "<group>"; };
AB603FE424D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessMirrorRotateMotion.metal; sourceTree = "<group>"; };
AB7B931C24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessUpMoveInBlurMotion.metal; sourceTree = "<group>"; };
AB7B931D24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessUpMoveInBlurMotion.swift; sourceTree = "<group>"; };
AB7B932024D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.metal */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.metal; path = MetalVideoProcessZoomOutBlurMotion.metal; sourceTree = "<group>"; };
AB7B932124D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MetalVideoProcessZoomOutBlurMotion.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -225,10 +313,42 @@
6A874BCE24C6E10500ADFD8A /* Motions */ = {
isa = PBXGroup;
children = (
AB59B94B24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.metal */,
AB59B94C24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.swift */,
AB7B932024D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.metal */,
AB7B932124D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.swift */,
AB00F87D24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.metal */,
AB00F87E24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.swift */,
AB00F87924D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.metal */,
AB00F87A24D7F45D00413EE8 /* MetalVideoProcessUpDropMotion.swift */,
AB00F87524D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.metal */,
AB00F87624D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.swift */,
AB00F87124D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.metal */,
AB00F87224D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.swift */,
AB4F026124D7BC4600D0C673 /* MetalVideoProcessWiperMotion.metal */,
AB4F026224D7BC4600D0C673 /* MetalVideoProcessWiperMotion.swift */,
AB4F025E24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.metal */,
AB4F025D24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.swift */,
AB603FE424D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.metal */,
AB603FE324D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.swift */,
AB603FA224D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.metal */,
AB603FA324D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.swift */,
AB7B931C24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.metal */,
AB7B931D24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.swift */,
AB4C45E424D0255600315A52 /* MetalVideoProcessMoveDownMotion.metal */,
AB4C45E324D0255600315A52 /* MetalVideoProcessMoveDownMotion.swift */,
AB4C45DF24D0208C00315A52 /* MetalVideoProcessMoveRightMotion.metal */,
AB4C45E024D0208C00315A52 /* MetalVideoProcessMoveRightMotion.swift */,
AB4C45DB24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.metal */,
AB4C45DC24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.swift */,
AB59B94724C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.metal */,
AB59B94824C9672B00943BE2 /* MetalVideoProcessMoveUpMotion.swift */,
AB4C45D824D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.metal */,
AB4C45D724D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.swift */,
AB4C45D424D0125700315A52 /* MetalVideoProcessSwirlMotion.metal */,
AB4C45D324D0125700315A52 /* MetalVideoProcessSwirlMotion.swift */,
AB4C45CF24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.metal */,
AB4C45CE24D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.swift */,
AB59B94B24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.metal */,
AB59B94C24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.swift */,
AB59B94024C921F300943BE2 /* MetalVideoProcessRotateMotion.metal */,
AB59B93F24C921F300943BE2 /* MetalVideoProcessRotateMotion.swift */,
6A874BCF24C6E1C200ADFD8A /* MetalVideoProcessFadeInMotion.swift */,
@@ -487,6 +607,18 @@
AB64835724C03CEA00A0266B /* Transitions */ = {
isa = PBXGroup;
children = (
6A24CA0624ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.metal */,
6A24CA0524ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.swift */,
6A24C9FB24ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.metal */,
6A24CA0324ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.swift */,
6A24C9FD24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.metal */,
6A24C9FE24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.swift */,
6A24CA0024ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.metal */,
6A24CA0224ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.swift */,
6A24CA0424ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.metal */,
6A24C9FF24ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.swift */,
6A24C9FC24ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.metal */,
6A24CA0124ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.swift */,
AB59B91E24C831D800943BE2 /* MetalVideoProcessBurnTransition.metal */,
AB59B92224C831D800943BE2 /* MetalVideoProcessBurnTransition.swift */,
AB59B91B24C831D700943BE2 /* MetalVideoProcessCubeTransition.metal */,
@@ -589,14 +721,20 @@
files = (
6ADB072A24ADCC250010A817 /* MetalVideoProcessColorFilter.swift in Sources */,
6ADB071124ADC4DC0010A817 /* MetalVideoProcessMovieWriter.swift in Sources */,
AB4C45E624D0255600315A52 /* MetalVideoProcessMoveDownMotion.metal in Sources */,
6A24CA1124ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.swift in Sources */,
6ADB06A224ADB3B70010A817 /* CompositionProvider.swift in Sources */,
6ADB06F924ADBE1D0010A817 /* YUVToRGBConversion.metal in Sources */,
AB59B92B24C831D900943BE2 /* MetalVideoProcessFadeTransition.swift in Sources */,
AB00F87824D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.swift in Sources */,
6ADB065E24AD8B7E0010A817 /* MetalRendering.swift in Sources */,
6ADB06B524ADB3B70010A817 /* CMTimeExtensition.swift in Sources */,
AB59B94924C9672C00943BE2 /* MetalVideoProcessMoveUpMotion.metal in Sources */,
AB4C45D024D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.swift in Sources */,
6ADB06B024ADB3B70010A817 /* AVAssetReverseImageResource.swift in Sources */,
6ADB070524ADC4100010A817 /* PictureOutput.swift in Sources */,
AB4C45DE24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.swift in Sources */,
AB4C45D624D0125700315A52 /* MetalVideoProcessSwirlMotion.metal in Sources */,
6A874BD424C6F98100ADFD8A /* MetalVideoProcessFadeMotion.metal in Sources */,
6ADB070F24ADC4DC0010A817 /* MetalVideoProcessPlayer.swift in Sources */,
6ADB06AE24ADB3B70010A817 /* Resource.swift in Sources */,
@@ -607,29 +745,42 @@
6ADB066C24AD8B7E0010A817 /* ImageOrientation.swift in Sources */,
AB59B93524C831D900943BE2 /* MetalVideoProcessEraseDownTransition.swift in Sources */,
6ADB069E24ADB3B70010A817 /* AudioMixer.swift in Sources */,
AB59B94E24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.swift in Sources */,
6A24CA1224ECCC4600F9D8BC /* MetalVideoProcessCircleEraseTransition.metal in Sources */,
AB59B94E24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.swift in Sources */,
6ADB071824ADC4F80010A817 /* MetalVideoProcessTransformFilter.metal in Sources */,
AB59B93124C831D900943BE2 /* MetalVideoProcessEraseDownTransition.metal in Sources */,
AB00F87724D7EFBC00413EE8 /* MetalVideoProcessRightDropMotion.metal in Sources */,
AB59B93424C831D900943BE2 /* MetalVideoProcessReflectTransition.metal in Sources */,
AB59B92A24C831D900943BE2 /* MetalVideoProcessShanBaiTransition.swift in Sources */,
6ADB065824AD8B7E0010A817 /* Color.swift in Sources */,
AB00F87F24D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.metal in Sources */,
6ADB06A324ADB3B70010A817 /* AudioTransition.swift in Sources */,
AB00F87324D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.metal in Sources */,
AB59B93624C831D900943BE2 /* MetalVideoProcessCubeTransition.swift in Sources */,
AB7B931F24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.swift in Sources */,
AB00F87C24D7F45E00413EE8 /* MetalVideoProcessUpDropMotion.swift in Sources */,
6ADB069C24ADB3B70010A817 /* CompositionGenerator.swift in Sources */,
6ADB06EF24ADBBDA0010A817 /* SolidColorGenerator.swift in Sources */,
6A24CA0824ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.metal in Sources */,
AB59B94124C921F300943BE2 /* MetalVideoProcessRotateMotion.swift in Sources */,
6ADB06AD24ADB3B70010A817 /* AVAssetTrackResource.swift in Sources */,
AB00F87424D7ED4300413EE8 /* MetalVideoProcessPendulumMotion.swift in Sources */,
6ADB066B24AD8B7E0010A817 /* MetalRenderingDevice.swift in Sources */,
6ADB06A124ADB3B70010A817 /* Timeline.swift in Sources */,
6ADB06B324ADB3B70010A817 /* Log.swift in Sources */,
AB4F026324D7BC4600D0C673 /* MetalVideoProcessWiperMotion.metal in Sources */,
6ADB065D24AD8B7E0010A817 /* Size.swift in Sources */,
AB4C45D124D00ED100315A52 /* MetalVideoProcessRotateInRightMotion.metal in Sources */,
6ADB070024ADC1930010A817 /* MetalVideoProcessBlendFilter.metal in Sources */,
6A874BC224C594EC00ADFD8A /* MetalVideoProcessMotion.swift in Sources */,
AB7B932224D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.metal in Sources */,
6ADB06B124ADB3B70010A817 /* CoreImageExtension.swift in Sources */,
AB603FE624D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.metal in Sources */,
6ADB06E024ADB8B80010A817 /* MetalVideoProcessOperation.swift in Sources */,
6ADB071A24ADC4F80010A817 /* MetalVideoProcessBeautyFilter.metal in Sources */,
6ADB06EB24ADBBDA0010A817 /* ImageGenerator.swift in Sources */,
6ADB06B724ADB3B70010A817 /* TimeRangeExtension.swift in Sources */,
AB4C45D524D0125700315A52 /* MetalVideoProcessSwirlMotion.swift in Sources */,
6ADB06CA24ADB55D0010A817 /* MetalVideoEditor.swift in Sources */,
6ADB07E124AEDC9B0010A817 /* default.metal in Sources */,
6ADB06ED24ADBBDA0010A817 /* PictureInput.swift in Sources */,
@@ -641,43 +792,68 @@
6ADB071724ADC4F80010A817 /* MetalVideoProcessBeautyFilter.swift in Sources */,
AB59B93324C831D900943BE2 /* MetalVideoProcessReflectTransition.swift in Sources */,
6ADB06AF24ADB3B70010A817 /* AVAssetReaderImageResource.swift in Sources */,
6A24CA1024ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.metal in Sources */,
6ADB072B24ADCC250010A817 /* MetalVideoProcessColorFilter.metal in Sources */,
6A24CA0C24ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.metal in Sources */,
AB4C45D924D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.swift in Sources */,
6ADB072624ADCC1C0010A817 /* MetalVideoProcessBackground.swift in Sources */,
AB4C45E524D0255600315A52 /* MetalVideoProcessMoveDownMotion.swift in Sources */,
AB59B93024C831D900943BE2 /* MetalVideoProcessBurnTransition.swift in Sources */,
AB7B931E24D15470006D0761 /* MetalVideoProcessUpMoveInBlurMotion.metal in Sources */,
AB603FE524D7AA4A008BF603 /* MetalVideoProcessMirrorRotateMotion.swift in Sources */,
AB4F026424D7BC4600D0C673 /* MetalVideoProcessWiperMotion.swift in Sources */,
AB603FA524D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.swift in Sources */,
6ADB071D24ADC8750010A817 /* MetalVideoProcessCompositor.swift in Sources */,
6ADB06B424ADB3B70010A817 /* CGMathFunctions.swift in Sources */,
6AA561D324BC57F3004894F7 /* MetalVideoProcessLuminance.metal in Sources */,
6ADB065A24AD8B7E0010A817 /* Matrix.swift in Sources */,
AB603FA424D2AD77008BF603 /* MetalVideoProcessSlimZoomInMotion.metal in Sources */,
6ADB069F24ADB3B70010A817 /* AudioProcessingChain.swift in Sources */,
AB59B92E24C831D900943BE2 /* MetalVideoProcessMirrorRotateTransition.swift in Sources */,
AB59B92F24C831D900943BE2 /* MetalVideoProcessMirrorRotateTransition.metal in Sources */,
AB4F025F24D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.swift in Sources */,
6A24CA0E24ECCC4600F9D8BC /* MetalVideoProcessEraseUpTransition.swift in Sources */,
AB7B932324D1640E006D0761 /* MetalVideoProcessZoomOutBlurMotion.swift in Sources */,
AB59B94A24C9672C00943BE2 /* MetalVideoProcessMoveUpMotion.swift in Sources */,
6A24CA0724ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.metal in Sources */,
6ADB06A424ADB3B70010A817 /* ImageOverlayItem.swift in Sources */,
AB4C45DD24D01E3600315A52 /* MetalVideoProcessMoveLeftMotion.metal in Sources */,
AB59B92C24C831D900943BE2 /* MetalVideoProcessBurnTransition.metal in Sources */,
AB4C45DA24D01B7D00315A52 /* MetalVideoProcessZoomOutMotion.metal in Sources */,
AB4C45E224D0208C00315A52 /* MetalVideoProcessMoveRightMotion.swift in Sources */,
AB00F88024D7F5E900413EE8 /* MetalVideoProcessZoomInBlurMotion.swift in Sources */,
6ADB071924ADC4F80010A817 /* MetalVideoProcessTransformFilter.swift in Sources */,
6ADB06FC24ADBF8F0010A817 /* MetalVideoProcessRenderView.swift in Sources */,
6ADB06AB24ADB3B70010A817 /* ImageResource.swift in Sources */,
6AA561D424BC57F3004894F7 /* MetalVideoProcessLuminance.swift in Sources */,
6ADB06A724ADB3B70010A817 /* TrackItem.swift in Sources */,
AB59B94D24C96E3100943BE2 /* MetalVideoProcessMoveInMotion.metal in Sources */,
AB59B94D24C96E3100943BE2 /* MetalVideoProcessZoomInMotion.metal in Sources */,
6ADB066924AD8B7E0010A817 /* ShaderUniformSettings.swift in Sources */,
AB59B94224C921F300943BE2 /* MetalVideoProcessRotateMotion.metal in Sources */,
6ADB071024ADC4DC0010A817 /* MetalVideoProcessPlayer+CompositorDelegate.swift in Sources */,
6A24CA0B24ECCC4600F9D8BC /* MetalVideoProcessMorphTransition.swift in Sources */,
6ADB06B224ADB3B70010A817 /* TimingFunctionFactory.swift in Sources */,
AB4F026024D7B20300D0C673 /* MetalVideoProcessUpMoveInBlurIIMotion.metal in Sources */,
6ADB072424ADCBC30010A817 /* MetalVideoProcessGaussianBlurFilter.swift in Sources */,
AB59B92924C831D900943BE2 /* MetalVideoProcessCubeTransition.metal in Sources */,
6ADB070624ADC4100010A817 /* RenderView.swift in Sources */,
6A24CA0924ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.metal in Sources */,
6A24CA0F24ECCC4600F9D8BC /* MetalVideoProcessEraseLeftTransition.swift in Sources */,
6A24CA0A24ECCC4600F9D8BC /* MetalVideoProcessEraseRightTransition.swift in Sources */,
6A24CA0D24ECCC4600F9D8BC /* MetalVideoProcessVerticalUpGlitchTransition.swift in Sources */,
6ADB06F824ADBE1D0010A817 /* YUVToRGBConversion.swift in Sources */,
6ADB069D24ADB3B70010A817 /* AudioProcessingTapHolder.swift in Sources */,
6ADB067024AD8B7E0010A817 /* Position.swift in Sources */,
6ADB06A024ADB3B70010A817 /* VideoTransition.swift in Sources */,
6ADB067124AD8B7E0010A817 /* Texture.swift in Sources */,
6ADB069A24ADB3B70010A817 /* VideoCompositionInstruction.swift in Sources */,
AB00F87B24D7F45E00413EE8 /* MetalVideoProcessUpDropMotion.metal in Sources */,
6ADB072224ADCB2A0010A817 /* MetalVideoProcessFilterGroup.swift in Sources */,
6ADB06AC24ADB3B70010A817 /* PHAssetImageResource.swift in Sources */,
AB59B92D24C831D900943BE2 /* MetalVideoProcessFadeTransition.metal in Sources */,
6ADB066024AD8B7E0010A817 /* Pipeline.swift in Sources */,
6ADB06A924ADB3B70010A817 /* PHAssetLivePhotoResource.swift in Sources */,
AB4C45E124D0208C00315A52 /* MetalVideoProcessMoveRightMotion.metal in Sources */,
AB59B93224C831D900943BE2 /* MetalVideoProcessShanBaiTransition.metal in Sources */,
6A3E705924BD9099009A0AC9 /* MetalVideoProcessTransition.swift in Sources */,
6ADB06FA24ADBE1D0010A817 /* Camera.swift in Sources */,
@@ -814,7 +990,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -841,7 +1017,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = RYRPKMVKDL;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -1,6 +1,7 @@
import Foundation
import AVFoundation
import Metal
import CoreImage
public protocol CameraDelegate {
func didCaptureBuffer(_ sampleBuffer: CMSampleBuffer)
@@ -72,7 +73,10 @@ public class Camera: NSObject, ImageSource, AVCaptureVideoDataOutputSampleBuffer
var supportsFullYUVRange: Bool = false
let captureAsYUV: Bool
let yuvConversionRenderPipelineState: MTLRenderPipelineState?
// let yuvConversionRenderPipelineState: MTLRenderPipelineState?
/// Compute
var yuvConversionComputePipelineState: MTLComputePipelineState?
var yuvLookupTable: [String: (Int, MTLDataType)] = [: ]
let frameRenderingSemaphore = DispatchSemaphore(value: 1)
@@ -110,7 +114,7 @@ public class Camera: NSObject, ImageSource, AVCaptureVideoDataOutputSampleBuffer
self.videoInput = nil
self.videoOutput = nil
self.inputCamera = nil
self.yuvConversionRenderPipelineState = nil
self.yuvConversionComputePipelineState = nil
super.init()
throw CameraError()
}
@@ -121,7 +125,7 @@ public class Camera: NSObject, ImageSource, AVCaptureVideoDataOutputSampleBuffer
} catch {
self.videoInput = nil
self.videoOutput = nil
self.yuvConversionRenderPipelineState = nil
self.yuvConversionComputePipelineState = nil
super.init()
throw error
}
@@ -133,7 +137,12 @@ public class Camera: NSObject, ImageSource, AVCaptureVideoDataOutputSampleBuffer
// Add the video frame output
videoOutput = AVCaptureVideoDataOutput()
videoOutput.alwaysDiscardsLateVideoFrames = false
#if targetEnvironment(simulator)
self.yuvConversionRenderPipelineState = nil
super.init()
#else
if captureAsYUV {
supportsFullYUVRange = false
let supportedPixelFormats = videoOutput.availableVideoPixelFormatTypes
@@ -143,20 +152,20 @@ public class Camera: NSObject, ImageSource, AVCaptureVideoDataOutputSampleBuffer
}
}
if (supportsFullYUVRange) {
let (pipelineState, lookupTable) = generateRenderPipelineState(device: sharedMetalRenderingDevice, vertexFunctionName: "twoInputVertex", fragmentFunctionName: "yuvConversionFullRangeFragment", operationName: "YUVToRGB")
self.yuvConversionRenderPipelineState = pipelineState
let (pipelineState, lookupTable) = generateComputePipelineState(device: sharedMetalRenderingDevice, kernelFunctionName: "yuv2rgb", operationName: "YUVToRGB")
self.yuvLookupTable = lookupTable
self.yuvConversionComputePipelineState = pipelineState
videoOutput.videoSettings = [kCVPixelBufferMetalCompatibilityKey as String: true,
kCVPixelBufferPixelFormatTypeKey as String: NSNumber(value: Int32(kCVPixelFormatType_420YpCbCr8BiPlanarFullRange))]
} else {
let (pipelineState, lookupTable) = generateRenderPipelineState(device: sharedMetalRenderingDevice, vertexFunctionName: "twoInputVertex", fragmentFunctionName: "yuvConversionVideoRangeFragment", operationName: "YUVToRGB")
self.yuvConversionRenderPipelineState = pipelineState
self.yuvLookupTable = lookupTable
videoOutput.videoSettings = [kCVPixelBufferMetalCompatibilityKey as String: true,
kCVPixelBufferPixelFormatTypeKey as String: NSNumber(value: Int32(kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange))]
// let (pipelineState, lookupTable) = generateRenderPipelineState(device: sharedMetalRenderingDevice, vertexFunctionName: "twoInputVertex", fragmentFunctionName: "yuvConversionVideoRangeFragment", operationName: "YUVToRGB")
// self.yuvConversionRenderPipelineState = pipelineState
// self.yuvLookupTable = lookupTable
// videoOutput.videoSettings = [kCVPixelBufferMetalCompatibilityKey as String: true,
// kCVPixelBufferPixelFormatTypeKey as String: NSNumber(value: Int32(kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange))]
}
} else {
self.yuvConversionRenderPipelineState = nil
self.yuvConversionComputePipelineState = nil
videoOutput.videoSettings = [kCVPixelBufferMetalCompatibilityKey as String: true,
kCVPixelBufferPixelFormatTypeKey as String: NSNumber(value: Int32(kCVPixelFormatType_32BGRA))]
}
@@ -173,6 +182,7 @@ public class Camera: NSObject, ImageSource, AVCaptureVideoDataOutputSampleBuffer
let _ = CVMetalTextureCacheCreate(kCFAllocatorDefault, nil, sharedMetalRenderingDevice.device, nil, &videoTextureCache)
videoOutput.setSampleBufferDelegate(self, queue: cameraProcessingQueue)
#endif
}
deinit {
@@ -228,11 +238,16 @@ public class Camera: NSObject, ImageSource, AVCaptureVideoDataOutputSampleBuffer
outputHeight = bufferHeight
}
let outputTexture = Texture(device: sharedMetalRenderingDevice.device, orientation: .portrait, width: outputWidth, height: outputHeight, timingStyle: .videoFrame(timestamp: Timestamp(currentTime)))
convertYUVToRGB(pipelineState: self.yuvConversionRenderPipelineState!, lookupTable: self.yuvLookupTable,
luminanceTexture: Texture(orientation: self.orientation ?? self.location.imageOrientation(), texture: luminanceTexture),
chrominanceTexture: Texture(orientation: self.orientation ?? self.location.imageOrientation(), texture: chrominanceTexture),
resultTexture: outputTexture, colorConversionMatrix: conversionMatrix)
convertYUVtoRGBCompute(pipelineState: self.yuvConversionComputePipelineState!,
lookupTable: self.yuvLookupTable,
luminanceTexture: Texture(orientation: self.orientation ?? self.location.imageOrientation(), texture: luminanceTexture),
chrominanceTexture: Texture(orientation: self.orientation ?? self.location.imageOrientation(), texture: chrominanceTexture),
resultTexture: outputTexture,
colorConversionMatrix: conversionMatrix)
// convertYUVToRGB(pipelineState: self.yuvConversionRenderPipelineState!, lookupTable: self.yuvLookupTable,
// luminanceTexture: Texture(orientation: self.orientation ?? self.location.imageOrientation(), texture: luminanceTexture),
// chrominanceTexture: Texture(orientation: self.orientation ?? self.location.imageOrientation(), texture: chrominanceTexture),
// resultTexture: outputTexture, colorConversionMatrix: conversionMatrix)
texture = outputTexture
} else {
texture = nil
@@ -36,3 +36,22 @@ fragment half4 yuvConversionVideoRangeFragment(TwoInputVertexIO fragmentInput [[
return half4(rgb, 1.0);
}
constant float3 ColorOffsetFullRange = float3(0.0, -0.5, -0.5);
kernel void yuv2rgb(texture2d<float, access::read> y_tex [[ texture(0) ]],
texture2d<float, access::read> uv_tex [[ texture(1) ]],
texture2d<float, access::write> bgr_tex [[ texture(2) ]],
uint2 gid [[thread_position_in_grid]])
{
float3 yuv = float3(y_tex.read(gid).r, uv_tex.read(gid/2).rg) + ColorOffsetFullRange;
const float3x3 kColorConversion601Default = {
{1.164, 1.164, 1.164},
{0.0, -0.392, 2.017},
{1.596, -0.813, 0.0},
};
bgr_tex.write(float4(float3(kColorConversion601Default * yuv), 1.0), gid);
}
@@ -21,6 +21,30 @@ public let colorConversionMatrix709Default = Matrix3x3(rowMajorValues: [
1.793, -0.533, 0.0,
])
public func convertYUVtoRGBCompute(pipelineState: MTLComputePipelineState,
lookupTable: [String:(Int, MTLDataType)],
luminanceTexture: Texture,
chrominanceTexture: Texture,
secondChrominanceTexture: Texture? = nil,
resultTexture: Texture,
colorConversionMatrix: Matrix3x3,
device: MetalRenderingDevice = sharedMetalRenderingDevice) {
guard let commandBuffer = device.commandQueue.makeCommandBuffer() else {return}
let inputTextures: [UInt: Texture]
if let secondChrominanceTexture = secondChrominanceTexture {
inputTextures = [0: luminanceTexture, 1: chrominanceTexture, 2: secondChrominanceTexture]
} else {
inputTextures = [0: luminanceTexture, 1: chrominanceTexture]
}
let inputWidth = resultTexture.texture.width
let inputHeight = resultTexture.texture.height
commandBuffer.computeQuad(pipelineState: pipelineState, uniformSettings: nil, inputTextures: inputTextures, outputTexture: resultTexture, threadGroups: MTLSizeMake(inputWidth / 16, inputHeight / 16, 1))
commandBuffer.commit()
}
public func convertYUVToRGB(pipelineState: MTLRenderPipelineState, lookupTable: [String: (Int, MTLDataType)], luminanceTexture: Texture, chrominanceTexture: Texture, secondChrominanceTexture: Texture? = nil, resultTexture: Texture, colorConversionMatrix: Matrix3x3) {
let uniformSettings = ShaderUniformSettings(uniformLookupTable: lookupTable)
uniformSettings["colorConversionMatrix"] = colorConversionMatrix
@@ -143,7 +143,7 @@ public class MetalVideoProcessBackground: MetalVideoProcessFilterGroup {
}
}
public override init(trackID: Int32) {
public init(trackID: Int32) {
super.init(trackID: trackID)
self.trackID = trackID
@@ -6,11 +6,15 @@
//
import Foundation
import CoreMedia
import Metal
open class MetalVideoProcessFilterGroup: ImageProcessingOperation {
public var debugName: String = ""
public var trackID: Int32 = 0
/// FIlterZero
public var timelineRange: CMTimeRange = CMTimeRange.zero
public var trackID: Int32 = 0 //
public var isEnable: Bool = true
@@ -21,12 +25,36 @@ open class MetalVideoProcessFilterGroup: ImageProcessingOperation {
public var targets: TargetContainer { get { return outputImageRelay.targets } }
public let maximumInputs: UInt = 1
public init(trackID: Int32) {
public func saveUniformSettings(forTimelineRange timeline: CMTimeRange, trackID: Int32) {
self.timelineRange = timeline
self.trackID = trackID
}
public init(trackID: Int32, timelineRange: CMTimeRange = CMTimeRange.zero) {
self.timelineRange = timelineRange
self.trackID = trackID
}
public func checkTimelineRange(with texture: Texture) -> (Bool) {
if self.timelineRange == .zero {
return true
} else {
guard let time = texture.timingStyle.timestamp else {
let seconds = texture.timingStyle.timestamp!.asCMTime.seconds
let cmTime = CMTime(seconds: seconds, preferredTimescale: 1)
return self.timelineRange.containsTime(cmTime) ||
self.timelineRange.end == cmTime
}
return self.timelineRange.containsTime(time.asCMTime) || self.timelineRange.end == time.asCMTime
}
}
open func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
inputImageRelay.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
inputImageRelay.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
public func configureGroup(_ configurationOperation: (_ input: ImageRelay, _ output: ImageRelay) -> ()) {
@@ -145,7 +145,7 @@ public class MetalVideoProcessPlayer: ImageSource {
self.playerItem = playerItem
self.player = AVPlayer(playerItem: self.playerItem)
self.player.volume = 1.0
self.playerItem.add(self.videoOutput)
self.videoOutput.requestNotificationOfMediaDataChange(withAdvanceInterval: 0.1)
@@ -160,6 +160,7 @@ public class MetalVideoProcessPlayer: ImageSource {
self.playbackCompositor = compositor
compositor.delegate = self
self.playerItem.preferredForwardBufferDuration = 0.5
self.seekTo(time: 0.0)
}
public func updatePlayerItem(playerItem: AVPlayerItem) {
@@ -524,9 +525,6 @@ public class MetalVideoProcessPlayer: ImageSource {
self.play()
}
}
}
public func suspend() {
@@ -0,0 +1,46 @@
//
// mirrorRotateMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace mirrorRotateMotion {
typedef struct
{
float factor;
float4 roi;
} MotionUniform;
fragment half4 mirrorRotateMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
float2 uv = fragmentInput.textureCoordinate2;
float2 tempUv = uv;
float curve = uniform.factor;
half4 outCol = half4(0.0);
if (curve < 0.5) {
tempUv = float2((tempUv.x - center.x) * -(1. + curve * 200.0) + center.x, uv.y);
outCol = inputTexture2.sample(quadSampler, tempUv.xy);
} else {
tempUv = float2((tempUv.x - center.x) * (1. + (1.0 - curve) * 200.0) + center.x, uv.y);
outCol = inputTexture2.sample(quadSampler, tempUv.xy);
}
return half4(bgCol.rgb * (1. - outCol.a) + outCol.rgb, outCol.a);
}
}
@@ -0,0 +1,37 @@
//
// MetalVideoProcessMirrorRotateMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessMirrorRotateMotion: MetalVideoProcessMotion {
public init() {
super.init(fragmentFunctionName: "mirrorRotateMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
debugPrint("mirrorRotateMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,38 @@
//
// moveDownMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace moveDownMotion {
typedef struct
{
float factor;
float4 roi;
} MotionUniform;
fragment half4 moveDownMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 uv = fragmentInput.textureCoordinate2;
half4 fgCol = inputTexture2.sample(quadSampler, uv + float2(0.0, uniform.roi.a) - float2(0.0, uniform.roi.a * uniform.factor));
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,36 @@
//
// MetalVideoProcessMoveDownMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessMoveDownMotion: MetalVideoProcessMotion {
public init() {
super.init(fragmentFunctionName: "moveDownMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .quadraticEaseIn
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
debugPrint("moveUpMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,38 @@
//
// rotateMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace moveLeftMotion {
typedef struct
{
float factor;
float4 roi;
} MotionUniform;
fragment half4 moveLeftMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 uv = fragmentInput.textureCoordinate2;
half4 fgCol = inputTexture2.sample(quadSampler, uv - float2(uniform.roi.b, 0.0) + float2(uniform.roi.b * uniform.factor, 0.0));
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,36 @@
//
// MetalVideoProcessMoveLeftMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessMoveLeftMotion: MetalVideoProcessMotion {
public init() {
super.init(fragmentFunctionName: "moveLeftMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
debugPrint("moveLeftMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,38 @@
//
// moveRightMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace moveRightMotion {
typedef struct
{
float factor;
float4 roi;
} MotionUniform;
fragment half4 moveRightMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 uv = fragmentInput.textureCoordinate2;
half4 fgCol = inputTexture2.sample(quadSampler, uv + float2(uniform.roi.b, 0.0) - float2(uniform.roi.b * uniform.factor, 0.0));
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,36 @@
//
// MetalVideoProcessMoveRightMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessMoveRightMotion: MetalVideoProcessMotion {
public init() {
super.init(fragmentFunctionName: "moveRightMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
debugPrint("moveLeftMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -29,9 +29,9 @@ namespace moveUpMotion {
float2 uv = fragmentInput.textureCoordinate2;
half4 fgCol = inputTexture2.sample(quadSampler, uv - float2(0.0, uniform.roi.b) + float2(0.0, uniform.roi.b * uniform.factor));
half4 fgCol = inputTexture2.sample(quadSampler, uv - float2(0.0, uniform.roi.a) + float2(0.0, uniform.roi.a * uniform.factor));
return half4(mix(bgCol.rgb, fgCol.rgb, fgCol.a), fgCol.a);
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,53 @@
//
// pendulumMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
#define PI 3.1415926
namespace pendulumMotion {
typedef struct
{
float factor;
float4 roi;
float2 iResolution;
} MotionUniform;
fragment half4 pendulumMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g);
float time = sin(uniform.factor * PI * 6.0) * exp(-uniform.factor);
float2 uv = fragmentInput.textureCoordinate2;
float rotCorner = time * 1.5707963;
float2 rot = float2(cos(rotCorner), sin(rotCorner));
uv = (uv - center) * uniform.iResolution;
uv = float2(rot.x * uv.x + rot.y * uv.y, -rot.y * uv.x + rot.x * uv.y);
uv = uv / uniform.iResolution + center;
float2 dir = float2(uv - center) * 0.5 * time;
dir = -float2(rot.x * dir.x + rot.y * dir.y, -rot.y * dir.x + rot.x * dir.y) * 0.6;
half4 fgCol = half4(0.0);
for(float i = 0.0; i < 1.0; i = i + 0.1) {
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
}
fgCol /= 10.0;
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,46 @@
//
// MetalVideoProcessPendulumMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessPendulumMotion: MetalVideoProcessMotion {
var iResolution: Position {
set {
uniformSettings["iResolution"] = newValue
}
get {
return uniformSettings["iResolution"]
}
}
public init() {
super.init(fragmentFunctionName: "pendulumMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
debugPrint("pendulumMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,45 @@
//
// pendulumMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
#define PI 3.1415926
namespace rightDropMotion {
typedef struct
{
float factor;
float4 roi;
float2 iResolution;
} MotionUniform;
fragment half4 rightDropMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g);
float time = cos(uniform.factor * PI * 2.5) * exp(-uniform.factor);
float2 uv = fragmentInput.textureCoordinate2 + float2(0.5, 0.0) * time;
float2 dir = float2(0.1, 0.0) * time;
half4 fgCol = half4(0.0);
for(float i = 0.0; i < 1.0; i = i + 0.1) {
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
}
fgCol /= 10.0;
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,46 @@
//
// MetalVideoProcessRightDropMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessRightDropMotion: MetalVideoProcessMotion {
var iResolution: Position {
set {
uniformSettings["iResolution"] = newValue
}
get {
return uniformSettings["iResolution"]
}
}
public init() {
super.init(fragmentFunctionName: "rightDropMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
debugPrint("rightDropMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,48 @@
//
// rotateMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace rotateInRightMotion {
typedef struct
{
float factor;
float4 roi;
float2 iResolution;
} MotionUniform;
fragment half4 rotateInRightMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 uv = fragmentInput.textureCoordinate2;
float rotCorner = -(1. - uniform.factor) * 1.5707963;
float2 rot = float2(cos(rotCorner), sin(rotCorner));
uv = (uv - center + float2(uniform.roi.b * (1.0 - uniform.factor), 0.0)) * uniform.iResolution;
uv = float2(rot.x * uv.x + rot.y * uv.y, -rot.y * uv.x + rot.x * uv.y);
uv = uv / uniform.iResolution + center;
half4 fgCol = inputTexture2.sample(quadSampler, uv);
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,46 @@
//
// MetalVideoProcessRotateMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessRotateInRightMotion: MetalVideoProcessMotion {
var iResolution: Position {
set {
uniformSettings["iResolution"] = newValue
}
get {
return uniformSettings["iResolution"]
}
}
public init() {
super.init(fragmentFunctionName: "rotateInRightMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .quadraticEaseOut
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
debugPrint("rotateMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -41,7 +41,7 @@ namespace rotateMotion {
half4 fgCol = inputTexture2.sample(quadSampler, uv);
return half4(mix(bgCol.rgb, fgCol.rgb, fgCol.a), fgCol.a);
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,36 @@
//
// slimZoomInMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace slimZoomInMotion {
typedef struct
{
float factor;
float4 roi;
} MotionUniform;
fragment half4 slimZoomInMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
float2 uv = fragmentInput.textureCoordinate2;
half4 fgCol = inputTexture2.sample(quadSampler, (uv - center) * (1.2 - uniform.factor * 0.2) + center);
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,37 @@
//
// MetalVideoProcessSlimZoomInMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessSlimZoomInMotion: MetalVideoProcessMotion {
public init() {
super.init(fragmentFunctionName: "slimZoomInMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .quadraticEaseIn
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
debugPrint("slimZoomInMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,47 @@
//
// swirlMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace swirlMotion {
typedef struct
{
float factor;
float4 roi;
float2 iResolution;
} MotionUniform;
fragment half4 swirlMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 uv = fragmentInput.textureCoordinate2;
float2 tempUv = uv - center;
float theta = atan2(tempUv.y, tempUv.x);
float r = length(tempUv);
theta = theta + r * 20.0 * (1. - uniform.factor);
uv = float2(r * cos(theta), r * sin(theta)) + center;
half4 fgCol = inputTexture2.sample(quadSampler, uv);
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,46 @@
//
// MetalVideoProcessSwirlMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessSwirlMotion: MetalVideoProcessMotion {
var iResolution: Position {
set {
uniformSettings["iResolution"] = newValue
}
get {
return uniformSettings["iResolution"]
}
}
public init() {
super.init(fragmentFunctionName: "swirlMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .quadraticEaseOut
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
debugPrint("rotateMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,45 @@
//
// pendulumMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
#define PI 3.1415926
namespace upDropMotion {
typedef struct
{
float factor;
float4 roi;
float2 iResolution;
} MotionUniform;
fragment half4 upDropMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g);
float time = cos(uniform.factor * PI * 2.5) * exp(-uniform.factor);
float2 uv = fragmentInput.textureCoordinate2 + float2(0.0, 0.5) * time;
float2 dir = float2(0.0, 0.1) * time;
half4 fgCol = half4(0.0);
for(float i = 0.0; i < 1.0; i = i + 0.1) {
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
}
fgCol /= 10.0;
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,46 @@
//
// MetalVideoProcessUpDropMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessUpDropMotion: MetalVideoProcessMotion {
var iResolution: Position {
set {
uniformSettings["iResolution"] = newValue
}
get {
return uniformSettings["iResolution"]
}
}
public init() {
super.init(fragmentFunctionName: "upDropMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
debugPrint("upDropMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,53 @@
//
// upMoveInBlurIIMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace upMoveInBlurIIMotion {
typedef struct
{
float factor;
float4 roi;
float2 iResolution;
} MotionUniform;
fragment half4 upMoveInBlurIIMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b, uniform.roi.g + uniform.roi.a * 0.5);
float time = uniform.factor;
float2 uv = fragmentInput.textureCoordinate2;
float rotCorner = -(1. - time) * 1.5707963;
float2 rot = float2(cos(rotCorner), sin(rotCorner));
uv = (uv - center) * uniform.iResolution;
uv = float2(rot.x * uv.x + rot.y * uv.y, -rot.y * uv.x + rot.x * uv.y);
uv = uv / uniform.iResolution + center;
float2 dir = float2(uv - center) * 0.5 * (1. - time);
dir = -float2(rot.x * dir.x + rot.y * dir.y, -rot.y * dir.x + rot.x * dir.y) * 0.6;
half4 fgCol = half4(0.0);
for(float i = 0.0; i < 1.0; i = i + 0.1) {
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
}
fgCol /= 10.0;
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,46 @@
//
// MetalVideoProcessUpMoveInBlurIIMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessUpMoveInBlurIIMotion: MetalVideoProcessMotion {
var iResolution: Position {
set {
uniformSettings["iResolution"] = newValue
}
get {
return uniformSettings["iResolution"]
}
}
public init() {
super.init(fragmentFunctionName: "upMoveInBlurIIMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .quadraticEaseOut
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
debugPrint("upMoveInBlurMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,53 @@
//
// upMoveInBlurMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace upMoveInBlurMotion {
typedef struct
{
float factor;
float4 roi;
float2 iResolution;
} MotionUniform;
fragment half4 upMoveInBlurMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.0, uniform.roi.g + uniform.roi.a * 0.5);
float time = clamp(uniform.factor * 2.0, 0.0, 1.0);
float2 uv = fragmentInput.textureCoordinate2;
float rotCorner = (1. - time) * 1.5707963;
float2 rot = float2(cos(rotCorner), sin(rotCorner));
uv = (uv - center) * uniform.iResolution;
uv = float2(rot.x * uv.x + rot.y * uv.y, -rot.y * uv.x + rot.x * uv.y);
uv = uv / uniform.iResolution + center;
float2 dir = float2(uv - center) * 0.5 * (1. - time);
dir = -float2(rot.x * dir.x + rot.y * dir.y, -rot.y * dir.x + rot.x * dir.y) * 0.3;
half4 fgCol = half4(0.0);
for(float i = 0.0; i < 1.0; i = i + 0.1) {
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
}
fgCol /= 10.0;
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,46 @@
//
// MetalVideoProcessUpMoveInBlurMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessUpMoveInBlurMotion: MetalVideoProcessMotion {
var iResolution: Position {
set {
uniformSettings["iResolution"] = newValue
}
get {
return uniformSettings["iResolution"]
}
}
public init() {
super.init(fragmentFunctionName: "upMoveInBlurMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .quadraticEaseOut
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
debugPrint("upMoveInBlurMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,53 @@
//
// upMoveInBlurIIMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
#define PI 3.1415926
namespace wiperMotion {
typedef struct
{
float factor;
float4 roi;
float2 iResolution;
} MotionUniform;
fragment half4 wiperMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a);
float time = sin(uniform.factor * PI * 6.0) * exp(-uniform.factor);
float2 uv = fragmentInput.textureCoordinate2;
float rotCorner = time * 1.5707963;
float2 rot = float2(cos(rotCorner), sin(rotCorner));
uv = (uv - center) * uniform.iResolution;
uv = float2(rot.x * uv.x + rot.y * uv.y, -rot.y * uv.x + rot.x * uv.y);
uv = uv / uniform.iResolution + center;
float2 dir = float2(uv - center) * 0.5 * time;
dir = -float2(rot.x * dir.x + rot.y * dir.y, -rot.y * dir.x + rot.x * dir.y) * 0.6;
half4 fgCol = half4(0.0);
for(float i = 0.0; i < 1.0; i = i + 0.1) {
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
}
fgCol /= 10.0;
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,46 @@
//
// MetalVideoProcessUpMoveInBlurIIMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessWiperMotion: MetalVideoProcessMotion {
var iResolution: Position {
set {
uniformSettings["iResolution"] = newValue
}
get {
return uniformSettings["iResolution"]
}
}
public init() {
super.init(fragmentFunctionName: "wiperMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
debugPrint("wiperMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,48 @@
//
// zoomOutBluMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace zoomInBlurMotion {
typedef struct
{
float factor;
float4 roi;
float2 iResolution;
} MotionUniform;
fragment half4 zoomInBlurMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
float time = clamp(uniform.factor * 2.0, 0.0, 1.0);
float2 uv = fragmentInput.textureCoordinate2;
uv = (uv - center);
uv = uv * (3.0 - 2.0 * uniform.factor) + center;
float2 dir = float2(uv - center) * 0.5 * (1. - time);
half4 fgCol = half4(0.0);
for(float i = 0.0; i < 1.0; i = i + 0.1) {
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
}
fgCol /= 10.0;
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,46 @@
//
// MetalVideoProcessZoomOutBlurMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessZoomInBlurMotion: MetalVideoProcessMotion {
var iResolution: Position {
set {
uniformSettings["iResolution"] = newValue
}
get {
return uniformSettings["iResolution"]
}
}
public init() {
super.init(fragmentFunctionName: "zoomInBlurMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .quadraticEaseOut
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
debugPrint("zoomInBlurMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -10,7 +10,7 @@
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace moveInMotion {
namespace zoomInMotion {
typedef struct
{
float factor;
@@ -18,7 +18,7 @@ namespace moveInMotion {
//float2 iResolution;
} MotionUniform;
fragment half4 moveInMotion(TwoInputVertexIO fragmentInput [[stage_in]],
fragment half4 zoomInMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
@@ -32,7 +32,7 @@ namespace moveInMotion {
half4 fgCol = inputTexture2.sample(quadSampler, (uv - center) * (2. - uniform.factor) + center);
return half4(mix(bgCol.rgb, fgCol.rgb, fgCol.a), fgCol.a);
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -8,10 +8,10 @@
import UIKit
public class MetalVideoProcessMoveInMotion: MetalVideoProcessMotion {
public class MetalVideoProcessZoomInMotion: MetalVideoProcessMotion {
public init() {
super.init(fragmentFunctionName: "moveInMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
super.init(fragmentFunctionName: "zoomInMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .quadraticEaseIn
self.factor = 0.0
}
@@ -0,0 +1,48 @@
//
// zoomOutBluMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace zoomOutBlurMotion {
typedef struct
{
float factor;
float4 roi;
float2 iResolution;
} MotionUniform;
fragment half4 zoomOutBlurMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
float time = clamp(uniform.factor * 2.0, 0.0, 1.0);
float2 uv = fragmentInput.textureCoordinate2;
uv = (uv - center);
uv = uv * (0.4 + 0.6 * uniform.factor) + center;
float2 dir = float2(uv - center) * 0.5 * (1. - time);
half4 fgCol = half4(0.0);
for(float i = 0.0; i < 1.0; i = i + 0.1) {
fgCol += inputTexture2.sample(quadSampler, uv + dir * i);
}
fgCol /= 10.0;
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,46 @@
//
// MetalVideoProcessZoomOutBlurMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessZoomOutBlurMotion: MetalVideoProcessMotion {
var iResolution: Position {
set {
uniformSettings["iResolution"] = newValue
}
get {
return uniformSettings["iResolution"]
}
}
public init() {
super.init(fragmentFunctionName: "zoomOutBlurMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .quadraticEaseOut
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
self.iResolution = Position(Float(texture.texture.width), Float(texture.texture.height))
debugPrint("zoomOutBlurMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -0,0 +1,39 @@
//
// zoomOutMotion.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace zoomOutMotion {
typedef struct
{
float factor;
float4 roi;
//float2 iResolution;
} MotionUniform;
fragment half4 zoomOutMotion(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant MotionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mip_filter::linear, min_filter::linear, mag_filter::linear, address::clamp_to_zero);
half4 bgCol = inputTexture.sample(quadSampler, fragmentInput.textureCoordinate);
float2 center = float2(uniform.roi.r + uniform.roi.b * 0.5, uniform.roi.g + uniform.roi.a * 0.5);
float2 uv = fragmentInput.textureCoordinate2;
half4 fgCol = inputTexture2.sample(quadSampler, (uv - center) * (1. + uniform.factor) + center);
return half4(bgCol.rgb * (1. - fgCol.a) + fgCol.rgb, fgCol.a);
}
}
@@ -0,0 +1,36 @@
//
// MetalVideoProcessZoomOutMotion.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/21.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import UIKit
public class MetalVideoProcessZoomOutMotion: MetalVideoProcessMotion {
public init() {
super.init(fragmentFunctionName: "zoomOutMotion", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .quadraticEaseIn
self.factor = 0.0
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
if let time = texture.timingStyle.timestamp?.asCMTime {
if time < timelineRange.start {
factor = 0.0
}
debugPrint("moveInMotion:", factor, " frameTime:", texture.frameTime)
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
}
}
/// before fade in, we need the texture alpha keep to zero
/// - Parameter texture: texture
/// - Returns: result
public override func checkTimelineRange(with texture: Texture) -> (Bool) {
return true
}
}
@@ -1,5 +1,5 @@
//
// MetalVideoProcessFadeTransition.metal
// MetalVideoProcessBurnTransition.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
@@ -2,8 +2,8 @@
// MetalVideoProcessBurnTransition.swift
// MetalVideoProcess
//
// Created by RenZhu Macro on 2020/7/16.
// Copyright © 2020 RenZhu Macro. All rights reserved.
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import AVFoundation
@@ -0,0 +1,44 @@
//
// MetalVideoProcessCircleEraseTransition.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace morph {
#define vec2 float2
#define vec3 float3
#define vec4 float4
typedef struct
{
float tweenFactor;
float2 iResolution;
} FadeTransitionUniform;
fragment half4 circleErase(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mag_filter:: linear,
min_filter:: linear,
address:: clamp_to_zero);
float progress = uniform.tweenFactor;
float2 uv = fragmentInput.textureCoordinate;
float mProgress = 1.0 - progress;
vec2 resolution = uniform.iResolution;
if(distance(uv * resolution, vec2(0.5,0.5) * resolution) < mProgress * length(resolution) * 0.5)
return inputTexture.sample(quadSampler, uv);
else
return inputTexture2.sample(quadSampler, uv);
}
}
@@ -0,0 +1,25 @@
//
// MetalVideoProcessCircleEraseTransition.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import AVFoundation
public class MetalVideoProcessCircleEraseTransition: MetalVideoProcessTransition {
public var iResolution: Size = Size(width: 1, height: 1) { didSet { uniformSettings["iResolution"] = iResolution } }
public init() {
super.init(fragmentFunctionName: "circleErase", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
iResolution = Size(width: 1, height: 1)
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
self.iResolution = Size(width: Float(texture.texture.width), height: Float(texture.texture.height))
}
}
@@ -1,5 +1,5 @@
//
// MetalVideoProcessFadeTransition.metal
// MetalVideoProcessCubeTransition.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
@@ -1,8 +1,8 @@
//
// MetalVideoProcessBurnTransition.swift
// MetalVideoProcessCubeTransition.swift
// MetalVideoProcess
//
// Created by RenZhu Macro on 2020/7/16.
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 RenZhu Macro. All rights reserved.
//
@@ -1,5 +1,5 @@
//
// MetalVideoProcessFadeTransition.metal
// MetalVideoProcessEraseDownTransition.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
@@ -0,0 +1,37 @@
//
// MetalVideoProcessEraseLeftTransition.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace eraseLeft {
typedef struct
{
float tweenFactor;
} FadeTransitionUniform;
fragment half4 eraseLeft(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mag_filter:: linear,
min_filter:: linear,
address:: clamp_to_zero);
float2 uv = fragmentInput.textureCoordinate;
half4 input0 = inputTexture.sample(quadSampler, uv);
half4 input1 = inputTexture2.sample(quadSampler, uv);
float process = uniform.tweenFactor;
float curve0 = process * process;
float curve1 = 3. * curve0 - 2. * curve0 * process;
return mix(input0, input1, step(1. - uv.x, process));
}
}
@@ -0,0 +1,17 @@
//
// MetalVideoProcessEraseLeftTransition.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import AVFoundation
public class MetalVideoProcessEraseLeftTransition: MetalVideoProcessTransition {
public init() {
super.init(fragmentFunctionName: "eraseLeft", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
}
}
@@ -0,0 +1,37 @@
//
// MetalVideoProcessEraseRightTransition.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace eraseLeft {
typedef struct
{
float tweenFactor;
} FadeTransitionUniform;
fragment half4 eraseRight(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mag_filter:: linear,
min_filter:: linear,
address:: clamp_to_zero);
float2 uv = fragmentInput.textureCoordinate;
half4 input0 = inputTexture.sample(quadSampler, uv);
half4 input1 = inputTexture2.sample(quadSampler, uv);
float process = uniform.tweenFactor;
float curve0 = process * process;
float curve1 = 3. * curve0 - 2. * curve0 * process;
return mix(input0, input1, step(uv.x, process));
}
}
@@ -0,0 +1,17 @@
//
// MetalVideoProcessEraseRightTransition.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import AVFoundation
public class MetalVideoProcessEraseRightTransition: MetalVideoProcessTransition {
public init() {
super.init(fragmentFunctionName: "eraseRight", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
}
}
@@ -0,0 +1,38 @@
//
// MetalVideoProcessEraseUpTransition.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace eraseUp {
typedef struct
{
float tweenFactor;
} FadeTransitionUniform;
fragment half4 eraseUpTransition(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mag_filter:: linear,
min_filter:: linear,
address:: clamp_to_zero);
float2 uv = fragmentInput.textureCoordinate;
half4 input0 = inputTexture.sample(quadSampler, uv);
half4 input1 = inputTexture2.sample(quadSampler, uv);
float process = uniform.tweenFactor;
float curve0 = process * process;
float curve1 = 3. * curve0 - 2. * curve0 * process;
return mix(input0, input1, step(1. - uv.y, process));
}
}
@@ -0,0 +1,17 @@
//
// MetalVideoProcessEraseUpTransition.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import AVFoundation
public class MetalVideoProcessEraseUpTransition: MetalVideoProcessTransition {
public init() {
super.init(fragmentFunctionName: "eraseUpTransition", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
}
}
@@ -2,7 +2,7 @@
// MetalVideoProcessFadeTransition.metal
// MetalVideoProcess
//
// Created by RenZhu Macro on 2020/7/16.
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 RenZhu Macro. All rights reserved.
//
@@ -2,7 +2,7 @@
// MetalVideoProcessFadeTransition.swift
// MetalVideoProcess
//
// Created by RenZhu Macro on 2020/7/16.
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 RenZhu Macro. All rights reserved.
//
@@ -1,5 +1,5 @@
//
// MetalVideoProcessFadeTransition.metal
// MetalVideoProcessMirrorRotateTransition.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
@@ -0,0 +1,50 @@
//
// MetalVideoProcessEraseRightTransition.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace morph {
#define vec2 float2
#define vec3 float3
#define vec4 float4
typedef struct
{
float tweenFactor;
} FadeTransitionUniform;
constant float strength=0.1;
fragment half4 morph(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mag_filter:: linear,
min_filter:: linear,
address:: clamp_to_zero);
float progress = uniform.tweenFactor;
float2 uv = fragmentInput.textureCoordinate;
vec2 p = uv;
vec4 ca = vec4(inputTexture.sample(quadSampler, p));
vec4 cb = vec4(inputTexture2.sample(quadSampler, p));
vec2 oa = (((ca.rg + ca.b) * 0.5) * 2.0 - 1.0);
vec2 ob = (((cb.rg + cb.b) * 0.5) * 2.0 - 1.0);
vec2 oc = mix(oa,ob,0.5) * strength;
// float progress = clamp(timer, 0.0, 1.0);
float w0 = progress;
float w1 = 1.0 - w0;
return mix(inputTexture.sample(quadSampler, p + oc * w0), inputTexture2.sample(quadSampler, p - oc * w1), progress);
}
}
@@ -0,0 +1,17 @@
//
// MetalVideoProcessEraseRightTransition.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import AVFoundation
public class MetalVideoProcessMorphTransition: MetalVideoProcessTransition {
public init() {
super.init(fragmentFunctionName: "morph", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
}
}
@@ -1,5 +1,5 @@
//
// MetalVideoProcessEraseDownTransition.swift
// MetalVideoProcessReflectTransition.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
@@ -0,0 +1,53 @@
//
// MetalVideoProcessVerticalGlitchTransition.metal
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
#include "../../Vender/Render/Base/OperationShaderTypes.h"
namespace morph {
#define vec2 float2
#define vec3 float3
#define vec4 float4
typedef struct
{
float tweenFactor;
float2 iResolution;
} FadeTransitionUniform;
float easeInOutQuint(float t)
{
return t < 0.5 ? 16.0 * t * t * t * t * t : 1.0 + 16.0 * (--t) * t * t * t * t;
}
void main() {
}
fragment half4 verticalupGlitch(TwoInputVertexIO fragmentInput [[stage_in]],
texture2d<half> inputTexture [[texture(0)]],
texture2d<half> inputTexture2 [[texture(1)]],
constant FadeTransitionUniform& uniform [[ buffer(1) ]])
{
constexpr sampler quadSampler(mag_filter:: linear,
min_filter:: linear,
address:: clamp_to_zero);
float progress = uniform.tweenFactor;
float2 uv = fragmentInput.textureCoordinate;
vec2 resolution = uniform.iResolution;
float mProgress = 1.0 - easeInOutQuint(progress);
if(uv.y < mProgress)
return inputTexture.sample(quadSampler, uv + vec2(0.0, 1.0 - mProgress));
else
return inputTexture2.sample(quadSampler, uv - vec2(0.0, mProgress));
}
}
@@ -0,0 +1,25 @@
//
// MetalVideoProcessVerticalGlitchTransition.swift
// MetalVideoProcess
//
// Created by Ruanshengqiang Macro on 2020/7/16.
// Copyright © 2020 Ruanshengqiang Macro. All rights reserved.
//
import AVFoundation
public class MetalVideoProcessVerticalUpGlitchTransition: MetalVideoProcessTransition {
public var iResolution: Size = Size(width: 1, height: 1) { didSet { uniformSettings["iResolution"] = iResolution } }
public init() {
super.init(fragmentFunctionName: "verticalupGlitch", numberOfInputs: 2, device: sharedMetalRenderingDevice)
self.timingType = .linearInterpolation
iResolution = Size(width: 1, height: 1)
}
public override func newTextureAvailable(_ texture: Texture, fromSourceIndex: UInt, trackID: Int32) {
super.newTextureAvailable(texture, fromSourceIndex: fromSourceIndex, trackID: trackID)
self.iResolution = Size(width: Float(texture.texture.width), height: Float(texture.texture.height))
}
}
+16
View File
@@ -4,10 +4,26 @@ MetalVideoProcess is a High-Performance video effects processing framework. It's
## Technical requirements
- Swift 5.0
- Xcode 10.2 or higher on Mac or iOS
- iOS: 11.0 or higher
- OSX: 10.11 or higher
## Features
- Realtime smooth playback with filters
- Support two video transitions
- Support video motions
- Video picture in picture
- Transform video with multitouch
- Support export video with H.265
- Support video split, delete, insert, merge
- High performance metal rendering
## General architecture