[FFmpeg-cvslog] avcodec/magicyuv: invert symbols when building vlc

Paul B Mahol git at videolan.org
Mon Aug 31 17:33:06 EEST 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Aug 31 16:19:55 2020 +0200| [445e5fb67ab1bd5b59e89efe7c14cda692a30e15] | committer: Paul B Mahol

avcodec/magicyuv: invert symbols when building vlc

Instead at every decoded symbol.

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

 libavcodec/magicyuv.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index 5d76274d54..dd947c3c2f 100644
--- a/libavcodec/magicyuv.c
+++ b/libavcodec/magicyuv.c
@@ -113,7 +113,7 @@ static int huff_build10(VLC *vlc, uint8_t *len)
     for (i = 1023; i >= 0; i--) {
         codes[i] = code >> (32 - he[i].len);
         bits[i]  = he[i].len;
-        syms[i]  = he[i].sym;
+        syms[i]  = 1023 - he[i].sym;
         code += 0x80000000u >> (he[i].len - 1);
     }
 
@@ -145,7 +145,7 @@ static int huff_build12(VLC *vlc, uint8_t *len)
     for (i = 4095; i >= 0; i--) {
         codes[i] = code >> (32 - he[i].len);
         bits[i]  = he[i].len;
-        syms[i]  = he[i].sym;
+        syms[i]  = 4095 - he[i].sym;
         code += 0x80000000u >> (he[i].len - 1);
     }
 
@@ -177,7 +177,7 @@ static int huff_build(VLC *vlc, uint8_t *len)
     for (i = 255; i >= 0; i--) {
         codes[i] = code >> (32 - he[i].len);
         bits[i]  = he[i].len;
-        syms[i]  = he[i].sym;
+        syms[i]  = 255 - he[i].sym;
         code += 0x80000000u >> (he[i].len - 1);
     }
 
@@ -259,7 +259,7 @@ static int magy_decode_slice10(AVCodecContext *avctx, void *tdata,
                     if (pix < 0)
                         return AVERROR_INVALIDDATA;
 
-                    dst[x] = max - pix;
+                    dst[x] = pix;
                 }
                 dst += stride;
             }
@@ -389,7 +389,7 @@ static int magy_decode_slice(AVCodecContext *avctx, void *tdata,
                     if (pix < 0)
                         return AVERROR_INVALIDDATA;
 
-                    dst[x] = 255 - pix;
+                    dst[x] = pix;
                 }
                 dst += stride;
             }



More information about the ffmpeg-cvslog mailing list