Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -709,12 +709,14 @@ static int param_init(AVFilterContext *ctx) · 708 unmodified lines | ||
| 709 | 709 | if (!strcmp(ctx->filter->name, "convolution")) { |
| 710 | 710 | for (i = 0; i < 4; i++) { |
| 711 | 711 | int *matrix = (int *)s->matrix[i]; |
| 712 | − char *p, *arg, *saveptr = NULL; | |
| 713 | − float sum = 0; | |
| 712 | + char *orig, *p, *arg, *saveptr = NULL; | |
| 713 | + float sum = 1.f; | |
| 714 | 714 | |
| 715 | − p = s->matrix_str[i]; | |
| 715 | + p = orig = av_strdup(s->matrix_str[i]); | |
| 716 | 716 | if (p) { |
| 717 | 717 | s->matrix_length[i] = 0; |
| 718 | + s->rdiv[i] = 0.f; | |
| 719 | + sum = 0.f; | |
| 718 | 720 | |
| 719 | 721 | while (s->matrix_length[i] < 49) { |
| 720 | 722 | if (!(arg = av_strtok(p, " |", &saveptr))) |
| @@ -726,6 +728,7 @@ static int param_init(AVFilterContext *ctx) · 5 unmodified lines | ||
| 726 | 728 | s->matrix_length[i]++; |
| 727 | 729 | } |
| 728 | 730 | |
| 731 | + av_freep(&orig); | |
| 729 | 732 | if (!(s->matrix_length[i] & 1)) { |
| 730 | 733 | av_log(ctx, AV_LOG_ERROR, "number of matrix elements must be odd\n"); |
| 731 | 734 | return AVERROR(EINVAL); |