File: val_surface_sharing_api.py

package info (click to toggle)
libvpl-tools 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,652 kB
  • sloc: cpp: 107,469; python: 4,303; ansic: 3,202; sh: 159; lisp: 52; makefile: 13
file content (749 lines) | stat: -rw-r--r-- 24,715 bytes parent folder | download | duplicates (2)
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
#==============================================================================
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
#==============================================================================
"""Surface Sharing API Validation Script."""
import subprocess  # nosec
import glob
import os
from enum import Enum


class SurfaceComponent(Enum):
    """Surface component list"""
    ENCODE = "encode"
    DECODE = "decode"
    VPP_INPUT = "vpp_in"
    VPP_OUTPUT = "vpp_out"


class SurfaceType(Enum):
    """Surface type list"""
    D3D11_TEX2D = "d3d11"
    VAAPI = "vaapi"
    OPENCL_IMG2D = "opencl"


class Mode(Enum):
    """Mode list"""
    COPY = "copy"
    SHARED = "shared"


# pylint: disable=too-few-public-methods
class TestStats:
    """Test staticstics for the report"""
    def __init__(self):
        self.n_total_testcase = 0
        self.n_total_failed = 0
        self.n_total_pass = 0


# pylint: disable=too-few-public-methods
class TestVariablesToShare:
    """Test variables to share"""
    def __init__(self):
        self.multi_session_test = False
        self.out_filename = ""


# pylint: disable=too-many-instance-attributes
class TestCategory:
    """Test category"""
    def __init__(self):
        self.surface_component = ""
        self.surface_type = ""
        self.mode = ""
        self.category = ""
        self.case = ""

        self.n_failed = 0
        self.n_pass = 0
        self.n_testcase = 0

    def init_values(self):
        """Init values"""
        self.surface_component = ""
        self.surface_type = ""
        self.mode = ""
        self.category = ""
        self.case = ""

        self.n_failed = 0
        self.n_pass = 0
        self.n_testcase = 0

    def get_category_cli_options(self):
        """Build command line and return it"""
        cmd = []
        if self.surface_component:
            cmd.extend(["-surface_component", self.surface_component])
        if self.surface_type:
            cmd.extend(["-surface_type", self.surface_type])
        if self.mode:
            cmd.extend(["-mode", self.mode])

        return cmd

    def get_category_name(self):
        """Return category name"""
        return self.category

    def set_category(self,
                     surface_component: SurfaceComponent,
                     surface_type: SurfaceType = None,
                     mode: Mode = None):
        """Set test category"""
        self.init_values()

        self.category = self.surface_component = (surface_component).value

        if surface_type:
            self.surface_type = (surface_type).value
            self.category += ", " + self.surface_type
        else:
            self.surface_type = ""

        if mode:
            self.mode = (mode).value
            self.category += ", " + self.mode
        else:
            self.mode = ""

    def report_result(self, test_stats: TestStats):
        """Summary test result of this category"""
        self.n_testcase = self.n_failed + self.n_pass

        # this is not related to password at all but means "test passed"
        pass_or_fail = "PASS"  # nosec
        if self.n_failed:
            pass_or_fail = "FAILED"  # nosec

        result_detail = '  ' + str(self.n_testcase) + " tests, " + str(
            self.n_pass) + " passed, " + str(self.n_failed) + " failed"

        out_space = ' ' * 74
        left_space = len(out_space) - len(
            self.category) - len(pass_or_fail) - 4
        result = '  ' + self.category + ' ' * left_space + pass_or_fail

        print(result)
        print(result_detail)
        print(
            "=========================================================================="
        )

        test_stats.n_total_testcase += self.n_testcase
        test_stats.n_total_failed += self.n_failed
        test_stats.n_total_pass += self.n_pass


# global declarations

# test information
TC = TestCategory()
# test statistics
TS = TestStats()
# test variables to share
TV = TestVariablesToShare()

VPL_EXAMPLES_PATH = os.environ.get('VPL_EXAMPLES_PATH')
if VPL_EXAMPLES_PATH:
    INPUT_CONTENT = f"{VPL_EXAMPLES_PATH}/content"
    VAL_APP = r"val-surface-sharing"
    print(INPUT_CONTENT)
else:
    raise SystemExit("environment is not ready!")


