libavfilter/vf_nlmeans_vulkan: clean up defaults
Change per-plane strength defaults to -1.0.
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#define TYPE_BLOCK_SIZE (TYPE_SIZE * TYPE_BLOCK_ELEMS)
|
||||
#define WG_SIZE 32
|
||||
|
||||
// prevent macro expansion in GLSL
|
||||
#undef isinf
|
||||
|
||||
typedef struct NLMeansVulkanContext {
|
||||
@@ -416,7 +417,7 @@ static av_cold int init_weights_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e
|
||||
GLSLC(1, c_plane = comp_plane[comp_idx]; );
|
||||
GLSLC(1, p = patch_size[comp_idx]; );
|
||||
GLSLC(1, s = strength[comp_idx]; );
|
||||
GLSLC(1, if (pos.y < p || pos.y >= height[c_plane] - p || pos.x < p || pos.x >= width[c_plane] - p || isinf(s)) );
|
||||
GLSLC(1, if (isinf(s) || pos.x < p || pos.y < p || pos.x >= width[c_plane] - p || pos.y >= height[c_plane] - p) );
|
||||
GLSLC(2, return; );
|
||||
GLSLC(0, );
|
||||
GLSLC(1, offset = integral_size * (invoc_idx * nb_components + comp_idx); );
|
||||
@@ -424,7 +425,7 @@ static av_cold int init_weights_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e
|
||||
for (int i = 0; i < TYPE_ELEMS; i++)
|
||||
GLSLF(1, offs[%i] = xyoffsets[xyoffs_start + %i*invoc_idx + %i]; ,i,TYPE_ELEMS,i);
|
||||
GLSLC(0, );
|
||||
GLSLC(1, ws_off = ws_count * invoc_idx + ws_offset[comp_idx] + pos.y * ws_stride[comp_idx]; );
|
||||
GLSLC(1, ws_off = ws_count * invoc_idx + ws_offset[comp_idx] + pos.y * ws_stride[comp_idx] + pos.x; );
|
||||
GLSLC(1, size = imageSize(input_img[c_plane]); );
|
||||
GLSLC(0, );
|
||||
GLSLC(1, DTYPE a; );
|
||||
@@ -460,8 +461,8 @@ static av_cold int init_weights_pipeline(FFVulkanContext *vkctx, FFVkExecPool *e
|
||||
GLSLC(1, w_sum = w[0] + w[1] + w[2] + w[3]; );
|
||||
GLSLC(1, sum = dot(w, src * 255); );
|
||||
GLSLC(0, );
|
||||
GLSLC(1, weights[ws_off + pos.x] += w_sum; );
|
||||
GLSLC(1, sums[ws_off + pos.x] += sum; );
|
||||
GLSLC(1, weights[ws_off] += w_sum; );
|
||||
GLSLC(1, sums[ws_off] += sum; );
|
||||
GLSLC(0, } );
|
||||
|
||||
RET(spv->compile_shader(vkctx, spv, shd, &spv_data, &spv_len, "main", &spv_opaque));
|
||||
@@ -634,7 +635,7 @@ static av_cold int init_filter(AVFilterContext *ctx)
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
double str = !isnan(s->opts.sc[i]) ? s->opts.sc[i] : s->opts.s;
|
||||
double str = s->opts.sc[i] != -1.0 ? s->opts.sc[i] : s->opts.s;
|
||||
int ps = (s->opts.pc[i] ? s->opts.pc[i] : s->opts.p);
|
||||
str = 10.0f*str;
|
||||
str *= -str;
|
||||
@@ -1177,10 +1178,10 @@ static const AVOption nlmeans_vulkan_options[] = {
|
||||
{ "r", "research window radius", OFFSET(opts.r), AV_OPT_TYPE_INT, { .i64 = 7*2+1 }, 0, 99, FLAGS },
|
||||
{ "t", "parallelism", OFFSET(opts.t), AV_OPT_TYPE_INT, { .i64 = 8 }, 1, 64, FLAGS },
|
||||
|
||||
{ "s1", "denoising strength for component 1", OFFSET(opts.sc[0]), AV_OPT_TYPE_DOUBLE, { .dbl = NAN }, 0.0, 100.0, FLAGS },
|
||||
{ "s2", "denoising strength for component 2", OFFSET(opts.sc[1]), AV_OPT_TYPE_DOUBLE, { .dbl = NAN }, 0.0, 100.0, FLAGS },
|
||||
{ "s3", "denoising strength for component 3", OFFSET(opts.sc[2]), AV_OPT_TYPE_DOUBLE, { .dbl = NAN }, 0.0, 100.0, FLAGS },
|
||||
{ "s4", "denoising strength for component 4", OFFSET(opts.sc[3]), AV_OPT_TYPE_DOUBLE, { .dbl = NAN }, 0.0, 100.0, FLAGS },
|
||||
{ "s1", "denoising strength for component 1", OFFSET(opts.sc[0]), AV_OPT_TYPE_DOUBLE, { .dbl = -1.0 }, 0.0, 100.0, FLAGS },
|
||||
{ "s2", "denoising strength for component 2", OFFSET(opts.sc[1]), AV_OPT_TYPE_DOUBLE, { .dbl = -1.0 }, 0.0, 100.0, FLAGS },
|
||||
{ "s3", "denoising strength for component 3", OFFSET(opts.sc[2]), AV_OPT_TYPE_DOUBLE, { .dbl = -1.0 }, 0.0, 100.0, FLAGS },
|
||||
{ "s4", "denoising strength for component 4", OFFSET(opts.sc[3]), AV_OPT_TYPE_DOUBLE, { .dbl = -1.0 }, 0.0, 100.0, FLAGS },
|
||||
|
||||
{ "p1", "patch size for component 1", OFFSET(opts.pc[0]), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 99, FLAGS },
|
||||
{ "p2", "patch size for component 2", OFFSET(opts.pc[1]), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 99, FLAGS },
|
||||
|
||||
Reference in New Issue
Block a user