[FFmpeg-cvslog] avcodec/mpegaudioenc_template: fix invalid shift of sample

Michael Niedermayer git at videolan.org
Fri Feb 28 00:22:42 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Jan 23 12:41:41 2020 +0100| [a2c97a8342fab6393280cc2f0e2ffb39c381d29c] | committer: Michael Niedermayer

avcodec/mpegaudioenc_template: fix invalid shift of sample

Fixes: Ticket8010

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2c97a8342fab6393280cc2f0e2ffb39c381d29c
---

 libavcodec/mpegaudioenc_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpegaudioenc_template.c b/libavcodec/mpegaudioenc_template.c
index 93363fe1d2..12f7a098e6 100644
--- a/libavcodec/mpegaudioenc_template.c
+++ b/libavcodec/mpegaudioenc_template.c
@@ -701,7 +701,7 @@ static void encode_frame(MpegAudioContext *s,
 
                                 /* normalize to P bits */
                                 if (shift < 0)
-                                    q1 = sample << (-shift);
+                                    q1 = sample * (1 << -shift);
                                 else
                                     q1 = sample >> shift;
                                 q1 = (q1 * mult) >> P;



More information about the ffmpeg-cvslog mailing list