| @@ -54,21 +54,14 @@ · 53 unmodified lines |
| 54 | 54 | #include "libavutil/x86/asm.h" |
| 55 | 55 | #include "libavutil/x86/cpu.h" |
| 56 | 56 | |
| 57 | | −// We have to implement deprecated functions until they are removed, this is the |
| 58 | | −// simplest way to prevent warnings |
| 59 | | −#undef attribute_deprecated |
| 60 | | −#define attribute_deprecated |
| 61 | | − |
| 62 | 57 | #include "rgb2rgb.h" |
| 63 | 58 | #include "swscale.h" |
| 64 | 59 | #include "swscale_internal.h" |
| 65 | 60 | |
| 66 | | −#if !FF_API_SWS_VECTOR |
| 67 | 61 | static SwsVector *sws_getIdentityVec(void); |
| 68 | 62 | static void sws_addVec(SwsVector *a, SwsVector *b); |
| 69 | 63 | static void sws_shiftVec(SwsVector *a, int shift); |
| 70 | 64 | static void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level); |
| 71 | | −#endif |
| 72 | 65 | |
| 73 | 66 | static void handle_formats(SwsContext *c); |
| 74 | 67 | |
| @@ -2081,9 +2074,7 @@ SwsVector *sws_getGaussianVec(double variance, double quality) · 2006 unmodified lines |
| 2081 | 2074 | * Allocate and return a vector with length coefficients, all |
| 2082 | 2075 | * with the same value c. |
| 2083 | 2076 | */ |
| 2084 | | −#if !FF_API_SWS_VECTOR |
| 2085 | 2077 | static |
| 2086 | | −#endif |
| 2087 | 2078 | SwsVector *sws_getConstVec(double c, int length) |
| 2088 | 2079 | { |
| 2089 | 2080 | int i; |
| @@ -2102,9 +2093,7 @@ SwsVector *sws_getConstVec(double c, int length) · 12 unmodified lines |
| 2102 | 2093 | * Allocate and return a vector with just one coefficient, with |
| 2103 | 2094 | * value 1.0. |
| 2104 | 2095 | */ |
| 2105 | | −#if !FF_API_SWS_VECTOR |
| 2106 | 2096 | static |
| 2107 | | −#endif |
| 2108 | 2097 | SwsVector *sws_getIdentityVec(void) |
| 2109 | 2098 | { |
| 2110 | 2099 | return sws_getConstVec(1.0, 1); |
| @@ -2134,26 +2123,6 @@ void sws_normalizeVec(SwsVector *a, double height) · 23 unmodified lines |
| 2134 | 2123 | sws_scaleVec(a, height / sws_dcVec(a)); |
| 2135 | 2124 | } |
| 2136 | 2125 | |
| 2137 | | −#if FF_API_SWS_VECTOR |
| 2138 | | −static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b) |
| 2139 | | −{ |
| 2140 | | − int length = a->length + b->length - 1; |
| 2141 | | − int i, j; |
| 2142 | | − SwsVector *vec = sws_getConstVec(0.0, length); |
| 2143 | | − |
| 2144 | | − if (!vec) |
| 2145 | | − return NULL; |
| 2146 | | − |
| 2147 | | − for (i = 0; i < a->length; i++) { |
| 2148 | | − for (j = 0; j < b->length; j++) { |
| 2149 | | − vec->coeff[i + j] += a->coeff[i] * b->coeff[j]; |
| 2150 | | − } |
| 2151 | | − } |
| 2152 | | − |
| 2153 | | − return vec; |
| 2154 | | −} |
| 2155 | | −#endif |
| 2156 | | − |
| 2157 | 2126 | static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b) |
| 2158 | 2127 | { |
| 2159 | 2128 | int length = FFMAX(a->length, b->length); |
| @@ -2171,25 +2140,6 @@ static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b) · 11 unmodified lines |
| 2171 | 2140 | return vec; |
| 2172 | 2141 | } |
| 2173 | 2142 | |
| 2174 | | −#if FF_API_SWS_VECTOR |
| 2175 | | −static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b) |
| 2176 | | −{ |
| 2177 | | − int length = FFMAX(a->length, b->length); |
| 2178 | | − int i; |
| 2179 | | − SwsVector *vec = sws_getConstVec(0.0, length); |
| 2180 | | − |
| 2181 | | − if (!vec) |
| 2182 | | − return NULL; |
| 2183 | | − |
| 2184 | | − for (i = 0; i < a->length; i++) |
| 2185 | | − vec->coeff[i + (length - 1) / 2 - (a->length - 1) / 2] += a->coeff[i]; |
| 2186 | | − for (i = 0; i < b->length; i++) |
| 2187 | | − vec->coeff[i + (length - 1) / 2 - (b->length - 1) / 2] -= b->coeff[i]; |
| 2188 | | − |
| 2189 | | − return vec; |
| 2190 | | −} |
| 2191 | | −#endif |
| 2192 | | − |
| 2193 | 2143 | /* shift left / or right if "shift" is negative */ |
| 2194 | 2144 | static SwsVector *sws_getShiftedVec(SwsVector *a, int shift) |
| 2195 | 2145 | { |
| @@ -2208,9 +2158,7 @@ static SwsVector *sws_getShiftedVec(SwsVector *a, int shift) · 12 unmodified lines |
| 2208 | 2158 | return vec; |
| 2209 | 2159 | } |
| 2210 | 2160 | |
| 2211 | | −#if !FF_API_SWS_VECTOR |
| 2212 | 2161 | static |
| 2213 | | −#endif |
| 2214 | 2162 | void sws_shiftVec(SwsVector *a, int shift) |
| 2215 | 2163 | { |
| 2216 | 2164 | SwsVector *shifted = sws_getShiftedVec(a, shift); |
| @@ -2224,9 +2172,7 @@ void sws_shiftVec(SwsVector *a, int shift) · 7 unmodified lines |
| 2224 | 2172 | av_free(shifted); |
| 2225 | 2173 | } |
| 2226 | 2174 | |
| 2227 | | −#if !FF_API_SWS_VECTOR |
| 2228 | 2175 | static |
| 2229 | | −#endif |
| 2230 | 2176 | void sws_addVec(SwsVector *a, SwsVector *b) |
| 2231 | 2177 | { |
| 2232 | 2178 | SwsVector *sum = sws_sumVec(a, b); |
| @@ -2240,53 +2186,11 @@ void sws_addVec(SwsVector *a, SwsVector *b) · 7 unmodified lines |
| 2240 | 2186 | av_free(sum); |
| 2241 | 2187 | } |
| 2242 | 2188 | |
| 2243 | | −#if FF_API_SWS_VECTOR |
| 2244 | | −void sws_subVec(SwsVector *a, SwsVector *b) |
| 2245 | | −{ |
| 2246 | | − SwsVector *diff = sws_diffVec(a, b); |
| 2247 | | − if (!diff) { |
| 2248 | | − makenan_vec(a); |
| 2249 | | − return; |
| 2250 | | − } |
| 2251 | | − av_free(a->coeff); |
| 2252 | | − a->coeff = diff->coeff; |
| 2253 | | − a->length = diff->length; |
| 2254 | | − av_free(diff); |
| 2255 | | −} |
| 2256 | | − |
| 2257 | | −void sws_convVec(SwsVector *a, SwsVector *b) |
| 2258 | | −{ |
| 2259 | | − SwsVector *conv = sws_getConvVec(a, b); |
| 2260 | | − if (!conv) { |
| 2261 | | − makenan_vec(a); |
| 2262 | | − return; |
| 2263 | | − } |
| 2264 | | − av_free(a->coeff); |
| 2265 | | − a->coeff = conv->coeff; |
| 2266 | | − a->length = conv->length; |
| 2267 | | − av_free(conv); |
| 2268 | | −} |
| 2269 | | − |
| 2270 | | −SwsVector *sws_cloneVec(SwsVector *a) |
| 2271 | | −{ |
| 2272 | | − SwsVector *vec = sws_allocVec(a->length); |
| 2273 | | − |
| 2274 | | − if (!vec) |
| 2275 | | − return NULL; |
| 2276 | | − |
| 2277 | | − memcpy(vec->coeff, a->coeff, a->length * sizeof(*a->coeff)); |
| 2278 | | − |
| 2279 | | − return vec; |
| 2280 | | −} |
| 2281 | | −#endif |
| 2282 | | − |
| 2283 | 2189 | /** |
| 2284 | 2190 | * Print with av_log() a textual representation of the vector a |
| 2285 | 2191 | * if log_level <= av_log_level. |
| 2286 | 2192 | */ |
| 2287 | | −#if !FF_API_SWS_VECTOR |
| 2288 | 2193 | static |
| 2289 | | −#endif |
| 2290 | 2194 | void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level) |
| 2291 | 2195 | { |
| 2292 | 2196 | int i; |