[FFmpeg-devel] remove palette8torgb15 and palette8torgb15, was: make swscale's palette functions public

Stefano Sabatini stefano.sabatini-lala
Tue Jun 1 10:42:21 CEST 2010


On date Tuesday 2010-06-01 09:34:09 +0200, Reinhard Tartler encoded:
> 
> okay, with the really deprecated functions now gone, I've reworked the
> patch a bit, it is now much smaller:
> 
> Index: libmpcodecs/vf_palette.c
> ===================================================================
> --- libmpcodecs/vf_palette.c	(revision 31298)
> +++ libmpcodecs/vf_palette.c	(working copy)
> @@ -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_palette8topacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);

What about
sws_palette8ToPacked24(...)
or
sws_convertPalette8ToPacked24()?

Since we're changing the name anyway we should strive to choose
something which is more readable.

[...]
> Index: libswscale/rgb2rgb.h
> ===================================================================
> --- libswscale/rgb2rgb.h	(revision 31298)
> +++ libswscale/rgb2rgb.h	(working copy)
> @@ -4,7 +4,7 @@
>   *               Software YUV to YUV converter
>   *               Software YUV to RGB converter
>   *  Written by Nick Kurshev.
> - *  palette & YUV & runtime CPU stuff by Michael (michaelni at gmx.at)
> + *  YUV & runtime CPU stuff by Michael (michaelni at gmx.at)
>   *
>   * This file is part of FFmpeg.
>   *
> @@ -28,6 +28,8 @@
>  
>  #include <inttypes.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,11 +68,14 @@
>  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);
> +/* 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 use 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);

Put these declarations under:

#if LIBSWSCALE_VERSION_MAJOR < 1  
...
#endif

Also please don't forget to bump minor and update APIchanges.

Regards.
-- 
FFmpeg = Fancy Faithless Mean Programmable Elected Game



More information about the ffmpeg-devel mailing list