Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit f2f693d

Browse files
committed
Merge branch 'develop'
2 parents 1542cb6 + 3a83e8c commit f2f693d

8 files changed

Lines changed: 63 additions & 35 deletions

File tree

Assets/SolAR/Demos/Sample/Scenes/SolARHololens2SampleScene.unity

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,11 @@ PrefabInstance:
10301030
propertyPath: gRpcDelayBetweenFramesInMs
10311031
value: 20
10321032
objectReference: {fileID: 0}
1033+
- target: {fileID: 747794893107280973, guid: e688a6d483c98df4ebcb4627f077e80c,
1034+
type: 3}
1035+
propertyPath: advancedGrpcSettings.imageCompression
1036+
value: 1
1037+
objectReference: {fileID: 0}
10331038
m_RemovedComponents: []
10341039
m_SourcePrefab: {fileID: 100100000, guid: e688a6d483c98df4ebcb4627f077e80c, type: 3}
10351040
--- !u!114 &287962944 stripped

Assets/SolAR/Prefab/SolArCloudHololens2.prefab

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ MonoBehaviour:
4646
frontendIp: http://192.168.137.1
4747
frontendBasePort: 5000
4848
solarScene: {fileID: 0}
49+
pipelineMode: 0
4950
advancedGrpcSettings:
5051
channelPoolSize: 6
5152
useUniquePort: 0

Assets/SolAR/Scripts/SolARMappingAndRelocalizationGrpcProxyManager.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private byte[] convertToPNG(ImageLayout imLayout,
142142
}
143143

144144
public void SetFrame(int sensorId, ulong timestamp, ImageLayout imLayout,
145-
uint imWidth, uint imHeight, byte[] imData, double[] pose, bool compressionEnabled)
145+
uint imWidth, uint imHeight, byte[] imData, double[] pose, ImageCompression imageCompression)
146146
{
147147

148148
// System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
@@ -165,7 +165,7 @@ public void SetFrame(int sensorId, ulong timestamp, ImageLayout imLayout,
165165
Height = imHeight,
166166
Data = ByteString.CopyFrom(imDataPng),
167167
// Data = UnsafeByteOperations.UnsafeWrap(imDataPng),
168-
ImageCompression = compressionEnabled ? ImageCompression.Png : ImageCompression.None
168+
ImageCompression = imageCompression
169169
},
170170
Pose = new Matrix4x4
171171
{
@@ -676,7 +676,7 @@ public RelocAndMappingResult RelocalizeAndMap(int sensorId, ulong timestamp, Ima
676676
);
677677
}
678678

679-
private byte[] convertToPNG(ImageLayout imLayout, uint imWidth, uint imHeight, byte[] imData)
679+
private byte[] applyCompression(ImageLayout imLayout, uint imWidth, uint imHeight, byte[] imData, ImageCompression imageCompression)
680680
{
681681
GraphicsFormat format;
682682
switch (imLayout)
@@ -687,7 +687,14 @@ private byte[] convertToPNG(ImageLayout imLayout, uint imWidth, uint imHeight, b
687687
default: throw new ArgumentException("Unkown image layout");
688688
}
689689

690-
return UnityEngine.ImageConversion.EncodeArrayToPNG(imData, format, imWidth, imHeight);
690+
switch(imageCompression)
691+
{
692+
case ImageCompression.Png: return UnityEngine.ImageConversion.EncodeArrayToPNG(imData, format, imWidth, imHeight);
693+
case ImageCompression.Jpg: return UnityEngine.ImageConversion.EncodeArrayToJPG(imData, format, imWidth, imHeight);
694+
case ImageCompression.None: throw new ArgumentException("None should not be used here"); // return imData;
695+
default: throw new ArgumentException("Unknown image compression");
696+
697+
}
691698
}
692699

693700
private RelocAndMappingResult RelocalizeAndMap(Frame frame)
@@ -710,8 +717,15 @@ private RelocAndMappingResult RelocalizeAndMap(Frame frame)
710717
break;
711718
}
712719
case ImageCompression.Png:
720+
case ImageCompression.Jpg:
713721
{
714-
frame.Image.Data = ByteString.CopyFrom(convertToPNG(frame.Image.Layout, frame.Image.Width, frame.Image.Height, frame.Image.Data.ToByteArray()));
722+
frame.Image.Data = ByteString.CopyFrom(
723+
applyCompression(
724+
frame.Image.Layout,
725+
frame.Image.Width,
726+
frame.Image.Height,
727+
frame.Image.Data.ToByteArray(),
728+
frame.Image.ImageCompression));
715729
break;
716730
}
717731
default:

