changeset 5396:9f0f022ca8e7 libavcodec

Rename "palette" to "colormap" when it's referring to the mapping from a 2-bit encoded color to a 4-bit index into the DVD palette. Patch by: Ian Caulfield, ian caulfield & gmx at
author takis
date Tue, 24 Jul 2007 13:03:13 +0000
parents 87d908152cb7
children 31f367bf1a99
files dvdsubdec.c
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dvdsubdec.c	Tue Jul 24 09:59:54 2007 +0000
+++ b/dvdsubdec.c	Tue Jul 24 13:03:13 2007 +0000
@@ -79,7 +79,7 @@
 }
 
 static void guess_palette(uint32_t *rgba_palette,
-                          uint8_t *palette,
+                          uint8_t *colormap,
                           uint8_t *alpha,
                           uint32_t subtitle_color)
 {
@@ -92,8 +92,8 @@
     memset(color_used, 0, 16);
     nb_opaque_colors = 0;
     for(i = 0; i < 4; i++) {
-        if (alpha[i] != 0 && !color_used[palette[i]]) {
-            color_used[palette[i]] = 1;
+        if (alpha[i] != 0 && !color_used[colormap[i]]) {
+            color_used[colormap[i]] = 1;
             nb_opaque_colors++;
         }
     }
@@ -105,16 +105,16 @@
     memset(color_used, 0, 16);
     for(i = 0; i < 4; i++) {
         if (alpha[i] != 0) {
-            if (!color_used[palette[i]])  {
+            if (!color_used[colormap[i]])  {
                 level = (0xff * j) / nb_opaque_colors;
                 r = (((subtitle_color >> 16) & 0xff) * level) >> 8;
                 g = (((subtitle_color >> 8) & 0xff) * level) >> 8;
                 b = (((subtitle_color >> 0) & 0xff) * level) >> 8;
                 rgba_palette[i] = b | (g << 8) | (r << 16) | ((alpha[i] * 17) << 24);
-                color_used[palette[i]] = (i + 1);
+                color_used[colormap[i]] = (i + 1);
                 j--;
             } else {
-                rgba_palette[i] = (rgba_palette[color_used[palette[i]] - 1] & 0x00ffffff) |
+                rgba_palette[i] = (rgba_palette[color_used[colormap[i]] - 1] & 0x00ffffff) |
                                     ((alpha[i] * 17) << 24);
             }
         }
@@ -125,7 +125,7 @@
                                 const uint8_t *buf, int buf_size)
 {
     int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos;
-    uint8_t palette[4], alpha[4];
+    uint8_t colormap[4], alpha[4];
     int date;
     int i;
     int is_menu = 0;
@@ -168,13 +168,13 @@
                 sub_header->end_display_time = (date << 10) / 90;
                 break;
             case 0x03:
-                /* set palette */
+                /* set colormap */
                 if ((buf_size - pos) < 2)
                     goto fail;
-                palette[3] = buf[pos] >> 4;
-                palette[2] = buf[pos] & 0x0f;
-                palette[1] = buf[pos + 1] >> 4;
-                palette[0] = buf[pos + 1] & 0x0f;
+                colormap[3] = buf[pos] >> 4;
+                colormap[2] = buf[pos] & 0x0f;
+                colormap[1] = buf[pos + 1] >> 4;
+                colormap[0] = buf[pos + 1] & 0x0f;
                 pos += 2;
                 break;
             case 0x04:
@@ -249,7 +249,7 @@
                 decode_rle(bitmap + w, w * 2, w, h / 2,
                            buf, offset2 * 2, buf_size);
                 guess_palette(sub_header->rects[0].rgba_palette,
-                              palette, alpha, 0xffff00);
+                              colormap, alpha, 0xffff00);
                 sub_header->rects[0].x = x1;
                 sub_header->rects[0].y = y1;
                 sub_header->rects[0].w = w;