def display_adapters():
    """Display available adapters information"""
    # build command
    cmd = [VAL_APP, "-adapters"]

    print("\n[Command] " + ' '.join(cmd) + "\n")

    with subprocess.Popen(cmd, shell=False) as proc:  # nosec
        proc.communicate()
        if proc.returncode != 0:
            raise RuntimeError("Error running command: " + cmd)
        return proc.returncode


# pylint: disable=invalid-name,too-many-arguments,too-many-positional-arguments
def run_test(c=None,
             i=None,
             o=None,
             sw=None,
             sh=None,
             sc=None,
             dw=None,
             dh=None,
             dc=None,
             multi_session=False):
    """Compose a test command line and execute it"""
    # init
    TV.multi_session_test = False
    TV.out_filename = ""
    TC.case = ""

    # build command
    cmd = [VAL_APP]

    # get composed the command line for surface component, surface type, mode
    cmd.extend(TC.get_category_cli_options())
    TC.case += TC.get_category_name()

    # set from function arguments
    if c:
        cmd.extend(["-c", c])
        TC.case += "/" + c
    if i:
        cmd.extend(["-i", f"{INPUT_CONTENT}/{i}"])
    if o:
        cmd.extend(["-o", o])
        TV.out_filename = o
    if sw and sw and sc:
        cmd.extend(["-sw", str(sw), "-sh", str(sh), "-sc", sc])
        TC.case += "/" + str(sw) + "x" + str(sh) + "," + sc
    if dw and dw and dc:
        cmd.extend(["-dw", str(dw), "-dh", str(dh), "-dc", dc])
        TC.case += "->" + str(dw) + "x" + str(dh) + "," + dc
    if multi_session:
        cmd.extend(["-multi_session"])
        TV.multi_session_test = True
        TC.case += "/" + "multi_session"

    print("\n[Command] " + ' '.join(cmd) + "\n")

    with subprocess.Popen(cmd, shell=False) as proc:  # nosec
        proc.communicate()
        return proc.returncode


def print_result(pass_or_fail):
    """Print result"""
    out_space = ' ' * 74
    left_space = len(out_space) - len(TC.case) - len(pass_or_fail) - 4
    result = '  ' + TC.case + ' ' * left_space + pass_or_fail
    print(
        "--------------------------------------------------------------------------"
    )
    print(result)
    print(
        "--------------------------------------------------------------------------"
    )


def check_output_multi_session(ref):
    """Compare the output contents from mult-session test with the reference content"""
    if not os.path.exists(ref) or os.path.getsize(ref) == 0:
        print("\n  Error: check_output_multi_session(): " + ref +
              " does not exist or size is 0")
        return False

    # there'll be always 2 output files at least with {filename}.1, 2 .. {filename}.n
    # but, it's enough to check only 1st and 2nd
    for i in range(2):
        m_out_filename = f"{TV.out_filename}.{i+1}"

        if not os.path.exists(m_out_filename) or os.path.getsize(
                m_out_filename) == 0:
            print("\n  Error: check_output_multi_session(): " +
                  m_out_filename + " does not exist or size is 0")
            return False

        block_size = 100 * 1024
        with open(ref, "rb") as fref, open(m_out_filename, "rb") as fout:
            while True:
                block_ref = fref.read(block_size)
                block_out = fout.read(block_size)
                if block_ref != block_out:
                    print(
                        "\n  Error: check_output_multi_session(): outputs are different!!"
                    )
                    return False
                if not block_ref and not block_out:
                    return True


def check_output(ref):
    """Compare the output content from the regular test with the reference content"""
    if not os.path.exists(ref) or os.path.getsize(ref) == 0:
        print("\n  Error: check_output(): " + ref +
              " does not exist or size is 0")
        return False

    if not os.path.exists(TV.out_filename) or os.path.getsize(
            TV.out_filename) == 0:
        print("\n  Error: check_output(): " + TV.out_filename +
              " does not exist")
        return False

    block_size = 100 * 1024
    with open(ref, "rb") as fref, open(TV.out_filename, "rb") as fout:
        while True:
            block_ref = fref.read(block_size)
            block_out = fout.read(block_size)
            if block_ref != block_out:
                print("\n  Error: check_output(): outputs are different!!")
                return False
            if not block_ref and not block_out:
                return True


def handle_result(returncode, ref=None):
    """Handle result"""
    if returncode != 0:
        TC.n_failed += 1
        print_result("FAILED")
    else:
        if ref is None:
            TC.n_pass += 1
            print_result("PASS")
        else:
            res = False

            if TV.multi_session_test is True:
                res = check_output_multi_session(ref)
            else:
                res = check_output(ref)

            if res is False:
                print_result("FAILED")
                TC.n_failed += 1
            else:
                print_result("PASS")
                TC.n_pass += 1


