...
|
...
|
@@ -36,6 +36,7 @@ enum FilterType {
|
36
|
36
|
CHROMA,
|
37
|
37
|
ACHROMA,
|
38
|
38
|
COLOR,
|
|
39
|
+ ACOLOR,
|
39
|
40
|
NB_FILTERS
|
40
|
41
|
};
|
41
|
42
|
|
...
|
...
|
@@ -128,6 +129,7 @@ static const AVOption waveform_options[] = {
|
128
|
128
|
{ "chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64=CHROMA}, 0, 0, FLAGS, "filter" },
|
129
|
129
|
{ "achroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ACHROMA}, 0, 0, FLAGS, "filter" },
|
130
|
130
|
{ "color", NULL, 0, AV_OPT_TYPE_CONST, {.i64=COLOR}, 0, 0, FLAGS, "filter" },
|
|
131
|
+ { "acolor", NULL, 0, AV_OPT_TYPE_CONST, {.i64=ACOLOR}, 0, 0, FLAGS, "filter" },
|
131
|
132
|
{ "graticule", "set graticule", OFFSET(graticule), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "graticule" },
|
132
|
133
|
{ "g", "set graticule", OFFSET(graticule), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "graticule" },
|
133
|
134
|
{ "none", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "graticule" },
|
...
|
...
|
@@ -240,6 +242,7 @@ static int query_formats(AVFilterContext *ctx)
|
240
|
240
|
case AFLAT:
|
241
|
241
|
case CHROMA:
|
242
|
242
|
case ACHROMA: pix_fmts = flat_pix_fmts; break;
|
|
243
|
+ case ACOLOR:
|
243
|
244
|
case COLOR: pix_fmts = color_pix_fmts; break;
|
244
|
245
|
}
|
245
|
246
|
|
...
|
...
|
@@ -1228,6 +1231,189 @@ static void color(WaveformContext *s, AVFrame *in, AVFrame *out,
|
1228
|
1228
|
envelope(s, out, plane, plane, column ? offset_x : offset_y);
|
1229
|
1229
|
}
|
1230
|
1230
|
|
|
1231
|
+static void acolor16(WaveformContext *s, AVFrame *in, AVFrame *out,
|
|
1232
|
+ int component, int intensity, int offset_y, int offset_x, int column)
|
|
1233
|
+{
|
|
1234
|
+ const int plane = s->desc->comp[component].plane;
|
|
1235
|
+ const int mirror = s->mirror;
|
|
1236
|
+ const int limit = s->max - 1;
|
|
1237
|
+ const int max = limit - intensity;
|
|
1238
|
+ const uint16_t *c0_data = (const uint16_t *)in->data[plane + 0];
|
|
1239
|
+ const uint16_t *c1_data = (const uint16_t *)in->data[(plane + 1) % s->ncomp];
|
|
1240
|
+ const uint16_t *c2_data = (const uint16_t *)in->data[(plane + 2) % s->ncomp];
|
|
1241
|
+ const int c0_linesize = in->linesize[ plane + 0 ] / 2;
|
|
1242
|
+ const int c1_linesize = in->linesize[(plane + 1) % s->ncomp] / 2;
|
|
1243
|
+ const int c2_linesize = in->linesize[(plane + 2) % s->ncomp] / 2;
|
|
1244
|
+ const int d0_linesize = out->linesize[ plane + 0 ] / 2;
|
|
1245
|
+ const int d1_linesize = out->linesize[(plane + 1) % s->ncomp] / 2;
|
|
1246
|
+ const int d2_linesize = out->linesize[(plane + 2) % s->ncomp] / 2;
|
|
1247
|
+ const int src_h = in->height;
|
|
1248
|
+ const int src_w = in->width;
|
|
1249
|
+ int x, y;
|
|
1250
|
+
|
|
1251
|
+ if (s->mode) {
|
|
1252
|
+ const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
|
|
1253
|
+ const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
|
|
1254
|
+ const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
|
|
1255
|
+ uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x;
|
|
1256
|
+ uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x;
|
|
1257
|
+ uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x;
|
|
1258
|
+ uint16_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
|
|
1259
|
+ uint16_t * const d0 = (mirror ? d0_bottom_line : d0_data);
|
|
1260
|
+ uint16_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
|
|
1261
|
+ uint16_t * const d1 = (mirror ? d1_bottom_line : d1_data);
|
|
1262
|
+ uint16_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1);
|
|
1263
|
+ uint16_t * const d2 = (mirror ? d2_bottom_line : d2_data);
|
|
1264
|
+
|
|
1265
|
+ for (y = 0; y < src_h; y++) {
|
|
1266
|
+ for (x = 0; x < src_w; x++) {
|
|
1267
|
+ const int c0 = FFMIN(c0_data[x], limit);
|
|
1268
|
+ const int c1 = c1_data[x];
|
|
1269
|
+ const int c2 = c2_data[x];
|
|
1270
|
+
|
|
1271
|
+ update16(d0 + d0_signed_linesize * c0 + x, max, intensity, limit);
|
|
1272
|
+ *(d1 + d1_signed_linesize * c0 + x) = c1;
|
|
1273
|
+ *(d2 + d2_signed_linesize * c0 + x) = c2;
|
|
1274
|
+ }
|
|
1275
|
+
|
|
1276
|
+ c0_data += c0_linesize;
|
|
1277
|
+ c1_data += c1_linesize;
|
|
1278
|
+ c2_data += c2_linesize;
|
|
1279
|
+ d0_data += d0_linesize;
|
|
1280
|
+ d1_data += d1_linesize;
|
|
1281
|
+ d2_data += d2_linesize;
|
|
1282
|
+ }
|
|
1283
|
+ } else {
|
|
1284
|
+ uint16_t *d0_data = (uint16_t *)out->data[plane] + offset_y * d0_linesize + offset_x;
|
|
1285
|
+ uint16_t *d1_data = (uint16_t *)out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x;
|
|
1286
|
+ uint16_t *d2_data = (uint16_t *)out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x;
|
|
1287
|
+
|
|
1288
|
+ if (mirror) {
|
|
1289
|
+ d0_data += s->size - 1;
|
|
1290
|
+ d1_data += s->size - 1;
|
|
1291
|
+ d2_data += s->size - 1;
|
|
1292
|
+ }
|
|
1293
|
+
|
|
1294
|
+ for (y = 0; y < src_h; y++) {
|
|
1295
|
+ for (x = 0; x < src_w; x++) {
|
|
1296
|
+ const int c0 = FFMIN(c0_data[x], limit);
|
|
1297
|
+ const int c1 = c1_data[x];
|
|
1298
|
+ const int c2 = c2_data[x];
|
|
1299
|
+
|
|
1300
|
+ if (mirror) {
|
|
1301
|
+ update16(d0_data - c0, max, intensity, limit);
|
|
1302
|
+ *(d1_data - c0) = c1;
|
|
1303
|
+ *(d2_data - c0) = c2;
|
|
1304
|
+ } else {
|
|
1305
|
+ update16(d0_data + c0, max, intensity, limit);
|
|
1306
|
+ *(d1_data + c0) = c1;
|
|
1307
|
+ *(d2_data + c0) = c2;
|
|
1308
|
+ }
|
|
1309
|
+ }
|
|
1310
|
+
|
|
1311
|
+ c0_data += c0_linesize;
|
|
1312
|
+ c1_data += c1_linesize;
|
|
1313
|
+ c2_data += c2_linesize;
|
|
1314
|
+ d0_data += d0_linesize;
|
|
1315
|
+ d1_data += d1_linesize;
|
|
1316
|
+ d2_data += d2_linesize;
|
|
1317
|
+ }
|
|
1318
|
+ }
|
|
1319
|
+
|
|
1320
|
+ envelope16(s, out, plane, plane, column ? offset_x : offset_y);
|
|
1321
|
+}
|
|
1322
|
+
|
|
1323
|
+static void acolor(WaveformContext *s, AVFrame *in, AVFrame *out,
|
|
1324
|
+ int component, int intensity, int offset_y, int offset_x, int column)
|
|
1325
|
+{
|
|
1326
|
+ const int plane = s->desc->comp[component].plane;
|
|
1327
|
+ const int mirror = s->mirror;
|
|
1328
|
+ const uint8_t *c0_data = in->data[plane + 0];
|
|
1329
|
+ const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp];
|
|
1330
|
+ const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp];
|
|
1331
|
+ const int c0_linesize = in->linesize[ plane + 0 ];
|
|
1332
|
+ const int c1_linesize = in->linesize[(plane + 1) % s->ncomp];
|
|
1333
|
+ const int c2_linesize = in->linesize[(plane + 2) % s->ncomp];
|
|
1334
|
+ const int d0_linesize = out->linesize[ plane + 0 ];
|
|
1335
|
+ const int d1_linesize = out->linesize[(plane + 1) % s->ncomp];
|
|
1336
|
+ const int d2_linesize = out->linesize[(plane + 2) % s->ncomp];
|
|
1337
|
+ const int max = 255 - intensity;
|
|
1338
|
+ const int src_h = in->height;
|
|
1339
|
+ const int src_w = in->width;
|
|
1340
|
+ int x, y;
|
|
1341
|
+
|
|
1342
|
+ if (s->mode) {
|
|
1343
|
+ const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1);
|
|
1344
|
+ const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1);
|
|
1345
|
+ const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1);
|
|
1346
|
+ uint8_t *d0_data = out->data[plane] + offset_y * d0_linesize + offset_x;
|
|
1347
|
+ uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x;
|
|
1348
|
+ uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x;
|
|
1349
|
+ uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1);
|
|
1350
|
+ uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data);
|
|
1351
|
+ uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1);
|
|
1352
|
+ uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data);
|
|
1353
|
+ uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1);
|
|
1354
|
+ uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data);
|
|
1355
|
+
|
|
1356
|
+ for (y = 0; y < src_h; y++) {
|
|
1357
|
+ for (x = 0; x < src_w; x++) {
|
|
1358
|
+ const int c0 = c0_data[x];
|
|
1359
|
+ const int c1 = c1_data[x];
|
|
1360
|
+ const int c2 = c2_data[x];
|
|
1361
|
+
|
|
1362
|
+ update(d0 + d0_signed_linesize * c0 + x, max, intensity);
|
|
1363
|
+ *(d1 + d1_signed_linesize * c0 + x) = c1;
|
|
1364
|
+ *(d2 + d2_signed_linesize * c0 + x) = c2;
|
|
1365
|
+ }
|
|
1366
|
+
|
|
1367
|
+ c0_data += c0_linesize;
|
|
1368
|
+ c1_data += c1_linesize;
|
|
1369
|
+ c2_data += c2_linesize;
|
|
1370
|
+ d0_data += d0_linesize;
|
|
1371
|
+ d1_data += d1_linesize;
|
|
1372
|
+ d2_data += d2_linesize;
|
|
1373
|
+ }
|
|
1374
|
+ } else {
|
|
1375
|
+ uint8_t *d0_data = out->data[plane] + offset_y * d0_linesize + offset_x;
|
|
1376
|
+ uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset_y * d1_linesize + offset_x;
|
|
1377
|
+ uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset_y * d2_linesize + offset_x;
|
|
1378
|
+
|
|
1379
|
+ if (mirror) {
|
|
1380
|
+ d0_data += s->size - 1;
|
|
1381
|
+ d1_data += s->size - 1;
|
|
1382
|
+ d2_data += s->size - 1;
|
|
1383
|
+ }
|
|
1384
|
+
|
|
1385
|
+ for (y = 0; y < src_h; y++) {
|
|
1386
|
+ for (x = 0; x < src_w; x++) {
|
|
1387
|
+ const int c0 = c0_data[x];
|
|
1388
|
+ const int c1 = c1_data[x];
|
|
1389
|
+ const int c2 = c2_data[x];
|
|
1390
|
+
|
|
1391
|
+ if (mirror) {
|
|
1392
|
+ update(d0_data - c0, max, intensity);
|
|
1393
|
+ *(d1_data - c0) = c1;
|
|
1394
|
+ *(d2_data - c0) = c2;
|
|
1395
|
+ } else {
|
|
1396
|
+ update(d0_data + c0, max, intensity);
|
|
1397
|
+ *(d1_data + c0) = c1;
|
|
1398
|
+ *(d2_data + c0) = c2;
|
|
1399
|
+ }
|
|
1400
|
+ }
|
|
1401
|
+
|
|
1402
|
+ c0_data += c0_linesize;
|
|
1403
|
+ c1_data += c1_linesize;
|
|
1404
|
+ c2_data += c2_linesize;
|
|
1405
|
+ d0_data += d0_linesize;
|
|
1406
|
+ d1_data += d1_linesize;
|
|
1407
|
+ d2_data += d2_linesize;
|
|
1408
|
+ }
|
|
1409
|
+ }
|
|
1410
|
+
|
|
1411
|
+ envelope(s, out, plane, plane, column ? offset_x : offset_y);
|
|
1412
|
+}
|
|
1413
|
+
|
1231
|
1414
|
static const uint8_t black_yuva_color[4] = { 0, 127, 127, 255 };
|
1232
|
1415
|
static const uint8_t green_yuva_color[4] = { 255, 0, 0, 255 };
|
1233
|
1416
|
static const uint8_t black_gbrp_color[4] = { 0, 0, 0, 255 };
|
...
|
...
|
@@ -1643,31 +1829,45 @@ static int config_input(AVFilterLink *inlink)
|
1643
|
1643
|
|
1644
|
1644
|
switch (s->filter) {
|
1645
|
1645
|
case LOWPASS:
|
1646
|
|
- s->size = 256;
|
1647
|
|
- if (s->graticule && s->mode == 1)
|
1648
|
|
- s->graticulef = s->bits > 8 ? graticule16_green_column : graticule_green_column;
|
1649
|
|
- else if (s->graticule && s->mode == 0)
|
1650
|
|
- s->graticulef = s->bits > 8 ? graticule16_green_row : graticule_green_row;
|
1651
|
|
- s->waveform = s->bits > 8 ? lowpass16 : lowpass; break;
|
|
1646
|
+ s->size = 256;
|
|
1647
|
+ if (s->graticule && s->mode == 1)
|
|
1648
|
+ s->graticulef = s->bits > 8 ? graticule16_green_column : graticule_green_column;
|
|
1649
|
+ else if (s->graticule && s->mode == 0)
|
|
1650
|
+ s->graticulef = s->bits > 8 ? graticule16_green_row : graticule_green_row;
|
|
1651
|
+ s->waveform = s->bits > 8 ? lowpass16 : lowpass;
|
|
1652
|
+ break;
|
1652
|
1653
|
case FLAT:
|
1653
|
|
- s->size = 256 * 3;
|
1654
|
|
- s->waveform = flat; break;
|
|
1654
|
+ s->size = 256 * 3;
|
|
1655
|
+ s->waveform = flat;
|
|
1656
|
+ break;
|
1655
|
1657
|
case AFLAT:
|
1656
|
|
- s->size = 256 * 2;
|
1657
|
|
- s->waveform = aflat; break;
|
|
1658
|
+ s->size = 256 * 2;
|
|
1659
|
+ s->waveform = aflat;
|
|
1660
|
+ break;
|
1658
|
1661
|
case CHROMA:
|
1659
|
|
- s->size = 256 * 2;
|
1660
|
|
- s->waveform = chroma; break;
|
|
1662
|
+ s->size = 256 * 2;
|
|
1663
|
+ s->waveform = chroma;
|
|
1664
|
+ break;
|
1661
|
1665
|
case ACHROMA:
|
1662
|
|
- s->size = 256;
|
1663
|
|
- s->waveform = achroma; break;
|
|
1666
|
+ s->size = 256;
|
|
1667
|
+ s->waveform = achroma;
|
|
1668
|
+ break;
|
1664
|
1669
|
case COLOR:
|
1665
|
|
- s->size = 256;
|
1666
|
|
- if (s->graticule && s->mode == 1)
|
1667
|
|
- s->graticulef = s->bits > 8 ? graticule16_green_column : graticule_green_column;
|
1668
|
|
- else if (s->graticule && s->mode == 0)
|
1669
|
|
- s->graticulef = s->bits > 8 ? graticule16_green_row : graticule_green_row;
|
1670
|
|
- s->waveform = s->bits > 8 ? color16 : color; break;
|
|
1670
|
+ s->size = 256;
|
|
1671
|
+ if (s->graticule && s->mode == 1)
|
|
1672
|
+ s->graticulef = s->bits > 8 ? graticule16_green_column : graticule_green_column;
|
|
1673
|
+ else if (s->graticule && s->mode == 0)
|
|
1674
|
+ s->graticulef = s->bits > 8 ? graticule16_green_row : graticule_green_row;
|
|
1675
|
+ s->waveform = s->bits > 8 ? color16 : color;
|
|
1676
|
+ break;
|
|
1677
|
+ case ACOLOR:
|
|
1678
|
+ s->size = 256;
|
|
1679
|
+ if (s->graticule && s->mode == 1)
|
|
1680
|
+ s->graticulef = s->bits > 8 ? graticule16_green_column : graticule_green_column;
|
|
1681
|
+ else if (s->graticule && s->mode == 0)
|
|
1682
|
+ s->graticulef = s->bits > 8 ? graticule16_green_row : graticule_green_row;
|
|
1683
|
+ s->waveform = s->bits > 8 ? acolor16 : acolor;
|
|
1684
|
+ break;
|
1671
|
1685
|
}
|
1672
|
1686
|
|
1673
|
1687
|
switch (s->scale) {
|