-
Notifications
You must be signed in to change notification settings - Fork 275
Expand file tree
/
Copy pathcyruntime.pxi
More file actions
1176 lines (1136 loc) · 86.1 KB
/
cyruntime.pxi
File metadata and controls
1176 lines (1136 loc) · 86.1 KB
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
# SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
# These graphics API are the reimplemented version of what's supported by CUDA Runtime.
# Issue https://github.com/NVIDIA/cuda-python/issues/488 will remove them by letting us
# use call into the static library directly.
# This file is included from cuda/bindings/_bindings/cyruntime.pyx.in but kept in a
# separate file to keep it separated from the auto-generated code there.
# Prior to https://github.com/NVIDIA/cuda-python/pull/914, this was two
# independent modules (c.b._lib.cyruntime.cyruntime and
# c.b._lib.cyruntime.utils), but was merged into one.
from libc.string cimport memset
cimport cuda.bindings._bindings.cydriver as cydriver
cdef cudaError_t _cudaEGLStreamProducerPresentFrame(cyruntime.cudaEglStreamConnection* conn, cyruntime.cudaEglFrame eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
cdef cydriver.CUeglFrame cueglFrame
err = getDriverEglFrame(&cueglFrame, eglframe)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuEGLStreamProducerPresentFrame(<cydriver.CUeglStreamConnection*>conn, cueglFrame, pStream)
return err
cdef cudaError_t _cudaEGLStreamProducerReturnFrame(cyruntime.cudaEglStreamConnection* conn, cyruntime.cudaEglFrame* eglframe, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
if eglframe == NULL:
err = cudaErrorInvalidResourceHandle
return err
cdef cydriver.CUeglFrame cueglFrame
err = <cudaError_t>cydriver._cuEGLStreamProducerReturnFrame(<cydriver.CUeglStreamConnection*>conn, &cueglFrame, pStream)
if err != cudaSuccess:
return err
err = getRuntimeEglFrame(eglframe, cueglFrame)
return err
cdef cudaError_t _cudaGraphicsResourceGetMappedEglFrame(cyruntime.cudaEglFrame* eglFrame, cudaGraphicsResource_t resource, unsigned int index, unsigned int mipLevel) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
cdef cydriver.CUeglFrame cueglFrame
memset(&cueglFrame, 0, sizeof(cueglFrame))
err = <cudaError_t>cydriver._cuGraphicsResourceGetMappedEglFrame(&cueglFrame, <cydriver.CUgraphicsResource>resource, index, mipLevel)
if err != cudaSuccess:
return err
err = getRuntimeEglFrame(eglFrame, cueglFrame)
return err
cdef cudaError_t _cudaVDPAUSetVDPAUDevice(int device, cyruntime.VdpDevice vdpDevice, cyruntime.VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil:
return cudaErrorNotSupported
cdef cudaError_t _cudaVDPAUGetDevice(int* device, cyruntime.VdpDevice vdpDevice, cyruntime.VdpGetProcAddress* vdpGetProcAddress) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuVDPAUGetDevice(<cydriver.CUdevice*>device, vdpDevice, vdpGetProcAddress)
return err
cdef cudaError_t _cudaGraphicsVDPAURegisterVideoSurface(cudaGraphicsResource** resource, cyruntime.VdpVideoSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuGraphicsVDPAURegisterVideoSurface(<cydriver.CUgraphicsResource*>resource, vdpSurface, flags)
return err
cdef cudaError_t _cudaGraphicsVDPAURegisterOutputSurface(cudaGraphicsResource** resource, cyruntime.VdpOutputSurface vdpSurface, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuGraphicsVDPAURegisterOutputSurface(<cydriver.CUgraphicsResource*>resource, vdpSurface, flags)
return err
cdef cudaError_t _cudaGLGetDevices(unsigned int* pCudaDeviceCount, int* pCudaDevices, unsigned int cudaDeviceCount, cyruntime.cudaGLDeviceList deviceList) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuGLGetDevices_v2(pCudaDeviceCount, <cydriver.CUdevice*>pCudaDevices, cudaDeviceCount, <cydriver.CUGLDeviceList>deviceList)
return err
cdef cudaError_t _cudaGraphicsGLRegisterImage(cudaGraphicsResource** resource, cyruntime.GLuint image, cyruntime.GLenum target, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuGraphicsGLRegisterImage(<cydriver.CUgraphicsResource*>resource, image, target, flags)
return err
cdef cudaError_t _cudaGraphicsGLRegisterBuffer(cudaGraphicsResource** resource, cyruntime.GLuint buffer, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuGraphicsGLRegisterBuffer(<cydriver.CUgraphicsResource*>resource, buffer, flags)
return err
cdef cudaError_t _cudaGraphicsEGLRegisterImage(cudaGraphicsResource_t* pCudaResource, cyruntime.EGLImageKHR image, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuGraphicsEGLRegisterImage(<cydriver.CUgraphicsResource*>pCudaResource, image, flags)
return err
cdef cudaError_t _cudaEGLStreamConsumerConnect(cyruntime.cudaEglStreamConnection* conn, cyruntime.EGLStreamKHR eglStream) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuEGLStreamConsumerConnect(<cydriver.CUeglStreamConnection*>conn, eglStream)
return err
cdef cudaError_t _cudaEGLStreamConsumerConnectWithFlags(cyruntime.cudaEglStreamConnection* conn, cyruntime.EGLStreamKHR eglStream, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuEGLStreamConsumerConnectWithFlags(<cydriver.CUeglStreamConnection*>conn, eglStream, flags)
return err
cdef cudaError_t _cudaEGLStreamConsumerDisconnect(cyruntime.cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuEGLStreamConsumerDisconnect(<cydriver.CUeglStreamConnection*>conn)
return err
cdef cudaError_t _cudaEGLStreamConsumerAcquireFrame(cyruntime.cudaEglStreamConnection* conn, cudaGraphicsResource_t* pCudaResource, cudaStream_t* pStream, unsigned int timeout) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuEGLStreamConsumerAcquireFrame(<cydriver.CUeglStreamConnection*>conn, <cydriver.CUgraphicsResource*>pCudaResource, <cydriver.CUstream*>pStream, timeout)
return err
cdef cudaError_t _cudaEGLStreamConsumerReleaseFrame(cyruntime.cudaEglStreamConnection* conn, cudaGraphicsResource_t pCudaResource, cudaStream_t* pStream) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuEGLStreamConsumerReleaseFrame(<cydriver.CUeglStreamConnection*>conn, <cydriver.CUgraphicsResource>pCudaResource, <cydriver.CUstream*>pStream)
return err
cdef cudaError_t _cudaEGLStreamProducerConnect(cyruntime.cudaEglStreamConnection* conn, cyruntime.EGLStreamKHR eglStream, cyruntime.EGLint width, cyruntime.EGLint height) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuEGLStreamProducerConnect(<cydriver.CUeglStreamConnection*>conn, eglStream, width, height)
return err
cdef cudaError_t _cudaEGLStreamProducerDisconnect(cyruntime.cudaEglStreamConnection* conn) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuEGLStreamProducerDisconnect(<cydriver.CUeglStreamConnection*>conn)
return err
cdef cudaError_t _cudaEventCreateFromEGLSync(cudaEvent_t* phEvent, cyruntime.EGLSyncKHR eglSync, unsigned int flags) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
# cudaFree(0) is a NOP operations that initializes the context state
err = cudaFree(<void*>0)
if err != cudaSuccess:
return err
err = <cudaError_t>cydriver._cuEventCreateFromEGLSync(<cydriver.CUevent*>phEvent, eglSync, flags)
return err
## utility functions
cdef int case_desc(const cudaChannelFormatDesc* d, int x, int y, int z, int w, int f) except ?cudaErrorCallRequiresNewerDriver nogil:
return d[0].x == x and d[0].y == y and d[0].z == z and d[0].w == w and d[0].f == f
cdef cudaError_t getDescInfo(const cudaChannelFormatDesc* d, int *numberOfChannels, cydriver.CUarray_format *format) except ?cudaErrorCallRequiresNewerDriver nogil:
# Check validity
if d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindSigned,
cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
if (d[0].x != 8) and (d[0].x != 16) and (d[0].x != 32):
return cudaErrorInvalidChannelDescriptor
elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindFloat,):
if (d[0].x != 16) and (d[0].x != 32):
return cudaErrorInvalidChannelDescriptor
elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindNV12,):
if (d[0].x != 8) or (d[0].y != 8) or (d[0].z != 8) or (d[0].w != 0):
return cudaErrorInvalidChannelDescriptor
elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1,
cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2,
cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4,):
if (d[0].x != 8):
return cudaErrorInvalidChannelDescriptor
elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1,
cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2,
cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4,):
if (d[0].x != 16):
return cudaErrorInvalidChannelDescriptor
elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4,
cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5,
cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB,):
if (d[0].x != 8):
return cudaErrorInvalidChannelDescriptor
elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H,
cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H,):
if (d[0].x != 16) or (d[0].y != 16) or (d[0].z != 16) or (d[0].w != 0):
return cudaErrorInvalidChannelDescriptor
elif d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102,):
if (d[0].x != 10) or (d[0].y != 10) or (d[0].z != 10) or (d[0].w != 2):
return cudaErrorInvalidChannelDescriptor
else:
return cudaErrorInvalidChannelDescriptor
# If Y is non-zero, it must match X
# If Z is non-zero, it must match Y
# If W is non-zero, it must match Z
if (((d[0].y != 0) and (d[0].y != d[0].x)) or
((d[0].z != 0) and (d[0].z != d[0].y)) or
((d[0].w != 0) and (d[0].w != d[0].z))):
if d[0].f != cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102:
return cudaErrorInvalidChannelDescriptor
if case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 1
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8
elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 2
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8
elif case_desc(d, 8, 8, 8, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8
elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT8
elif case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 1
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8
elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 2
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8
elif case_desc(d, 8, 8, 8, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8
elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT8
elif case_desc(d, 16, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 1
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16
elif case_desc(d, 16, 16, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 2
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16
elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16
elif case_desc(d, 16, 16, 16, 16, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT16
elif case_desc(d, 16, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 1
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16
elif case_desc(d, 16, 16, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 2
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16
elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16
elif case_desc(d, 16, 16, 16, 16, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT16
elif case_desc(d, 32, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 1
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32
elif case_desc(d, 32, 32, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 2
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32
elif case_desc(d, 32, 32, 32, 0, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32
elif case_desc(d, 32, 32, 32, 32, cudaChannelFormatKind.cudaChannelFormatKindSigned):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_SIGNED_INT32
elif case_desc(d, 32, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 1
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32
elif case_desc(d, 32, 32, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 2
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32
elif case_desc(d, 32, 32, 32, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32
elif case_desc(d, 32, 32, 32, 32, cudaChannelFormatKind.cudaChannelFormatKindUnsigned):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNSIGNED_INT32
elif case_desc(d, 16, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat):
numberOfChannels[0] = 1
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_HALF
elif case_desc(d, 16, 16, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat):
numberOfChannels[0] = 2
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_HALF
elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_HALF
elif case_desc(d, 16, 16, 16, 16, cudaChannelFormatKind.cudaChannelFormatKindFloat):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_HALF
elif case_desc(d, 32, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat):
numberOfChannels[0] = 1
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_FLOAT
elif case_desc(d, 32, 32, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat):
numberOfChannels[0] = 2
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_FLOAT
elif case_desc(d, 32, 32, 32, 0, cudaChannelFormatKind.cudaChannelFormatKindFloat):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_FLOAT
elif case_desc(d, 32, 32, 32, 32, cudaChannelFormatKind.cudaChannelFormatKindFloat):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_FLOAT
elif case_desc(d, 8, 8, 8, 0, cudaChannelFormatKind.cudaChannelFormatKindNV12):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_NV12
elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC1_UNORM
elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC1_UNORM_SRGB
elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC2_UNORM
elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC2_UNORM_SRGB
elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC3_UNORM
elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC3_UNORM_SRGB
elif case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4):
numberOfChannels[0] = 1
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC4_UNORM
elif case_desc(d, 8, 0, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4):
numberOfChannels[0] = 1
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC4_SNORM
elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5):
numberOfChannels[0] = 2
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC5_UNORM
elif case_desc(d, 8, 8, 0, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5):
numberOfChannels[0] = 2
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC5_SNORM
elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC6H_UF16
elif case_desc(d, 16, 16, 16, 0, cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H):
numberOfChannels[0] = 3
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC6H_SF16
elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM
elif case_desc(d, 8, 8, 8, 8, cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_BC7_UNORM_SRGB
elif case_desc(d, 10, 10, 10, 2, cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102):
numberOfChannels[0] = 4
format[0] = cydriver.CUarray_format_enum.CU_AD_FORMAT_UNORM_INT_101010_2
else:
return cudaErrorInvalidChannelDescriptor
if d[0].f in (cudaChannelFormatKind.cudaChannelFormatKindNV12,
cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H,
cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H,):
if numberOfChannels[0] != 3:
return cudaErrorInvalidChannelDescriptor
else:
if (numberOfChannels[0] != 1) and (numberOfChannels[0] != 2) and (numberOfChannels[0] != 4):
return cudaErrorInvalidChannelDescriptor
return cudaSuccess
cdef cudaError_t getChannelFormatDescFromDriverDesc(cudaChannelFormatDesc* pRuntimeDesc, size_t* pDepth, size_t* pHeight, size_t* pWidth, const cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2* pDriverDesc) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef int channel_size = 0
if pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT8:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT16:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNSIGNED_INT32:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsigned
channel_size = 32
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT8:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT16:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SIGNED_INT32:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSigned
channel_size = 32
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_HALF:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindFloat
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_FLOAT:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindFloat
channel_size = 32
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_NV12:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindNV12
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X1:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X1
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X2:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X2
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT8X4:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized8X4
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X1:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X1
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X2:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X2
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT8X4:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized8X4
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X1:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X1
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X2:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X2
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT16X4:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized16X4
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X1:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X1
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X2:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X2
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_SNORM_INT16X4:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedNormalized16X4
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC1_UNORM:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC1_UNORM_SRGB:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed1SRGB
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC2_UNORM:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC2_UNORM_SRGB:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed2SRGB
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC3_UNORM:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC3_UNORM_SRGB:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed3SRGB
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC4_UNORM:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed4
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC4_SNORM:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed4
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC5_UNORM:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed5
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC5_SNORM:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed5
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC6H_UF16:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed6H
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC6H_SF16:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindSignedBlockCompressed6H
channel_size = 16
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC7_UNORM:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_BC7_UNORM_SRGB:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedBlockCompressed7SRGB
channel_size = 8
elif pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT_101010_2:
pRuntimeDesc[0].f = cudaChannelFormatKind.cudaChannelFormatKindUnsignedNormalized1010102
else:
return cudaErrorInvalidChannelDescriptor
# populate bits per channel
pRuntimeDesc[0].x = 0
pRuntimeDesc[0].y = 0
pRuntimeDesc[0].z = 0
pRuntimeDesc[0].w = 0
if pDriverDesc[0].Format == cydriver.CU_AD_FORMAT_UNORM_INT_101010_2 and pDriverDesc[0].NumChannels == 4:
pRuntimeDesc[0].w = 2
pRuntimeDesc[0].z = 10
pRuntimeDesc[0].y = 10
pRuntimeDesc[0].x = 10
else:
if pDriverDesc[0].NumChannels >= 4:
pRuntimeDesc[0].w = channel_size
if pDriverDesc[0].NumChannels >= 3:
pRuntimeDesc[0].z = channel_size
if pDriverDesc[0].NumChannels >= 2:
pRuntimeDesc[0].y = channel_size
if pDriverDesc[0].NumChannels >= 1:
pRuntimeDesc[0].x = channel_size
if pDriverDesc[0].NumChannels not in (4, 3, 2, 1):
return cudaErrorInvalidChannelDescriptor
# populate dimensions
if pDepth != NULL:
pDepth[0] = pDriverDesc[0].Depth
if pHeight != NULL:
pHeight[0] = pDriverDesc[0].Height
if pWidth != NULL:
pWidth[0] = pDriverDesc[0].Width
return cudaSuccess
cdef cudaError_t getDriverEglFrame(cydriver.CUeglFrame *cuEglFrame, cyruntime.cudaEglFrame eglFrame) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
cdef unsigned int i = 0
err = getDescInfo(&eglFrame.planeDesc[0].channelDesc, <int*>&cuEglFrame[0].numChannels, &cuEglFrame[0].cuFormat)
if err != cudaSuccess:
return err
for i in range(eglFrame.planeCount):
if eglFrame.frameType == cyruntime.cudaEglFrameTypeArray:
cuEglFrame[0].frame.pArray[i] = <cydriver.CUarray>eglFrame.frame.pArray[i]
else:
cuEglFrame[0].frame.pPitch[i] = eglFrame.frame.pPitch[i].ptr
cuEglFrame[0].width = eglFrame.planeDesc[0].width
cuEglFrame[0].height = eglFrame.planeDesc[0].height
cuEglFrame[0].depth = eglFrame.planeDesc[0].depth
cuEglFrame[0].pitch = eglFrame.planeDesc[0].pitch
cuEglFrame[0].planeCount = eglFrame.planeCount
if eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV420Planar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV420SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV422Planar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV422SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV444Planar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV444SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUYV422:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_422
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatUYVY422:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_422
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatUYVY709:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_709
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatUYVY709_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_709_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatUYVY2020:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_2020
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatARGB:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ARGB
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatRGBA:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RGBA
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatABGR:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ABGR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBGRA:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BGRA
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatL:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_L
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatR:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_R
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatA:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_A
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatRG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatAYUV:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU444SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU422SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU420SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_444SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_420SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY12V12U12_444SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY12V12U12_420SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatVYUY_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatUYVY_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUYV_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVYU_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUVA_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatAYUV_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV444Planar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV422Planar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV420Planar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV444SemiPlanar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV422SemiPlanar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV420SemiPlanar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU444Planar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU422Planar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU420Planar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU444SemiPlanar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU422SemiPlanar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU420SemiPlanar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerRGGB:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RGGB
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerBGGR:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BGGR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerGRBG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GRBG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerGBRG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_GBRG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer10RGGB:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_RGGB
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer10BGGR:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_BGGR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer10GRBG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GRBG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer10GBRG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_GBRG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer12RGGB:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RGGB
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer12BGGR:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BGGR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer12GRBG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GRBG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer12GBRG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_GBRG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer14RGGB:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_RGGB
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer14BGGR:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_BGGR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer14GRBG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GRBG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer14GBRG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER14_GBRG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer20RGGB:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_RGGB
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer20BGGR:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_BGGR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer20GRBG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GRBG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer20GBRG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER20_GBRG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerIspRGGB:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_RGGB
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerIspBGGR:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_BGGR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerIspGRBG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GRBG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerIspGBRG:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_ISP_GBRG
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU444Planar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU422Planar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU420Planar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerBCCR:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_BCCR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerRCCB:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_RCCB
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerCRBC:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CRBC
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayerCBRC:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER_CBRC
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer10CCCC:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER10_CCCC
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer12BCCR:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_BCCR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer12RCCB:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_RCCB
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer12CRBC:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CRBC
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer12CBRC:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CBRC
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatBayer12CCCC:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BAYER12_CCCC
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV420SemiPlanar_2020:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU420SemiPlanar_2020:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV420Planar_2020:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU420Planar_2020:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV420SemiPlanar_709:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU420SemiPlanar_709:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUV420Planar_709:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVU420Planar_709:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_420SemiPlanar_709:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_420SemiPlanar_2020:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_422SemiPlanar_2020:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_422SemiPlanar:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_422SemiPlanar_709:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY_709_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y_709_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10_709_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10_709_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY12_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY12_709_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12_709_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYUVA:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUVA
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatYVYU:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVYU
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatVYUY:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_420SemiPlanar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_420SemiPlanar_709_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_444SemiPlanar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY10V10U10_444SemiPlanar_709_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY12V12U12_420SemiPlanar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY12V12U12_420SemiPlanar_709_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY12V12U12_444SemiPlanar_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER
elif eglFrame.eglColorFormat == cyruntime.cudaEglColorFormatY12V12U12_444SemiPlanar_709_ER:
cuEglFrame[0].eglColorFormat = cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER
else:
return cudaErrorInvalidValue
if eglFrame.frameType == cyruntime.cudaEglFrameTypeArray:
cuEglFrame[0].frameType = cydriver.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_ARRAY
elif eglFrame.frameType == cyruntime.cudaEglFrameTypePitch:
cuEglFrame[0].frameType = cydriver.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_PITCH
else:
return cudaErrorInvalidValue
@cython.show_performance_hints(False)
cdef cudaError_t getRuntimeEglFrame(cyruntime.cudaEglFrame *eglFrame, cydriver.CUeglFrame cueglFrame) except ?cudaErrorCallRequiresNewerDriver nogil:
cdef cudaError_t err = cudaSuccess
cdef unsigned int i
cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_v2 ad
cdef cudaPitchedPtr pPtr
memset(eglFrame, 0, sizeof(eglFrame[0]))
memset(&ad, 0, sizeof(ad))
for i in range(cueglFrame.planeCount):
ad.Depth = cueglFrame.depth
ad.Flags = 0
ad.Format = cueglFrame.cuFormat
ad.Height = cueglFrame.height
ad.NumChannels = cueglFrame.numChannels
ad.Width = cueglFrame.width
err = getChannelFormatDescFromDriverDesc(&eglFrame[0].planeDesc[i].channelDesc, NULL, NULL, NULL, &ad)
if err != cudaSuccess:
return err
eglFrame[0].planeDesc[i].depth = cueglFrame.depth
eglFrame[0].planeDesc[i].numChannels = cueglFrame.numChannels
if i == 0:
eglFrame[0].planeDesc[i].width = cueglFrame.width
eglFrame[0].planeDesc[i].height = cueglFrame.height
eglFrame[0].planeDesc[i].pitch = cueglFrame.pitch
elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_2020 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_2020 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR_709 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_PLANAR_709):
eglFrame[0].planeDesc[i].width = <unsigned int>(cueglFrame.width / 2)
eglFrame[0].planeDesc[i].height = <unsigned int>(cueglFrame.height / 2)
eglFrame[0].planeDesc[i].pitch = <unsigned int>(cueglFrame.pitch / 2)
elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_2020 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_2020 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR_709 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR_709 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER):
eglFrame[0].planeDesc[i].width = <unsigned int>(cueglFrame.width / 2)
eglFrame[0].planeDesc[i].height = <unsigned int>(cueglFrame.height / 2)
eglFrame[0].planeDesc[i].pitch = <unsigned int>(cueglFrame.pitch / 2)
eglFrame[0].planeDesc[1].channelDesc.y = 8
if (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_2020 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR_709_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR_709_ER):
eglFrame[0].planeDesc[1].channelDesc.y = 16
elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_PLANAR_ER):
eglFrame[0].planeDesc[i].height = cueglFrame.height
eglFrame[0].planeDesc[i].width = <unsigned int>(cueglFrame.width / 2)
eglFrame[0].planeDesc[i].pitch = <unsigned int>(cueglFrame.pitch / 2)
elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709):
eglFrame[0].planeDesc[i].width = <unsigned int>(cueglFrame.width / 2)
eglFrame[0].planeDesc[i].height = cueglFrame.height
eglFrame[0].planeDesc[i].pitch = <unsigned int>(cueglFrame.pitch / 2)
eglFrame[0].planeDesc[1].channelDesc.y = 8
if (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_2020 or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_422_SEMIPLANAR_709):
eglFrame[0].planeDesc[1].channelDesc.y = 16
elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_PLANAR_ER):
eglFrame[0].planeDesc[i].height = cueglFrame.height
eglFrame[0].planeDesc[i].width = cueglFrame.width
eglFrame[0].planeDesc[i].pitch = cueglFrame.pitch
elif (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER):
eglFrame[0].planeDesc[i].height = cueglFrame.height
eglFrame[0].planeDesc[i].width = cueglFrame.width
eglFrame[0].planeDesc[i].pitch = cueglFrame.pitch
eglFrame[0].planeDesc[1].channelDesc.y = 8
if (cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR_709_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_ER or
cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR_709_ER):
eglFrame[0].planeDesc[1].channelDesc.y = 16
if cueglFrame.frameType == cydriver.CUeglFrameType_enum.CU_EGL_FRAME_TYPE_ARRAY:
eglFrame[0].frame.pArray[i] = <cudaArray_t>cueglFrame.frame.pArray[i]
else:
pPtr = make_cudaPitchedPtr(cueglFrame.frame.pPitch[i], eglFrame[0].planeDesc[i].pitch,
eglFrame[0].planeDesc[i].width, eglFrame[0].planeDesc[i].height)
eglFrame[0].frame.pPitch[i] = pPtr
eglFrame[0].planeCount = cueglFrame.planeCount
if cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_PLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatYUV420Planar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatYUV420SemiPlanar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_PLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatYUV422Planar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV422_SEMIPLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatYUV422SemiPlanar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_PLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatYUV444Planar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUV444_SEMIPLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatYUV444SemiPlanar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YUYV_422:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatYUYV422
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_422:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatUYVY422
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_709:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatUYVY709
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_709_ER:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatUYVY709_ER
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_2020:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatUYVY2020
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ARGB:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatARGB
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RGBA:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatRGBA
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_ABGR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatABGR
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_BGRA:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatBGRA
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_L:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatL
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_R:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatR
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_A:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatA
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_RG:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatRG
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_AYUV:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatAYUV
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU444_SEMIPLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatYVU444SemiPlanar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU422_SEMIPLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatYVU422SemiPlanar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatYVU420SemiPlanar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_444_SEMIPLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatY10V10U10_444SemiPlanar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatY10V10U10_420SemiPlanar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_444_SEMIPLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatY12V12U12_444SemiPlanar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatY12V12U12_420SemiPlanar
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_VYUY_ER:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatVYUY_ER
elif cueglFrame.eglColorFormat == cydriver.CUeglColorFormat_enum.CU_EGL_COLOR_FORMAT_UYVY_ER:
eglFrame[0].eglColorFormat = cyruntime.cudaEglColorFormatUYVY_ER