From patchwork Tue Dec 20 22:23:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ronald S. Bultje" X-Patchwork-Id: 1871 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.86 with SMTP id o83csp1944216vsa; Tue, 20 Dec 2016 14:29:31 -0800 (PST) X-Received: by 10.194.47.203 with SMTP id f11mr1389346wjn.146.1482272971007; Tue, 20 Dec 2016 14:29:31 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dy10si24741958wjb.80.2016.12.20.14.29.30; Tue, 20 Dec 2016 14:29:30 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6797B68A204; Wed, 21 Dec 2016 00:29:28 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk0-f193.google.com (mail-qk0-f193.google.com [209.85.220.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6A45768A1FD for ; Wed, 21 Dec 2016 00:29:22 +0200 (EET) Received: by mail-qk0-f193.google.com with SMTP id u25so5983529qki.2 for ; Tue, 20 Dec 2016 14:29:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=oFrPY7xvco4yd8i62laTedvQYE+9wTGS5TZ0LthdIro=; b=LdxNJDsbe1x8cqn8gMzlL8/ifwlstw+3aJJkw8qWYLFx3KiVPhDF0j2PEb7js9ddy8 M6DHgQXV5hLHXqBniMiSWYBirfqBr3RzzJRMnSiYW/x9OKoihAVLW7fI826AUo3tWbKX NHRYt2DWK+C3Pwg5+6u6MxwXW/SAZDGB7H5u+VZmiMtMaIC4nkhLY/eRJ7GiN23AXNlg RsQLuH5FNnD1MuaXuldwYAe/7LBPIOs0uYRgrSfTlegECP4/GZw9h4fsiqxGBWoqiaC+ ExQXmJA//HIhgYHbuTC+n8wcswUoKyR58VvJXnYvPqvEJrASnzfGK00ZgJHOsnjrgpN2 e/ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oFrPY7xvco4yd8i62laTedvQYE+9wTGS5TZ0LthdIro=; b=b+HR+iuIjXutfae7IS+hOkXMCKAyxUpCvUo/m5laGcf08C6JiCEKzEtm3/pMqx9Ren gaSr8r/4N2qUm6PZErEi+LF5n9x4ct32F1zB9Zwk3esLssAbQN9RP8T5TK3Kx2FSh4O7 hTv+z55cMfqca9GW40VqIWdx/6CL5HQJepfqBgTkKT7q8jvoYR5az0eGVcyybrhHJHes c5MG10IsUA6CKSs9vzBTXMZsUWu0ul+L9QH0qhQ76rreW+xeiH9w1DjxeMs6RstGMPyn zt3i5KYeDQRyJHHp0yZC75xc0pfpc12tg/ZjqUZCEWqQp6V9XkZAk2LsKatOUXPSQt8/ Dv4g== X-Gm-Message-State: AIkVDXJBj9n4WZR1dBPcdzq2H+J7de0zDsz+bzETQ4n+Ni3Xwj4hCUWIo9ZkWAuD352s/Q== X-Received: by 10.55.192.137 with SMTP id v9mr1708229qkv.305.1482272592239; Tue, 20 Dec 2016 14:23:12 -0800 (PST) Received: from localhost.localdomain ([65.206.95.146]) by smtp.gmail.com with ESMTPSA id q88sm3594813qkq.21.2016.12.20.14.23.11 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 20 Dec 2016 14:23:11 -0800 (PST) From: "Ronald S. Bultje" To: ffmpeg-devel@ffmpeg.org Date: Tue, 20 Dec 2016 17:23:05 -0500 Message-Id: <1482272588-20810-1-git-send-email-rsbultje@gmail.com> X-Mailer: git-send-email 2.8.1 Subject: [FFmpeg-devel] [PATCH 1/4] wmavoice: move wmavoice_flush() up. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: "Ronald S. Bultje" MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- 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"),