History

avfilter/vf_convolution: improve runtime support for convolution filter

Paul B Mahol committed 5 years ago

Commit 6c45d341 parent 9e8bb9e1 file · +6 −3Browse files

Unified · Split

libavfilter/vf_convolution.c+6−3
@@ -709,12 +709,14 @@ static int param_init(AVFilterContext *ctx) · 708 unmodified lines
709709 if (!strcmp(ctx->filter->name, "convolution")) {
710710 for (i = 0; i < 4; i++) {
711711 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;
714714
715− p = s->matrix_str[i];
715+ p = orig = av_strdup(s->matrix_str[i]);
716716 if (p) {
717717 s->matrix_length[i] = 0;
718+ s->rdiv[i] = 0.f;
719+ sum = 0.f;
718720
719721 while (s->matrix_length[i] < 49) {
720722 if (!(arg = av_strtok(p, " |", &saveptr)))
@@ -726,6 +728,7 @@ static int param_init(AVFilterContext *ctx) · 5 unmodified lines
726728 s->matrix_length[i]++;
727729 }
728730
731+ av_freep(&orig);
729732 if (!(s->matrix_length[i] & 1)) {
730733 av_log(ctx, AV_LOG_ERROR, "number of matrix elements must be odd\n");
731734 return AVERROR(EINVAL);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t