Erik de Castro Lopo | 1 Jan 2007 11:34
Favicon

freetype2/camlimages/lablgl

Hi all,

Does anyone have any example code that uses the freetype bindings
that come as part of camlimages in lablgl?I simply don't have
any idea of where to start with this. Basically, what I'd like to 
do is draw a string in 3 dimensional text.

Erik
--

-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"Cunnilinugus and psychiatry brought us to this."
  -- Tony Soprano in HBO's "the Sopranos"

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Matthieu Dubuget | 1 Jan 2007 15:53
Picon
Gravatar

Re: ANNOUNCE : libsndfile-ocaml alpha

Erik de Castro Lopo a écrit :
> Richard Jones wrote:
>
>   
>> On Sun, Dec 31, 2006 at 03:23:05PM +1100, Erik de Castro Lopo wrote:
>>     
>>> Since it is already possible to read Ocaml floats (which are normalised
>>> to the range [-1.0, 1.0]) why would anyone want to ready any other data
>>> type?
>>>       
>> Two reasons I can think of[*]: (a) to avoid copying, (b) to make an
>> exact reproduction (without the conversion to and from float).
>>     
>
> Well the amount of copying is the same whether I use bigarray or a 
> standard Ocaml float array so (a) is irrelevant.
>   
Is it really the case? I thought that it was possible to create a
bigarray wrapping a C array without
copying datas. I do not know how to achieve this for float arrays?

This could be interesting for read-only access or in-place modifications?

Another very interesting feature of bigarrays is the memory mapping of a
file as a big array, very useful to work with BIG files.

Matt

_______________________________________________
Caml-list mailing list. Subscription management:
(Continue reading)

Erik de Castro Lopo | 1 Jan 2007 20:58
Favicon

Re: ANNOUNCE : libsndfile-ocaml alpha

Matthieu Dubuget wrote:

> Is it really the case? I thought that it was possible to create a
> bigarray wrapping a C array without
> copying datas. I do not know how to achieve this for float arrays?

When reading files libsndfile always does at least one copy; from
the disk to the array supplied by the caller. This single copy 
only occurs if the data requested by the caller is the same format
and endian-ness as the format requested by the caller. When the data
formats are not the same two copies are required; from the disk to
and buffer internal to libsndfile and then a copy/data conversion
to the buffer suppiled by the caller.

The above doesn't change regardless of whether the caller supplies
an Ocaml float array or a bigarray.

In addition, I also regard the most common case to be the one where 
a data convesion takes place between the file format and the format
requested by the caller.

> This could be interesting for read-only access or in-place modifications?

I don't see how this would be different float array vs bigarray.

> Another very interesting feature of bigarrays is the memory mapping of a
> file as a big array, very useful to work with BIG files.

Firstly, libsndfile doesn't use mem-mapping because the most common case
is where the disk format is different from the file format. Secondly I
(Continue reading)

skaller | 2 Jan 2007 01:51
Picon

Re: ANNOUNCE : libsndfile-ocaml alpha

On Tue, 2007-01-02 at 06:58 +1100, Erik de Castro Lopo wrote:
> That file
> is:
> 
>     96000 * 60 * 60 * 8 * 4 bytes => 
>     11059.200 Mbytes =>
>     11.059 Gbytes
> 
> Nobody is going to load the whole of that file into memory at once. 

Why not? That's tiny compared to available address space on a 64
bit machine, and personal computers have heaps
of free address space.

--

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Erik de Castro Lopo | 2 Jan 2007 02:14
Favicon

Re: ANNOUNCE : libsndfile-ocaml alpha

skaller wrote:

> On Tue, 2007-01-02 at 06:58 +1100, Erik de Castro Lopo wrote:
> > That file
> > is:
> > 
> >     96000 * 60 * 60 * 8 * 4 bytes => 
> >     11059.200 Mbytes =>
> >     11.059 Gbytes
> > 
> > Nobody is going to load the whole of that file into memory at once. 
> 
> Why not? That's tiny compared to available address space on a 64
> bit machine, and personal computers have heaps
> of free address space

