Showing the changes to libavfilter (1 of 2 files). Show all
Unified · Split
| @@ -76,12 +76,13 @@ static const AVOption gradients_options[] = { · 75 unmodified lines | ||
| 76 | 76 | {"duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1}, -1, INT64_MAX, FLAGS }, |
| 77 | 77 | {"d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=-1}, -1, INT64_MAX, FLAGS }, |
| 78 | 78 | {"speed", "set gradients rotation speed", OFFSET(speed), AV_OPT_TYPE_FLOAT,{.dbl=0.01}, 0.00001, 1, FLAGS }, |
| 79 | − {"type", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS, "type" }, | |
| 80 | − {"t", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS, "type" }, | |
| 81 | − {"linear", "set gradient type", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "type" }, | |
| 82 | − {"radial", "set gradient type", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "type" }, | |
| 83 | − {"circular", "set gradient type", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "type" }, | |
| 84 | − {"spiral", "set gradient type", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, "type" }, | |
| 79 | + {"type", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 4, FLAGS, "type" }, | |
| 80 | + {"t", "set gradient type", OFFSET(type), AV_OPT_TYPE_INT, {.i64=0}, 0, 4, FLAGS, "type" }, | |
| 81 | + { "linear", "set linear gradient", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "type" }, | |
| 82 | + { "radial", "set radial gradient", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "type" }, | |
| 83 | + { "circular", "set circular gradient", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "type" }, | |
| 84 | + { "spiral", "set spiral gradient", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, "type" }, | |
| 85 | + { "square", "set square gradient", 0, AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, FLAGS, "type" }, | |
| 85 | 86 | {NULL}, |
| 86 | 87 | }; |
| 87 | 88 | |
| @@ -219,6 +220,9 @@ static float project(float origin_x, float origin_y, · 131 unmodified lines | ||
| 219 | 220 | case 3: |
| 220 | 221 | od_s_q = M_PI * 2.f; |
| 221 | 222 | break; |
| 223 | + case 4: | |
| 224 | + od_s_q = fmaxf(fabsf(od_x), fabsf(od_y)); | |
| 225 | + break; | |
| 222 | 226 | } |
| 223 | 227 | |
| 224 | 228 | switch (type) { |
| @@ -234,6 +238,9 @@ static float project(float origin_x, float origin_y, · 9 unmodified lines | ||
| 234 | 238 | case 3: |
| 235 | 239 | op_x_od = fmodf(atan2f(op_x, op_y) + M_PI + point_x / fmaxf(origin_x, dest_x), 2.f * M_PI); |
| 236 | 240 | break; |
| 241 | + case 4: | |
| 242 | + op_x_od = fmaxf(fabsf(op_x), fabsf(op_y)); | |
| 243 | + break; | |
| 237 | 244 | } |
| 238 | 245 | |
| 239 | 246 | // Normalize and clamp range. |
| @@ -255,7 +262,7 @@ static int draw_gradients_slice(AVFilterContext *ctx, void *arg, int job, int nb · 15 unmodified lines | ||
| 255 | 262 | for (int y = start; y < end; y++) { |
| 256 | 263 | for (int x = 0; x < width; x++) { |
| 257 | 264 | float factor = project(s->fx0, s->fy0, s->fx1, s->fy1, x, y, type); |
| 258 | − dst[x] = lerp_colors(s->color_rgba, s->nb_colors, s->nb_colors + (type >= 2), factor); | |
| 265 | + dst[x] = lerp_colors(s->color_rgba, s->nb_colors, s->nb_colors + (type >= 2 && type <= 3), factor); | |
| 259 | 266 | } |
| 260 | 267 | |
| 261 | 268 | dst += linesize; |
| @@ -279,7 +286,7 @@ static int draw_gradients_slice16(AVFilterContext *ctx, void *arg, int job, int · 17 unmodified lines | ||
| 279 | 286 | for (int y = start; y < end; y++) { |
| 280 | 287 | for (int x = 0; x < width; x++) { |
| 281 | 288 | float factor = project(s->fx0, s->fy0, s->fx1, s->fy1, x, y, type); |
| 282 | − dst[x] = lerp_colors16(s->color_rgba, s->nb_colors, s->nb_colors + (type >= 2), factor); | |
| 289 | + dst[x] = lerp_colors16(s->color_rgba, s->nb_colors, s->nb_colors + (type >= 2 && type <= 3), factor); | |
| 283 | 290 | } |
| 284 | 291 | |
| 285 | 292 | dst += linesize; |
| @@ -309,7 +316,7 @@ static int draw_gradients_slice32_planar(AVFilterContext *ctx, void *arg, int jo · 23 unmodified lines | ||
| 309 | 316 | for (int y = start; y < end; y++) { |
| 310 | 317 | for (int x = 0; x < width; x++) { |
| 311 | 318 | float factor = project(s->fx0, s->fy0, s->fx1, s->fy1, x, y, type); |
| 312 | − lerp_colors32(s->color_rgbaf, s->nb_colors, s->nb_colors + (type >= 2), factor, | |
| 319 | + lerp_colors32(s->color_rgbaf, s->nb_colors, s->nb_colors + (type >= 2 && type <= 3), factor, | |
| 313 | 320 | &dst_r[x], &dst_g[x], &dst_b[x], &dst_a[x]); |
| 314 | 321 | } |
| 315 | 322 | |