From 68188b726c6d4b14e43d708af4c7e8fef304444c Mon Sep 17 00:00:00 2001
From: Martin Vignali <martin.vignali@gmail.com>
Date: Thu, 14 Mar 2019 21:15:38 +0100
Subject: [PATCH 1/2] avcodec/qtrle : use prev raw decoding for 32bpp on
 sparc64

---
 libavcodec/qtrle.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c
index a744d7ba68..aca7ec2f40 100644
--- a/libavcodec/qtrle.c
+++ b/libavcodec/qtrle.c
@@ -353,7 +353,10 @@ static void qtrle_decode_24bpp(QtrleContext *s, int row_ptr, int lines_to_change
 
 static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change)
 {
-    int rle_code, rle_code_half;
+    int rle_code;
+#if !ARCH_SPARC64
+    int rle_code_half;
+#endif
     int pixel_ptr;
     int row_inc = s->frame->linesize[0];
     unsigned int argb;
@@ -386,6 +389,13 @@ static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change
                 CHECK_PIXEL_PTR(rle_code * 4);
 
                 /* copy pixels directly to output */
+#if ARCH_SPARC64
+                while (rle_code--) {
+                    argb = bytestream2_get_ne32(&s->g);
+                    AV_WN32A(rgb + pixel_ptr, argb);
+                    pixel_ptr  += 4;
+                }
+#else
                 rle_code_half = rle_code / 2;
                 while (rle_code_half--) { /* copy 2 argb raw value at the same time */
                     AV_WN64A(rgb + pixel_ptr, bytestream2_get_ne64(&s->g));
@@ -396,6 +406,7 @@ static void qtrle_decode_32bpp(QtrleContext *s, int row_ptr, int lines_to_change
                     AV_WN32A(rgb + pixel_ptr, bytestream2_get_ne32(&s->g));
                     pixel_ptr += 4;
                 }
+#endif
             }
         }
         row_ptr += row_inc;
-- 
2.17.2 (Apple Git-113)

