# HG changeset patch # User siretart # Date 1275420916 0 # Node ID 6617555072365ef9794b345aaeb7e6985673bf48 # Parent ef9fdc663e72f4acacdadbec65b0eebaa9cbee8f deprecate palette8topacked32 in favor of public API functions sws_convertPalette8ToPacked32 and -24 additionallym deprecate palette8torgb16 and its bgr variant without replacement. These functions are not meant to be used by applications. Discussed at: http://comments.gmane.org/gmane.comp.video.ffmpeg.devel/109340 diff -r ef9fdc663e72 -r 661755507236 libmpcodecs/vf_palette.c --- a/libmpcodecs/vf_palette.c Tue Jun 01 11:30:07 2010 +0000 +++ b/libmpcodecs/vf_palette.c Tue Jun 01 19:35:16 2010 +0000 @@ -29,6 +29,7 @@ #include "mp_image.h" #include "vf.h" +#include "libswscale/swscale.h" #include "libswscale/rgb2rgb.h" //===========================================================================// @@ -122,15 +123,15 @@ break; case 24: if (IMGFMT_IS_BGR(dmpi->imgfmt)) - palette8topacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); + sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); else - palette8topacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); + sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); break; case 32: if (IMGFMT_IS_BGR(dmpi->imgfmt)) - palette8topacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); + sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); else - palette8topacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); + sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]); break; } } else { @@ -148,15 +149,15 @@ break; case 24: if (IMGFMT_IS_BGR(dmpi->imgfmt)) - palette8topacked24(src,dst,mpi->w,mpi->planes[1]); + sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]); else - palette8topacked24(src,dst,mpi->w,mpi->planes[1]); + sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]); break; case 32: if (IMGFMT_IS_BGR(dmpi->imgfmt)) - palette8topacked32(src,dst,mpi->w,mpi->planes[1]); + sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]); else - palette8topacked32(src,dst,mpi->w,mpi->planes[1]); + sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]); break; } } diff -r ef9fdc663e72 -r 661755507236 libswscale/rgb2rgb.c --- a/libswscale/rgb2rgb.c Tue Jun 01 11:30:07 2010 +0000 +++ b/libswscale/rgb2rgb.c Tue Jun 01 19:35:16 2010 +0000 @@ -207,31 +207,15 @@ 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,10 +69,15 @@ 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); +#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 -r ef9fdc663e72 -r 661755507236 libswscale/swscale.c --- a/libswscale/swscale.c Tue Jun 01 11:30:07 2010 +0000 +++ b/libswscale/swscale.c Tue Jun 01 19:35:16 2010 +0000 @@ -1419,12 +1419,12 @@ 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; } } @@ -1957,3 +1957,26 @@ 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