diff mbox

[FFmpeg-devel,1/4] wmavoice: move wmavoice_flush() up.

Message ID 1482272588-20810-1-git-send-email-rsbultje@gmail.com
State Accepted
Commit 992cb15e671332650ddd5020c00cf08a40bb7cf0
Headers show

Commit Message

Ronald S. Bultje Dec. 20, 2016, 10:23 p.m. UTC
---
 libavcodec/wmavoice.c | 56 +++++++++++++++++++++++++--------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

Comments

Paul B Mahol Dec. 22, 2016, 9:46 a.m. UTC | #1
On 12/20/16, Ronald S. Bultje <rsbultje@gmail.com> wrote:
> ---
>  libavcodec/wmavoice.c | 56
> +++++++++++++++++++++++++--------------------------
>  1 file changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
> index ceac61f..4b3ab43 100644
> --- a/libavcodec/wmavoice.c
> +++ b/libavcodec/wmavoice.c
> @@ -337,6 +337,34 @@ static av_cold void wmavoice_init_static_data(AVCodec
> *codec)
>                      bits, 1, 1, codes, 2, 2, 132);
>  }
>
> +static av_cold void wmavoice_flush(AVCodecContext *ctx)
> +{
> +    WMAVoiceContext *s = ctx->priv_data;
> +    int n;
> +
> +    s->postfilter_agc    = 0;
> +    s->sframe_cache_size = 0;
> +    s->skip_bits_next    = 0;
> +    for (n = 0; n < s->lsps; n++)
> +        s->prev_lsps[n] = M_PI * (n + 1.0) / (s->lsps + 1.0);
> +    memset(s->excitation_history, 0,
> +           sizeof(*s->excitation_history) * MAX_SIGNAL_HISTORY);
> +    memset(s->synth_history,      0,
> +           sizeof(*s->synth_history)      * MAX_LSPS);
> +    memset(s->gain_pred_err,      0,
> +           sizeof(s->gain_pred_err));
> +
> +    if (s->do_apf) {
> +        memset(&s->synth_filter_out_buf[MAX_LSPS_ALIGN16 - s->lsps], 0,
> +               sizeof(*s->synth_filter_out_buf) * s->lsps);
> +        memset(s->dcf_mem,              0,
> +               sizeof(*s->dcf_mem)              * 2);
> +        memset(s->zero_exc_pf,          0,
> +               sizeof(*s->zero_exc_pf)          * s->history_nsamples);
> +        memset(s->denoise_filter_cache, 0,
> sizeof(s->denoise_filter_cache));
> +    }
> +}
> +
>  /**
>   * Set up decoder with parameters from demuxer (extradata etc.).
>   */
> @@ -2046,34 +2074,6 @@ static av_cold int wmavoice_decode_end(AVCodecContext
> *ctx)
>      return 0;
>  }
>
> -static av_cold void wmavoice_flush(AVCodecContext *ctx)
> -{
> -    WMAVoiceContext *s = ctx->priv_data;
> -    int n;
> -
> -    s->postfilter_agc    = 0;
> -    s->sframe_cache_size = 0;
> -    s->skip_bits_next    = 0;
> -    for (n = 0; n < s->lsps; n++)
> -        s->prev_lsps[n] = M_PI * (n + 1.0) / (s->lsps + 1.0);
> -    memset(s->excitation_history, 0,
> -           sizeof(*s->excitation_history) * MAX_SIGNAL_HISTORY);
> -    memset(s->synth_history,      0,
> -           sizeof(*s->synth_history)      * MAX_LSPS);
> -    memset(s->gain_pred_err,      0,
> -           sizeof(s->gain_pred_err));
> -
> -    if (s->do_apf) {
> -        memset(&s->synth_filter_out_buf[MAX_LSPS_ALIGN16 - s->lsps], 0,
> -               sizeof(*s->synth_filter_out_buf) * s->lsps);
> -        memset(s->dcf_mem,              0,
> -               sizeof(*s->dcf_mem)              * 2);
> -        memset(s->zero_exc_pf,          0,
> -               sizeof(*s->zero_exc_pf)          * s->history_nsamples);
> -        memset(s->denoise_filter_cache, 0,
> sizeof(s->denoise_filter_cache));
> -    }
> -}
> -
>  AVCodec ff_wmavoice_decoder = {
>      .name             = "wmavoice",
>      .long_name        = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"),
> --
> 2.8.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

lgtm
diff mbox

Patch

diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index ceac61f..4b3ab43 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -337,6 +337,34 @@  static av_cold void wmavoice_init_static_data(AVCodec *codec)
                     bits, 1, 1, codes, 2, 2, 132);
 }
 
+static av_cold void wmavoice_flush(AVCodecContext *ctx)
+{
+    WMAVoiceContext *s = ctx->priv_data;
+    int n;
+
+    s->postfilter_agc    = 0;
+    s->sframe_cache_size = 0;
+    s->skip_bits_next    = 0;
+    for (n = 0; n < s->lsps; n++)
+        s->prev_lsps[n] = M_PI * (n + 1.0) / (s->lsps + 1.0);
+    memset(s->excitation_history, 0,
+           sizeof(*s->excitation_history) * MAX_SIGNAL_HISTORY);
+    memset(s->synth_history,      0,
+           sizeof(*s->synth_history)      * MAX_LSPS);
+    memset(s->gain_pred_err,      0,
+           sizeof(s->gain_pred_err));
+
+    if (s->do_apf) {
+        memset(&s->synth_filter_out_buf[MAX_LSPS_ALIGN16 - s->lsps], 0,
+               sizeof(*s->synth_filter_out_buf) * s->lsps);
+        memset(s->dcf_mem,              0,
+               sizeof(*s->dcf_mem)              * 2);
+        memset(s->zero_exc_pf,          0,
+               sizeof(*s->zero_exc_pf)          * s->history_nsamples);
+        memset(s->denoise_filter_cache, 0, sizeof(s->denoise_filter_cache));
+    }
+}
+
 /**
  * Set up decoder with parameters from demuxer (extradata etc.).
  */
@@ -2046,34 +2074,6 @@  static av_cold int wmavoice_decode_end(AVCodecContext *ctx)
     return 0;
 }
 
-static av_cold void wmavoice_flush(AVCodecContext *ctx)
-{
-    WMAVoiceContext *s = ctx->priv_data;
-    int n;
-
-    s->postfilter_agc    = 0;
-    s->sframe_cache_size = 0;
-    s->skip_bits_next    = 0;
-    for (n = 0; n < s->lsps; n++)
-        s->prev_lsps[n] = M_PI * (n + 1.0) / (s->lsps + 1.0);
-    memset(s->excitation_history, 0,
-           sizeof(*s->excitation_history) * MAX_SIGNAL_HISTORY);
-    memset(s->synth_history,      0,
-           sizeof(*s->synth_history)      * MAX_LSPS);
-    memset(s->gain_pred_err,      0,
-           sizeof(s->gain_pred_err));
-
-    if (s->do_apf) {
-        memset(&s->synth_filter_out_buf[MAX_LSPS_ALIGN16 - s->lsps], 0,
-               sizeof(*s->synth_filter_out_buf) * s->lsps);
-        memset(s->dcf_mem,              0,
-               sizeof(*s->dcf_mem)              * 2);
-        memset(s->zero_exc_pf,          0,
-               sizeof(*s->zero_exc_pf)          * s->history_nsamples);
-        memset(s->denoise_filter_cache, 0, sizeof(s->denoise_filter_cache));
-    }
-}
-
 AVCodec ff_wmavoice_decoder = {
     .name             = "wmavoice",
     .long_name        = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"),