| 848 | for (int64_t k = 0; k < filter_size; ++k) { |
| 849 | const int64_t dst_index = 2 * pair + 1 - k; |
| 850 | if (dst_index < 0 || dst_index >= bands.frames) { |
| 851 | continue; |
| 852 | } |
| 853 | out[static_cast<size_t>(dst_index * bands.channels + channel)] += |
| 854 | bands.low[index] * bands.spec->dec_lo[static_cast<size_t>(k)] + |
| 855 | bands.high[index] * bands.spec->dec_hi[static_cast<size_t>(k)]; |
| 856 | } |
| 857 | } |
| 858 | } |
| 859 | return out; |
| 860 | } |
| 861 | |
| 862 | void apply_dcw_correction( |
| 863 | std::vector<float> & hidden, |
| 864 | const std::vector<float> & denoised, |
| 865 | int64_t frames, |
| 866 | int64_t channels, |
| 867 | float t_curr, |
| 868 | bool reference_skips_wavelet_dcw, |
| 869 | const AceStepGenerationOptions & options) { |
| 870 | if (!dcw_is_active(options, reference_skips_wavelet_dcw)) { |
| 871 | return; |
| 872 | } |
| 873 | if (hidden.size() < denoised.size()) { |
| 874 | throw std::runtime_error("ACE-Step diffusion DCW hidden/denoised size mismatch"); |
| 875 | } |
| 876 | if (options.dcw_mode == "pix") { |
| 877 | if (options.dcw_scaler == 0.0F) { |
| 878 | return; |
| 879 | } |
| 880 | for (size_t i = 0; i < denoised.size(); ++i) { |
| 881 | hidden[i] = hidden[i] + options.dcw_scaler * (hidden[i] - denoised[i]); |
| 882 | } |
| 883 | return; |
| 884 | } |
| 885 | const auto & spec = lookup_wavelet_spec(options.dcw_wavelet); |
no test coverage detected