Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -392,29 +392,29 @@ static int run_channel_fft(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo · 391 unmodified lines | ||
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | if (s->stop) { |
| 395 | − double theta, phi, psi, a, b, S, c; | |
| 395 | + float theta, phi, psi, a, b, S, c; | |
| 396 | 396 | FFTComplex *g = s->fft_data[ch]; |
| 397 | 397 | FFTComplex *h = s->fft_scratch[ch]; |
| 398 | 398 | int L = s->buf_size; |
| 399 | 399 | int N = s->win_size; |
| 400 | 400 | int M = s->win_size / 2; |
| 401 | 401 | |
| 402 | − phi = 2.0 * M_PI * (s->stop - s->start) / (double)inlink->sample_rate / (M - 1); | |
| 403 | − theta = 2.0 * M_PI * s->start / (double)inlink->sample_rate; | |
| 402 | + phi = 2.f * M_PI * (s->stop - s->start) / (float)inlink->sample_rate / (M - 1); | |
| 403 | + theta = 2.f * M_PI * s->start / (float)inlink->sample_rate; | |
| 404 | 404 | |
| 405 | 405 | for (int n = 0; n < M; n++) { |
| 406 | − h[n].re = cos(n * n / 2.0 * phi); | |
| 407 | − h[n].im = sin(n * n / 2.0 * phi); | |
| 406 | + h[n].re = cosf(n * n / 2.f * phi); | |
| 407 | + h[n].im = sinf(n * n / 2.f * phi); | |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | for (int n = M; n < L; n++) { |
| 411 | − h[n].re = 0.0; | |
| 412 | − h[n].im = 0.0; | |
| 411 | + h[n].re = 0.f; | |
| 412 | + h[n].im = 0.f; | |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | for (int n = L - N; n < L; n++) { |
| 416 | − h[n].re = cos((L - n) * (L - n) / 2.0 * phi); | |
| 417 | − h[n].im = sin((L - n) * (L - n) / 2.0 * phi); | |
| 416 | + h[n].re = cosf((L - n) * (L - n) / 2.f * phi); | |
| 417 | + h[n].im = sinf((L - n) * (L - n) / 2.f * phi); | |
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | for (int n = 0; n < N; n++) { |
| @@ -423,14 +423,14 @@ static int run_channel_fft(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo · 2 unmodified lines | ||
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | for (int n = N; n < L; n++) { |
| 426 | − g[n].re = 0.; | |
| 427 | − g[n].im = 0.; | |
| 426 | + g[n].re = 0.f; | |
| 427 | + g[n].im = 0.f; | |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | for (int n = 0; n < N; n++) { |
| 431 | − psi = n * theta + n * n / 2.0 * phi; | |
| 432 | − c = cos(psi); | |
| 433 | − S = -sin(psi); | |
| 431 | + psi = n * theta + n * n / 2.f * phi; | |
| 432 | + c = cosf(psi); | |
| 433 | + S = -sinf(psi); | |
| 434 | 434 | a = c * g[n].re - S * g[n].im; |
| 435 | 435 | b = S * g[n].re + c * g[n].im; |
| 436 | 436 | g[n].re = a; |
| @@ -457,9 +457,9 @@ static int run_channel_fft(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo · 20 unmodified lines | ||
| 457 | 457 | av_fft_calc(s->ifft[ch], g); |
| 458 | 458 | |
| 459 | 459 | for (int k = 0; k < M; k++) { |
| 460 | − psi = k * k / 2.0 * phi; | |
| 461 | − c = cos(psi); | |
| 462 | − S = -sin(psi); | |
| 460 | + psi = k * k / 2.f * phi; | |
| 461 | + c = cosf(psi); | |
| 462 | + S = -sinf(psi); | |
| 463 | 463 | a = c * g[k].re - S * g[k].im; |
| 464 | 464 | b = S * g[k].re + c * g[k].im; |
| 465 | 465 | s->fft_data[ch][k].re = a; |
| @@ -555,15 +555,15 @@ static void color_range(ShowSpectrumContext *s, int ch, · 89 unmodified lines | ||
| 555 | 555 | |
| 556 | 556 | if (s->color_mode == CHANNEL) { |
| 557 | 557 | if (s->nb_display_channels > 1) { |
| 558 | − *uf *= 0.5 * sin((2 * M_PI * ch) / s->nb_display_channels + M_PI * s->rotation); | |
| 559 | − *vf *= 0.5 * cos((2 * M_PI * ch) / s->nb_display_channels + M_PI * s->rotation); | |
| 558 | + *uf *= 0.5f * sinf((2 * M_PI * ch) / s->nb_display_channels + M_PI * s->rotation); | |
| 559 | + *vf *= 0.5f * cosf((2 * M_PI * ch) / s->nb_display_channels + M_PI * s->rotation); | |
| 560 | 560 | } else { |
| 561 | − *uf *= 0.5 * sin(M_PI * s->rotation); | |
| 562 | − *vf *= 0.5 * cos(M_PI * s->rotation + M_PI_2); | |
| 561 | + *uf *= 0.5f * sinf(M_PI * s->rotation); | |
| 562 | + *vf *= 0.5f * cosf(M_PI * s->rotation + M_PI_2); | |
| 563 | 563 | } |
| 564 | 564 | } else { |
| 565 | − *uf += *uf * sin(M_PI * s->rotation); | |
| 566 | − *vf += *vf * cos(M_PI * s->rotation + M_PI_2); | |
| 565 | + *uf += *uf * sinf(M_PI * s->rotation); | |
| 566 | + *vf += *vf * cosf(M_PI * s->rotation + M_PI_2); | |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | *uf *= s->saturation; |
| @@ -854,7 +854,7 @@ static int draw_legend(AVFilterContext *ctx, int samples) · 284 unmodified lines | ||
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | for (y = 0; ch == 0 && y < h; y += h / 10) { |
| 857 | − float value = 120.0 * log10(1. - y / (float)h); | |
| 857 | + float value = 120.f * log10f(1.f - y / (float)h); | |
| 858 | 858 | char *text; |
| 859 | 859 | |
| 860 | 860 | if (value < -120) |
| @@ -896,19 +896,19 @@ static float get_value(AVFilterContext *ctx, int ch, int y) · 35 unmodified lines | ||
| 896 | 896 | a = av_clipf(a, 0, 1); |
| 897 | 897 | break; |
| 898 | 898 | case SQRT: |
| 899 | − a = av_clipf(sqrt(a), 0, 1); | |
| 899 | + a = av_clipf(sqrtf(a), 0, 1); | |
| 900 | 900 | break; |
| 901 | 901 | case CBRT: |
| 902 | − a = av_clipf(cbrt(a), 0, 1); | |
| 902 | + a = av_clipf(cbrtf(a), 0, 1); | |
| 903 | 903 | break; |
| 904 | 904 | case FOURTHRT: |
| 905 | − a = av_clipf(sqrt(sqrt(a)), 0, 1); | |
| 905 | + a = av_clipf(sqrtf(sqrtf(a)), 0, 1); | |
| 906 | 906 | break; |
| 907 | 907 | case FIFTHRT: |
| 908 | − a = av_clipf(pow(a, 0.20), 0, 1); | |
| 908 | + a = av_clipf(powf(a, 0.20), 0, 1); | |
| 909 | 909 | break; |
| 910 | 910 | case LOG: |
| 911 | − a = 1 + log10(av_clipd(a, 1e-6, 1)) / 6; // zero = -120dBFS | |
| 911 | + a = 1.f + log10f(av_clipf(a, 1e-6, 1)) / 6.f; // zero = -120dBFS | |
| 912 | 912 | break; |
| 913 | 913 | default: |
| 914 | 914 | av_assert0(0); |
| @@ -1128,7 +1128,7 @@ static int config_output(AVFilterLink *outlink) · 213 unmodified lines | ||
| 1128 | 1128 | generate_window_func(s->window_func_lut, s->win_size, s->win_func, &overlap); |
| 1129 | 1129 | if (s->overlap == 1) |
| 1130 | 1130 | s->overlap = overlap; |
| 1131 | − s->hop_size = (1. - s->overlap) * s->win_size; | |
| 1131 | + s->hop_size = (1.f - s->overlap) * s->win_size; | |
| 1132 | 1132 | if (s->hop_size < 1) { |
| 1133 | 1133 | av_log(ctx, AV_LOG_ERROR, "overlap %f too big\n", s->overlap); |
| 1134 | 1134 | return AVERROR(EINVAL); |
| @@ -1137,7 +1137,7 @@ static int config_output(AVFilterLink *outlink) · 2 unmodified lines | ||
| 1137 | 1137 | for (s->win_scale = 0, i = 0; i < s->win_size; i++) { |
| 1138 | 1138 | s->win_scale += s->window_func_lut[i] * s->window_func_lut[i]; |
| 1139 | 1139 | } |
| 1140 | − s->win_scale = 1. / sqrt(s->win_scale); | |
| 1140 | + s->win_scale = 1.f / sqrtf(s->win_scale); | |
| 1141 | 1141 | |
| 1142 | 1142 | /* prepare the initial picref buffer (black frame) */ |
| 1143 | 1143 | av_frame_free(&s->outpicref); |
| @@ -1198,8 +1198,8 @@ static int config_output(AVFilterLink *outlink) · 54 unmodified lines | ||
| 1198 | 1198 | |
| 1199 | 1199 | #define RE(y, ch) s->fft_data[ch][y].re |
| 1200 | 1200 | #define IM(y, ch) s->fft_data[ch][y].im |
| 1201 | −#define MAGNITUDE(y, ch) hypot(RE(y, ch), IM(y, ch)) | |
| 1202 | −#define PHASE(y, ch) atan2(IM(y, ch), RE(y, ch)) | |
| 1201 | +#define MAGNITUDE(y, ch) hypotf(RE(y, ch), IM(y, ch)) | |
| 1202 | +#define PHASE(y, ch) atan2f(IM(y, ch), RE(y, ch)) | |
| 1203 | 1203 | |
| 1204 | 1204 | static int calc_channel_magnitudes(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) |
| 1205 | 1205 | { |
| @@ -1639,7 +1639,7 @@ static int showspectrumpic_request_frame(AVFilterLink *outlink) · 433 unmodified lines | ||
| 1639 | 1639 | if (consumed >= spb) { |
| 1640 | 1640 | int h = s->orientation == VERTICAL ? s->h : s->w; |
| 1641 | 1641 | |
| 1642 | − scale_magnitudes(s, 1. / (consumed / spf)); | |
| 1642 | + scale_magnitudes(s, 1.f / (consumed / spf)); | |
| 1643 | 1643 | plot_spectrum_column(inlink, fin); |
| 1644 | 1644 | consumed = 0; |
| 1645 | 1645 | x++; |