H264 encoding and decoding using Videotoolbox - objective-c
I was testing the encoding and decoding using videotoolbox, to convert the captured frames to H264 and using that data to display it in AVSampleBufferdisplayLayer.
error here while decompress CMVideoFormatDescriptionCreateFromH264ParameterSets with error code -12712
I follow this code from mobisoftinfotech.com
status = CMVideoFormatDescriptionCreateFromH264ParameterSets(
kCFAlloc atorDefault, 2,
(const uint8_t const)parameterSetPointers,
parameterSetSizes, 4, &_formatDesc);
videoCompressionTest; can anyone figure out the problem?
I am not sure if you did figure out the problem yet. However, I found 2 places in your code that leading to the error. After fixed them and run locally your test app, it seems to be working fine. (Tested with Xcode 9.4.1, MacOS 10.13)
The first one is in -(void)CompressAndConvertToData:(CMSampleBufferRef)sampleBuffer method where the while loop should be like this
while (bufferOffset < blockBufferLength - AVCCHeaderLength) {
// Read the NAL unit length
uint32_t NALUnitLength = 0;
memcpy(&NALUnitLength, bufferDataPointer + bufferOffset, AVCCHeaderLength);
// Convert the length value from Big-endian to Little-endian
NALUnitLength = CFSwapInt32BigToHost(NALUnitLength);
// Write start code to the elementary stream
[elementaryStream appendBytes:startCode length:startCodeLength];
// Write the NAL unit without the AVCC length header to the elementary stream
[elementaryStream appendBytes:bufferDataPointer + bufferOffset + AVCCHeaderLength
length:NALUnitLength];
// Move to the next NAL unit in the block buffer
bufferOffset += AVCCHeaderLength + NALUnitLength;
}
uint8_t *bytes = (uint8_t*)[elementaryStream bytes];
int size = (int)[elementaryStream length];
[self receivedRawVideoFrame:bytes withSize:size];
The second place is the decompression code where you process for NALU type 8, the block of code in if(nalu_type == 8) statement. This is a tricky one.
To fix it, update
for (int i = _spsSize + 12; i < _spsSize + 50; i++)
to
for (int i = _spsSize + 12; i < _spsSize + 12 + 50; i++)
And you are freely to remove this hack
//was crashing here
if(_ppsSize == 0)
_ppsSize = 4;
Why? Lets print out the frame packet format.
po frame
▿ 4282 elements
- 0 : 0
- 1 : 0
- 2 : 0
- 3 : 1
- 4 : 39
- 5 : 100
- 6 : 0
- 7 : 30
- 8 : 172
- 9 : 86
- 10 : 193
- 11 : 112
- 12 : 247
- 13 : 151
- 14 : 64
- 15 : 0
- 16 : 0
- 17 : 0
- 18 : 1
- 19 : 40
- 20 : 238
- 21 : 60
- 22 : 176
- 23 : 0
- 24 : 0
- 25 : 0
- 26 : 1
- 27 : 6
- 28 : 5
- 29 : 35
- 30 : 71
- 31 : 86
- 32 : 74
- 33 : 220
- 34 : 92
- 35 : 76
- 36 : 67
- 37 : 63
- 38 : 148
- 39 : 239
- 40 : 197
- 41 : 17
- 42 : 60
- 43 : 209
- 44 : 67
- 45 : 168
- 46 : 0
- 47 : 0
- 48 : 3
- 49 : 0
- 50 : 0
- 51 : 3
- 52 : 0
- 53 : 2
- 54 : 143
- 55 : 92
- 56 : 40
- 57 : 1
- 58 : 221
- 59 : 204
- 60 : 204
- 61 : 221
- 62 : 2
- 63 : 0
- 64 : 76
- 65 : 75
- 66 : 64
- 67 : 128
- 68 : 0
- 69 : 0
- 70 : 0
- 71 : 1
- 72 : 37
- 73 : 184
- 74 : 32
- 75 : 1
- 76 : 223
- 77 : 205
- 78 : 248
- 79 : 30
- 80 : 231
… more
The first NALU start code if (nalu_type == 7) is 0, 0, 0, 1 from index of 15 to 18. The next 0, 0, 0, 1 (from 23 to 26) is type 6, type 8 NALU start code is from 68 to 71. That why I modify the for loop a bit to scan from start index (_spsSize + 12) with a range of 50.
I haven't fully tested your code to make sure encode and decode work properly as expected. However, I hope this finding would help you.
By the way, if there is any misunderstanding, I would love to learn from your comments.
Related
Paraview crash with Nvidia omniverse connector, possible vtk, qt5, libc error?
I'm trying to install the paraview connector to Nvidia omniverse. Once I load the plugin, it crashes with the following error. It looks like some issues with libc.so or Qt5. But I do not know what exactly is the problem and how I can deal with it. The paraview install works fine without omniverse connector. AutoMPI: SUCCESS: command is: "/usr/local/bin/mpiexec" "-n" "6" "/usr/local/bin/pvserver" "--server-port=36395" AutoMPI: starting process server -------------- server output -------------- Waiting for client... AutoMPI: server successfully started. free(): invalid pointer Loguru caught a signal: SIGABRT Stack trace: 72 0x561c3c15e1fe paraview(+0x91fe) [0x561c3c15e1fe] 71 0x7f4381b3d0b3 __libc_start_main + 243 70 0x561c3c15e007 paraview(+0x9007) [0x561c3c15e007] 69 0x7f43801d8116 QCoreApplication::exec() + 150 68 0x7f43801d03ab QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 299 67 0x7f4380229435 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 101 66 0x7f4379fb44a3 g_main_context_iteration + 51 65 0x7f4379fb4400 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52400) [0x7f4379fb4400] 64 0x7f4379fb417d g_main_context_dispatch + 637 63 0x7f436e91a32e /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5(+0x7932e) [0x7f436e91a32e] 62 0x7f438059635b QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 187 61 0x7f43805bc10b QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) + 603 60 0x7f43805ba7d3 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 1763 59 0x7f43801d180a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 394 58 0x7f438131e0f0 QApplication::notify(QObject*, QEvent*) + 816 57 0x7f4381314a66 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 134 56 0x7f43813761ec /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x1cc1ec) [0x7f43813761ec] 55 0x7f4381373ce4 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x1c9ce4) [0x7f4381373ce4] 54 0x7f438131d457 QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) + 439 53 0x7f43801d180a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 394 52 0x7f438131e343 QApplication::notify(QObject*, QEvent*) + 1411 51 0x7f4381314a66 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 134 50 0x7f43814a1adb QMenu::event(QEvent*) + 347 49 0x7f43813572b6 QWidget::event(QEvent*) + 646 48 0x7f438149f4d2 QMenu::mouseReleaseEvent(QMouseEvent*) + 626 47 0x7f438149e4ae /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x2f44ae) [0x7f438149e4ae] 46 0x7f4381496d12 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x2ecd12) [0x7f4381496d12] 45 0x7f4381310aa2 QAction::activate(QAction::ActionEvent) + 242 44 0x7f438130e3e6 QAction::triggered(bool) + 70 43 0x7f43801fd1d0 QMetaObject::activate(QObject*, int, int, void**) + 2000 42 0x7f43819a9f0d pqManagePluginsReaction::managePlugins() + 221 41 0x7f4381518c6d QDialog::exec() + 461 40 0x7f43801d03ab QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 299 39 0x7f4380229435 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 101 38 0x7f4379fb44a3 g_main_context_iteration + 51 37 0x7f4379fb4400 /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52400) [0x7f4379fb4400] 36 0x7f4379fb417d g_main_context_dispatch + 637 35 0x7f436e91a32e /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5(+0x7932e) [0x7f436e91a32e] 34 0x7f438059635b QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 187 33 0x7f43805bc10b QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) + 603 32 0x7f43805ba7d3 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 1763 31 0x7f43801d180a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 394 30 0x7f438131e0f0 QApplication::notify(QObject*, QEvent*) + 816 29 0x7f4381314a66 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 134 28 0x7f43813761ec /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x1cc1ec) [0x7f43813761ec] 27 0x7f438137335d /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x1c935d) [0x7f438137335d] 26 0x7f438131d457 QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) + 439 25 0x7f43801d180a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 394 24 0x7f438131e343 QApplication::notify(QObject*, QEvent*) + 1411 23 0x7f4381314a66 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 134 22 0x7f43813572b6 QWidget::event(QEvent*) + 646 21 0x7f438140b035 QAbstractButton::mouseReleaseEvent(QMouseEvent*) + 229 20 0x7f438140ae73 /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x260e73) [0x7f438140ae73] 19 0x7f4381409a2e /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x25fa2e) [0x7f4381409a2e] 18 0x7f4381409806 QAbstractButton::clicked(bool) + 70 17 0x7f43801fd1d0 QMetaObject::activate(QObject*, int, int, void**) + 2000 16 0x7f4380f8ff37 pqPluginDialog::loadPlugin(pqServer*, bool) + 2919 15 0x7f4380f8cc62 pqPluginDialog::loadPlugin(pqServer*, QString const&, bool) + 82 14 0x7f4380c63229 pqPluginManager::loadExtension(pqServer*, QString const&, QString*, bool) + 169 13 0x7f437fd4b5a6 vtkSMPluginManager::LoadLocalPlugin(char const*) + 150 12 0x7f437f09e083 vtkPVPluginLoader::LoadPluginInternal(char const*, bool) + 4227 11 0x7f437f09c474 vtkPVPluginLoader::LoadPluginInternal(vtkPVPlugin*) + 948 10 0x7f437f09b16c vtkPVPlugin::ImportPlugin(vtkPVPlugin*) + 1436 9 0x7f437f0a7b1f vtkPVPluginTracker::RegisterPlugin(vtkPVPlugin*) + 1551 8 0x7f437d2be644 /usr/local/lib/libvtkCommonCore-pv5.9.so.1(+0x440644) [0x7f437d2be644] 7 0x7f437fccc7a1 vtkObject::vtkClassMemberCallback<vtkSIProxyDefinitionManager>::operator()(vtkObject*, unsigned long, void*) + 113 6 0x7f437fcc5365 vtkSIProxyDefinitionManager::HandlePlugin(vtkPVPlugin*) + 469 5 0x7f4381bafcac /lib/x86_64-linux-gnu/libc.so.6(+0x99cac) [0x7f4381bafcac] 4 0x7f4381bae47c /lib/x86_64-linux-gnu/libc.so.6(+0x9847c) [0x7f4381bae47c] 3 0x7f4381ba63ee /lib/x86_64-linux-gnu/libc.so.6(+0x903ee) [0x7f4381ba63ee] 2 0x7f4381b3b859 abort + 299 1 0x7f4381b5c18b gsignal + 203 0 0x7f4381b5c210 /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7f4381b5c210] ( 36.129s) [paraview ] :0 FATL| Signal: SIGABRT Aborted (core dumped)
Filtering file according to the highest value in a column of each line
I have the following file: gene.100079.0.5.p3 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 84.9 gene.100079.0.3.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 84.9 gene.100079.0.0.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 86.7 gene.100080.0.3.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 99.9 gene.100080.0.0.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 99.9 chr11_pilon3.g3568.t1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 74.9 chr11_pilon3.g3568.t2 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 76.7 The above file has some IDs which are similar gene.100079.0.5.p3 gene.100079.0.3.p1 gene.100079.0.0.p1 By remaining only gene.100079 the IDs become identically. I would like to filter the above file in the following way: chr11_pilon3.g3568.t1 = 74.9. IDs starting with chr get excluded from the comparison and they end up straight in the output. gene.100079.0.0.p1 = 86.7 && gene.100079.0.5.p3 = 84.9 == gene.100079.0.3.p1 = 84.9. gene.100079.0.0.p1 has the highest value and therefore it should be in the output. gene.100080.0.3.p1 = 99.9 == gene.100080.0.0.p1 = 99.9. Both IDs have the same value and therefore both should be in the output. However, this awk script from #RavinderSingh13 and #anubhava returns the wrong results. awk '{ if (/^gene\./) { split($1, a, /\./) k = a[1] "." a[2] } else k = $1 } !(k in max) || $13 >= max[k] { if(!(k in max)) ord[++n] = k else if (max[k] == $13) { print next } max[k] = $13 rec[k] = $0 } END { for (i=1; i<=n; ++i) print rec[ord[i]] }' file Wrong output with the above script: chr11_pilon3.g3568.t1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 74.9 chr11_pilon3.g3568.t2 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 76.7 gene.100079.0.0.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 86.7 gene.100079.0.3.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 84.9 gene.100080.0.0.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 99.9 gene.100080.0.3.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 99.9 As output I would like to get: chr11_pilon3.g3568.t1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 74.9 chr11_pilon3.g3568.t2 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 76.7 gene.100079.0.0.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 86.7 gene.100080.0.3.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 99.9 gene.100080.0.0.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 99.9 I also tried to fix as show below but it didn't work: awk '{ if (/^gene\./) { split($1, a, /\./) k = a[1] "." a[2] } else k = $1 } !(k in max) || $13 > max[k] { max[k]=$13; line[k]=$0 } END { for(i in line) print line[i] }' Thank you in advance,
This seems to work correctly, assuming that the data is ordered so that all the lines with the same first two name components are grouped together in the data file. The order of those lines within the group doesn't matter. As revised, the question now wants lines starting chr transferred to the output without any filtering. That is easily achieved — the rule matching /^chr/ provides that functionality. #!/bin/sh awk ' function dump_memo() { if (memo_num > 0) { for (i = 0; i < memo_num; i++) print memo_line[i] } } /^chr/ { print; next } # Do not process lines starting chr specially { split($1, a, ".") key = a[1] "." a[2] val = $NF # print "# " key " = " val " (memo_key = " memo_key ", memo_val = " memo_val ")" if (memo_key == key) { if (memo_val == val) { memo_line[memo_num++] = $0 } else if (memo_val < val) { memo_val = val memo_num = 0 memo_line[memo_num++] = $0 } } else { dump_memo() memo_num = 0 memo_line[memo_num++] = $0 memo_key = key memo_val = val } } END { dump_memo() }' "$#" When run on the data file shown in the question, the original output from the unrevised script was: gene.100079.0.0.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 86.7 gene.100080.0.3.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 99.9 gene.100080.0.0.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 99.9 chr11_pilon3.g3568.t2 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 76.7 The main difference between this and what was requested is the sort order. If you need the data in sorted order, pipe the output of the script through sort. With the revised script (with the /^chr/ rule) is: gene.100079.0.0.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 86.7 chr11_pilon3.g3568.t1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 74.9 chr11_pilon3.g3568.t2 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 76.7 gene.100080.0.3.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 99.9 gene.100080.0.0.p1 transcript:OIS96097 82.2 169 30 0 1 169 4 172 1.3e-75 283.1 99.9 Again, if you want the data in some specific order, apply a sort to the output.
Microsoft Visual Studio 2017 has stopped working - after computer sleep
My visual studio keeps crashing after waking up my computer from sleep. Spectacular is that sometimes it blocks mouse and keyboard. Mouse moves in a speed of few pixels every 5 seconds, for pressed key on the keyboard you wait like 10 seconds. Highly unusual, because mouse and keyboard have usually the highest priority no matter what happens. With parallelly installed VS2015 and VS2013 there is no problem (therefore I suppose it is not caused by Resharper). Program and system info: VS Community 2017, Version 15.2 (26430.12) Using Resharper Ultimate 2017.1.2 OS: Windows 8.1 Pro, Version 6.3.9600 Edit: By following the suggestion about writing and reading crash dump by WinDbg I got this error description (memory corruption there is frightening ...). Any further suggestion will be appreciated. ******************************************************************************* * * * Exception Analysis * * * ******************************************************************************* *** WARNING: Unable to verify checksum for mscorlib.ni.dll *** WARNING: Unable to verify checksum for PresentationFramework.ni.dll *** WARNING: Unable to verify checksum for WindowsBase.ni.dll *** WARNING: Unable to verify checksum for Microsoft.VisualStudio.Shell.15.0.ni.dll *** WARNING: Unable to verify checksum for System.ni.dll *** WARNING: Unable to verify checksum for Microsoft.CodeAnalysis.Features.ni.dll *** WARNING: Unable to verify checksum for Microsoft.CodeAnalysis.Workspaces.ni.dll *** WARNING: Unable to verify checksum for Microsoft.CodeAnalysis.EditorFeatures.Text.ni.dll *** WARNING: Unable to verify checksum for Microsoft.Build.ni.dll *** ERROR: Symbol file could not be found. Defaulted to export symbols for libleveldb.dll - *** WARNING: Unable to verify checksum for Microsoft.CodeAnalysis.EditorFeatures.ni.dll *** WARNING: Unable to verify checksum for System.Runtime.Remoting.ni.dll DEBUG_FLR_EXCEPTION_CODE(80131509) and the ".exr -1" ExceptionCode(e0434352) don't match DUMP_CLASS: 2 DUMP_QUALIFIER: 400 CONTEXT: (.ecxr) eax=55f9e8c0 ebx=00000005 ecx=00000005 edx=00000000 esi=55f9e980 edi=00000001 eip=760f2f71 esp=55f9e8c0 ebp=55f9e918 iopl=0 nv up ei pl nz ac pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000216 KERNELBASE!RaiseException+0x48: 760f2f71 8b4c2454 mov ecx,dword ptr [esp+54h] ss:002b:55f9e914=ee800b58 Resetting default scope FAULTING_IP: KERNELBASE!RaiseException+48 760f2f71 8b4c2454 mov ecx,dword ptr [esp+54h] EXCEPTION_RECORD: (.exr -1) ExceptionAddress: 760f2f71 (KERNELBASE!RaiseException+0x00000048) ExceptionCode: e0434352 (CLR exception) ExceptionFlags: 00000001 NumberParameters: 5 Parameter[0]: 80131509 Parameter[1]: 00000000 Parameter[2]: 00000000 Parameter[3]: 00000000 Parameter[4]: 715a0000 PROCESS_NAME: devenv.exe ERROR_CODE: (NTSTATUS) 0xe0434352 - EXCEPTION_CODE: (HRESULT) 0x80131509 (2148734217) - EXCEPTION_CODE_STR: 80131509 EXCEPTION_PARAMETER1: 80131509 EXCEPTION_PARAMETER2: 00000000 EXCEPTION_PARAMETER3: 00000000 EXCEPTION_PARAMETER4: 0 WATSON_BKT_PROCSTAMP: 59275f23 WATSON_BKT_PROCVER: 15.0.26430.12 PROCESS_VER_PRODUCT: Microsoft® Visual Studio® WATSON_BKT_MODULE: KERNELBASE.dll WATSON_BKT_MODSTAMP: 53eeb460 WATSON_BKT_MODOFFSET: 12f71 WATSON_BKT_MODVER: 6.3.9600.17278 MODULE_VER_PRODUCT: Microsoft® Windows® Operating System BUILD_VERSION_STRING: 6.3.9600.17056 (winblue_gdr.140319-1520) DETOURED_IMAGE: 1 MODLIST_WITH_TSCHKSUM_HASH: fb123f85e82dc66a6aaa47baaf54a8d6c688d06a MODLIST_SHA1_HASH: 5d338567fc7fda41c0d3a856681d67a8a2273337 NTGLOBALFLAG: 0 PROCESS_BAM_CURRENT_THROTTLED: 0 PROCESS_BAM_PREVIOUS_THROTTLED: 0 APPLICATION_VERIFIER_FLAGS: 0 CHKIMG_EXTENSION: !chkimg -lo 50 -d !KERNELBASE 760ed598-760ed59c 5 bytes - KERNELBASE!GetModuleHandleW [ 8b ff 55 8b ec:e9 20 3c 57 eb ] 760edbce-760edbd2 5 bytes - KERNELBASE!GetModuleHandleExW (+0x636) [ 8b ff 55 8b ec:e9 41 34 57 eb ] 760f1bc6-760f1bca 5 bytes - KERNELBASE!RegCloseKey (+0x3ff8) [ 8b ff 55 8b ec:e9 84 47 94 8a ] 760f213e-760f2142 5 bytes - KERNELBASE!RegQueryValueExW (+0x578) [ 8b ff 55 8b ec:e9 8c 42 94 8a ] 760f2441-760f2445 5 bytes - KERNELBASE!RegOpenKeyExW (+0x303) [ 8b ff 55 8b ec:e9 2d 3a 94 8a ] 760f30c6-760f30ca 5 bytes - KERNELBASE!FreeLibrary (+0xc85) [ 8b ff 55 8b ec:e9 9c e1 56 eb ] 760f30f4-760f30f8 5 bytes - KERNELBASE!LoadLibraryExW (+0x2e) [ 8b ff 55 8b ec:e9 52 e4 56 eb ] 760f772e-760f7732 5 bytes - KERNELBASE!RegOpenKeyExA (+0x463a) [ 8b ff 55 8b ec:e9 e8 f1 93 8a ] 760f7e99-760f7e9d 5 bytes - KERNELBASE!RegQueryValueExA (+0x76b) [ 8b ff 55 8b ec:e9 1c ea 93 8a ] 760fa5b1-760fa5b5 5 bytes - KERNELBASE!RegCreateKeyExW (+0x2718) [ 8b ff 55 8b ec:e9 45 c4 93 8a ] 760fe5b7-760fe5bb 5 bytes - KERNELBASE!RegCreateKeyExA (+0x4006) [ 8b ff 55 8b ec:e9 75 e7 93 8a ] 76100273-76100279 7 bytes - KERNELBASE!RegQueryInfoKeyW (+0x1cbc) [ 6a 48 68 d0 03 10 76:e9 2d 65 93 8a cc cc ] 7610049e-761004a4 7 bytes - KERNELBASE!RegDeleteValueW (+0x22b) [ 6a 20 68 28 05 10 76:e9 e6 83 93 8a cc cc ] 76100fd0-76100fd6 7 bytes - KERNELBASE!RegEnumValueW (+0xb32) [ 6a 38 68 f8 10 10 76:e9 7d 58 93 8a cc cc ] 76102ad4-76102ad8 5 bytes - KERNELBASE!RegEnumKeyExA (+0x1b04) [ 68 58 02 00 00:e9 09 6e 93 8a ] 76106c9a-76106c9e 5 bytes - KERNELBASE!RegEnumKeyExW (+0x41c6) [ 8b ff 55 8b ec:e9 45 fb 92 8a ] 7610b27e-7610b284 7 bytes - KERNELBASE!RegEnumValueA (+0x45e4) [ 6a 60 68 08 b5 10 76:e9 21 fe 96 8a cc cc ] 7611f3f4-7611f3fa 7 bytes - KERNELBASE!RegQueryInfoKeyA (+0x14176) [ 6a 60 68 88 f5 11 76:e9 1b bd 95 8a cc cc ] 7612107a-7612107e 5 bytes - KERNELBASE!RegDeleteKeyExW (+0x1c86) [ 8b ff 55 8b ec:e9 5f 66 91 8a ] 7612489c-761248a2 7 bytes - KERNELBASE!RegDeleteValueA (+0x3822) [ 6a 20 68 30 49 12 76:e9 c6 67 95 8a cc cc ] 7617240a-7617240e 5 bytes - KERNELBASE!RegDeleteKeyExA (+0x4db6e) [ 8b ff 55 8b ec:e9 ed 8b 90 8a ] 117 errors : !KERNELBASE (760ed598-7617240e) PRODUCT_TYPE: 1 SUITE_MASK: 272 DUMP_FLAGS: 8000c07 DUMP_TYPE: 3 MISSING_CLR_SYMBOL: 0 MANAGED_EXCEPTION_HRESULT: 80131509 ANALYSIS_SESSION_HOST: KOMP ANALYSIS_SESSION_TIME: 06-11-2017 08:17:44.0657 ANALYSIS_VERSION: 10.0.15063.400 x86fre MANAGED_CODE: 1 MANAGED_ENGINE_MODULE: clr MANAGED_ANALYSIS_PROVIDER: SOS MANAGED_THREAD_ID: c44 MANAGED_EXCEPTION_ADDRESS: 905fdb68 LAST_CONTROL_TRANSFER: from 716f0245 to 760f2f71 THREAD_ATTRIBUTES: FAULTING_THREAD: ffffffff THREAD_SHA1_HASH_MOD_FUNC: 8b084063f74c10f14fd5a9c68991db600ea504a6 THREAD_SHA1_HASH_MOD_FUNC_OFFSET: ba90ca3a69862e0865ec0206bec2d1add0fdbffe ADDITIONAL_DEBUG_TEXT: SOS.DLL is not loaded for managed code. Analysis might be incomplete ; Followup set based on attribute [Is_ChosenCrashFollowupThread] from Frame:[0] on thread:[PSEUDO_THREAD] OS_LOCALE: ENU PROBLEM_CLASSES: ID: [0n237] Type: [CLR_EXCEPTION] Class: Primary Scope: DEFAULT_BUCKET_ID (Failure Bucket ID prefix) BUCKET_ID Name: Add Data: Omit PID: [Unspecified] TID: [0xc44] Frame: [0] : KERNELBASE!RaiseException ID: [0n235] Type: [#ManagedObjectName] Class: Addendum Scope: DEFAULT_BUCKET_ID (Failure Bucket ID prefix) BUCKET_ID Name: Omit Data: Add String: [System.InvalidOperationException] PID: [Unspecified] TID: [Unspecified] Frame: [0] ID: [0n203] Type: [MEMORY_CORRUPTION] Class: Primary Scope: DEFAULT_BUCKET_ID (Failure Bucket ID prefix) BUCKET_ID Name: Add Data: Omit PID: [0x988] TID: [0xc44] Frame: [Unspecified] ID: [0n151] Type: [PATCH] Class: Addendum Scope: DEFAULT_BUCKET_ID (Failure Bucket ID prefix) BUCKET_ID Name: Add Data: Omit PID: [0x988] TID: [0xc44] Frame: [Unspecified] ID: [0n234] Type: [NOSOS] Class: Addendum Scope: DEFAULT_BUCKET_ID (Failure Bucket ID prefix) BUCKET_ID Name: Add Data: Omit PID: [Unspecified] TID: [Unspecified] Frame: [0] BUGCHECK_STR: CLR_EXCEPTION_System.InvalidOperationException_NOSOS_MEMORY_CORRUPTION_PATCH DEFAULT_BUCKET_ID: CLR_EXCEPTION_System.InvalidOperationException_NOSOS_MEMORY_CORRUPTION_PATCH PRIMARY_PROBLEM_CLASS: CLR_EXCEPTION STACK_TEXT: 00000000 00000000 memory_corruption!KERNELBASE+0x0 STACK_COMMAND: !sos.pe 0x905fdb68 ; ** Pseudo Context ** ; kb THREAD_SHA1_HASH_MOD: 7da7fbec386ce361a40d03d69a994bc4836f03e8 SYMBOL_STACK_INDEX: 0 SYMBOL_NAME: memory_corruption!KERNELBASE FOLLOWUP_NAME: MachineOwner MODULE_NAME: memory_corruption DEBUG_FLR_IMAGE_TIMESTAMP: 0 FAILURE_BUCKET_ID: CLR_EXCEPTION_System.InvalidOperationException_NOSOS_MEMORY_CORRUPTION_PATCH_80131509_memory_corruption!KERNELBASE BUCKET_ID: CLR_EXCEPTION_System.InvalidOperationException_NOSOS_MEMORY_CORRUPTION_PATCH_DETOURED_memory_corruption!KERNELBASE FAILURE_EXCEPTION_CODE: 80131509 IMAGE_NAME: memory_corruption FAILURE_IMAGE_NAME: memory_corruption BUCKET_ID_IMAGE_STR: memory_corruption FAILURE_MODULE_NAME: memory_corruption BUCKET_ID_MODULE_STR: memory_corruption FAILURE_FUNCTION_NAME: KERNELBASE BUCKET_ID_FUNCTION_STR: KERNELBASE BUCKET_ID_OFFSET: 0 BUCKET_ID_MODTIMEDATESTAMP: 0 BUCKET_ID_MODCHECKSUM: 0 BUCKET_ID_MODVER_STR: 0.0.0.0 BUCKET_ID_PREFIX_STR: CLR_EXCEPTION_System.InvalidOperationException_NOSOS_ FAILURE_PROBLEM_CLASS: CLR_EXCEPTION FAILURE_SYMBOL_NAME: memory_corruption!KERNELBASE WATSON_STAGEONE_URL: http://watson.microsoft.com/StageOne/devenv.exe/15.0.26430.12/59275f23/KERNELBASE.dll/6.3.9600.17278/53eeb460/80131509/00012f71.htm?Retriage=1 TARGET_TIME: 2017-06-10T19:22:40.000Z OSBUILD: 9600 OSSERVICEPACK: 17056 SERVICEPACK_NUMBER: 0 OS_REVISION: 0 OSPLATFORM_TYPE: x86 OSNAME: Windows 8.1 OSEDITION: Windows 8.1 WinNt SingleUserTS USER_LCID: 0 OSBUILD_TIMESTAMP: 2014-03-20 00:55:24 BUILDDATESTAMP_STR: 140319-1520 BUILDLAB_STR: winblue_gdr BUILDOSVER_STR: 6.3.9600.17056 ANALYSIS_SESSION_ELAPSED_TIME: 9ad5 ANALYSIS_SOURCE: UM FAILURE_ID_HASH_STRING: um:clr_exception_system.invalidoperationexception_nosos_memory_corruption_patch_80131509_memory_corruption!kernelbase FAILURE_ID_HASH: {1100017e-170d-400c-940f-f475e873df74} Followup: MachineOwner ---------
Can't get Svg to show up in react-native with react-native-svg or Svg/expo
I am not sure exactly why this is not showing up. I suspect maybe it has to do with the transform? <Svg.G id="startup" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd" transform="translate(135.000000, 76.000000)"> But I really don't know... I'm seeing "invalid prop transform" As I copied SVG code form sketch, suspect I'm having similar trouble to this issue: https://github.com/react-native-community/react-native-svg/issues/205 Code is below. Any ideas? import React from 'react'; import { Svg } from 'expo'; const RocketSvg = () => { return ( <Svg width="108px" height="128px" viewBox="135 76 108 128" version="1.1"> <Svg.G id="startup" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd" transform="translate(135.000000, 76.000000)"> <Svg.Ellipse id="Oval" fill="#DCDDDE" cx="54" cy="75" rx="52" ry="51"></Svg.Ellipse> <Svg.Path d="M81.764,76.608 C79.316,75.5 75.758,74.198 72,73.81 L72,61.414 C77.408,64.05 80.866,70.118 81.764,76.608 Z" id="Shape" fill="#FFFFFF"></Svg.Path> <Svg.Path d="M26.236,76.608 C27.134,70.118 30.592,64.052 36,61.412 L36,73.804 C32.242,74.194 28.682,75.498 26.236,76.608 Z" id="Shape" fill="#FFFFFF"></Svg.Path> <Svg.Path d="M40,76 L40,42 C40,37.68 40.562,33.678 41.448,30 L66.556,30 C67.44,33.676 68,37.676 68,42 L68,76 L66,76 L42,76 L40,76 Z" id="Shape" fill="#FFFFFF"></Svg.Path> <Svg.Polygon id="Shape" fill="#FFFFFF" points="46 84 46 80 62 80 62 84 60 84 48 84"></Svg.Polygon> <Svg.Path d="M70,78 L70,42 C70,18 54,2 54,2 L54,78 L70,78 Z" id="Shape" fill="#DCDDDE"></Svg.Path> <Svg.Circle id="Oval" fill="#53B7E8" cx="54" cy="42" r="6"></Svg.Circle> <Svg.Path d="M98.8,100.76 C96.66,104.34 94.04,107.7 90.96,110.78 C88.58,113.16 86.02,115.26 83.32,117.08 C65.74,129.02 42.46,128.98 24.92,116.96 C22.28,115.18 19.78,113.12 17.44,110.78 C14.26,107.6 11.56,104.1 9.38,100.4 C11.4,96.6 15.4,94 20,94 C25.48,94 30.1,97.7 31.54,102.74 C33.3,99.9 36.42,98 40,98 C44.84,98 48.88,101.44 49.8,106 L50,106 L50,86 L58,86 L58,106 L58.2,106 C59.12,101.44 63.16,98 68,98 C71.58,98 74.7,99.9 76.46,102.74 C77.88,97.7 82.5,94 88,94 C92.74,94 96.84,96.76 98.8,100.76 Z" id="Shape" fill="#FFD768"></Svg.Path> <Svg.Rect id="Rectangle-path" fill="#DCDDDE" x="54" y="80" width="8" height="4"></Svg.Rect> <Svg.Path d="M91.414,36.586 L90,35.172 L87.172,38 L88.586,39.414 C98.67,49.5 104,61.458 104,74 C104,82.056 102.096,89.812 98.522,96.778 C95.9,93.776 92.12,92 88,92 C82.948,92 78.354,94.752 75.894,98.988 C73.742,97.08 70.96,96 68,96 C64.966,96 62.144,97.148 60,99.062 L60,88 L66,88 L66,80 L72,80 L72,77.844 C77.584,78.546 82.886,81.664 82.966,81.714 L86,83.538 L86,80 C86,70.238 80.864,60.222 72,57.052 L72,42 C72,17.454 56.092,2.09 55.414,1.414 L54,0 L52.586,1.414 C51.908,2.09 36,17.454 36,42 L36,57.052 C27.136,60.222 22,70.238 22,80 L22.002,83.538 L25.034,81.714 C25.116,81.664 30.418,78.542 36,77.842 L36,80 L42,80 L42,88 L48,88 L48,99.062 C45.856,97.148 43.034,96 40,96 C37.036,96 34.252,97.082 32.1,98.994 C29.628,94.754 25.036,92 20,92 C15.91,92 12.116,93.794 9.486,96.794 C5.906,89.824 4,82.06 4,73.998 C4,61.458 9.33,49.5 19.414,39.414 L20.828,38 L18,35.172 L16.586,36.586 C5.736,47.438 0,60.376 0,73.998 C0,88.424 5.618,101.984 15.816,112.184 C26.344,122.71 40.172,128 54,128 C67.828,128 81.656,122.71 92.184,112.184 C102.382,101.984 108,88.424 108,74 C108,60.376 102.264,47.438 91.414,36.586 Z M81.764,76.608 C79.316,75.5 75.758,74.198 72,73.81 L72,61.414 C77.408,64.05 80.866,70.118 81.764,76.608 Z M54.002,5.824 C56.604,8.896 62.168,15.912 65.444,26 L42.566,26 C45.844,15.928 51.404,8.902 54.002,5.824 Z M26.236,76.608 C27.134,70.118 30.592,64.052 36,61.412 L36,73.804 C32.242,74.194 28.682,75.498 26.236,76.608 Z M40,76 L40,42 C40,37.68 40.562,33.678 41.448,30 L66.556,30 C67.44,33.676 68,37.676 68,42 L68,76 L66,76 L42,76 L40,76 Z M46,84 L46,80 L62,80 L62,84 L60,84 L48,84 L46,84 Z M89.356,109.356 C69.86,128.85 38.14,128.85 18.646,109.356 C15.952,106.662 13.616,103.706 11.634,100.558 C13.48,97.732 16.598,96 20,96 C24.436,96 28.39,98.998 29.618,103.29 L30.86,107.638 L33.24,103.794 C34.712,101.418 37.24,100 40,100 C43.794,100 47.092,102.69 47.838,106.394 L48.164,108 L52,108 L52,88 L56,88 L56,108 L59.836,108 L60.16,106.394 C60.908,102.69 64.206,100 68,100 C70.76,100 73.288,101.418 74.76,103.792 L77.154,107.656 L78.386,103.282 C79.592,98.994 83.546,96 88,96 C91.426,96 94.528,97.718 96.372,100.55 C94.39,103.7 92.052,106.658 89.356,109.356 Z" id="Shape" fill="#0C3847"></Svg.Path> <Svg.Path d="M54,34 C49.588,34 46,37.588 46,42 C46,46.412 49.588,50 54,50 C58.412,50 62,46.412 62,42 C62,37.588 58.412,34 54,34 Z M54,46 C51.794,46 50,44.206 50,42 C50,39.794 51.794,38 54,38 C56.206,38 58,39.794 58,42 C58,44.206 56.206,46 54,46 Z" id="Shape" fill="#0C3847"></Svg.Path> <Svg.Polygon id="Shape" fill="#0C3847" points="78 16 82 16 82 12 86 12 86 8 82 8 82 4 78 4 78 8 74 8 74 12 78 12"></Svg.Polygon> <Svg.Polygon id="Shape" fill="#0C3847" points="14 26 18 26 18 22 22 22 22 18 18 18 18 14 14 14 14 18 10 18 10 22 14 22"></Svg.Polygon> <Svg.Polygon id="Shape" fill="#0C3847" points="96 32 100 32 100 28 104 28 104 24 100 24 100 20 96 20 96 24 92 24 92 28 96 28"></Svg.Polygon> <Svg.Polygon id="Shape" fill="#0C3847" points="84 46 84 48 82 48 82 52 84 52 84 54 88 54 88 52 90 52 90 48 88 48 88 46"></Svg.Polygon> <Svg.Polygon id="Shape" fill="#0C3847" points="26 44 30 44 30 42 32 42 32 38 30 38 30 36 26 36 26 38 24 38 24 42 26 42"></Svg.Polygon> <Svg.Polygon id="Shape" fill="#0C3847" points="26 8 30 8 30 6 32 6 32 2 30 2 30 0 26 0 26 2 24 2 24 6 26 6"></Svg.Polygon> <Svg.Path d="M54.002,5.824 C56.604,8.896 62.168,15.912 65.444,26 L42.566,26 C45.844,15.928 51.404,8.902 54.002,5.824 Z" id="Shape" fill="#F37053"></Svg.Path>*/} </Svg.G> </Svg> ); }
Answer Regards Tranform transform propType is not currently support as part of react-native-svg (4th June 2017) However you can use x and y props instead: <Svg.G x="135.000000" y="76.000000" id="startup" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd"> Fix for SVG However the SVG you pasted does still not seem to render. I first converted it back to SVG and re-exported with Sketch. // logo.svg <?xml version="1.0" encoding="UTF-8"?> <svg width="108px" height="128px" viewBox="0 0 108 128" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Generator: Sketch 44.1 (41455) - http://www.bohemiancoding.com/sketch --> <title>Slice 1</title> <desc>Created with Sketch.</desc> <defs></defs> <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <g id="so" fill-rule="nonzero"> <ellipse id="Oval" fill="#DCDDDE" cx="54" cy="75" rx="52" ry="51"></ellipse> <path d="M81.764,76.608 C79.316,75.5 75.758,74.198 72,73.81 L72,61.414 C77.408,64.05 80.866,70.118 81.764,76.608 Z" id="Shape" fill="#FFFFFF"></path> <path d="M26.236,76.608 C27.134,70.118 30.592,64.052 36,61.412 L36,73.804 C32.242,74.194 28.682,75.498 26.236,76.608 Z" id="Shape" fill="#FFFFFF"></path> <path d="M40,76 L40,42 C40,37.68 40.562,33.678 41.448,30 L66.556,30 C67.44,33.676 68,37.676 68,42 L68,76 L66,76 L42,76 L40,76 Z" id="Shape" fill="#FFFFFF"></path> <polygon id="Shape" fill="#FFFFFF" points="46 84 46 80 62 80 62 84 60 84 48 84"></polygon> <path d="M70,78 L70,42 C70,18 54,2 54,2 L54,78 L70,78 Z" id="Shape" fill="#DCDDDE"></path> <circle id="Oval" fill="#53B7E8" cx="54" cy="42" r="6"></circle> <path d="M98.8,100.76 C96.66,104.34 94.04,107.7 90.96,110.78 C88.58,113.16 86.02,115.26 83.32,117.08 C65.74,129.02 42.46,128.98 24.92,116.96 C22.28,115.18 19.78,113.12 17.44,110.78 C14.26,107.6 11.56,104.1 9.38,100.4 C11.4,96.6 15.4,94 20,94 C25.48,94 30.1,97.7 31.54,102.74 C33.3,99.9 36.42,98 40,98 C44.84,98 48.88,101.44 49.8,106 L50,106 L50,86 L58,86 L58,106 L58.2,106 C59.12,101.44 63.16,98 68,98 C71.58,98 74.7,99.9 76.46,102.74 C77.88,97.7 82.5,94 88,94 C92.74,94 96.84,96.76 98.8,100.76 Z" id="Shape" fill="#FFD768"></path> <rect id="Rectangle-path" fill="#DCDDDE" x="54" y="80" width="8" height="4"></rect> <path d="M91.414,36.586 L90,35.172 L87.172,38 L88.586,39.414 C98.67,49.5 104,61.458 104,74 C104,82.056 102.096,89.812 98.522,96.778 C95.9,93.776 92.12,92 88,92 C82.948,92 78.354,94.752 75.894,98.988 C73.742,97.08 70.96,96 68,96 C64.966,96 62.144,97.148 60,99.062 L60,88 L66,88 L66,80 L72,80 L72,77.844 C77.584,78.546 82.886,81.664 82.966,81.714 L86,83.538 L86,80 C86,70.238 80.864,60.222 72,57.052 L72,42 C72,17.454 56.092,2.09 55.414,1.414 L54,0 L52.586,1.414 C51.908,2.09 36,17.454 36,42 L36,57.052 C27.136,60.222 22,70.238 22,80 L22.002,83.538 L25.034,81.714 C25.116,81.664 30.418,78.542 36,77.842 L36,80 L42,80 L42,88 L48,88 L48,99.062 C45.856,97.148 43.034,96 40,96 C37.036,96 34.252,97.082 32.1,98.994 C29.628,94.754 25.036,92 20,92 C15.91,92 12.116,93.794 9.486,96.794 C5.906,89.824 4,82.06 4,73.998 C4,61.458 9.33,49.5 19.414,39.414 L20.828,38 L18,35.172 L16.586,36.586 C5.736,47.438 0,60.376 0,73.998 C0,88.424 5.618,101.984 15.816,112.184 C26.344,122.71 40.172,128 54,128 C67.828,128 81.656,122.71 92.184,112.184 C102.382,101.984 108,88.424 108,74 C108,60.376 102.264,47.438 91.414,36.586 Z M81.764,76.608 C79.316,75.5 75.758,74.198 72,73.81 L72,61.414 C77.408,64.05 80.866,70.118 81.764,76.608 Z M54.002,5.824 C56.604,8.896 62.168,15.912 65.444,26 L42.566,26 C45.844,15.928 51.404,8.902 54.002,5.824 Z M26.236,76.608 C27.134,70.118 30.592,64.052 36,61.412 L36,73.804 C32.242,74.194 28.682,75.498 26.236,76.608 Z M40,76 L40,42 C40,37.68 40.562,33.678 41.448,30 L66.556,30 C67.44,33.676 68,37.676 68,42 L68,76 L66,76 L42,76 L40,76 Z M46,84 L46,80 L62,80 L62,84 L60,84 L48,84 L46,84 Z M89.356,109.356 C69.86,128.85 38.14,128.85 18.646,109.356 C15.952,106.662 13.616,103.706 11.634,100.558 C13.48,97.732 16.598,96 20,96 C24.436,96 28.39,98.998 29.618,103.29 L30.86,107.638 L33.24,103.794 C34.712,101.418 37.24,100 40,100 C43.794,100 47.092,102.69 47.838,106.394 L48.164,108 L52,108 L52,88 L56,88 L56,108 L59.836,108 L60.16,106.394 C60.908,102.69 64.206,100 68,100 C70.76,100 73.288,101.418 74.76,103.792 L77.154,107.656 L78.386,103.282 C79.592,98.994 83.546,96 88,96 C91.426,96 94.528,97.718 96.372,100.55 C94.39,103.7 92.052,106.658 89.356,109.356 Z" id="Shape" fill="#0C3847"></path> <path d="M54,34 C49.588,34 46,37.588 46,42 C46,46.412 49.588,50 54,50 C58.412,50 62,46.412 62,42 C62,37.588 58.412,34 54,34 Z M54,46 C51.794,46 50,44.206 50,42 C50,39.794 51.794,38 54,38 C56.206,38 58,39.794 58,42 C58,44.206 56.206,46 54,46 Z" id="Shape" fill="#0C3847"></path> <polygon id="Shape" fill="#0C3847" points="78 16 82 16 82 12 86 12 86 8 82 8 82 4 78 4 78 8 74 8 74 12 78 12"></polygon> <polygon id="Shape" fill="#0C3847" points="14 26 18 26 18 22 22 22 22 18 18 18 18 14 14 14 14 18 10 18 10 22 14 22"></polygon> <polygon id="Shape" fill="#0C3847" points="96 32 100 32 100 28 104 28 104 24 100 24 100 20 96 20 96 24 92 24 92 28 96 28"></polygon> <polygon id="Shape" fill="#0C3847" points="84 46 84 48 82 48 82 52 84 52 84 54 88 54 88 52 90 52 90 48 88 48 88 46"></polygon> <polygon id="Shape" fill="#0C3847" points="26 44 30 44 30 42 32 42 32 38 30 38 30 36 26 36 26 38 24 38 24 42 26 42"></polygon> <polygon id="Shape" fill="#0C3847" points="26 8 30 8 30 6 32 6 32 2 30 2 30 0 26 0 26 2 24 2 24 6 26 6"></polygon> <path d="M54.002,5.824 C56.604,8.896 62.168,15.912 65.444,26 L42.566,26 C45.844,15.928 51.404,8.902 54.002,5.824 Z" id="Shape" fill="#F37053"></path> </g> </g> </svg> Then I used msvgc to convert it to a react-native-svg compatible component. Lastly made changes so with works with import { Svg } from 'expo'. You'll notice that there is no longer a transform anyway so your original question is not needed. // Logo.js import React from 'react' import { Svg } from 'expo' const logo = props => ( <Svg width={props.width || 108} height={props.height || 128} viewBox="0 0 108 128"> <Svg.G fillRule="nonzero" fill="none"> <Svg.Ellipse fill="#DCDDDE" cx="54" cy="75" rx="52" ry="51"></Svg.Ellipse> <Svg.Path d="M81.764 76.608C79.316 75.5 75.758 74.198 72 73.81V61.414c5.408 2.636 8.866 8.704 9.764 15.194zM26.236 76.608c.898-6.49 4.356-12.556 9.764-15.196v12.392c-3.758.39-7.318 1.694-9.764 2.804zM40 76V42c0-4.32.562-8.322 1.448-12h25.108A51.108 51.108 0 0 1 68 42v34H40zM46 84v-4h16v4H48z" fill="#FFF"></Svg.Path> <Svg.Path d="M70 78V42C70 18 54 2 54 2v76h16z" fill="#DCDDDE"></Svg.Path> <Svg.Circle fill="#53B7E8" cx="54" cy="42" r="6"></Svg.Circle> <Svg.Path d="M98.8 100.76a51.654 51.654 0 0 1-7.84 10.02 51.539 51.539 0 0 1-7.64 6.3c-17.58 11.94-40.86 11.9-58.4-.12a50.5 50.5 0 0 1-7.48-6.18 52.123 52.123 0 0 1-8.06-10.38C11.4 96.6 15.4 94 20 94c5.48 0 10.1 3.7 11.54 8.74C33.3 99.9 36.42 98 40 98a10 10 0 0 1 9.8 8h.2V86h8v20h.2a10 10 0 0 1 9.8-8c3.58 0 6.7 1.9 8.46 4.74C77.88 97.7 82.5 94 88 94c4.74 0 8.84 2.76 10.8 6.76z" fill="#FFD768"></Svg.Path> <Svg.Path fill="#DCDDDE" d="M54 80h8v4h-8z"></Svg.Path> <Svg.Path d="M91.414 36.586L90 35.172 87.172 38l1.414 1.414C98.67 49.5 104 61.458 104 74c0 8.056-1.904 15.812-5.478 22.778A13.905 13.905 0 0 0 88 92c-5.052 0-9.646 2.752-12.106 6.988A11.857 11.857 0 0 0 68 96a12.009 12.009 0 0 0-8 3.062V88h6v-8h6v-2.156c5.584.702 10.886 3.82 10.966 3.87L86 83.538V80c0-9.762-5.136-19.778-14-22.948V42C72 17.454 56.092 2.09 55.414 1.414L54 0l-1.414 1.414C51.908 2.09 36 17.454 36 42v15.052C27.136 60.222 22 70.238 22 80l.002 3.538 3.032-1.824c.082-.05 5.384-3.172 10.966-3.872V80h6v8h6v11.062A12.009 12.009 0 0 0 40 96a11.85 11.85 0 0 0-7.9 2.994C29.628 94.754 25.036 92 20 92c-4.09 0-7.884 1.794-10.514 4.794C5.906 89.824 4 82.06 4 73.998 4 61.458 9.33 49.5 19.414 39.414L20.828 38 18 35.172l-1.414 1.414C5.736 47.438 0 60.376 0 73.998c0 14.426 5.618 27.986 15.816 38.186C26.344 122.71 40.172 128 54 128c13.828 0 27.656-5.29 38.184-15.816C102.382 101.984 108 88.424 108 74c0-13.624-5.736-26.562-16.586-37.414zm-9.65 40.022C79.316 75.5 75.758 74.198 72 73.81V61.414c5.408 2.636 8.866 8.704 9.764 15.194zM54.002 5.824C56.604 8.896 62.168 15.912 65.444 26H42.566c3.278-10.072 8.838-17.098 11.436-20.176zM26.236 76.608c.898-6.49 4.356-12.556 9.764-15.196v12.392c-3.758.39-7.318 1.694-9.764 2.804zM40 76V42c0-4.32.562-8.322 1.448-12h25.108A51.108 51.108 0 0 1 68 42v34H40zm6 8v-4h16v4H46zm43.356 25.356c-19.496 19.494-51.216 19.494-70.71 0a50.398 50.398 0 0 1-7.012-8.798C13.48 97.732 16.598 96 20 96c4.436 0 8.39 2.998 9.618 7.29l1.242 4.348 2.38-3.844c1.472-2.376 4-3.794 6.76-3.794 3.794 0 7.092 2.69 7.838 6.394l.326 1.606H52V88h4v20h3.836l.324-1.606C60.908 102.69 64.206 100 68 100c2.76 0 5.288 1.418 6.76 3.792l2.394 3.864 1.232-4.374C79.592 98.994 83.546 96 88 96c3.426 0 6.528 1.718 8.372 4.55a50.456 50.456 0 0 1-7.016 8.806z" fill="#0C3847"></Svg.Path> <Svg.Path d="M54 34c-4.412 0-8 3.588-8 8s3.588 8 8 8 8-3.588 8-8-3.588-8-8-8zm0 12c-2.206 0-4-1.794-4-4s1.794-4 4-4 4 1.794 4 4-1.794 4-4 4zM78 16h4v-4h4V8h-4V4h-4v4h-4v4h4zM14 26h4v-4h4v-4h-4v-4h-4v4h-4v4h4zM96 32h4v-4h4v-4h-4v-4h-4v4h-4v4h4zM84 46v2h-2v4h2v2h4v-2h2v-4h-2v-2zM26 44h4v-2h2v-4h-2v-2h-4v2h-2v4h2zM26 8h4V6h2V2h-2V0h-4v2h-2v4h2z" fill="#0C3847"></Svg.Path> <Svg.Path d="M54.002 5.824C56.604 8.896 62.168 15.912 65.444 26H42.566c3.278-10.072 8.838-17.098 11.436-20.176z" fill="#F37053"></Svg.Path> </Svg.G> </Svg> ) export default logo
AWK - Select lines to print according to score
I have a tab-separated file containing a series of lemmas with associated scores. The file contains 5 columns, the first column is the lemma and the third is the one that contains the score. What I need to do is print the line as it is, when lemma is not repeated and print the line with the highest score when lemma is repeated. IN Lemma --- Score --- --- cserép 06a 55 6 bueno darázs 05 38 1 bueno dél 06a 34 1 bueno dér 06a 29 1 bueno díj 05 14 89 malo díj 06a 2 101 malo díj 06b 2 101 malo díj 07 90 13 bueno díj 08a 2 101 malo díj 08b 2 101 malo egér 06a 66 5 bueno fonal 05 12 1 bueno fonal 07 52 4 bueno Desired output Lemma --- Score --- --- cserép 06a 55 6 bueno darázs 05 38 1 bueno dél 06a 34 1 bueno dér 06a 29 1 bueno díj 07 90 13 bueno egér 06a 66 5 bueno fonal 07 52 4 malo What I have done. But it only works when the lemma is repeated once. BEGIN { OFS=FS="\t"; flag=""; } { id=$1; if (id != flag) { if (line != "") { sub("^;","",line); z=split(line,A,";"); if ((A[3] > A[8]) && (A[8] != "")) { print A[1]"\t"A[2]"\t"A[3]"\t"A[4]"\t"A[5]; } else if ((A[8] > A[3]) && (A[8] != "")) { print A[6]"\t"A[7]"\t"A[8]"\t"A[9]"\t"A[10] } else { print A[1]"\t"A[2]"\t"A[3]"\t"A[4]"\t"A[5]; } } delete line; flag=id; } line[$1]=line[$1]";"$2";"$3";"$4";"$5; } END { line=line ";"$1";"$2";"$3";"$4";"$5 sub("^;","",line); z=split(line,A,";"); if ((A[3] > A[8]) && (A[8] != "")) { print A[1]"\t"A[2]"\t"A[3]"\t"A[4]"\t"A[5]; } else if ((A[8] > A[3]) && (A[8] != "")) { print A[6]"\t"A[7]"\t"A[8]"\t"A[9]"\t"A[10] } else { print A[1]"\t"A[2]"\t"A[3]"\t"A[4]"\t"A[5] } }
This one doesn't require the file to be sorted by lemma, but, it keeps all the lines to be printed in memory (one for each lemma) so may not be appropriate for a file with millions of different lemmas. It also does not respect the order of the original file. Finally, it assumes that all scores are non-negative! $ cat lemma.awk BEGIN { FS = OFS = "\t" } NR == 1 { print } NR > 1 { if ($3 > score[$1]) { score[$1] = $3 line[$1] = $0 } } END { for (lemma in line) print line[lemma] } $ awk -f lemma.awk lemma.txt Lemma --- Score --- --- cserép 06a 55 6 bueno díj 07 90 13 bueno fonal 07 52 4 bueno darázs 05 38 1 bueno egér 06a 66 5 bueno dél 06a 34 1 bueno dér 06a 29 1 bueno
Tested with gnu awk: prevLemma != $1 { if( prevLemma ) { print line; } prevLemma = $1; prevScore = $3; line = $0; } prevLemma == $1 { if( prevScore < $3 ) { prevScore = $3; line = $0; } } END { print line;} assumption is: the file is sorted by lemma when the lemma changes (or at the very beginning when the var is empty) the lemma, score and line are saved when the lemma changes (or in the END), the line for the previous lemma is printed when the current line belongs to the same lemma and has a higher score the values are saved again
$ cat tst.awk $1 != prev { printf "%s", maxLine; maxLine=""; max=$3; prev=$1 } $3 >= max { max=$3; maxLine=$0 ORS } END { printf "%s", maxLine } $ awk -f tst.awk file Lemma --- Score --- --- cserép 06a 55 6 bueno darázs 05 38 1 bueno dél 06a 34 1 bueno dér 06a 29 1 bueno díj 07 90 13 bueno egér 06a 66 5 bueno fonal 07 52 4 bueno
Use a script: if ($1 != $5) print $0 else { score($NR) = $3 print $0 } Actually , this might be better done with perl.