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