help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fast copy of buffer data into a matrix


From: John Swensen
Subject: Re: Fast copy of buffer data into a matrix
Date: Fri, 09 Feb 2007 15:21:02 -0500
User-agent: Thunderbird 2.0a1 (X11/20060807)

John W. Eaton wrote:
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

I was using static qualifiers to keep octave from creating a new variable each time. I knew quite well that th size could be a problem if I tried to change the image size.

Also, here is a patch for mkoctfile.in. It ended up being a lot easier than I thought it would.

John Swensen
Index: mkoctfile.in
===================================================================
RCS file: /cvs/octave/mkoctfile.in,v
retrieving revision 1.54
diff -u -r1.54 mkoctfile.in
--- mkoctfile.in        29 Nov 2006 01:59:59 -0000      1.54
+++ mkoctfile.in        9 Feb 2007 19:04:38 -0000
@@ -120,6 +120,10 @@
       file=$1
       objfiles="$objfiles $file"
     ;;
+    *.a)
+      file=$1
+      objfiles="$objfiles $file"
+    ;;
     -d | --debug | -v | --verbose)
       dbg=echo
     ;;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]