From 20d4a1f020242fa2df2399728310d5549b52091e Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Thu, 3 Jun 2010 20:16:42 +0000 Subject: Add an entry to APIchanges for the addition of sws_convertPalette8ToPacked32 -24 backport r23415 by siretart Originally committed as revision 23446 to svn://svn.ffmpeg.org/ffmpeg/branches/0.6 --- doc/APIchanges | 3 +++ libswscale/rgb2rgb.c | 38 ++++---------------------------------- libswscale/rgb2rgb.h | 20 +++++++++++++------- libswscale/swscale.c | 35 +++++++++++++++++++++++++++++------ libswscale/swscale.h | 27 ++++++++++++++++++++++++++- 5 files changed, 75 insertions(+), 48 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 4d574108b8..db696580f4 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -12,6 +12,9 @@ libavutil: 2009-03-08 API changes, most recent first: +2010-06-01 - r31301 - lsws 0.11.0 - convertPalette API + Add sws_convertPalette8ToPacked32 and sws_convertPalette8ToPacked24 + 2010-05-26 - r23334 - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL Add CODEC_CAP_EXPERIMENTAL flag. diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index 7d1cefca3a..b506b12edc 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -207,31 +207,15 @@ void sws_rgb2rgb_init(int flags) rgb2rgb_init_C(); } -/** - * Convert the palette to the same packet 32-bit format as the palette - */ +#if LIBSWSCALE_VERSION_MAJOR < 1 void palette8topacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) { - long i; - - for (i=0; i dst format: ABC - */ void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) { - long i; - - for (i=0; i +#include "libswscale/swscale.h" +#include "libavutil/avutil.h" + /* A full collection of RGB to RGB(BGR) converters */ extern void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size); extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size); @@ -66,12 +69,15 @@ void shuffle_bytes_2103(const uint8_t *src, uint8_t *dst, long src_size); void shuffle_bytes_3012(const uint8_t *src, uint8_t *dst, long src_size); void shuffle_bytes_3210(const uint8_t *src, uint8_t *dst, long src_size); -void palette8topacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); -void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); +#if LIBSWSCALE_VERSION_MAJOR < 1 +/* deprecated, use the public versions in swscale.h */ +attribute_deprecated void palette8topacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); +attribute_deprecated void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); + +/* totally deprecated, please fix code that uses this */ +attribute_deprecated void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); +attribute_deprecated void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette); +#endif /** * Height should be a multiple of 2 and width should be a multiple of 16. diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 2b02dd3dfd..81f475c6e2 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1424,12 +1424,12 @@ static int palToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], if (usePal(srcFormat)) { switch (dstFormat) { - case PIX_FMT_RGB32 : conv = palette8topacked32; break; - case PIX_FMT_BGR32 : conv = palette8topacked32; break; - case PIX_FMT_BGR32_1: conv = palette8topacked32; break; - case PIX_FMT_RGB32_1: conv = palette8topacked32; break; - case PIX_FMT_RGB24 : conv = palette8topacked24; break; - case PIX_FMT_BGR24 : conv = palette8topacked24; break; + case PIX_FMT_RGB32 : conv = sws_convertPalette8ToPacked32; break; + case PIX_FMT_BGR32 : conv = sws_convertPalette8ToPacked32; break; + case PIX_FMT_BGR32_1: conv = sws_convertPalette8ToPacked32; break; + case PIX_FMT_RGB32_1: conv = sws_convertPalette8ToPacked32; break; + case PIX_FMT_RGB24 : conv = sws_convertPalette8ToPacked24; break; + case PIX_FMT_BGR24 : conv = sws_convertPalette8ToPacked24; break; } } @@ -1962,3 +1962,26 @@ int sws_scale_ordered(SwsContext *c, const uint8_t* const src[], int srcStride[] return sws_scale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride); } #endif + +/* Convert the palette to the same packed 32-bit format as the palette */ +void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) +{ + long i; + + for (i=0; i dst format: ABC */ +void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) +{ + long i; + + for (i=0; i