[FFmpeg-cvslog] lavc/sgienc: Fix default 16bit encoding.

Carl Eugen Hoyos git at videolan.org
Sun Jul 19 22:58:39 EEST 2020


ffmpeg | branch: master | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Sun Jul 19 21:57:41 2020 +0200| [c4b6ee55c0a5dbf1a56c5be95eb19f86e762ddcb] | committer: Carl Eugen Hoyos

lavc/sgienc: Fix default 16bit encoding.

Broken since 7c56b879

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

 libavcodec/sgienc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c
index 13756f1608..40771d4666 100644
--- a/libavcodec/sgienc.c
+++ b/libavcodec/sgienc.c
@@ -219,7 +219,15 @@ FF_ENABLE_DEPRECATION_WARNINGS
                 bytestream2_put_be32(&taboff_pcb, bytestream2_tell_p(&pbc));
 
                 for (x = 0; x < width * bytes_per_channel; x += bytes_per_channel)
-                    encode_buf[x] = in_buf[depth * x];
+                    if (bytes_per_channel == 1) {
+                        encode_buf[x]     = in_buf[depth * x];
+                    } else if (HAVE_BIGENDIAN ^ put_be) {
+                        encode_buf[x + 1] = in_buf[depth * x];
+                        encode_buf[x]     = in_buf[depth * x + 1];
+                    } else {
+                        encode_buf[x]     = in_buf[depth * x];
+                        encode_buf[x + 1] = in_buf[depth * x + 1];
+                    }
 
                 length = sgi_rle_encode(&pbc, encode_buf, width,
                                         bytes_per_channel);



More information about the ffmpeg-cvslog mailing list