Skip to content
Snippets Groups Projects
nvEncodeAPI.h 175 KiB
Newer Older
  • Learn to ignore specific revisions
  • 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
    /*
     * This copyright notice applies to this header file only:
     *
     * Copyright (c) 2010-2015 NVIDIA Corporation
     *
     * Permission is hereby granted, free of charge, to any person
     * obtaining a copy of this software and associated documentation
     * files (the "Software"), to deal in the Software without
     * restriction, including without limitation the rights to use,
     * copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the software, and to permit persons to whom the
     * software is furnished to do so, subject to the following
     * conditions:
     *
     * The above copyright notice and this permission notice shall be
     * included in all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
     * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
     * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     * OTHER DEALINGS IN THE SOFTWARE.
     */
    
    /**
     * \file nvEncodeAPI.h
     *   NvEncodeAPI provides a NVENC Video Encoding interface to NVIDIA GPU devices based on the Kepler architecture.
     * \date 2011-2016
     *  This file contains the interface constants, structure definitions and function prototypes.
     */
    
    #ifndef _NV_ENCODEAPI_H_
    #define _NV_ENCODEAPI_H_
    
    #include <stdlib.h>
    
    #ifdef _WIN32
    #include <windows.h>
    #endif
    
    #ifdef _MSC_VER
    #ifndef _STDINT
    typedef __int32 int32_t;
    typedef unsigned __int32 uint32_t;
    typedef __int64 int64_t;
    typedef unsigned __int64 uint64_t;
    typedef signed char int8_t;
    typedef unsigned char uint8_t;
    typedef short int16_t;
    typedef unsigned short uint16_t;
    #endif
    #else
    #include <stdint.h>
    #endif
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    /**
     * \addtogroup ENCODER_STRUCTURE NvEncodeAPI Data structures
     * @{
     */
    
    #if defined(_WIN32) || defined(__CYGWIN__)
    #define NVENCAPI __stdcall
    #else
    #define NVENCAPI
    #endif
    
    #ifdef _WIN32
    typedef RECT NVENC_RECT;
    #else
    // =========================================================================================
    #ifndef GUID
    /*!
     * \struct GUID
     * Abstracts the GUID structure for non-windows platforms.
     */
    // =========================================================================================
    typedef struct
    {
        uint32_t Data1;                                      /**< [in]: Specifies the first 8 hexadecimal digits of the GUID.                                */
        uint16_t Data2;                                      /**< [in]: Specifies the first group of 4 hexadecimal digits.                                   */
        uint16_t Data3;                                      /**< [in]: Specifies the second group of 4 hexadecimal digits.                                  */
        uint8_t  Data4[8];                                   /**< [in]: Array of 8 bytes. The first 2 bytes contain the third group of 4 hexadecimal digits.
                                                                        The remaining 6 bytes contain the final 12 hexadecimal digits.                       */
    } GUID;
    #endif // GUID
    
    /**
     * \struct _NVENC_RECT
     * Defines a Rectangle. Used in ::NV_ENC_PREPROCESS_FRAME.
     */
    typedef struct _NVENC_RECT
    {
        uint32_t left;                                        /**< [in]: X coordinate of the upper left corner of rectangular area to be specified.       */
        uint32_t top;                                         /**< [in]: Y coordinate of the upper left corner of the rectangular area to be specified.   */
        uint32_t right;                                       /**< [in]: X coordinate of the bottom right corner of the rectangular area to be specified. */
        uint32_t bottom;                                      /**< [in]: Y coordinate of the bottom right corner of the rectangular area to be specified. */
    } NVENC_RECT;
    
    #endif // _WIN32
    
    /** @} */ /* End of GUID and NVENC_RECT structure grouping*/
    
    typedef void* NV_ENC_INPUT_PTR;             /**< NVENCODE API input buffer                              */
    typedef void* NV_ENC_OUTPUT_PTR;            /**< NVENCODE API output buffer*/
    typedef void* NV_ENC_REGISTERED_PTR;        /**< A Resource that has been registered with NVENCODE API*/
    
    #define NVENCAPI_MAJOR_VERSION 7
    #define NVENCAPI_MINOR_VERSION 0
    
    #define NVENCAPI_VERSION (NVENCAPI_MAJOR_VERSION | (NVENCAPI_MINOR_VERSION << 24))
    
    /**
     * Macro to generate per-structure version for use with API.
     */
    #define NVENCAPI_STRUCT_VERSION(ver) ((uint32_t)NVENCAPI_VERSION | ((ver)<<16) | (0x7 << 28))
    
    
    #define NVENC_INFINITE_GOPLENGTH  0xffffffff
    
    #define NV_MAX_SEQ_HDR_LEN  (512)
    
    // =========================================================================================
    // Encode Codec GUIDS supported by the NvEncodeAPI interface.
    // =========================================================================================
    
    // {6BC82762-4E63-4ca4-AA85-1E50F321F6BF}
    static const GUID NV_ENC_CODEC_H264_GUID =
    { 0x6bc82762, 0x4e63, 0x4ca4, { 0xaa, 0x85, 0x1e, 0x50, 0xf3, 0x21, 0xf6, 0xbf } };
    
    // {790CDC88-4522-4d7b-9425-BDA9975F7603}
    static const GUID NV_ENC_CODEC_HEVC_GUID =
    { 0x790cdc88, 0x4522, 0x4d7b, { 0x94, 0x25, 0xbd, 0xa9, 0x97, 0x5f, 0x76, 0x3 } };
    
    
    
    // =========================================================================================
    // *   Encode Profile GUIDS supported by the NvEncodeAPI interface.
    // =========================================================================================
    
    // {BFD6F8E7-233C-4341-8B3E-4818523803F4}
    static const GUID NV_ENC_CODEC_PROFILE_AUTOSELECT_GUID =
    { 0xbfd6f8e7, 0x233c, 0x4341, { 0x8b, 0x3e, 0x48, 0x18, 0x52, 0x38, 0x3, 0xf4 } };
    
    // {0727BCAA-78C4-4c83-8C2F-EF3DFF267C6A}
    static const GUID  NV_ENC_H264_PROFILE_BASELINE_GUID =
    { 0x727bcaa, 0x78c4, 0x4c83, { 0x8c, 0x2f, 0xef, 0x3d, 0xff, 0x26, 0x7c, 0x6a } };
    
    // {60B5C1D4-67FE-4790-94D5-C4726D7B6E6D}
    static const GUID  NV_ENC_H264_PROFILE_MAIN_GUID =
    { 0x60b5c1d4, 0x67fe, 0x4790, { 0x94, 0xd5, 0xc4, 0x72, 0x6d, 0x7b, 0x6e, 0x6d } };
    
    // {E7CBC309-4F7A-4b89-AF2A-D537C92BE310}
    static const GUID NV_ENC_H264_PROFILE_HIGH_GUID =
    { 0xe7cbc309, 0x4f7a, 0x4b89, { 0xaf, 0x2a, 0xd5, 0x37, 0xc9, 0x2b, 0xe3, 0x10 } };
    
    // {7AC663CB-A598-4960-B844-339B261A7D52}
    static const GUID  NV_ENC_H264_PROFILE_HIGH_444_GUID =
    { 0x7ac663cb, 0xa598, 0x4960, { 0xb8, 0x44, 0x33, 0x9b, 0x26, 0x1a, 0x7d, 0x52 } };
    
    // {40847BF5-33F7-4601-9084-E8FE3C1DB8B7}
    static const GUID NV_ENC_H264_PROFILE_STEREO_GUID =
    { 0x40847bf5, 0x33f7, 0x4601, { 0x90, 0x84, 0xe8, 0xfe, 0x3c, 0x1d, 0xb8, 0xb7 } };
    
    // {CE788D20-AAA9-4318-92BB-AC7E858C8D36}
    static const GUID NV_ENC_H264_PROFILE_SVC_TEMPORAL_SCALABILTY =
    { 0xce788d20, 0xaaa9, 0x4318, { 0x92, 0xbb, 0xac, 0x7e, 0x85, 0x8c, 0x8d, 0x36 } };
    
    // {B405AFAC-F32B-417B-89C4-9ABEED3E5978}
    static const GUID NV_ENC_H264_PROFILE_PROGRESSIVE_HIGH_GUID =
    { 0xb405afac, 0xf32b, 0x417b, { 0x89, 0xc4, 0x9a, 0xbe, 0xed, 0x3e, 0x59, 0x78 } };
    
    // {AEC1BD87-E85B-48f2-84C3-98BCA6285072}
    static const GUID NV_ENC_H264_PROFILE_CONSTRAINED_HIGH_GUID =
    { 0xaec1bd87, 0xe85b, 0x48f2, { 0x84, 0xc3, 0x98, 0xbc, 0xa6, 0x28, 0x50, 0x72 } };
    
    // {B514C39A-B55B-40fa-878F-F1253B4DFDEC}
    static const GUID NV_ENC_HEVC_PROFILE_MAIN_GUID =
    { 0xb514c39a, 0xb55b, 0x40fa, { 0x87, 0x8f, 0xf1, 0x25, 0x3b, 0x4d, 0xfd, 0xec } };
    
    // {fa4d2b6c-3a5b-411a-8018-0a3f5e3c9be5}
    static const GUID NV_ENC_HEVC_PROFILE_MAIN10_GUID =
    { 0xfa4d2b6c, 0x3a5b, 0x411a, { 0x80, 0x18, 0x0a, 0x3f, 0x5e, 0x3c, 0x9b, 0xe5 } };
    
    // For HEVC Main 444 8 bit and HEVC Main 444 10 bit profiles only
    // {51ec32b5-1b4c-453c-9cbd-b616bd621341}
    static const GUID NV_ENC_HEVC_PROFILE_FREXT_GUID =
    { 0x51ec32b5, 0x1b4c, 0x453c, { 0x9c, 0xbd, 0xb6, 0x16, 0xbd, 0x62, 0x13, 0x41 } };
    
    // =========================================================================================
    // *   Preset GUIDS supported by the NvEncodeAPI interface.
    // =========================================================================================
    // {B2DFB705-4EBD-4C49-9B5F-24A777D3E587}
    static const GUID NV_ENC_PRESET_DEFAULT_GUID =
    { 0xb2dfb705, 0x4ebd, 0x4c49, { 0x9b, 0x5f, 0x24, 0xa7, 0x77, 0xd3, 0xe5, 0x87 } };
    
    // {60E4C59F-E846-4484-A56D-CD45BE9FDDF6}
    static const GUID NV_ENC_PRESET_HP_GUID =
    { 0x60e4c59f, 0xe846, 0x4484, { 0xa5, 0x6d, 0xcd, 0x45, 0xbe, 0x9f, 0xdd, 0xf6 } };
    
    // {34DBA71D-A77B-4B8F-9C3E-B6D5DA24C012}
    static const GUID NV_ENC_PRESET_HQ_GUID =
    { 0x34dba71d, 0xa77b, 0x4b8f, { 0x9c, 0x3e, 0xb6, 0xd5, 0xda, 0x24, 0xc0, 0x12 } };
    
    // {82E3E450-BDBB-4e40-989C-82A90DF9EF32}
    static const GUID NV_ENC_PRESET_BD_GUID  =
    { 0x82e3e450, 0xbdbb, 0x4e40, { 0x98, 0x9c, 0x82, 0xa9, 0xd, 0xf9, 0xef, 0x32 } };
    
    // {49DF21C5-6DFA-4feb-9787-6ACC9EFFB726}
    static const GUID NV_ENC_PRESET_LOW_LATENCY_DEFAULT_GUID  =
    { 0x49df21c5, 0x6dfa, 0x4feb, { 0x97, 0x87, 0x6a, 0xcc, 0x9e, 0xff, 0xb7, 0x26 } };
    
    // {C5F733B9-EA97-4cf9-BEC2-BF78A74FD105}
    static const GUID NV_ENC_PRESET_LOW_LATENCY_HQ_GUID  =
    { 0xc5f733b9, 0xea97, 0x4cf9, { 0xbe, 0xc2, 0xbf, 0x78, 0xa7, 0x4f, 0xd1, 0x5 } };
    
    // {67082A44-4BAD-48FA-98EA-93056D150A58}
    static const GUID NV_ENC_PRESET_LOW_LATENCY_HP_GUID =
    { 0x67082a44, 0x4bad, 0x48fa, { 0x98, 0xea, 0x93, 0x5, 0x6d, 0x15, 0xa, 0x58 } };
    
    // {D5BFB716-C604-44e7-9BB8-DEA5510FC3AC}
    static const GUID NV_ENC_PRESET_LOSSLESS_DEFAULT_GUID =
    { 0xd5bfb716, 0xc604, 0x44e7, { 0x9b, 0xb8, 0xde, 0xa5, 0x51, 0xf, 0xc3, 0xac } };
    
    // {149998E7-2364-411d-82EF-179888093409}
    static const GUID NV_ENC_PRESET_LOSSLESS_HP_GUID =
    { 0x149998e7, 0x2364, 0x411d, { 0x82, 0xef, 0x17, 0x98, 0x88, 0x9, 0x34, 0x9 } };
    
    /**
     * \addtogroup ENCODER_STRUCTURE NvEncodeAPI Data structures
     * @{
     */
    
    /**
     * Input frame encode modes
     */
    typedef enum _NV_ENC_PARAMS_FRAME_FIELD_MODE
    {
        NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME = 0x01,  /**< Frame mode */
        NV_ENC_PARAMS_FRAME_FIELD_MODE_FIELD = 0x02,  /**< Field mode */
        NV_ENC_PARAMS_FRAME_FIELD_MODE_MBAFF = 0x03   /**< MB adaptive frame/field */
    } NV_ENC_PARAMS_FRAME_FIELD_MODE;
    
    /**
     * Rate Control Modes
     */
    typedef enum _NV_ENC_PARAMS_RC_MODE
    {
        NV_ENC_PARAMS_RC_CONSTQP                = 0x0,       /**< Constant QP mode */
        NV_ENC_PARAMS_RC_VBR                    = 0x1,       /**< Variable bitrate mode */
        NV_ENC_PARAMS_RC_CBR                    = 0x2,       /**< Constant bitrate mode */
        NV_ENC_PARAMS_RC_VBR_MINQP              = 0x4,       /**< Variable bitrate mode with MinQP */
        NV_ENC_PARAMS_RC_2_PASS_QUALITY         = 0x8,       /**< Multi pass encoding optimized for image quality and works only with low latency mode */
        NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP   = 0x10,      /**< Multi pass encoding optimized for maintaining frame size and works only with low latency mode */
        NV_ENC_PARAMS_RC_2_PASS_VBR             = 0x20       /**< Multi pass VBR */
    } NV_ENC_PARAMS_RC_MODE;
    
    #define NV_ENC_PARAMS_RC_CBR2   NV_ENC_PARAMS_RC_CBR    /**< Deprecated */
    
    /**
     * Input picture structure
     */
    typedef enum _NV_ENC_PIC_STRUCT
    {
        NV_ENC_PIC_STRUCT_FRAME             = 0x01,                 /**< Progressive frame */
        NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM  = 0x02,                 /**< Field encoding top field first */
        NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP  = 0x03                  /**< Field encoding bottom field first */
    } NV_ENC_PIC_STRUCT;
    
    /**
     * Input picture type
     */
    typedef enum _NV_ENC_PIC_TYPE
    {
        NV_ENC_PIC_TYPE_P               = 0x0,     /**< Forward predicted */
        NV_ENC_PIC_TYPE_B               = 0x01,    /**< Bi-directionally predicted picture */
        NV_ENC_PIC_TYPE_I               = 0x02,    /**< Intra predicted picture */
        NV_ENC_PIC_TYPE_IDR             = 0x03,    /**< IDR picture */
        NV_ENC_PIC_TYPE_BI              = 0x04,    /**< Bi-directionally predicted with only Intra MBs */
        NV_ENC_PIC_TYPE_SKIPPED         = 0x05,    /**< Picture is skipped */
        NV_ENC_PIC_TYPE_INTRA_REFRESH   = 0x06,    /**< First picture in intra refresh cycle */
        NV_ENC_PIC_TYPE_UNKNOWN         = 0xFF     /**< Picture type unknown */
    } NV_ENC_PIC_TYPE;
    
    /**
     * Motion vector precisions
     */
    typedef enum _NV_ENC_MV_PRECISION
    {
        NV_ENC_MV_PRECISION_DEFAULT     = 0x0,       /**<Driver selects QuarterPel motion vector precision by default*/
        NV_ENC_MV_PRECISION_FULL_PEL    = 0x01,    /**< FullPel  motion vector precision */
        NV_ENC_MV_PRECISION_HALF_PEL    = 0x02,    /**< HalfPel motion vector precision */
        NV_ENC_MV_PRECISION_QUARTER_PEL = 0x03     /**< QuarterPel motion vector precision */
    } NV_ENC_MV_PRECISION;
    
    
    /**
     * Input buffer formats
     */
    typedef enum _NV_ENC_BUFFER_FORMAT
    {
        NV_ENC_BUFFER_FORMAT_UNDEFINED                       = 0x00000000,  /**< Undefined buffer format */
    
        NV_ENC_BUFFER_FORMAT_NV12                            = 0x00000001,  /**< Semi-Planar YUV [Y plane followed by interleaved UV plane] */
        NV_ENC_BUFFER_FORMAT_YV12                            = 0x00000010,  /**< Planar YUV [Y plane followed by V and U planes] */
        NV_ENC_BUFFER_FORMAT_IYUV                            = 0x00000100,  /**< Planar YUV [Y plane followed by U and V planes] */
        NV_ENC_BUFFER_FORMAT_YUV444                          = 0x00001000,  /**< Planar YUV [Y plane followed by U and V planes] */
        NV_ENC_BUFFER_FORMAT_YUV420_10BIT                    = 0x00010000,  /**< 10 bit Semi-Planar YUV [Y plane followed by interleaved UV plane]. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data. */
        NV_ENC_BUFFER_FORMAT_YUV444_10BIT                    = 0x00100000,  /**< 10 bit Planar YUV444 [Y plane followed by U and V planes]. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data.  */
        NV_ENC_BUFFER_FORMAT_ARGB                            = 0x01000000,  /**< 8 bit Packed A8R8G8B8 */
        NV_ENC_BUFFER_FORMAT_ARGB10                          = 0x02000000,  /**< 10 bit Packed A2R10G10B10. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data.  */
        NV_ENC_BUFFER_FORMAT_AYUV                            = 0x04000000,  /**< 8 bit Packed A8Y8U8V8 */
        NV_ENC_BUFFER_FORMAT_ABGR                            = 0x10000000,  /**< 8 bit Packed A8B8G8R8 */
        NV_ENC_BUFFER_FORMAT_ABGR10                          = 0x20000000,  /**< 10 bit Packed A2B10G10R10. Each pixel of size 2 bytes. Most Significant 10 bits contain pixel data.  */
    } NV_ENC_BUFFER_FORMAT;
    
    #define NV_ENC_BUFFER_FORMAT_NV12_PL NV_ENC_BUFFER_FORMAT_NV12
    #define NV_ENC_BUFFER_FORMAT_YV12_PL NV_ENC_BUFFER_FORMAT_YV12
    #define NV_ENC_BUFFER_FORMAT_IYUV_PL NV_ENC_BUFFER_FORMAT_IYUV
    #define NV_ENC_BUFFER_FORMAT_YUV444_PL NV_ENC_BUFFER_FORMAT_YUV444
    
    /**
     * Encoding levels
     */
    typedef enum _NV_ENC_LEVEL
    {
        NV_ENC_LEVEL_AUTOSELECT         = 0,
    
        NV_ENC_LEVEL_H264_1             = 10,
        NV_ENC_LEVEL_H264_1b            = 9,
        NV_ENC_LEVEL_H264_11            = 11,
        NV_ENC_LEVEL_H264_12            = 12,
        NV_ENC_LEVEL_H264_13            = 13,
        NV_ENC_LEVEL_H264_2             = 20,
        NV_ENC_LEVEL_H264_21            = 21,
        NV_ENC_LEVEL_H264_22            = 22,
        NV_ENC_LEVEL_H264_3             = 30,
        NV_ENC_LEVEL_H264_31            = 31,
        NV_ENC_LEVEL_H264_32            = 32,
        NV_ENC_LEVEL_H264_4             = 40,
        NV_ENC_LEVEL_H264_41            = 41,
        NV_ENC_LEVEL_H264_42            = 42,
        NV_ENC_LEVEL_H264_5             = 50,
        NV_ENC_LEVEL_H264_51            = 51,
        NV_ENC_LEVEL_H264_52            = 52,
    
    
        NV_ENC_LEVEL_HEVC_1             = 30,
        NV_ENC_LEVEL_HEVC_2             = 60,
        NV_ENC_LEVEL_HEVC_21            = 63,
        NV_ENC_LEVEL_HEVC_3             = 90,
        NV_ENC_LEVEL_HEVC_31            = 93,
        NV_ENC_LEVEL_HEVC_4             = 120,
        NV_ENC_LEVEL_HEVC_41            = 123,
        NV_ENC_LEVEL_HEVC_5             = 150,
        NV_ENC_LEVEL_HEVC_51            = 153,
        NV_ENC_LEVEL_HEVC_52            = 156,
        NV_ENC_LEVEL_HEVC_6             = 180,
        NV_ENC_LEVEL_HEVC_61            = 183,
        NV_ENC_LEVEL_HEVC_62            = 186,
    
        NV_ENC_TIER_HEVC_MAIN           = 0,
        NV_ENC_TIER_HEVC_HIGH           = 1
    } NV_ENC_LEVEL;
    
    /**
     * Error Codes
     */
    typedef enum _NVENCSTATUS
    {
        /**
         * This indicates that API call returned with no errors.
         */
        NV_ENC_SUCCESS,
    
        /**
         * This indicates that no encode capable devices were detected.
         */
        NV_ENC_ERR_NO_ENCODE_DEVICE,
    
        /**
         * This indicates that devices pass by the client is not supported.
         */
        NV_ENC_ERR_UNSUPPORTED_DEVICE,
    
        /**
         * This indicates that the encoder device supplied by the client is not
         * valid.
         */
        NV_ENC_ERR_INVALID_ENCODERDEVICE,
    
        /**
         * This indicates that device passed to the API call is invalid.
         */
        NV_ENC_ERR_INVALID_DEVICE,
    
        /**
         * This indicates that device passed to the API call is no longer available and
         * needs to be reinitialized. The clients need to destroy the current encoder
         * session by freeing the allocated input output buffers and destroying the device
         * and create a new encoding session.
         */
        NV_ENC_ERR_DEVICE_NOT_EXIST,
    
        /**
         * This indicates that one or more of the pointers passed to the API call
         * is invalid.
         */
        NV_ENC_ERR_INVALID_PTR,
    
        /**
         * This indicates that completion event passed in ::NvEncEncodePicture() call
         * is invalid.
         */
        NV_ENC_ERR_INVALID_EVENT,
    
        /**
         * This indicates that one or more of the parameter passed to the API call
         * is invalid.
         */
        NV_ENC_ERR_INVALID_PARAM,
    
        /**
         * This indicates that an API call was made in wrong sequence/order.
         */
        NV_ENC_ERR_INVALID_CALL,
    
        /**
         * This indicates that the API call failed because it was unable to allocate
         * enough memory to perform the requested operation.
         */
        NV_ENC_ERR_OUT_OF_MEMORY,
    
        /**
         * This indicates that the encoder has not been initialized with
         * ::NvEncInitializeEncoder() or that initialization has failed.
         * The client cannot allocate input or output buffers or do any encoding
         * related operation before successfully initializing the encoder.
         */
        NV_ENC_ERR_ENCODER_NOT_INITIALIZED,
    
        /**
         * This indicates that an unsupported parameter was passed by the client.
         */
        NV_ENC_ERR_UNSUPPORTED_PARAM,
    
        /**
         * This indicates that the ::NvEncLockBitstream() failed to lock the output
         * buffer. This happens when the client makes a non blocking lock call to
         * access the output bitstream by passing NV_ENC_LOCK_BITSTREAM::doNotWait flag.
         * This is not a fatal error and client should retry the same operation after
         * few milliseconds.
         */
        NV_ENC_ERR_LOCK_BUSY,
    
        /**
         * This indicates that the size of the user buffer passed by the client is
         * insufficient for the requested operation.
         */
        NV_ENC_ERR_NOT_ENOUGH_BUFFER,
    
        /**
         * This indicates that an invalid struct version was used by the client.
         */
        NV_ENC_ERR_INVALID_VERSION,
    
        /**
         * This indicates that ::NvEncMapInputResource() API failed to map the client
         * provided input resource.
         */
        NV_ENC_ERR_MAP_FAILED,
    
        /**
         * This indicates encode driver requires more input buffers to produce an output
         * bitstream. If this error is returned from ::NvEncEncodePicture() API, this
         * is not a fatal error. If the client is encoding with B frames then,
         * ::NvEncEncodePicture() API might be buffering the input frame for re-ordering.
         *
         * A client operating in synchronous mode cannot call ::NvEncLockBitstream()
         * API on the output bitstream buffer if ::NvEncEncodePicture() returned the
         * ::NV_ENC_ERR_NEED_MORE_INPUT error code.
         * The client must continue providing input frames until encode driver returns
         * ::NV_ENC_SUCCESS. After receiving ::NV_ENC_SUCCESS status the client can call
         * ::NvEncLockBitstream() API on the output buffers in the same order in which
         * it has called ::NvEncEncodePicture().
         */
        NV_ENC_ERR_NEED_MORE_INPUT,
    
        /**
         * This indicates that the HW encoder is busy encoding and is unable to encode
         * the input. The client should call ::NvEncEncodePicture() again after few
         * milliseconds.
         */
        NV_ENC_ERR_ENCODER_BUSY,
    
        /**
         * This indicates that the completion event passed in ::NvEncEncodePicture()
         * API has not been registered with encoder driver using ::NvEncRegisterAsyncEvent().
         */
        NV_ENC_ERR_EVENT_NOT_REGISTERD,
    
        /**
         * This indicates that an unknown internal error has occurred.
         */
        NV_ENC_ERR_GENERIC,
    
        /**
         * This indicates that the client is attempting to use a feature
         * that is not available for the license type for the current system.
         */
        NV_ENC_ERR_INCOMPATIBLE_CLIENT_KEY,
    
        /**
         * This indicates that the client is attempting to use a feature
         * that is not implemented for the current version.
         */
        NV_ENC_ERR_UNIMPLEMENTED,
    
        /**
         * This indicates that the ::NvEncRegisterResource API failed to register the resource.
         */
        NV_ENC_ERR_RESOURCE_REGISTER_FAILED,
    
        /**
         * This indicates that the client is attempting to unregister a resource
         * that has not been successfully registered.
         */
        NV_ENC_ERR_RESOURCE_NOT_REGISTERED,
    
        /**
         * This indicates that the client is attempting to unmap a resource
         * that has not been successfully mapped.
         */
        NV_ENC_ERR_RESOURCE_NOT_MAPPED,
    
    } NVENCSTATUS;
    
    /**
     * Encode Picture encode flags.
     */
    typedef enum _NV_ENC_PIC_FLAGS
    {
        NV_ENC_PIC_FLAG_FORCEINTRA         = 0x1,   /**< Encode the current picture as an Intra picture */
        NV_ENC_PIC_FLAG_FORCEIDR           = 0x2,   /**< Encode the current picture as an IDR picture.
                                                         This flag is only valid when Picture type decision is taken by the Encoder
                                                         [_NV_ENC_INITIALIZE_PARAMS::enablePTD == 1]. */
        NV_ENC_PIC_FLAG_OUTPUT_SPSPPS      = 0x4,   /**< Write the sequence and picture header in encoded bitstream of the current picture */
        NV_ENC_PIC_FLAG_EOS                = 0x8,   /**< Indicates end of the input stream */
    } NV_ENC_PIC_FLAGS;
    
    /**
     * Memory heap to allocate input and output buffers.
     */
    typedef enum _NV_ENC_MEMORY_HEAP
    {
        NV_ENC_MEMORY_HEAP_AUTOSELECT      = 0, /**< Memory heap to be decided by the encoder driver based on the usage */
        NV_ENC_MEMORY_HEAP_VID             = 1, /**< Memory heap is in local video memory */
        NV_ENC_MEMORY_HEAP_SYSMEM_CACHED   = 2, /**< Memory heap is in cached system memory */
        NV_ENC_MEMORY_HEAP_SYSMEM_UNCACHED = 3  /**< Memory heap is in uncached system memory */
    } NV_ENC_MEMORY_HEAP;
    
    
    /**
     * H.264 entropy coding modes.
     */
    typedef enum _NV_ENC_H264_ENTROPY_CODING_MODE
    {
        NV_ENC_H264_ENTROPY_CODING_MODE_AUTOSELECT = 0x0,   /**< Entropy coding mode is auto selected by the encoder driver */
        NV_ENC_H264_ENTROPY_CODING_MODE_CABAC      = 0x1,   /**< Entropy coding mode is CABAC */
        NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC      = 0x2    /**< Entropy coding mode is CAVLC */
    } NV_ENC_H264_ENTROPY_CODING_MODE;
    
    /**
     * H.264 specific Bdirect modes
     */
    typedef enum _NV_ENC_H264_BDIRECT_MODE
    {
        NV_ENC_H264_BDIRECT_MODE_AUTOSELECT = 0x0,          /**< BDirect mode is auto selected by the encoder driver */
        NV_ENC_H264_BDIRECT_MODE_DISABLE    = 0x1,          /**< Disable BDirect mode */
        NV_ENC_H264_BDIRECT_MODE_TEMPORAL   = 0x2,          /**< Temporal BDirect mode */
        NV_ENC_H264_BDIRECT_MODE_SPATIAL    = 0x3           /**< Spatial BDirect mode */
    } NV_ENC_H264_BDIRECT_MODE;
    
    /**
     * H.264 specific FMO usage
     */
    typedef enum _NV_ENC_H264_FMO_MODE
    {
        NV_ENC_H264_FMO_AUTOSELECT          = 0x0,          /**< FMO usage is auto selected by the encoder driver */
        NV_ENC_H264_FMO_ENABLE              = 0x1,          /**< Enable FMO */
        NV_ENC_H264_FMO_DISABLE             = 0x2,          /**< Disble FMO */
    } NV_ENC_H264_FMO_MODE;
    
    /**
     * H.264 specific Adaptive Transform modes
     */
    typedef enum _NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE
    {
        NV_ENC_H264_ADAPTIVE_TRANSFORM_AUTOSELECT = 0x0,   /**< Adaptive Transform 8x8 mode is auto selected by the encoder driver*/
        NV_ENC_H264_ADAPTIVE_TRANSFORM_DISABLE    = 0x1,   /**< Adaptive Transform 8x8 mode disabled */
        NV_ENC_H264_ADAPTIVE_TRANSFORM_ENABLE     = 0x2,   /**< Adaptive Transform 8x8 mode should be used */
    } NV_ENC_H264_ADAPTIVE_TRANSFORM_MODE;
    
    /**
     * Stereo frame packing modes.
     */
    typedef enum _NV_ENC_STEREO_PACKING_MODE
    {
        NV_ENC_STEREO_PACKING_MODE_NONE             = 0x0,  /**< No Stereo packing required */
        NV_ENC_STEREO_PACKING_MODE_CHECKERBOARD     = 0x1,  /**< Checkerboard mode for packing stereo frames */
        NV_ENC_STEREO_PACKING_MODE_COLINTERLEAVE    = 0x2,  /**< Column Interleave mode for packing stereo frames */
        NV_ENC_STEREO_PACKING_MODE_ROWINTERLEAVE    = 0x3,  /**< Row Interleave mode for packing stereo frames */
        NV_ENC_STEREO_PACKING_MODE_SIDEBYSIDE       = 0x4,  /**< Side-by-side mode for packing stereo frames */
        NV_ENC_STEREO_PACKING_MODE_TOPBOTTOM        = 0x5,  /**< Top-Bottom mode for packing stereo frames */
        NV_ENC_STEREO_PACKING_MODE_FRAMESEQ         = 0x6   /**< Frame Sequential mode for packing stereo frames */
    } NV_ENC_STEREO_PACKING_MODE;
    
    /**
     *  Input Resource type
     */
    typedef enum _NV_ENC_INPUT_RESOURCE_TYPE
    {
        NV_ENC_INPUT_RESOURCE_TYPE_DIRECTX          = 0x0,   /**< input resource type is a directx9 surface*/
        NV_ENC_INPUT_RESOURCE_TYPE_CUDADEVICEPTR    = 0x1,   /**< input resource type is a cuda device pointer surface*/
        NV_ENC_INPUT_RESOURCE_TYPE_CUDAARRAY        = 0x2,   /**< input resource type is a cuda array surface */
    } NV_ENC_INPUT_RESOURCE_TYPE;
    
    /**
     *  Encoder Device type
     */
    typedef enum _NV_ENC_DEVICE_TYPE
    {
        NV_ENC_DEVICE_TYPE_DIRECTX          = 0x0,   /**< encode device type is a directx9 device */
        NV_ENC_DEVICE_TYPE_CUDA             = 0x1,   /**< encode device type is a cuda device */
    } NV_ENC_DEVICE_TYPE;
    
    /**
     * Encoder capabilities enumeration.
     */
    typedef enum _NV_ENC_CAPS
    {
        /**
         * Maximum number of B-Frames supported.
         */
        NV_ENC_CAPS_NUM_MAX_BFRAMES,
    
        /**
         * Rate control modes supported.
         * \n The API return value is a bitmask of the values in NV_ENC_PARAMS_RC_MODE.
         */
        NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES,
    
        /**
         * Indicates HW support for field mode encoding.
         * \n 0 : Interlaced mode encoding is not supported.
         * \n 1 : Interlaced field mode encoding is supported.
         * \n 2 : Interlaced frame encoding and field mode encoding are both supported.
         */
         NV_ENC_CAPS_SUPPORT_FIELD_ENCODING,
    
        /**
         * Indicates HW support for monochrome mode encoding.
         * \n 0 : Monochrome mode not supported.
         * \n 1 : Monochrome mode supported.
         */
        NV_ENC_CAPS_SUPPORT_MONOCHROME,
    
        /**
         * Indicates HW support for FMO.
         * \n 0 : FMO not supported.
         * \n 1 : FMO supported.
         */
        NV_ENC_CAPS_SUPPORT_FMO,
    
        /**
         * Indicates HW capability for Quarter pel motion estimation.
         * \n 0 : QuarterPel Motion Estimation not supported.
         * \n 1 : QuarterPel Motion Estimation supported.
         */
        NV_ENC_CAPS_SUPPORT_QPELMV,
    
        /**
         * H.264 specific. Indicates HW support for BDirect modes.
         * \n 0 : BDirect mode encoding not supported.
         * \n 1 : BDirect mode encoding supported.
         */
        NV_ENC_CAPS_SUPPORT_BDIRECT_MODE,
    
        /**
         * H264 specific. Indicates HW support for CABAC entropy coding mode.
         * \n 0 : CABAC entropy coding not supported.
         * \n 1 : CABAC entropy coding supported.
         */
        NV_ENC_CAPS_SUPPORT_CABAC,
    
        /**
         * Indicates HW support for Adaptive Transform.
         * \n 0 : Adaptive Transform not supported.
         * \n 1 : Adaptive Transform supported.
         */
        NV_ENC_CAPS_SUPPORT_ADAPTIVE_TRANSFORM,
    
        /**
         * Reserved enum field.
         */
        NV_ENC_CAPS_SUPPORT_RESERVED,
    
        /**
         * Indicates HW support for encoding Temporal layers.
         * \n 0 : Encoding Temporal layers not supported.
         * \n 1 : Encoding Temporal layers supported.
         */
        NV_ENC_CAPS_NUM_MAX_TEMPORAL_LAYERS,
    
        /**
         * Indicates HW support for Hierarchical P frames.
         * \n 0 : Hierarchical P frames not supported.
         * \n 1 : Hierarchical P frames supported.
         */
        NV_ENC_CAPS_SUPPORT_HIERARCHICAL_PFRAMES,
    
        /**
         * Indicates HW support for Hierarchical B frames.
         * \n 0 : Hierarchical B frames not supported.
         * \n 1 : Hierarchical B frames supported.
         */
        NV_ENC_CAPS_SUPPORT_HIERARCHICAL_BFRAMES,
    
        /**
         * Maximum Encoding level supported (See ::NV_ENC_LEVEL for details).
         */
        NV_ENC_CAPS_LEVEL_MAX,
    
        /**
         * Minimum Encoding level supported (See ::NV_ENC_LEVEL for details).
         */
        NV_ENC_CAPS_LEVEL_MIN,
    
        /**
         * Indicates HW support for separate colour plane encoding.
         * \n 0 : Separate colour plane encoding not supported.
         * \n 1 : Separate colour plane encoding supported.
         */
        NV_ENC_CAPS_SEPARATE_COLOUR_PLANE,
    
        /**
         * Maximum output width supported.
         */
        NV_ENC_CAPS_WIDTH_MAX,
    
        /**
         * Maximum output height supported.
         */
        NV_ENC_CAPS_HEIGHT_MAX,
    
        /**
         * Indicates Temporal Scalability Support.
         * \n 0 : Temporal SVC encoding not supported.
         * \n 1 : Temporal SVC encoding supported.
         */
        NV_ENC_CAPS_SUPPORT_TEMPORAL_SVC,
    
        /**
         * Indicates Dynamic Encode Resolution Change Support.
         * Support added from NvEncodeAPI version 2.0.
         * \n 0 : Dynamic Encode Resolution Change not supported.
         * \n 1 : Dynamic Encode Resolution Change supported.
         */
        NV_ENC_CAPS_SUPPORT_DYN_RES_CHANGE,
    
        /**
         * Indicates Dynamic Encode Bitrate Change Support.
         * Support added from NvEncodeAPI version 2.0.
         * \n 0 : Dynamic Encode bitrate change not supported.
         * \n 1 : Dynamic Encode bitrate change supported.
         */
        NV_ENC_CAPS_SUPPORT_DYN_BITRATE_CHANGE,
    
        /**
         * Indicates Forcing Constant QP On The Fly Support.
         * Support added from NvEncodeAPI version 2.0.
         * \n 0 : Forcing constant QP on the fly not supported.
         * \n 1 : Forcing constant QP on the fly supported.
         */
        NV_ENC_CAPS_SUPPORT_DYN_FORCE_CONSTQP,
    
        /**
         * Indicates Dynamic rate control mode Change Support.
         * \n 0 : Dynamic rate control mode change not supported.
         * \n 1 : Dynamic rate control mode change supported.
         */
        NV_ENC_CAPS_SUPPORT_DYN_RCMODE_CHANGE,
    
        /**
         * Indicates Subframe readback support for slice-based encoding.
         * \n 0 : Subframe readback not supported.
         * \n 1 : Subframe readback supported.
         */
        NV_ENC_CAPS_SUPPORT_SUBFRAME_READBACK,
    
        /**
         * Indicates Constrained Encoding mode support.
         * Support added from NvEncodeAPI version 2.0.
         * \n 0 : Constrained encoding mode not supported.
         * \n 1 : Constarined encoding mode supported.
         * If this mode is supported client can enable this during initialisation.
         * Client can then force a picture to be coded as constrained picture where
         * each slice in a constrained picture will have constrained_intra_pred_flag set to 1
         * and disable_deblocking_filter_idc will be set to 2 and prediction vectors for inter
         * macroblocks in each slice will be restricted to the slice region.
         */
        NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING,
    
        /**
         * Indicates Intra Refresh Mode Support.
         * Support added from NvEncodeAPI version 2.0.
         * \n 0 : Intra Refresh Mode not supported.
         * \n 1 : Intra Refresh Mode supported.
         */
        NV_ENC_CAPS_SUPPORT_INTRA_REFRESH,
    
        /**
         * Indicates Custom VBV Bufer Size support. It can be used for capping frame size.
         * Support added from NvEncodeAPI version 2.0.
         * \n 0 : Custom VBV buffer size specification from client, not supported.
         * \n 1 : Custom VBV buffer size specification from client, supported.
         */
        NV_ENC_CAPS_SUPPORT_CUSTOM_VBV_BUF_SIZE,
    
        /**
         * Indicates Dynamic Slice Mode Support.
         * Support added from NvEncodeAPI version 2.0.
         * \n 0 : Dynamic Slice Mode not supported.
         * \n 1 : Dynamic Slice Mode supported.
         */
        NV_ENC_CAPS_SUPPORT_DYNAMIC_SLICE_MODE,
    
        /**
         * Indicates Reference Picture Invalidation Support.
         * Support added from NvEncodeAPI version 2.0.
         * \n 0 : Reference Picture Invalidation not supported.
         * \n 1 : Reference Picture Invalidation supported.
         */
        NV_ENC_CAPS_SUPPORT_REF_PIC_INVALIDATION,
    
        /**
         * Indicates support for PreProcessing.
         * The API return value is a bitmask of the values defined in ::NV_ENC_PREPROC_FLAGS
         */
        NV_ENC_CAPS_PREPROC_SUPPORT,
    
        /**
        * Indicates support Async mode.
        * \n 0 : Async Encode mode not supported.
        * \n 1 : Async Encode mode supported.
        */
        NV_ENC_CAPS_ASYNC_ENCODE_SUPPORT,
    
        /**
         * Maximum MBs per frame supported.
         */
        NV_ENC_CAPS_MB_NUM_MAX,
    
        /**
         * Maximum aggregate throughput in MBs per sec.
         */
        NV_ENC_CAPS_MB_PER_SEC_MAX,
    
        /**
         * Indicates HW support for YUV444 mode encoding.
         * \n 0 : YUV444 mode encoding not supported.
         * \n 1 : YUV444 mode encoding supported.
         */
        NV_ENC_CAPS_SUPPORT_YUV444_ENCODE,
    
        /**
         * Indicates HW support for lossless encoding.
         * \n 0 : lossless encoding not supported.
         * \n 1 : lossless encoding supported.
         */
        NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE,
    
         /**
         * Indicates HW support for Sample Adaptive Offset.
         * \n 0 : SAO not supported.
         * \n 1 : SAO encoding supported.
         */
        NV_ENC_CAPS_SUPPORT_SAO,
    
        /**
         * Indicates HW support for MEOnly Mode.
         * \n 0 : MEOnly Mode not supported.
         * \n 1 : MEOnly Mode supported.
         */
        NV_ENC_CAPS_SUPPORT_MEONLY_MODE,
    
        /**
         * Indicates HW support for lookahead encoding (enableLookahead=1).
         * \n 0 : Lookahead not supported.
         * \n 1 : Lookahead supported.
         */
        NV_ENC_CAPS_SUPPORT_LOOKAHEAD,
    
        /**
         * Indicates HW support for temporal AQ encoding (enableTemporalAQ=1).
         * \n 0 : Temporal AQ not supported.
         * \n 1 : Temporal AQ supported.
         */
        NV_ENC_CAPS_SUPPORT_TEMPORAL_AQ,
        /**
         * Indicates HW support for 10 bit encoding.
         * \n 0 : 10 bit encoding not supported.
         * \n 1 : 10 bit encoding supported.
         */
        NV_ENC_CAPS_SUPPORT_10BIT_ENCODE,
    
        /**
         * Reserved - Not to be used by clients.
         */
        NV_ENC_CAPS_EXPOSED_COUNT
    } NV_ENC_CAPS;
    
    /**
     *  HEVC CU SIZE
     */
    typedef enum _NV_ENC_HEVC_CUSIZE
    {
        NV_ENC_HEVC_CUSIZE_AUTOSELECT = 0,
        NV_ENC_HEVC_CUSIZE_8x8        = 1,
        NV_ENC_HEVC_CUSIZE_16x16      = 2,
        NV_ENC_HEVC_CUSIZE_32x32      = 3,
        NV_ENC_HEVC_CUSIZE_64x64      = 4,
    }NV_ENC_HEVC_CUSIZE;
    
    /**
     * Input struct for querying Encoding capabilities.
     */
    typedef struct _NV_ENC_CAPS_PARAM
    {
        uint32_t version;                                  /**< [in]: Struct version. Must be set to ::NV_ENC_CAPS_PARAM_VER */
        NV_ENC_CAPS  capsToQuery;                          /**< [in]: Specifies the encode capability to be queried. Client should pass a member for ::NV_ENC_CAPS enum. */
        uint32_t reserved[62];                             /**< [in]: Reserved and must be set to 0 */
    } NV_ENC_CAPS_PARAM;
    
    /** NV_ENC_CAPS_PARAM struct version. */
    #define NV_ENC_CAPS_PARAM_VER NVENCAPI_STRUCT_VERSION(1)
    
    
    /**
     * Creation parameters for input buffer.
     */
    typedef struct _NV_ENC_CREATE_INPUT_BUFFER
    {
        uint32_t                  version;                 /**< [in]: Struct version. Must be set to ::NV_ENC_CREATE_INPUT_BUFFER_VER */
        uint32_t                  width;                   /**< [in]: Input buffer width */
        uint32_t                  height;                  /**< [in]: Input buffer width */
        NV_ENC_MEMORY_HEAP        memoryHeap;              /**< [in]: Deprecated. Will be removed in sdk 8.0 */
        NV_ENC_BUFFER_FORMAT      bufferFmt;               /**< [in]: Input buffer format */
        uint32_t                  reserved;                /**< [in]: Reserved and must be set to 0 */
        NV_ENC_INPUT_PTR          inputBuffer;             /**< [out]: Pointer to input buffer */
        void*                     pSysMemBuffer;           /**< [in]: Pointer to existing sysmem buffer */
        uint32_t                  reserved1[57];           /**< [in]: Reserved and must be set to 0 */
        void*                     reserved2[63];           /**< [in]: Reserved and must be set to NULL */
    } NV_ENC_CREATE_INPUT_BUFFER;
    
    /** NV_ENC_CREATE_INPUT_BUFFER struct version. */
    #define NV_ENC_CREATE_INPUT_BUFFER_VER NVENCAPI_STRUCT_VERSION(1)
    
    /**
     * Creation parameters for output bitstream buffer.
     */
    typedef struct _NV_ENC_CREATE_BITSTREAM_BUFFER
    {
        uint32_t              version;                     /**< [in]: Struct version. Must be set to ::NV_ENC_CREATE_BITSTREAM_BUFFER_VER */
        uint32_t              size;                        /**< [in]: Size of the bitstream buffer to be created */
        NV_ENC_MEMORY_HEAP    memoryHeap;                  /**< [in]: Deprecated. Will be removed in sdk 8.0 */
        uint32_t              reserved;                    /**< [in]: Reserved and must be set to 0 */
        NV_ENC_OUTPUT_PTR     bitstreamBuffer;             /**< [out]: Pointer to the output bitstream buffer */
        void*                 bitstreamBufferPtr;          /**< [out]: Reserved and should not be used */
        uint32_t              reserved1[58];               /**< [in]: Reserved and should be set to 0 */
        void*                 reserved2[64];               /**< [in]: Reserved and should be set to NULL */
    } NV_ENC_CREATE_BITSTREAM_BUFFER;
    
    /** NV_ENC_CREATE_BITSTREAM_BUFFER struct version. */
    #define NV_ENC_CREATE_BITSTREAM_BUFFER_VER NVENCAPI_STRUCT_VERSION(1)
    
    /**
     * Structs needed for ME only mode.
     */
    typedef struct _NV_ENC_MVECTOR
    {
        int16_t             mvx;               /**< the x component of MV in qpel units */
        int16_t             mvy;               /**< the y component of MV in qpel units */
    } NV_ENC_MVECTOR;