FFT is somewhat better now

This commit is contained in:
ha7ilm 2017-05-07 11:04:14 +02:00
parent 0357c8b3ed
commit 51904d2cca
2 changed files with 9 additions and 6 deletions

View File

@ -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(), \
)

View File

@ -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<w;x++)
{
var color=waterfall_mkcolor(data[x]+30);
var color=waterfall_mkcolor(data[x]+secondary_demod_fft_offset_db);
for(i=0;i<4;i++) oneline_image.data[x*4+i] = ((color>>>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();