X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fatrac3plusdsp.c;h=17c6437707ac6ac3e253f96c00f443087a8685e8;hb=a5b2b22d9a45c9634e6947d43945ebafe121abec;hp=3c68f74d2588f8680f200d532bddc9bfd5bb8fb6;hpb=07f606b4f0149b6515248b9f7b879a59b2008d7e;p=ffmpeg diff --git a/libavcodec/atrac3plusdsp.c b/libavcodec/atrac3plusdsp.c index 3c68f74d258..17c6437707a 100644 --- a/libavcodec/atrac3plusdsp.c +++ b/libavcodec/atrac3plusdsp.c @@ -116,14 +116,16 @@ av_cold void ff_atrac3p_init_wave_synth(void) * @param[in] synth_param ptr to common synthesis parameters * @param[in] waves_info parameters for each sine wave * @param[in] envelope envelope data for all waves in a group - * @param[in] phase_shift flag indicates 180° phase shift + * @param[in] fdsp ptr to floating-point DSP context + * @param[in] invert_phase flag indicating 180° phase shift * @param[in] reg_offset region offset for trimming envelope data * @param[out] out receives sythesized data */ static void waves_synth(Atrac3pWaveSynthParams *synth_param, Atrac3pWavesData *waves_info, Atrac3pWaveEnvelope *envelope, - int phase_shift, int reg_offset, float *out) + AVFloatDSPContext *fdsp, + int invert_phase, int reg_offset, float *out) { int i, wn, inc, pos; double amp; @@ -146,6 +148,10 @@ static void waves_synth(Atrac3pWaveSynthParams *synth_param, } } + /* invert phase if requested */ + if (invert_phase) + fdsp->vector_fmul_scalar(out, out, -1.0f, 128); + /* fade in with steep Hann window if requested */ if (envelope->has_start_point) { pos = (envelope->start_pos << 2) - reg_offset; @@ -216,12 +222,12 @@ void ff_atrac3p_generate_tones(Atrac3pChanUnitCtx *ch_unit, AVFloatDSPContext *f /* synthesize waves for both overlapping regions */ if (tones_now->num_wavs && reg1_env_nonzero) waves_synth(ch_unit->waves_info_prev, tones_now, &tones_now->curr_env, - ch_unit->waves_info_prev->phase_shift[sb] & ch_num, + fdsp, ch_unit->waves_info_prev->invert_phase[sb] & ch_num, 128, wavreg1); if (tones_next->num_wavs && reg2_env_nonzero) - waves_synth(ch_unit->waves_info, tones_next, &tones_next->curr_env, - ch_unit->waves_info->phase_shift[sb] & ch_num, 0, wavreg2); + waves_synth(ch_unit->waves_info, tones_next, &tones_next->curr_env, fdsp, + ch_unit->waves_info->invert_phase[sb] & ch_num, 0, wavreg2); /* Hann windowing for non-faded wave signals */ if (tones_now->num_wavs && tones_next->num_wavs &&