[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fast copy of buffer data into a matrix
From: |
John W. Eaton |
Subject: |
Re: Fast copy of buffer data into a matrix |
Date: |
Fri, 9 Feb 2007 12:37:47 -0500 |
On 9-Feb-2007, John Swensen wrote:
| static Matrix m1(settings.width, settings.height);
| static uint8NDArray m = octave_value(m1).uint8_array_value();
| static octave_uint8* tmp = m.fortran_vec();
| memcpy( tmp, capturebuffer, settings.height*settings.width );
| return octave_value(m.transpose());
Why are you using static qualifiers here? Since you haven't provided
a complete example, it's hard to tell if it is appropriate, but it
seems like it might cause trouble for these to be static when settings
appears to be a varible. If this is in a function, think about what
will happen on a subsequent call when settings.width and
settings.height have different values (since they are static, m1, m,
and your tmp buffer will not be resized to accomodate the new
dimensions).
| As a side note, when using mkoctfile with the -p option, is there any
| way to get a complete list of all the include flags and all the ld
| flags? I need to link with a static library and mkoctfile won't allow
| me to specify a 'libfoo.a' file in the list of object files. So, I need
| to build the link up and would like to use 'mkoctfile -p', but don't
| want to have it start looking like 'mkoctfile -p LDFLAGS LD_CXX
| LD_STATIC_FLAG LIBS LFLAGS LIBCRUFT LIBOCTAVE LIBOCTINTERP ETC'
How about proposing a patch that makes it handle .a files?
jwe