summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-02-05 14:28:57 +0100
committerPaul B Mahol <onemda@gmail.com>2021-02-05 15:27:50 +0100
commit8b78eb312de948c408c2437674e6ebf8971857c4 (patch)
tree34a2b7c5d6f88ae803143e4f534a71bcbf4f25a4 /libavfilter
parent593817f51d42165c2d2accf322acb6e2c58ccb76 (diff)
avfilter/vf_lensfun: replace deprecated calls
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_lensfun.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c
index 089121ed08..95f00e8c10 100644
--- a/libavfilter/vf_lensfun.c
+++ b/libavfilter/vf_lensfun.c
@@ -147,10 +147,10 @@ static av_cold int init(AVFilterContext *ctx)
return AVERROR(EINVAL);
}
- lensfun->lens = lf_lens_new();
- lensfun->camera = lf_camera_new();
+ lensfun->lens = lf_lens_create();
+ lensfun->camera = lf_camera_create();
- db = lf_db_new();
+ db = lf_db_create();
if (lf_db_load(db) != LF_NO_ERROR) {
lf_db_destroy(db);
av_log(ctx, AV_LOG_FATAL, "Failed to load lensfun database\n");
@@ -169,7 +169,7 @@ static av_cold int init(AVFilterContext *ctx)
}
lf_free(cameras);
- lenses = lf_db_find_lenses_hd(db, lensfun->camera, NULL, lensfun->lens_model, 0);
+ lenses = lf_db_find_lenses(db, lensfun->camera, NULL, lensfun->lens_model, 0);
if (lenses && *lenses) {
lf_lens_copy(lensfun->lens, *lenses);
av_log(ctx, AV_LOG_INFO, "Using lens %s\n", lensfun->lens->Model);
@@ -210,30 +210,23 @@ static int config_props(AVFilterLink *inlink)
LensfunContext *lensfun = ctx->priv;
int index;
float a;
- int lensfun_mode = 0;
if (!lensfun->modifier) {
if (lensfun->camera && lensfun->lens) {
- lensfun->modifier = lf_modifier_new(lensfun->lens,
- lensfun->camera->CropFactor,
- inlink->w,
- inlink->h);
+ lensfun->modifier = lf_modifier_create(lensfun->lens,
+ lensfun->focal_length,
+ lensfun->camera->CropFactor,
+ inlink->w,
+ inlink->h, LF_PF_U8, lensfun->reverse);
if (lensfun->mode & VIGNETTING)
- lensfun_mode |= LF_MODIFY_VIGNETTING;
- if (lensfun->mode & GEOMETRY_DISTORTION)
- lensfun_mode |= LF_MODIFY_DISTORTION | LF_MODIFY_GEOMETRY | LF_MODIFY_SCALE;
+ lf_modifier_enable_vignetting_correction(lensfun->modifier, lensfun->aperture, lensfun->focus_distance);
+ if (lensfun->mode & GEOMETRY_DISTORTION) {
+ lf_modifier_enable_distortion_correction(lensfun->modifier);
+ lf_modifier_enable_projection_transform(lensfun->modifier, lensfun->target_geometry);
+ lf_modifier_enable_scaling(lensfun->modifier, lensfun->scale);
+ }
if (lensfun->mode & SUBPIXEL_DISTORTION)
- lensfun_mode |= LF_MODIFY_TCA;
- lf_modifier_initialize(lensfun->modifier,
- lensfun->lens,
- LF_PF_U8,
- lensfun->focal_length,
- lensfun->aperture,
- lensfun->focus_distance,
- lensfun->scale,
- lensfun->target_geometry,
- lensfun_mode,
- lensfun->reverse);
+ lf_modifier_enable_tca_correction(lensfun->modifier);
} else {
// lensfun->camera and lensfun->lens should have been initialized
return AVERROR_BUG;