Mercurial > hg > may
changeset 215:c4f4e8def0aa matrix_opaque_immutable
Update channels
author | Chris Cannam |
---|---|
date | Sat, 11 May 2013 11:46:44 +0100 |
parents | 709fba377099 |
children | b251e1ab953d |
files | yetilab/stream/channels.yeti |
diffstat | 1 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/yetilab/stream/channels.yeti Sat May 11 11:39:09 2013 +0100 +++ b/yetilab/stream/channels.yeti Sat May 11 11:46:44 2013 +0100 @@ -3,6 +3,15 @@ vec = load yetilab.block.vector; mat = load yetilab.matrix.matrix; + +load yetilab.block.vectortype; + +//!!! "internal" vector function to retrieve data for read-only +// purposes without copying +//!!! need to have this in some internal-use module +raw = + (raw' v is ~double[] -> ~double[] = v; + raw' as vector -> ~double[]); interleaved m = ({ columns, rows } = (mat.size m); @@ -24,7 +33,7 @@ else rows = (vec.length b) / channels; vv = array (map \(new double[rows]) [0..channels-1]); - v = vec.data b; + v = raw b; for [0..rows-1] do row: for [0..channels-1] do col: vv[col][row] := v[channels * row + col]; @@ -47,8 +56,8 @@ if channels == 1 then b; else - v = vec.data b; - columns = ((vec.length v) / channels); + columns = ((vec.length b) / channels); + v = raw b; v' = new double[columns]; for [0..channels-1] do row: for [0..columns-1] do col: @@ -64,8 +73,8 @@ elif targetChannels == 1 then mixedDownFromInterleaved channels b; else - v = vec.data b; - columns = ((vec.length v) / channels); + columns = ((vec.length b) / channels); + v = raw b; v' = new double[columns * targetChannels]; for [0..targetChannels-1] do target: for [0..columns-1] do col: