Browse code

avfilter/vf_blend: rename addition128 and difference128 to grainmerge and grainextract

Paul B Mahol authored on 2017/08/24 21:43:00
Showing 5 changed files
... ...
@@ -4854,13 +4854,13 @@ of @var{all_mode}. Default value is @code{normal}.
4854 4854
 Available values for component modes are:
4855 4855
 @table @samp
4856 4856
 @item addition
4857
-@item addition128
4857
+@item grainmerge
4858 4858
 @item and
4859 4859
 @item average
4860 4860
 @item burn
4861 4861
 @item darken
4862 4862
 @item difference
4863
-@item difference128
4863
+@item grainextract
4864 4864
 @item divide
4865 4865
 @item dodge
4866 4866
 @item freeze
... ...
@@ -4987,7 +4987,7 @@ blend=all_expr=if(gt(X,Y*(W/H)),A,B)
4987 4987
 @item
4988 4988
 Display differences between the current and the previous frame:
4989 4989
 @example
4990
-tblend=all_mode=difference128
4990
+tblend=all_mode=grainextract
4991 4991
 @end example
4992 4992
 @end itemize
4993 4993
 
... ...
@@ -33,7 +33,7 @@ enum BlendMode {
33 33
     BLEND_BURN,
34 34
     BLEND_DARKEN,
35 35
     BLEND_DIFFERENCE,
36
-    BLEND_DIFFERENCE128,
36
+    BLEND_GRAINEXTRACT,
37 37
     BLEND_DIVIDE,
38 38
     BLEND_DODGE,
39 39
     BLEND_EXCLUSION,
... ...
@@ -54,7 +54,7 @@ enum BlendMode {
54 54
     BLEND_HARDMIX,
55 55
     BLEND_LINEARLIGHT,
56 56
     BLEND_GLOW,
57
-    BLEND_ADDITION128,
57
+    BLEND_GRAINMERGE,
58 58
     BLEND_MULTIPLY128,
59 59
     BLEND_HEAT,
60 60
     BLEND_FREEZE,
... ...
@@ -66,13 +66,15 @@ typedef struct ThreadData {
66 66
     { "c3_mode", "set component #3 blend mode", OFFSET(params[3].mode), AV_OPT_TYPE_INT, {.i64=0}, 0, BLEND_NB-1, FLAGS, "mode"},\
67 67
     { "all_mode", "set blend mode for all components", OFFSET(all_mode), AV_OPT_TYPE_INT, {.i64=-1},-1, BLEND_NB-1, FLAGS, "mode"},\
68 68
     { "addition",   "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_ADDITION},   0, 0, FLAGS, "mode" },\
69
-    { "addition128", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_ADDITION128}, 0, 0, FLAGS, "mode" },\
69
+    { "addition128","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINMERGE}, 0, 0, FLAGS, "mode" },\
70
+    { "grainmerge", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINMERGE}, 0, 0, FLAGS, "mode" },\
70 71
     { "and",        "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_AND},        0, 0, FLAGS, "mode" },\
71 72
     { "average",    "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_AVERAGE},    0, 0, FLAGS, "mode" },\
72 73
     { "burn",       "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_BURN},       0, 0, FLAGS, "mode" },\
73 74
     { "darken",     "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DARKEN},     0, 0, FLAGS, "mode" },\
74 75
     { "difference", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIFFERENCE}, 0, 0, FLAGS, "mode" },\
75
-    { "difference128", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIFFERENCE128}, 0, 0, FLAGS, "mode" },\
76
+    { "difference128", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINEXTRACT}, 0, 0, FLAGS, "mode" },\
77
+    { "grainextract", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINEXTRACT}, 0, 0, FLAGS, "mode" },\
76 78
     { "divide",     "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIVIDE},     0, 0, FLAGS, "mode" },\
77 79
     { "dodge",      "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DODGE},      0, 0, FLAGS, "mode" },\
78 80
     { "exclusion",  "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_EXCLUSION},  0, 0, FLAGS, "mode" },\
... ...
@@ -236,7 +238,7 @@ static void blend_## name##_16bit(const uint8_t *_top, ptrdiff_t top_linesize,
236 236
 #define DODGE(a, b)       (((a) == 255) ? (a) : FFMIN(255, (((b) << 8) / (255 - (a)))))
237 237
 
238 238
 DEFINE_BLEND8(addition,   FFMIN(255, A + B))
239
-DEFINE_BLEND8(addition128, av_clip_uint8(A + B - 128))
239
+DEFINE_BLEND8(grainmerge, av_clip_uint8(A + B - 128))
240 240
 DEFINE_BLEND8(average,    (A + B) / 2)
241 241
 DEFINE_BLEND8(subtract,   FFMAX(0, A - B))
242 242
 DEFINE_BLEND8(multiply,   MULTIPLY(1, A, B))
... ...
@@ -244,7 +246,7 @@ DEFINE_BLEND8(multiply128,av_clip_uint8((A - 128) * B / 32. + 128))
244 244
 DEFINE_BLEND8(negation,   255 - FFABS(255 - A - B))
245 245
 DEFINE_BLEND8(extremity,  FFABS(255 - A - B))
246 246
 DEFINE_BLEND8(difference, FFABS(A - B))
247
-DEFINE_BLEND8(difference128, av_clip_uint8(128 + A - B))
247
+DEFINE_BLEND8(grainextract, av_clip_uint8(128 + A - B))
248 248
 DEFINE_BLEND8(screen,     SCREEN(1, A, B))
249 249
 DEFINE_BLEND8(overlay,    (A < 128) ? MULTIPLY(2, A, B) : SCREEN(2, A, B))
250 250
 DEFINE_BLEND8(hardlight,  (B < 128) ? MULTIPLY(2, B, A) : SCREEN(2, B, A))
... ...
@@ -279,7 +281,7 @@ DEFINE_BLEND8(linearlight,av_clip_uint8((B < 128) ? B + 2 * A - 255 : B + 2 * (A
279 279
 #define DODGE(a, b)       (((a) == 65535) ? (a) : FFMIN(65535, (((b) << 16) / (65535 - (a)))))
280 280
 
281 281
 DEFINE_BLEND16(addition,   FFMIN(65535, A + B))
282
-DEFINE_BLEND16(addition128, av_clip_uint16(A + B - 32768))
282
+DEFINE_BLEND16(grainmerge, av_clip_uint16(A + B - 32768))
283 283
 DEFINE_BLEND16(average,    (A + B) / 2)
284 284
 DEFINE_BLEND16(subtract,   FFMAX(0, A - B))
285 285
 DEFINE_BLEND16(multiply,   MULTIPLY(1, A, B))
... ...
@@ -287,7 +289,7 @@ DEFINE_BLEND16(multiply128, av_clip_uint16((A - 32768) * B / 8192. + 32768))
287 287
 DEFINE_BLEND16(negation,   65535 - FFABS(65535 - A - B))
288 288
 DEFINE_BLEND16(extremity,  FFABS(65535 - A - B))
289 289
 DEFINE_BLEND16(difference, FFABS(A - B))
290
-DEFINE_BLEND16(difference128, av_clip_uint16(32768 + A - B))
290
+DEFINE_BLEND16(grainextract, av_clip_uint16(32768 + A - B))
291 291
 DEFINE_BLEND16(screen,     SCREEN(1, A, B))
292 292
 DEFINE_BLEND16(overlay,    (A < 32768) ? MULTIPLY(2, A, B) : SCREEN(2, A, B))
293 293
 DEFINE_BLEND16(hardlight,  (B < 32768) ? MULTIPLY(2, B, A) : SCREEN(2, B, A))
... ...
@@ -450,13 +452,13 @@ void ff_blend_init(FilterParams *param, int is_16bit)
450 450
 {
451 451
     switch (param->mode) {
452 452
     case BLEND_ADDITION:   param->blend = is_16bit ? blend_addition_16bit   : blend_addition_8bit;   break;
453
-    case BLEND_ADDITION128: param->blend = is_16bit ? blend_addition128_16bit : blend_addition128_8bit; break;
453
+    case BLEND_GRAINMERGE: param->blend = is_16bit ? blend_grainmerge_16bit : blend_grainmerge_8bit; break;
454 454
     case BLEND_AND:        param->blend = is_16bit ? blend_and_16bit        : blend_and_8bit;        break;
455 455
     case BLEND_AVERAGE:    param->blend = is_16bit ? blend_average_16bit    : blend_average_8bit;    break;
456 456
     case BLEND_BURN:       param->blend = is_16bit ? blend_burn_16bit       : blend_burn_8bit;       break;
457 457
     case BLEND_DARKEN:     param->blend = is_16bit ? blend_darken_16bit     : blend_darken_8bit;     break;
458 458
     case BLEND_DIFFERENCE: param->blend = is_16bit ? blend_difference_16bit : blend_difference_8bit; break;
459
-    case BLEND_DIFFERENCE128: param->blend = is_16bit ? blend_difference128_16bit: blend_difference128_8bit; break;
459
+    case BLEND_GRAINEXTRACT: param->blend = is_16bit ? blend_grainextract_16bit: blend_grainextract_8bit; break;
460 460
     case BLEND_DIVIDE:     param->blend = is_16bit ? blend_divide_16bit     : blend_divide_8bit;     break;
461 461
     case BLEND_DODGE:      param->blend = is_16bit ? blend_dodge_16bit      : blend_dodge_8bit;      break;
462 462
     case BLEND_EXCLUSION:  param->blend = is_16bit ? blend_exclusion_16bit  : blend_exclusion_8bit;  break;
... ...
@@ -83,7 +83,7 @@ BLEND_SIMPLE subtract, subusb
83 83
 BLEND_SIMPLE darken,   minub
84 84
 BLEND_SIMPLE lighten,  maxub
85 85
 
86
-BLEND_INIT difference128, 4
86
+BLEND_INIT grainextract, 4
87 87
     pxor       m2, m2
88 88
     mova       m3, [pw_128]
89 89
 .nextrow:
... ...
@@ -181,7 +181,7 @@ BLEND_INIT average, 3
181 181
     jl .loop
182 182
 BLEND_END
183 183
 
184
-BLEND_INIT addition128, 4
184
+BLEND_INIT grainmerge, 4
185 185
     pxor       m2, m2
186 186
     mova       m3, [pw_128]
187 187
 .nextrow:
... ...
@@ -31,11 +31,11 @@ void ff_blend_##name##_##opt(const uint8_t *top, ptrdiff_t top_linesize,       \
31 31
                              struct FilterParams *param, double *values, int starty);
32 32
 
33 33
 BLEND_FUNC(addition, sse2)
34
-BLEND_FUNC(addition128, sse2)
34
+BLEND_FUNC(grainmerge, sse2)
35 35
 BLEND_FUNC(average, sse2)
36 36
 BLEND_FUNC(and, sse2)
37 37
 BLEND_FUNC(darken, sse2)
38
-BLEND_FUNC(difference128, sse2)
38
+BLEND_FUNC(grainextract, sse2)
39 39
 BLEND_FUNC(multiply, sse2)
40 40
 BLEND_FUNC(screen, sse2)
41 41
 BLEND_FUNC(hardmix, sse2)
... ...
@@ -59,29 +59,29 @@ av_cold void ff_blend_init_x86(FilterParams *param, int is_16bit)
59 59
     if (EXTERNAL_SSE2(cpu_flags) && param->opacity == 1 && !is_16bit) {
60 60
         switch (param->mode) {
61 61
         case BLEND_ADDITION: param->blend = ff_blend_addition_sse2; break;
62
-        case BLEND_ADDITION128: param->blend = ff_blend_addition128_sse2; break;
62
+        case BLEND_GRAINMERGE: param->blend = ff_blend_grainmerge_sse2; break;
63 63
         case BLEND_AND:      param->blend = ff_blend_and_sse2;      break;
64 64
         case BLEND_AVERAGE:  param->blend = ff_blend_average_sse2;  break;
65 65
         case BLEND_DARKEN:   param->blend = ff_blend_darken_sse2;   break;
66
-        case BLEND_DIFFERENCE128: param->blend = ff_blend_difference128_sse2; break;
66
+        case BLEND_GRAINEXTRACT: param->blend = ff_blend_grainextract_sse2; break;
67 67
         case BLEND_DIVIDE:   param->blend = ff_blend_divide_sse2;   break;
68 68
         case BLEND_HARDMIX:  param->blend = ff_blend_hardmix_sse2;  break;
69 69
         case BLEND_LIGHTEN:  param->blend = ff_blend_lighten_sse2;  break;
70 70
         case BLEND_MULTIPLY: param->blend = ff_blend_multiply_sse2; break;
71 71
         case BLEND_OR:       param->blend = ff_blend_or_sse2;       break;
72 72
         case BLEND_PHOENIX:  param->blend = ff_blend_phoenix_sse2;  break;
73
-        case BLEND_SCREEN:   param->blend = ff_blend_screen_sse2; break;
73
+        case BLEND_SCREEN:   param->blend = ff_blend_screen_sse2;   break;
74 74
         case BLEND_SUBTRACT: param->blend = ff_blend_subtract_sse2; break;
75 75
         case BLEND_XOR:      param->blend = ff_blend_xor_sse2;      break;
76 76
         case BLEND_DIFFERENCE: param->blend = ff_blend_difference_sse2; break;
77
-        case BLEND_EXTREMITY:  param->blend = ff_blend_extremity_sse2; break;
77
+        case BLEND_EXTREMITY:  param->blend = ff_blend_extremity_sse2;  break;
78 78
         case BLEND_NEGATION:   param->blend = ff_blend_negation_sse2;   break;
79 79
         }
80 80
     }
81 81
     if (EXTERNAL_SSSE3(cpu_flags) && param->opacity == 1 && !is_16bit) {
82 82
         switch (param->mode) {
83 83
         case BLEND_DIFFERENCE: param->blend = ff_blend_difference_ssse3; break;
84
-        case BLEND_EXTREMITY:  param->blend = ff_blend_extremity_ssse3; break;
84
+        case BLEND_EXTREMITY:  param->blend = ff_blend_extremity_ssse3;  break;
85 85
         case BLEND_NEGATION:   param->blend = ff_blend_negation_ssse3;   break;
86 86
         }
87 87
     }