OSDN Git Service

dvbsubdec: move shared codepath
authorVittorio Giovara <vittorio.giovara@gmail.com>
Sun, 9 Nov 2014 07:48:45 +0000 (08:48 +0100)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Tue, 11 Nov 2014 10:49:54 +0000 (11:49 +0100)
CC: libav-stable@libav.org
Bug-Id: CID 1238839

libavcodec/dvbsubdec.c

index 839465b..3d6e313 100644 (file)
@@ -693,26 +693,19 @@ static int dvbsub_read_8bit_string(uint8_t *destbuf, int dbuf_len,
                 if (run_length == 0) {
                     return pixels_read;
                 }
-
-                if (map_table)
-                    bits = map_table[0];
-                else
-                    bits = 0;
-                while (run_length-- > 0 && pixels_read < dbuf_len) {
-                    *destbuf++ = bits;
-                    pixels_read++;
-                }
             } else {
                 bits = *(*srcbuf)++;
 
                 if (non_mod == 1 && bits == 1)
                     pixels_read += run_length;
-                if (map_table)
-                    bits = map_table[bits];
-                else while (run_length-- > 0 && pixels_read < dbuf_len) {
-                    *destbuf++ = bits;
-                    pixels_read++;
-                }
+            }
+            if (map_table)
+                bits = map_table[0];
+            else
+                bits = 0;
+            while (run_length-- > 0 && pixels_read < dbuf_len) {
+                *destbuf++ = bits;
+                pixels_read++;
             }
         }
     }