def print_test(stest):
    """Print 'stest'"""
    print(
        "\n=========================================================================="
    )
    print(stest)
    print(
        "=========================================================================="
    )


def summary_final():
    """Summary final report"""
    test_final = "Surface Sharing API functional Validation Test"

    # this is not related to password at all but means "test passed"
    pass_or_fail = "PASS"  # nosec
    if TS.n_total_failed:
        pass_or_fail = "FAILED"  # nosec

    result_final = '  ' + str(TS.n_total_testcase) + " tests, " + str(
        TS.n_total_pass) + " passed, " + str(TS.n_total_failed) + " failed"

    out_space = ' ' * 74
    left_space = len(out_space) - len(test_final) - len(pass_or_fail) - 4
    result = '  ' + test_final + ' ' * left_space + pass_or_fail
    print('  ' + "Result Final:")
    print(result)
    print(result_final)
    print(
        "=========================================================================="
    )


def clean_up_outputs():
    """Clean up temporary output contents after each test"""
    files_to_delete = ["out.*", "ref_*"]
    files_found = [
        filename for pattern in files_to_delete
        for filename in glob.glob(pattern)
    ]
    if not files_found:
        print("No, 'out.*' or 'ref*' files found")
    else:
        for filename in files_found:
            try:
                os.remove(filename)
            # pylint: disable=broad-except
            except Exception as err_info:
                print(f"Error deleting {filename}: {err_info}")