Assets/SolAR/Scripts/SolArCloudHololens2.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public struct GrpcSettings
7070
public bool useUniquePort;
7171
[Tooltip("Delay in ms before sending each frame")]
7272
public int delayBetweenFramesInMs;
73-
[Tooltip("Enable compression of frame image buffer in PNG to save bandwidth")]
74-
public bool compressionEnabled;
73+
[Tooltip("Select compression method of frame image buffer to save bandwidth")]
74+
public SolARRpc.ImageCompression imageCompression;
7575
}
7676

7777
[SerializeField]
@@ -80,7 +80,7 @@ public struct GrpcSettings
8080
channelPoolSize = 6,
8181
useUniquePort = false,
8282
delayBetweenFramesInMs = 20,
83-
compressionEnabled = true
83+
imageCompression = SolARRpc.ImageCompression.None
8484
};
8585

8686

@@ -744,7 +744,7 @@ private void handleDepth(
744744
if (rpcAvailable)
745745
{
746746
relocAndMappingFrameSender.SetFrame(0, ts, SolARRpc.ImageLayout.Grey16,
747-
_width, _height, depthData, cam2WorldTransform, /* compression = */ false);
747+
_width, _height, depthData, cam2WorldTransform, SolARRpc.ImageCompression.None);
748748
}
749749
NotifyOnDepthFrame(depthData, depthABData, ts, cam2WorldTransform, _width,
750750
_height, _fx, _fy, _pixelBufferSize);
@@ -808,7 +808,7 @@ SolARRpc.SolARMappingAndRelocalizationGrpcProxyManager.FrameSender relocAndMappi
808808

809809
byte[] vclBufferData = null;
810810
#if ENABLE_WINMD_SUPPORT
811-
vclBufferData = researchMode.GetVlcData(sensorType, out ts, out cam2WorldTransform, out _fx, out _fy, out _pixelBufferSize, out _width, out _height, /* flip = */ advancedGrpcSettings.compressionEnabled);
811+
vclBufferData = researchMode.GetVlcData(sensorType, out ts, out cam2WorldTransform, out _fx, out _fy, out _pixelBufferSize, out _width, out _height, /* flip = */ advancedGrpcSettings.imageCompression != SolARRpc.ImageCompression.None);
812812
#endif
813813
if (vclBufferData != null)
814814
{
@@ -827,7 +827,7 @@ SolARRpc.SolARMappingAndRelocalizationGrpcProxyManager.FrameSender relocAndMappi
827827
_height,
828828
vclBufferData,
829829
cam2WorldTransform,
830-
advancedGrpcSettings.compressionEnabled);
830+
advancedGrpcSettings.imageCompression);
831831
}
832832
}
833833
else
@@ -878,7 +878,7 @@ private void handlePv(
878878
double[] _PVtoWorldtransform = null;
879879
byte[] frameTexture = null;
880880
#if ENABLE_WINMD_SUPPORT
881-
frameTexture = researchMode.GetPvData(out _timestamp, out _PVtoWorldtransform, out _fx, out _fy, out _pixelBufferSize, out _width, out _height, /* flip = */ advancedGrpcSettings.compressionEnabled);
881+
frameTexture = researchMode.GetPvData(out _timestamp, out _PVtoWorldtransform, out _fx, out _fy, out _pixelBufferSize, out _width, out _height, /* flip = */ advancedGrpcSettings.imageCompression != SolARRpc.ImageCompression.None);
882882
#endif
883883
if (frameTexture != null)
884884
{
@@ -890,7 +890,7 @@ private void handlePv(
890890
{
891891
relocAndMappingFrameSender.SetFrame(/* sensor id PV */ 0, _timestamp,
892892
SolARRpc.ImageLayout.Rgb24, _width, _height, frameTexture,
893-
_PVtoWorldtransform, advancedGrpcSettings.compressionEnabled);
893+
_PVtoWorldtransform, advancedGrpcSettings.imageCompression);
894894
}
895895
}
896896
}