Ok, so someone writes a simple application that loads the whole file
into memory and then plays it. Unfortunately disk transfer speeds being
in the order of 100 Mb/sec means that its going to take 110 seconds to
load that file. Thats bad!

Obviously, the smart way to do it is to stream that file off disk 100kB
chunks at a time. Thats what libsndfile is designed and optimised for.

Erik
--

-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"C++ is a language strongly optimized for liars and people who 
(Continue reading)

Erick Tryzelaar | 2 Jan 2007 06:26
Favicon

Re: ANNOUNCE : libsndfile-ocaml alpha

Erik de Castro Lopo wrote:
> skaller wrote:
>   
>> Why not? That's tiny compared to available address space on a 64
>> bit machine, and personal computers have heaps
>> of free address space
>>     
>
> Ok, so someone writes a simple application that loads the whole file
> into memory and then plays it. Unfortunately disk transfer speeds being
> in the order of 100 Mb/sec means that its going to take 110 seconds to
> load that file. Thats bad!
>
> Obviously, the smart way to do it is to stream that file off disk 100kB
> chunks at a time. Thats what libsndfile is designed and optimised for.
>
> Erik
>   

But a mem-mapped file shouldn't be loaded into physical memory until 
it's accessed, and then only the page that has the data, right?

-e

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
(Continue reading)

Erik de Castro Lopo | 2 Jan 2007 06:39
Favicon

Re: ANNOUNCE : libsndfile-ocaml alpha

Erick Tryzelaar wrote:

> But a mem-mapped file shouldn't be loaded into physical memory until 
> it's accessed, and then only the page that has the data, right?

But libsndfile doesn't use mem-mapping to access files, only read/write.

Erik
--

-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"I could never learn to use C++, because of the completely 
overwhelming desire to redesign the language every time I tried 
to use it, but this is the normal, healthy reaction to C++."
-- Erik Naggum

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Christoph Bauer | 2 Jan 2007 08:47
Picon
Favicon

Re: ANNOUNCE : libsndfile-ocaml alpha

skaller <skaller <at> users.sourceforge.net> writes:

> On Tue, 2007-01-02 at 06:58 +1100, Erik de Castro Lopo wrote:
>> That file
>> is:
>> 
>>     96000 * 60 * 60 * 8 * 4 bytes => 
>>     11059.200 Mbytes =>
>>     11.059 Gbytes
>> 
>> Nobody is going to load the whole of that file into memory at once. 
>
> Why not? That's tiny compared to available address space on a 64
> bit machine, and personal computers have heaps
> of free address space.

I had to deal with big files and OCaml too and Erik's approach
sound good to me. 

On 64 bit machines you may mmap huge files, but you can't on 32-bit
machines. I run in troubles with files > 700MB.  Maybe you could mmap
smaller blocks, but this isn't possible with the current
implementation of bigarrays mmap (since you need to mmap with an
offset). Furthermore mmap is a bit different on different operation
system.

Measurements show that mmap doesn't mean a big (or any) speed
up. For the OS the advantage is, that no swap space needs to be
reservered.

(Continue reading)

Erik de Castro Lopo | 2 Jan 2007 11:32
Favicon

Wrapping C++ in Ocaml?

Hi all,

I have wrapped a C library for use with Ocaml and didn't find 
the task too daunting. I have now found a C++ library that would
be useful, but the Ocaml ORA book makes no mention of wrapping
C++ libraries.

Has anyone got any experience wrapping C++ libraries in Ocaml?
Is it possible? Painful but doable? Too painful to think about?

Any pointers or advice appreciated.

Cheers,
Erik
--

-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
"I consider C++ the most significant technical hazard to the survival
of your project and do so without apologies." -- Alistair Cockburn

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Vu Ngoc San | 2 Jan 2007 11:56
Picon
Picon
Favicon

Re: ANNOUNCE : libsndfile-ocaml alpha

I was thinking of using libsndfile in combination with the ocaml-gsl 
(gnu scientific library), and the latter uses bigarray, afaik. I am just 
wondering whether then it would be appropriate to have bigarrays from 
libsndfile. If not, fine for me. That was just naive remark.

San

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Gmane