[FFmpeg-cvslog] avcodec/mlpenc: fix regression in encoding only zeroes

Paul B Mahol git at videolan.org
Tue Oct 10 11:32:21 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Oct 10 10:23:06 2023 +0200| [394106a1384574d9dcb74c5dd5172bbc0508fa53] | committer: Paul B Mahol

avcodec/mlpenc: fix regression in encoding only zeroes

Previously it would use more bits than neccessary.

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

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

diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c
index 60a8abe929..46f6c4127a 100644
--- a/libavcodec/mlpenc.c
+++ b/libavcodec/mlpenc.c
@@ -452,7 +452,7 @@ static void default_decoding_params(MLPEncodeContext *ctx, DecodingParams *decod
  */
 static int inline number_sbits(int32_t n)
 {
-    return 33 - ff_clz(FFABS(n)|1);
+    return 33 - ff_clz(FFABS(n)|1) - !n;
 }
 
 enum InputBitDepth {



More information about the ffmpeg-cvslog mailing list