1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
|
diff --unified --recursive --text a/configure b/configure
--- a/configure 2023-02-27 21:43:45.000000000 +0100
+++ b/configure 2023-09-16 15:29:24.441115658 +0200
@@ -307,6 +307,7 @@
--enable-lv2 enable LV2 audio filtering [no]
--disable-lzma disable lzma [autodetect]
--enable-decklink enable Blackmagic DeckLink I/O support [no]
+ --enable-dektec enable DekTec I/O support [no]
--enable-mbedtls enable mbedTLS, needed for https support
if openssl, gnutls or libtls is not used [no]
--enable-mediacodec enable Android MediaCodec support [no]
@@ -1774,6 +1775,7 @@
EXTERNAL_LIBRARY_NONFREE_LIST="
decklink
+ dektec
libfdk_aac
libtls
"
@@ -3481,6 +3483,8 @@
rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
sap_demuxer_select="sdp_demuxer"
sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
+sdi_demuxer_select="wrapped_avframe_decoder"
+sdi_muxer_select="wrapped_avframe_encoder"
sdp_demuxer_select="rtpdec"
smoothstreaming_muxer_select="ismv_muxer"
spdif_demuxer_select="adts_header"
@@ -3522,6 +3526,10 @@
decklink_outdev_deps="decklink threads"
decklink_outdev_suggest="libklvanc"
decklink_outdev_extralibs="-lstdc++"
+dektec_indev_deps="dektec"
+dektec_indev_select="sdi_demuxer udp_protocol"
+dektec_outdev_deps="dektec"
+dektec_outdev_select="sdi_muxer udp_protocol"
dshow_indev_deps="IBaseFilter"
dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
fbdev_indev_deps="linux_fb_h"
@@ -6835,6 +6843,22 @@
esac
fi
+if enabled dektec; then
+ if ! enabled nonfree; then
+ die "ERROR: DekTec is incompatible with (l)gpl"
+ fi
+
+ require_pkg_config CDTAPI CDTAPI "CDTAPI.h" CDTAPI_VERSION
+ if test $target_os = "win64"; then
+ check_lib CDTAPI "CDTAPI.h" CDTAPI_VERSION -lCDTAPI64MT
+ else
+ check_lib CDTAPI "CDTAPI.h" CDTAPI_VERSION -lCDTAPI64
+ fi
+
+ dektec_indev_extralibs="$dektec_indev_extralibs ${CDTAPI_extralibs}"
+ dektec_outdev_extralibs="$dektec_outdev_extralibs ${CDTAPI_extralibs}"
+fi
+
enabled securetransport &&
check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
diff --unified --recursive --text a/doc/indevs.texi b/doc/indevs.texi
--- a/doc/indevs.texi 2023-02-27 21:43:45.000000000 +0100
+++ b/doc/indevs.texi 2023-09-16 15:34:20.196929751 +0200
@@ -476,6 +476,77 @@
@end itemize
+@section dektec
+
+Input device for DekTec hardware.
+
+DekTec devices are identified by their serial number and port number
+(e.g. 2178000409:5). If no port is specified, port 1 is used.
+
+@subsection Options
+
+@table @option
+
+@item url[:stream_specifier]
+Specify the URL for a video stream (@var{stream_specifier} is 'v') or audio
+stream (@var{stream_specifier} is 'a').
+
+@item sample_rate
+Specify the audio samplerate. Available values are:
+
+@table @samp
+@item 32000
+32 kHz.
+@item 44100
+44.1 kHz.
+@item 48000
+48 kHz.
+@item 96000
+96 kHz.
+@end table
+
+@item bps
+Specify the audio bit depth per sample. Allowed values are 16 and 24.
+
+@item n_channels
+Specify the number of audio channels. Allowed range is from 1 to 64.
+
+@item sdi_standard
+Force a specific SDI standard. Otherwise the standard will automatically be
+deduced from the video input parameters.
+
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Receive a video stream with a DTA-2110:
+@example
+ffplay -url:v 239.0.0.5:5678 -f dektec -i 211000054
+@end example
+
+@item
+Receive a video and audio stream with a DTA-2110:
+@example
+ffplay -url:v 239.0.0.5:5678 -url:a 239.0.0.5:5680 -f dektec -i 211000054
+@end example
+
+@item
+Receive an audio stream with specific parameters via DTA-2110:
+@example
+ffplay -url:a 239.0.0.5:5680 -sample_rate 48000 -bps 24 -n_channels 2 -f dektec -i 211000054
+@end example
+
+@item
+Receive and render an SDI stream from a DTA-2178:
+@example
+ffplay -f dektec -i 217800024:1
+@end example
+
+@end itemize
+
@section dshow
Windows DirectShow input device.
diff --unified --recursive --text a/doc/outdevs.texi b/doc/outdevs.texi
--- a/doc/outdevs.texi 2022-11-04 21:16:28.000000000 +0100
+++ b/doc/outdevs.texi 2023-09-16 15:36:34.648679554 +0200
@@ -267,6 +267,88 @@
@end itemize
+@section dektec
+
+Output device for DekTec hardware.
+
+DekTec devices are identified by their serial number and port number
+(e.g. 2178000409:5). If no port is specified, port 1 is used.
+
+@subsection Options
+
+@table @option
+
+@item url[:stream_specifier]
+Specify the URL for a video stream (@var{stream_specifier} is 'v') or audio
+stream (@var{stream_specifier} is 'a').
+
+@item aspp
+Set the number of audio samples per RTP packet. Default is 48. Minimum value
+is 1. Maximum value depends on the audio properties. Common values are 6 and 48.
+
+@item pf
+Specify the pixel format. Available values are:
+
+@table @samp
+@item auto
+The default, use the pixel format from the video stream.
+@item 8
+Force 8-bit video output.
+@item 10
+Force 10-bit video output.
+@end table
+
+Automatic pixel format conversion is done to get the right picel format for the
+hardware.
+
+@item pm
+Set the SMPTE-2110 packing mode. Available values are:
+
+@table @samp
+@item block
+@item line
+@item general
+@end table
+
+Default is @option{block}.
+
+@item sch
+Set the SMPTE-2110 scheduling mode. Available values are:
+
+@table @samp
+@item gapped
+@item linear
+@end table
+
+Default is @option{gapped}.
+
+@item ps
+Specify the RTP payload size. Default is -1 and automatically sizes the RTP
+packets. Allowed range is from 1 to 1440.
+
+@item pt
+Specify the RTP payload type. Default is 96. Allowed range is from 96 to 127.
+
+@end table
+
+@subsection Examples
+
+@itemize
+
+@item
+Playout an MPEG transport stream via a DTA-2110 (port 1):
+@example
+ffmpeg -i input.ts -url:v 239.0.0.5:5678 -url:a 239.0.0.6:5680 -f dektec -o 211000054
+@end example
+
+@item
+Playout an MPEG transport stream via a DTA-2178 port 3:
+@example
+ffmpeg -i input.ts -f dektec -o 217800024:3
+@end example
+
+@end itemize
+
@section fbdev
Linux framebuffer output device.
diff --unified --recursive --text a/fftools/Makefile b/fftools/Makefile
--- a/fftools/Makefile 2023-02-27 21:43:45.000000000 +0100
+++ b/fftools/Makefile 2023-09-16 15:46:36.996719403 +0200
@@ -19,9 +19,10 @@
fftools/objpool.o \
fftools/sync_queue.o \
fftools/thread_queue.o \
+ fftools/unused_functions.o \
define DOFFTOOL
-OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/$(1).o $(OBJS-$(1)-yes)
+OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/unused_functions.o fftools/$(1).o $(OBJS-$(1)-yes)
ifdef HAVE_GNU_WINDRES
OBJS-$(1) += fftools/fftoolsres.o
endif
diff --unified --recursive --text a/libavcodec/Makefile b/libavcodec/Makefile
--- a/libavcodec/Makefile 2023-02-27 21:43:45.000000000 +0100
+++ b/libavcodec/Makefile 2023-09-16 15:53:29.728370219 +0200
@@ -55,6 +55,7 @@
profiles.o \
qsv_api.o \
raw.o \
+ unused_functions.o \
utils.o \
version.o \
vlc.o \
diff --unified --recursive --text a/libavdevice/alldevices.c b/libavdevice/alldevices.c
--- a/libavdevice/alldevices.c 2023-02-27 21:43:45.000000000 +0100
+++ b/libavdevice/alldevices.c 2023-09-16 17:08:03.406493367 +0200
@@ -32,6 +32,8 @@
extern const FFOutputFormat ff_caca_muxer;
extern const AVInputFormat ff_decklink_demuxer;
extern const FFOutputFormat ff_decklink_muxer;
+extern const AVInputFormat ff_dektec_demuxer;
+extern const AVOutputFormat ff_dektec_muxer;
extern const AVInputFormat ff_dshow_demuxer;
extern const AVInputFormat ff_fbdev_demuxer;
extern const FFOutputFormat ff_fbdev_muxer;
diff --unified --recursive --text a/libavdevice/Makefile b/libavdevice/Makefile
--- a/libavdevice/Makefile 2023-02-27 21:43:45.000000000 +0100
+++ b/libavdevice/Makefile 2023-09-16 17:03:28.303193201 +0200
@@ -22,6 +22,8 @@
OBJS-$(CONFIG_CACA_OUTDEV) += caca.o
OBJS-$(CONFIG_DECKLINK_OUTDEV) += decklink_enc.o decklink_enc_c.o decklink_common.o
OBJS-$(CONFIG_DECKLINK_INDEV) += decklink_dec.o decklink_dec_c.o decklink_common.o
+OBJS-$(CONFIG_DEKTEC_INDEV) += dektec_dec.o dektec_common.o
+OBJS-$(CONFIG_DEKTEC_OUTDEV) += dektec_enc.o dektec_common.o
OBJS-$(CONFIG_DSHOW_INDEV) += dshow_crossbar.o dshow.o dshow_enummediatypes.o \
dshow_enumpins.o dshow_filter.o \
dshow_pin.o dshow_common.o
diff --unified --recursive --text a/libavfilter/allfilters.c b/libavfilter/allfilters.c
--- a/libavfilter/allfilters.c 2023-02-27 21:43:45.000000000 +0100
+++ b/libavfilter/allfilters.c 2023-09-16 17:13:34.761423801 +0200
@@ -554,6 +554,7 @@
extern const AVFilter ff_vsrc_smptehdbars;
extern const AVFilter ff_vsrc_testsrc;
extern const AVFilter ff_vsrc_testsrc2;
+extern const AVFilter ff_vsrc_yuvflag;
extern const AVFilter ff_vsrc_yuvtestsrc;
extern const AVFilter ff_vsink_nullsink;
diff --unified --recursive --text a/libavfilter/Makefile b/libavfilter/Makefile
--- a/libavfilter/Makefile 2023-02-27 21:43:45.000000000 +0100
+++ b/libavfilter/Makefile 2023-09-16 17:12:22.176294464 +0200
@@ -21,6 +21,7 @@
framequeue.o \
graphdump.o \
graphparser.o \
+ unused_functions.o \
version.o \
video.o \
diff --unified --recursive --text a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
--- a/libavfilter/vsrc_testsrc.c 2023-02-27 21:43:45.000000000 +0100
+++ b/libavfilter/vsrc_testsrc.c 2023-09-16 17:22:02.580665030 +0200
@@ -88,6 +88,10 @@
/* only used by haldclut */
int level;
+
+ /* only used by yuvflag and yuvflag2 */
+ int box_x, box_y, box_w, box_h;
+ AVFrame *flag;
} TestSourceContext;
#define OFFSET(x) offsetof(TestSourceContext, x)
@@ -2039,3 +2043,422 @@
};
#endif /* CONFIG_COLORCHART_FILTER */
+
+#if CONFIG_YUVFLAG_FILTER
+
+#include <emmintrin.h> // SSE2 intrinsics
+#include <immintrin.h> // Other intrinsics
+
+#include "libavutil/x86/cpu.h"
+
+static const AVOption yuvflag_options[] = {
+ COMMON_OPTIONS
+ { NULL }
+};
+
+AVFILTER_DEFINE_CLASS(yuvflag);
+
+static void yuvflag_fill_picture_8b(AVFilterContext *ctx, AVFrame *frame)
+{
+ TestSourceContext *test = ctx->priv;
+ int x = 0, y = 0;
+ const int linesize = frame->linesize[0];
+ uint8_t *line = frame->data[0];
+ int one_third = test->h / 3;
+ int two_third = one_third * 2;
+
+
+ const uint8_t red_y = 0x51;
+ const uint8_t red_u = 0x59;
+ const uint8_t red_v = 0xF0;
+ const uint32_t red = red_y << 24 | red_v << 16 | red_y << 8 | red_u;
+ const uint8_t white_y = 0xEB;
+ const uint8_t white_u = 0x80;
+ const uint8_t white_v = 0x80;
+ const uint32_t white = white_y << 24 | white_v << 16 | white_y << 8 | white_u;
+ const uint8_t blue_y = 0x29;
+ const uint8_t blue_u = 0xF0;
+ const uint8_t blue_v = 0x6E;
+ const uint32_t blue = blue_y << 24 | blue_v << 16 | blue_y << 8 | blue_u;
+ const uint8_t orange_y = 0x9C;
+ const uint8_t orange_u = 0x2F;
+ const uint8_t orange_v = 0xB9;
+ const uint32_t orange = orange_y << 24 | orange_v << 16 | orange_y << 8 | orange_u;
+
+ for (y = 0; y < one_third; y++) {
+ uint32_t *dst = line;
+ for (int x = 0; x < test->w; x += 2) {
+ *dst++ = red;
+ }
+ line += linesize;
+ }
+ for (; y < two_third; y++) {
+ uint32_t *dst = line;
+ for (int x = 0; x < test->w; x += 2) {
+ *dst++ = white;
+ }
+ line += linesize;
+ }
+ for (; y < test->h; y++) {
+ uint32_t *dst = line;
+ for (int x = 0; x < test->w; x += 2) {
+ *dst++ = blue;
+ }
+ line += linesize;
+ }
+
+ for (int y = test->box_y; y < (test->box_y + test->box_h); y++) {
+ for (int x = test->box_x; x < ((test->box_x + test->box_w) - 1); x += 2) {
+ uint32_t *dst = frame->data[0] + y * linesize + x * 2;
+ *dst++ = orange;
+ }
+ }
+
+ if ((test->box_x + test->box_w + 2) < test->w)
+ test->box_x += 2;
+ else
+ test->box_x = 0;
+
+ if ((test->box_y + test->box_h + 1) < test->h)
+ test->box_y++;
+ else
+ test->box_y = 0;
+}
+
+static void yuvflag_fill_picture_10b(AVFilterContext *ctx, AVFrame *frame)
+{
+ TestSourceContext *test = ctx->priv;
+ int x = 0, y = 0;
+ const int linesize = frame->linesize[0];
+ uint8_t *line = frame->data[0];
+ int one_third = test->h / 3;
+ int two_third = one_third * 2;
+
+ uint16_t *y_line = frame->data[0];
+ uint16_t *u_line = frame->data[1];
+ uint16_t *v_line = frame->data[2];
+ av_log(ctx, AV_LOG_DEBUG, "y=%lld, u=%lld, v=%lld\n", frame->data[0], frame->data[1], frame->data[2]);
+
+ const uint16_t red_y = 0x51 << 2;
+ const uint16_t red_u = 0x59 << 2;
+ const uint16_t red_v = 0xF0 << 2;
+ const uint32_t red = red_y << 24 | red_v << 16 | red_y << 8 | red_u;
+ const uint16_t white_y = 0xEB << 2;
+ const uint16_t white_u = 0x80 << 2;
+ const uint16_t white_v = 0x80 << 2;
+ const uint32_t white = white_y << 24 | white_v << 16 | white_y << 8 | white_u;
+ const uint16_t blue_y = 0x29 << 2;
+ const uint16_t blue_u = 0xF0 << 2;
+ const uint16_t blue_v = 0x6E << 2;
+ const uint32_t blue = blue_y << 24 | blue_v << 16 | blue_y << 8 | blue_u;
+ const uint16_t orange_y = 0x9C << 2;
+ const uint16_t orange_u = 0x2F << 2;
+ const uint16_t orange_v = 0xB9 << 2;
+ const uint32_t orange = orange_y << 24 | orange_v << 16 | orange_y << 8 | orange_u;
+
+ for (y = 0; y < one_third; y++) {
+ for (int x = 0; x < test->w; x += 2) {
+ *y_line++ = red_y;
+ *y_line++ = red_y;
+ *u_line++ = red_u;
+ *v_line++ = red_v;
+ }
+ }
+ for (; y < two_third; y++) {
+ for (int x = 0; x < test->w; x += 2) {
+ *y_line++ = white_y;
+ *y_line++ = white_y;
+ *u_line++ = white_u;
+ *v_line++ = white_v;
+ }
+ }
+ for (; y < test->h; y++) {
+ for (int x = 0; x < test->w; x += 2) {
+ *y_line++ = blue_y;
+ *y_line++ = blue_y;
+ *u_line++ = blue_u;
+ *v_line++ = blue_v;
+ }
+ }
+
+ for (int y = test->box_y; y < (test->box_y + test->box_h); y++) {
+ uint16_t *y_line = frame->data[0] + y * frame->linesize[0];
+ uint16_t *u_line = frame->data[1] + y * frame->linesize[1];
+ uint16_t *v_line = frame->data[2] + y * frame->linesize[2];
+ for (int x = test->box_x; x < ((test->box_x + test->box_w) - 1); x+=2) {
+ y_line[x] = orange_y;
+ y_line[x+1] = orange_y;
+ u_line[x/2] = orange_u;
+ v_line[x/2] = orange_v;
+ }
+ }
+
+ if ((test->box_x + test->box_w + 2) < test->w)
+ test->box_x += 2;
+ else
+ test->box_x = 0;
+
+ if ((test->box_y + test->box_h + 1) < test->h)
+ test->box_y++;
+ else
+ test->box_y = 0;
+}
+
+static void yuvflag_fill_picture_sse_8b(AVFilterContext *ctx, AVFrame *frame)
+{
+ TestSourceContext *test = ctx->priv;
+ int x = 0, y = 0;
+ const int linesize = frame->linesize[0];
+ uint8_t *line = frame->data[0];
+ int one_third = test->h / 3;
+ int two_third = one_third * 2;
+
+
+ const uint8_t red_y = 0x51, red_u = 0x59, red_v = 0xF0;
+ const uint8_t white_y = 0xEB, white_u = 0x80, white_v = 0x80;
+ const uint8_t blue_y = 0x29, blue_u = 0xF0, blue_v = 0x6E;
+ const uint8_t orange_y = 0x9C, orange_u = 0x2F, orange_v = 0xB9;
+
+ __m128i red = _mm_set1_epi32(red_y << 24 | red_v << 16 | red_y << 8 | red_u);
+ __m128i white = _mm_set1_epi32(white_y << 24 | white_v << 16 | white_y << 8 | white_u);
+ __m128i blue = _mm_set1_epi32(blue_y << 24 | blue_v << 16 | blue_y << 8 | blue_u);
+ // __m128i orange = _mm_set1_epi32(orange_y << 24 | orange_v << 16 | orange_y << 8 | orange_u);
+ const uint32_t orange = orange_y << 24 | orange_v << 16 | orange_y << 8 | orange_u;
+
+ for (y = 0; y < one_third; y++) {
+ __m128i *dst = line;
+ for (int x = 0; x < linesize; x += 16) {
+ _mm_stream_si128(dst++, red);
+ }
+ line += linesize;
+ }
+ for (; y < two_third; y++) {
+ __m128i *dst = line;
+ for (int x = 0; x < linesize; x += 16) {
+ _mm_stream_si128(dst++, white);
+ }
+ line += linesize;
+ }
+ for (; y < test->h; y++) {
+ __m128i *dst = line;
+ for (int x = 0; x < linesize; x += 16) {
+ _mm_stream_si128(dst++, blue);
+ }
+ line += linesize;
+ }
+
+ for (int y = test->box_y; y < (test->box_y + test->box_h); y++) {
+ for (int x = test->box_x; x < ((test->box_x + test->box_w) - 1); x += 2) {
+ uint32_t *dst = frame->data[0] + y * linesize + x * 2;
+ *dst++ = orange;
+ }
+ }
+
+ if ((test->box_x + test->box_w + 2) < test->w)
+ test->box_x += 2;
+ else
+ test->box_x = 0;
+
+ if ((test->box_y + test->box_h + 1) < test->h)
+ test->box_y++;
+ else
+ test->box_y = 0;
+}
+
+static void yuvflag_fill_picture_sse_10b(AVFilterContext *ctx, AVFrame *frame)
+{
+ TestSourceContext *test = ctx->priv;
+ int ret = 0;
+ // int x = 0, y = 0;
+ // const int linesize = frame->linesize[0];
+ // uint8_t *line = frame->data[0];
+ // int one_third = test->h / 3;
+ // int two_third = one_third * 2;
+
+ // uint8_t *y_line = frame->data[0];
+ // uint8_t *u_line = frame->data[1];
+ // uint8_t *v_line = frame->data[2];
+
+
+ const uint16_t orange_y = 0x9C << 2;
+ const uint16_t orange_u = 0x2F << 2;
+ const uint16_t orange_v = 0xB9 << 2;
+ // const uint32_t orange = orange_y << 24 | orange_v << 16 | orange_y << 8 | orange_u;
+
+ // const uint8_t red_y = 0x51, red_u = 0x59, red_v = 0xF0;
+ // const uint8_t white_y = 0xEB, white_u = 0x80, white_v = 0x80;
+ // const uint8_t blue_y = 0x29, blue_u = 0xF0, blue_v = 0x6E;
+ // const uint8_t orange_y = 0x9C, orange_u = 0x2F, orange_v = 0xB9;
+
+ // __m128i red = _mm_set1_epi32(red_y << 24 | red_v << 16 | red_y << 8 | red_u);
+ // __m128i white = _mm_set1_epi32(white_y << 24 | white_v << 16 | white_y << 8 | white_u);
+ // __m128i blue = _mm_set1_epi32(blue_y << 24 | blue_v << 16 | blue_y << 8 | blue_u);
+ // // __m128i orange = _mm_set1_epi32(orange_y << 24 | orange_v << 16 | orange_y << 8 | orange_u);
+ // const uint32_t orange = orange_y << 24 | orange_v << 16 | orange_y << 8 | orange_u;
+
+ ret = av_frame_copy(frame, test->flag);
+ if (ret < 0)
+ return;
+
+ for (int y = test->box_y; y < (test->box_y + test->box_h); y++) {
+ uint16_t *y_line = frame->data[0] + y * frame->linesize[0];
+ uint16_t *u_line = frame->data[1] + y * frame->linesize[1];
+ uint16_t *v_line = frame->data[2] + y * frame->linesize[2];
+ for (int x = test->box_x; x < ((test->box_x + test->box_w) - 1); x+=2) {
+ y_line[x] = orange_y;
+ y_line[x+1] = orange_y;
+ u_line[x/2] = orange_u;
+ v_line[x/2] = orange_v;
+ }
+ }
+
+ if ((test->box_x + test->box_w + 2) < test->w)
+ test->box_x += 2;
+ else
+ test->box_x = 0;
+
+ if ((test->box_y + test->box_h + 1) < test->h)
+ test->box_y++;
+ else
+ test->box_y = 0;
+}
+
+static int yuvflag_config_props(AVFilterLink *outlink)
+{
+ TestSourceContext *test = outlink->src->priv;
+ int cpu_flags = 0;
+ int ret = 0;
+
+ test->box_x = test->w / 2;
+ test->box_y = test->h / 2;
+ test->box_w = test->w / 10;
+ test->box_h = test->box_w;
+
+ cpu_flags = av_get_cpu_flags();
+ if (X86_SSE2(cpu_flags)) {
+ if (outlink->format == AV_PIX_FMT_UYVY422)
+ test->fill_picture_fn = yuvflag_fill_picture_sse_8b;
+ else if (outlink->format == AV_PIX_FMT_YUV422P10LE)
+ test->fill_picture_fn = yuvflag_fill_picture_sse_10b;
+ } else {
+ if (outlink->format == AV_PIX_FMT_UYVY422)
+ test->fill_picture_fn = yuvflag_fill_picture_8b;
+ else if (outlink->format == AV_PIX_FMT_YUV422P10LE)
+ test->fill_picture_fn = yuvflag_fill_picture_10b;
+ }
+
+ test->flag = av_frame_alloc();
+ test->flag->format = AV_PIX_FMT_YUV422P10LE;
+ test->flag->width = test->w;
+ test->flag->height = test->h;
+ ret = av_frame_get_buffer(test->flag, 0);
+ if (ret != 0)
+ return ret;
+
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(test->flag->format);
+
+ const uint16_t red_y = 0x51 << 2;
+ const uint16_t red_u = 0x59 << 2;
+ const uint16_t red_v = 0xF0 << 2;
+ const uint32_t red = red_y << 24 | red_v << 16 | red_y << 8 | red_u;
+ const uint16_t white_y = 0xEB << 2;
+ const uint16_t white_u = 0x80 << 2;
+ const uint16_t white_v = 0x80 << 2;
+ const uint32_t white = white_y << 24 | white_v << 16 | white_y << 8 | white_u;
+ const uint16_t blue_y = 0x29 << 2;
+ const uint16_t blue_u = 0xF0 << 2;
+ const uint16_t blue_v = 0x6E << 2;
+ const uint32_t blue = blue_y << 24 | blue_v << 16 | blue_y << 8 | blue_u;
+
+ uint8_t *y_line = test->flag->data[0];
+ uint8_t *u_line = test->flag->data[1];
+ uint8_t *v_line = test->flag->data[2];
+
+ int one_third;
+ int two_third;
+ int width = test->flag->width;
+ int height = test->flag->height;
+ int chroma_width = AV_CEIL_RSHIFT(width, desc->log2_chroma_w);
+ int chroma_height= AV_CEIL_RSHIFT(height, desc->log2_chroma_h);
+
+ one_third = height / 3;
+ two_third = one_third * 2;
+ for (int y = 0; y < height; y++) {
+ __m128i *dst_y = y_line;
+
+ if (y < one_third) {
+ for (int x = 0; x < width; x += 8)
+ _mm_store_si128(dst_y++, _mm_set1_epi16(red_y));
+ }
+ else if (y < two_third) {
+ for (int x = 0; x < width; x += 8)
+ _mm_store_si128(dst_y++, _mm_set1_epi16(white_y));
+ }
+ else {
+ for (int x = 0; x < width; x += 8)
+ _mm_store_si128(dst_y++, _mm_set1_epi16(blue_y));
+ }
+
+ y_line += test->flag->linesize[0];
+ }
+
+ one_third = chroma_height / 3;
+ two_third = one_third * 2;
+ for (int y = 0; y < chroma_height; y++) {
+ __m128i *dst_u = u_line;
+ __m128i *dst_v = v_line;
+
+ if (y < one_third) {
+ for (int x = 0; x < chroma_width; x += 8) {
+ _mm_store_si128(dst_u++, _mm_set1_epi16(red_u));
+ _mm_store_si128(dst_v++, _mm_set1_epi16(red_v));
+ }
+ }
+ else if (y < two_third) {
+ for (int x = 0; x < chroma_width; x += 8) {
+ _mm_store_si128(dst_u++, _mm_set1_epi16(white_u));
+ _mm_store_si128(dst_v++, _mm_set1_epi16(white_v));
+ }
+ }
+ else {
+ for (int x = 0; x < chroma_width; x += 8) {
+ _mm_store_si128(dst_u++, _mm_set1_epi16(blue_u));
+ _mm_store_si128(dst_v++, _mm_set1_epi16(blue_v));
+ }
+ }
+
+ u_line += test->flag->linesize[1];
+ v_line += test->flag->linesize[2];
+ }
+
+ return config_props(outlink);
+}
+
+static const enum AVPixelFormat yuvflag_pix_fmts[] = {
+ AV_PIX_FMT_UYVY422,
+ AV_PIX_FMT_YUV422P10LE,
+ AV_PIX_FMT_NONE
+};
+
+static const AVFilterPad avfilter_vsrc_yuvflag_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .config_props = yuvflag_config_props,
+ },
+};
+
+const AVFilter ff_vsrc_yuvflag = {
+ .name = "yuvflag",
+ .description = NULL_IF_CONFIG_SMALL("Generate YUV flag."),
+ .priv_size = sizeof(TestSourceContext),
+ .priv_class = &yuvflag_class,
+ .init = init,
+ .uninit = uninit,
+ .activate = activate,
+ .inputs = NULL,
+ FILTER_OUTPUTS(avfilter_vsrc_yuvflag_outputs),
+ FILTER_PIXFMTS_ARRAY(yuvflag_pix_fmts),
+};
+
+#endif /* CONFIG_YUVFLAG_FILTER */
diff --unified --recursive --text a/libavformat/allformats.c b/libavformat/allformats.c
--- a/libavformat/allformats.c 2023-02-27 21:43:45.000000000 +0100
+++ b/libavformat/allformats.c 2023-09-16 17:25:41.949686067 +0200
@@ -512,6 +512,8 @@
extern const AVInputFormat ff_yop_demuxer;
extern const AVInputFormat ff_yuv4mpegpipe_demuxer;
extern const FFOutputFormat ff_yuv4mpegpipe_muxer;
+extern const AVInputFormat ff_sdi_demuxer;
+extern const AVOutputFormat ff_sdi_muxer;
/* image demuxers */
extern const AVInputFormat ff_image_bmp_pipe_demuxer;
extern const AVInputFormat ff_image_cri_pipe_demuxer;
diff --unified --recursive --text a/libavformat/Makefile b/libavformat/Makefile
--- a/libavformat/Makefile 2023-02-27 21:43:45.000000000 +0100
+++ b/libavformat/Makefile 2023-09-16 17:24:03.158616736 +0200
@@ -27,6 +27,7 @@
riff.o \
sdp.o \
seek.o \
+ unused_functions.o \
url.o \
utils.o \
version.o \
@@ -524,6 +525,10 @@
OBJS-$(CONFIG_SCC_DEMUXER) += sccdec.o subtitles.o
OBJS-$(CONFIG_SCC_MUXER) += sccenc.o
OBJS-$(CONFIG_SCD_DEMUXER) += scd.o
+OBJS-$(CONFIG_SDI_DEMUXER) += sdidec.o sdicommon.o
+OBJS-$(CONFIG_SDI_MUXER) += sdienc.o sdicommon.o \
+ sdienc_audio.o \
+ sdienc_payloadid.o
OBJS-$(CONFIG_SDNS_DEMUXER) += sdns.o
OBJS-$(CONFIG_SDP_DEMUXER) += rtsp.o
OBJS-$(CONFIG_SDR2_DEMUXER) += sdr2.o
diff --unified --recursive --text a/libavutil/Makefile b/libavutil/Makefile
--- a/libavutil/Makefile 2023-02-27 21:43:45.000000000 +0100
+++ b/libavutil/Makefile 2023-09-16 17:31:15.049091139 +0200
@@ -170,6 +170,7 @@
timecode.o \
tree.o \
twofish.o \
+ unused_functions.o \
utils.o \
xga_font_data.o \
xtea.o \
diff --unified --recursive --text a/libswresample/Makefile b/libswresample/Makefile
--- a/libswresample/Makefile 2023-02-27 21:43:45.000000000 +0100
+++ b/libswresample/Makefile 2023-09-16 17:32:12.457392311 +0200
@@ -14,6 +14,7 @@
resample_dsp.o \
swresample.o \
swresample_frame.o \
+ unused_functions.o \
version.o \
OBJS-$(CONFIG_LIBSOXR) += soxr_resample.o
diff --unified --recursive --text a/libswscale/Makefile b/libswscale/Makefile
--- a/libswscale/Makefile 2023-02-27 21:43:45.000000000 +0100
+++ b/libswscale/Makefile 2023-09-16 17:33:17.400414958 +0200
@@ -17,6 +17,7 @@
slice.o \
swscale.o \
swscale_unscaled.o \
+ unused_functions.o \
utils.o \
version.o \
yuv2rgb.o \
diff --unified --recursive --text a/tests/Makefile b/tests/Makefile
--- a/tests/Makefile 2023-02-27 21:43:45.000000000 +0100
+++ b/tests/Makefile 2023-09-16 17:34:25.951512552 +0200
@@ -229,6 +229,7 @@
include $(SRC_PATH)/tests/fate/qtrle.mak
include $(SRC_PATH)/tests/fate/real.mak
include $(SRC_PATH)/tests/fate/screen.mak
+include $(SRC_PATH)/tests/fate/sdi.mak
include $(SRC_PATH)/tests/fate/segafilm.mak
include $(SRC_PATH)/tests/fate/segment.mak
include $(SRC_PATH)/tests/fate/source.mak
|