[Spice-devel] [PATCH spice-gtk] mjpeg_decoder_schedule: Remove support for SPICE protocol version 1

Frediano Ziglio fziglio at redhat.com
Wed Oct 31 16:28:44 UTC 2018


Support for protocol version 1 was dropped in commit f77a1d50.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/channel-display-mjpeg.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c
index 6f7ded65..83cd391b 100644
--- a/src/channel-display-mjpeg.c
+++ b/src/channel-display-mjpeg.c
@@ -92,7 +92,6 @@ static void mjpeg_decoder_schedule(MJpegDecoder *decoder);
 static gboolean mjpeg_decoder_decode_frame(gpointer video_decoder)
 {
     MJpegDecoder *decoder = (MJpegDecoder*)video_decoder;
-    gboolean back_compat = decoder->base.stream->channel->priv->peer_hdr.major_version == 1;
     JDIMENSION width, height;
     uint8_t *dest;
     uint8_t *lines[4];
@@ -109,10 +108,7 @@ static gboolean mjpeg_decoder_decode_frame(gpointer video_decoder)
 
 #ifdef JCS_EXTENSIONS
     // requires jpeg-turbo
-    if (back_compat)
-        decoder->mjpeg_cinfo.out_color_space = JCS_EXT_RGBX;
-    else
-        decoder->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX;
+    decoder->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX;
 #else
 #warning "You should consider building with libjpeg-turbo"
     decoder->mjpeg_cinfo.out_color_space = JCS_RGB;
@@ -153,20 +149,11 @@ static gboolean mjpeg_decoder_decode_frame(gpointer video_decoder)
             uint8_t *s = lines[0];
             uint32_t *d = SPICE_ALIGNED_CAST(uint32_t *, s);
 
-            if (back_compat) {
-                for (unsigned int j = lines_read * width; j > 0; ) {
-                    j -= 1; // reverse order, bad for cache?
-                    d[j] = s[j * 3 + 0] |
-                        s[j * 3 + 1] << 8 |
-                        s[j * 3 + 2] << 16;
-                }
-            } else {
-                for (unsigned int j = lines_read * width; j > 0; ) {
-                    j -= 1; // reverse order, bad for cache?
-                    d[j] = s[j * 3 + 0] << 16 |
-                        s[j * 3 + 1] << 8 |
-                        s[j * 3 + 2];
-                }
+            for (unsigned int j = lines_read * width; j > 0; ) {
+                j -= 1; // reverse order, bad for cache?
+                d[j] = s[j * 3 + 0] << 16 |
+                    s[j * 3 + 1] << 8 |
+                    s[j * 3 + 2];
             }
         }
 #endif
-- 
2.17.2



More information about the Spice-devel mailing list