diff options
Diffstat (limited to 'gst')
-rw-r--r-- | gst/flx/flx_color.c | 25 | ||||
-rw-r--r-- | gst/flx/flx_color.h | 4 | ||||
-rw-r--r-- | gst/flx/gstflxdec.c | 18 |
3 files changed, 32 insertions, 15 deletions
diff --git a/gst/flx/flx_color.c b/gst/flx/flx_color.c index c61052d0..8b505c9d 100644 --- a/gst/flx/flx_color.c +++ b/gst/flx/flx_color.c @@ -66,7 +66,7 @@ flx_colorspace_convert(FlxColorSpaceConverter *flxpal, guchar *src, guchar *dest void -flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num, guchar *newpal) +flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num, guchar *newpal, gint scale) { guint grab; @@ -75,20 +75,33 @@ flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num, g grab = ((start + num) > 0x100 ? 0x100 - start : num); - memcpy(&flxpal->palvec[start * 3], newpal, grab*3); + if (scale) { + gint i = 0; + + start *= 3; + while (grab) { + flxpal->palvec[start++] = newpal[i++] << scale; + flxpal->palvec[start++] = newpal[i++] << scale; + flxpal->palvec[start++] = newpal[i++] << scale; + grab--; + } + } + else { + memcpy(&flxpal->palvec[start * 3], newpal, grab * 3); + } } void -flx_set_color(FlxColorSpaceConverter *flxpal, guint colr, guint red, guint green, guint blue) +flx_set_color(FlxColorSpaceConverter *flxpal, guint colr, guint red, guint green, guint blue, gint scale) { g_return_if_fail(flxpal != NULL); g_return_if_fail(colr < 0x100); - flxpal->palvec[(colr * 3)] = red; - flxpal->palvec[(colr * 3) + 1] = green; - flxpal->palvec[(colr * 3) + 2] = blue; + flxpal->palvec[(colr * 3)] = red << scale; + flxpal->palvec[(colr * 3) + 1] = green << scale; + flxpal->palvec[(colr * 3) + 2] = blue << scale; } diff --git a/gst/flx/flx_color.h b/gst/flx/flx_color.h index 5676c878..022e54d6 100644 --- a/gst/flx/flx_color.h +++ b/gst/flx/flx_color.h @@ -37,7 +37,7 @@ void flx_colorspace_convert(FlxColorSpaceConverter *flxpal, guchar *src, guchar FlxColorSpaceConverter * flx_colorspace_converter_new(gint width, gint height); void flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num, - guchar *newpal); + guchar *newpal, gint scale); void flx_set_color(FlxColorSpaceConverter *flxpal, guint colr, guint red, guint green, - guint blue); + guint blue, gint scale); diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c index 95e55cc6..b679fa48 100644 --- a/gst/flx/gstflxdec.c +++ b/gst/flx/gstflxdec.c @@ -98,10 +98,10 @@ static void gst_flxdec_set_property (GObject *object, guint prop_id, const GValu static void gst_flxdec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void flx_decode_color(GstFlxDec *, guchar *, guchar *); -static void flx_decode_brun(GstFlxDec *, guchar *, guchar *); -static void flx_decode_delta_fli(GstFlxDec *, guchar *, guchar *); -static void flx_decode_delta_flc(GstFlxDec *, guchar *, guchar *); +static void flx_decode_color (GstFlxDec *, guchar *, guchar *, gint); +static void flx_decode_brun (GstFlxDec *, guchar *, guchar *); +static void flx_decode_delta_fli (GstFlxDec *, guchar *, guchar *); +static void flx_decode_delta_flc (GstFlxDec *, guchar *, guchar *); #define rndalign(off) ((off) + ((off) % 2)) @@ -200,8 +200,12 @@ flx_decode_chunks (GstFlxDec *flxdec , gulong count, gchar *data, gchar *dest) switch(hdr->id) { case FLX_COLOR64: + flx_decode_color(flxdec, data, dest, 2); + data += rndalign(hdr->size) - FlxFrameChunkSize; + break; + case FLX_COLOR256: - flx_decode_color(flxdec, data, dest); + flx_decode_color(flxdec, data, dest, 0); data += rndalign(hdr->size) - FlxFrameChunkSize; break; @@ -240,7 +244,7 @@ flx_decode_chunks (GstFlxDec *flxdec , gulong count, gchar *data, gchar *dest) static void -flx_decode_color(GstFlxDec *flxdec, guchar *data, guchar *dest) +flx_decode_color(GstFlxDec *flxdec, guchar *data, guchar *dest, gint scale) { guint packs, count, indx; @@ -262,7 +266,7 @@ flx_decode_color(GstFlxDec *flxdec, guchar *data, guchar *dest) count = 256; g_print("GstFlxDec: cmap count: %d (indx: %d)\n", count, indx); - flx_set_palette_vector(flxdec->converter, indx, count, data); + flx_set_palette_vector(flxdec->converter, indx, count, data, scale); data += (count * 3); } |