From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/lsp: Move ff_lsp2polyf() upwards in lsp.c
Date: Sun, 25 Sep 2022 17:06:43 +0200
Message-ID: <AS8P250MB0744DF4FD1242B8075645D668F539@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB074473DA76F7C7EFA8225DFE8F539@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
Will avoid a forward declaration lateron.
Also adapt the function to modern style while at it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/lsp.c | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/libavcodec/lsp.c b/libavcodec/lsp.c
index 9e7bc5f87a..9536d8078b 100644
--- a/libavcodec/lsp.c
+++ b/libavcodec/lsp.c
@@ -124,6 +124,22 @@ static void lsp2poly(int* f, const int16_t* lsp, int lp_half_order)
}
}
+#ifndef ff_lsp2polyf
+void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order)
+{
+ f[0] = 1.0;
+ f[1] = -2 * lsp[0];
+ lsp -= 2;
+ for (int i = 2; i <= lp_half_order; i++) {
+ double val = -2 * lsp[2*i];
+ f[i] = val * f[i-1] + 2*f[i-2];
+ for (int j = i-1; j > 1; j--)
+ f[j] += f[j-1] * val + f[j-2];
+ f[1] += val;
+ }
+}
+#endif /* ff_lsp2polyf */
+
void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order)
{
int i;
@@ -191,25 +207,6 @@ void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd, const int16_t* lsp_2nd
ff_acelp_lsp2lpc(lp_2nd, lsp_2nd, lp_order >> 1);
}
-#ifndef ff_lsp2polyf
-void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order)
-{
- int i, j;
-
- f[0] = 1.0;
- f[1] = -2 * lsp[0];
- lsp -= 2;
- for(i=2; i<=lp_half_order; i++)
- {
- double val = -2 * lsp[2*i];
- f[i] = val * f[i-1] + 2*f[i-2];
- for(j=i-1; j>1; j--)
- f[j] += f[j-1] * val + f[j-2];
- f[1] += val;
- }
-}
-#endif /* ff_lsp2polyf */
-
void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order)
{
double pa[MAX_LP_HALF_ORDER+1], qa[MAX_LP_HALF_ORDER+1];
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-09-25 15:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-25 15:05 [FFmpeg-devel] [PATCH 1/3] avcodec/amrwbdec, lsp: Include mips headers only #if ARCH_MIPS Andreas Rheinhardt
2022-09-25 15:06 ` Andreas Rheinhardt [this message]
2022-09-25 15:06 ` [FFmpeg-devel] [PATCH 3/3] avcodec/lsp: Make ff_lsp2polyf() static Andreas Rheinhardt
2022-09-28 1:07 ` [FFmpeg-devel] [PATCH 1/3] avcodec/amrwbdec, lsp: Include mips headers only #if ARCH_MIPS Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AS8P250MB0744DF4FD1242B8075645D668F539@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git