Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -62,6 +62,10 @@ typedef struct ColorMapContext { · 61 unmodified lines | ||
| 62 | 62 | float (*kernel)(const float *x, const float *y); |
| 63 | 63 | |
| 64 | 64 | FFFrameSync fs; |
| 65 | + | |
| 66 | + double A[(MAX_SIZE + 4) * (MAX_SIZE + 4)]; | |
| 67 | + double b[MAX_SIZE + 4]; | |
| 68 | + int pivot[MAX_SIZE + 4]; | |
| 65 | 69 | } ColorMapContext; |
| 66 | 70 | |
| 67 | 71 | #define OFFSET(x) offsetof(ColorMapContext, x) |
| @@ -262,12 +266,9 @@ static void build_map(AVFilterContext *ctx) · 194 unmodified lines | ||
| 262 | 266 | { |
| 263 | 267 | const int N = s->nb_maps; |
| 264 | 268 | const int N4 = N + 4; |
| 265 | − double *A = av_calloc(sizeof(*A), N4 * N4); | |
| 266 | − double *b = av_calloc(sizeof(*b), N4); | |
| 267 | − int *pivot = NULL; | |
| 268 | − | |
| 269 | − if (!A || !b) | |
| 270 | − goto error; | |
| 269 | + double *A = s->A; | |
| 270 | + double *b = s->b; | |
| 271 | + int *pivot = s->pivot; | |
| 271 | 272 | |
| 272 | 273 | for (int j = 0; j < N; j++) |
| 273 | 274 | for (int i = j; i < N; i++) |
| @@ -286,10 +287,6 @@ static void build_map(AVFilterContext *ctx) · 12 unmodified lines | ||
| 286 | 287 | for (int i = N;i < N4; i++) |
| 287 | 288 | A[j * N4 + i] = 0.; |
| 288 | 289 | |
| 289 | − pivot = av_calloc(N4, sizeof(*pivot)); | |
| 290 | − if (!pivot) | |
| 291 | − goto error; | |
| 292 | − | |
| 293 | 290 | if (gauss_make_triangular(A, pivot, N4)) { |
| 294 | 291 | for (int i = 0; i < N; i++) |
| 295 | 292 | b[i] = s->target[i][c]; |
| @@ -304,10 +301,6 @@ static void build_map(AVFilterContext *ctx) · 8 unmodified lines | ||
| 304 | 301 | for (int i = 0; i < 4; i++) |
| 305 | 302 | s->icoeff[i][c] = b[N + i]; |
| 306 | 303 | } |
| 307 | −error: | |
| 308 | − av_free(pivot); | |
| 309 | − av_free(b); | |
| 310 | − av_free(A); | |
| 311 | 304 | } |
| 312 | 305 | } |
| 313 | 306 | } |