From 51904d2cca8270357ca07c5cb01f9d1cfecd812a Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Sun, 7 May 2017 11:04:14 +0200 Subject: [PATCH] FFT is somewhat better now --- csdr.py | 5 +++-- htdocs/openwebrx.js | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/csdr.py b/csdr.py index be70ff8..be287eb 100755 --- a/csdr.py +++ b/csdr.py @@ -89,7 +89,7 @@ class dsp: def secondary_chain(self, which): secondary_chain_base="cat {input_pipe} | " if which == "fft": - return secondary_chain_base+"csdr realpart_cf | csdr fft_fc {secondary_fft_size} {secondary_fft_block_size} | csdr logpower_cf -70 | csdr fft_one_side_ff {secondary_fft_size}" + (" | csdr compress_fft_adpcm_f_u8 {secondary_fft_size}" if self.fft_compression=="adpcm" else "") + return secondary_chain_base+"csdr realpart_cf | csdr fft_fc {secondary_fft_input_size} {secondary_fft_block_size} | csdr logpower_cf -70 | csdr fft_one_side_ff {secondary_fft_size}" + (" | csdr compress_fft_adpcm_f_u8 {secondary_fft_size}" if self.fft_compression=="adpcm" else "") elif which == "bpsk31": return secondary_chain_base + ("csdr shift_addition_cc {secondary_shift_pipe} | " if 0 else "") + \ "csdr bandpass_fir_fft_cc -{secondary_bpf_cutoff} {secondary_bpf_cutoff} {secondary_bpf_transition_bw} HAMMING | " + \ @@ -115,7 +115,7 @@ class dsp: self.secondary_demodulator = what def secondary_fft_block_size(self): - return (self.samp_rate/self.decimation)/self.fft_fps + return (self.samp_rate/self.decimation)/(self.fft_fps*2) #*2 is there because we do FFT on real signal here def secondary_decimation(self): return 1 #currently unused @@ -144,6 +144,7 @@ class dsp: secondary_command_fft=secondary_command_fft.format( \ input_pipe=self.iqtee_pipe, \ + secondary_fft_input_size=self.secondary_fft_size*2, \ secondary_fft_size=self.secondary_fft_size, \ secondary_fft_block_size=self.secondary_fft_block_size(), \ ) diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index 13c3866..16b020c 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1721,7 +1721,7 @@ var canvas_phantom; function add_canvas() { - new_canvas = document.createElement("canvas"); + var new_canvas = document.createElement("canvas"); new_canvas.width=fft_size; new_canvas.height=canvas_default_height; canvas_actual_line=canvas_default_height-1; @@ -2272,7 +2272,8 @@ function secondary_demod_canvases_update_top() function secondary_demod_swap_canvases() { - secondary_demod_canvases[0+!secondary_demod_current_canvas_index].style.openwebrx_top-=$(secondary_demod_canvas_container).height()*2; + console.log("swap"); + secondary_demod_canvases[0+!secondary_demod_current_canvas_index].openwebrx_top-=$(secondary_demod_canvas_container).height()*2; secondary_demod_current_canvas_index=0+!secondary_demod_current_canvas_index; secondary_demod_current_canvas_context = secondary_demod_canvases[secondary_demod_current_canvas_index].getContext("2d"); secondary_demod_current_canvas_actual_line=$(secondary_demod_canvas_container).height()-1; @@ -2330,6 +2331,8 @@ function secondary_demod_close_window() toggle_panel("openwebrx-panel-digimodes", false); } +secondary_demod_fft_offset_db=30; //need to calculate that later + function secondary_demod_waterfall_add(data) { if(!secondary_demod) return; @@ -2339,12 +2342,11 @@ function secondary_demod_waterfall_add(data) var oneline_image = secondary_demod_current_canvas_context.createImageData(w,1); for(x=0;x>>0)>>((3-i)*8))&0xff; } //Draw image - console.log(oneline_image); secondary_demod_current_canvas_context.putImageData(oneline_image, 0, secondary_demod_current_canvas_actual_line--); secondary_demod_canvases.map((x)=>{x.openwebrx_top += 1;}); secondary_demod_canvases_update_top();