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