# pylint: disable=too-many-statements
def run_surface_type_test(surface_type: SurfaceType):
    """List DX11 test cases and run"""
    print_test("[Test] Encode Component")

    TC.set_category(SurfaceComponent.ENCODE)

    # no surface sharing api
    # prepare reference stream to compare
    handle_result(
        run_test(c="h264",
                 i="cars_320x240.nv12",
                 sw=320,
                 sh=240,
                 sc="nv12",
                 o="ref_nv12.h264"))
    handle_result(
        run_test(c="h264",
                 i="cars_320x240.bgra",
                 sw=320,
                 sh=240,
                 sc="rgb4",
                 o="ref_rgb4.h264"))
    handle_result(
        run_test(c="h265",
                 i="cars_320x240.nv12",
                 sw=320,
                 sh=240,
                 sc="nv12",
                 o="ref_nv12.h265"))
    handle_result(
        run_test(c="h265",
                 i="cars_320x240.bgra",
                 sw=320,
                 sh=240,
                 sc="rgb4",
                 o="ref_rgb4.h265"))
    TC.report_result(TS)

    # disable opencl encode - import shared mode testing until gpu-rt supports
    if surface_type != SurfaceType.OPENCL_IMG2D:
        # run surface sharing test
        TC.set_category(SurfaceComponent.ENCODE, surface_type, Mode.SHARED)
        handle_result(run_test(c="h264",
                               i="cars_320x240.nv12",
                               sw=320,
                               sh=240,
                               sc="nv12",
                               o="out.h264"),
                      ref="ref_nv12.h264")
        handle_result(run_test(c="h264",
                               i="cars_320x240.bgra",
                               sw=320,
                               sh=240,
                               sc="rgb4",
                               o="out.h264"),
                      ref="ref_rgb4.h264")
        handle_result(run_test(c="h265",
                               i="cars_320x240.nv12",
                               sw=320,
                               sh=240,
                               sc="nv12",
                               o="out.h265"),
                      ref="ref_nv12.h265")
        handle_result(run_test(c="h265",
                               i="cars_320x240.bgra",
                               sw=320,
                               sh=240,
                               sc="rgb4",
                               o="out.h265"),
                      ref="ref_rgb4.h265")
        handle_result(run_test(c="h264",
                               i="cars_320x240.nv12",
                               sw=320,
                               sh=240,
                               sc="nv12",
                               o="out.h264",
                               multi_session=True),
                      ref="ref_nv12.h264")
        handle_result(run_test(c="h265",
                               i="cars_320x240.bgra",
                               sw=320,
                               sh=240,
                               sc="rgb4",
                               o="out.h265",
                               multi_session=True),
                      ref="ref_rgb4.h265")
        TC.report_result(TS)

    TC.set_category(SurfaceComponent.ENCODE, surface_type, Mode.COPY)
    handle_result(run_test(c="h264",
                           i="cars_320x240.nv12",
                           sw=320,
                           sh=240,
                           sc="nv12",
                           o="out.h264"),
                  ref="ref_nv12.h264")
    handle_result(run_test(c="h264",
                           i="cars_320x240.bgra",
                           sw=320,
                           sh=240,
                           sc="rgb4",
                           o="out.h264"),
                  ref="ref_rgb4.h264")
    handle_result(run_test(c="h265",
                           i="cars_320x240.nv12",
                           sw=320,
                           sh=240,
                           sc="nv12",
                           o="out.h265"),
                  ref="ref_nv12.h265")
    handle_result(run_test(c="h265",
                           i="cars_320x240.bgra",
                           sw=320,
                           sh=240,
                           sc="rgb4",
                           o="out.h265"),
                  ref="ref_rgb4.h265")
    handle_result(run_test(c="h264",
                           i="cars_320x240.nv12",
                           sw=320,
                           sh=240,
                           sc="nv12",
                           o="out.h264",
                           multi_session=True),
                  ref="ref_nv12.h264")
    handle_result(run_test(c="h265",
                           i="cars_320x240.bgra",
                           sw=320,
                           sh=240,
                           sc="rgb4",
                           o="out.h265",
                           multi_session=True),
                  ref="ref_rgb4.h265")
    TC.report_result(TS)
    clean_up_outputs()

    print_test("[Test] Decode Component")

    TC.set_category(SurfaceComponent.DECODE)

    # no surface sharing api
    # prepare reference stream to compare
    handle_result(run_test(c="h264", i="cars_320x240.h264", o="ref_h264.nv12"))
    handle_result(run_test(c="h265", i="cars_320x240.h265", o="ref_h265.nv12"))
    TC.report_result(TS)

    # run surface sharing test
    TC.set_category(SurfaceComponent.DECODE, surface_type, Mode.SHARED)
    handle_result(run_test(c="h264", i="cars_320x240.h264", o="out.nv12"),
                  ref="ref_h264.nv12")
    handle_result(run_test(c="h265", i="cars_320x240.h265", o="out.nv12"),
                  ref="ref_h265.nv12")
    handle_result(run_test(c="h264",
                           i="cars_320x240.h264",
                           o="out.nv12",
                           multi_session=True),
                  ref="ref_h264.nv12")
    TC.report_result(TS)

    TC.set_category(SurfaceComponent.DECODE, surface_type, Mode.COPY)
    handle_result(run_test(c="h264", i="cars_320x240.h264", o="out.nv12"),
                  ref="ref_h264.nv12")
    handle_result(run_test(c="h265", i="cars_320x240.h265", o="out.nv12"),
                  ref="ref_h265.nv12")
    handle_result(run_test(c="h265",
                           i="cars_320x240.h265",
                           o="out.nv12",
                           multi_session=True),
                  ref="ref_h265.nv12")
    TC.report_result(TS)
    clean_up_outputs()

    print_test("[Test] VPP In Component")

    TC.set_category(SurfaceComponent.VPP_INPUT)

    # no surface sharing api
    # prepare reference stream to compare
    handle_result(
        run_test(i="cars_320x240.nv12",
                 sw=320,
                 sh=240,
                 sc="nv12",
                 o="ref_nv12.bgra",
                 dw=352,
                 dh=288,
                 dc="rgb4"))
    handle_result(
        run_test(i="cars_320x240.bgra",
                 sw=320,
                 sh=240,
                 sc="rgb4",
                 o="ref_rgb4.nv12",
                 dw=352,
                 dh=288,
                 dc="nv12"))
    TC.report_result(TS)

    # disable opencl vpp_input - import shared mode testing until gpu-rt supports
    if surface_type != SurfaceType.OPENCL_IMG2D:
        # run surface sharing test
        TC.set_category(SurfaceComponent.VPP_INPUT, surface_type, Mode.SHARED)
        handle_result(run_test(i="cars_320x240.nv12",
                               sw=320,
                               sh=240,
                               sc="nv12",
                               o="out.bgra",
                               dw=352,
                               dh=288,
                               dc="rgb4"),
                      ref="ref_nv12.bgra")
        handle_result(run_test(i="cars_320x240.bgra",
                               sw=320,
                               sh=240,
                               sc="rgb4",
                               o="out.nv12",
                               dw=352,
                               dh=288,
                               dc="nv12"),
                      ref="ref_rgb4.nv12")
        handle_result(run_test(i="cars_320x240.nv12",
                               sw=320,
                               sh=240,
                               sc="nv12",
                               o="out.bgra",
                               dw=352,
                               dh=288,
                               dc="rgb4",
                               multi_session=True),
                      ref="ref_nv12.bgra")
        TC.report_result(TS)

    TC.set_category(SurfaceComponent.VPP_INPUT, surface_type, Mode.COPY)
    handle_result(run_test(i="cars_320x240.nv12",
                           sw=320,
                           sh=240,
                           sc="nv12",
                           o="out.bgra",
                           dw=352,
                           dh=288,
                           dc="rgb4"),
                  ref="ref_nv12.bgra")
    handle_result(run_test(i="cars_320x240.bgra",
                           sw=320,
                           sh=240,
                           sc="rgb4",
                           o="out.nv12",
                           dw=352,
                           dh=288,
                           dc="nv12"),
                  ref="ref_rgb4.nv12")
    handle_result(run_test(i="cars_320x240.bgra",
                           sw=320,
                           sh=240,
                           sc="rgb4",
                           o="out.nv12",
                           dw=352,
                           dh=288,
                           dc="nv12",
                           multi_session=True),
                  ref="ref_rgb4.nv12")
    TC.report_result(TS)
    clean_up_outputs()

    print_test("[Test] VPP Out Component")

    TC.set_category(SurfaceComponent.VPP_OUTPUT)

    # no surface sharing api
    # prepare reference stream to compare
    handle_result(
        run_test(i="cars_320x240.nv12",
                 sw=320,
                 sh=240,
                 sc="nv12",
                 o="ref_nv12.bgra",
                 dw=352,
                 dh=288,
                 dc="rgb4"))
    handle_result(
        run_test(i="cars_320x240.bgra",
                 sw=320,
                 sh=240,
                 sc="rgb4",
                 o="ref_rgb4.nv12",
                 dw=352,
                 dh=288,
                 dc="nv12"))
    TC.report_result(TS)

    # run surface sharing test
    TC.set_category(SurfaceComponent.VPP_OUTPUT, surface_type, Mode.SHARED)
    handle_result(run_test(i="cars_320x240.nv12",
                           sw=320,
                           sh=240,
                           sc="nv12",
                           o="out.bgra",
                           dw=352,
                           dh=288,
                           dc="rgb4"),
                  ref="ref_nv12.bgra")
    handle_result(run_test(i="cars_320x240.bgra",
                           sw=320,
                           sh=240,
                           sc="rgb4",
                           o="out.nv12",
                           dw=352,
                           dh=288,
                           dc="nv12"),
                  ref="ref_rgb4.nv12")
    handle_result(run_test(i="cars_320x240.nv12",
                           sw=320,
                           sh=240,
                           sc="nv12",
                           o="out.bgra",
                           dw=352,
                           dh=288,
                           dc="rgb4",
                           multi_session=True),
                  ref="ref_nv12.bgra")
    TC.report_result(TS)

    TC.set_category(SurfaceComponent.VPP_OUTPUT, surface_type, Mode.COPY)
    handle_result(run_test(i="cars_320x240.nv12",
                           sw=320,
                           sh=240,
                           sc="nv12",
                           o="out.bgra",
                           dw=352,
                           dh=288,
                           dc="rgb4"),
                  ref="ref_nv12.bgra")
    handle_result(run_test(i="cars_320x240.bgra",
                           sw=320,
                           sh=240,
                           sc="rgb4",
                           o="out.nv12",
                           dw=352,
                           dh=288,
                           dc="nv12"),
                  ref="ref_rgb4.nv12")
    handle_result(run_test(i="cars_320x240.bgra",
                           sw=320,
                           sh=240,
                           sc="rgb4",
                           o="out.nv12",
                           dw=352,
                           dh=288,
                           dc="nv12",
                           multi_session=True),
                  ref="ref_rgb4.nv12")
    TC.report_result(TS)
    clean_up_outputs()


def main():
    """Main"""
    print_test("[Info] Gen Adapters")
    display_adapters()

    if os.name == 'nt':
        # dx11 test
        run_surface_type_test(SurfaceType.D3D11_TEX2D)

        # opencl test
        run_surface_type_test(SurfaceType.OPENCL_IMG2D)
    else:
        # vaapi test
        run_surface_type_test(SurfaceType.VAAPI)

    # final report
    summary_final()


if __name__ == '__main__':
    main()