Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e298925f6 |
@@ -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)",
|
||||
|
||||
+6
-2
@@ -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)",
|
||||
|
||||
+145
-22
@@ -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) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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)",
|
||||
|
||||
+2
-1
@@ -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 = (
|
||||
|
||||
@@ -990,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";
|
||||
@@ -1017,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
|
||||
|
||||
Reference in New Issue
Block a user