* [FFmpeg-devel] [PATCH] avfilter/lensfun: add option db_path
@ 2022-04-10 6:06 Gyan Doshi
2022-04-10 17:45 ` Gyan Doshi
0 siblings, 1 reply; 3+ messages in thread
From: Gyan Doshi @ 2022-04-10 6:06 UTC (permalink / raw)
To: ffmpeg-devel
The lensfun filter, at present, loads its database from a path hardcoded
at build time. This may not be known or available to end users.
Added option db_path allows custom path.
---
doc/filters.texi | 4 ++++
libavfilter/vf_lensfun.c | 8 +++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 6a66b0ed11..9861f43c07 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -14693,6 +14693,10 @@ required.
The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
option is required.
+@item db_path
+The full path to the lens database folder. If not set, the filter will attempt to
+load the database from the install path when the library was built. Default is unset.
+
@item mode
The type of correction to apply. The following values are valid options:
diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c
index 596daed104..35c522a723 100644
--- a/libavfilter/vf_lensfun.c
+++ b/libavfilter/vf_lensfun.c
@@ -73,7 +73,7 @@ typedef struct DistortionCorrectionThreadData {
typedef struct LensfunContext {
const AVClass *class;
- const char *make, *model, *lens_model;
+ const char *make, *model, *lens_model, *db_path;
int mode;
float focal_length;
float aperture;
@@ -97,6 +97,7 @@ static const AVOption lensfun_options[] = {
{ "make", "set camera maker", OFFSET(make), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "model", "set camera model", OFFSET(model), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "lens_model", "set lens model", OFFSET(lens_model), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
+ { "db_path", "set path to database", OFFSET(db_path), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
{ "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=GEOMETRY_DISTORTION}, 0, VIGNETTING | GEOMETRY_DISTORTION | SUBPIXEL_DISTORTION, FLAGS, "mode" },
{ "vignetting", "fix lens vignetting", 0, AV_OPT_TYPE_CONST, {.i64=VIGNETTING}, 0, 0, FLAGS, "mode" },
{ "geometry", "correct geometry distortion", 0, AV_OPT_TYPE_CONST, {.i64=GEOMETRY_DISTORTION}, 0, 0, FLAGS, "mode" },
@@ -136,9 +137,10 @@ static av_cold int init(AVFilterContext *ctx)
const lfLens **lenses;
db = lf_db_create();
- if (lf_db_load(db) != LF_NO_ERROR) {
+ if ((lensfun->db_path ? lf_db_load_path(db, lensfun->db_path) : lf_db_load(db)) != LF_NO_ERROR) {
lf_db_destroy(db);
- av_log(ctx, AV_LOG_FATAL, "Failed to load lensfun database\n");
+ av_log(ctx, AV_LOG_FATAL, "Failed to load lensfun database from %s path\n",
+ lensfun->db_path ? lensfun->db_path : "default");
return AVERROR_INVALIDDATA;
}
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avfilter/lensfun: add option db_path
2022-04-10 6:06 [FFmpeg-devel] [PATCH] avfilter/lensfun: add option db_path Gyan Doshi
@ 2022-04-10 17:45 ` Gyan Doshi
2022-04-13 6:26 ` Gyan Doshi
0 siblings, 1 reply; 3+ messages in thread
From: Gyan Doshi @ 2022-04-10 17:45 UTC (permalink / raw)
To: ffmpeg-devel
Plan to push tomorrow.
On 2022-04-10 11:36 am, Gyan Doshi wrote:
> The lensfun filter, at present, loads its database from a path hardcoded
> at build time. This may not be known or available to end users.
>
> Added option db_path allows custom path.
> ---
> doc/filters.texi | 4 ++++
> libavfilter/vf_lensfun.c | 8 +++++---
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 6a66b0ed11..9861f43c07 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -14693,6 +14693,10 @@ required.
> The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6 IS STM"). This
> option is required.
>
> +@item db_path
> +The full path to the lens database folder. If not set, the filter will attempt to
> +load the database from the install path when the library was built. Default is unset.
> +
> @item mode
> The type of correction to apply. The following values are valid options:
>
> diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c
> index 596daed104..35c522a723 100644
> --- a/libavfilter/vf_lensfun.c
> +++ b/libavfilter/vf_lensfun.c
> @@ -73,7 +73,7 @@ typedef struct DistortionCorrectionThreadData {
>
> typedef struct LensfunContext {
> const AVClass *class;
> - const char *make, *model, *lens_model;
> + const char *make, *model, *lens_model, *db_path;
> int mode;
> float focal_length;
> float aperture;
> @@ -97,6 +97,7 @@ static const AVOption lensfun_options[] = {
> { "make", "set camera maker", OFFSET(make), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
> { "model", "set camera model", OFFSET(model), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
> { "lens_model", "set lens model", OFFSET(lens_model), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
> + { "db_path", "set path to database", OFFSET(db_path), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
> { "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=GEOMETRY_DISTORTION}, 0, VIGNETTING | GEOMETRY_DISTORTION | SUBPIXEL_DISTORTION, FLAGS, "mode" },
> { "vignetting", "fix lens vignetting", 0, AV_OPT_TYPE_CONST, {.i64=VIGNETTING}, 0, 0, FLAGS, "mode" },
> { "geometry", "correct geometry distortion", 0, AV_OPT_TYPE_CONST, {.i64=GEOMETRY_DISTORTION}, 0, 0, FLAGS, "mode" },
> @@ -136,9 +137,10 @@ static av_cold int init(AVFilterContext *ctx)
> const lfLens **lenses;
>
> db = lf_db_create();
> - if (lf_db_load(db) != LF_NO_ERROR) {
> + if ((lensfun->db_path ? lf_db_load_path(db, lensfun->db_path) : lf_db_load(db)) != LF_NO_ERROR) {
> lf_db_destroy(db);
> - av_log(ctx, AV_LOG_FATAL, "Failed to load lensfun database\n");
> + av_log(ctx, AV_LOG_FATAL, "Failed to load lensfun database from %s path\n",
> + lensfun->db_path ? lensfun->db_path : "default");
> return AVERROR_INVALIDDATA;
> }
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avfilter/lensfun: add option db_path
2022-04-10 17:45 ` Gyan Doshi
@ 2022-04-13 6:26 ` Gyan Doshi
0 siblings, 0 replies; 3+ messages in thread
From: Gyan Doshi @ 2022-04-13 6:26 UTC (permalink / raw)
To: ffmpeg-devel
Pushed as 1405b65d22d8e05ae8bb74fc13e275be2ae6b9f9
On 2022-04-10 11:15 pm, Gyan Doshi wrote:
> Plan to push tomorrow.
>
> On 2022-04-10 11:36 am, Gyan Doshi wrote:
>> The lensfun filter, at present, loads its database from a path hardcoded
>> at build time. This may not be known or available to end users.
>>
>> Added option db_path allows custom path.
>> ---
>> doc/filters.texi | 4 ++++
>> libavfilter/vf_lensfun.c | 8 +++++---
>> 2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index 6a66b0ed11..9861f43c07 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -14693,6 +14693,10 @@ required.
>> The model of the lens (for example, "Canon EF-S 18-55mm f/3.5-5.6
>> IS STM"). This
>> option is required.
>> +@item db_path
>> +The full path to the lens database folder. If not set, the filter
>> will attempt to
>> +load the database from the install path when the library was built.
>> Default is unset.
>> +
>> @item mode
>> The type of correction to apply. The following values are valid
>> options:
>> diff --git a/libavfilter/vf_lensfun.c b/libavfilter/vf_lensfun.c
>> index 596daed104..35c522a723 100644
>> --- a/libavfilter/vf_lensfun.c
>> +++ b/libavfilter/vf_lensfun.c
>> @@ -73,7 +73,7 @@ typedef struct DistortionCorrectionThreadData {
>> typedef struct LensfunContext {
>> const AVClass *class;
>> - const char *make, *model, *lens_model;
>> + const char *make, *model, *lens_model, *db_path;
>> int mode;
>> float focal_length;
>> float aperture;
>> @@ -97,6 +97,7 @@ static const AVOption lensfun_options[] = {
>> { "make", "set camera maker", OFFSET(make), AV_OPT_TYPE_STRING,
>> {.str=NULL}, 0, 0, FLAGS },
>> { "model", "set camera model", OFFSET(model),
>> AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
>> { "lens_model", "set lens model", OFFSET(lens_model),
>> AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
>> + { "db_path", "set path to database", OFFSET(db_path),
>> AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
>> { "mode", "set mode", OFFSET(mode), AV_OPT_TYPE_INT,
>> {.i64=GEOMETRY_DISTORTION}, 0, VIGNETTING | GEOMETRY_DISTORTION |
>> SUBPIXEL_DISTORTION, FLAGS, "mode" },
>> { "vignetting", "fix lens vignetting", 0,
>> AV_OPT_TYPE_CONST, {.i64=VIGNETTING}, 0, 0, FLAGS, "mode" },
>> { "geometry", "correct geometry distortion", 0,
>> AV_OPT_TYPE_CONST, {.i64=GEOMETRY_DISTORTION}, 0, 0, FLAGS, "mode" },
>> @@ -136,9 +137,10 @@ static av_cold int init(AVFilterContext *ctx)
>> const lfLens **lenses;
>> db = lf_db_create();
>> - if (lf_db_load(db) != LF_NO_ERROR) {
>> + if ((lensfun->db_path ? lf_db_load_path(db, lensfun->db_path) :
>> lf_db_load(db)) != LF_NO_ERROR) {
>> lf_db_destroy(db);
>> - av_log(ctx, AV_LOG_FATAL, "Failed to load lensfun database\n");
>> + av_log(ctx, AV_LOG_FATAL, "Failed to load lensfun database
>> from %s path\n",
>> + lensfun->db_path ? lensfun->db_path : "default");
>> return AVERROR_INVALIDDATA;
>> }
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-13 6:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-10 6:06 [FFmpeg-devel] [PATCH] avfilter/lensfun: add option db_path Gyan Doshi
2022-04-10 17:45 ` Gyan Doshi
2022-04-13 6:26 ` Gyan Doshi
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git