You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avfilter/vf_guided: Fix indention
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
@@ -110,19 +110,19 @@ static int box_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
|
|||||||
w = (radius << 1) + 1;
|
w = (radius << 1) + 1;
|
||||||
numPix = w * w;
|
numPix = w * w;
|
||||||
for (int i = slice_start;i < slice_end;i++) {
|
for (int i = slice_start;i < slice_end;i++) {
|
||||||
for (int j = 0;j < width;j++) {
|
for (int j = 0;j < width;j++) {
|
||||||
float temp = 0.0;
|
float temp = 0.0;
|
||||||
for (int row = -radius;row <= radius;row++) {
|
for (int row = -radius;row <= radius;row++) {
|
||||||
for (int col = -radius;col <= radius;col++) {
|
for (int col = -radius;col <= radius;col++) {
|
||||||
int x = i + row;
|
int x = i + row;
|
||||||
int y = j + col;
|
int y = j + col;
|
||||||
x = (x < 0) ? 0 : (x >= height ? height - 1 : x);
|
x = (x < 0) ? 0 : (x >= height ? height - 1 : x);
|
||||||
y = (y < 0) ? 0 : (y >= width ? width - 1 : y);
|
y = (y < 0) ? 0 : (y >= width ? width - 1 : y);
|
||||||
temp += src[x * src_stride + y];
|
temp += src[x * src_stride + y];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
dst[i * dst_stride + j] = temp / numPix;
|
||||||
}
|
}
|
||||||
dst[i * dst_stride + j] = temp / numPix;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -161,8 +161,7 @@ static int config_input(AVFilterLink *inlink)
|
|||||||
|
|
||||||
if (s->mode == BASIC) {
|
if (s->mode == BASIC) {
|
||||||
s->sub = 1;
|
s->sub = 1;
|
||||||
}
|
} else if (s->mode == FAST) {
|
||||||
else if (s->mode == FAST) {
|
|
||||||
if (s->radius >= s->sub)
|
if (s->radius >= s->sub)
|
||||||
s->radius = s->radius / s->sub;
|
s->radius = s->radius / s->sub;
|
||||||
else {
|
else {
|
||||||
@@ -235,13 +234,13 @@ static int guided_##name(AVFilterContext *ctx, GuidedContext *s,
|
|||||||
goto end; \
|
goto end; \
|
||||||
} \
|
} \
|
||||||
for (int i = 0;i < h;i++) { \
|
for (int i = 0;i < h;i++) { \
|
||||||
for (int j = 0;j < w;j++) { \
|
for (int j = 0;j < w;j++) { \
|
||||||
int x = i * w + j; \
|
int x = i * w + j; \
|
||||||
I[x] = src[(i * src_stride + j) * sub] / maxval; \
|
I[x] = src[(i * src_stride + j) * sub] / maxval; \
|
||||||
II[x] = I[x] * I[x]; \
|
II[x] = I[x] * I[x]; \
|
||||||
P[x] = srcRef[(i * src_ref_stride + j) * sub] / maxval; \
|
P[x] = srcRef[(i * src_ref_stride + j) * sub] / maxval; \
|
||||||
IP[x] = I[x] * P[x]; \
|
IP[x] = I[x] * P[x]; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
t.width = w; \
|
t.width = w; \
|
||||||
@@ -262,13 +261,13 @@ static int guided_##name(AVFilterContext *ctx, GuidedContext *s,
|
|||||||
ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \
|
ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \
|
||||||
\
|
\
|
||||||
for (int i = 0;i < h;i++) { \
|
for (int i = 0;i < h;i++) { \
|
||||||
for (int j = 0;j < w;j++) { \
|
for (int j = 0;j < w;j++) { \
|
||||||
int x = i * w + j; \
|
int x = i * w + j; \
|
||||||
float varI = meanII[x] - (meanI[x] * meanI[x]); \
|
float varI = meanII[x] - (meanI[x] * meanI[x]); \
|
||||||
float covIP = meanIP[x] - (meanI[x] * meanP[x]); \
|
float covIP = meanIP[x] - (meanI[x] * meanP[x]); \
|
||||||
A[x] = covIP / (varI + eps); \
|
A[x] = covIP / (varI + eps); \
|
||||||
B[x] = meanP[x] - A[x] * meanI[x]; \
|
B[x] = meanP[x] - A[x] * meanI[x]; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
t.src = A; \
|
t.src = A; \
|
||||||
@@ -279,11 +278,11 @@ static int guided_##name(AVFilterContext *ctx, GuidedContext *s,
|
|||||||
ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \
|
ff_filter_execute(ctx, s->box_slice, &t, NULL, FFMIN(h, nb_threads)); \
|
||||||
\
|
\
|
||||||
for (int i = 0;i < height;i++) { \
|
for (int i = 0;i < height;i++) { \
|
||||||
for (int j = 0;j < width;j++) { \
|
for (int j = 0;j < width;j++) { \
|
||||||
int x = i / sub * w + j / sub; \
|
int x = i / sub * w + j / sub; \
|
||||||
dst[i * dst_stride + j] = meanA[x] * src[i * src_stride + j] + \
|
dst[i * dst_stride + j] = meanA[x] * src[i * src_stride + j] + \
|
||||||
meanB[x] * maxval; \
|
meanB[x] * maxval; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
end: \
|
end: \
|
||||||
av_freep(&I); \
|
av_freep(&I); \
|
||||||
@@ -321,13 +320,13 @@ static int filter_frame(AVFilterContext *ctx, AVFrame **out, AVFrame *in, AVFram
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (s->depth <= 8)
|
if (s->depth <= 8)
|
||||||
guided_byte(ctx, s, in->data[plane], ref->data[plane], (*out)->data[plane], s->radius, s->eps,
|
guided_byte(ctx, s, in->data[plane], ref->data[plane], (*out)->data[plane], s->radius, s->eps,
|
||||||
s->planewidth[plane], s->planeheight[plane],
|
s->planewidth[plane], s->planeheight[plane],
|
||||||
in->linesize[plane], ref->linesize[plane], (*out)->linesize[plane], (1 << s->depth) - 1.f);
|
in->linesize[plane], ref->linesize[plane], (*out)->linesize[plane], (1 << s->depth) - 1.f);
|
||||||
else
|
else
|
||||||
guided_word(ctx, s, in->data[plane], ref->data[plane], (*out)->data[plane], s->radius, s->eps,
|
guided_word(ctx, s, in->data[plane], ref->data[plane], (*out)->data[plane], s->radius, s->eps,
|
||||||
s->planewidth[plane], s->planeheight[plane],
|
s->planewidth[plane], s->planeheight[plane],
|
||||||
in->linesize[plane] / 2, ref->linesize[plane] / 2, (*out)->linesize[plane] / 2, (1 << s->depth) - 1.f);
|
in->linesize[plane] / 2, ref->linesize[plane] / 2, (*out)->linesize[plane] / 2, (1 << s->depth) - 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user