diff options
Diffstat (limited to 'src/modules/audio_processing/aecm/main/matlab/matlab/getBspectrum.m')
-rw-r--r-- | src/modules/audio_processing/aecm/main/matlab/matlab/getBspectrum.m | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/modules/audio_processing/aecm/main/matlab/matlab/getBspectrum.m b/src/modules/audio_processing/aecm/main/matlab/matlab/getBspectrum.m new file mode 100644 index 0000000000..a4a533d600 --- /dev/null +++ b/src/modules/audio_processing/aecm/main/matlab/matlab/getBspectrum.m @@ -0,0 +1,22 @@ +function bspectrum=getBspectrum(ps,threshold,bandfirst,bandlast) +% function bspectrum=getBspectrum(ps,threshold,bandfirst,bandlast) +% compute binary spectrum using threshold spectrum as pivot +% bspectrum = binary spectrum (binary) +% ps=current power spectrum (float) +% threshold=threshold spectrum (float) +% bandfirst = first band considered +% bandlast = last band considered + +% initialization stuff + if( length(ps)<bandlast | bandlast>32 | length(ps)~=length(threshold)) + error('BinDelayEst:spectrum:invalid','Dimensionality error'); +end + +% get current binary spectrum +diff = ps - threshold; +bspectrum=uint32(0); +for(i=bandfirst:bandlast) + if( diff(i)>0 ) + bspectrum = bitset(bspectrum,i); + end +end |