The buffer protocol has been implemented #443
Replies: 8 comments 1 reply
-
Hi, I recently discovered your great work on python4Delphi. As I am a Linux/Lazarus/FPC user it would be handy if your announcements clarify if new features are also available for the FPC. Ive tried to run the Demo35 but it fails on FPC (even after changing the inline variants). Nothing unexpected but adding this in the announcement can help users. Keep up the good work ! cheers waveSharp Free Image sharpen Software TeensyBat Bat Detector RegiStax Free Image Processing Software |
Beta Was this translation helpful? Give feedback.
-
The buffer protocol stuff is FPC compatible. Although Demo35 may not work in FPC out of the box, it can be easily made FPC compatible, by rewriting the loop involving the VarPyIterate as a standard for loop. There is a Wiki page Supported Platforms discussing the level of FPC support in general. The master branch of FPC contains fixes to the variants issue, anonymous functions and importantly an Rtti unit. When it gets released, I will revisit the level of FPC compatibility, since it may well be possible to bring FPC support much closer to the Delphi support. And by the way, I am looking for a volunteer to convert at least some of the tests (in the Tests subdirectory) to FPC, so that we know exactly what it does and what it doesn't work in FPC. Is it something you can help with? |
Beta Was this translation helpful? Give feedback.
-
Hi, I have tried to use that demo but cannot get this line working And on your request for a volunteer, you contact me on registax at gmail dot com as I am interested to help. Cor |
Beta Was this translation helpful? Give feedback.
-
Here is an FPC translation of Demo35 that works. I will email you regarding the tests, |
Beta Was this translation helpful? Give feedback.
-
Added Demo35 to FPC demos. |
Beta Was this translation helpful? Give feedback.
-
Output (only needed to change the dll to a linux library)
|
Beta Was this translation helpful? Give feedback.
-
TIntArray = array[0..N - 1] of int64; |
Beta Was this translation helpful? Give feedback.
-
That speed is very promissing BTW. I hope this scales for larger matrices also. The project I am trying to use this in uses large matrices (images of 5000x4000 pixels) that get processed with openCV in python (using P4D) and I currently get the results back by saving a file. I read that file back into Lazarus. |
Beta Was this translation helpful? Give feedback.
-
The buffer protocol has been implemented in P4D. A new demo (Demo 35) has been added, that shows how you can achieve super fast read/write access to numpy arrays using this protocol.
Beta Was this translation helpful? Give feedback.
All reactions