The number of elements is always two or three.
Unified · Split
| @@ -24,6 +24,7 @@ · 23 unmodified lines | |||
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | #include "libavutil/attributes.h" | 26 | #include "libavutil/attributes.h" |
| 27 | #include "libavutil/avassert.h" | ||
| 27 | #include "libavutil/common.h" | 28 | #include "libavutil/common.h" |
| 28 | #include "libavutil/opt.h" | 29 | #include "libavutil/opt.h" |
| 29 | #include "avfilter.h" | 30 | #include "avfilter.h" |
| @@ -134,20 +135,15 @@ static void gauss_solve_triangular(const double *A, const int *p, double *b, int · 104 unmodified lines | |||
| 134 | 135 | ||
| 135 | static int gauss_solve(double *A, double *b, int n) | 136 | static int gauss_solve(double *A, double *b, int n) |
| 136 | { | 137 | { |
| 137 | int *p = av_calloc(n, sizeof(*p)); | 138 | int p[3] = { 0 }; |
| 138 | 139 | ||
| 139 | if (!p) | 140 | av_assert2(n <= FF_ARRAY_ELEMS(p)); |
| 140 | return 1; | ||
| 141 | 141 | ||
| 142 | if (!gauss_make_triangular(A, p, n)) { | 142 | if (!gauss_make_triangular(A, p, n)) |
| 143 | av_freep(&p); | ||
| 144 | return 1; | 143 | return 1; |
| 145 | } | ||
| 146 | 144 | ||
| 147 | gauss_solve_triangular(A, p, b, n); | 145 | gauss_solve_triangular(A, p, b, n); |
| 148 | 146 | ||
| 149 | av_freep(&p); | ||
| 150 | |||
| 151 | return 0; | 147 | return 0; |
| 152 | } | 148 | } |
| 153 | 149 | ||