diff mbox series

[FFmpeg-devel,1/2] avcodec/lpc: zero the middle odd sample in the output

Message ID 20220922185834.5700-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] avcodec/lpc: zero the middle odd sample in the output | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer Sept. 22, 2022, 6:58 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/lpc.c       |  1 +
 libavcodec/x86/lpc.asm | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index 8603bb9709..dc6a3060ce 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -53,6 +53,7 @@  static void lpc_apply_welch_window_c(const int32_t *data, ptrdiff_t len,
             w_data[i] = data[i] * w;
             w_data[len-1-i] = data[len-1-i] * w;
         }
+        w_data[n2] = 0.0;
         return;
     }
 
diff --git a/libavcodec/x86/lpc.asm b/libavcodec/x86/lpc.asm
index ad74f1d8ac..47b31aa147 100644
--- a/libavcodec/x86/lpc.asm
+++ b/libavcodec/x86/lpc.asm
@@ -37,7 +37,7 @@  SECTION .text
 %macro APPLY_WELCH_FN 0
 cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2
     cmp lenq, 0
-    je .end
+    je .end_e
     cmp lenq, 2
     je .two
     cmp lenq, 1
@@ -104,7 +104,7 @@  cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2
 
     add lend, (mmsize/4 - 1)
     cmp lend, 0
-    je .end
+    je .end_o
     sub lenq, (mmsize/4 - 1)
 
 .scalar_o:
@@ -135,6 +135,10 @@  cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2
 
     sub lenq, 2
     jg .loop_o_scalar
+
+.end_o:
+    xorps xm3, xm3
+    movlpd [outq + off1q*2], xm3
     RET
 
 .even:
@@ -233,7 +237,7 @@  cglobal lpc_apply_welch_window, 3, 5, 8, data, len, out, off1, off2
 .one:
     xorpd xm0, xm0
     movhpd [outq], xm0
-.end:
+.end_e:
     RET
 %endmacro