...
|
...
|
@@ -437,6 +437,51 @@ static av_cold void uninit(AVFilterContext *ctx)
|
437
|
437
|
av_expr_free(s->params[i].e);
|
438
|
438
|
}
|
439
|
439
|
|
|
440
|
+void ff_blend_init(FilterParams *param, int is_16bit)
|
|
441
|
+{
|
|
442
|
+ switch (param->mode) {
|
|
443
|
+ case BLEND_ADDITION: param->blend = is_16bit ? blend_addition_16bit : blend_addition_8bit; break;
|
|
444
|
+ case BLEND_ADDITION128: param->blend = is_16bit ? blend_addition128_16bit : blend_addition128_8bit; break;
|
|
445
|
+ case BLEND_AND: param->blend = is_16bit ? blend_and_16bit : blend_and_8bit; break;
|
|
446
|
+ case BLEND_AVERAGE: param->blend = is_16bit ? blend_average_16bit : blend_average_8bit; break;
|
|
447
|
+ case BLEND_BURN: param->blend = is_16bit ? blend_burn_16bit : blend_burn_8bit; break;
|
|
448
|
+ case BLEND_DARKEN: param->blend = is_16bit ? blend_darken_16bit : blend_darken_8bit; break;
|
|
449
|
+ case BLEND_DIFFERENCE: param->blend = is_16bit ? blend_difference_16bit : blend_difference_8bit; break;
|
|
450
|
+ case BLEND_DIFFERENCE128: param->blend = is_16bit ? blend_difference128_16bit: blend_difference128_8bit; break;
|
|
451
|
+ case BLEND_DIVIDE: param->blend = is_16bit ? blend_divide_16bit : blend_divide_8bit; break;
|
|
452
|
+ case BLEND_DODGE: param->blend = is_16bit ? blend_dodge_16bit : blend_dodge_8bit; break;
|
|
453
|
+ case BLEND_EXCLUSION: param->blend = is_16bit ? blend_exclusion_16bit : blend_exclusion_8bit; break;
|
|
454
|
+ case BLEND_GLOW: param->blend = is_16bit ? blend_glow_16bit : blend_glow_8bit; break;
|
|
455
|
+ case BLEND_HARDLIGHT: param->blend = is_16bit ? blend_hardlight_16bit : blend_hardlight_8bit; break;
|
|
456
|
+ case BLEND_HARDMIX: param->blend = is_16bit ? blend_hardmix_16bit : blend_hardmix_8bit; break;
|
|
457
|
+ case BLEND_LIGHTEN: param->blend = is_16bit ? blend_lighten_16bit : blend_lighten_8bit; break;
|
|
458
|
+ case BLEND_LINEARLIGHT:param->blend = is_16bit ? blend_linearlight_16bit: blend_linearlight_8bit;break;
|
|
459
|
+ case BLEND_MULTIPLY: param->blend = is_16bit ? blend_multiply_16bit : blend_multiply_8bit; break;
|
|
460
|
+ case BLEND_MULTIPLY128:param->blend = is_16bit ? blend_multiply128_16bit: blend_multiply128_8bit;break;
|
|
461
|
+ case BLEND_NEGATION: param->blend = is_16bit ? blend_negation_16bit : blend_negation_8bit; break;
|
|
462
|
+ case BLEND_NORMAL: param->blend = param->opacity == 1 ? blend_copytop :
|
|
463
|
+ param->opacity == 0 ? blend_copybottom :
|
|
464
|
+ is_16bit ? blend_normal_16bit : blend_normal_8bit; break;
|
|
465
|
+ case BLEND_OR: param->blend = is_16bit ? blend_or_16bit : blend_or_8bit; break;
|
|
466
|
+ case BLEND_OVERLAY: param->blend = is_16bit ? blend_overlay_16bit : blend_overlay_8bit; break;
|
|
467
|
+ case BLEND_PHOENIX: param->blend = is_16bit ? blend_phoenix_16bit : blend_phoenix_8bit; break;
|
|
468
|
+ case BLEND_PINLIGHT: param->blend = is_16bit ? blend_pinlight_16bit : blend_pinlight_8bit; break;
|
|
469
|
+ case BLEND_REFLECT: param->blend = is_16bit ? blend_reflect_16bit : blend_reflect_8bit; break;
|
|
470
|
+ case BLEND_SCREEN: param->blend = is_16bit ? blend_screen_16bit : blend_screen_8bit; break;
|
|
471
|
+ case BLEND_SOFTLIGHT: param->blend = is_16bit ? blend_softlight_16bit : blend_softlight_8bit; break;
|
|
472
|
+ case BLEND_SUBTRACT: param->blend = is_16bit ? blend_subtract_16bit : blend_subtract_8bit; break;
|
|
473
|
+ case BLEND_VIVIDLIGHT: param->blend = is_16bit ? blend_vividlight_16bit : blend_vividlight_8bit; break;
|
|
474
|
+ case BLEND_XOR: param->blend = is_16bit ? blend_xor_16bit : blend_xor_8bit; break;
|
|
475
|
+ }
|
|
476
|
+
|
|
477
|
+ if (param->opacity == 0 && param->mode != BLEND_NORMAL) {
|
|
478
|
+ param->blend = blend_copytop;
|
|
479
|
+ }
|
|
480
|
+
|
|
481
|
+ if (ARCH_X86)
|
|
482
|
+ ff_blend_init_x86(param, is_16bit);
|
|
483
|
+}
|
|
484
|
+
|
440
|
485
|
static int config_output(AVFilterLink *outlink)
|
441
|
486
|
{
|
442
|
487
|
AVFilterContext *ctx = outlink->src;
|
...
|
...
|
@@ -493,47 +538,7 @@ static int config_output(AVFilterLink *outlink)
|
493
|
493
|
if (s->all_opacity < 1)
|
494
|
494
|
param->opacity = s->all_opacity;
|
495
|
495
|
|
496
|
|
- switch (param->mode) {
|
497
|
|
- case BLEND_ADDITION: param->blend = is_16bit ? blend_addition_16bit : blend_addition_8bit; break;
|
498
|
|
- case BLEND_ADDITION128: param->blend = is_16bit ? blend_addition128_16bit : blend_addition128_8bit; break;
|
499
|
|
- case BLEND_AND: param->blend = is_16bit ? blend_and_16bit : blend_and_8bit; break;
|
500
|
|
- case BLEND_AVERAGE: param->blend = is_16bit ? blend_average_16bit : blend_average_8bit; break;
|
501
|
|
- case BLEND_BURN: param->blend = is_16bit ? blend_burn_16bit : blend_burn_8bit; break;
|
502
|
|
- case BLEND_DARKEN: param->blend = is_16bit ? blend_darken_16bit : blend_darken_8bit; break;
|
503
|
|
- case BLEND_DIFFERENCE: param->blend = is_16bit ? blend_difference_16bit : blend_difference_8bit; break;
|
504
|
|
- case BLEND_DIFFERENCE128: param->blend = is_16bit ? blend_difference128_16bit: blend_difference128_8bit; break;
|
505
|
|
- case BLEND_DIVIDE: param->blend = is_16bit ? blend_divide_16bit : blend_divide_8bit; break;
|
506
|
|
- case BLEND_DODGE: param->blend = is_16bit ? blend_dodge_16bit : blend_dodge_8bit; break;
|
507
|
|
- case BLEND_EXCLUSION: param->blend = is_16bit ? blend_exclusion_16bit : blend_exclusion_8bit; break;
|
508
|
|
- case BLEND_GLOW: param->blend = is_16bit ? blend_glow_16bit : blend_glow_8bit; break;
|
509
|
|
- case BLEND_HARDLIGHT: param->blend = is_16bit ? blend_hardlight_16bit : blend_hardlight_8bit; break;
|
510
|
|
- case BLEND_HARDMIX: param->blend = is_16bit ? blend_hardmix_16bit : blend_hardmix_8bit; break;
|
511
|
|
- case BLEND_LIGHTEN: param->blend = is_16bit ? blend_lighten_16bit : blend_lighten_8bit; break;
|
512
|
|
- case BLEND_LINEARLIGHT:param->blend = is_16bit ? blend_linearlight_16bit: blend_linearlight_8bit;break;
|
513
|
|
- case BLEND_MULTIPLY: param->blend = is_16bit ? blend_multiply_16bit : blend_multiply_8bit; break;
|
514
|
|
- case BLEND_MULTIPLY128:param->blend = is_16bit ? blend_multiply128_16bit: blend_multiply128_8bit;break;
|
515
|
|
- case BLEND_NEGATION: param->blend = is_16bit ? blend_negation_16bit : blend_negation_8bit; break;
|
516
|
|
- case BLEND_NORMAL: param->blend = param->opacity == 1 ? blend_copytop :
|
517
|
|
- param->opacity == 0 ? blend_copybottom :
|
518
|
|
- is_16bit ? blend_normal_16bit : blend_normal_8bit; break;
|
519
|
|
- case BLEND_OR: param->blend = is_16bit ? blend_or_16bit : blend_or_8bit; break;
|
520
|
|
- case BLEND_OVERLAY: param->blend = is_16bit ? blend_overlay_16bit : blend_overlay_8bit; break;
|
521
|
|
- case BLEND_PHOENIX: param->blend = is_16bit ? blend_phoenix_16bit : blend_phoenix_8bit; break;
|
522
|
|
- case BLEND_PINLIGHT: param->blend = is_16bit ? blend_pinlight_16bit : blend_pinlight_8bit; break;
|
523
|
|
- case BLEND_REFLECT: param->blend = is_16bit ? blend_reflect_16bit : blend_reflect_8bit; break;
|
524
|
|
- case BLEND_SCREEN: param->blend = is_16bit ? blend_screen_16bit : blend_screen_8bit; break;
|
525
|
|
- case BLEND_SOFTLIGHT: param->blend = is_16bit ? blend_softlight_16bit : blend_softlight_8bit; break;
|
526
|
|
- case BLEND_SUBTRACT: param->blend = is_16bit ? blend_subtract_16bit : blend_subtract_8bit; break;
|
527
|
|
- case BLEND_VIVIDLIGHT: param->blend = is_16bit ? blend_vividlight_16bit : blend_vividlight_8bit; break;
|
528
|
|
- case BLEND_XOR: param->blend = is_16bit ? blend_xor_16bit : blend_xor_8bit; break;
|
529
|
|
- }
|
530
|
|
-
|
531
|
|
- if (ARCH_X86)
|
532
|
|
- ff_blend_init_x86(param, is_16bit);
|
533
|
|
-
|
534
|
|
- if (param->opacity == 0 && param->mode != BLEND_NORMAL) {
|
535
|
|
- param->blend = blend_copytop;
|
536
|
|
- }
|
|
496
|
+ ff_blend_init(param, is_16bit);
|
537
|
497
|
|
538
|
498
|
if (s->all_expr && !param->expr_str) {
|
539
|
499
|
param->expr_str = av_strdup(s->all_expr);
|