Skip to content

Commit 722b21a

Browse files
committed
vfx: lcd: update default fft scale
1 parent 0beb9a9 commit 722b21a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

main/src/user/vfx.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ static void vfx_task(void *pvParameter)
140140
xEventGroupSetBits(user_event_group, VFX_FFT_NULL_BIT);
141141

142142
fft_amp[0] = sqrt(pow(vfx_fft_output[0], 2) + pow(vfx_fft_output[1], 2)) / FFT_N;
143-
fft_out[0] = fft_amp[0] / (65536 / vfx_disp_height) * vfx.scale_factor;
143+
fft_out[0] = fft_amp[0] / (65536 / vfx_disp_height) * vfx.scale_factor * 2;
144144
if (fft_out[0] > vfx_disp_height) {
145145
fft_out[0] = vfx_disp_height;
146146
} else if (fft_out[0] < 1) {
@@ -149,7 +149,7 @@ static void vfx_task(void *pvParameter)
149149

150150
for (uint16_t k=1; k<FFT_N/2; k++) {
151151
fft_amp[k] = sqrt(pow(vfx_fft_output[2*k], 2) + pow(vfx_fft_output[2*k+1], 2)) / FFT_N * 2;
152-
fft_out[k] = fft_amp[k] / (65536 / vfx_disp_height) * vfx.scale_factor;
152+
fft_out[k] = fft_amp[k] / (65536 / vfx_disp_height) * vfx.scale_factor * 2;
153153
if (fft_out[k] > vfx_disp_height) {
154154
fft_out[k] = vfx_disp_height;
155155
} else if (fft_out[k] < 1) {
@@ -240,7 +240,7 @@ static void vfx_task(void *pvParameter)
240240
xEventGroupSetBits(user_event_group, VFX_FFT_NULL_BIT);
241241

242242
fft_amp[0] = sqrt(pow(vfx_fft_output[0], 2) + pow(vfx_fft_output[1], 2)) / FFT_N;
243-
fft_out[0] = fft_amp[0] / (65536 / vfx_disp_height) * vfx.scale_factor;
243+
fft_out[0] = fft_amp[0] / (65536 / vfx_disp_height) * vfx.scale_factor * 2;
244244
if (fft_out[0] > vfx_disp_height) {
245245
fft_out[0] = vfx_disp_height;
246246
} else if (fft_out[0] < 1) {
@@ -249,7 +249,7 @@ static void vfx_task(void *pvParameter)
249249

250250
for (uint16_t k=1; k<FFT_N/2; k++) {
251251
fft_amp[k] = sqrt(pow(vfx_fft_output[2*k], 2) + pow(vfx_fft_output[2*k+1], 2)) / FFT_N * 2;
252-
fft_out[k] = fft_amp[k] / (65536 / vfx_disp_height) * vfx.scale_factor;
252+
fft_out[k] = fft_amp[k] / (65536 / vfx_disp_height) * vfx.scale_factor * 2;
253253
if (fft_out[k] > vfx_disp_height) {
254254
fft_out[k] = vfx_disp_height;
255255
} else if (fft_out[k] < 1) {
@@ -466,7 +466,7 @@ static void vfx_task(void *pvParameter)
466466
xEventGroupSetBits(user_event_group, VFX_FFT_NULL_BIT);
467467

468468
fft_amp[0] = sqrt(pow(vfx_fft_output[0], 2) + pow(vfx_fft_output[1], 2)) / FFT_N;
469-
fft_out[0] = 20 * log10(fft_amp[0]) / (65536 / vfx_disp_height) * vfx.scale_factor;
469+
fft_out[0] = 20 * log10(fft_amp[0]) / (65536 / vfx_disp_height) * vfx.scale_factor * 2;
470470
if (fft_out[0] > center_y) {
471471
fft_out[0] = center_y;
472472
} else if (fft_out[0] < 0) {
@@ -475,7 +475,7 @@ static void vfx_task(void *pvParameter)
475475

476476
for (uint16_t k=1; k<FFT_N/2; k++) {
477477
fft_amp[k] = sqrt(pow(vfx_fft_output[2*k], 2) + pow(vfx_fft_output[2*k+1], 2)) / FFT_N * 2;
478-
fft_out[k] = 20 * log10(fft_amp[k]) / (65536 / vfx_disp_height) * vfx.scale_factor;
478+
fft_out[k] = 20 * log10(fft_amp[k]) / (65536 / vfx_disp_height) * vfx.scale_factor * 2;
479479
if (fft_out[k] > center_y) {
480480
fft_out[k] = center_y;
481481
} else if (fft_out[k] < 0) {
@@ -570,7 +570,7 @@ static void vfx_task(void *pvParameter)
570570
xEventGroupSetBits(user_event_group, VFX_FFT_NULL_BIT);
571571

572572
fft_amp[0] = sqrt(pow(vfx_fft_output[0], 2) + pow(vfx_fft_output[1], 2)) / FFT_N;
573-
fft_out[0] = 20 * log10(fft_amp[0]) / (65536 / vfx_disp_height) * vfx.scale_factor;
573+
fft_out[0] = 20 * log10(fft_amp[0]) / (65536 / vfx_disp_height) * vfx.scale_factor * 2;
574574
if (fft_out[0] > center_y) {
575575
fft_out[0] = center_y;
576576
} else if (fft_out[0] < 0) {
@@ -579,7 +579,7 @@ static void vfx_task(void *pvParameter)
579579

580580
for (uint16_t k=1; k<FFT_N/2; k++) {
581581
fft_amp[k] = sqrt(pow(vfx_fft_output[2*k], 2) + pow(vfx_fft_output[2*k+1], 2)) / FFT_N * 2;
582-
fft_out[k] = 20 * log10(fft_amp[k]) / (65536 / vfx_disp_height) * vfx.scale_factor;
582+
fft_out[k] = 20 * log10(fft_amp[k]) / (65536 / vfx_disp_height) * vfx.scale_factor * 2;
583583
if (fft_out[k] > center_y) {
584584
fft_out[k] = center_y;
585585
} else if (fft_out[k] < 0) {

0 commit comments

Comments
 (0)