Assets/SolAR/Scripts/deprecated/SolARStreamer2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ SolARRpc.SolARMappingAndRelocalizationGrpcProxyManager.FrameSender relocAndMappi
660660
_height,
661661
vclBufferData,
662662
cam2WorldTransform,
663-
/* compression = */ false);
663+
SolARRpc.ImageCompression.None);
664664
}
665665

666666

@@ -785,7 +785,7 @@ private void handlePv(SolarRpcClient.FrameSender frameSender,
785785
_height,
786786
frameTexture,
787787
_PVtoWorldtransform,
788-
/* compression = */ false);
788+
SolARRpc.ImageCompression.None);
789789
}
790790

791791

Assets/SolAR/Scripts/grpc/SolarMappingAndRelocalizationProxy.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@ static SolarMappingAndRelocalizationProxyReflection() {
5858
"Tl9PTkxZEAEqHwoKQ2FtZXJhVHlwZRIHCgNSR0IQABIICgRHUkFZEAEqRgoY",
5959
"UmVsb2NhbGl6YXRpb25Qb3NlU3RhdHVzEgsKB05PX1BPU0UQABIMCghORVdf",
6060
"UE9TRRABEg8KC0xBVEVTVF9QT1NFEAIqMgoLSW1hZ2VMYXlvdXQSCgoGUkdC",
61-
"XzI0EAASCgoGR1JFWV84EAESCwoHR1JFWV8xNhACKiUKEEltYWdlQ29tcHJl",
62-
"c3Npb24SCAoETk9ORRAAEgcKA1BORxABMsgECiJTb2xBUk1hcHBpbmdBbmRS",
63-
"ZWxvY2FsaXphdGlvblByb3h5EkoKBEluaXQSJi5jb20uYmNvbS5zb2xhci5n",
64-
"cHJjLlBpcGVsaW5lTW9kZVZhbHVlGhouY29tLmJjb20uc29sYXIuZ3ByYy5F",
65-
"bXB0eRI/CgVTdGFydBIaLmNvbS5iY29tLnNvbGFyLmdwcmMuRW1wdHkaGi5j",
66-
"b20uYmNvbS5zb2xhci5ncHJjLkVtcHR5Ej4KBFN0b3ASGi5jb20uYmNvbS5z",
67-
"b2xhci5ncHJjLkVtcHR5GhouY29tLmJjb20uc29sYXIuZ3ByYy5FbXB0eRJY",
68-
"ChNTZXRDYW1lcmFQYXJhbWV0ZXJzEiUuY29tLmJjb20uc29sYXIuZ3ByYy5D",
69-
"YW1lcmFQYXJhbWV0ZXJzGhouY29tLmJjb20uc29sYXIuZ3ByYy5FbXB0eRJZ",
70-
"ChBSZWxvY2FsaXplQW5kTWFwEhouY29tLmJjb20uc29sYXIuZ3ByYy5GcmFt",
71-
"ZRopLmNvbS5iY29tLnNvbGFyLmdwcmMuUmVsb2NhbGl6YXRpb25SZXN1bHQS",
72-
"VwoOR2V0M0RUcmFuc2Zvcm0SGi5jb20uYmNvbS5zb2xhci5ncHJjLkVtcHR5",
73-
"GikuY29tLmJjb20uc29sYXIuZ3ByYy5SZWxvY2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2FnZRoaLmNvbS5iY29tLnNvbGFyLmdwcmMuRW1wdHliBnByb3RvMw=="));
7676
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
7777
new pbr::FileDescriptor[] { },
7878
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Com.Bcom.Solar.Gprc.PipelineMode), typeof(global::Com.Bcom.Solar.Gprc.CameraType), typeof(global::Com.Bcom.Solar.Gprc.RelocalizationPoseStatus), typeof(global::Com.Bcom.Solar.Gprc.ImageLayout), typeof(global::Com.Bcom.Solar.Gprc.ImageCompression), }, null, new pbr::GeneratedClrTypeInfo[] {
@@ -117,6 +117,7 @@ public enum ImageLayout {
117117
public enum ImageCompression {
118118
[pbr::OriginalName("NONE")] None = 0,
119119
[pbr::OriginalName("PNG")] Png = 1,
120+
[pbr::OriginalName("JPG")] Jpg = 2,
120121
}
121122

122123
#endregion

ProjectSettings/ProjectSettings.asset

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ PlayerSettings:
128128
16:10: 1
129129
16:9: 1
130130
Others: 1
131-
bundleVersion: 0.2.0
131+
bundleVersion: 0.3.0
132132
preloadedAssets:
133133
- {fileID: 0}
134134
- {fileID: 0}
@@ -255,6 +255,9 @@ PlayerSettings:
255255
- {fileID: 0}
256256
- {fileID: 0}
257257
- {fileID: 0}
258+
- {fileID: 0}
259+
- {fileID: 8098013011867456620, guid: 892250fbfc1442f49a66d62b6c348e31, type: 2}
260+
- {fileID: 2256912601668067897, guid: bc86b981421586743bee1b33317fbc8a, type: 2}
258261
metroInputSource: 0
259262
wsaTransparentSwapchain: 0
260263
m_HolographicPauseOnTrackingLoss: 1
@@ -745,7 +748,7 @@ PlayerSettings:
745748
m_RenderingPath: 1
746749
m_MobileRenderingPath: 1
747750
metroPackageName: SolARDemo
748-
metroPackageVersion: 0.2.0.0
751+
metroPackageVersion: 0.3.0.0
749752
metroCertificatePath: Assets\WSATestCertificate.pfx
750753
metroCertificatePassword:
751754
metroCertificateSubject: DefaultCompany
@@ -781,6 +784,7 @@ PlayerSettings:
781784
metroSplashScreenUseBackgroundColor: 0
782785
platformCapabilities:
783786
WindowsStoreApps:
787+
EnterpriseAuthentication: False
784788
OfflineMapsManagement: False
785789
HumanInterfaceDevice: False
786790
Location: False
@@ -792,7 +796,6 @@ PlayerSettings:
792796
PrivateNetworkClientServer: True
793797
InternetClientServer: True
794798
VideosLibrary: False
795-
BackgroundMediaPlayback: False
796799
Objects3D: False
797800
RemoteSystem: False
798801
BlockedChatMessages: False
@@ -816,9 +819,9 @@ PlayerSettings:
816819
RecordedCallsFolder: False
817820
Contacts: False
818821
Proximity: False
819-
InternetClient: True
820822
CodeGeneration: False
821-
EnterpriseAuthentication: False
823+
BackgroundMediaPlayback: False
824+
InternetClient: True
822825
metroTargetDeviceFamilies:
823826
Desktop: False
824827
Holographic: True

RELEASE-NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes
22

3+
## v0.3.0
4+
5+
* Add JPEG compression option
6+
37
## v0.2.0
48

59
* Add ability to select pipeline mode from relocation AND mapping to mapping only

0 commit comments

Comments
 (0)