Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork320
The buffer protocol has been implemented#443
-
Thebuffer 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. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
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 |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
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 pageSupported 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? |
BetaWas this translation helpful?Give feedback.
All reactions
-
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 |
BetaWas this translation helpful?Give feedback.
All reactions
-
Here is an FPC translation of Demo35 that works. I will email you regarding the tests, |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Added Demo35 to FPC demos. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Output (only needed to change the dll to a linux library)
|
BetaWas this translation helpful?Give feedback.
All reactions
-
On Windows I get:
The sum is the same. I think on Linux the buffer contains Int64 values. Could you please check whether casting to an Int64 array in line 100 resolves the issue? |
BetaWas this translation helpful?Give feedback.
All reactions
-
TIntArray = array[0..N - 1] of int64; |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 1
-
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. |
BetaWas this translation helpful?Give feedback.