-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtry-chroma-decoder
executable file
·1017 lines (941 loc) · 24.5 KB
/
try-chroma-decoder
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
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh -e
# Test the chroma decoder, capturing the output.
usage () {
cat >&2 <<EOF
Usage: $0 [options] [TEST ...]"
$0 - Test ld-chroma-decoder
Options:
-n NAME Name of output subdirectory (default: tmp)
-a Only run tests that haven't already been run
-s SYSTEM Only run tests for a particular system (pal or ntsc)
-f DECODER Select chroma decoder (use with -s)
-o OPTIONS Pass extra options to ld-chroma-decoder
-I Don't generate undecoded input images
-V Don't generate videos of output
Read this script for the list of possible tests.
EOF
exit 1
}
newonly=false
defaultdecoder=
inputfiles=true
version=tmp
extraopts=
onlysystem=
videofiles=true
while getopts "af:In:o:s:V" c; do
case "$c" in
a)
newonly=true
;;
f)
defaultdecoder="$OPTARG"
;;
I)
inputfiles=false
;;
n)
version="$OPTARG"
;;
o)
extraopts="$OPTARG"
;;
s)
onlysystem="$OPTARG"
;;
V)
videofiles=false
;;
\?)
usage
;;
esac
done
shift $(expr $OPTIND - 1)
testsuitedir="$(realpath $(dirname $0))"
testdatadir="$(realpath $testsuitedir/../ld-decode-testdata)"
ldddir="$(realpath $testsuitedir/../ld-decode)"
export PATH="$ldddir/tools/ld-ldstoefm:$PATH"
export LD_LIBRARY_PATH="$ldddir/tools/library:$LD_LIBRARY_PATH"
outdir="$testsuitedir/output/$version"
cachedir="$testsuitedir/cache"
tmpdir="/var/tmp/lddtest"
ramdir="/tmp/lddtest"
mkdir -p "$outdir" "$cachedir" "$tmpdir" "$ramdir"
# Remove any leftover .tbc files from $ramdir on exit.
trap 'rm -f "$ramdir"/*.tbc' 0
(cd "$ldddir" && git log -1) >"$outdir/git-revision.new"
if [ -f "$outdir/git-revision" ]; then
if ! cmp -s "$outdir/git-revision" "$outdir/git-revision.new"; then
echo >&2 "Different git revision in $outdir/git-revision"
exit 1
fi
fi
mv "$outdir/git-revision.new" "$outdir/git-revision"
commitdate=$(cd "$ldddir" && git log -1 --pretty=%cI)
verbose () {
echo >&2 ">>> $*"
"$@"
}
# Check that a .tbc file exists, decoding it from a .lds if not.
make_tbc () {
tbc="$1"
lds="$2"
shift 2
if [ -f "$tbc" ]; then
return
fi
lddecode="$ldddir/ld-decode.py"
if [ -f "$ldddir/ld-decode" ]; then
lddecode="$ldddir/ld-decode"
fi
verbose $lddecode "$@" "$lds" "${tbc%.tbc}"
}
# Generate a .tbc file using hacktv.
make_hacktv_tbc () {
tbc="$1"
system="$2"
length="$3"
shift 3
if [ -f "$tbc" ]; then
return
fi
verbose $testsuitedir/hacktv-to-tbc "--$system" -l "$length" "$tbc" -G 1.0 "$@"
}
# Link to an existing .tbc.
link_tbc () {
outtbc="$1"
intbc="$2"
shift 2
if [ -f "$tbc" ]; then
return
fi
verbose ln -sf "$intbc" "$outtbc"
verbose ln -sf "$intbc.json" "$outtbc.json"
}
# Chroma-decode a capture.
decode () {
system="$1"
lds="$2"
shift 2
frame=
stillframe=0
use3d=
usedecoder="${system}2d"
nogain=false
noise=
lddargs=
tbcsource=ld-decode
hacktvlength=0
usedoc=
docargs=
aspect=4:3
y4m=false
if [ -n "$defaultdecoder" ]; then
usedecoder="$defaultdecoder"
fi
while :; do
case "$1" in
--frame)
# CAV frame to seek to in the input file
frame="$2"
shift 2
;;
--stillframe)
# Frame (from 0) to seek to in the output file, for stills
stillframe="$2"
shift 2
;;
--1d)
# Use 1D decoder
usedecoder="${system}1d"
shift 1
;;
--3d|--3dmap)
# Use 3D decoder, or 3D decoder showing motion map
use3d="$1"
usedecoder="${system}3d"
shift 1
;;
--decoder)
# Use a specific decoder
usedecoder="$2"
shift 2
;;
--nogain)
# Defeat chroma gain fudge factor
nogain=true
shift 1
;;
--noise)
# Add random noise to the TBC
noise="$2"
shift 2
;;
--ldd-*)
# Pass argument to ld-decode
lddargs="$lddargs ${1#--ldd}"
shift 1
;;
--hacktv)
# Use hacktv rather than ld-decode, giving a length in frames
tbcsource=hacktv
hacktvlength="$2"
shift 2
;;
--doc)
# Use ld-dropout-correct
usedoc=yes
shift 1
;;
--doc-*)
# Pass argument to ld-dropout-correct
docargs="$docargs ${1#--doc}"
shift 1
;;
--aspect)
# Override aspect ratio
aspect="$2"
shift 2
;;
--y4m)
# Use y4m output (which also tests plain yuv)
y4m=true
shift 1
;;
*)
# Remaining args are passed to the chroma decoder directly
break
;;
esac
done
if [ -n "$onlysystem" -a "$system" != "$onlysystem" ]; then
echo >&2 "Test skipped because it's not for $onlysystem: $testname"
return
fi
case "$lds" in
test:*)
# hacktv's internal source
;;
*.tbc)
# Existing TBC file
if ! [ -f "$lds" -a -f "$lds.json" ]; then
echo >&2 "Test skipped because source file is missing: $testname"
return
fi
tbcsource=link
;;
*)
if ! [ -f "$lds" ]; then
echo >&2 "Test skipped because source file is missing: $testname"
return
fi
;;
esac
if [ ! -f "$ldddir/tools/ld-chroma-decoder/transformpal.cpp" ]; then
case "$usedecoder" in
transform*)
echo >&2 "Test skipped because no Transform support: $testname"
return
;;
esac
fi
if ! grep -q getThresholdsSize "$ldddir/tools/ld-chroma-decoder/palcolour.h"; then
case "$usedecoder" in
transform*f*)
echo >&2 "Test skipped because no Transform threshold file support: $testname"
return
;;
esac
fi
if ! grep -q simplePAL "$ldddir/tools/ld-chroma-decoder/palcolour.h"; then
case "$usedecoder" in
pal*s|transform*s)
echo >&2 "Test skipped because no Simple PAL support: $testname"
return
;;
esac
fi
if ! grep -q ntsc1d "$ldddir/tools/ld-chroma-decoder/main.cpp"; then
case "$usedecoder" in
ntsc1d)
echo >&2 "Test skipped because no ntsc1d support: $testname"
return
;;
esac
fi
if ! grep -q outputFormatOption "$ldddir/tools/ld-chroma-decoder/main.cpp"; then
if $y4m; then
echo >&2 "Test skipped because no y4m support: $testname"
return
fi
fi
if $newonly && [ -f "$outdir/$testname-output.png" ]; then
echo >&2 "Test already done: $testname"
return
fi
rm -f \
"$outdir/$testname.FAILED" \
"$outdir/$testname-input.png" \
"$outdir/$testname-output.png" \
"$outdir/$testname.mkv"
case "$system" in
ntsc)
inputsize=910x526
if [ "$commitdate" '<' 2019-05-05 ]; then
# Pre ebf68032f3b9653c9a660749e8d21c414f181cae
outputsize=754x486
else
outputsize=760x488
fi
fps=30
lddargs="$lddargs --ntsc"
;;
pal)
inputsize=1135x626
if [ "$commitdate" '<' 2019-05-05 ]; then
outputsize=922x576
else
outputsize=928x576
fi
fps=25
lddargs="$lddargs --pal"
;;
esac
case "$lds" in
*.r8)
lddargs="$lddargs -f 8fsc --daa"
;;
esac
# Name the cached .tbc after the .lds file, for reuse between tests.
tbc="$cachedir/$(echo "$lds" | sed 's,/,_,g').tbc"
rgb="$tmpdir/$testname.rgb"
if $y4m; then
rgb="$tmpdir/$testname.y4m"
fi
case "$tbcsource" in
ld-decode)
make_tbc "$tbc" "$lds" $lddargs
;;
hacktv)
make_hacktv_tbc "$tbc" "$system" "$hacktvlength" "$lds"
;;
link)
link_tbc "$tbc" "$lds"
;;
esac
if [ -n "$noise" ]; then
noisytbc="$tbc.noise$noise"
if [ ! -f "$noisytbc" ]; then
$testsuitedir/rot-tbc "$noise" "$tbc" "$noisytbc"
fi
tbc="$noisytbc"
fi
if [ -n "$usedoc" ]; then
doctbc="$tbc.doc"
rm -f "$doctbc" "$doctbc.json"
if ! verbose $ldddir/tools/ld-dropout-correct/ld-dropout-correct $docargs "$tbc" "$doctbc"; then
touch "$outdir/$testname.FAILED"
return
fi
tbc="$doctbc"
fi
if [ -f "$ldddir/tools/ld-comb-$system/main.cpp" ]; then
decoder="$ldddir/tools/ld-comb-$system/ld-comb-$system"
if [ -n "$use3d" ]; then
decoder="$decoder --3d"
fi
# Doesn't understand -f, so usedecoder will be ignored.
else
decoder="$ldddir/tools/ld-chroma-decoder/ld-chroma-decoder"
if [ -n "$usedecoder" ]; then
case "$usedecoder" in
pal*s|transform*s)
decoder="$decoder --simple-pal"
usedecoder=$(echo "$usedecoder" | sed 's/s$//')
esac
case "$usedecoder" in
transform3df)
decoder="$decoder --transform-thresholds $testsuitedir/transform3d.thresholds"
usedecoder="transform3d"
;;
esac
decoder="$decoder -f ${usedecoder}"
fi
fi
rawframe=0
if [ -n "$frame" ]; then
frameno=$("$testsuitedir/picno-to-frame" "$tbc.json" "$frame")
decoder="$decoder -s $frameno"
rawframe=$(expr $frameno - 1)
fi
if [ "$use3d" = "--3dmap" ]; then
decoder="$decoder --oftest"
fi
if $nogain; then
decoder="$decoder --chroma-gain 1.0"
fi
if $y4m; then
decoder="$decoder -p y4m"
fi
if [ -n "$extraopts" ]; then
decoder="$decoder $extraopts"
fi
if ! verbose $decoder "$@" "$tbc" "$rgb"; then
touch "$outdir/$testname.FAILED"
return
fi
ffmpeg="ffmpeg -loglevel error -y"
ffmpegout="$ffmpeg -f rawvideo -pix_fmt rgb48 -s $outputsize"
if $y4m; then
ffmpegout="$ffmpeg -f yuv4mpegpipe"
fi
if $inputfiles; then
$ffmpeg -f rawvideo -pix_fmt gray16 -s $inputsize -r 1 \
-ss $(expr $rawframe + $stillframe) -t 1 \
-i "$tbc" "$outdir/$testname-input.png"
fi
$ffmpegout -r 1 \
-ss $stillframe -t 1 \
-i "$rgb" "$outdir/$testname-output.png"
if $videofiles; then
$ffmpegout -r $fps \
-i "$rgb" \
-filter:v setfield=tff \
-codec:v libx264rgb -crf 16 -flags +ildct+ilme -aspect "$aspect" \
"$outdir/$testname.mkv"
fi
}
# Decode with dropout correction.
doc_decode () {
testname="$1"
system="$2"
lds="$3"
shift 3
case "$testname" in
*-off)
docargs=""
;;
*-on)
docargs="--doc --doc--overcorrect"
;;
*-on-intra)
docargs="--doc --doc--overcorrect --doc--intra"
;;
*)
echo >&2 "Unknown doc mode in $testname"
exit 1
;;
esac
decode "$system" "$lds" $docargs "$@"
}
# Capture timings.
benchmark () {
system="$1"
lds="$2"
usedecoder="$3"
shift 3
if ! [ -f "$lds" ]; then
echo >&2 "Test skipped because source file is missing: $testname"
return
fi
if [ ! -f "$ldddir/tools/ld-chroma-decoder/transformpal.cpp" ]; then
case "$usedecoder" in
transform*)
echo >&2 "Test skipped because no Transform support: $testname"
return
;;
esac
fi
if [ ! -f "$ldddir/tools/ld-chroma-decoder/transformpal3d.cpp" ]; then
case "$usedecoder" in
transform3d)
echo >&2 "Test skipped because no Transform 3D support: $testname"
return
;;
esac
fi
# Get the number of CPUs, and go a little beyond that in case that works better
maxcpus=$(grep ^processor /proc/cpuinfo | wc -l)
maxcpus=$(expr $maxcpus + 3)
# Check for parallelisation support in decoders.
numframes=1000
case "$usedecoder" in
pal2d)
if [ -f "$ldddir/tools/ld-chroma-decoder/main.cpp" ]; then
:
elif ! grep -q threadsOption "$ldddir/tools/ld-comb-pal/main.cpp" 2>/dev/null; then
maxcpus=1
fi
;;
ntsc2d)
if [ ! -f "$ldddir/tools/ld-chroma-decoder/ntscdecoder.cpp" ]; then
maxcpus=1
fi
;;
ntsc3d)
if ! grep -q getLookBehind "$ldddir/tools/ld-chroma-decoder/ntscdecoder.cpp" 2>/dev/null; then
maxcpus=1
fi
# Slow decoder - use a shorter benchmark
numframes=300
;;
esac
benchfile="$outdir/Benchfile.$testname."$(hostname)
case "$system" in
ntsc)
lddargs="--ntsc"
;;
pal)
lddargs="--pal"
;;
esac
# Name the cached .tbc after the .lds file, for reuse between tests.
tbcbase="$(echo "$lds" | sed 's,/,_,g')-benchmark$numframes.tbc"
tbc="$cachedir/$tbcbase"
make_tbc "$tbc" "$lds" $lddargs -l $numframes
# Copy the .tbc to $ramdir, to minimise read time.
tbcram="$ramdir/$tbcbase"
if [ ! -f "$tbcram" ]; then
cp "$tbc" "$tbc.json" "$ramdir"
fi
if [ -f "$ldddir/tools/ld-comb-$system/main.cpp" ]; then
decoder="$ldddir/tools/ld-comb-$system/ld-comb-$system"
if [ "$usedecoder" = "ntsc3d" ]; then
decoder="$decoder --3d"
fi
else
decoder="$ldddir/tools/ld-chroma-decoder/ld-chroma-decoder -f $usedecoder"
fi
# XXX Find a better way of writing this
if [ "$maxcpus" = "1" ]; then
benchchart measure -f "$benchfile" \
-r 1 -n 3 \
"$decoder $* $tbcram /dev/null"
else
benchchart measure -f "$benchfile" \
-r "1-$maxcpus" -n 3 \
"$decoder -t \$v $* $tbcram /dev/null"
fi
}
# Populate this by running testvideos.py.
EVALDATA="$cachedir/evaluate/video"
ATSDATA="/n/stuff2/capture/laserdisc"
GGV1069="$ATSDATA/Simon/GGV1069_CAV_NTSC_side1_2019-06-15_18-02-41.raw.oga"
GGV1011="$ATSDATA/Simon/GGV1011_CAV_PAL_side1_DD1_2019-06-12_20-18-21.raw.oga"
all_tests="\
snellwilcox ntscbars \
testcardg palbars palbars-kagemusha palbars-bgb leon \
snellwilcox-n1d \
snellwilcox-phasecomp \
snellwilcox-n3d nr-vbar-n3d nr-sweep-n3d 3dmap1 3dmap2 3dmap3 \
testcardg-t3ds \
testcardg-mono snellwilcox-mono \
testcardg-yuv444 testcardg-gray16 snellwilcox-yuv444 snellwilcox-gray16 \
noise-ntsc-20000 noise-pal-20000 noise-t2d-20000 \
nr-vbar nr-multiburst nr-white100 nr-black7.5 nr-compositetest nr-stairstep nr-bars \
nr-magenta nr-cross nr-dot nr-stills nr-sweep nr-testcard nr-ramp nr-bounce \
pr-vbar pr-multiburst pr-white100 pr-black7.5 pr-pulsebar pr-stairstep pr-bars \
pr-magenta pr-window pr-cross pr-dot pr-black0 pr-sweep pr-ramp pr-yramp \
"
for frame in 2 4 25 54 77 88 122 123 145 155; do
all_tests="$all_tests pr-motion$frame"
done
for decoder in t2d t3d t3df; do
all_tests="$all_tests testcardg-$decoder palbars-$decoder pr-sweep-$decoder"
if [ "$decoder" != "t3df" ]; then
all_tests="$all_tests testcardg-$decoder-thresh0.3"
fi
for frame in 2 25 122 123 155; do
all_tests="$all_tests pr-motion$frame-$decoder"
done
if $videofiles; then
all_tests="$all_tests pr-motion-$decoder"
fi
done
for doctest in kagemusha un aspen; do
all_tests="$all_tests doc-$doctest-off doc-$doctest-on doc-$doctest-on-intra"
done
if $videofiles; then
all_tests="$all_tests nr-motion pr-motion"
fi
for bbctest in couple mobcal newpat newpatcirc swinging wheel; do
for decoder in mono pal2d transform2d transform3d; do
all_tests="$all_tests bbc-$bbctest-$decoder"
done
done
run_test () {
testname="$1"
case "$testname" in
# Basic NTSC tests
snellwilcox)
# Snell & Wilcox test pattern from "Video Essentials"
decode ntsc "$testdatadir/ve-snw-cut.lds"
;;
ntscbars)
# SMPTE colour bars from GGV1069
decode ntsc "$testdatadir/ggv_cbar_5500-v2800.lds"
;;
# Basic PAL tests
testcardg)
# BBC Test Card G from "Jason and the Argonauts"
decode pal "$testdatadir/pal/jason-testpattern.lds"
;;
palbars)
# 75% colour bars from "Jason and the Argonauts"
# These are EBU PAL bars: white is 100% amplitude; colours are 75% amplitude.
decode pal "$testdatadir/pal/jason-cbar1.lds"
;;
palbars-kagemusha)
# 75% EBU bars from leadout of "Kagemusha"
decode pal "$ATSDATA/Kagemusha_CLV_PAL_ANA_side3leadout_4400_2019-08-26_17-08-41.raw.oga" --ldd--ignoreleadout --ldd-s1500 --ldd-l16
;;
palbars-bgb)
# 75% EBU bars (with rather low level) from leadout of "British Garden Birds"
decode pal "$ATSDATA/BritishGardenBirds_CAV_PAL_ANA_side1leadout_4400_2019-08-24_22-14-42.raw.oga" --ldd--ignoreleadout --ldd-s20 --ldd-l16
;;
leon)
# A few seconds from "Leon", captured noisily with cxadc
decode pal "$ATSDATA/cap.leon.r8"
;;
# ntsc1d decoder
snellwilcox-n1d)
# Snell & Wilcox test pattern from "Video Essentials"
decode ntsc "$testdatadir/ve-snw-cut.lds" --stillframe 15 --1d
;;
# ntsc2d decoder with special options
snellwilcox-phasecomp)
decode ntsc "$testdatadir/ve-snw-cut.lds" --ntsc-phase-comp
;;
# ntsc3d decoder
snellwilcox-n3d)
# Snell & Wilcox test pattern from "Video Essentials"
decode ntsc "$testdatadir/ve-snw-cut.lds" --stillframe 15 --3d
;;
nr-vbar-n3d)
# The crosstalk test frames, testing response to shot changes.
decode ntsc "$GGV1069" --frame 113 --3d --stillframe 2 -l 5
;;
nr-sweep-n3d)
decode ntsc "$GGV1069" --frame 17151 --3d --stillframe 5 -l 10
;;
3dmap1)
# 3D map -- this should have motion
decode ntsc "$testdatadir/ve-snw-cut.lds" --stillframe 5 --3dmap
;;
3dmap2)
# 3D map -- this should be still
decode ntsc "$testdatadir/ve-snw-cut.lds" --stillframe 15 --3dmap
;;
3dmap3)
# 3D map, first frame after seek -- this should be identical to 3dmap2
decode ntsc "$testdatadir/ve-snw-cut.lds" --3dmap -s 16 -l 1
;;
# transform2d decoder
testcardg-t2d)
decode pal "$testdatadir/pal/jason-testpattern.lds" --decoder transform2d -l 1
;;
testcardg-t2d-thresh0.3)
decode pal "$testdatadir/pal/jason-testpattern.lds" --decoder transform2d -l 1 \
--transform-threshold 0.3
;;
palbars-t2d)
decode pal "$testdatadir/pal/jason-cbar1.lds" --decoder transform2d -l 1
;;
pr-motion-t2d)
decode pal "$GGV1011" --frame 19501 --decoder transform2d --stillframe 20
;;
pr-motion*-t2d)
num=$(echo "$testname" | sed -e s/pr-motion// -e s/-t2d//)
decode pal "$GGV1011" --frame $(expr 19501 + 25 \* "$num") --decoder transform2d -l 1
;;
pr-sweep-t2d)
decode pal "$GGV1011" --frame 14301 --decoder transform2d -l 1
;;
# transform3d decoder
testcardg-t3d)
decode pal "$testdatadir/pal/jason-testpattern.lds" --decoder transform3d -l 1
;;
testcardg-t3d-thresh0.3)
decode pal "$testdatadir/pal/jason-testpattern.lds" --decoder transform3d -l 1 \
--transform-threshold 0.3
;;
palbars-t3d)
decode pal "$testdatadir/pal/jason-cbar1.lds" --decoder transform3d -l 1
;;
pr-motion-t3d)
decode pal "$GGV1011" --frame 19501 --decoder transform3d --stillframe 20
;;
pr-motion*-t3d)
num=$(echo "$testname" | sed -e s/pr-motion// -e s/-t3d//)
decode pal "$GGV1011" --frame $(expr 19501 + 25 \* "$num") --decoder transform3d -l 1
;;
pr-sweep-t3d)
decode pal "$GGV1011" --frame 14301 --decoder transform3d -l 1
;;
# transform3d decoder with per-bin thresholds
testcardg-t3df)
decode pal "$testdatadir/pal/jason-testpattern.lds" --decoder transform3df -l 1
;;
palbars-t3df)
decode pal "$testdatadir/pal/jason-cbar1.lds" --decoder transform3df -l 1
;;
pr-motion-t3df)
decode pal "$GGV1011" --frame 19501 --decoder transform3df --stillframe 20
;;
pr-motion*-t3df)
num=$(echo "$testname" | sed -e s/pr-motion// -e s/-t3df//)
decode pal "$GGV1011" --frame $(expr 19501 + 25 \* "$num") --decoder transform3df -l 1
;;
pr-sweep-t3df)
decode pal "$GGV1011" --frame 14301 --decoder transform3df -l 1
;;
# Simple PAL
testcardg-t3ds)
decode pal "$testdatadir/pal/jason-testpattern.lds" --decoder transform3ds -l 1
;;
# mono decoder
testcardg-mono)
decode pal "$testdatadir/pal/jason-testpattern.lds" --decoder mono
;;
snellwilcox-mono)
decode ntsc "$testdatadir/ve-snw-cut.lds" --decoder mono
;;
# y4m output
testcardg-yuv444)
decode pal "$testdatadir/pal/jason-testpattern.lds" --decoder pal2d --y4m
;;
testcardg-gray16)
decode pal "$testdatadir/pal/jason-testpattern.lds" --decoder mono --y4m
;;
snellwilcox-yuv444)
decode ntsc "$testdatadir/ve-snw-cut.lds" --decoder ntsc2d --y4m
;;
snellwilcox-gray16)
decode ntsc "$testdatadir/ve-snw-cut.lds" --decoder mono --y4m
;;
# Tests with artificial noise added
noise-ntsc-*)
mag=$(echo "$testname" | sed 's/.*-//')
decode ntsc "$testdatadir/ve-snw-cut.lds" --noise "$mag"
;;
noise-pal-*)
mag=$(echo "$testname" | sed 's/.*-//')
decode pal "$testdatadir/pal/jason-testpattern.lds" --noise "$mag"
;;
noise-t2d-*)
mag=$(echo "$testname" | sed 's/.*-//')
decode pal "$testdatadir/pal/jason-testpattern.lds" --decoder transform2d --noise "$mag"
;;
# Tests from GGV1069, Pioneer's NTSC Reference Disc
nr-vbar)
# Crosstalk check; also tests that --frame gets the right frame
decode ntsc "$GGV1069" --frame 113 --stillframe 2 -l 5
;;
nr-multiburst)
decode ntsc "$GGV1069" --frame 951 -l 10
;;
nr-white100)
decode ntsc "$GGV1069" --frame 1851 -l 10
;;
nr-black7.5)
decode ntsc "$GGV1069" --frame 2751 -l 10
;;
nr-compositetest)
decode ntsc "$GGV1069" --frame 3651 -l 10
;;
nr-stairstep)
decode ntsc "$GGV1069" --frame 4551 -l 10
;;
nr-bars)
decode ntsc "$GGV1069" --frame 5451 -l 10
;;
nr-magenta)
decode ntsc "$GGV1069" --frame 7251 -l 10
# Other solid colours follow; magenta is what the service manuals use.
;;
nr-cross)
decode ntsc "$GGV1069" --frame 14451 -l 10
;;
nr-dot)
decode ntsc "$GGV1069" --frame 15351 -l 10
;;
nr-stills)
decode ntsc "$GGV1069" --frame 16251 -l 10
;;
nr-still*)
# This is a loop of 21 images; use nr-still1 to nr-still21 to get them.
# Not enabled by default because they're not very good quality.
num=$(echo "$testname" | sed s/nr-still//)
decode ntsc "$GGV1069" --frame $(expr 16200 + $num) -l 1
;;
nr-sweep)
decode ntsc "$GGV1069" --frame 17151 -l 10
;;
nr-testcard)
decode ntsc "$GGV1069" --frame 18051 -l 10
;;
nr-ramp)
decode ntsc "$GGV1069" --frame 18951 -l 10
;;
nr-bounce)
decode ntsc "$GGV1069" --frame 20751 -l 10
;;
nr-motion)
decode ntsc "$GGV1069" --frame 23401
;;
# Tests from GGV1011, Pioneer's PAL Reference Disc
pr-vbar)
# Crosstalk check; also tests that --frame gets the right frame
decode pal "$GGV1011" --frame 475 -l 10
;;
pr-multiburst)
decode pal "$GGV1011" --frame 801 -l 10
;;
pr-white100)
decode pal "$GGV1011" --frame 1551 -l 10
;;
pr-black7.5)
decode pal "$GGV1011" --frame 2301 -l 10
;;
pr-pulsebar)
decode pal "$GGV1011" --frame 3051 -l 10
;;
pr-stairstep)
decode pal "$GGV1011" --frame 3801 -l 10
;;
pr-bars)
# These are EBU SECAM bars: white and colours are all 75% amplitude.
# (Still encoded as PAL, but would produce valid output on a SECAM player.)
decode pal "$GGV1011" --frame 4551 -l 10
;;
pr-magenta)
decode pal "$GGV1011" --frame 6051 -l 10
;;
pr-blue)
decode pal "$GGV1011" --frame 6801 -l 10
;;
pr-red)
decode pal "$GGV1011" --frame 8001 -l 10
;;
pr-green)
decode pal "$GGV1011" --frame 8751 -l 10
;;
pr-window)
decode pal "$GGV1011" --frame 11301 -l 10
;;
pr-cross)
decode pal "$GGV1011" --frame 12051 -l 10
;;
pr-dot)
decode pal "$GGV1011" --frame 12801 -l 10
;;
pr-black0)
decode pal "$GGV1011" --frame 13551 -l 10
;;
pr-sweep)
decode pal "$GGV1011" --frame 14301 -l 10
;;
pr-ramp)
decode pal "$GGV1011" --frame 15801 -l 10
;;
pr-yramp)
decode pal "$GGV1011" --frame 17301 -l 10
;;
pr-motion)
decode pal "$GGV1011" --frame 19501 --stillframe 20
;;
pr-motion*)
# pr-motionN is a still frame from N seconds into the motion section.
num=$(echo "$testname" | sed s/pr-motion//)
decode pal "$GGV1011" --frame $(expr 19501 + 25 \* "$num") -l 1
;;
# Synthetic tests using hacktv
hp-bars)
decode pal test:colourbars --hacktv 16
;;
hp-testcardj)
decode pal "/n/stuff/tv/Testcards/tcj-43.mkv" --hacktv 16
;;
# Synthetic tests using BBC encoder
bbc-couple-*)
decoder=$(echo "$testname" | sed 's/.*-//')
decode pal "$ATSDATA/BBC/xc_couple.tbc" --nogain --decoder "$decoder" --aspect 16:9 --stillframe 25
;;
bbc-mobcal-*)
decoder=$(echo "$testname" | sed 's/.*-//')
decode pal "$ATSDATA/BBC/mobcal.tbc" --nogain --decoder "$decoder" --stillframe 25
;;
bbc-newpat-*)
decoder=$(echo "$testname" | sed 's/.*-//')
# This is newpat_pm.tbc with the first 16 fields repeated to
# give 256 fields, so there's enough headroom to get
# transform3d going properly at both ends.
decode pal "$ATSDATA/BBC/newpat_pm_x16.tbc" --nogain --decoder "$decoder" --aspect 16:9 --stillframe 60 -s 8 -l 120
;;
bbc-newpatcirc-*)
decoder=$(echo "$testname" | sed 's/.*-//')
decode pal "$ATSDATA/BBC/circling_newpat_pm.tbc" --nogain --decoder "$decoder" --aspect 16:9 --stillframe 5
;;
bbc-swinging-*)
decoder=$(echo "$testname" | sed 's/.*-//')
decode pal "$ATSDATA/BBC/hv_swinging_bars_12.tbc" --nogain --decoder "$decoder" --aspect 16:9 --stillframe 6
;;
bbc-wheel-*)
decoder=$(echo "$testname" | sed 's/.*-//')
decode pal "$ATSDATA/BBC/wheel.tbc" --nogain --decoder "$decoder" --stillframe 50
;;
# Synthetic tests using ld-chroma-encoder
# XXX Compare line-locked and subcarrier-locked
vqeg-mobcal-*)
decoder=$(echo "$testname" | sed 's/.*-//')
decode pal "$EVALDATA/vqeg-mobilecalendar.tbc" --nogain --decoder "$decoder" --stillframe 25 -s 97
;;
# Performance tests
bench-ntsc2d)
benchmark ntsc "$GGV1069" ntsc2d
;;
bench-ntsc3d)
benchmark ntsc "$GGV1069" ntsc3d
;;
bench-pal2d)
benchmark pal "$GGV1011" pal2d
;;
bench-transform2d)
benchmark pal "$GGV1011" transform2d
;;
bench-transform3d)
benchmark pal "$GGV1011" transform3d
;;
# Dropout correction
doc-kagemusha-*)
doc_decode "$testname" \
pal "$ATSDATA/Kagemusha_CLV_PAL_ANA_side1_4400_2019-08-26_16-50-27.raw.oga" --ldd-s3786 --ldd-l16 \
--decoder transform3d
;;
doc-un-*)
doc_decode "$testname" \
pal "$ATSDATA/Simon/The World the UN and You_CAV_PAL_Disc1_2019-09-15_18-27-44.raw.oga" \
--ldd-s1000 --ldd-S470 --ldd-l16 --stillframe 6 \
--decoder transform3d
;;
doc-aspen-*)
doc_decode "$testname" \
ntsc "$ATSDATA/Simon/MIT_Aspen_Map_4.raw.oga" --ldd-s41900 --ldd-S42875 --ldd-l16 --frame 42883
;;
# XXX Signals with varying chroma/burst amplitude