From 3b905b9fe611efb3282aa4c5c659e1870d91a83b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 Mar 2016 17:20:58 +0200 Subject: [PATCH] swscale: Deprecate vector functions which are unused outside swscale There are no known users of these functions within debian It should be thus possible to remove these functions without recommandition of a replacement Signed-off-by: Michael Niedermayer --- libswscale/swscale.h | 37 ++++++++++------------------------- libswscale/utils.c | 46 ++++++++++++++++++++++++++++++++++++++++++++ libswscale/version.h | 4 ++++ 3 files changed, 60 insertions(+), 27 deletions(-) diff --git a/libswscale/swscale.h b/libswscale/swscale.h index da9dd2ea8f8..8449948931e 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -247,18 +247,6 @@ SwsVector *sws_allocVec(int length); */ SwsVector *sws_getGaussianVec(double variance, double quality); -/** - * Allocate and return a vector with length coefficients, all - * with the same value c. - */ -SwsVector *sws_getConstVec(double c, int length); - -/** - * Allocate and return a vector with just one coefficient, with - * value 1.0. - */ -SwsVector *sws_getIdentityVec(void); - /** * Scale all the coefficients of a by the scalar value. */ @@ -268,22 +256,17 @@ void sws_scaleVec(SwsVector *a, double scalar); * Scale all the coefficients of a so that their sum equals height. */ void sws_normalizeVec(SwsVector *a, double height); -void sws_convVec(SwsVector *a, SwsVector *b); -void sws_addVec(SwsVector *a, SwsVector *b); -void sws_subVec(SwsVector *a, SwsVector *b); -void sws_shiftVec(SwsVector *a, int shift); -/** - * Allocate and return a clone of the vector a, that is a vector - * with the same coefficients as a. - */ -SwsVector *sws_cloneVec(SwsVector *a); - -/** - * Print with av_log() a textual representation of the vector a - * if log_level <= av_log_level. - */ -void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); +#if FF_API_SWS_VECTOR +attribute_deprecated SwsVector *sws_getConstVec(double c, int length); +attribute_deprecated SwsVector *sws_getIdentityVec(void); +attribute_deprecated void sws_convVec(SwsVector *a, SwsVector *b); +attribute_deprecated void sws_addVec(SwsVector *a, SwsVector *b); +attribute_deprecated void sws_subVec(SwsVector *a, SwsVector *b); +attribute_deprecated void sws_shiftVec(SwsVector *a, int shift); +attribute_deprecated SwsVector *sws_cloneVec(SwsVector *a); +attribute_deprecated void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); +#endif void sws_freeVec(SwsVector *a); diff --git a/libswscale/utils.c b/libswscale/utils.c index 24ddd13ed6e..1891c22d834 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -53,10 +53,23 @@ #include "libavutil/ppc/cpu.h" #include "libavutil/x86/asm.h" #include "libavutil/x86/cpu.h" + +// We have to implement deprecated functions until they are removed, this is the +// simplest way to prevent warnings +#undef attribute_deprecated +#define attribute_deprecated + #include "rgb2rgb.h" #include "swscale.h" #include "swscale_internal.h" +#if !FF_API_SWS_VECTOR +static SwsVector *sws_getIdentityVec(void); +static void sws_addVec(SwsVector *a, SwsVector *b); +static void sws_shiftVec(SwsVector *a, int shift); +static void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); +#endif + static void handle_formats(SwsContext *c); unsigned swscale_version(void) @@ -2049,6 +2062,13 @@ SwsVector *sws_getGaussianVec(double variance, double quality) return vec; } +/** + * Allocate and return a vector with length coefficients, all + * with the same value c. + */ +#if !FF_API_SWS_VECTOR +static +#endif SwsVector *sws_getConstVec(double c, int length) { int i; @@ -2063,6 +2083,13 @@ SwsVector *sws_getConstVec(double c, int length) return vec; } +/** + * Allocate and return a vector with just one coefficient, with + * value 1.0. + */ +#if !FF_API_SWS_VECTOR +static +#endif SwsVector *sws_getIdentityVec(void) { return sws_getConstVec(1.0, 1); @@ -2092,6 +2119,7 @@ void sws_normalizeVec(SwsVector *a, double height) sws_scaleVec(a, height / sws_dcVec(a)); } +#if FF_API_SWS_VECTOR static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b) { int length = a->length + b->length - 1; @@ -2109,6 +2137,7 @@ static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b) return vec; } +#endif static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b) { @@ -2127,6 +2156,7 @@ static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b) return vec; } +#if FF_API_SWS_VECTOR static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b) { int length = FFMAX(a->length, b->length); @@ -2143,6 +2173,7 @@ static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b) return vec; } +#endif /* shift left / or right if "shift" is negative */ static SwsVector *sws_getShiftedVec(SwsVector *a, int shift) @@ -2162,6 +2193,9 @@ static SwsVector *sws_getShiftedVec(SwsVector *a, int shift) return vec; } +#if !FF_API_SWS_VECTOR +static +#endif void sws_shiftVec(SwsVector *a, int shift) { SwsVector *shifted = sws_getShiftedVec(a, shift); @@ -2175,6 +2209,9 @@ void sws_shiftVec(SwsVector *a, int shift) av_free(shifted); } +#if !FF_API_SWS_VECTOR +static +#endif void sws_addVec(SwsVector *a, SwsVector *b) { SwsVector *sum = sws_sumVec(a, b); @@ -2188,6 +2225,7 @@ void sws_addVec(SwsVector *a, SwsVector *b) av_free(sum); } +#if FF_API_SWS_VECTOR void sws_subVec(SwsVector *a, SwsVector *b) { SwsVector *diff = sws_diffVec(a, b); @@ -2225,7 +2263,15 @@ SwsVector *sws_cloneVec(SwsVector *a) return vec; } +#endif +/** + * Print with av_log() a textual representation of the vector a + * if log_level <= av_log_level. + */ +#if !FF_API_SWS_VECTOR +static +#endif void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level) { int i; diff --git a/libswscale/version.h b/libswscale/version.h index 24908b89313..5c1cfb1fb63 100644 --- a/libswscale/version.h +++ b/libswscale/version.h @@ -46,4 +46,8 @@ * the public API and may change, break or disappear at any time. */ +#ifndef FF_API_SWS_VECTOR +#define FF_API_SWS_VECTOR (LIBSWSCALE_VERSION_MAJOR < 6) +#endif + #endif /* SWSCALE_VERSION_H */ -- 2.39.2