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

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_convolution.c+6−3
@@ -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);

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