[FFmpeg-cvslog] lavfi/vf_libplacebo: add corner_rounding option

Niklas Haas git at videolan.org
Mon May 29 20:11:28 EEST 2023


ffmpeg | branch: master | Niklas Haas <git at haasn.dev> | Wed May 24 15:47:44 2023 +0200| [c4cdd794355eaf7c4e63f288fef5bac0216f0f2c] | committer: Niklas Haas

lavfi/vf_libplacebo: add corner_rounding option

For what use it may be.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c4cdd794355eaf7c4e63f288fef5bac0216f0f2c
---

 doc/filters.texi            | 6 ++++++
 libavfilter/vf_libplacebo.c | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/doc/filters.texi b/doc/filters.texi
index c47e88e5d4..a46357bfd8 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -16164,6 +16164,12 @@ example as a result of @option{normalize_sar}. For the general syntax of this
 option, check the @ref{color syntax,,"Color" section in the ffmpeg-utils
 manual,ffmpeg-utils}. Defaults to @code{black}.
 
+ at item corner_rounding
+Render frames with rounded corners. The value, given as a float ranging from
+ at code{0.0} to @code{1.0}, indicates the relative degree of rounding, from fully
+square to fully circular. In other words, it gives the radius divided by half
+the smaller side length. Defaults to @code{0.0}.
+
 @item colorspace
 @item color_primaries
 @item color_trc
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index 0a849f8676..b546f02dc6 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -148,6 +148,7 @@ typedef struct LibplaceboContext {
     AVExpr *pos_x_pexpr, *pos_y_pexpr, *pos_w_pexpr, *pos_h_pexpr;
     AVRational target_sar;
     float pad_crop_ratio;
+    float corner_rounding;
     int force_original_aspect_ratio;
     int force_divisible_by;
     int normalize_sar;
@@ -440,6 +441,9 @@ static int update_settings(AVFilterContext *ctx)
             (float) color_rgba[1] / UINT8_MAX,
             (float) color_rgba[2] / UINT8_MAX,
         },
+#if PL_API_VER >= 277
+        .corner_rounding = s->corner_rounding,
+#endif
 
         .deband_params = s->deband ? &s->deband_params : NULL,
         .sigmoid_params = s->sigmoid ? &pl_sigmoid_default_params : NULL,
@@ -1154,6 +1158,7 @@ static const AVOption libplacebo_options[] = {
     { "normalize_sar", "force SAR normalization to 1:1 by adjusting pos_x/y/w/h", OFFSET(normalize_sar), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, STATIC },
     { "pad_crop_ratio", "ratio between padding and cropping when normalizing SAR (0=pad, 1=crop)", OFFSET(pad_crop_ratio), AV_OPT_TYPE_FLOAT, {.dbl=0.0}, 0.0, 1.0, DYNAMIC },
     { "fillcolor", "Background fill color", OFFSET(fillcolor), AV_OPT_TYPE_STRING, {.str = "black"}, .flags = DYNAMIC },
+    { "corner_rounding", "Corner rounding radius", OFFSET(corner_rounding), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, 0.0, 1.0, .flags = DYNAMIC },
 
     {"colorspace", "select colorspace", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64=-1}, -1, AVCOL_SPC_NB-1, DYNAMIC, "colorspace"},
     {"auto", "keep the same colorspace",  0, AV_OPT_TYPE_CONST, {.i64=-1},                          INT_MIN, INT_MAX, STATIC, "colorspace"},



More information about the ffmpeg-cvslog mailing list