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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364
|
/*############################################################################
# Copyright Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __MFXSTRUCTURES_H__
#define __MFXSTRUCTURES_H__
#include "mfxcommon.h"
#if !defined (__GNUC__)
#pragma warning(disable: 4201)
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Frame ID for MVC */
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Describes the view and layer of a frame picture. */
typedef struct {
mfxU16 TemporalId; /*!< The temporal identifier as defined in the annex H of the ITU*-T H.264 specification. */
mfxU16 PriorityId; /*!< Reserved and must be zero. */
union {
struct {
mfxU16 DependencyId; /*!< Reserved for future use. */
mfxU16 QualityId; /*!< Reserved for future use. */
};
struct {
mfxU16 ViewId; /*!< The view identifier as defined in the annex H of the ITU-T H.264 specification. */
};
};
} mfxFrameId;
MFX_PACK_END()
/* This struct has 4-byte alignment for binary compatibility with previously released versions of API. */
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Specifies properties of video frames. See also "Configuration Parameter Constraints" chapter. */
typedef struct {
mfxU32 reserved[4]; /*!< Reserved for future use. */
/*! The unique ID of each VPP channel set by application. It's required that during Init/Reset application fills ChannelId for
each mfxVideoChannelParam provided by the application and the SDK sets it back to the correspondent
mfxSurfaceArray::mfxFrameSurface1 to distinguish different channels. It's expected that surfaces for some channels might be
returned with some delay so application has to use mfxFrameInfo::ChannelId to distinguish what returned surface belongs to
what VPP channel. Decoder's initialization parameters are always sent through channel with mfxFrameInfo::ChannelId equals to
zero. It's allowed to skip setting of decoder's parameters for simplified decoding procedure */
mfxU16 ChannelId;
/*! Number of bits used to represent luma samples.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported. */
mfxU16 BitDepthLuma;
/*! Number of bits used to represent chroma samples.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported. */
mfxU16 BitDepthChroma;
/*! The Shift flag indicates whether the values of luma and chroma samples are shifted. For the decoding process, the recommended value
is specified by the DecodeHeader or GetVideoParam API. A value of one indicates that the luma and chroma sample values are shifted,
while a value of zero indicates that there is no shift. Please refer to the example data alignment provided below.
@note Not all codecs and implementations support this flag. Use the Query API function to check if this feature is supported.
AVC and HEVC allow users to set the Shift flag to either 0 or 1. However, setting the Shift flag to a value different from the
recommended one may lead to increased CPU utilization. For other codecs, attempting to set the Shift flag to a value other than
the recommended one will result in an error status.
*/
mfxU16 Shift;
mfxFrameId FrameId; /*!< Describes the view and layer of a frame picture. */
mfxU32 FourCC; /*!< FourCC code of the color format. See the ColorFourCC enumerator for details. */
union {
struct { /* Frame parameters */
/*! Width of the video frame in pixels. Must be a multiple of 16.
In case of fused operation of decode plus VPP it can be set to zero to signalize that scaling operation is not requested. */
mfxU16 Width;
/*! Height of the video frame in pixels. Must be a multiple of 16 for progressive frame sequence and a multiple of 32 otherwise.
In case of fused operation of decode plus VPP it can be set to zero to signalize that scaling operation is not requested. */
mfxU16 Height;
/*! @{
@name ROI
The region of interest of the frame. Specify the display width and height in mfxVideoParam. */
/*! X coordinate.
In case of fused operation of decode plus VPP it can be set to zero to signalize that cropping operation is not requested. */
mfxU16 CropX;
/*! Y coordinate.
In case of fused operation of decode plus VPP it can be set to zero to signalize that cropping operation is not requested. */
mfxU16 CropY;
/*! Width in pixels.
In case of fused operation of decode plus VPP it can be set to zero to signalize that cropping operation is not requested. */
mfxU16 CropW;
/*! Height in pixels.
In case of fused operation of decode plus VPP it can be set to zero to signalize that cropping operation is not requested. */
mfxU16 CropH;
/*! @} */
};
struct { /* Buffer parameters (for plain formats like P8) */
mfxU64 BufferSize; /*!< Size of frame buffer in bytes. Valid only for plain formats (when FourCC is P8). In this case, Width, Height, and crop values are invalid. */
mfxU32 reserved5;
};
};
/*! @{
@name FrameRate
Specify the frame rate with the following formula: FrameRateExtN / FrameRateExtD.
For encoding, frame rate must be specified. For decoding, frame rate may be unspecified (FrameRateExtN and FrameRateExtD
are all zeros.) In this case, the frame rate is defaulted to 0 frames per second, and timestamp will be calculated by 30fps in SDK.
In decoding process:
If there is frame rate information in bitstream, MFXVideoDECODE_DecodeHeader will carry actual frame rate in FrameRateExtN and FrameRateExtD parameters.
MFXVideoDECODE_Init, MFXVideoDECODE_Query, MFXVideoDECODE_DecodeFrameAsync and MFXVideoDECODE_GetVideoParam will also carry these values for frame rate.
Timestamp will be calculated by the actual frame rate.
If there is no frame rate information in bitstream, MFXVideoDECODE_DecodeHeader will assign 0 for frame rate in FrameRateExtN and FrameRateExtD parameters.
MFXVideoDECODE_Init, MFXVideoDECODE_Query, MFXVideoDECODE_DecodeFrameAsync and MFXVideoDECODE_GetVideoParam will also assign 0 for frame rate. Timestamp will be calculated by 30fps.
If these two parameters are modified through MFXVideoDECODE_Init, then the modified values for frame rate will be used in
MFXVideoDECODE_Query, MFXVideoDECODE_DecodeFrameAsync and MFXVideoDECODE_GetVideoParam. Timestamps will be calculated using the modified values.
*/
mfxU32 FrameRateExtN; /*!< Frame rate numerator. */
mfxU32 FrameRateExtD; /*!< Frame rate denominator. */
/*! @} */
mfxU16 reserved3;
/*! @{
@name AspectRatio
AspectRatioW and AspectRatioH are used to specify the sample aspect ratio. If sample aspect ratio is explicitly defined by the standards (see
Table 6-3 in the MPEG-2 specification or Table E-1 in the H.264 specification), AspectRatioW and AspectRatioH should be the defined values.
Otherwise, the sample aspect ratio can be derived as follows:
@li @c AspectRatioW=display_aspect_ratio_width*display_height
@li @c AspectRatioH=display_aspect_ratio_height*display_width
For MPEG-2, the above display aspect ratio must be one of the defined values in Table 6-3 in the MPEG-2 specification. For H.264, there is no restriction
on display aspect ratio values.
If both parameters are zero, the encoder uses the default value of sample aspect ratio.
*/
mfxU16 AspectRatioW; /*!< Aspect Ratio for width. */
mfxU16 AspectRatioH; /*!< Aspect Ratio for height. */
/*! @} */
mfxU16 PicStruct; /*!< Picture type as specified in the PicStruct enumerator. */
mfxU16 ChromaFormat; /*!< Color sampling method. Value is the same as that of ChromaFormatIdc.
ChromaFormat is not defined if FourCC is zero.*/
mfxU16 reserved2;
} mfxFrameInfo;
MFX_PACK_END()
/*! The ColorFourCC enumerator itemizes color formats. */
enum {
MFX_FOURCC_NV12 = MFX_MAKEFOURCC('N','V','1','2'), /*!< NV12 color planes. Native format for 4:2:0/8b Gen hardware implementation. */
MFX_FOURCC_YV12 = MFX_MAKEFOURCC('Y','V','1','2'), /*!< YV12 color planes. */
MFX_FOURCC_NV16 = MFX_MAKEFOURCC('N','V','1','6'), /*!< 4:2:2 color format with similar to NV12 layout. */
MFX_FOURCC_YUY2 = MFX_MAKEFOURCC('Y','U','Y','2'), /*!< YUY2 color planes. */
MFX_FOURCC_RGB565 = MFX_MAKEFOURCC('R','G','B','2'), /*!< 2 bytes per pixel, uint16 in little-endian format, where 0-4 bits are blue, bits 5-10 are green and bits 11-15 are red. */
/*! RGB 24 bit planar layout (3 separate channels, 8-bits per sample each). This format should be mapped to D3DFMT_R8G8B8 or VA_FOURCC_RGBP. */
MFX_FOURCC_RGBP = MFX_MAKEFOURCC('R','G','B','P'),
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_FOURCC_RGB3) = MFX_MAKEFOURCC('R','G','B','3'), /* Deprecated. */
MFX_FOURCC_RGB4 = MFX_MAKEFOURCC('R','G','B','4'), /*!< RGB4 (RGB32) color planes. BGRA is the order, 'B' is 8 MSBs, then 8 bits for 'G' channel, then 'R' and 'A' channels. */
/*!
Internal color format. The application should use the following functions to create a surface that corresponds to the Direct3D* version in use.
For Direct3D* 9: IDirectXVideoDecoderService::CreateSurface()
For Direct3D* 11: ID3D11Device::CreateBuffer()
*/
MFX_FOURCC_P8 = 41,
/*!
Internal color format. The application should use the following functions to create a surface that corresponds to the Direct3D* version in use.
For Direct3D 9: IDirectXVideoDecoderService::CreateSurface()
For Direct3D 11: ID3D11Device::CreateTexture2D()
*/
MFX_FOURCC_P8_TEXTURE = MFX_MAKEFOURCC('P','8','M','B'),
MFX_FOURCC_P010 = MFX_MAKEFOURCC('P','0','1','0'), /*!< P010 color format. This is 10 bit per sample format with similar to NV12 layout. This format should be mapped to DXGI_FORMAT_P010. */
MFX_FOURCC_P016 = MFX_MAKEFOURCC('P','0','1','6'), /*!< P016 color format. This is 16 bit per sample format with similar to NV12 layout. This format should be mapped to DXGI_FORMAT_P016. */
MFX_FOURCC_P210 = MFX_MAKEFOURCC('P','2','1','0'), /*!< 10 bit per sample 4:2:2 color format with similar to NV12 layout. */
MFX_FOURCC_BGR4 = MFX_MAKEFOURCC('B','G','R','4'), /*!< RGBA color format. It is similar to MFX_FOURCC_RGB4 but with different order of channels. 'R' is 8 MSBs, then 8 bits for 'G' channel, then 'B' and 'A' channels. */
MFX_FOURCC_A2RGB10 = MFX_MAKEFOURCC('R','G','1','0'), /*!< 10 bits ARGB color format packed in 32 bits. 'A' channel is two MSBs, then 'R', then 'G' and then 'B' channels. This format should be mapped to DXGI_FORMAT_R10G10B10A2_UNORM or D3DFMT_A2R10G10B10. */
MFX_FOURCC_ARGB16 = MFX_MAKEFOURCC('R','G','1','6'), /*!< 10 bits ARGB color format packed in 64 bits. 'A' channel is 16 MSBs, then 'R', then 'G' and then 'B' channels. This format should be mapped to DXGI_FORMAT_R16G16B16A16_UINT or D3DFMT_A16B16G16R16 formats. */
MFX_FOURCC_ABGR16 = MFX_MAKEFOURCC('B','G','1','6'), /*!< 10 bits ABGR color format packed in 64 bits. 'A' channel is 16 MSBs, then 'B', then 'G' and then 'R' channels. This format should be mapped to DXGI_FORMAT_R16G16B16A16_UINT or D3DFMT_A16B16G16R16 formats. */
MFX_FOURCC_R16 = MFX_MAKEFOURCC('R','1','6','U'), /*!< 16 bits single channel color format. This format should be mapped to DXGI_FORMAT_R16_TYPELESS or D3DFMT_R16F. */
MFX_FOURCC_AYUV = MFX_MAKEFOURCC('A','Y','U','V'), /*!< YUV 4:4:4, AYUV color format. This format should be mapped to DXGI_FORMAT_AYUV. */
MFX_FOURCC_AYUV_RGB4 = MFX_MAKEFOURCC('A','V','U','Y'), /*!< RGB4 stored in AYUV surface. This format should be mapped to DXGI_FORMAT_AYUV. */
MFX_FOURCC_UYVY = MFX_MAKEFOURCC('U','Y','V','Y'), /*!< UYVY color planes. Same as YUY2 except the byte order is reversed. */
MFX_FOURCC_Y210 = MFX_MAKEFOURCC('Y','2','1','0'), /*!< 10 bit per sample 4:2:2 packed color format with similar to YUY2 layout. This format should be mapped to DXGI_FORMAT_Y210. */
MFX_FOURCC_Y410 = MFX_MAKEFOURCC('Y','4','1','0'), /*!< 10 bit per sample 4:4:4 packed color format. This format should be mapped to DXGI_FORMAT_Y410. */
MFX_FOURCC_Y216 = MFX_MAKEFOURCC('Y','2','1','6'), /*!< 16 bit per sample 4:2:2 packed color format with similar to YUY2 layout. This format should be mapped to DXGI_FORMAT_Y216. */
MFX_FOURCC_Y416 = MFX_MAKEFOURCC('Y','4','1','6'), /*!< 16 bit per sample 4:4:4 packed color format. This format should be mapped to DXGI_FORMAT_Y416. */
MFX_FOURCC_NV21 = MFX_MAKEFOURCC('N', 'V', '2', '1'), /*!< Same as NV12 but with weaved V and U values. */
MFX_FOURCC_IYUV = MFX_MAKEFOURCC('I', 'Y', 'U', 'V'), /*!< Same as YV12 except that the U and V plane order is reversed. */
MFX_FOURCC_I010 = MFX_MAKEFOURCC('I', '0', '1', '0'), /*!< 10-bit YUV 4:2:0, each component has its own plane. */
MFX_FOURCC_I210 = MFX_MAKEFOURCC('I', '2', '1', '0'), /*!< 10-bit YUV 4:2:2, each component has its own plane. */
MFX_FOURCC_I420 = MFX_FOURCC_IYUV, /*!< Alias for the IYUV color format. */
MFX_FOURCC_I422 = MFX_MAKEFOURCC('I', '4', '2', '2'), /*!< Same as YV16 except that the U and V plane order is reversed */
MFX_FOURCC_BGRA = MFX_FOURCC_RGB4, /*!< Alias for the RGB4 color format. */
/*! BGR 24 bit planar layout (3 separate channels, 8-bits per sample each). This format should be mapped to VA_FOURCC_BGRP. */
MFX_FOURCC_BGRP = MFX_MAKEFOURCC('B','G','R','P'),
/*! 8bit per sample 4:4:4 format packed in 32 bits, X=unused/undefined, 'X' channel is 8 MSBs, then 'Y', then 'U', and then 'V' channels. This format should be mapped to VA_FOURCC_XYUV. */
MFX_FOURCC_XYUV = MFX_MAKEFOURCC('X','Y','U','V'),
MFX_FOURCC_ABGR16F = MFX_MAKEFOURCC('B', 'G', 'R', 'F'), /*!< 16 bits float point ABGR color format packed in 64 bits. 'A' channel is 16 MSBs, then 'B', then 'G' and then 'R' channels. This format should be mapped to DXGI_FORMAT_R16G16B16A16_FLOAT or D3DFMT_A16B16G16R16F formats.. */
};
/* PicStruct */
enum {
MFX_PICSTRUCT_UNKNOWN =0x00, /*!< Unspecified or mixed progressive/interlaced/field pictures. */
MFX_PICSTRUCT_PROGRESSIVE =0x01, /*!< Progressive picture. */
MFX_PICSTRUCT_FIELD_TFF =0x02, /*!< Top field in first interlaced picture. */
MFX_PICSTRUCT_FIELD_BFF =0x04, /*!< Bottom field in first interlaced picture. */
MFX_PICSTRUCT_FIELD_REPEATED=0x10, /*!< First field repeated: pic_struct=5 or 6 in H.264. */
MFX_PICSTRUCT_FRAME_DOUBLING=0x20, /*!< Double the frame for display: pic_struct=7 in H.264. */
MFX_PICSTRUCT_FRAME_TRIPLING=0x40, /*!< Triple the frame for display: pic_struct=8 in H.264. */
MFX_PICSTRUCT_FIELD_SINGLE =0x100, /*!< Single field in a picture. */
MFX_PICSTRUCT_FIELD_TOP =MFX_PICSTRUCT_FIELD_SINGLE | MFX_PICSTRUCT_FIELD_TFF, /*!< Top field in a picture: pic_struct = 1 in H.265. */
MFX_PICSTRUCT_FIELD_BOTTOM =MFX_PICSTRUCT_FIELD_SINGLE | MFX_PICSTRUCT_FIELD_BFF, /*!< Bottom field in a picture: pic_struct = 2 in H.265. */
MFX_PICSTRUCT_FIELD_PAIRED_PREV =0x200, /*!< Paired with previous field: pic_struct = 9 or 10 in H.265. */
MFX_PICSTRUCT_FIELD_PAIRED_NEXT =0x400, /*!< Paired with next field: pic_struct = 11 or 12 in H.265 */
};
/*! The ChromaFormatIdc enumerator itemizes color-sampling formats. */
enum {
MFX_CHROMAFORMAT_MONOCHROME =0, /*!< Monochrome. */
MFX_CHROMAFORMAT_YUV420 =1, /*!< 4:2:0 color. */
MFX_CHROMAFORMAT_YUV422 =2, /*!< 4:2:2 color. */
MFX_CHROMAFORMAT_YUV444 =3, /*!< 4:4:4 color. */
MFX_CHROMAFORMAT_YUV400 = MFX_CHROMAFORMAT_MONOCHROME, /*!< Equal to monochrome. */
MFX_CHROMAFORMAT_YUV411 = 4, /*!< 4:1:1 color. */
MFX_CHROMAFORMAT_YUV422H = MFX_CHROMAFORMAT_YUV422, /*!< 4:2:2 color, horizontal sub-sampling. It is equal to 4:2:2 color. */
MFX_CHROMAFORMAT_YUV422V = 5, /*!< 4:2:2 color, vertical sub-sampling. */
MFX_CHROMAFORMAT_RESERVED1 = 6 /*!< Reserved. */
};
enum {
MFX_TIMESTAMP_UNKNOWN = -1 /*!< Indicates that time stamp is unknown for this frame/bitstream portion. */
};
enum {
MFX_FRAMEORDER_UNKNOWN = -1 /*!< Unused entry or API functions that generate the frame output do not use this frame. */
};
/*! The FrameDataFlag enumerator itemizes DataFlag value in mfxFrameData. */
enum {
MFX_FRAMEDATA_TIMESTAMP_UNKNOWN = 0x0000,/*!< Indicates the time stamp of this frame is unknown and will be calculated by SDK. */
MFX_FRAMEDATA_ORIGINAL_TIMESTAMP = 0x0001 /*!< Indicates the time stamp of this frame is not calculated and is a pass-through of the original time stamp. */
};
/*! Corrupted in mfxFrameData */
enum {
MFX_CORRUPTION_NO = 0x0000, /*!< No corruption. */
MFX_CORRUPTION_MINOR = 0x0001, /*!< Minor corruption in decoding certain macro-blocks. */
MFX_CORRUPTION_MAJOR = 0x0002, /*!< Major corruption in decoding the frame - incomplete data, for example. */
MFX_CORRUPTION_ABSENT_TOP_FIELD = 0x0004, /*!< Top field of frame is absent in bitstream. Only bottom field has been decoded. */
MFX_CORRUPTION_ABSENT_BOTTOM_FIELD = 0x0008, /*!< Bottom field of frame is absent in bitstream. Only top filed has been decoded. */
MFX_CORRUPTION_REFERENCE_FRAME = 0x0010, /*!< Decoding used a corrupted reference frame. A corrupted reference frame was used for decoding this
frame. For example, if the frame uses a reference frame that was decoded with minor/major corruption flag, then this
frame is also marked with a reference corruption flag. */
MFX_CORRUPTION_REFERENCE_LIST = 0x0020, /*!< The reference list information of this frame does not match what is specified in the Reference Picture Marking
Repetition SEI message. (ITU-T H.264 D.1.8 dec_ref_pic_marking_repetition) */
#ifdef ONEVPL_EXPERIMENTAL
MFX_CORRUPTION_HW_RESET = 0x0040 /*!< The hardware reset is reported from media driver. */
#endif
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Specifies "pixel" in Y410 color format. */
typedef struct
{
mfxU32 U : 10; /*!< U component. */
mfxU32 Y : 10; /*!< Y component. */
mfxU32 V : 10; /*!< V component. */
mfxU32 A : 2; /*!< A component. */
} mfxY410;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Specifies "pixel" in Y416 color format. */
typedef struct
{
mfxU32 U : 16; /*!< U component. */
mfxU32 Y : 16; /*!< Y component. */
mfxU32 V : 16; /*!< V component. */
mfxU32 A : 16; /*!< A component. */
} mfxY416;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Specifies "pixel" in A2RGB10 color format */
typedef struct
{
mfxU32 B : 10; /*!< B component. */
mfxU32 G : 10; /*!< G component. */
mfxU32 R : 10; /*!< R component. */
mfxU32 A : 2; /*!< A component. */
} mfxA2RGB10;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Specifies "pixel" in ABGR 16 bit half float point color format */
typedef struct
{
mfxFP16 R; /*!< R component. */
mfxFP16 G; /*!< G component. */
mfxFP16 B; /*!< B component. */
mfxFP16 A; /*!< A component. */
} mfxABGR16FP;
MFX_PACK_END()
/*! Describes frame buffer pointers. */
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
typedef struct {
/*! @name Extension Buffers */
/*! @{ */
union {
mfxExtBuffer **ExtParam; /*!< Points to an array of pointers to the extra configuration structures. See the ExtendedBufferID
enumerator for a list of extended configurations. */
mfxU64 reserved2;
};
mfxU16 NumExtParam; /*!< The number of extra configuration structures attached to this structure. */
/*! @} */
/*! @name General members */
/*! @{ */
mfxU16 reserved[9]; /*!< Reserved for future use. */
mfxU16 MemType; /*!< Allocated memory type. See the ExtMemFrameType enumerator for details. Used for better integration of
3rd party plugins into the pipeline. */
mfxU16 PitchHigh; /*!< Distance in bytes between the start of two consecutive rows in a frame. */
mfxU64 TimeStamp; /*!< Time stamp of the video frame in units of 90KHz. Divide TimeStamp by 90,000 (90 KHz) to obtain the time in seconds.
A value of MFX_TIMESTAMP_UNKNOWN indicates that there is no time stamp. */
mfxU32 FrameOrder; /*!< Current frame counter for the top field of the current frame. An invalid value of MFX_FRAMEORDER_UNKNOWN indicates that
API functions that generate the frame output do not use this frame. */
mfxU16 Locked; /*!< Counter flag for the application. If Locked is greater than zero then the application locks the frame or field pair.
Do not move, alter or delete the frame. */
union{
mfxU16 Pitch;
mfxU16 PitchLow; /*!< Distance in bytes between the start of two consecutive rows in a frame. */
};
/*! @} */
/*!
@name Color Planes
Data pointers to corresponding color channels (planes). The frame buffer pointers must be 16-byte aligned. The application has to specify pointers to
all color channels even for packed formats. For example, for YUY2 format the application must specify Y, U, and V pointers.
For RGB32 format, the application must specify R, G, B, and A pointers.
*/
/*! @{ */
union {
mfxU8 *Y; /*!< Y channel. */
mfxU16 *Y16; /*!< Y16 channel. */
mfxU8 *R; /*!< R channel. */
};
union {
mfxU8 *UV; /*!< UV channel for UV merged formats. */
mfxU8 *VU; /*!< YU channel for VU merged formats. */
mfxU8 *CbCr; /*!< CbCr channel for CbCr merged formats. */
mfxU8 *CrCb; /*!< CrCb channel for CrCb merged formats. */
mfxU8 *Cb; /*!< Cb channel. */
mfxU8 *U; /*!< U channel. */
mfxU16 *U16; /*!< U16 channel. */
mfxU8 *G; /*!< G channel. */
mfxY410 *Y410; /*!< T410 channel for Y410 format (merged AVYU). */
mfxY416 *Y416; /*!< This format is a packed 16-bit representation that includes 16 bits of alpha. */
};
union {
mfxU8 *Cr; /*!< Cr channel. */
mfxU8 *V; /*!< V channel. */
mfxU16 *V16; /*!< V16 channel. */
mfxU8 *B; /*!< B channel. */
mfxA2RGB10 *A2RGB10; /*!< A2RGB10 channel for A2RGB10 format (merged ARGB). */
mfxABGR16FP* ABGRFP16; /*!< ABGRFP16 channel for half float ARGB format (use this merged one due to no separate FP16 Alpha Channel). */
};
mfxU8 *A; /*!< A channel. */
mfxMemId MemId; /*!< Memory ID of the data buffers. Ignored if any of the preceding data pointers is non-zero. */
/*! @} */
/*!
@name Additional Flags
*/
/*! @{ */
mfxU16 Corrupted; /*!< Some part of the frame or field pair is corrupted. See the Corruption enumerator for details. */
mfxU16 DataFlag; /*!< Additional flags to indicate frame data properties. See the FrameDataFlag enumerator for details. */
/*! @} */
} mfxFrameData;
MFX_PACK_END()
/*! The mfxHandleType enumerator itemizes system handle types that implementations might use. */
typedef enum {
MFX_HANDLE_DIRECT3D_DEVICE_MANAGER9 = 1, /*!< Pointer to the IDirect3DDeviceManager9 interface. See Working with Microsoft* DirectX* Applications for more details on how to use this handle. */
MFX_HANDLE_D3D9_DEVICE_MANAGER = MFX_HANDLE_DIRECT3D_DEVICE_MANAGER9, /*!< Pointer to the IDirect3DDeviceManager9 interface. See Working with Microsoft* DirectX* Applications for more details on how to use this handle. */
MFX_HANDLE_RESERVED1 = 2, /* Reserved. */
MFX_HANDLE_D3D11_DEVICE = 3, /*!< Pointer to the ID3D11Device interface. See Working with Microsoft* DirectX* Applications for more details on how to use this handle. */
MFX_HANDLE_VA_DISPLAY = 4, /*!< VADisplay interface. See Working with VA-API Applications for more details on how to use this handle. */
MFX_HANDLE_RESERVED3 = 5, /* Reserved. */
MFX_HANDLE_VA_CONFIG_ID = 6, /*!< Pointer to VAConfigID interface. It represents external VA config for Common Encryption usage model. */
MFX_HANDLE_VA_CONTEXT_ID = 7, /*!< Pointer to VAContextID interface. It represents external VA context for Common Encryption usage model. */
MFX_HANDLE_CM_DEVICE = 8, /*!< Pointer to CmDevice interface ( Intel(r) C for Metal Runtime ). */
MFX_HANDLE_HDDLUNITE_WORKLOADCONTEXT = 9, /*!< Pointer to HddlUnite::WorkloadContext interface. */
MFX_HANDLE_PXP_CONTEXT = 10, /*!< Pointer to PXP context for protected content support. */
MFX_HANDLE_CONFIG_INTERFACE = 1000, /*!< Pointer to interface of type mfxConfigInterface. */
#ifdef ONEVPL_EXPERIMENTAL
MFX_HANDLE_MEMORY_INTERFACE = 1001, /*!< Pointer to interface of type mfxMemoryInterface. */
#endif
} mfxHandleType;
/*! The mfxMemoryFlags enumerator specifies memory access mode. */
typedef enum
{
MFX_MAP_READ = 0x1, /*!< The surface is mapped for reading. */
MFX_MAP_WRITE = 0x2, /*!< The surface is mapped for writing. */
MFX_MAP_READ_WRITE = MFX_MAP_READ|MFX_MAP_WRITE, /*!< The surface is mapped for reading and writing. */
/*!
* The mapping would be done immediately without any implicit synchronizations.
* \attention This flag is optional.
*/
MFX_MAP_NOWAIT = 0x10
} mfxMemoryFlags;
#define MFX_FRAMESURFACE1_VERSION MFX_STRUCT_VERSION(1, 1)
/* Frame Surface */
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*! Defines the uncompressed frames surface information and data buffers.
The frame surface is in the frame or complementary field pairs of pixels up to four color-channels, in two parts:
mfxFrameInfo and mfxFrameData.
*/
typedef struct {
union
{
struct mfxFrameSurfaceInterface* FrameInterface; /*!< Specifies interface to work with surface. */
mfxU32 reserved[2];
};
mfxStructVersion Version; /*!< Specifies version of mfxFrameSurface1 structure. */
mfxU16 reserved1[3];
mfxFrameInfo Info; /*!< Specifies surface properties. */
mfxFrameData Data; /*!< Describes the actual frame buffer. */
} mfxFrameSurface1;
MFX_PACK_END()
#ifdef ONEVPL_EXPERIMENTAL
/*! The mfxSurfaceType enumerator specifies the surface type described by mfxSurfaceHeader. */
typedef enum {
MFX_SURFACE_TYPE_UNKNOWN = 0, /*!< Unknown surface type. */
MFX_SURFACE_TYPE_D3D11_TEX2D = 2, /*!< D3D11 surface of type ID3D11Texture2D. */
MFX_SURFACE_TYPE_VAAPI = 3, /*!< VA-API surface. */
MFX_SURFACE_TYPE_OPENCL_IMG2D = 4, /*!< OpenCL 2D image (cl_mem). */
MFX_SURFACE_TYPE_D3D12_TEX2D = 5, /*!< D3D12 surface of type ID3D12Resource with 2D texture type. */
MFX_SURFACE_TYPE_VULKAN_IMG2D = 6, /*!< Vulkan 2D image (VkImage). */
} mfxSurfaceType;
/*! This enumerator specifies the sharing modes which are allowed for importing or exporting shared surfaces. */
enum {
MFX_SURFACE_FLAG_DEFAULT = 0x0000, /*!< Default is SHARED import or export. */
MFX_SURFACE_FLAG_IMPORT_SHARED = 0x0010, /*!< Import frames directly by mapping a shared native handle from an application-provided surface to an internally-allocated surface. */
MFX_SURFACE_FLAG_IMPORT_COPY = 0x0020, /*!< Import frames by copying data from an application-provided surface to an internally-allocated surface. */
MFX_SURFACE_FLAG_EXPORT_SHARED = 0x0100, /*!< Export frames directly by mapping a shared native handle from an internally-allocated surface to an application-provided surface. */
MFX_SURFACE_FLAG_EXPORT_COPY = 0x0200, /*!< Export frames by copying data from an internally-allocated surface to an application-provided surface. */
};
MFX_PACK_BEGIN_STRUCT_W_PTR()
typedef struct {
mfxSurfaceType SurfaceType; /*!< Set to the MFX_SURFACE_TYPE enum corresponding to the specific structure. */
mfxU32 SurfaceFlags; /*!< Set to the MFX_SURFACE_FLAG enum (or combination) corresponding to the allowed import / export mode(s). Multiple flags may be combined with OR.
Upon a successful Import or Export operation, this field will indicate the actual mode used.*/
mfxU32 StructSize; /*!< Size in bytes of the complete mfxSurfaceXXX structure. */
mfxU16 NumExtParam; /*!< The number of extra configuration structures attached to the structure. */
mfxExtBuffer** ExtParam; /*!< Points to an array of pointers to the extra configuration structures; see the ExtendedBufferID enumerator for a list of extended configurations. */
mfxU32 reserved[6];
} mfxSurfaceHeader;
MFX_PACK_END()
#define MFX_SURFACEINTERFACE_VERSION MFX_STRUCT_VERSION(1, 0)
/*!
Contains mfxSurfaceHeader and the callback functions AddRef, Release and GetRefCounter
that the application may use to manage access to exported surfaces.
These interfaces are only valid for surfaces obtained by mfxFrameSurfaceInterface::Export.
They are not used for surface descriptions passed to function mfxMemoryInterface::ImportFrameSurface.
*/
MFX_PACK_BEGIN_STRUCT_W_PTR()
typedef struct mfxSurfaceInterface {
mfxSurfaceHeader Header; /*!< Exported surface header. Contains description of current surface. */
mfxStructVersion Version; /*!< The version of the structure. */
mfxHDL Context; /*!< The context of the exported surface interface. User should not touch (change, set, null) this pointer. */
/*! @brief
Increments the internal reference counter of the surface. The surface is not destroyed until the surface is released using the mfxSurfaceInterface::Release function.
mfxSurfaceInterface::AddRef should be used each time a new link to the surface is created (for example, copy structure) for proper surface management.
@param[in] surface Valid surface.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfaceInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *AddRef)(struct mfxSurfaceInterface* surface);
/*! @brief
Decrements the internal reference counter of the surface. mfxSurfaceInterface::Release should be called after using the
mfxSurfaceInterface::AddRef function to add a surface or when allocation logic requires it. For example, call
mfxSurfaceInterface::Release to release a surface obtained with the mfxFrameSurfaceInterface::Export function.
@param[in] surface Valid surface.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfaceInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNDEFINED_BEHAVIOR If Reference Counter of surface is zero before call. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *Release)(struct mfxSurfaceInterface* surface);
/*! @brief
Returns current reference counter of exported surface.
@param[in] surface Valid surface.
@param[out] counter Sets counter to the current reference counter value.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface or counter is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfaceInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *GetRefCounter)(struct mfxSurfaceInterface* surface, mfxU32* counter);
/*! @brief
This function is only valuable for surfaces which were exported in sharing mode (without a copy).
Guarantees readiness of both the data (pixels) and any original mfxFrameSurface1 frame's meta information (for example corruption flags) after a function completes.
Instead of MFXVideoCORE_SyncOperation, users may directly call the mfxSurfaceInterface::Synchronize function after the corresponding
Decode or VPP function calls (MFXVideoDECODE_DecodeFrameAsync or MFXVideoVPP_RunFrameVPPAsync).
The prerequisites to call the functions are:
@li The main processing functions return MFX_ERR_NONE.
@li A valid surface object.
@param[in] surface Valid surface.
@param[out] wait Wait time in milliseconds.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface is NULL. \n
MFX_ERR_INVALID_HANDLE If any of surface is not valid object . \n
MFX_WRN_IN_EXECUTION If the given timeout is expired and the surface is not ready. \n
MFX_ERR_ABORTED If the specified asynchronous function aborted due to data dependency on a previous asynchronous function that did not complete. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *Synchronize)(struct mfxSurfaceInterface* surface, mfxU32 wait);
mfxHDL reserved[11];
} mfxSurfaceInterface;
MFX_PACK_END()
#endif
#ifdef ONEVPL_EXPERIMENTAL
#define MFX_FRAMESURFACEINTERFACE_VERSION MFX_STRUCT_VERSION(1, 1)
#else
#define MFX_FRAMESURFACEINTERFACE_VERSION MFX_STRUCT_VERSION(1, 0)
#endif
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*! Specifies frame surface interface. */
typedef struct mfxFrameSurfaceInterface {
mfxHDL Context; /*!< The context of the memory interface. User should not touch (change, set, null) this pointer. */
mfxStructVersion Version; /*!< The version of the structure. */
mfxU16 reserved1[3];
/*! @brief
Increments the internal reference counter of the surface. The surface is not destroyed until the surface is released using the mfxFrameSurfaceInterface::Release function.
mfxFrameSurfaceInterface::AddRef should be used each time a new link to the surface is created (for example, copy structure) for proper surface management.
@param[in] surface Valid surface.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxFrameSurfaceInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *AddRef)(mfxFrameSurface1* surface);
/*! @brief
Decrements the internal reference counter of the surface. mfxFrameSurfaceInterface::Release should be called after using the
mfxFrameSurfaceInterface::AddRef function to add a surface or when allocation logic requires it. For example, call
mfxFrameSurfaceInterface::Release to release a surface obtained with the GetSurfaceForXXX function.
@param[in] surface Valid surface.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxFrameSurfaceInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNDEFINED_BEHAVIOR If Reference Counter of surface is zero before call. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *Release)(mfxFrameSurface1* surface);
/*! @brief
Returns current reference counter of mfxFrameSurface1 structure.
@param[in] surface Valid surface.
@param[out] counter Sets counter to the current reference counter value.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface or counter is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxFrameSurfaceInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *GetRefCounter)(mfxFrameSurface1* surface, mfxU32* counter);
/*! @brief
Sets pointers of surface->Info.Data to actual pixel data, providing read-write access.
In case of video memory, the surface with data in video memory becomes mapped to system memory.
An application can map a surface for read access with any value of mfxFrameSurface1::Data::Locked, but can map a surface for write access only when mfxFrameSurface1::Data::Locked equals to 0.
Note: A surface allows shared read access, but exclusive write access. Consider the following cases:
@li Map with Write or Read|Write flags. A request during active another read or write access returns MFX_ERR_LOCK_MEMORY error immediately, without waiting.
MFX_MAP_NOWAIT does not impact behavior. This type of request does not lead to any implicit synchronizations.
@li Map with Read flag. A request during active write access will wait for resource to become free,
or exits immediately with error if MFX_MAP_NOWAIT flag was set. This request may lead to the implicit synchronization (with same logic as Synchronize call)
waiting for surface to become ready to use (all dependencies should be resolved and upstream components finished writing to this surface).
It is guaranteed that read access will be acquired right after synchronization without allowing another thread to acquire this surface for writing.
If MFX_MAP_NOWAIT was set and the surface is not ready yet (for example the surface has unresolved data dependencies or active processing), the read access request exits immediately with error.
Read-write access with MFX_MAP_READ_WRITE provides exclusive simultaneous reading and writing access.
@note Bitwise copying of mfxFrameSurface1 object between map / unmap calls may result in having dangling data pointers in copies.
@param[in] surface Valid surface.
@param[out] flags Specify mapping mode.
@param[out] surface->Info.Data Pointers set to actual pixel data.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxFrameSurfaceInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNSUPPORTED If flags are invalid. \n
MFX_ERR_LOCK_MEMORY If user wants to map the surface for write and surface->Data.Locked does not equal to 0. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *Map)(mfxFrameSurface1* surface, mfxU32 flags);
/*! @brief
Invalidates pointers of surface->Info.Data and sets them to NULL.
In case of video memory, the underlying texture becomes unmapped after last reader or writer unmap.
@param[in] surface Valid surface.
@param[out] surface->Info.Data Pointers set to NULL.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxFrameSurfaceInterface->Context is invalid (for example NULL). \n
MFX_ERR_UNSUPPORTED If surface is already unmapped. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *Unmap)(mfxFrameSurface1* surface);
/*! @brief
Returns a native resource's handle and type. The handle is returned *as-is*, meaning that the reference counter of base resources is not incremented.
The native resource is not detached from surface and the library still owns the resource. User must not destroy
the native resource or assume that the resource will be alive after mfxFrameSurfaceInterface::Release.
@param[in] surface Valid surface.
@param[out] resource Pointer is set to the native handle of the resource.
@param[out] resource_type Type of native resource. See mfxResourceType enumeration).
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If any of surface, resource or resource_type is NULL. \n
MFX_ERR_INVALID_HANDLE If any of surface, resource or resource_type is not valid object (no native resource was allocated). \n
MFX_ERR_UNSUPPORTED If surface is in system memory. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *GetNativeHandle)(mfxFrameSurface1* surface, mfxHDL* resource, mfxResourceType* resource_type);
/*! @brief
Returns a device abstraction that was used to create that resource.
The handle is returned *as-is*, meaning that the reference counter for the device abstraction is not incremented.
The native resource is not detached from the surface and the library still has a reference to the resource.
User must not destroy the device or assume that the device will be alive after mfxFrameSurfaceInterface::Release.
@param[in] surface Valid surface.
@param[out] device_handle Pointer is set to the device which created the resource
@param[out] device_type Type of device (see mfxHandleType enumeration).
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If any of surface, device_handle or device_type is NULL. \n
MFX_ERR_INVALID_HANDLE If any of surface, resource or resource_type is not valid object (no native resource was allocated). \n
MFX_ERR_UNSUPPORTED If surface is in system memory. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *GetDeviceHandle)(mfxFrameSurface1* surface, mfxHDL* device_handle, mfxHandleType* device_type);
/*! @brief
Guarantees readiness of both the data (pixels) and any frame's meta information (for example corruption flags) after a function completes.
Instead of MFXVideoCORE_SyncOperation, users may directly call the mfxFrameSurfaceInterface::Synchronize function after the corresponding
Decode or VPP function calls (MFXVideoDECODE_DecodeFrameAsync or MFXVideoVPP_RunFrameVPPAsync).
The prerequisites to call the functions are:
@li The main processing functions return MFX_ERR_NONE.
@li A valid mfxFrameSurface1 object.
@param[in] surface Valid surface.
@param[out] wait Wait time in milliseconds.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface is NULL. \n
MFX_ERR_INVALID_HANDLE If any of surface is not valid object . \n
MFX_WRN_IN_EXECUTION If the given timeout is expired and the surface is not ready. \n
MFX_ERR_ABORTED If the specified asynchronous function aborted due to data dependency on a previous asynchronous function that did not complete. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *Synchronize)(mfxFrameSurface1* surface, mfxU32 wait);
/*! @brief
The library calls the function after complete of associated video operation
notifying the application that frame surface is ready.
@attention This is callback function and intended to be called by
the library only.
@note The library calls this callback only when this surface is used as the output surface.
It is expected that the function is low-intrusive designed otherwise it may
impact performance.
@param[in] sts The status of completed operation.
*/
void (MFX_CDECL *OnComplete)(mfxStatus sts);
/*! @brief
Returns an interface defined by the GUID. If the returned interface is a reference
counted object the caller should release the obtained interface to avoid memory leaks.
@param[in] surface Valid surface.
@param[in] guid GUID of the requested interface.
@param[out] iface Interface.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If interface or surface is NULL. \n
MFX_ERR_UNSUPPORTED If requested interface is not supported. \n
MFX_ERR_NOT_IMPLEMENTED If requested interface is not implemented. \n
MFX_ERR_NOT_INITIALIZED If requested interface is not available (not created or already deleted). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *QueryInterface)(mfxFrameSurface1* surface, mfxGUID guid, mfxHDL* iface);
#ifdef ONEVPL_EXPERIMENTAL
/*! @brief
If successful returns an exported surface, which is a refcounted object allocated by runtime. It could be exported with or without copy, depending
on export flags and the possibility of such export. Exported surface is valid throughout the session, as long as the original mfxFrameSurface1
object is not closed and the refcount of exported surface is not zero.
@param[in] surface Valid surface.
@param[in] export_header Description of export: caller should fill in SurfaceType (type to export to) and SurfaceFlags (allowed export modes).
@param[out] exported_surface Exported surface, allocated by runtime, user needs to decrement refcount after usage for object release.
After successful export, the value of mfxSurfaceHeader::SurfaceFlags will contain the actual export mode.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If export surface or surface is NULL. \n
MFX_ERR_UNSUPPORTED If requested export is not supported. \n
MFX_ERR_NOT_IMPLEMENTED If requested export is not implemented. \n
MFX_ERR_UNKNOWN Any internal error.
*/
/* For reference with Import flow please search for mfxMemoryInterface::ImportFrameSurface. */
mfxStatus (MFX_CDECL *Export)(mfxFrameSurface1* surface, mfxSurfaceHeader export_header, mfxSurfaceHeader** exported_surface);
mfxHDL reserved2[1];
#else
mfxHDL reserved2[2];
#endif
} mfxFrameSurfaceInterface;
MFX_PACK_END()
/*! The TimeStampCalc enumerator itemizes time-stamp calculation methods. */
enum {
/*! The time stamp calculation is based on the input frame rate if time stamp is not explicitly specified. */
MFX_TIMESTAMPCALC_UNKNOWN = 0,
/*! Adjust time stamp to 29.97fps on 24fps progressively encoded sequences if telecine attributes are available in the bitstream and
time stamp is not explicitly specified. The input frame rate must be specified. */
MFX_TIMESTAMPCALC_TELECINE = 1,
};
/* Transcoding Info */
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Specifies configurations for decoding, encoding, and transcoding processes.
A zero value in any of these fields indicates that the field is not explicitly specified. */
typedef struct {
mfxU32 reserved[7]; /*!< Reserved for future use. */
/*! Hint to enable low power consumption mode for encoders. See the CodingOptionValue enumerator for values
of this option. Use the Query API function to check if this feature is supported. */
mfxU16 LowPower;
/*! Specifies a multiplier for bitrate control parameters. Affects the following variables: InitialDelayInKB, BufferSizeInKB,
TargetKbps, MaxKbps, WinBRCMaxAvgKbps. If this value is not equal to zero, the encoder calculates BRC parameters as ``value * BRCParamMultiplier``. */
mfxU16 BRCParamMultiplier;
mfxFrameInfo FrameInfo; /*!< mfxFrameInfo structure that specifies frame parameters. */
mfxU32 CodecId; /*!< Specifies the codec format identifier in the FourCC code; see the CodecFormatFourCC enumerator for details.
This is a mandated input parameter for the QueryIOSurf and Init API functions. */
mfxU16 CodecProfile; /*!< Specifies the codec profile; see the CodecProfile enumerator for details. Specify the codec profile explicitly or the API functions will determine
the correct profile from other sources, such as resolution and bitrate. */
mfxU16 CodecLevel; /*!< Codec level; see the CodecLevel enumerator for details. Specify the codec level explicitly or the functions will determine the correct level from other sources,
such as resolution and bitrate. */
mfxU16 NumThread;
union {
struct { /* Encoding Options */
mfxU16 TargetUsage; /*!< Target usage model that guides the encoding process; see the TargetUsage enumerator for details. */
/*! Number of pictures within the current GOP (Group of Pictures); if GopPicSize = 0, then the GOP size is unspecified. If GopPicSize = 1, only I-frames are used.
The following pseudo-code that shows how the library uses this parameter:
@code
mfxU16 get_gop_sequence (...) {
pos=display_frame_order;
if (pos == 0)
return MFX_FRAMETYPE_I | MFX_FRAMETYPE_IDR | MFX_FRAMETYPE_REF;
If (GopPicSize == 1) // Only I-frames
return MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;
if (GopPicSize == 0)
frameInGOP = pos; //Unlimited GOP
else
frameInGOP = pos%GopPicSize;
if (frameInGOP == 0)
return MFX_FRAMETYPE_I | MFX_FRAMETYPE_REF;
if (GopRefDist == 1 || GopRefDist == 0) // Only I,P frames
return MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF;
frameInPattern = (frameInGOP-1)%GopRefDist;
if (frameInPattern == GopRefDist - 1)
return MFX_FRAMETYPE_P | MFX_FRAMETYPE_REF;
return MFX_FRAMETYPE_B;
}
@endcode */
mfxU16 GopPicSize;
/*! Distance between I- or P (or GPB) - key frames; if it is zero, the GOP structure is unspecified. Note: If GopRefDist = 1,
there are no regular B-frames used (only P or GPB); if mfxExtCodingOption3::GPB is ON, GPB frames (B without backward
references) are used instead of P. */
mfxU16 GopRefDist;
/*! ORs of the GopOptFlag enumerator indicate the additional flags for the GOP specification. */
mfxU16 GopOptFlag;
/*! For H.264, specifies IDR-frame interval in terms of I-frames.
For example:
@li If IdrInterval = 0, then every I-frame is an IDR-frame.
@li If IdrInterval = 1, then every other I-frame is an IDR-frame.
For HEVC, if IdrInterval = 0, then only first I-frame is an IDR-frame. For example:
@li If IdrInterval = 1, then every I-frame is an IDR-frame.
@li If IdrInterval = 2, then every other I-frame is an IDR-frame.
For MPEG2, IdrInterval defines sequence header interval in terms of I-frames. For example:
@li If IdrInterval = 0 (default), then the sequence header is inserted once at the beginning of the stream.
@li If IdrInterval = N, then the sequence header is inserted before every Nth I-frame.
If GopPicSize or GopRefDist is zero, IdrInterval is undefined. */
mfxU16 IdrInterval;
mfxU16 RateControlMethod; /*! Rate control method; see the RateControlMethod enumerator for details. */
union {
/*! Initial size of the Video Buffering Verifier (VBV) buffer.
@note In this context, KB is 1000 bytes and Kbps is 1000 bps. */
mfxU16 InitialDelayInKB;
/*! Quantization Parameter (QP) for I-frames for constant QP mode (CQP). Zero QP is not valid and means that the default value is assigned by the library.
Non-zero QPI might be clipped to supported QPI range.
@note In the HEVC design, a further adjustment to QPs can occur based on bit depth.
Adjusted QPI value = QPI - (6 * (BitDepthLuma - 8)) for BitDepthLuma in the range [8,14].
For HEVC_MAIN10, we minus (6*(10-8)=12) on our side and continue.
@note In av1 design, valid range is 0 to 255 inclusive, and if QPI=QPP=QPB=0, the encoder is in lossless mode.
@note In vp9 design, valid range is 1 to 255 inclusive, and zero QP that the default value is assigned by the library.
@note Default QPI value is implementation dependent and subject to change without additional notice in this document. */
mfxU16 QPI;
mfxU16 Accuracy; /*!< Specifies accuracy range in the unit of tenth of percent. */
};
mfxU16 BufferSizeInKB; /*!< Represents the maximum possible size of any compressed frames. */
union {
/*! Constant bitrate TargetKbps. Used to estimate the targeted frame size by dividing the frame rate by the bitrate. */
mfxU16 TargetKbps;
/*! Quantization Parameter (QP) for P-frames for constant QP mode (CQP). Zero QP is not valid and means that the default value is assigned by the library.
Non-zero QPP might be clipped to supported QPI range.
@note In the HEVC design, a further adjustment to QPs can occur based on bit depth.
Adjusted QPP value = QPP - (6 * (BitDepthLuma - 8)) for BitDepthLuma in the range [8,14].
For HEVC_MAIN10, we minus (6*(10-8)=12) on our side and continue.
@note In av1 design, valid range is 0 to 255 inclusive, and if QPI=QPP=QPB=0, the encoder is in lossless mode.
@note In vp9 design, valid range is 1 to 255 inclusive, and zero QP that the default value is assigned by the library.
@note Default QPP value is implementation dependent and subject to change without additional notice in this document. */
mfxU16 QPP;
mfxU16 ICQQuality; /*!< Used by the Intelligent Constant Quality (ICQ) bitrate control algorithm. Values are in the 1 to 51 range, where 1 corresponds the best quality. */
};
union {
/*! The maximum bitrate at which the encoded data enters the Video Buffering Verifier (VBV) buffer. */
mfxU16 MaxKbps;
/*! Quantization Parameter (QP) for B-frames for constant QP mode (CQP). Zero QP is not valid and means that the default value is assigned by the library.
Non-zero QPI might be clipped to supported QPB range.
@note In the HEVC design, a further adjustment to QPs can occur based on bit depth.
Adjusted QPB value = QPB - (6 * (BitDepthLuma - 8)) for BitDepthLuma in the range [8,14].
For HEVC_MAIN10, we minus (6*(10-8)=12) on our side and continue.
@note In av1 design, valid range is 0 to 255 inclusive, and if QPI=QPP=QPB=0, the encoder is in lossless mode.
@note Default QPB value is implementation dependent and subject to change without additional notice in this document. */
mfxU16 QPB;
mfxU16 Convergence; /*!< Convergence period in the unit of 100 frames. */
};
/*! Number of slices in each video frame. Each slice contains one or more macro-block rows. If NumSlice equals zero, the encoder may choose any slice partitioning
allowed by the codec standard. See also mfxExtCodingOption2::NumMbPerSlice. */
mfxU16 NumSlice;
/*! Max number of all available reference frames (for AVC/HEVC, NumRefFrame defines DPB size). If NumRefFrame = 0, this parameter is not specified.
See also NumRefActiveP, NumRefActiveBL0, and NumRefActiveBL1 in the mfxExtCodingOption3 structure, which set a number of active references. */
mfxU16 NumRefFrame;
/*! If not zero, specifies that ENCODE takes the input surfaces in the encoded order and uses explicit frame type control.
The application must still provide GopRefDist and mfxExtCodingOption2::BRefType so the library can pack headers and build reference
lists correctly. */
mfxU16 EncodedOrder;
};
struct { /* Decoding Options */
/*! For AVC and HEVC, used to instruct the decoder to return output frames in the decoded order. Must be zero for all other decoders.
When enabled, correctness of mfxFrameData::TimeStamp and FrameOrder for output surface is not guaranteed, the application should ignore them. */
mfxU16 DecodedOrder;
/*! Instructs DECODE to output extended picture structure values for additional display attributes. See the PicStruct description for details. */
mfxU16 ExtendedPicStruct;
/*! Time stamp calculation method. See the TimeStampCalc description for details. */
mfxU16 TimeStampCalc;
/*! Nonzero value indicates that slice groups are present in the bitstream. Used only by AVC decoder. */
mfxU16 SliceGroupsPresent;
/*! Nonzero value specifies the maximum required size of the decoded picture buffer in frames for AVC and HEVC decoders. */
mfxU16 MaxDecFrameBuffering;
/*! For decoders supporting dynamic resolution change (VP9), set this option to ON to allow MFXVideoDECODE_DecodeFrameAsync
return MFX_ERR_REALLOC_SURFACE. See the CodingOptionValue enumerator for values of this option. Use the Query API
function to check if this feature is supported. */
mfxU16 EnableReallocRequest;
/*! Special parameter for AV1 decoder. Indicates presence/absence of film grain parameters in bitstream.
Also controls decoding behavior for streams with film grain parameters. MFXVideoDECODE_DecodeHeader returns nonzero FilmGrain
for streams with film grain parameters and zero for streams w/o them. Decoding with film grain requires additional output surfaces.
If FilmGrain` is non-zero then MFXVideoDECODE_QueryIOSurf will request more surfaces in case of external allocated video memory at decoder output.
FilmGrain is passed to MFXVideoDECODE_Init function to control decoding operation for AV1 streams with film grain parameters.
If FilmGrain is nonzero decoding of each frame require two output surfaces (one for reconstructed frame and one for output frame with film grain applied).
The decoder returns MFX_ERR_MORE_SURFACE from MFXVideoDECODE_DecodeFrameAsync if it has insufficient output surfaces to decode frame.
Application can forcibly disable the feature passing zero value of `FilmGrain` to `MFXVideoDECODE_Init`.
In this case the decoder will output reconstructed frames w/o film grain applied.
Application can retrieve film grain parameters for a frame by attaching extended buffer mfxExtAV1FilmGrainParam to mfxFrameSurface1.
If stream has no film grain parameters `FilmGrain` passed to `MFXVideoDECODE_Init` is ignored by the decoder. */
mfxU16 FilmGrain;
/*! If not zero, it forces SDK to attempt to decode bitstream even if a decoder may not support all features associated with given CodecLevel. Decoder may produce visual artifacts. Only AVC decoder supports this field. */
mfxU16 IgnoreLevelConstrain;
/*! This flag is used to disable output of main decoding channel. When it's ON SkipOutput = MFX_CODINGOPTION_ON decoder outputs only video processed channels. For pure decode this flag should be always disabled. */
mfxU16 SkipOutput;
mfxU16 reserved2[4];
};
struct { /* JPEG Decoding Options */
/*! Specify the chroma sampling format that has been used to encode a JPEG picture. See the ChromaFormat enumerator for details. */
mfxU16 JPEGChromaFormat;
/*! Rotation option of the output JPEG picture. See the Rotation enumerator for details. */
mfxU16 Rotation;
/*! Specify the color format that has been used to encode a JPEG picture. See the JPEGColorFormat enumerator for details. */
mfxU16 JPEGColorFormat;
/*! Specify JPEG scan type for decoder. See the JPEGScanType enumerator for details. */
mfxU16 InterleavedDec;
mfxU8 SamplingFactorH[4]; /*!< Horizontal sampling factor. */
mfxU8 SamplingFactorV[4]; /*!< Vertical sampling factor. */
mfxU16 reserved3[5];
};
struct { /* JPEG Encoding Options */
/*! Specify interleaved or non-interleaved scans. If it is equal to MFX_SCANTYPE_INTERLEAVED then the image is encoded as interleaved,
all components are encoded in one scan. See the JPEG Scan Type enumerator for details. */
mfxU16 Interleaved;
/*! Specifies the image quality if the application does not specified quantization table.
The value is from 1 to 100 inclusive. "100" is the best quality. */
mfxU16 Quality;
/*! Specifies the number of MCU in the restart interval. "0" means no restart interval. */
mfxU16 RestartInterval;
mfxU16 reserved5[10];
};
};
} mfxInfoMFX;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Specifies configurations for video processing. A zero value in any of the fields indicates
that the corresponding field is not explicitly specified. */
typedef struct {
mfxU32 reserved[8];
mfxFrameInfo In; /*!< Input format for video processing. */
mfxFrameInfo Out; /*!< Output format for video processing. */
} mfxInfoVPP;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! Configuration parameters for encoding, decoding, transcoding, and video processing. */
typedef struct {
/*! Unique component ID that will be passed by the library to mfxFrameAllocRequest. Useful in pipelines where several
components of the same type share the same allocator. */
mfxU32 AllocId;
mfxU32 reserved[2];
mfxU16 reserved3;
/*! Specifies how many asynchronous operations an application performs before the application explicitly synchronizes the result.
If zero, the value is not specified. */
mfxU16 AsyncDepth;
union {
mfxInfoMFX mfx; /*!< Configurations related to encoding, decoding, and transcoding. See the definition of the mfxInfoMFX structure for details. */
mfxInfoVPP vpp; /*!< Configurations related to video processing. See the definition of the mfxInfoVPP structure for details. */
};
/*! Specifies the content protection mechanism. See the Protected enumerator for a list of supported protection schemes. */
mfxU16 Protected;
/*! Input and output memory access types for functions. See the enumerator IOPattern for details.
The Query API functions return the natively supported IOPattern if the Query input argument is NULL.
This parameter is a mandated input for QueryIOSurf and Init API functions. The output pattern must be specified for DECODE.
The input pattern must be specified for ENCODE. Both input and output pattern must be specified for VPP. */
mfxU16 IOPattern;
mfxExtBuffer** ExtParam; /*!< Points to an array of pointers to the extra configuration structures. See the ExtendedBufferID enumerator
for a list of extended configurations.
The list of extended buffers should not contain duplicated entries, such as entries of the same type.
If the mfxVideoParam structure is used to query library capability, then the list of extended buffers attached to the input
and output mfxVideoParam structure should be equal, that is, it should contain the same number of extended
buffers of the same type. */
mfxU16 NumExtParam; /*!< The number of extra configuration structures attached to this structure. */
mfxU16 reserved2;
} mfxVideoParam;
MFX_PACK_END()
/*! The IOPattern enumerator itemizes memory access patterns for API functions. Use bit-ORed values to specify an input access
pattern and an output access pattern. */
enum {
MFX_IOPATTERN_IN_VIDEO_MEMORY = 0x01, /*!< Input to functions is a video memory surface. */
MFX_IOPATTERN_IN_SYSTEM_MEMORY = 0x02, /*!< Input to functions is a linear buffer directly in system memory or in system memory through an external allocator. */
MFX_IOPATTERN_OUT_VIDEO_MEMORY = 0x10, /*!< Output to functions is a video memory surface. */
MFX_IOPATTERN_OUT_SYSTEM_MEMORY = 0x20 /*!< Output to functions is a linear buffer directly in system memory or in system memory through an external allocator. */
};
/*! The CodecFormatFourCC enumerator itemizes codecs in the FourCC format. */
enum {
MFX_CODEC_AVC =MFX_MAKEFOURCC('A','V','C',' '), /*!< AVC, H.264, or MPEG-4, part 10 codec. */
MFX_CODEC_HEVC =MFX_MAKEFOURCC('H','E','V','C'), /*!< HEVC codec. */
MFX_CODEC_MPEG2 =MFX_MAKEFOURCC('M','P','G','2'), /*!< MPEG-2 codec. */
MFX_CODEC_VC1 =MFX_MAKEFOURCC('V','C','1',' '), /*!< VC-1 codec. */
MFX_CODEC_CAPTURE =MFX_MAKEFOURCC('C','A','P','T'), /*!< */
MFX_CODEC_VP9 =MFX_MAKEFOURCC('V','P','9',' '), /*!< VP9 codec. */
MFX_CODEC_AV1 =MFX_MAKEFOURCC('A','V','1',' '), /*!< AV1 codec. */
MFX_CODEC_VVC =MFX_MAKEFOURCC('V','V','C',' ') /*!< VVC codec. */
};
/*!
The CodecProfile enumerator itemizes codec profiles for all codecs.
CodecLevel
*/
enum {
MFX_PROFILE_UNKNOWN =0, /*!< Unspecified profile. */
MFX_LEVEL_UNKNOWN =0, /*!< Unspecified level. */
/*! @{ */
/* Combined with H.264 profile these flags impose additional constrains. See H.264 specification for the list of constrains. */
MFX_PROFILE_AVC_CONSTRAINT_SET0 = (0x100 << 0),
MFX_PROFILE_AVC_CONSTRAINT_SET1 = (0x100 << 1),
MFX_PROFILE_AVC_CONSTRAINT_SET2 = (0x100 << 2),
MFX_PROFILE_AVC_CONSTRAINT_SET3 = (0x100 << 3),
MFX_PROFILE_AVC_CONSTRAINT_SET4 = (0x100 << 4),
MFX_PROFILE_AVC_CONSTRAINT_SET5 = (0x100 << 5),
/*! @} */
/*! @{ */
/* H.264 Profiles. */
MFX_PROFILE_AVC_BASELINE =66,
MFX_PROFILE_AVC_MAIN =77,
MFX_PROFILE_AVC_EXTENDED =88,
MFX_PROFILE_AVC_HIGH =100,
MFX_PROFILE_AVC_HIGH10 =110,
MFX_PROFILE_AVC_HIGH_422 =122,
MFX_PROFILE_AVC_CONSTRAINED_BASELINE =MFX_PROFILE_AVC_BASELINE + MFX_PROFILE_AVC_CONSTRAINT_SET1,
MFX_PROFILE_AVC_CONSTRAINED_HIGH =MFX_PROFILE_AVC_HIGH + MFX_PROFILE_AVC_CONSTRAINT_SET4
+ MFX_PROFILE_AVC_CONSTRAINT_SET5,
MFX_PROFILE_AVC_PROGRESSIVE_HIGH =MFX_PROFILE_AVC_HIGH + MFX_PROFILE_AVC_CONSTRAINT_SET4,
/*! @} */
/*! @{ */
/* H.264 level 1-1.3 */
MFX_LEVEL_AVC_1 =10,
MFX_LEVEL_AVC_1b =9,
MFX_LEVEL_AVC_11 =11,
MFX_LEVEL_AVC_12 =12,
MFX_LEVEL_AVC_13 =13,
/*! @} */
/*! @{ */
/* H.264 level 2-2.2 */
MFX_LEVEL_AVC_2 =20,
MFX_LEVEL_AVC_21 =21,
MFX_LEVEL_AVC_22 =22,
/*! @} */
/*! @{ */
/* H.264 level 3-3.2 */
MFX_LEVEL_AVC_3 =30,
MFX_LEVEL_AVC_31 =31,
MFX_LEVEL_AVC_32 =32,
/*! @} */
/*! @{ */
/* H.264 level 4-4.2 */
MFX_LEVEL_AVC_4 =40,
MFX_LEVEL_AVC_41 =41,
MFX_LEVEL_AVC_42 =42,
/*! @} */
/*! @{ */
/* H.264 level 5-5.2 */
MFX_LEVEL_AVC_5 =50,
MFX_LEVEL_AVC_51 =51,
MFX_LEVEL_AVC_52 =52,
/*! @} */
/*! @{ */
/* H.264 level 6-6.2 */
MFX_LEVEL_AVC_6 =60,
MFX_LEVEL_AVC_61 =61,
MFX_LEVEL_AVC_62 =62,
/*! @} */
/*! @{ */
/* MPEG2 Profiles. */
MFX_PROFILE_MPEG2_SIMPLE =0x50,
MFX_PROFILE_MPEG2_MAIN =0x40,
MFX_PROFILE_MPEG2_HIGH =0x10,
/*! @} */
/*! @{ */
/* MPEG2 Levels. */
MFX_LEVEL_MPEG2_LOW =0xA,
MFX_LEVEL_MPEG2_MAIN =0x8,
MFX_LEVEL_MPEG2_HIGH =0x4,
MFX_LEVEL_MPEG2_HIGH1440 =0x6,
/*! @} */
/*! @{ */
/* VC-1 Profiles. */
MFX_PROFILE_VC1_SIMPLE =(0+1),
MFX_PROFILE_VC1_MAIN =(4+1),
MFX_PROFILE_VC1_ADVANCED =(12+1),
/*! @} */
/*! @{ */
/* VC-1 Level Low (simple & main profiles) */
MFX_LEVEL_VC1_LOW =(0+1),
MFX_LEVEL_VC1_MEDIAN =(2+1),
MFX_LEVEL_VC1_HIGH =(4+1),
/*! @} */
/*! @{ */
/* VC-1 advanced profile levels */
MFX_LEVEL_VC1_0 =(0x00+1),
MFX_LEVEL_VC1_1 =(0x01+1),
MFX_LEVEL_VC1_2 =(0x02+1),
MFX_LEVEL_VC1_3 =(0x03+1),
MFX_LEVEL_VC1_4 =(0x04+1),
/*! @} */
/*! @{ */
/* HEVC profiles */
MFX_PROFILE_HEVC_MAIN =1,
MFX_PROFILE_HEVC_MAIN10 =2,
MFX_PROFILE_HEVC_MAINSP =3,
MFX_PROFILE_HEVC_REXT =4,
MFX_PROFILE_HEVC_SCC =9,
/*! @} */
/*! @{ */
/* HEVC levels */
MFX_LEVEL_HEVC_1 = 10,
MFX_LEVEL_HEVC_2 = 20,
MFX_LEVEL_HEVC_21 = 21,
MFX_LEVEL_HEVC_3 = 30,
MFX_LEVEL_HEVC_31 = 31,
MFX_LEVEL_HEVC_4 = 40,
MFX_LEVEL_HEVC_41 = 41,
MFX_LEVEL_HEVC_5 = 50,
MFX_LEVEL_HEVC_51 = 51,
MFX_LEVEL_HEVC_52 = 52,
MFX_LEVEL_HEVC_6 = 60,
MFX_LEVEL_HEVC_61 = 61,
MFX_LEVEL_HEVC_62 = 62,
MFX_LEVEL_HEVC_85 = 85,
/*! @} */
/*! @{ */
/* HEVC tiers */
MFX_TIER_HEVC_MAIN = 0,
MFX_TIER_HEVC_HIGH = 0x100,
/*! @} */
/*! @{ */
/* VP9 Profiles */
MFX_PROFILE_VP9_0 = 1,
MFX_PROFILE_VP9_1 = 2,
MFX_PROFILE_VP9_2 = 3,
MFX_PROFILE_VP9_3 = 4,
/*! @} */
/*! @{ */
/* AV1 Profiles */
MFX_PROFILE_AV1_MAIN = 1,
MFX_PROFILE_AV1_HIGH = 2,
MFX_PROFILE_AV1_PRO = 3,
/*! @} */
/*! @{ */
/* AV1 Levels */
MFX_LEVEL_AV1_2 = 20,
MFX_LEVEL_AV1_21 = 21,
MFX_LEVEL_AV1_22 = 22,
MFX_LEVEL_AV1_23 = 23,
MFX_LEVEL_AV1_3 = 30,
MFX_LEVEL_AV1_31 = 31,
MFX_LEVEL_AV1_32 = 32,
MFX_LEVEL_AV1_33 = 33,
MFX_LEVEL_AV1_4 = 40,
MFX_LEVEL_AV1_41 = 41,
MFX_LEVEL_AV1_42 = 42,
MFX_LEVEL_AV1_43 = 43,
MFX_LEVEL_AV1_5 = 50,
MFX_LEVEL_AV1_51 = 51,
MFX_LEVEL_AV1_52 = 52,
MFX_LEVEL_AV1_53 = 53,
MFX_LEVEL_AV1_6 = 60,
MFX_LEVEL_AV1_61 = 61,
MFX_LEVEL_AV1_62 = 62,
MFX_LEVEL_AV1_63 = 63,
MFX_LEVEL_AV1_7 = 70,
MFX_LEVEL_AV1_71 = 71,
MFX_LEVEL_AV1_72 = 72,
MFX_LEVEL_AV1_73 = 73,
/*! @} */
/*! @{ */
/* VVC Profiles */
MFX_PROFILE_VVC_MAIN10 = 1,
MFX_PROFILE_VVC_MAIN10_STILL_PICTURE = 65,
/*! @} */
/*! @{ */
/* VVC Levels */
MFX_LEVEL_VVC_1 = 16,
MFX_LEVEL_VVC_2 = 32,
MFX_LEVEL_VVC_21 = 35,
MFX_LEVEL_VVC_3 = 48,
MFX_LEVEL_VVC_31 = 51,
MFX_LEVEL_VVC_4 = 64,
MFX_LEVEL_VVC_41 = 67,
MFX_LEVEL_VVC_5 = 80,
MFX_LEVEL_VVC_51 = 83,
MFX_LEVEL_VVC_52 = 86,
MFX_LEVEL_VVC_6 = 96,
MFX_LEVEL_VVC_61 = 99,
MFX_LEVEL_VVC_62 = 102,
MFX_LEVEL_VVC_63 = 105,
MFX_LEVEL_VVC_155 = 255,
/*! @} */
/*! @{ */
/* VVC tiers */
MFX_TIER_VVC_MAIN = 0,
MFX_TIER_VVC_HIGH = 0x100,
/*! @} */
};
/*! The GopOptFlag enumerator itemizes special properties in the GOP (Group of Pictures) sequence. */
enum {
/*!
The encoder generates closed GOP if this flag is set. Frames in this GOP do not use frames in previous GOP as reference.
The encoder generates open GOP if this flag is not set. In this GOP frames prior to the first frame of GOP in display order may use
frames from previous GOP as reference. Frames subsequent to the first frame of GOP in display order do not use frames from previous
GOP as reference.
The AVC encoder ignores this flag if IdrInterval in mfxInfoMFX structure is set to 0, i.e. if every GOP starts from IDR frame.
In this case, GOP is encoded as closed.
This flag does not affect long-term reference frames.
*/
MFX_GOP_CLOSED =1,
/*!
The encoder must strictly follow the given GOP structure as defined by parameter GopPicSize, GopRefDist etc in the mfxVideoParam structure.
Otherwise, the encoder can adapt the GOP structure for better efficiency, whose range is constrained by parameter GopPicSize and
GopRefDist etc. See also description of AdaptiveI and AdaptiveB fields in the mfxExtCodingOption2 structure.
*/
MFX_GOP_STRICT =2
};
/*! The TargetUsage enumerator itemizes a range of numbers from MFX_TARGETUSAGE_1, best quality, to MFX_TARGETUSAGE_7, best speed.
It indicates trade-offs between quality and speed. The application can use any number in the range. The actual number of supported
target usages depends on implementation. If specified target usage is not supported, the encoder will use the closest supported value. */
enum {
MFX_TARGETUSAGE_1 =1, /*!< Best quality */
MFX_TARGETUSAGE_2 =2,
MFX_TARGETUSAGE_3 =3,
MFX_TARGETUSAGE_4 =4, /*!< Balanced quality and speed. */
MFX_TARGETUSAGE_5 =5,
MFX_TARGETUSAGE_6 =6,
MFX_TARGETUSAGE_7 =7, /*!< Best speed */
MFX_TARGETUSAGE_UNKNOWN =0, /*!< Unspecified target usage. */
MFX_TARGETUSAGE_BEST_QUALITY =MFX_TARGETUSAGE_1, /*!< Best quality. */
MFX_TARGETUSAGE_BALANCED =MFX_TARGETUSAGE_4, /*!< Balanced quality and speed. */
MFX_TARGETUSAGE_BEST_SPEED =MFX_TARGETUSAGE_7 /*!< Best speed. */
};
/*! The RateControlMethod enumerator itemizes bitrate control methods. */
enum {
MFX_RATECONTROL_CBR =1, /*!< Use the constant bitrate control algorithm. */
MFX_RATECONTROL_VBR =2, /*!< Use the variable bitrate control algorithm. */
MFX_RATECONTROL_CQP =3, /*!< Use the constant quantization parameter algorithm. */
MFX_RATECONTROL_AVBR =4, /*!< Use the average variable bitrate control algorithm. */
MFX_RATECONTROL_RESERVED1 =5,
MFX_RATECONTROL_RESERVED2 =6,
MFX_RATECONTROL_RESERVED3 =100,
MFX_RATECONTROL_RESERVED4 =7,
/*!
Use the VBR algorithm with look ahead. It is a special bitrate control mode in the AVC encoder that has been designed
to improve encoding quality. It works by performing extensive analysis of several dozen frames before the actual encoding and as a side
effect significantly increases encoding delay and memory consumption.
The only available rate control parameter in this mode is mfxInfoMFX::TargetKbps. Two other parameters, MaxKbps and InitialDelayInKB,
are ignored. To control LA depth the application can use mfxExtCodingOption2::LookAheadDepth parameter.
This method is not HRD compliant.
*/
MFX_RATECONTROL_LA =8,
/*!
Use the Intelligent Constant Quality algorithm. This algorithm improves subjective video quality of encoded stream. Depending on content,
it may or may not decrease objective video quality. Only one control parameter is used - quality factor, specified by mfxInfoMFX::ICQQuality.
*/
MFX_RATECONTROL_ICQ =9,
/*!
Use the Video Conferencing Mode algorithm. This algorithm is similar to the VBR and uses the same set of parameters mfxInfoMFX::InitialDelayInKB,
TargetKbpsandMaxKbps. It is tuned for IPPP GOP pattern and streams with strong temporal correlation between frames.
It produces better objective and subjective video quality in these conditions than other bitrate control algorithms.
It does not support interlaced content, B-frames and produced stream is not HRD compliant.
*/
MFX_RATECONTROL_VCM =10,
/*!
Use Intelligent Constant Quality algorithm with look ahead. Quality factor is specified by mfxInfoMFX::ICQQuality.
To control LA depth the application can use mfxExtCodingOption2::LookAheadDepth parameter.
This method is not HRD compliant.
*/
MFX_RATECONTROL_LA_ICQ =11,
/*!
MFX_RATECONTROL_LA_EXT has been removed
*/
/*! Use HRD compliant look ahead rate control algorithm. */
MFX_RATECONTROL_LA_HRD =13,
/*!
Use the variable bitrate control algorithm with constant quality. This algorithm trying to achieve the target subjective quality with
the minimum number of bits, while the bitrate constraint and HRD compliance are satisfied. It uses the same set of parameters
as VBR and quality factor specified by mfxExtCodingOption3::QVBRQuality.
*/
MFX_RATECONTROL_QVBR =14,
};
/*!
The TrellisControl enumerator is used to control trellis quantization in AVC encoder. The application can turn it on
or off for any combination of I-, P- and B-frames by combining different enumerator values. For example, MFX_TRELLIS_I | MFX_TRELLIS_B
turns it on for I- and B-frames.
@note Due to performance reason on some target usages trellis quantization is always turned off and this control is ignored by the encoder.
*/
enum {
MFX_TRELLIS_UNKNOWN =0, /*!< Default value, it is up to the encoder to turn trellis quantization on or off. */
MFX_TRELLIS_OFF =0x01, /*!< Turn trellis quantization off for all frame types. */
MFX_TRELLIS_I =0x02, /*!< Turn trellis quantization on for I-frames. */
MFX_TRELLIS_P =0x04, /*!< Turn trellis quantization on for P-frames. */
MFX_TRELLIS_B =0x08 /*!< Turn trellis quantization on for B-frames. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Specifies additional options for encoding.
The application can attach this extended buffer to the mfxVideoParam structure to configure initialization.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CODING_OPTION. */
mfxU16 reserved1;
mfxU16 RateDistortionOpt; /*!< Set this flag if rate distortion optimization is needed. See the CodingOptionValue enumerator for values of this option. */
mfxU16 MECostType; /*!< Motion estimation cost type. This value is reserved and must be zero. */
mfxU16 MESearchType; /*!< Motion estimation search algorithm. This value is reserved and must be zero. */
mfxI16Pair MVSearchWindow; /*!< Rectangular size of the search window for motion estimation. This parameter is reserved and must be (0, 0). */
MFX_DEPRECATED mfxU16 EndOfSequence; /* Deprecated */
mfxU16 FramePicture; /*!< Set this flag to encode interlaced fields as interlaced frames. This flag does not affect progressive input frames. See the CodingOptionValue enumerator for values of this option. */
mfxU16 CAVLC; /*!< If set, CAVLC is used; if unset, CABAC is used for encoding. See the CodingOptionValue enumerator for values of this option. */
mfxU16 reserved2[2];
/*!
Set this flag to insert the recovery point SEI message at the beginning of every intra refresh cycle. See the description of
IntRefType in mfxExtCodingOption2 structure for details on how to enable and configure intra refresh.
If intra refresh is not enabled then this flag is ignored.
See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 RecoveryPointSEI;
/*!
Set this flag to instruct the MVC encoder to output each view in separate bitstream buffer. See the CodingOptionValue enumerator
for values of this option and the Multi-View Video Coding section for more details about usage of this flag.
*/
mfxU16 ViewOutput;
/*!
If this option is turned ON, then AVC encoder produces an HRD conformant bitstream. If it is turned OFF, then the AVC encoder may (but not necessarily) violate HRD conformance. That is, this option can force the encoder to produce an HRD conformant stream, but
cannot force it to produce a non-conformant stream.
See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 NalHrdConformance;
/*!
If set, encoder puts all SEI messages in the singe NAL unit. It includes messages provided by application and created
by encoder. It is a three-states option. See CodingOptionValue enumerator for values of this option. The three states are:
@li UNKNOWN Put each SEI in its own NAL unit.
@li ON Put all SEI messages in the same NAL unit.
@li OFF The same as unknown.
*/
mfxU16 SingleSeiNalUnit;
/*!
If set and VBR rate control method is used, then VCL HRD parameters are written in bitstream with values identical to the values of the NAL HRD parameters.
See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 VuiVclHrdParameters;
mfxU16 RefPicListReordering; /*!< Set this flag to activate reference picture list reordering. This value is reserved and must be zero. */
mfxU16 ResetRefList; /*!< Set this flag to reset the reference list to non-IDR I-frames of a GOP sequence. See the CodingOptionValue enumerator for values of this option. */
/*!
Set this flag to write the reference picture marking repetition SEI message into the output bitstream.
See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 RefPicMarkRep;
/*!
Set this flag to instruct the AVC encoder to output bitstreams immediately after the encoder encodes a field,
in the field-encoding mode. See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 FieldOutput;
mfxU16 IntraPredBlockSize; /*!< Minimum block size of intra-prediction. This value is reserved and must be zero. */
mfxU16 InterPredBlockSize; /*!< Minimum block size of inter-prediction. This value is reserved and must be zero. */
mfxU16 MVPrecision; /*!< Specify the motion estimation precision. This parameter is reserved and must be zero. */
mfxU16 MaxDecFrameBuffering; /*!< Specifies the maximum number of frames buffered in a DPB. A value of zero means unspecified. */
mfxU16 AUDelimiter; /*!< Set this flag to insert the Access Unit Delimiter NAL. See the CodingOptionValue enumerator for values of this option. */
MFX_DEPRECATED mfxU16 EndOfStream; /* Deprecated */
/*!
Set this flag to insert the picture timing SEI with pic_struct syntax element. See sub-clauses D.1.2 and D.2.2 of the ISO/IEC 14496-10
specification for the definition of this syntax element. See the CodingOptionValue enumerator for values of this option.
The default value is ON.
*/
mfxU16 PicTimingSEI;
mfxU16 VuiNalHrdParameters; /*!< Set this flag to insert NAL HRD parameters in the VUI header. See the CodingOptionValue enumerator for values of this option. */
} mfxExtCodingOption;
MFX_PACK_END()
/*! The BRefControl enumerator is used to control usage of B-frames as reference in AVC encoder. */
enum {
MFX_B_REF_UNKNOWN = 0, /*!< Default value, it is up to the encoder to use B-frames as reference. */
MFX_B_REF_OFF = 1, /*!< Do not use B-frames as reference. */
MFX_B_REF_PYRAMID = 2 /*!< Arrange B-frames in so-called "B pyramid" reference structure. */
};
/*! The LookAheadDownSampling enumerator is used to control down sampling in look ahead bitrate control mode in AVC encoder. */
enum {
MFX_LOOKAHEAD_DS_UNKNOWN = 0, /*!< Default value, it is up to the encoder what down sampling value to use. */
MFX_LOOKAHEAD_DS_OFF = 1, /*!< Do not use down sampling, perform estimation on original size frames. This is the slowest setting that produces the best quality. */
MFX_LOOKAHEAD_DS_2x = 2, /*!< Down sample frames two times before estimation. */
MFX_LOOKAHEAD_DS_4x = 3 /*!< Down sample frames four times before estimation. This option may significantly degrade quality. */
};
/*! The BPSEIControl enumerator is used to control insertion of buffering period SEI in the encoded bitstream. */
enum {
MFX_BPSEI_DEFAULT = 0x00, /*!< encoder decides when to insert BP SEI. */
MFX_BPSEI_IFRAME = 0x01 /*!< BP SEI should be inserted with every I-frame */
};
/*! The SkipFrame enumerator is used to define usage of mfxEncodeCtrl::SkipFrame parameter. */
enum {
MFX_SKIPFRAME_NO_SKIP = 0, /*!< Frame skipping is disabled, mfxEncodeCtrl::SkipFrame is ignored. */
MFX_SKIPFRAME_INSERT_DUMMY = 1, /*!< Skipping is allowed, when mfxEncodeCtrl::SkipFrame is set encoder inserts into bitstream frame
where all macroblocks are encoded as skipped. Only non-reference P- and B-frames can be skipped.
If GopRefDist = 1 and mfxEncodeCtrl::SkipFrame is set for reference P-frame, it will be encoded
as non-reference. */
MFX_SKIPFRAME_INSERT_NOTHING = 2, /*!< Similar to MFX_SKIPFRAME_INSERT_DUMMY, but when mfxEncodeCtrl::SkipFrame is set encoder inserts nothing into bitstream. */
MFX_SKIPFRAME_BRC_ONLY = 3, /*!< mfxEncodeCtrl::SkipFrame indicates number of missed frames before the current frame. Affects only BRC, current frame will be encoded as usual. */
};
/*! The IntraRefreshTypes enumerator itemizes types of intra refresh. */
enum {
MFX_REFRESH_NO = 0, /*!< Encode without refresh. */
MFX_REFRESH_VERTICAL = 1, /*!< Vertical refresh, by column of MBs. */
MFX_REFRESH_HORIZONTAL = 2, /*!< Horizontal refresh, by rows of MBs. */
MFX_REFRESH_SLICE = 3 /*!< Horizontal refresh by slices without overlapping. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used with the mfxExtCodingOption structure to specify additional options for encoding.
The application can attach this extended buffer to the mfxVideoParam structure to configure initialization and to the mfxEncodeCtrl during runtime.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CODING_OPTION2. */
/*!
Specifies intra refresh type. See the IntraRefreshTypes. The major goal of intra refresh is improvement of error resilience without
significant impact on encoded bitstream size caused by I-frames. The encoder achieves this by encoding part of each frame in the refresh
cycle using intra MBs.
This parameter is valid during initialization and
runtime. When used with temporal scalability, intra refresh applied only to base layer.
MFX_REFRESH_NO No refresh.
MFX_REFRESH_VERTICAL Vertical refresh, by column of MBs.
MFX_REFRESH_HORIZONTAL Horizontal refresh, by rows of MBs.
MFX_REFRESH_SLICE Horizontal refresh by slices without overlapping.
MFX_REFRESH_SLICE Library ignores IntRefCycleSize (size of refresh cycle equals number slices).
*/
mfxU16 IntRefType;
/*!
Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are invalid values. This parameter is valid only during initialization.
*/
mfxU16 IntRefCycleSize;
/*!
Specifies QP difference for inserted intra MBs. Signed values are in the -51 to 51 range. This parameter is valid during initialization and runtime.
*/
mfxI16 IntRefQPDelta;
/*!
Specify maximum encoded frame size in byte. This parameter is used in VBR based bitrate control modes and ignored in others.
The encoder tries to keep frame size below specified limit but minor overshoots are possible to preserve visual quality.
This parameter is valid during initialization and runtime. It is recommended to set MaxFrameSize to 5x-10x target frame size
((TargetKbps*1000)/(8* FrameRateExtN/FrameRateExtD)) for I-frames and 2x-4x target frame size for P- and B-frames.
*/
mfxU32 MaxFrameSize;
/*!
Specify maximum slice size in bytes. If this parameter is specified other controls over number of slices are ignored.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.
*/
mfxU32 MaxSliceSize;
/*!
Modifies bitrate to be in the range imposed by the encoder. The default value is ON, that is, bitrate is limited. Setting this flag to OFF may lead to violation of HRD conformance.Specifying bitrate below the encoder range might significantly affect quality.
If set to ON, this option takes effect in non CQP modes:
if TargetKbps is not in the range imposed by the encoder, it will be changed to be in the range.
This parameter is valid only during initialization. Flag works with MFX_CODEC_AVC only, it is ignored with other codecs.
See the CodingOptionValue
enumerator for values of this option.
@deprecated Deprecated in API version 2.9
*/
MFX_DEPRECATED mfxU16 BitrateLimit; /* Deprecated */
/*!
Setting this flag enables macroblock level bitrate control that generally improves subjective visual quality. Enabling this flag may
have negative impact on performance and objective visual quality metric. See the CodingOptionValue enumerator for values of this option.
The default value depends on target usage settings.
*/
mfxU16 MBBRC;
/*!
Set this option to ON to enable external BRC. See the CodingOptionValue enumerator for values of this option.
Use the Query API function to check if this feature is supported.
*/
mfxU16 ExtBRC;
/*!
Specifies the depth of the look ahead rate control algorithm. The depth value is the number of frames that the encoder analyzes before encoding. Values are in the 10 to 100 range, inclusive.
To instruct the encoder to use the default value the application should zero this field.
*/
mfxU16 LookAheadDepth;
/*!
Used to control trellis quantization in AVC encoder. See TrellisControl enumerator for values of this option.
This parameter is valid only during initialization.
*/
mfxU16 Trellis;
/*!
Controls picture parameter set repetition in AVC encoder. Set this flag to ON to repeat PPS with each frame.
See the CodingOptionValue enumerator for values of this option. The default value is ON. This parameter is valid only during initialization.
*/
mfxU16 RepeatPPS;
/*!
Controls usage of B-frames as reference. See BRefControl enumerator for values of this option.
This parameter is valid only during initialization.
*/
mfxU16 BRefType;
/*!
Controls insertion of I-frames by the encoder. Set this flag to ON to allow changing of frame type from P and B to I.
This option is ignored if GopOptFlag in mfxInfoMFX structure is equal to MFX_GOP_STRICT. See the CodingOptionValue enumerator
for values of this option. This parameter is valid only during initialization.
*/
mfxU16 AdaptiveI;
/*!
Controls changing of frame type from B to P. Set this flag to ON enable changing of frame type from B to P. This option is ignored if
GopOptFlag in mfxInfoMFX structure is equal to MFX_GOP_STRICT. See the CodingOptionValue enumerator for values of this option.
This parameter is valid only during initialization.
*/
mfxU16 AdaptiveB;
/*!
Controls down sampling in look ahead bitrate control mode. See LookAheadDownSampling enumerator for values
of this option. This parameter is valid only during initialization.
*/
mfxU16 LookAheadDS;
/*!
Specifies suggested slice size in number of macroblocks. The library can adjust this number based on platform capability.
If this option is specified, that is, if it is not equal to zero, the library ignores mfxInfoMFX::NumSlice parameter.
*/
mfxU16 NumMbPerSlice;
/*!
Enables usage of mfxEncodeCtrl::SkipFrame parameter. See the SkipFrame enumerator for values of this option.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.
*/
mfxU16 SkipFrame;
mfxU8 MinQPI; /*!< Minimum allowed QP value for I-frame types. Valid range varies with the codec. Zero means default value, that is, no limitations on QP.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported. */
mfxU8 MaxQPI; /*!< Maximum allowed QP value for I-frame types. Valid range varies with the codec. Zero means default value, that is, no limitations on QP.
@note In the HEVC design, a further adjustment to QPs can occur based on bit depth.
Adjusted MaxQPI value = 51 + (6 * (BitDepthLuma - 8)) for BitDepthLuma in the range [8,14].
For HEVC_MAIN10, we add (6*(10-8)=12) on our side for MaxQPI will reach 63.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported. */
mfxU8 MinQPP; /*!< Minimum allowed QP value for P-frame types. Valid range varies with the codec. Zero means default value, that is, no limitations on QP.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported. */
mfxU8 MaxQPP; /*!< Maximum allowed QP value for P-frame types. Valid range varies with the codec. Zero means default value, that is, no limitations on QP.
@note In the HEVC design, a further adjustment to QPs can occur based on bit depth.
Adjusted MaxQPP value = 51 + (6 * (BitDepthLuma - 8)) for BitDepthLuma in the range [8,14].
For HEVC_MAIN10, we add (6*(10-8)=12) on our side for MaxQPP will reach 63.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported. */
mfxU8 MinQPB; /*!< Minimum allowed QP value for B-frame types. Valid range varies with the codec. Zero means default value, that is, no limitations on QP.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported. */
mfxU8 MaxQPB; /*!< Maximum allowed QP value for B-frame types. Valid range varies with the codec. Zero means default value, that is, no limitations on QP.
@note In the HEVC design, a further adjustment to QPs can occur based on bit depth.
Adjusted MaxQPB value = 51 + (6 * (BitDepthLuma - 8)) for BitDepthLuma in the range [8,14].
For HEVC_MAIN10, we add (6*(10-8)=12) on our side for MaxQPB will reach 63.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported. */
/*!
Sets fixed_frame_rate_flag in VUI.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.
*/
mfxU16 FixedFrameRate;
/*! Disables deblocking.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.
*/
mfxU16 DisableDeblockingIdc;
/*!
Completely disables VUI in the output bitstream.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.
*/
mfxU16 DisableVUI;
/*!
Controls insertion of buffering period SEI in the encoded bitstream. It should be one of the following values:
MFX_BPSEI_DEFAULT Encoder decides when to insert BP SEI,
MFX_BPSEI_IFRAME BP SEI should be inserted with every I-frame.
*/
mfxU16 BufferingPeriodSEI;
/*!
Set this flag to ON to enable per-frame reporting of Mean Absolute Difference. This parameter is valid only during initialization.
*/
mfxU16 EnableMAD;
/*!
Set this flag to ON to use raw frames for reference instead of reconstructed frames. This parameter is valid during
initialization and runtime (only if was turned ON during initialization).
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.
*/
mfxU16 UseRawRef;
} mfxExtCodingOption2;
MFX_PACK_END()
/*! The WeightedPred enumerator itemizes weighted prediction modes. */
enum {
MFX_WEIGHTED_PRED_UNKNOWN = 0, /*!< Allow encoder to decide. */
MFX_WEIGHTED_PRED_DEFAULT = 1, /*!< Use default weighted prediction. */
MFX_WEIGHTED_PRED_EXPLICIT = 2, /*!< Use explicit weighted prediction. */
MFX_WEIGHTED_PRED_IMPLICIT = 3 /*!< Use implicit weighted prediction (for B-frames only). */
};
/*! The ScenarioInfo enumerator itemizes scenarios for the encoding session. */
enum {
MFX_SCENARIO_UNKNOWN = 0,
MFX_SCENARIO_DISPLAY_REMOTING = 1,
MFX_SCENARIO_VIDEO_CONFERENCE = 2,
MFX_SCENARIO_ARCHIVE = 3,
MFX_SCENARIO_LIVE_STREAMING = 4,
MFX_SCENARIO_CAMERA_CAPTURE = 5,
MFX_SCENARIO_VIDEO_SURVEILLANCE = 6,
MFX_SCENARIO_GAME_STREAMING = 7,
MFX_SCENARIO_REMOTE_GAMING = 8
};
/*! The ContentInfo enumerator itemizes content types for the encoding session. */
enum {
MFX_CONTENT_UNKNOWN = 0,
MFX_CONTENT_FULL_SCREEN_VIDEO = 1,
MFX_CONTENT_NON_VIDEO_SCREEN = 2,
MFX_CONTENT_NOISY_VIDEO = 3
};
/*! The PRefType enumerator itemizes models of reference list construction and DPB management when GopRefDist=1. */
enum {
MFX_P_REF_DEFAULT = 0, /*!< Allow encoder to decide. */
MFX_P_REF_SIMPLE = 1, /*!< Regular sliding window used for DPB removal process. */
MFX_P_REF_PYRAMID = 2 /*!< Let N be the max reference list's size. Encoder treats each N's frame as a 'strong'
reference and the others as 'weak' references. The encoder uses a 'weak' reference only for
prediction of the next frame and removes it from DPB immediately after use. 'Strong' references are removed from
DPB by a sliding window. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used with mfxExtCodingOption and mfxExtCodingOption2 structures to specify additional options for encoding.
The application can attach this extended buffer to the mfxVideoParam structure to configure initialization and to the mfxEncodeCtrl during runtime.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CODING_OPTION3. */
mfxU16 NumSliceI; /*!< The number of slices for I-frames.
@note Not all codecs and implementations support these values. Use the Query API function to check if this feature is supported */
mfxU16 NumSliceP; /*!< The number of slices for P-frames.
@note Not all codecs and implementations support these values. Use the Query API function to check if this feature is supported */
mfxU16 NumSliceB; /*!< The number of slices for B-frames.
@note Not all codecs and implementations support these values. Use the Query API function to check if this feature is supported */
/*!
When rate control method is MFX_RATECONTROL_CBR, MFX_RATECONTROL_VBR, MFX_RATECONTROL_LA, MFX_RATECONTROL_LA_HRD, or MFX_RATECONTROL_QVBR
this parameter specifies the maximum bitrate averaged over a sliding window specified by WinBRCSize.
*/
mfxU16 WinBRCMaxAvgKbps;
/*!
When rate control method is MFX_RATECONTROL_CBR, MFX_RATECONTROL_VBR, MFX_RATECONTROL_LA, MFX_RATECONTROL_LA_HRD, or MFX_RATECONTROL_QVBR
this parameter specifies sliding window size in frames. Set WinBRCMaxAvgKbps and WinBRCSize to zero to disable sliding window.
*/
mfxU16 WinBRCSize;
/*! When rate control method is MFX_RATECONTROL_QVBR, this parameter specifies quality factor.
Values are in the 1 to 51 range, where 1 corresponds to the best quality.
*/
mfxU16 QVBRQuality;
/*!
Set this flag to ON to enable per-macroblock QP control. Rate control method must be MFX_RATECONTROL_CQP. See the CodingOptionValue
enumerator for values of this option. This parameter is valid only during initialization.
*/
mfxU16 EnableMBQP;
/*!
Distance between the beginnings of the intra-refresh cycles in frames. Zero means no distance between cycles.
*/
mfxU16 IntRefCycleDist;
/*!
Set this flag to ON to enable the ENC mode decision algorithm to bias to fewer B Direct/Skip types. Applies only to B-frames,
all other frames will ignore this setting. See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 DirectBiasAdjustment;
/*!
Enables global motion bias. See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 GlobalMotionBiasAdjustment;
/*!
Values are:
@li 0: Set MV cost to be 0.
@li 1: Scale MV cost to be 1/2 of the default value.
@li 2: Scale MV cost to be 1/4 of the default value.
@li 3: Scale MV cost to be 1/8 of the default value.
*/
mfxU16 MVCostScalingFactor;
/*!
Set this flag to ON to enable usage of mfxExtMBDisableSkipMap. See the CodingOptionValue enumerator for values of this option.
This parameter is valid only during initialization.
*/
mfxU16 MBDisableSkipMap;
mfxU16 WeightedPred; /*!< Weighted prediction mode. See the WeightedPred enumerator for values of these options. */
mfxU16 WeightedBiPred; /*!< Weighted prediction mode. See the WeightedPred enumerator for values of these options. */
/*!
Instructs encoder whether aspect ratio info should present in VUI parameters. See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 AspectRatioInfoPresent;
/*!
Instructs encoder whether overscan info should present in VUI parameters. See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 OverscanInfoPresent;
/*!
ON indicates that the cropped decoded pictures output are suitable for display using overscan. OFF indicates that the cropped decoded
pictures output contain visually important information in the entire region out to the edges of the cropping rectangle of the picture.
See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 OverscanAppropriate;
/*!
Instructs encoder whether frame rate info should present in VUI parameters. See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 TimingInfoPresent;
/*!
Instructs encoder whether bitstream restriction info should present in VUI parameters. See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 BitstreamRestriction;
/*!
Corresponds to AVC syntax element low_delay_hrd_flag (VUI). See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 LowDelayHrd;
/*!
When set to OFF, no sample outside the picture boundaries and no sample at a fractional sample position for which the sample value
is derived using one or more samples outside the picture boundaries is used for inter prediction of any sample.
When set to ON, one or more samples outside picture boundaries may be used in inter prediction.
See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 MotionVectorsOverPicBoundaries;
mfxU16 reserved1[2];
mfxU16 ScenarioInfo; /*!< Provides a hint to encoder about the scenario for the encoding session. See the ScenarioInfo enumerator for values of this option. */
mfxU16 ContentInfo; /*!< Provides a hint to encoder about the content for the encoding session. See the ContentInfo enumerator for values of this option. */
mfxU16 PRefType; /*!< When GopRefDist=1, specifies the model of reference list construction and DPB management. See the PRefType enumerator for values of this option. */
/*!
Instructs encoder whether internal fade detection algorithm should be used for calculation of weigh/offset values for pred_weight_table
unless application provided mfxExtPredWeightTable for this frame. See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 FadeDetection;
mfxU16 reserved2[2];
/*!
Set this flag to OFF to make HEVC encoder use regular P-frames instead of GPB. See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 GPB;
/*!
Same as mfxExtCodingOption2::MaxFrameSize but affects only I-frames. MaxFrameSizeI must be set if MaxFrameSizeP is set.
If MaxFrameSizeI is not specified or greater than spec limitation, spec limitation will be applied to the sizes of I-frames.
*/
mfxU32 MaxFrameSizeI;
/*!
Same as mfxExtCodingOption2::MaxFrameSize but affects only P/B-frames. If MaxFrameSizeP equals 0, the library sets MaxFrameSizeP
equal to MaxFrameSizeI. If MaxFrameSizeP is not specified or greater than spec limitation, spec limitation will be applied to the
sizes of P/B-frames.
*/
mfxU32 MaxFrameSizeP;
mfxU32 reserved3[3];
/*!
Enables QPOffset control. See the CodingOptionValue enumerator for values of this option.
*/
mfxU16 EnableQPOffset;
/*!
Specifies QP offset per pyramid layer when EnableQPOffset is set to ON and RateControlMethod is CQP.
For B-pyramid, B-frame QP = QPB + QPOffset[layer].
For P-pyramid, P-frame QP = QPP + QPOffset[layer].
*/
mfxI16 QPOffset[8]; /* FrameQP = QPX + QPOffset[pyramid_layer]; QPX = QPB for B-pyramid, QPP for P-pyramid */
mfxU16 NumRefActiveP[8]; /*!< Max number of active references for P-frames. Array index is pyramid layer. */
mfxU16 NumRefActiveBL0[8]; /*!< Max number of active references for B-frames in reference picture list 0. Array index is pyramid layer. */
mfxU16 NumRefActiveBL1[8]; /*!< Max number of active references for B-frames in reference picture list 1. Array index is pyramid layer. */
mfxU16 reserved6;
/*!
For HEVC if this option is turned ON, the transform_skip_enabled_flag will be set to 1 in PPS. OFF specifies that transform_skip_enabled_flag will be set to 0.
*/
mfxU16 TransformSkip;
/*!
Minus 1 specifies target encoding chroma format (see ChromaFormatIdc enumerator). May differ from the source format.
TargetChromaFormatPlus1 = 0 specifies the default target chroma format which is equal to source (mfxVideoParam::mfx::FrameInfo::ChromaFormat + 1),
except RGB4 source format. In case of RGB4 source format default target , chroma format is 4:2:0 (instead of 4:4:4)
for the purpose of backward compatibility.
*/
mfxU16 TargetChromaFormatPlus1;
/*!
Target encoding bit-depth for luma samples. May differ from source bit-depth. 0 specifies a default target bit-depth that is equal to
source (mfxVideoParam::mfx::FrameInfo::BitDepthLuma).
*/
mfxU16 TargetBitDepthLuma;
/*!
Target encoding bit-depth for chroma samples. May differ from source bit-depth. 0 specifies a default target bit-depth that is equal to
source (mfxVideoParam::mfx::FrameInfo::BitDepthChroma).
*/
mfxU16 TargetBitDepthChroma;
mfxU16 BRCPanicMode; /*!< Controls panic mode in AVC and MPEG2 encoders. */
/*!
When rate control method is MFX_RATECONTROL_VBR, MFX_RATECONTROL_QVBR or MFX_RATECONTROL_VCM this parameter specifies frame size
tolerance. Set this parameter to MFX_CODINGOPTION_ON to allow strictly obey average frame size set by MaxKbps, for example cases when
MaxFrameSize == (MaxKbps*1000)/(8* FrameRateExtN/FrameRateExtD). Also MaxFrameSizeI and MaxFrameSizeP can be set separately.
*/
mfxU16 LowDelayBRC;
/*!
Set this flag to ON to enable usage of mfxExtMBForceIntra for AVC encoder. See the CodingOptionValue enumerator
for values of this option. This parameter is valid only during initialization.
*/
mfxU16 EnableMBForceIntra;
/*!
If this flag is set to ON, BRC may decide a larger P- or B-frame size than what MaxFrameSizeP dictates when the scene change is detected.
It may benefit the video quality. AdaptiveMaxFrameSize feature is not supported with LowPower ON or if the value of MaxFrameSizeP = 0.
*/
mfxU16 AdaptiveMaxFrameSize;
/*!
Controls AVC encoder attempts to predict from small partitions. Default value allows encoder to choose preferred mode.
MFX_CODINGOPTION_ON forces encoder to favor quality and MFX_CODINGOPTION_OFF forces encoder to favor performance.
*/
mfxU16 RepartitionCheckEnable;
mfxU16 reserved5[3];
mfxU16 EncodedUnitsInfo; /*!< Set this flag to ON to make encoded units info available in mfxExtEncodedUnitsInfo. */
/*!
If this flag is set to ON, the HEVC encoder uses the NAL unit type provided by the application in the mfxEncodeCtrl::MfxNalUnitType field.
This parameter is valid only during initialization.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.
*/
mfxU16 EnableNalUnitType;
union {
MFX_DEPRECATED mfxU16 ExtBrcAdaptiveLTR; /* Deprecated */
/*!
If this flag is set to ON, encoder will mark, modify, or remove LTR frames based on encoding parameters and content
properties. Turn OFF to prevent Adaptive marking of Long Term Reference Frames.
*/
mfxU16 AdaptiveLTR;
};
/*!
If this flag is set to ON, encoder adaptively selects one of implementation-defined quantization matrices for each frame.
Non-default quantization matrices aim to improve subjective visual quality under certain conditions.
Their number and definitions are API implementation specific.
If this flag is set to OFF, default quantization matrix is used for all frames.
This parameter is valid only during initialization.
*/
mfxU16 AdaptiveCQM;
/*!
If this flag is set to ON, encoder adaptively selects list of reference frames to improve encoding quality.
Enabling of the flag can increase computation complexity and introduce additional delay.
If this flag is set to OFF, regular reference frames are used for encoding.
*/
mfxU16 AdaptiveRef;
mfxU16 reserved[161];
} mfxExtCodingOption3;
MFX_PACK_END()
/*! IntraPredBlockSize/InterPredBlockSize specifies the minimum block size of inter-prediction. */
enum {
MFX_BLOCKSIZE_UNKNOWN = 0, /*!< Unspecified. */
MFX_BLOCKSIZE_MIN_16X16 = 1, /*!< 16x16 minimum block size. */
MFX_BLOCKSIZE_MIN_8X8 = 2, /*!< 8x8 minimum block size. May be 16x16 or 8x8. */
MFX_BLOCKSIZE_MIN_4X4 = 3 /*!< 4x4 minimum block size. May be 16x16, 8x8, or 4x4. */
};
/*! The MVPrecision enumerator specifies the motion estimation precision. */
enum {
MFX_MVPRECISION_UNKNOWN = 0,
MFX_MVPRECISION_INTEGER = (1 << 0),
MFX_MVPRECISION_HALFPEL = (1 << 1),
MFX_MVPRECISION_QUARTERPEL = (1 << 2)
};
/*! The CodingOptionValue enumerator defines a three-state coding option setting. */
enum {
MFX_CODINGOPTION_UNKNOWN =0, /*!< Unspecified. */
MFX_CODINGOPTION_ON =0x10, /*!< Coding option set. */
MFX_CODINGOPTION_OFF =0x20, /*!< Coding option not set. */
MFX_CODINGOPTION_ADAPTIVE =0x30 /*!< Reserved. */
};
/*! The BitstreamDataFlag enumerator uses bit-ORed values to itemize additional information about the bitstream buffer. */
enum {
MFX_BITSTREAM_NO_FLAG = 0x0000, /*!< The bitstream doesn't contain any flags. */
/*!
The bitstream buffer contains a complete frame or complementary field pair of data for the bitstream. For decoding, this means
that the decoder can proceed with this buffer without waiting for the start of the next frame, which effectively reduces decoding latency.
If this flag is set, but the bitstream buffer contains incomplete frame or pair of field, then decoder will produce corrupted output.
*/
MFX_BITSTREAM_COMPLETE_FRAME = 0x0001,
/*!
The bitstream buffer contains the end of the stream. For decoding,
this means that the application does not have any additional bitstream data to send to decoder.
*/
MFX_BITSTREAM_EOS = 0x0002
};
/*! The ExtendedBufferID enumerator itemizes and defines identifiers (BufferId) for extended buffers or video processing algorithm identifiers. */
enum {
/*!
This extended buffer defines additional encoding controls. See the mfxExtCodingOption structure for details.
The application can attach this buffer to the structure for encoding initialization.
*/
MFX_EXTBUFF_CODING_OPTION = MFX_MAKEFOURCC('C','D','O','P'),
/*!
This extended buffer defines sequence header and picture header for encoders and decoders. See the mfxExtCodingOptionSPSPPS
structure for details. The application can attach this buffer to the mfxVideoParam structure for encoding initialization,
and for obtaining raw headers from the decoders and encoders.
*/
MFX_EXTBUFF_CODING_OPTION_SPSPPS = MFX_MAKEFOURCC('C','O','S','P'),
/*!
This extended buffer defines a list of VPP algorithms that applications should not use. See the mfxExtVPPDoNotUse structure
for details. The application can attach this buffer to the mfxVideoParam structure for video processing initialization.
*/
MFX_EXTBUFF_VPP_DONOTUSE = MFX_MAKEFOURCC('N','U','S','E'),
/*!
This extended buffer defines auxiliary information at the VPP output. See the mfxExtVppAuxData structure for details. The application
can attach this buffer to the mfxEncodeCtrl structure for per-frame encoding control.
*/
MFX_EXTBUFF_VPP_AUXDATA = MFX_MAKEFOURCC('A','U','X','D'),
/*!
The extended buffer defines control parameters for the VPP denoise filter algorithm. See the mfxExtVPPDenoise2 structure for details.
The application can attach this buffer to the mfxVideoParam structure for video processing initialization.
*/
MFX_EXTBUFF_VPP_DENOISE2 = MFX_MAKEFOURCC('D','N','I','2'),
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_VPP_DENOISE) = MFX_MAKEFOURCC('D','N','I','S'), /*!< Deprecated in 2.2 API version.*/
MFX_EXTBUFF_VPP_SCENE_ANALYSIS = MFX_MAKEFOURCC('S','C','L','Y'), /*!< Reserved for future use. */
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_VPP_SCENE_CHANGE) = MFX_EXTBUFF_VPP_SCENE_ANALYSIS, /* Deprecated. */
/*!
The extended buffer defines control parameters for the VPP ProcAmp filter algorithm. See the mfxExtVPPProcAmp structure for details.
The application can attach this buffer to the mfxVideoParam structure for video processing initialization or to the mfxFrameData
structure in the mfxFrameSurface1 structure of output surface for per-frame processing configuration.
*/
MFX_EXTBUFF_VPP_PROCAMP = MFX_MAKEFOURCC('P','A','M','P'),
/*!
The extended buffer defines control parameters for the VPP detail filter algorithm. See the mfxExtVPPDetail structure for details.
The application can attach this buffer to the structure for video processing initialization.
*/
MFX_EXTBUFF_VPP_DETAIL = MFX_MAKEFOURCC('D','E','T',' '),
/*!
This extended buffer defines video signal type. See the mfxExtVideoSignalInfo structure for details. The application can attach this
buffer to the mfxVideoParam structure for encoding initialization, and for retrieving such information from the decoders. If video
signal info changes per frame, the application can attach this buffer to the mfxFrameData structure for video processing.
*/
MFX_EXTBUFF_VIDEO_SIGNAL_INFO = MFX_MAKEFOURCC('V','S','I','N'),
/*!
This extended buffer defines video signal type. See the mfxExtVideoSignalInfo structure for details. The application can attach this
buffer to the mfxVideoParam structure for the input of video processing if the input video signal information changes in sequence
base.
*/
MFX_EXTBUFF_VIDEO_SIGNAL_INFO_IN = MFX_MAKEFOURCC('V','S','I','I'),
/*!
This extended buffer defines video signal type. See the mfxExtVideoSignalInfo structure for details. The application can attach this
buffer to the mfxVideoParam structure for the output of video processing if the output video signal information changes in sequence
base.
*/
MFX_EXTBUFF_VIDEO_SIGNAL_INFO_OUT = MFX_MAKEFOURCC('V','S','I','O'),
/*!
This extended buffer defines a list of VPP algorithms that applications should use. See the mfxExtVPPDoUse structure for details.
The application can attach this buffer to the structure for video processing initialization.
*/
MFX_EXTBUFF_VPP_DOUSE = MFX_MAKEFOURCC('D','U','S','E'),
/*!
This extended buffer defines additional encoding controls for reference list. See the mfxExtAVCRefListCtrl structure for details.
The application can attach this buffer to the mfxVideoParam structure for encoding & decoding initialization, or the mfxEncodeCtrl
structure for per-frame encoding configuration.
*/
MFX_EXTBUFF_AVC_REFLIST_CTRL = MFX_MAKEFOURCC('R','L','S','T'),
/*!
This extended buffer defines control parameters for the VPP frame rate conversion algorithm. See the mfxExtVPPFrameRateConversion structure
for details. The application can attach this buffer to the mfxVideoParam structure for video processing initialization.
*/
MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION = MFX_MAKEFOURCC('F','R','C',' '),
/*!
This extended buffer configures the H.264 picture timing SEI message. See the mfxExtPictureTimingSEI structure for details.
The application can attach this buffer to the mfxVideoParam structure for encoding initialization, or the mfxEncodeCtrl structure
for per-frame encoding configuration.
*/
MFX_EXTBUFF_PICTURE_TIMING_SEI = MFX_MAKEFOURCC('P','T','S','E'),
/*!
This extended buffer configures the structure of temporal layers inside the encoded H.264 bitstream. See the mfxExtAvcTemporalLayers
structure for details. The application can attach this buffer to the mfxVideoParam structure for encoding initialization.
*/
MFX_EXTBUFF_AVC_TEMPORAL_LAYERS = MFX_MAKEFOURCC('A','T','M','L'),
/*!
This extended buffer defines additional encoding controls. See the mfxExtCodingOption2 structure for details.
The application can attach this buffer to the structure for encoding initialization.
*/
MFX_EXTBUFF_CODING_OPTION2 = MFX_MAKEFOURCC('C','D','O','2'),
/*!
This extended buffer defines control parameters for the VPP image stabilization filter algorithm. See the mfxExtVPPImageStab structure
for details. The application can attach this buffer to the mfxVideoParam structure for video processing initialization.
*/
MFX_EXTBUFF_VPP_IMAGE_STABILIZATION = MFX_MAKEFOURCC('I','S','T','B'),
/*!
This extended buffer is used to retrieve encoder capability. See the mfxExtEncoderCapability structure for details.
The application can attach this buffer to the mfxVideoParam structure before calling MFXVideoENCODE_Query function.
*/
MFX_EXTBUFF_ENCODER_CAPABILITY = MFX_MAKEFOURCC('E','N','C','P'),
/*!
This extended buffer is used to control encoder reset behavior and also to query possible encoder reset outcome.
See the mfxExtEncoderResetOption structure for details. The application can attach this buffer to the mfxVideoParam structure
before calling MFXVideoENCODE_Query or MFXVideoENCODE_Reset functions.
*/
MFX_EXTBUFF_ENCODER_RESET_OPTION = MFX_MAKEFOURCC('E','N','R','O'),
/*!
This extended buffer is used by the encoder to report additional information about encoded picture.
See the mfxExtAVCEncodedFrameInfo structure for details. The application can attach this buffer to the mfxBitstream structure
before calling MFXVideoENCODE_EncodeFrameAsync function.
*/
MFX_EXTBUFF_ENCODED_FRAME_INFO = MFX_MAKEFOURCC('E','N','F','I'),
/*!
This extended buffer is used to control composition of several input surfaces in the one output. In this mode,
the VPP skips any other filters. The VPP returns error if any mandatory filter is specified and filter skipped warning
for optional filter. The only supported filters are deinterlacing and interlaced scaling.
*/
MFX_EXTBUFF_VPP_COMPOSITE = MFX_MAKEFOURCC('V','C','M','P'),
/*!
This extended buffer is used to control transfer matrix and nominal range of YUV frames.
The application should provide it during initialization.
*/
MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO = MFX_MAKEFOURCC('V','V','S','I'),
/*!
This extended buffer is used by the application to specify different Region Of Interests during encoding.
The application should provide it at initialization or at runtime.
*/
MFX_EXTBUFF_ENCODER_ROI = MFX_MAKEFOURCC('E','R','O','I'),
/*!
This extended buffer is used by the application to specify different deinterlacing algorithms.
*/
MFX_EXTBUFF_VPP_DEINTERLACING = MFX_MAKEFOURCC('V','P','D','I'),
/*!
This extended buffer specifies reference lists for the encoder.
*/
MFX_EXTBUFF_AVC_REFLISTS = MFX_MAKEFOURCC('R','L','T','S'),
/*!
See the mfxExtDecVideoProcessing structure for details.
*/
MFX_EXTBUFF_DEC_VIDEO_PROCESSING = MFX_MAKEFOURCC('D','E','C','V'),
/*!
The extended buffer defines control parameters for the VPP field-processing algorithm. See the mfxExtVPPFieldProcessing
structure for details. The application can attach this buffer to the mfxVideoParam structure for video processing initialization
or to the mfxFrameData structure during runtime.
*/
MFX_EXTBUFF_VPP_FIELD_PROCESSING = MFX_MAKEFOURCC('F','P','R','O'),
/*!
This extended buffer defines additional encoding controls. See the mfxExtCodingOption3 structure for details.
The application can attach this buffer to the structure for encoding initialization.
*/
MFX_EXTBUFF_CODING_OPTION3 = MFX_MAKEFOURCC('C','D','O','3'),
/*!
This extended buffer defines chroma samples location information. See the mfxExtChromaLocInfo structure for details.
The application can attach this buffer to the mfxVideoParam structure for encoding initialization.
*/
MFX_EXTBUFF_CHROMA_LOC_INFO = MFX_MAKEFOURCC('C','L','I','N'),
/*!
This extended buffer defines per-macroblock QP. See the mfxExtMBQP structure for details.
The application can attach this buffer to the mfxEncodeCtrl structure for per-frame encoding configuration.
*/
MFX_EXTBUFF_MBQP = MFX_MAKEFOURCC('M','B','Q','P'),
/*!
This extended buffer defines per-macroblock force intra flag. See the mfxExtMBForceIntra structure for details.
The application can attach this buffer to the mfxEncodeCtrl structure for per-frame encoding configuration.
*/
MFX_EXTBUFF_MB_FORCE_INTRA = MFX_MAKEFOURCC('M','B','F','I'),
/*!
This extended buffer defines additional encoding controls for HEVC tiles. See the mfxExtHEVCTiles structure for details.
The application can attach this buffer to the mfxVideoParam structure for encoding initialization.
*/
MFX_EXTBUFF_HEVC_TILES = MFX_MAKEFOURCC('2','6','5','T'),
/*!
This extended buffer defines macroblock map for current frame which forces specified macroblocks to be non skip. See the
mfxExtMBDisableSkipMap structure for details. The application can attach this buffer to the mfxEncodeCtrl structure for
per-frame encoding configuration.
*/
MFX_EXTBUFF_MB_DISABLE_SKIP_MAP = MFX_MAKEFOURCC('M','D','S','M'),
/*!
See the mfxExtHEVCParam structure for details.
*/
MFX_EXTBUFF_HEVC_PARAM = MFX_MAKEFOURCC('2','6','5','P'),
/*!
This extended buffer is used by decoders to report additional information about decoded frame. See the
mfxExtDecodedFrameInfo structure for more details.
*/
MFX_EXTBUFF_DECODED_FRAME_INFO = MFX_MAKEFOURCC('D','E','F','I'),
/*!
See the mfxExtTimeCode structure for more details.
*/
MFX_EXTBUFF_TIME_CODE = MFX_MAKEFOURCC('T','M','C','D'),
/*!
This extended buffer specifies the region to encode. The application can attach this buffer to the
mfxVideoParam structure during HEVC encoder initialization.
*/
MFX_EXTBUFF_HEVC_REGION = MFX_MAKEFOURCC('2','6','5','R'),
/*!
See the mfxExtPredWeightTable structure for details.
*/
MFX_EXTBUFF_PRED_WEIGHT_TABLE = MFX_MAKEFOURCC('E','P','W','T'),
/*!
See the mfxExtDirtyRect structure for details.
*/
MFX_EXTBUFF_DIRTY_RECTANGLES = MFX_MAKEFOURCC('D','R','O','I'),
/*!
See the mfxExtMoveRect structure for details.
*/
MFX_EXTBUFF_MOVING_RECTANGLES = MFX_MAKEFOURCC('M','R','O','I'),
/*!
See the mfxExtCodingOptionVPS structure for details.
*/
MFX_EXTBUFF_CODING_OPTION_VPS = MFX_MAKEFOURCC('C','O','V','P'),
/*!
See the mfxExtVPPRotation structure for details.
*/
MFX_EXTBUFF_VPP_ROTATION = MFX_MAKEFOURCC('R','O','T',' '),
/*!
See the mfxExtEncodedSlicesInfo structure for details.
*/
MFX_EXTBUFF_ENCODED_SLICES_INFO = MFX_MAKEFOURCC('E','N','S','I'),
/*!
See the mfxExtVPPScaling structure for details.
*/
MFX_EXTBUFF_VPP_SCALING = MFX_MAKEFOURCC('V','S','C','L'),
/*!
This extended buffer defines additional encoding controls for reference list. See the mfxExtAVCRefListCtrl structure for details.
The application can attach this buffer to the mfxVideoParam structure for encoding & decoding initialization, or
the mfxEncodeCtrl structure for per-frame encoding configuration.
*/
MFX_EXTBUFF_HEVC_REFLIST_CTRL = MFX_EXTBUFF_AVC_REFLIST_CTRL,
/*!
This extended buffer specifies reference lists for the encoder.
*/
MFX_EXTBUFF_HEVC_REFLISTS = MFX_EXTBUFF_AVC_REFLISTS,
/*!
This extended buffer configures the structure of temporal layers inside the encoded H.265 bitstream. See the mfxExtHEVCTemporalLayers
structure for details. The application can attach this buffer to the mfxVideoParam structure for encoding initialization.
*/
MFX_EXTBUFF_HEVC_TEMPORAL_LAYERS = MFX_EXTBUFF_AVC_TEMPORAL_LAYERS,
/*!
See the mfxExtVPPMirroring structure for details.
*/
MFX_EXTBUFF_VPP_MIRRORING = MFX_MAKEFOURCC('M','I','R','R'),
/*!
See the mfxExtMVOverPicBoundaries structure for details.
*/
MFX_EXTBUFF_MV_OVER_PIC_BOUNDARIES = MFX_MAKEFOURCC('M','V','P','B'),
/*!
See the mfxExtVPPColorFill structure for details.
*/
MFX_EXTBUFF_VPP_COLORFILL = MFX_MAKEFOURCC('V','C','L','F'),
/*!
This extended buffer is used by decoders to report error information before frames get decoded.
See the mfxExtDecodeErrorReport structure for more details.
*/
MFX_EXTBUFF_DECODE_ERROR_REPORT = MFX_MAKEFOURCC('D', 'E', 'R', 'R'),
/*!
See the mfxExtColorConversion structure for details.
*/
MFX_EXTBUFF_VPP_COLOR_CONVERSION = MFX_MAKEFOURCC('V', 'C', 'S', 'C'),
/*!
This extended buffer configures HDR SEI message. See the mfxExtContentLightLevelInfo structure for details.
*/
MFX_EXTBUFF_CONTENT_LIGHT_LEVEL_INFO = MFX_MAKEFOURCC('L', 'L', 'I', 'S'),
/*!
This extended buffer configures HDR SEI message. See the mfxExtMasteringDisplayColourVolume structure for details. If color volume changes
per frame, the application can attach this buffer to the mfxFrameData structure for video processing.
*/
MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME = MFX_MAKEFOURCC('D', 'C', 'V', 'S'),
/*!
This extended buffer configures HDR SEI message. See the mfxExtMasteringDisplayColourVolume structure for details. The application can
attach this buffer to the mfxVideoParam structure for the input of video processing if the mastering display color volume changes per
sequence. In this case, this buffer should be together with MFX_EXTBUFF_CONTENT_LIGHT_LEVEL_INFO to indicate the light level and mastering
color volume of the input of video processing. If color Volume changes per frame instead of per sequence, the application can attach
MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME to mfxFrameData for frame based processing.
*/
MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME_IN = MFX_MAKEFOURCC('D', 'C', 'V', 'I'),
/*!
This extended buffer configures HDR SEI message. See the mfxExtMasteringDisplayColourVolume structure for details. The application can
attach this buffer to the mfxVideoParam structure for the output of video processing if the mastering display color volume changes per
sequence. If color volume changes per frame instead of per sequence, the application can attach the buffer with MFX_EXTBUFF_MASTERING_
DISPLAY_COLOUR_VOLUME to mfxFrameData for frame based processing.
*/
MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME_OUT = MFX_MAKEFOURCC('D', 'C', 'V', 'O'),
/*!
See the mfxExtEncodedUnitsInfo structure for details.
*/
MFX_EXTBUFF_ENCODED_UNITS_INFO = MFX_MAKEFOURCC('E', 'N', 'U', 'I'),
/*!
This video processing algorithm identifier is used to enable MCTF via mfxExtVPPDoUse and together with mfxExtVppMctf
*/
MFX_EXTBUFF_VPP_MCTF = MFX_MAKEFOURCC('M', 'C', 'T', 'F'),
/*!
Extends mfxVideoParam structure with VP9 segmentation parameters. See the mfxExtVP9Segmentation structure for details.
*/
MFX_EXTBUFF_VP9_SEGMENTATION = MFX_MAKEFOURCC('9', 'S', 'E', 'G'),
/*!
Extends mfxVideoParam structure with parameters for VP9 temporal scalability. See the mfxExtVP9TemporalLayers structure for details.
*/
MFX_EXTBUFF_VP9_TEMPORAL_LAYERS = MFX_MAKEFOURCC('9', 'T', 'M', 'L'),
/*!
Extends mfxVideoParam structure with VP9-specific parameters. See the mfxExtVP9Param structure for details.
*/
MFX_EXTBUFF_VP9_PARAM = MFX_MAKEFOURCC('9', 'P', 'A', 'R'),
/*!
See the mfxExtAVCRoundingOffset structure for details.
*/
MFX_EXTBUFF_AVC_ROUNDING_OFFSET = MFX_MAKEFOURCC('R','N','D','O'),
/*!
See the mfxExtPartialBitstreamParam structure for details.
*/
MFX_EXTBUFF_PARTIAL_BITSTREAM_PARAM = MFX_MAKEFOURCC('P','B','O','P'),
/*!
See the mfxExtEncoderIPCMArea structure for details.
*/
MFX_EXTBUFF_ENCODER_IPCM_AREA = MFX_MAKEFOURCC('P', 'C', 'M', 'R'),
/*!
See the mfxExtInsertHeaders structure for details.
*/
MFX_EXTBUFF_INSERT_HEADERS = MFX_MAKEFOURCC('S', 'P', 'R', 'E'),
/*!
See the mfxExtDeviceAffinityMask structure for details.
*/
MFX_EXTBUFF_DEVICE_AFFINITY_MASK = MFX_MAKEFOURCC('D', 'A', 'F', 'M'),
/*!
See the mfxExtInCrops structure for details.
*/
MFX_EXTBUFF_CROPS = MFX_MAKEFOURCC('C', 'R', 'O', 'P'),
/*!
See the mfxExtAV1BitstreamParam structure for more details.
*/
MFX_EXTBUFF_AV1_BITSTREAM_PARAM = MFX_MAKEFOURCC('A', '1', 'B', 'S'),
/*!
See the mfxExtAV1ResolutionParam structure for more details.
*/
MFX_EXTBUFF_AV1_RESOLUTION_PARAM = MFX_MAKEFOURCC('A', '1', 'R', 'S'),
/*!
See the mfxExtAV1TileParam structure for more details.
*/
MFX_EXTBUFF_AV1_TILE_PARAM = MFX_MAKEFOURCC('A', '1', 'T', 'L'),
/*!
See the mfxExtAV1Segmentation structure for more details.
*/
MFX_EXTBUFF_AV1_SEGMENTATION = MFX_MAKEFOURCC('1', 'S', 'E', 'G'),
/*!
See the mfxExtAV1FilmGrainParam structure for more details.
*/
MFX_EXTBUFF_AV1_FILM_GRAIN_PARAM = MFX_MAKEFOURCC('A','1','F','G'),
/*!
See the mfxExtHyperModeParam structure for more details.
*/
MFX_EXTBUFF_HYPER_MODE_PARAM = MFX_MAKEFOURCC('H', 'Y', 'P', 'M'),
/*!
See the mfxExtTemporalLayers structure for more details.
*/
MFX_EXTBUFF_UNIVERSAL_TEMPORAL_LAYERS = MFX_MAKEFOURCC('U', 'T', 'M', 'P'),
/*!
This extended buffer defines additional encoding controls for reference list. See the mfxExtRefListCtrl structure for details.
The application can attach this buffer to the mfxVideoParam structure for encoding & decoding initialization, or
the mfxEncodeCtrl structure for per-frame encoding configuration.
*/
MFX_EXTBUFF_UNIVERSAL_REFLIST_CTRL = MFX_EXTBUFF_AVC_REFLIST_CTRL,
#ifdef ONEVPL_EXPERIMENTAL
/*!
See the mfxExtEncodeStats structure for details.
*/
MFX_EXTBUFF_ENCODESTATS = MFX_MAKEFOURCC('E','N','S','B'),
#endif
/*!
See the mfxExtVPP3DLut structure for more details.
*/
MFX_EXTBUFF_VPP_3DLUT = MFX_MAKEFOURCC('T','D','L','T'),
/*!
See the mfxExtAllocationHints structure for more details.
*/
MFX_EXTBUFF_ALLOCATION_HINTS = MFX_MAKEFOURCC('A','L','C','H'),
#ifdef ONEVPL_EXPERIMENTAL
/*!
See the mfxExtVPPPercEncPrefilter structure for details.
*/
MFX_EXTBUFF_VPP_PERC_ENC_PREFILTER = MFX_MAKEFOURCC('V','P','E','F'),
/*!
See the mfxExtTuneEncodeQuality structure for details.
*/
MFX_EXTBUFF_TUNE_ENCODE_QUALITY = MFX_MAKEFOURCC('T','U','N','E'),
/*!
See the mfxExtSurfaceOpenCLImg2DExportDescription structure for more details.
*/
MFX_EXTBUFF_EXPORT_SHARING_DESC_OCL = MFX_MAKEFOURCC('E', 'O', 'C', 'L'),
/*!
See the mfxExtSurfaceD3D12Tex2DExportDescription structure for more details.
*/
MFX_EXTBUFF_EXPORT_SHARING_DESC_D3D12 = MFX_MAKEFOURCC('E', 'D', '1', '2'),
/*!
See the mfxExtSurfaceVulkanImg2DExportDescription structure for more details.
*/
MFX_EXTBUFF_EXPORT_SHARING_DESC_VULKAN = MFX_MAKEFOURCC('E', 'V', 'U', 'L'),
#endif
/*!
See the mfxExtVPPAISuperResolution structure for details.
*/
MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION = MFX_MAKEFOURCC('V','A','S','R'),
/*!
See the mfxExtVPPAIFrameInterpolation structure for details.
*/
MFX_EXTBUFF_VPP_AI_FRAME_INTERPOLATION = MFX_MAKEFOURCC('V', 'A', 'F', 'I'),
/*!
See the mfxExtQualityInfoMode structure for details.
*/
MFX_EXTBUFF_ENCODED_QUALITY_INFO_MODE = MFX_MAKEFOURCC('E', 'N', 'Q', 'M'),
/*!
See the mfxExtQualityInfoOutput structure for details.
*/
MFX_EXTBUFF_ENCODED_QUALITY_INFO_OUTPUT = MFX_MAKEFOURCC('E', 'N', 'Q', 'O'),
/*!
See the mfxExtAV1ScreenContentTools structure for details.
*/
MFX_EXTBUFF_AV1_SCREEN_CONTENT_TOOLS = MFX_MAKEFOURCC('1', 'S', 'C', 'C'),
/*!
See the mfxExtAlphaChannelEncCtrl structure for more details.
*/
MFX_EXTBUFF_ALPHA_CHANNEL_ENC_CTRL = MFX_MAKEFOURCC('A', 'C', 'E', 'C'),
/*!
See the mfxExtAlphaChannelSurface structure for more details.
*/
MFX_EXTBUFF_ALPHA_CHANNEL_SURFACE = MFX_MAKEFOURCC('A', 'C', 'S', 'F'),
};
/* VPP Conf: Do not use certain algorithms */
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Tells the VPP not to use certain filters in pipeline. See "Configurable VPP filters" table for complete
list of configurable filters. The user can attach this structure to the mfxVideoParam structure when initializing video processing.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_DONOTUSE. */
mfxU32 NumAlg; /*!< Number of filters (algorithms) not to use */
mfxU32* AlgList; /*!< Pointer to a list of filters (algorithms) not to use */
} mfxExtVPPDoNotUse;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures the VPP denoise filter algorithm.
@deprecated Deprecated in API version 2.5. Use mfxExtVPPDenoise2 instead.
*/
MFX_DEPRECATED typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_DENOISE. */
mfxU16 DenoiseFactor; /*!< Indicates the level of noise to remove. Value range of 0 to 100 (inclusive). */
} mfxExtVPPDenoise;
MFX_PACK_END()
/*! The mfxDenoiseMode enumerator specifies the mode of denoise. */
typedef enum {
MFX_DENOISE_MODE_DEFAULT = 0, /*!< Default denoise mode. The library selects the most appropriate denoise mode. */
MFX_DENOISE_MODE_VENDOR = 1000, /*!< The enumeration to separate common denoise mode above and vendor specific. */
MFX_DENOISE_MODE_INTEL_HVS_AUTO_BDRATE = MFX_DENOISE_MODE_VENDOR + 1, /*!< Indicates auto BD rate improvement in pre-processing before video encoding,
ignore Strength.*/
MFX_DENOISE_MODE_INTEL_HVS_AUTO_SUBJECTIVE = MFX_DENOISE_MODE_VENDOR + 2, /*!< Indicates auto subjective quality improvement in pre-processing before video encoding,
ignore Strength.*/
MFX_DENOISE_MODE_INTEL_HVS_AUTO_ADJUST = MFX_DENOISE_MODE_VENDOR + 3, /*!< Indicates auto adjust subjective quality in post-processing (after decoding) for video playback,
ignore Strength.*/
MFX_DENOISE_MODE_INTEL_HVS_PRE_MANUAL = MFX_DENOISE_MODE_VENDOR + 4, /*!< Indicates manual mode for pre-processing before video encoding,
allow to adjust the denoise strength manually.*/
MFX_DENOISE_MODE_INTEL_HVS_POST_MANUAL = MFX_DENOISE_MODE_VENDOR + 5, /*!< Indicates manual mode for post-processing for video playback,
allow to adjust the denoise strength manually.*/
} mfxDenoiseMode;
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures the VPP denoise filter algorithm.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_DENOISE2. */
mfxDenoiseMode Mode; /*!< Indicates the mode of denoise. mfxDenoiseMode enumerator. */
mfxU16 Strength; /*!< Denoise strength in manual mode. Value of 0-100 (inclusive) indicates the strength of denoise.
The strength of denoise controls degree of possible changes of pixel values; the bigger the strength
the larger the change is. */
mfxU16 reserved[15];
} mfxExtVPPDenoise2;
MFX_PACK_END()
/*! The mfx3DLutChannelMapping enumerator specifies the channel mapping of 3DLUT. */
typedef enum {
MFX_3DLUT_CHANNEL_MAPPING_DEFAULT = 0, /*!< Default 3DLUT channel mapping. The library selects the most appropriate 3DLUT channel mapping. */
MFX_3DLUT_CHANNEL_MAPPING_RGB_RGB = 1, /*!< 3DLUT RGB channels map to RGB channels. */
MFX_3DLUT_CHANNEL_MAPPING_YUV_RGB = 2, /*!< 3DLUT YUV channels map to RGB channels. */
MFX_3DLUT_CHANNEL_MAPPING_VUY_RGB = 3, /*!< 3DLUT VUY channels map to RGB channels. */
} mfx3DLutChannelMapping;
/*! The mfx3DLutMemoryLayout enumerator specifies the memory layout of 3DLUT. */
typedef enum {
MFX_3DLUT_MEMORY_LAYOUT_DEFAULT = 0, /*!< Default 3DLUT memory layout. The library selects the most appropriate 3DLUT memory layout.*/
MFX_3DLUT_MEMORY_LAYOUT_VENDOR = 0x1000, /*!< The enumeration to separate default above and vendor specific.*/
/*!
Intel specific memory layout. The enumerator indicates the attributes and memory layout of 3DLUT.
3DLUT size is 17(the number of elements per dimension), 4 channels(3 valid channels, 1 channel is reserved), every channel must be 16-bit unsigned integer.
3DLUT contains 17x17x32 entries with holes that are not filled. Take RGB as example, the nodes RxGx17 to RxGx31 are not filled, are "don't care" bits, and not accessed for the 17x17x17 nodes.
*/
MFX_3DLUT_MEMORY_LAYOUT_INTEL_17LUT = MFX_3DLUT_MEMORY_LAYOUT_VENDOR + 1,
/*!
Intel specific memory layout. The enumerator indicates the attributes and memory layout of 3DLUT.
3DLUT size is 33(the number of elements per dimension), 4 channels(3 valid channels, 1 channel is reserved), every channel must be 16-bit unsigned integer.
3DLUT contains 33x33x64 entries with holes that are not filled. Take RGB as example, the nodes RxGx33 to RxGx63 are not filled, are "don't care" bits, and not accessed for the 33x33x33 nodes.
*/
MFX_3DLUT_MEMORY_LAYOUT_INTEL_33LUT = MFX_3DLUT_MEMORY_LAYOUT_VENDOR + 2,
/*!
Intel specific memory layout. The enumerator indicates the attributes and memory layout of 3DLUT.
3DLUT size is 65(the number of elements per dimension), 4 channels(3 valid channels, 1 channel is reserved), every channel must be 16-bit unsigned integer.
3DLUT contains 65x65x128 entries with holes that are not filled. Take RGB as example, the nodes RxGx65 to RxGx127 are not filled, are "don't care" bits, and not accessed for the 65x65x65 nodes.
*/
MFX_3DLUT_MEMORY_LAYOUT_INTEL_65LUT = MFX_3DLUT_MEMORY_LAYOUT_VENDOR + 3,
} mfx3DLutMemoryLayout;
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
A hint structure that configures the data channel.
*/
typedef struct {
mfxDataType DataType; /*!< Data type, mfxDataType enumerator.*/
mfxU32 Size; /*!< Size of Look up table, the number of elements per dimension.*/
union
{
mfxU8* Data; /*!< The pointer to 3DLUT data, 8 bit unsigned integer.*/
mfxU16* Data16; /*!< The pointer to 3DLUT data, 16 bit unsigned integer.*/
};
mfxU32 reserved[4]; /*!< Reserved for future extension.*/
} mfxChannel;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures 3DLUT system buffer.
*/
typedef struct {
mfxChannel Channel[3]; /*!< 3 Channels, can be RGB or YUV, mfxChannel structure.*/
mfxU32 reserved[8]; /*!< Reserved for future extension.*/
} mfx3DLutSystemBuffer;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures 3DLUT video buffer.
*/
typedef struct {
mfxDataType DataType; /*!< Data type, mfxDataType enumerator.*/
mfx3DLutMemoryLayout MemLayout; /*!< Indicates 3DLUT memory layout. mfx3DLutMemoryLayout enumerator.*/
mfxMemId MemId; /*!< Memory ID for holding the lookup table data. One MemID is dedicated for one instance of VPP.*/
mfxU32 reserved[8]; /*!< Reserved for future extension.*/
} mfx3DLutVideoBuffer;
MFX_PACK_END()
#ifdef ONEVPL_EXPERIMENTAL
/*! The mfx3DLutInterpolationMethod enumerator specifies the 3DLUT interpolation method. */
typedef enum {
MFX_3DLUT_INTERPOLATION_DEFAULT = 0, /*!< Default 3DLUT interpolation Method. The library selects the most appropriate 3DLUT interpolation method. */
MFX_3DLUT_INTERPOLATION_TRILINEAR = 1, /*!< 3DLUT Trilinear interpolation method. */
MFX_3DLUT_INTERPOLATION_TETRAHEDRAL = 2, /*!< 3DLUT Tetrahedral interpolation method. */
} mfx3DLutInterpolationMethod;
#endif
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures 3DLUT filter.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_3DLUT.*/
mfx3DLutChannelMapping ChannelMapping; /*!< Indicates 3DLUT channel mapping. mfx3DLutChannelMapping enumerator.*/
mfxResourceType BufferType; /*!< Indicates 3DLUT buffer type. mfxResourceType enumerator, can be system memory, VA surface, DX11 texture/buffer etc.*/
union
{
mfx3DLutSystemBuffer SystemBuffer; /*!< The 3DLUT system buffer. mfx3DLutSystemBuffer structure describes the details of the buffer.*/
mfx3DLutVideoBuffer VideoBuffer; /*!< The 3DLUT video buffer. mfx3DLutVideoBuffer describes the details of 3DLUT video buffer.*/
};
#ifdef ONEVPL_EXPERIMENTAL
mfx3DLutInterpolationMethod InterpolationMethod; /*!< Indicates 3DLUT Interpolation Method. mfx3DLutInterpolationMethod enumerator.*/
mfxU32 reserved[3]; /*!< Reserved for future extension.*/
#else
mfxU32 reserved[4]; /*!< Reserved for future extension.*/
#endif
} mfxExtVPP3DLut;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures the VPP detail/edge enhancement filter algorithm.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_DETAIL. */
mfxU16 DetailFactor; /*!< Indicates the level of details to be enhanced. Value range of 0 to 100 (inclusive). */
} mfxExtVPPDetail;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
A hint structure that configures the VPP ProcAmp filter algorithm.
The structure parameters will be clipped to their corresponding range and rounded by their corresponding increment.
@note There are no default values for fields in this structure, all settings must be explicitly specified every time this
buffer is submitted for processing.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_PROCAMP. */
mfxF64 Brightness; /*!< The brightness parameter is in the range of -100.0F to 100.0F, in increments of 0.1F.
Setting this field to 0.0F will disable brightness adjustment. */
mfxF64 Contrast; /*!< The contrast parameter in the range of 0.0F to 10.0F, in increments of 0.01F, is used for manual
contrast adjustment. Setting this field to 1.0F will disable contrast adjustment. If the parameter
is negative, contrast will be adjusted automatically. */
mfxF64 Hue; /*!< The hue parameter is in the range of -180F to 180F, in increments of 0.1F. Setting this field to 0.0F
will disable hue adjustment. */
mfxF64 Saturation; /*!< The saturation parameter is in the range of 0.0F to 10.0F, in increments of 0.01F.
Setting this field to 1.0F will disable saturation adjustment. */
} mfxExtVPPProcAmp;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
Returns statistics collected during encoding.
*/
typedef struct {
mfxU32 reserved[16];
mfxU32 NumFrame; /*!< Number of encoded frames. */
mfxU64 NumBit; /*!< Number of bits for all encoded frames. */
mfxU32 NumCachedFrame; /*!< Number of internally cached frames. */
} mfxEncodeStat;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Returns statistics collected during decoding.
*/
typedef struct {
mfxU32 reserved[16];
mfxU32 NumFrame; /*!< Number of total decoded frames. */
mfxU32 NumSkippedFrame; /*!< Number of skipped frames. */
mfxU32 NumError; /*!< Number of errors recovered. */
mfxU32 NumCachedFrame; /*!< Number of internally cached frames. */
} mfxDecodeStat;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Returns statistics collected during video processing.
*/
typedef struct {
mfxU32 reserved[16];
mfxU32 NumFrame; /*!< Total number of frames processed. */
mfxU32 NumCachedFrame; /*!< Number of internally cached frames. */
} mfxVPPStat;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Returns auxiliary data generated by the video processing pipeline.
The encoding process may use the auxiliary data by attaching this structure to the mfxEncodeCtrl structure.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_AUXDATA. */
union{
struct{
MFX_DEPRECATED mfxU32 SpatialComplexity; /* Deprecated */
MFX_DEPRECATED mfxU32 TemporalComplexity; /* Deprecated */
};
struct{
/*!
Detected picture structure - top field first, bottom field first, progressive or unknown if video processor cannot
detect picture structure. See the PicStruct enumerator for definition of these values.
*/
mfxU16 PicStruct;
mfxU16 reserved[3];
};
};
MFX_DEPRECATED mfxU16 SceneChangeRate; /* Deprecated */
mfxU16 RepeatedFrame; /*!< The flag signalizes that the frame is identical to the previous one. */
} mfxExtVppAuxData;
MFX_PACK_END()
/*! The PayloadCtrlFlags enumerator itemizes additional payload properties. */
enum {
MFX_PAYLOAD_CTRL_SUFFIX = 0x00000001 /*!< Insert this payload into HEVC Suffix SEI NAL-unit. */
};
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Describes user data payload in MPEG-2 or SEI message payload in H.264.
For encoding, these payloads can be
inserted into the bitstream. The payload buffer must contain a valid formatted payload.
For H.264, this is the sei_message() as
specified in the section 7.3.2.3.1 'Supplemental enhancement information message syntax' of the ISO/IEC 14496-10 specification.
For MPEG-2,
this is the section 6.2.2.2.2 'User data' of the ISO/IEC 13818-2 specification, excluding the user data start_code.
For decoding,
these payloads can be retrieved as the decoder parses the bitstream and caches them in an internal buffer.
@internal
+-----------+-------------------------------------------+
| **Codec** | **Supported Types** |
+===========+===========================================+
| MPEG2 | 0x01B2 //User Data |
+-----------+-------------------------------------------+
| AVC | 02 //pan_scan_rect |
| | 03 //filler_payload |
| | 04 //user_data_registered_itu_t_t35 |
| | 05 //user_data_unregistered |
| | 06 //recovery_point |
| | 09 //scene_info |
| | 13 //full_frame_freeze |
| | 14 //full_frame_freeze_release |
| | 15 //full_frame_snapshot |
| | 16 //progressive_refinement_segment_start |
| | 17 //progressive_refinement_segment_end |
| | 19 //film_grain_characteristics |
| | 20 //deblocking_filter_display_preference |
| | 21 //stereo_video_info |
| | 45 //frame_packing_arrangement |
+-----------+-------------------------------------------+
| HEVC | All |
+-----------+-------------------------------------------+
@endinternal
*/
typedef struct {
mfxU32 CtrlFlags; /*!< Additional payload properties. See the PayloadCtrlFlags enumerator for details. */
mfxU32 reserved[3];
mfxU8 *Data; /*!< Pointer to the actual payload data buffer. */
mfxU32 NumBit; /*!< Number of bits in the payload data */
mfxU16 Type; /*!< MPEG-2 user data start code or H.264 SEI message type. */
mfxU16 BufSize; /*!< Payload buffer size in bytes. */
} mfxPayload;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Contains parameters for per-frame based encoding control.
*/
typedef struct {
mfxExtBuffer Header; /*!< This extension buffer doesn't have assigned buffer ID. Ignored. */
mfxU32 reserved[4];
mfxU16 reserved1;
/*!
Type of NAL unit that contains encoding frame. All supported values are defined by MfxNalUnitType enumerator. Other values
defined in ITU-T H.265 specification are not supported.
The encoder uses this field only if application sets mfxExtCodingOption3::EnableNalUnitType option to ON during encoder initialization.
@note Only encoded order is supported. If application specifies this value in display order or uses value inappropriate for current frame or
invalid value, then the encoder silently ignores it.
*/
mfxU16 MfxNalUnitType;
mfxU16 SkipFrame; /*!< Indicates that current frame should be skipped or the number of missed frames before the current frame. See mfxExtCodingOption2::SkipFrame for details. */
mfxU16 QP; /*!< If nonzero, this value overwrites the global QP value for the current frame in the constant QP mode. */
/*!
Encoding frame type. See the FrameType enumerator for details. If the encoder works in the encoded order, the application must
specify the frame type. If the encoder works in the display order, only key frames are enforceable.
*/
mfxU16 FrameType;
mfxU16 NumExtParam; /*!< Number of extra control buffers. */
mfxU16 NumPayload; /*!< Number of payload records to insert into the bitstream. */
mfxU16 reserved2;
/*!
Pointer to an array of pointers to external buffers that provide additional information or control to the encoder for this
frame or field pair. A typical use is to pass the VPP auxiliary data generated by the video processing pipeline to the encoder.
See the ExtendedBufferID for the list of extended buffers.
*/
mfxExtBuffer **ExtParam;
/*!
Pointer to an array of pointers to user data (MPEG-2) or SEI messages (H.264) for insertion into the bitstream. For field pictures,
odd payloads are associated with the first field and even payloads are associated with the second field. See the mfxPayload structure
for payload definitions.
*/
mfxPayload **Payload;
} mfxEncodeCtrl;
MFX_PACK_END()
/*! The ExtMemBufferType enumerator specifies the buffer type. It is a bit-ORed value of the following. */
enum {
MFX_MEMTYPE_PERSISTENT_MEMORY =0x0002 /*!< Memory page for persistent use. */
};
/* Frame Memory Types */
#define MFX_MEMTYPE_BASE(x) (0x90ff & (x))
/*!
The ExtMemFrameType enumerator specifies the memory type of frame. It is a bit-ORed value of the following.
\verbatim embed:rst
For information on working with video memory surfaces, see the :ref:`Working with Hardware Acceleration section<hw-acceleration>`.
\endverbatim
*/
enum {
MFX_MEMTYPE_DXVA2_DECODER_TARGET =0x0010, /*!< Frames are in video memory and belong to video decoder render targets. */
MFX_MEMTYPE_DXVA2_PROCESSOR_TARGET =0x0020, /*!< Frames are in video memory and belong to video processor render targets. */
MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET = MFX_MEMTYPE_DXVA2_DECODER_TARGET, /*!< Frames are in video memory and belong to video decoder render targets. */
MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET = MFX_MEMTYPE_DXVA2_PROCESSOR_TARGET,/*!< Frames are in video memory and belong to video processor render targets. */
MFX_MEMTYPE_SYSTEM_MEMORY =0x0040, /*!< The frames are in system memory. */
MFX_MEMTYPE_RESERVED1 =0x0080, /*!< */
MFX_MEMTYPE_FROM_ENCODE = 0x0100, /*!< Allocation request comes from an ENCODE function */
MFX_MEMTYPE_FROM_DECODE = 0x0200, /*!< Allocation request comes from a DECODE function */
MFX_MEMTYPE_FROM_VPPIN = 0x0400, /*!< Allocation request comes from a VPP function for input frame allocation */
MFX_MEMTYPE_FROM_VPPOUT = 0x0800, /*!< Allocation request comes from a VPP function for output frame allocation */
MFX_MEMTYPE_FROM_ENC = 0x2000, /*!< Allocation request comes from an ENC function */
MFX_MEMTYPE_FROM_PAK = 0x4000, /* Reserved */
MFX_MEMTYPE_INTERNAL_FRAME = 0x0001, /*!< Allocation request for internal frames */
MFX_MEMTYPE_EXTERNAL_FRAME = 0x0002, /*!< Allocation request for I/O frames */
MFX_MEMTYPE_EXPORT_FRAME = 0x0008, /*!< Application requests frame handle export to some associated object. For Linux frame handle can be
considered to be exported to DRM Prime FD, DRM FLink or DRM FrameBuffer Handle. Specifics of export
types and export procedure depends on external frame allocator implementation */
MFX_MEMTYPE_SHARED_RESOURCE = MFX_MEMTYPE_EXPORT_FRAME, /*!< For DX11 allocation use shared resource bind flag. */
MFX_MEMTYPE_VIDEO_MEMORY_ENCODER_TARGET = 0x1000, /*!< Frames are in video memory and belong to video encoder render targets. */
MFX_MEMTYPE_VIDEO_MEMORY_UNORDERED_ACCESS = 0x8000 /*!< Frames are in video memory and used as an unordered access resource. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Describes multiple frame allocations when initializing encoders, decoders, and video preprocessors.
A range specifies the number of video frames. Applications are free to allocate additional frames. In all cases, the minimum number of
frames must be at least NumFrameMin or the called API function will return an error.
*/
typedef struct {
union {
mfxU32 AllocId; /*!< Unique (within the session) ID of component requested the allocation. */
mfxU32 reserved[1];
};
mfxU32 reserved3[3];
mfxFrameInfo Info; /*!< Describes the properties of allocated frames. */
mfxU16 Type; /*!< Allocated memory type. See the ExtMemFrameType enumerator for details. */
mfxU16 NumFrameMin; /*!< Minimum number of allocated frames. */
mfxU16 NumFrameSuggested; /*!< Suggested number of allocated frames. */
mfxU16 reserved2;
} mfxFrameAllocRequest;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Describes the response to multiple frame allocations. The calling API function returns the number of
video frames actually allocated and pointers to their memory IDs.
*/
typedef struct {
mfxU32 AllocId; /*!< Unique (within the session) ID of component requested the allocation. */
mfxU32 reserved[3];
mfxMemId *mids; /*!< Pointer to the array of the returned memory IDs. The application allocates or frees this array. */
mfxU16 NumFrameActual; /*!< Number of frames actually allocated. */
mfxU16 reserved2;
} mfxFrameAllocResponse;
MFX_PACK_END()
/*! The FrameType enumerator itemizes frame types. Use bit-ORed values to specify all that apply. */
enum {
MFX_FRAMETYPE_UNKNOWN =0x0000, /*!< Frame type is unspecified. */
MFX_FRAMETYPE_I =0x0001, /*!< This frame or the first field is encoded as an I-frame/field. */
MFX_FRAMETYPE_P =0x0002, /*!< This frame or the first field is encoded as an P-frame/field. */
MFX_FRAMETYPE_B =0x0004, /*!< This frame or the first field is encoded as an B-frame/field. */
MFX_FRAMETYPE_S =0x0008, /*!< This frame or the first field is either an SI- or SP-frame/field. */
MFX_FRAMETYPE_REF =0x0040, /*!< This frame or the first field is encoded as a reference. */
MFX_FRAMETYPE_IDR =0x0080, /*!< This frame or the first field is encoded as an IDR. */
MFX_FRAMETYPE_xI =0x0100, /*!< The second field is encoded as an I-field. */
MFX_FRAMETYPE_xP =0x0200, /*!< The second field is encoded as an P-field. */
MFX_FRAMETYPE_xB =0x0400, /*!< The second field is encoded as an S-field. */
MFX_FRAMETYPE_xS =0x0800, /*!< The second field is an SI- or SP-field. */
MFX_FRAMETYPE_xREF =0x4000, /*!< The second field is encoded as a reference. */
MFX_FRAMETYPE_xIDR =0x8000 /*!< The second field is encoded as an IDR. */
};
/*!
The MfxNalUnitType enumerator specifies NAL unit types supported by the HEVC encoder.
*/
enum {
MFX_HEVC_NALU_TYPE_UNKNOWN = 0, /*!< The encoder will decide what NAL unit type to use. */
MFX_HEVC_NALU_TYPE_TRAIL_N = ( 0+1), /*!< See Table 7-1 of the ITU-T H.265 specification for the definition of these type. */
MFX_HEVC_NALU_TYPE_TRAIL_R = ( 1+1), /*!< See Table 7-1 of the ITU-T H.265 specification for the definition of these type. */
MFX_HEVC_NALU_TYPE_RADL_N = ( 6+1), /*!< See Table 7-1 of the ITU-T H.265 specification for the definition of these type. */
MFX_HEVC_NALU_TYPE_RADL_R = ( 7+1), /*!< See Table 7-1 of the ITU-T H.265 specification for the definition of these type. */
MFX_HEVC_NALU_TYPE_RASL_N = ( 8+1), /*!< See Table 7-1 of the ITU-T H.265 specification for the definition of these type. */
MFX_HEVC_NALU_TYPE_RASL_R = ( 9+1), /*!< See Table 7-1 of the ITU-T H.265 specification for the definition of these type. */
MFX_HEVC_NALU_TYPE_IDR_W_RADL = (19+1), /*!< See Table 7-1 of the ITU-T H.265 specification for the definition of these type. */
MFX_HEVC_NALU_TYPE_IDR_N_LP = (20+1), /*!< See Table 7-1 of the ITU-T H.265 specification for the definition of these type. */
MFX_HEVC_NALU_TYPE_CRA_NUT = (21+1) /*!< See Table 7-1 of the ITU-T H.265 specification for the definition of these type. */
};
/*! The mfxSkipMode enumerator describes the decoder skip-mode options. */
typedef enum {
MFX_SKIPMODE_NOSKIP=0, /*! Do not skip any frames. */
MFX_SKIPMODE_MORE=1, /*! Skip more frames. */
MFX_SKIPMODE_LESS=2 /*! Skip less frames. */
} mfxSkipMode;
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Attach this structure as part of the extended buffers to configure the encoder during MFXVideoENCODE_Init. The sequence or picture
parameters specified by this structure overwrite any parameters specified by the structure or any other attached extended buffers attached.
For H.264, SPSBuffer and PPSBuffer must point to valid bitstreams that contain the sequence parameter set and picture parameter set,
respectively.
For MPEG-2, SPSBuffer must point to valid bitstreams that contain the sequence header followed by any sequence header extension. The PPSBuffer pointer is ignored.
The encoder imports parameters from these buffers. If the encoder does not support the specified parameters,
the encoder does not initialize and returns the status code MFX_ERR_INCOMPATIBLE_VIDEO_PARAM.
Check with the MFXVideoENCODE_Query function for the support of this multiple segment encoding feature. If this feature is not supported,
the query returns MFX_ERR_UNSUPPORTED.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CODING_OPTION_SPSPPS. */
mfxU8 *SPSBuffer; /*!< Pointer to a valid bitstream that contains the SPS (sequence parameter set for H.264 or sequence header
followed by any sequence header extension for MPEG-2) buffer. Can be NULL to skip specifying the SPS. */
mfxU8 *PPSBuffer; /*!< Pointer to a valid bitstream that contains the PPS (picture parameter set for H.264 or picture header
followed by any picture header extension for MPEG-2) buffer. Can be NULL to skip specifying the PPS. */
mfxU16 SPSBufSize; /*!< Size of the SPS in bytes. */
mfxU16 PPSBufSize; /*!< Size of the PPS in bytes. */
mfxU16 SPSId; /*!< SPS identifier. The value is reserved and must be zero. */
mfxU16 PPSId; /*!< PPS identifier. The value is reserved and must be zero. */
} mfxExtCodingOptionSPSPPS;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
Attach this structure as part of the extended buffers to configure the encoder during MFXVideoENCODE_Init. The sequence or picture
parameters specified by this structure overwrite any parameters specified by the structure or any other attached extended buffers attached.
If the encoder does not support the specified parameters, the encoder does not initialize and returns the status code
MFX_ERR_INCOMPATIBLE_VIDEO_PARAM.
Check with the MFXVideoENCODE_Query function for the support of this multiple segment encoding feature. If this feature is not supported,
the query returns MFX_ERR_UNSUPPORTED.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CODING_OPTION_VPS. */
union {
mfxU8 *VPSBuffer; /*!< Pointer to a valid bitstream that contains the VPS (video parameter set for HEVC) buffer. */
mfxU64 reserved1;
};
mfxU16 VPSBufSize; /*!< Size of the VPS in bytes. */
mfxU16 VPSId; /*!< VPS identifier; the value is reserved and must be zero. */
mfxU16 reserved[6];
} mfxExtCodingOptionVPS;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Defines the video signal information.
For H.264, see Annex E of the ISO/IEC 14496-10 specification for the definition of these parameters.
For MPEG-2, see section 6.3.6 of the ITU* H.262 specification for the definition of these parameters. The field VideoFullRange is ignored.
For VC-1, see section 6.1.14.5 of the SMPTE* 421M specification. The fields VideoFormat and VideoFullRange are ignored.
@note If ColourDescriptionPresent is zero, the color description information (including ColourPrimaries, TransferCharacteristics,
and MatrixCoefficients) does not present in the bitstream.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VIDEO_SIGNAL_INFO. */
mfxU16 VideoFormat;
mfxU16 VideoFullRange;
mfxU16 ColourDescriptionPresent;
mfxU16 ColourPrimaries;
mfxU16 TransferCharacteristics;
mfxU16 MatrixCoefficients;
} mfxExtVideoSignalInfo;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Tells the VPP to include certain filters in the pipeline.
Each filter may be included in the pipeline in one of two different ways:
@li Adding a filter ID to this structure. In this method,
the default filter parameters are used.
@li Attaching a filter configuration structure directly to the mfxVideoParam structure.
In this method, adding filter ID to the mfxExtVPPDoUse structure is optional.
See Table "Configurable VPP filters" for complete list of
configurable filters, their IDs, and configuration structures.
The user can attach this structure to the mfxVideoParam structure when initializing video processing.
@note MFX_EXTBUFF_VPP_COMPOSITE cannot be enabled using mfxExtVPPDoUse because default parameters are undefined for this filter.
The application must attach the appropriate filter configuration structure directly to the mfxVideoParam structure to enable it.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_DOUSE. */
mfxU32 NumAlg; /*!< Number of filters (algorithms) to use */
mfxU32 *AlgList; /*!< Pointer to a list of filters (algorithms) to use */
} mfxExtVPPDoUse;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures reference frame options for the H.264 encoder.
\verbatim embed:rst
See the :ref:`Reference List Selection <sec_reference_list_selection>` and :ref:`Long Term Reference Frame <sec_long_term_reference_frame>` sections for more details.
\endverbatim
@note Not all implementations of the encoder support LongTermIdx and ApplyLongTermIdx fields in this structure. The application must use
query mode 1 to determine if such functionality is supported. To do this, the application must attach this extended buffer to the
mfxVideoParam structure and call the MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE and these fields were set to non-zero value,
then the functionality is supported. If the function fails or sets fields to zero, then the functionality is not supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AVC_REFLIST_CTRL. */
mfxU16 NumRefIdxL0Active; /*!< Specify the number of reference frames in the active reference list L0. This number should be less or equal to the NumRefFrame parameter from encoding initialization. */
mfxU16 NumRefIdxL1Active; /*!< Specify the number of reference frames in the active reference list L1. This number should be less or equal to the NumRefFrame parameter from encoding initialization. */
struct {
/*! @{
@name Reference Lists
The following structure members are used by the reference lists contained in the parent structure. */
mfxU32 FrameOrder; /*!< Together FrameOrder and PicStruct fields are used to identify reference picture. Use FrameOrder = MFX_FRAMEORDER_UNKNOWN to mark unused entry. */
mfxU16 PicStruct; /*!< Together FrameOrder and PicStruct fields are used to identify reference picture. Use FrameOrder = MFX_FRAMEORDER_UNKNOWN to mark unused entry. */
mfxU16 ViewId; /*!< Reserved and must be zero. */
mfxU16 LongTermIdx; /*!< Index that should be used by the encoder to mark long-term reference frame. */
mfxU16 reserved[3]; /*!< Reserved */
/*! @} */
} PreferredRefList[32], /*!< Reference list that specifies the list of frames that should be used to predict the current frame. */
RejectedRefList[16], /*!< Reference list that specifies the list of frames that should not be used for prediction. */
LongTermRefList[16]; /*!< Reference list that specifies the list of frames that should be marked as long-term reference frame. */
mfxU16 ApplyLongTermIdx;/*!< If it is equal to zero, the encoder assigns long-term index according to internal algorithm.
If it is equal to one, the encoder uses LongTermIdx value as long-term index. */
mfxU16 reserved[15];
} mfxExtAVCRefListCtrl;
MFX_PACK_END()
/*! The FrcAlgm enumerator itemizes frame rate conversion algorithms. See description of mfxExtVPPFrameRateConversion structure for more details. */
enum {
MFX_FRCALGM_PRESERVE_TIMESTAMP = 0x0001, /*!< Frame dropping/repetition based frame rate conversion algorithm with preserved original
time stamps. Any inserted frames will carry MFX_TIMESTAMP_UNKNOWN. */
MFX_FRCALGM_DISTRIBUTED_TIMESTAMP = 0x0002, /*!< Frame dropping/repetition based frame rate conversion algorithm with distributed time stamps.
The algorithm distributes output time stamps evenly according to the output frame rate. */
MFX_FRCALGM_FRAME_INTERPOLATION = 0x0004, /*!< Frame rate conversion algorithm based on frame interpolation. This flag may be combined with
MFX_FRCALGM_PRESERVE_TIMESTAMP or MFX_FRCALGM_DISTRIBUTED_TIMESTAMP flags. */
#ifdef ONEVPL_EXPERIMENTAL
MFX_FRCALGM_AI_FRAME_INTERPOLATION = 0x0008 /*!< Frame rate conversion algorithm based on AI powered frame interpolation. This flag may be combined with
MFX_FRCALGM_PRESERVE_TIMESTAMP or MFX_FRCALGM_DISTRIBUTED_TIMESTAMP flags. This flag can not be combined
with MFX_FRCALGM_FRAME_INTERPOLATION. If application sets this flag, the application needs to attach
MFX_EXTBUFF_VPP_AI_FRAME_INTERPOLATION for the details of frame interpolation to mfxVideoParam. Refer to
mfxExtVPPAIFrameInterpolation for more details.*/
#endif
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures the VPP frame rate conversion filter. The user can attach this structure to the
mfxVideoParam structure when initializing, resetting, or querying capability of video processing.
On some platforms the advanced frame rate conversion algorithm (the algorithm based on frame interpolation) is not supported. To query its support,
the application should add the MFX_FRCALGM_FRAME_INTERPOLATION flag to the Algorithm value in the mfxExtVPPFrameRateConversion structure, attach it to the
structure, and call the MFXVideoVPP_Query function. If the filter is supported, the function returns a MFX_ERR_NONE status and copies the content of the
input structure to the output structure. If an advanced filter is not supported, then a simple filter will be used and the function returns
MFX_WRN_INCOMPATIBLE_VIDEO_PARAM, copies content of the input structure to the output structure, and corrects the Algorithm value.
If advanced FRC algorithm is not supported, both MFXVideoVPP_Init and MFXVideoVPP_Reset functions return the MFX_WRN_INCOMPATIBLE_VIDEO_PARAM status.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION. */
mfxU16 Algorithm; /*!< See the FrcAlgm enumerator for a list of frame rate conversion algorithms. */
mfxU16 reserved;
mfxU32 reserved2[15];
} mfxExtVPPFrameRateConversion;
MFX_PACK_END()
/*! The ImageStabMode enumerator itemizes image stabilization modes. See description of mfxExtVPPImageStab structure for more details. */
enum {
MFX_IMAGESTAB_MODE_UPSCALE = 0x0001, /*!< Upscale mode. */
MFX_IMAGESTAB_MODE_BOXING = 0x0002 /*!< Boxing mode. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that configures the VPP image stabilization filter.
On some platforms this filter is not supported. To query its support, the application should use the same approach that it uses
to configure VPP filters: adding the filter ID to the mfxExtVPPDoUse structure or by attaching the mfxExtVPPImageStab structure
directly to the mfxVideoParam structure and calling the MFXVideoVPP_Query function.
If this filter is supported, the function returns a MFX_ERR_NONE
status and copies the content of the input structure to the output structure. If the filter is not supported, the function returns MFX_WRN_FILTER_SKIPPED, removes the
filter from the mfxExtVPPDoUse structure, and zeroes the mfxExtVPPImageStab structure.
If the image stabilization filter is not supported, both MFXVideoVPP_Init and MFXVideoVPP_Reset functions return a MFX_WRN_FILTER_SKIPPED status.
The application can retrieve the list of active filters by attaching the mfxExtVPPDoUse structure to the mfxVideoParam structure and calling the
MFXVideoVPP_GetVideoParam function. The application must allocate enough memory for the filter list.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_IMAGE_STABILIZATION. */
mfxU16 Mode; /*!< Image stabilization mode. See ImageStabMode enumerator for values. */
mfxU16 reserved[11];
} mfxExtVPPImageStab;
MFX_PACK_END()
/*!
The InsertHDRPayload enumerator itemizes HDR payloads insertion rules in the encoder,
and indicates if there is valid HDR information in the clip in the decoder.
*/
enum {
MFX_PAYLOAD_OFF = 0, /*!< Do not insert payload when encoding;
Clip does not have valid HDR information when decoding. */
MFX_PAYLOAD_IDR = 1 /*!< Insert payload on IDR frames when encoding;
Clip has valid HDR information when decoding. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Handle the HDR information.
During encoding: If the application attaches this structure to the mfxEncodeCtrl structure at runtime,
the encoder inserts the HDR information for the current frame and ignores InsertPayloadToggle. If the application attaches this
structure to the mfxVideoParam structure during initialization or reset, the encoder inserts the HDR information based on InsertPayloadToggle.
During video processing: If the application attaches this structure for video processing, InsertPayloadToggle will be ignored.
And DisplayPrimariesX[3], DisplayPrimariesY[3] specify the color primaries where 0,1,2 specifies Red, Green, Blue respectively.
During decoding: If the application attaches this structure to the mfxFrameSurface1 structure at runtime
which will seed to the MFXVideoDECODE_DecodeFrameAsync() as surface_work parameter,
the decoder will parse the HDR information if the bitstream include HDR information per frame.
The parsed HDR information will be attached to the ExtendBuffer of surface_out parameter of MFXVideoDECODE_DecodeFrameAsync()
with flag `InsertPayloadToggle` to indicate if there is valid HDR information in the clip.
`InsertPayloadToggle` will be set to `MFX_PAYLOAD_IDR` if oneAPI Video Processing Library (oneVPL) gets valid HDR information, otherwise it will be set
to `MFX_PAYLOAD_OFF`.
This function is support for HEVC and AV1 only now.
Encoding or Decoding, Field semantics are defined in ITU-T* H.265 Annex D, AV1 6.7.4 Metadata OBU semantics.
Video processing, `DisplayPrimariesX[3]` and `WhitePointX` are in increments of 0.00002, in the range of [5, 37000]. `DisplayPrimariesY[3]`
and `WhitePointY` are in increments of 0.00002, in the range of [5, 42000]. `MaxDisplayMasteringLuminance` is in units of 1 candela per square meter.
`MinDisplayMasteringLuminance` is in units of 0.0001 candela per square meter.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME. */
mfxU16 reserved[15];
mfxU16 InsertPayloadToggle; /*!< InsertHDRPayload enumerator value. */
mfxU16 DisplayPrimariesX[3]; /*!< Color primaries for a video source. Consist of RGB x coordinates and
define how to convert colors from RGB color space to CIE XYZ color space. */
mfxU16 DisplayPrimariesY[3]; /*!< Color primaries for a video source. Consists of RGB y coordinates and
defines how to convert colors from RGB color space to CIE XYZ color space.*/
mfxU16 WhitePointX; /*!< White point X coordinate. */
mfxU16 WhitePointY; /*!< White point Y coordinate. */
mfxU32 MaxDisplayMasteringLuminance; /*!< Specify maximum luminance of the display on which the content was authored.*/
mfxU32 MinDisplayMasteringLuminance; /*!< Specify minimum luminance of the display on which the content was authored. */
} mfxExtMasteringDisplayColourVolume;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Handle the HDR information.
During encoding: If the application attaches this structure to the mfxEncodeCtrl structure at runtime,
the encoder inserts the HDR information for the current frame and ignores InsertPayloadToggle. If the application
attaches this structure to the mfxVideoParam structure during initialization or reset, the encoder inserts
the HDR information based on InsertPayloadToggle.
During video processing: If the application attaches this structure for video processing, InsertPayloadToggle will be ignored.
During decoding: If the application attaches this structure to the mfxFrameSurface1 structure at runtime
which will seed to the MFXVideoDECODE_DecodeFrameAsync() as surface_work parameter,
the decoder will parse the HDR information if the bitstream include HDR information per frame.
The parsed HDR information will be attached to the ExtendBuffer of surface_out parameter of MFXVideoDECODE_DecodeFrameAsync()
with flag `InsertPayloadToggle` to indicate if there is valid HDR information in the clip.
`InsertPayloadToggle` will be set to `MFX_PAYLOAD_IDR` if oneVPL gets valid HDR information, otherwise it will be set to `MFX_PAYLOAD_OFF`.
This function is support for HEVC and AV1 only now.
Field semantics are defined in ITU-T* H.265 Annex D, AV1 6.7.3 Metadata high dynamic range content light level semantics.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to EXTBUFF_CONTENT_LIGHT_LEVEL_INFO. */
mfxU16 reserved[9];
mfxU16 InsertPayloadToggle; /*!< InsertHDRPayload enumerator value. */
mfxU16 MaxContentLightLevel; /*!< Maximum luminance level of the content. Field range is 1 to 65535. */
mfxU16 MaxPicAverageLightLevel; /*!< Maximum average per-frame luminance level of the content. Field range is 1 to 65535. */
} mfxExtContentLightLevelInfo;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures the H.264 picture timing SEI message. The encoder ignores it if HRD information in
the stream is absent and the PicTimingSEI option in the mfxExtCodingOption structure is turned off. See mfxExtCodingOption for details.
If the application attaches this structure to the mfxVideoParam structure during initialization, the encoder inserts the picture timing
SEI message based on provided template in every access unit of coded bitstream.
If application attaches this structure to the mfxEncodeCtrl structure at runtime, the encoder inserts the picture timing SEI message
based on provided template in access unit that represents current frame.
These parameters define the picture timing information. An invalid value of 0xFFFF indicates that application does not set the value and
encoder must calculate it.
See Annex D of the ISO*\/IEC* 14496-10 specification for the definition of these parameters.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_PICTURE_TIMING_SEI. */
mfxU32 reserved[14];
struct {
mfxU16 ClockTimestampFlag;
mfxU16 CtType;
mfxU16 NuitFieldBasedFlag;
mfxU16 CountingType;
mfxU16 FullTimestampFlag;
mfxU16 DiscontinuityFlag;
mfxU16 CntDroppedFlag;
mfxU16 NFrames;
mfxU16 SecondsFlag;
mfxU16 MinutesFlag;
mfxU16 HoursFlag;
mfxU16 SecondsValue;
mfxU16 MinutesValue;
mfxU16 HoursValue;
mfxU32 TimeOffset;
} TimeStamp[3];
} mfxExtPictureTimingSEI;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures the H.264 temporal layers hierarchy.
If the application attaches it to the mfxVideoParam
structure during initialization, the encoder generates the temporal layers and inserts the prefix NAL unit before each slice to
indicate the temporal and priority IDs of the layer.
This structure can be used with the display-order encoding mode only.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AVC_TEMPORAL_LAYERS. */
mfxU32 reserved1[4];
mfxU16 reserved2;
mfxU16 BaseLayerPID; /*!< The priority ID of the base layer. The encoder increases the ID for each temporal layer and writes to the prefix NAL unit. */
struct {
mfxU16 Scale; /*!< The ratio between the frame rates of the current temporal layer and the base layer. */
mfxU16 reserved[3];
}Layer[8];
} mfxExtAvcTemporalLayers; /*!< The array of temporal layers; Use Scale=0 to specify absent layers. */
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used to retrieve encoder capability. See the description of mode 4 of the MFXVideoENCODE_Query function
for details on how to use this structure.
@note Not all implementations of the encoder support this extended buffer. The application must use query mode 1 to determine
if the functionality is supported. To do this, the application must attach this extended buffer to the mfxVideoParam structure and
call the MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE then the functionality is supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODER_CAPABILITY. */
mfxU32 MBPerSec; /*!< Specify the maximum processing rate in macro blocks per second. */
mfxU16 reserved[58];
} mfxExtEncoderCapability;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used to control the encoder behavior during reset. By using this structure, the application
instructs the encoder to start a new coded sequence after reset or to continue encoding of the current sequence.
This structure is also used in mode 3 of the MFXVideoENCODE_Query function to check for reset outcome before actual reset. The application
should set StartNewSequence to the required behavior and call the query function. If the query fails (see status codes below), then reset is not
possible in current encoder state. If the application sets StartNewSequence to MFX_CODINGOPTION_UNKNOWN, then the query function replaces the coding option with the
actual reset type: MFX_CODINGOPTION_ON if the encoder will begin a new sequence after reset or MFX_CODINGOPTION_OFF if the encoder will continue the current sequence.
Using this structure may cause one of the following status codes from the MFXVideoENCODE_Reset and MFXVideoENCODE_Queryfunctions:
@li MFX_ERR_INVALID_VIDEO_PARAM If a reset is not possible. For example, the application sets StartNewSequence to off and requests resolution change.
@li MFX_ERR_INCOMPATIBLE_VIDEO_PARAM If the application requests change that leads to memory allocation. For example, the application sets StartNewSequence to on and
requests resolution change to greater than the initialization value.
@li MFX_ERR_NONE If reset is possible.
The following limited list of parameters can be changed without starting a new coded sequence:
@li The bitrate parameters, TargetKbps and MaxKbps, in the mfxInfoMFX structure.
@li The number of slices, NumSlice, in the mfxInfoMFX structure. Number of slices should be equal to or less than the number of slices during initialization.
@li The number of temporal layers in the mfxExtAvcTemporalLayers structure. Reset should be called immediately before encoding of frame from base layer and
number of reference frames should be large enough for the new temporal layers structure.
@li The quantization parameters, QPI, QPP and QPB, in the mfxInfoMFX structure.
The application should retrieve all cached frames before calling reset. When the Query API function
checks for reset outcome, it expects that this requirement be satisfied. If it is not true and there are some cached frames inside the
encoder, then the query result may differ from the reset result, because the encoder may insert an IDR frame to produce valid coded sequence.
\verbatim embed:rst
See the :ref:`Configuration Change <config-change>` section for more information.
\endverbatim
@note Not all implementations of the encoder support this extended buffer. The application must use query mode 1 to determine if the
functionality is supported. To do this, the application must attach this extended buffer to the mfxVideoParam structure and call the
MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE, then the functionality is supported.
\verbatim embed:rst
See the :ref:`Streaming and Video Conferencing Features <stream_vid_conf_features>` section for more information.
\endverbatim
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODER_RESET_OPTION. */
/*!
Instructs encoder to start new sequence after reset. Use one of the CodingOptionValue options:
@li MFX_CODINGOPTION_ON The encoder completely reset internal state and begins new coded sequence after reset, including
insertion of IDR frame, sequence, and picture headers.
@li MFX_CODINGOPTION_OFF The encoder continues encoding of current coded sequence after reset, without insertion of IDR frame.
@li MFX_CODINGOPTION_UNKNOWN Depending on the current encoder state and changes in configuration parameters, the encoder may or may not
start new coded sequence. This value is also used to query reset outcome.
*/
mfxU16 StartNewSequence;
mfxU16 reserved[11];
} mfxExtEncoderResetOption;
MFX_PACK_END()
/*! The LongTermIdx specifies long term index of picture control. */
enum {
MFX_LONGTERM_IDX_NO_IDX = 0xFFFF /*!< Long term index of picture is undefined. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by the encoder to report additional information about the encoded picture. The application can attach
this buffer to the mfxBitstream structure before calling MFXVideoENCODE_EncodeFrameAsync function. For interlaced content the encoder
requires two such structures. They correspond to fields in encoded order.
@note Not all implementations of the encoder support this extended buffer. The application must use query mode 1 to determine if
the functionality is supported. To do this, the application must attach this extended buffer to the mfxVideoParam structure and
call the MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE then the functionality is supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODED_FRAME_INFO. */
mfxU32 FrameOrder; /*!< Frame order of encoded picture. */
mfxU16 PicStruct; /*!< Picture structure of encoded picture. */
mfxU16 LongTermIdx; /*!< Long term index of encoded picture if applicable. */
mfxU32 MAD; /*!< Mean Absolute Difference between original pixels of the frame and motion compensated (for inter macroblocks) or
spatially predicted (for intra macroblocks) pixels. Only luma component, Y plane, is used in calculation. */
mfxU16 BRCPanicMode; /*!< Bitrate control was not able to allocate enough bits for this frame. Frame quality may be unacceptably low. */
mfxU16 QP; /*!< Luma QP. */
mfxU32 SecondFieldOffset; /*!< Offset to second field. Second field starts at mfxBitstream::Data + mfxBitstream::DataOffset + mfxExtAVCEncodedFrameInfo::SecondFieldOffset. */
mfxU16 reserved[2];
struct {
/*! @{
@name Reference Lists
The following structure members are used by the reference lists contained in the parent structure. */
mfxU32 FrameOrder; /*!< Frame order of reference picture. */
mfxU16 PicStruct; /*!< Picture structure of reference picture. */
mfxU16 LongTermIdx; /*!< Long term index of reference picture if applicable. */
mfxU16 reserved[4];
/*! @} */
} UsedRefListL0[32], /*!< Reference list that has been used to encode picture. */
UsedRefListL1[32]; /*!< Reference list that has been used to encode picture. */
} mfxExtAVCEncodedFrameInfo;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used to specify input stream details for composition of several input surfaces in the one output.
*/
typedef struct mfxVPPCompInputStream {
mfxU32 DstX; /*!< X coordinate of location of input stream in output surface. */
mfxU32 DstY; /*!< Y coordinate of location of input stream in output surface. */
mfxU32 DstW; /*!< Width of of location of input stream in output surface.*/
mfxU32 DstH; /*!< Height of of location of input stream in output surface.*/
mfxU16 LumaKeyEnable; /*!< Non-zero value enables luma keying for the input stream. Luma keying is used to mark some of the areas
of the frame with specified luma values as transparent. It may, for example, be used for closed captioning. */
mfxU16 LumaKeyMin; /*!< Minimum value of luma key, inclusive. Pixels whose luma values fit in this range are rendered transparent. */
mfxU16 LumaKeyMax; /*!< Maximum value of luma key, inclusive. Pixels whose luma values fit in this range are rendered transparent. */
mfxU16 GlobalAlphaEnable; /*!< Non-zero value enables global alpha blending for this input stream. */
mfxU16 GlobalAlpha; /*!< Alpha value for this stream. Should be in the range of 0 to 255, where 0 is transparent and 255 is opaque. */
mfxU16 PixelAlphaEnable; /*!< Non-zero value enables per pixel alpha blending for this input stream. The stream should have RGB color format. */
mfxU16 TileId; /*!< Specify the tile this video stream is assigned to. Should be in the range of 0 to NumTiles. Valid only if NumTiles > 0. */
mfxU16 reserved2[17];
} mfxVPPCompInputStream;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Used to control composition of several input surfaces in one output. In this mode, the VPP skips
any other filters. The VPP returns an error if any mandatory filter is specified and returns the filter skipped warning if an optional filter is specified. The only
supported filters are deinterlacing and interlaced scaling. The only supported combinations of input and output color formats are:
- RGB to RGB,
- NV12 to NV12,
- RGB and NV12 to NV12, for per the pixel alpha blending use case.
The VPP returns MFX_ERR_MORE_DATA for additional input until an output is ready. When the output is ready, the VPP returns MFX_ERR_NONE.
The application must process the output frame after synchronization.
The composition process is controlled by:
- mfxFrameInfo::CropXYWH in the input surface defines the location of the picture in the input frame.
- InputStream[i].DstXYWH defines the location of the cropped input picture in the output frame.
- mfxFrameInfo::CropXYWH in the output surface defines the actual part of the output frame. All pixels in the output frame outside this region will be filled by the specified color.
If the application uses the composition process on video streams with different frame sizes, the application should provide maximum frame size in the
mfxVideoParam structure during the initialization, reset, or query operations.
If the application uses the composition process, the MFXVideoVPP_QueryIOSurf function returns the cumulative number of input surfaces, that is, the number
required to process all input video streams. The function sets the frame size in the mfxFrameAllocRequest equal to the size provided by the
application in the mfxVideoParam structure.
The composition process supports all types of surfaces.
All input surfaces should have the same type and color format, except for the per pixel alpha blending case, where it is allowable to mix NV12 and RGB
surfaces.
There are three different blending use cases:
- <b>Luma keying.</b> All input surfaces should have the NV12 color format specified during VPP initialization. Part of each surface, including the
first one, may be rendered transparent by using LumaKeyEnable, LumaKeyMin, and LumaKeyMax values.
- <b>Global alpha blending.</b> All input surfaces should have the same color format, NV12 or RGB, specified during VPP initialization. Each input surface, including the first one, can be blended with underlying surfaces by using GlobalAlphaEnable and
GlobalAlpha values.
- <b>Per-pixel alpha blending.</b> It is allowed to mix NV12 and RGB input surfaces. Each RGB input surface, including the first one,
can be blended with underlying surfaces by using PixelAlphaEnable value.
It is not allowed to mix different blending use cases in the same function call.
In the special case where the destination region of the output surface defined by output crops is fully covered with destination sub-regions of the
surfaces, the fast compositing mode can be enabled. The main use case for this mode is a video-wall scenario with a fixed destination surface
partition into sub-regions of potentially different size.
In order to trigger this mode, the application must cluster input surfaces into tiles, defining at least one tile by setting the NumTiles
field to be greater than 0, and assigning surfaces to the corresponding tiles by setting the TileId field to the value within the 0 to NumTiles range per
input surface. Tiles should also satisfy the following additional constraints:
- Each tile should not have more than 8 surfaces assigned to it.
- Tile bounding boxes, as defined by the enclosing rectangles of a union of a surfaces assigned to this tile, should not intersect.
Background color may be changed dynamically through Reset. There is no default value. YUV black is (0;128;128) or (16;128;128) depending
on the sample range. The library uses a YUV or RGB triple depending on output color format.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_COMPOSITE. */
/* background color*/
union {
mfxU16 Y; /*!< Y value of the background color. */
mfxU16 R; /*!< R value of the background color. */
};
union {
mfxU16 U; /*!< U value of the background color. */
mfxU16 G; /*!< G value of the background color. */
};
union {
mfxU16 V; /*!< V value of the background color. */
mfxU16 B; /*!< B value of the background color. */
};
mfxU16 NumTiles; /*!< Number of input surface clusters grouped together to enable fast compositing. May be changed dynamically
at runtime through Reset. */
mfxU16 reserved1[23];
mfxU16 NumInputStream; /*!< Number of input surfaces to compose one output. May be changed dynamically at runtime through Reset. Number of surfaces
can be decreased or increased, but should not exceed the number specified during initialization. Query mode 2 should be used
to find the maximum supported number. */
mfxVPPCompInputStream *InputStream; /*!< An array of mfxVPPCompInputStream structures that describe composition of input video streams. It should consist of exactly NumInputStream elements. */
} mfxExtVPPComposite;
MFX_PACK_END()
/*! The TransferMatrix enumerator itemizes color transfer matrices. */
enum {
MFX_TRANSFERMATRIX_UNKNOWN = 0, /*!< Transfer matrix is not specified */
MFX_TRANSFERMATRIX_BT709 = 1, /*!< Transfer matrix from ITU-R BT.709 standard. */
MFX_TRANSFERMATRIX_BT601 = 2 /*!< Transfer matrix from ITU-R BT.601 standard. */
};
/*! The NominalRange enumerator itemizes pixel's value nominal range. */
enum {
MFX_NOMINALRANGE_UNKNOWN = 0, /*!< Range is not defined. */
MFX_NOMINALRANGE_0_255 = 1, /*!< Range is from 0 to 255. */
MFX_NOMINALRANGE_16_235 = 2 /*!< Range is from 16 to 235. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used to control transfer matrix and nominal range of YUV frames. The application
should provide this during initialization. Supported for multiple conversions, for example YUV to YUV, YUV to RGB, and RGB to YUV.
@note This structure is used by VPP only and is not compatible with mfxExtVideoSignalInfo.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO. */
mfxU16 reserved1[4];
union {
struct { // Init
struct {
mfxU16 TransferMatrix; /*!< Transfer matrix. */
mfxU16 NominalRange; /*!< Nominal range. */
mfxU16 reserved2[6];
} In, Out;
};
struct { // Runtime<
mfxU16 TransferMatrix; /*!< Transfer matrix. */
mfxU16 NominalRange; /*!< Nominal range. */
mfxU16 reserved3[14];
};
};
} mfxExtVPPVideoSignalInfo;
MFX_PACK_END()
/*! The ROImode enumerator itemizes QP adjustment mode for ROIs. */
enum {
MFX_ROI_MODE_PRIORITY = 0, /*!< Priority mode. */
MFX_ROI_MODE_QP_DELTA = 1, /*!< QP mode */
MFX_ROI_MODE_QP_VALUE = 2 /*!< Absolute QP */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by the application to specify different Region Of Interests during encoding. It may be used at
initialization or at runtime.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODER_ROI. */
mfxU16 NumROI; /*!< Number of ROI descriptions in array. The Query API function mode 2 returns maximum supported value (set it to 256 and
query will update it to maximum supported value). */
mfxU16 ROIMode; /*!< QP adjustment mode for ROIs. Defines if Priority or DeltaQP is used during encoding. */
mfxU16 reserved1[10];
struct {
/*! @{
@name ROI location rectangle
The ROI rectangle definition uses end-point exclusive notation. In other words, the pixel with (Right, Bottom)
coordinates lies immediately outside of the ROI. Left, Top, Right, Bottom should be aligned by codec-specific block boundaries
(should be dividable by 16 for AVC, or by 32 for HEVC). Every ROI with unaligned coordinates will be expanded by the library to minimal-area
block-aligned ROI, enclosing the original one. For example (5, 5, 15, 31) ROI will be expanded to (0, 0, 16, 32) for AVC encoder,
or to (0, 0, 32, 32) for HEVC.
*/
mfxU32 Left; /*!< Left ROI's coordinate. */
mfxU32 Top; /*!< Top ROI's coordinate. */
mfxU32 Right; /*!< Right ROI's coordinate. */
mfxU32 Bottom; /*!< Bottom ROI's coordinate. */
union {
/*! Priority of ROI. Used if ROIMode = MFX_ROI_MODE_PRIORITY.This is an absolute value in the range of -3 to 3,
which will be added to the MB QP. Priority is deprecated mode and is used only for backward compatibility.
Bigger value produces better quality. */
mfxI16 Priority;
/*! Delta QP of ROI. Used if ROIMode = MFX_ROI_MODE_QP_DELTA. This is an absolute value in the range of -51 to 51,
which will be added to the MB QP. Lesser value produces better quality. */
mfxI16 DeltaQP;
};
mfxU16 reserved2[7];
/*! @} */
} ROI[256]; /*!< Array of ROIs. Different ROI may overlap each other. If macroblock belongs to several ROI,
Priority from ROI with lowest index is used. */
} mfxExtEncoderROI;
MFX_PACK_END()
/*! The DeinterlacingMode enumerator itemizes VPP deinterlacing modes. */
enum {
MFX_DEINTERLACING_BOB = 1, /*!< BOB deinterlacing mode. */
MFX_DEINTERLACING_ADVANCED = 2, /*!< Advanced deinterlacing mode. */
MFX_DEINTERLACING_AUTO_DOUBLE = 3, /*!< Auto mode with deinterlacing double frame rate output. */
MFX_DEINTERLACING_AUTO_SINGLE = 4, /*!< Auto mode with deinterlacing single frame rate output. */
MFX_DEINTERLACING_FULL_FR_OUT = 5, /*!< Deinterlace only mode with full frame rate output. */
MFX_DEINTERLACING_HALF_FR_OUT = 6, /*!< Deinterlace only Mode with half frame rate output. */
MFX_DEINTERLACING_24FPS_OUT = 7, /*!< 24 fps fixed output mode. */
MFX_DEINTERLACING_FIXED_TELECINE_PATTERN = 8, /*!< Fixed telecine pattern removal mode. */
MFX_DEINTERLACING_30FPS_OUT = 9, /*!< 30 fps fixed output mode. */
MFX_DEINTERLACING_DETECT_INTERLACE = 10, /*!< Only interlace detection. */
MFX_DEINTERLACING_ADVANCED_NOREF = 11, /*!< Advanced deinterlacing mode without using of reference frames. */
MFX_DEINTERLACING_ADVANCED_SCD = 12, /*!< Advanced deinterlacing mode with scene change detection. */
MFX_DEINTERLACING_FIELD_WEAVING = 13 /*!< Field weaving. */
};
/*! The TelecinePattern enumerator itemizes telecine patterns. */
enum {
MFX_TELECINE_PATTERN_32 = 0, /*!< 3:2 telecine. */
MFX_TELECINE_PATTERN_2332 = 1, /*!< 2:3:3:2 telecine. */
MFX_TELECINE_PATTERN_FRAME_REPEAT = 2, /*!< One frame repeat telecine. */
MFX_TELECINE_PATTERN_41 = 3, /*!< 4:1 telecine. */
MFX_TELECINE_POSITION_PROVIDED = 4 /*!< User must provide position inside a sequence of 5 frames where the artifacts start. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by the application to specify different deinterlacing algorithms.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_DEINTERLACING. */
mfxU16 Mode; /*!< Deinterlacing algorithm. See the DeinterlacingMode enumerator for details. */
mfxU16 TelecinePattern; /*!< Specifies telecine pattern when Mode = MFX_DEINTERLACING_FIXED_TELECINE_PATTERN. See the TelecinePattern enumerator for details.*/
mfxU16 TelecineLocation; /*!< Specifies position inside a sequence of 5 frames where the artifacts start when TelecinePattern = MFX_TELECINE_POSITION_PROVIDED*/
mfxU16 reserved[9]; /*!< Reserved for future use. */
} mfxExtVPPDeinterlacing;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Specifies reference lists for the encoder. It may be used together with the mfxExtAVCRefListCtrl
structure to create customized reference lists. If both structures are used together, then the encoder takes reference lists from the
mfxExtAVCRefLists structure and modifies them according to the mfxExtAVCRefListCtrl instructions. In case of interlaced coding,
the first mfxExtAVCRefLists structure affects TOP field and the second - BOTTOM field.
@note Not all implementations of the encoder support this structure. The application must use the Query API function to determine if it is supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AVC_REFLISTS. */
mfxU16 NumRefIdxL0Active; /*!< Specify the number of reference frames in the active reference list L0. This number should be less than or
equal to the NumRefFrame parameter from encoding initialization. */
mfxU16 NumRefIdxL1Active; /*!< Specify the number of reference frames in the active reference list L1. This number should be less than or
equal to the NumRefFrame parameter from encoding initialization. */
mfxU16 reserved[2];
/*! Used by the reference lists contained in the parent structure. Together these fields are used to identify reference picture. */
struct mfxRefPic{
mfxU32 FrameOrder; /*!< Use FrameOrder = MFX_FRAMEORDER_UNKNOWN to mark
unused entry. */
mfxU16 PicStruct; /*!< Use PicStruct = MFX_PICSTRUCT_FIELD_TFF for TOP field, PicStruct = MFX_PICSTRUCT_FIELD_BFF for
BOTTOM field. */
mfxU16 reserved[5];
} RefPicList0[32], /*!< Specify L0 reference list. */
RefPicList1[32]; /*!< Specify L1 reference list. */
}mfxExtAVCRefLists;
MFX_PACK_END()
/*! The VPPFieldProcessingMode enumerator is used to control VPP field processing algorithm. */
enum {
MFX_VPP_COPY_FRAME =0x01, /*!< Copy the whole frame. */
MFX_VPP_COPY_FIELD =0x02, /*!< Copy only one field. */
MFX_VPP_SWAP_FIELDS =0x03 /*!< Swap top and bottom fields. */
};
/*! The PicType enumerator itemizes picture type. */
enum {
MFX_PICTYPE_UNKNOWN =0x00, /*!< Picture type is unknown. */
MFX_PICTYPE_FRAME =0x01, /*!< Picture is a frame. */
MFX_PICTYPE_TOPFIELD =0x02, /*!< Picture is a top field. */
MFX_PICTYPE_BOTTOMFIELD =0x04 /*!< Picture is a bottom field. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures the VPP field processing algorithm. The application can attach this extended buffer to
the mfxVideoParam structure to configure initialization and/or to the mfxFrameData during runtime. Runtime configuration has priority
over initialization configuration. If the field processing algorithm was activated via the mfxExtVPPDoUse structure and the mfxExtVPPFieldProcessing
extended buffer was not provided during initialization, this buffer must be attached to the mfxFrameData structure of each input surface.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_FIELD_PROCESSING. */
mfxU16 Mode; /*!< Specifies the mode of the field processing algorithm. See the VPPFieldProcessingMode enumerator for values of this option. */
mfxU16 InField; /*!< When Mode is MFX_VPP_COPY_FIELD, specifies input field. See the PicType enumerator for values of this parameter. */
mfxU16 OutField; /*!< When Mode is MFX_VPP_COPY_FIELD, specifies output field. See the PicType enumerator for values of this parameter. */
mfxU16 reserved[25];
} mfxExtVPPFieldProcessing;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
If attached to the mfxVideoParam structure during the Init stage, this buffer will instruct the decoder to resize output frames via the
fixed function resize engine (if supported by hardware), utilizing direct pipe connection and bypassing intermediate memory operations.
The main benefits of this mode of pipeline operation are offloading resize operation to a dedicated engine, thus reducing power
consumption and memory traffic.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_DEC_VIDEO_PROCESSING. */
/*! Input surface description. */
struct mfxIn{
mfxU16 CropX; /*!< X coordinate of region of interest of the input surface. */
mfxU16 CropY; /*!< Y coordinate of region of interest of the input surface. */
mfxU16 CropW; /*!< Width coordinate of region of interest of the input surface. */
mfxU16 CropH; /*!< Height coordinate of region of interest of the input surface. */
mfxU16 reserved[12];
}In; /*!< Input surface description. */
/*! Output surface description. */
struct mfxOut{
mfxU32 FourCC; /*!< FourCC of output surface Note: Should be MFX_FOURCC_NV12. */
mfxU16 ChromaFormat; /*!< Chroma Format of output surface.
@note Should be MFX_CHROMAFORMAT_YUV420 */
mfxU16 reserved1;
mfxU16 Width; /*!< Width of output surface. */
mfxU16 Height; /*!< Height of output surface. */
mfxU16 CropX; /*!< X coordinate of region of interest of the output surface. */
mfxU16 CropY; /*!< Y coordinate of region of interest of the output surface. */
mfxU16 CropW; /*!< Width coordinate of region of interest of the output surface. */
mfxU16 CropH; /*!< Height coordinate of region of interest of the output surface. */
mfxU16 reserved[22];
}Out; /*!< Output surface description. */
mfxU16 reserved[13];
} mfxExtDecVideoProcessing;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Members of this structure define the location of chroma samples information.
See Annex E of the ISO*\/IEC* 14496-10 specification for the definition of these parameters.
@note Not all implementations of the encoder support this structure. The application must use the Query API function to determine if it is supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_CHROMA_LOC_INFO. */
mfxU16 ChromaLocInfoPresentFlag;
mfxU16 ChromaSampleLocTypeTopField;
mfxU16 ChromaSampleLocTypeBottomField;
mfxU16 reserved[9];
} mfxExtChromaLocInfo;
MFX_PACK_END()
/*! The MBQPMode enumerator itemizes QP update modes. */
enum {
MFX_MBQP_MODE_QP_VALUE = 0, /*!< QP array contains QP values. */
MFX_MBQP_MODE_QP_DELTA = 1, /*!< QP array contains deltas for QP. */
MFX_MBQP_MODE_QP_ADAPTIVE = 2 /*!< QP array contains deltas for QP or absolute QP values. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Specifies per-MB or per-CU mode and QP or DeltaQP value depending on the mode type.
*/
typedef struct{
union {
/*!
QP for MB or CU. Valid when Mode = MFX_MBQP_MODE_QP_VALUE.
For AVC, the valid range is 1 to 51.
For HEVC, the valid range is 1 to 51. The application's provided QP values should be valid, otherwise invalid QP values may cause undefined behavior.
MBQP map should be aligned for 16x16 block size. The align rule is: (width +15 /16) && (height +15 /16).
For MPEG2, the valid range is 1 to 112. QP corresponds to quantizer_scale of the ISO*\/IEC* 13818-2 specification.
*/
mfxU8 QP;
/*!
Per-macroblock QP delta. Valid when Mode = MFX_MBQP_MODE_QP_DELTA.
*/
mfxI8 DeltaQP;
};
mfxU16 Mode; /*!< Defines QP update mode. Can be equal to MFX_MBQP_MODE_QP_VALUE or MFX_MBQP_MODE_QP_DELTA. */
} mfxQPandMode;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
Specifies per-macroblock QP for current frame if mfxExtCodingOption3::EnableMBQP was turned ON during
encoder initialization. The application can attach this extended buffer to the mfxEncodeCtrl structure during runtime.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MBQP. */
mfxU32 reserved[9];
mfxU32 Pitch; /*!< Distance in bytes between the start of two consecutive rows in the QP array. */
mfxU16 Mode; /*!< Defines QP update mode. See MBQPMode enumerator for more details. */
mfxU16 BlockSize; /*!< QP block size, valid for HEVC only during Init and Runtime. */
mfxU32 NumQPAlloc; /*!< Size of allocated by application QP or DeltaQP array. */
union {
/*!
Pointer to a list of per-macroblock QP in raster scan order. In case of interlaced encoding the first half of QP array affects the top
field and the second half of QP array affects the bottom field. Valid when Mode = MFX_MBQP_MODE_QP_VALUE.
For AVC, the valid range is 1 to 51.
For HEVC, the valid range is 1 to 51. Application's provided QP values should be valid. Otherwise invalid QP values may cause undefined behavior.
MBQP map should be aligned for 16x16 block size. The alignment rule is (width +15 /16) && (height +15 /16).
For MPEG2, QP corresponds to quantizer_scale of the ISO*\/IEC* 13818-2 specification and has a valid range of 1 to 112.
*/
mfxU8 *QP;
mfxI8 *DeltaQP; /*!< Pointer to a list of per-macroblock QP deltas in raster scan order.
For block i: QP[i] = BrcQP[i] + DeltaQP[i]. Valid when Mode = MFX_MBQP_MODE_QP_DELTA. */
mfxQPandMode *QPmode; /*!< Block-granularity modes when MFX_MBQP_MODE_QP_ADAPTIVE is set. */
mfxU64 reserved2;
};
} mfxExtMBQP;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Runtime ctrl buffer for SPS/PPS insertion with current encoding frame.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_INSERT_HEADERS. */
mfxU16 SPS; /*!< Tri-state option to insert SPS. */
mfxU16 PPS; /*!< Tri-state option to insert PPS. */
mfxU16 reserved[8];
} mfxExtInsertHeaders;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Specifies rectangle areas for IPCM coding mode.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODER_IPCM_AREA. */
mfxU16 reserve1[10];
mfxU16 NumArea; /*! Number of areas */
struct area {
mfxU32 Left; /*!< Left area coordinate. */
mfxU32 Top; /*!< Top area coordinate. */
mfxU32 Right; /*!< Right area coordinate. */
mfxU32 Bottom; /*!< Bottom area coordinate. */
mfxU16 reserved2[8];
} * Areas; /*!< Array of areas. */
} mfxExtEncoderIPCMArea;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
Specifies macroblock map for current frame which forces specified macroblocks to be encoded as intra
if mfxExtCodingOption3::EnableMBForceIntra was turned ON during encoder initialization. The application can attach this extended
buffer to the mfxEncodeCtrl structure during runtime.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MB_FORCE_INTRA. */
mfxU32 reserved[11];
mfxU32 MapSize; /*!< Macroblock map size. */
union {
mfxU8 *Map; /*!< Pointer to a list of force intra macroblock flags in raster scan order. Each flag is one byte in map. Set flag to 1
to force corresponding macroblock to be encoded as intra. In case of interlaced encoding, the first half of map
affects top field and the second half of map affects the bottom field. */
mfxU64 reserved2;
};
} mfxExtMBForceIntra;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures tiles options for the HEVC encoder. The application can attach this extended buffer to the
mfxVideoParam structure to configure initialization.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_HEVC_TILES. */
mfxU16 NumTileRows; /*!< Number of tile rows. */
mfxU16 NumTileColumns; /*!< Number of tile columns. */
mfxU16 reserved[74];
}mfxExtHEVCTiles;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
Specifies macroblock map for current frame which forces specified macroblocks to be non-skip if
mfxExtCodingOption3::MBDisableSkipMap was turned ON during encoder initialization. The application can attach this
extended buffer to the mfxEncodeCtrl structure during runtime.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MB_DISABLE_SKIP_MAP. */
mfxU32 reserved[11];
mfxU32 MapSize; /*!< Macroblock map size. */
union {
mfxU8 *Map; /*!< Pointer to a list of non-skip macroblock flags in raster scan order. Each flag is one byte in map. Set flag to 1 to force
corresponding macroblock to be non-skip. In case of interlaced encoding, the first half of map affects
the top field and the second half of map affects the bottom field. */
mfxU64 reserved2;
};
} mfxExtMBDisableSkipMap;
MFX_PACK_END()
/*! The GeneralConstraintFlags enumerator uses bit-ORed values to itemize HEVC bitstream indications for specific profiles. Each value
indicates for format range extensions profiles.
To specify HEVC Main 10 Still Picture profile applications have to set mfxInfoMFX::CodecProfile == MFX_PROFILE_HEVC_MAIN10 and
mfxExtHEVCParam::GeneralConstraintFlags == MFX_HEVC_CONSTR_REXT_ONE_PICTURE_ONLY. */
enum {
/* REXT Profile constraint flags*/
MFX_HEVC_CONSTR_REXT_MAX_12BIT = (1 << 0),
MFX_HEVC_CONSTR_REXT_MAX_10BIT = (1 << 1),
MFX_HEVC_CONSTR_REXT_MAX_8BIT = (1 << 2),
MFX_HEVC_CONSTR_REXT_MAX_422CHROMA = (1 << 3),
MFX_HEVC_CONSTR_REXT_MAX_420CHROMA = (1 << 4),
MFX_HEVC_CONSTR_REXT_MAX_MONOCHROME = (1 << 5),
MFX_HEVC_CONSTR_REXT_INTRA = (1 << 6),
MFX_HEVC_CONSTR_REXT_ONE_PICTURE_ONLY = (1 << 7),
MFX_HEVC_CONSTR_REXT_LOWER_BIT_RATE = (1 << 8)
};
/*! The SampleAdaptiveOffset enumerator uses bit-ORed values to itemize corresponding HEVC encoding feature. */
enum {
MFX_SAO_UNKNOWN = 0x00, /*!< Use default value for platform/TargetUsage. */
MFX_SAO_DISABLE = 0x01, /*!< Disable SAO. If set during Init leads to SPS sample_adaptive_offset_enabled_flag = 0.
If set during Runtime, leads to to slice_sao_luma_flag = 0 and slice_sao_chroma_flag = 0
for current frame. */
MFX_SAO_ENABLE_LUMA = 0x02, /*!< Enable SAO for luma (slice_sao_luma_flag = 1). */
MFX_SAO_ENABLE_CHROMA = 0x04 /*!< Enable SAO for chroma (slice_sao_chroma_flag = 1). */
};
/* This struct has 4-byte alignment for binary compatibility with previously released versions of API */
MFX_PACK_BEGIN_USUAL_STRUCT()
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_HEVC_PARAM. */
mfxU16 PicWidthInLumaSamples; /*!< Specifies the width of each coded picture in units of luma samples. */
mfxU16 PicHeightInLumaSamples; /*!< Specifies the height of each coded picture in units of luma samples. */
mfxU64 GeneralConstraintFlags; /*!< Additional flags to specify exact profile and constraints. See the GeneralConstraintFlags enumerator for values of this field. */
mfxU16 SampleAdaptiveOffset; /*!< Controls SampleAdaptiveOffset encoding feature. See the SampleAdaptiveOffset enumerator for supported values
(bit-ORed). Valid during encoder Init and Runtime. */
mfxU16 LCUSize; /*!< Specifies largest coding unit size (max luma coding block). Valid during encoder Init. */
mfxU16 reserved[116];
} mfxExtHEVCParam;
MFX_PACK_END()
/*! The ErrorTypes enumerator uses bit-ORed values to itemize bitstream error types. */
enum {
MFX_ERROR_NO = 0, /*!< No error in bitstream. */
MFX_ERROR_PPS = (1 << 0), /*!< Invalid/corrupted PPS. */
MFX_ERROR_SPS = (1 << 1), /*!< Invalid/corrupted SPS. */
MFX_ERROR_SLICEHEADER = (1 << 2), /*!< Invalid/corrupted slice header. */
MFX_ERROR_SLICEDATA = (1 << 3), /*!< Invalid/corrupted slice data. */
MFX_ERROR_FRAME_GAP = (1 << 4), /*!< Missed frames. */
MFX_ERROR_JPEG_APP0_MARKER = (1 << 5), /*!< Invalid/corrupted APP0 marker. */
MFX_ERROR_JPEG_APP1_MARKER = (1 << 6), /*!< Invalid/corrupted APP1 marker. */
MFX_ERROR_JPEG_APP2_MARKER = (1 << 7), /*!< Invalid/corrupted APP2 marker. */
MFX_ERROR_JPEG_APP3_MARKER = (1 << 8), /*!< Invalid/corrupted APP3 marker. */
MFX_ERROR_JPEG_APP4_MARKER = (1 << 9), /*!< Invalid/corrupted APP4 marker. */
MFX_ERROR_JPEG_APP5_MARKER = (1 << 10), /*!< Invalid/corrupted APP5 marker. */
MFX_ERROR_JPEG_APP6_MARKER = (1 << 11), /*!< Invalid/corrupted APP6 marker. */
MFX_ERROR_JPEG_APP7_MARKER = (1 << 12), /*!< Invalid/corrupted APP7 marker. */
MFX_ERROR_JPEG_APP8_MARKER = (1 << 13), /*!< Invalid/corrupted APP8 marker. */
MFX_ERROR_JPEG_APP9_MARKER = (1 << 14), /*!< Invalid/corrupted APP9 marker. */
MFX_ERROR_JPEG_APP10_MARKER = (1 << 15), /*!< Invalid/corrupted APP10 marker. */
MFX_ERROR_JPEG_APP11_MARKER = (1 << 16), /*!< Invalid/corrupted APP11 marker. */
MFX_ERROR_JPEG_APP12_MARKER = (1 << 17), /*!< Invalid/corrupted APP12 marker. */
MFX_ERROR_JPEG_APP13_MARKER = (1 << 18), /*!< Invalid/corrupted APP13 marker. */
MFX_ERROR_JPEG_APP14_MARKER = (1 << 19), /*!< Invalid/corrupted APP14 marker. */
MFX_ERROR_JPEG_DQT_MARKER = (1 << 20), /*!< Invalid/corrupted DQT marker. */
MFX_ERROR_JPEG_SOF0_MARKER = (1 << 21), /*!< Invalid/corrupted SOF0 marker. */
MFX_ERROR_JPEG_DHT_MARKER = (1 << 22), /*!< Invalid/corrupted DHT marker. */
MFX_ERROR_JPEG_DRI_MARKER = (1 << 23), /*!< Invalid/corrupted DRI marker. */
MFX_ERROR_JPEG_SOS_MARKER = (1 << 24), /*!< Invalid/corrupted SOS marker. */
MFX_ERROR_JPEG_UNKNOWN_MARKER = (1 << 25), /*!< Unknown Marker. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by the decoders to report bitstream error information right after DecodeHeader or DecodeFrameAsync.
The application can attach this extended buffer to the mfxBitstream structure at runtime.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_DECODE_ERROR_REPORT. */
mfxU32 ErrorTypes; /*!< Bitstream error types (bit-ORed values). See ErrorTypes enumerator for the list of types. */
mfxU16 reserved[10];
} mfxExtDecodeErrorReport;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by the decoders to report additional information about a decoded frame. The application can attach this
extended buffer to the mfxFrameSurface1::mfxFrameData structure at runtime.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_DECODED_FRAME_INFO. */
mfxU16 FrameType; /*!< Frame type. See FrameType enumerator for the list of types. */
mfxU16 reserved[59];
} mfxExtDecodedFrameInfo;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by the library to pass MPEG 2 specific timing information.
See ISO/IEC 13818-2 and ITU-T H.262, MPEG-2 Part 2 for the definition of these parameters.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_TIME_CODE. */
mfxU16 DropFrameFlag; /*!< Indicated dropped frame. */
mfxU16 TimeCodeHours; /*!< Hours. */
mfxU16 TimeCodeMinutes; /*!< Minutes. */
mfxU16 TimeCodeSeconds; /*!< Seconds. */
mfxU16 TimeCodePictures; /*!< Pictures. */
mfxU16 reserved[7];
} mfxExtTimeCode;
MFX_PACK_END()
/*! The HEVCRegionType enumerator itemizes type of HEVC region. */
enum {
MFX_HEVC_REGION_SLICE = 0 /*!< Slice type. */
};
/*! The HEVCRegionEncoding enumerator itemizes HEVC region's encoding. */
enum {
MFX_HEVC_REGION_ENCODING_ON = 0,
MFX_HEVC_REGION_ENCODING_OFF = 1
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Attached to the mfxVideoParam structure during HEVC encoder initialization. Specifies the region to encode.
@note Not all implementations of the encoder support this structure. The application must use the Query API function to determine if it is supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_HEVC_REGION. */
mfxU32 RegionId; /*!< ID of region. */
mfxU16 RegionType; /*!< Type of region. See HEVCRegionType enumerator for the list of types. */
mfxU16 RegionEncoding; /*!< Set to MFX_HEVC_REGION_ENCODING_ON to encode only specified region. */
mfxU16 reserved[24];
} mfxExtHEVCRegion;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Specifies weighted prediction table for current frame when all of the following conditions are met:
@li mfxExtCodingOption3::WeightedPred was set to explicit during encoder Init or Reset .
@li The current frame is P-frame or mfxExtCodingOption3::WeightedBiPred was set to explicit during encoder Init or Reset.
@li The current frame is B-frame and is attached to the mfxEncodeCtrl structure.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_PRED_WEIGHT_TABLE. */
mfxU16 LumaLog2WeightDenom; /*!< Base 2 logarithm of the denominator for all luma weighting factors. Value must be in the range of 0 to 7, inclusive. */
mfxU16 ChromaLog2WeightDenom; /*!< Base 2 logarithm of the denominator for all chroma weighting factors. Value must be in the range of 0 to 7, inclusive. */
mfxU16 LumaWeightFlag[2][32]; /*!< LumaWeightFlag[L][R] equal to 1 specifies that the weighting factors for the luma component are specified for R's entry of RefPicList L. */
mfxU16 ChromaWeightFlag[2][32]; /*!< ChromaWeightFlag[L][R] equal to 1 specifies that the weighting factors for the chroma component are specified for R's entry of RefPicList L. */
mfxI16 Weights[2][32][3][2]; /*!< The values of the weights and offsets used in the encoding processing. The value of Weights[i][j][k][m] is
interpreted as: i refers to reference picture list 0 or 1; j refers to reference list entry 0-31;
k refers to data for the luma component when it is 0, the Cb chroma component when it is 1 and
the Cr chroma component when it is 2; m refers to weight when it is 0 and offset when it is 1 */
mfxU16 reserved[58];
} mfxExtPredWeightTable;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by encoders to set rounding offset parameters for quantization. It is per-frame based encoding control,
and can be attached to some frames and skipped for others. When the extension buffer is set the application can attach it to the mfxEncodeCtrl
during runtime.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AVC_ROUNDING_OFFSET. */
mfxU16 EnableRoundingIntra; /*!< Enable rounding offset for intra blocks. See the CodingOptionValue enumerator for values of this option. */
mfxU16 RoundingOffsetIntra; /*!< Intra rounding offset. Value must be in the range of 0 to 7, inclusive. */
mfxU16 EnableRoundingInter; /*!< Enable rounding offset for inter blocks. See the CodingOptionValue enumerator for values of this option. */
mfxU16 RoundingOffsetInter; /*!< Inter rounding offset. Value must be in the range of 0 to 7, inclusive. */
mfxU16 reserved[24];
} mfxExtAVCRoundingOffset;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by the application to specify dirty regions within a frame during encoding. It may be used at initialization or at runtime.
Dirty rectangle definition is using end-point exclusive notation. In other words, the pixel with (Right, Bottom) coordinates lies
immediately outside of the dirty rectangle. Left, Top, Right, Bottom should be aligned by codec-specific block boundaries (should be
dividable by 16 for AVC, or by block size (8, 16, 32 or 64, depends on platform) for HEVC).
Every dirty rectangle with unaligned
coordinates will be expanded to a minimal-area block-aligned dirty rectangle, enclosing the original one.
For example, a (5, 5, 15, 31) dirty rectangle will be expanded to (0, 0, 16, 32) for AVC encoder, or to (0, 0, 32, 32) for HEVC,
if block size is 32.
Dirty rectangle (0, 0, 0, 0) is a valid dirty rectangle and means that the frame is not changed.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_DIRTY_RECTANGLES. */
mfxU16 NumRect; /*!< Number of dirty rectangles. */
mfxU16 reserved1[11];
struct {
/*! @{
@name Dirty rectangle coordinates
The following structure members are used by the Rect array contained in the parent structure.
*/
mfxU32 Left; /*!< Dirty region left coordinate. */
mfxU32 Top; /*!< Dirty region top coordinate. */
mfxU32 Right; /*!< Dirty region right coordinate. */
mfxU32 Bottom; /*!< Dirty region bottom coordinate. */
mfxU16 reserved2[8];
/*! @} */
} Rect[256]; /*!< Array of dirty rectangles. */
} mfxExtDirtyRect;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by the application to specify moving regions within a frame during encoding.
Destination rectangle location should be aligned to MB boundaries (should be dividable by 16). If not, the encoder
truncates it to MB boundaries, for example, both 17 and 31 will be truncated to 16.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MOVING_RECTANGLE. */
mfxU16 NumRect; /*!< Number of moving rectangles. */
mfxU16 reserved1[11];
struct {
/*! @{
@name Destination and source rectangle location
The following structure members are used by the Rect array contained in the parent structure.
*/
mfxU32 DestLeft; /*!< Destination rectangle location. */
mfxU32 DestTop; /*!< Destination rectangle location. */
mfxU32 DestRight; /*!< Destination rectangle location. */
mfxU32 DestBottom; /*!< Destination rectangle location. */
mfxU32 SourceLeft; /*!< Source rectangle location. */
mfxU32 SourceTop; /*!< Source rectangle location. */
mfxU16 reserved2[4];
/*! @} */
} Rect[256]; /*!< Array of moving rectangles. */
} mfxExtMoveRect;
MFX_PACK_END()
/*! The Angle enumerator itemizes valid rotation angles. */
enum {
MFX_ANGLE_0 = 0, /*!< 0 degrees. */
MFX_ANGLE_90 = 90, /*!< 90 degrees. */
MFX_ANGLE_180 = 180, /*!< 180 degrees. */
MFX_ANGLE_270 = 270 /*!< 270 degrees. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures the VPP Rotation filter algorithm.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_ROTATION. */
mfxU16 Angle; /*!< Rotation angle. See Angle enumerator for supported values. */
mfxU16 reserved[11];
} mfxExtVPPRotation;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
Used by the encoder to report additional information about encoded slices. The application can attach this
buffer to the mfxBitstream structure before calling the MFXVideoENCODE_EncodeFrameAsync function.
@note Not all implementations of the encoder support this extended buffer. The application must use query mode 1 to determine if the
functionality is supported. To do this, the application must attach this extended buffer to the mfxVideoParam structure and call the
MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE, then the functionality is supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODED_SLICES_INFO. */
mfxU16 SliceSizeOverflow; /*!< When mfxExtCodingOption2::MaxSliceSize is used, indicates the requested slice size was not met for one or more generated slices. */
mfxU16 NumSliceNonCopliant; /*!< When mfxExtCodingOption2::MaxSliceSize is used, indicates the number of generated slices exceeds specification limits. */
mfxU16 NumEncodedSlice; /*!< Number of encoded slices. */
mfxU16 NumSliceSizeAlloc; /*!< SliceSize array allocation size. Must be specified by application. */
union {
mfxU16 *SliceSize; /*!< Slice size in bytes. Array must be allocated by application. */
mfxU64 reserved1;
};
mfxU16 reserved[20];
} mfxExtEncodedSlicesInfo;
MFX_PACK_END()
/*! The ScalingMode enumerator itemizes variants of scaling filter implementation. */
enum {
MFX_SCALING_MODE_DEFAULT = 0, /*!< Default scaling mode. The library selects the most appropriate scaling method. */
MFX_SCALING_MODE_LOWPOWER = 1, /*!< Low power scaling mode which is applicable for library implementations.
The exact scaling algorithm is defined by the library. */
MFX_SCALING_MODE_QUALITY = 2, /*!< The best quality scaling mode. */
MFX_SCALING_MODE_VENDOR = 1000, /*!< The enumeration to separate common scaling controls above and vendor specific. */
MFX_SCALING_MODE_INTEL_GEN_COMPUTE = MFX_SCALING_MODE_VENDOR + 1, /*! The mode to run scaling operation on Execution Units (EUs). */
MFX_SCALING_MODE_INTEL_GEN_VDBOX = MFX_SCALING_MODE_VENDOR + 2, /*! The special optimization mode where scaling operation running on SFC (Scaler & Format Converter) is coupled with VDBOX (also known as Multi-Format Codec Engines). This mode is applicable for DECODE_VPP domain functions. */
MFX_SCALING_MODE_INTEL_GEN_VEBOX = MFX_SCALING_MODE_VENDOR + 3 /*! The special optimization mode where scaling operation running on SFC is coupled with VEBOX (HW video processing pipe). */
};
/*! The InterpolationMode enumerator specifies type of interpolation method used by VPP scaling filter. */
enum {
MFX_INTERPOLATION_DEFAULT = 0, /*!< Default interpolation mode for scaling. Library selects the most appropriate
scaling method. */
MFX_INTERPOLATION_NEAREST_NEIGHBOR = 1, /*!< Nearest neighbor interpolation method. */
MFX_INTERPOLATION_BILINEAR = 2, /*!< Bilinear interpolation method. */
MFX_INTERPOLATION_ADVANCED = 3 /*!< Advanced interpolation method is defined by each implementation and usually gives best quality. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures the VPP Scaling filter algorithm.
Not all combinations of ScalingMode and InterpolationMethod are supported in the library. The application must use the Query API function to determine if a combination is supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_SCALING. */
mfxU16 ScalingMode; /*!< Scaling mode. See ScalingMode for values. */
mfxU16 InterpolationMethod; /*!< Interpolation mode for scaling algorithm. See InterpolationMode for values. */
mfxU16 reserved[10];
} mfxExtVPPScaling;
MFX_PACK_END()
typedef mfxExtAVCRefListCtrl mfxExtHEVCRefListCtrl;
typedef mfxExtAVCRefLists mfxExtHEVCRefLists;
typedef mfxExtAvcTemporalLayers mfxExtHEVCTemporalLayers;
typedef mfxExtAVCRefListCtrl mfxExtRefListCtrl;
typedef mfxExtAVCEncodedFrameInfo mfxExtEncodedFrameInfo;
/* The MirroringType enumerator itemizes mirroring types. */
enum
{
MFX_MIRRORING_DISABLED = 0,
MFX_MIRRORING_HORIZONTAL = 1,
MFX_MIRRORING_VERTICAL = 2
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures the VPP Mirroring filter algorithm.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_MIRRORING. */
mfxU16 Type; /*!< Mirroring type. See MirroringType for values. */
mfxU16 reserved[11];
} mfxExtVPPMirroring;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Instructs encoder to use or not use samples over specified picture border for inter prediction. Attached to the mfxVideoParam structure.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_MV_OVER_PIC_BOUNDARIES. */
mfxU16 StickTop; /*!< When set to OFF, one or more samples outside corresponding picture boundary may be used in inter prediction.
See the CodingOptionValue enumerator for values of this option. */
mfxU16 StickBottom; /*!< When set to OFF, one or more samples outside corresponding picture boundary may be used in inter prediction.
See the CodingOptionValue enumerator for values of this option. */
mfxU16 StickLeft; /*!< When set to OFF, one or more samples outside corresponding picture boundary may be used in inter prediction.
See the CodingOptionValue enumerator for values of this option. */
mfxU16 StickRight; /*!< When set to OFF, one or more samples outside corresponding picture boundary may be used in inter prediction.
See the CodingOptionValue enumerator for values of this option. */
mfxU16 reserved[8];
} mfxExtMVOverPicBoundaries;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Configures the VPP ColorFill filter algorithm.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_COLORFILL. */
mfxU16 Enable; /*!< Set to ON makes VPP fill the area between Width/Height and Crop borders.
See the CodingOptionValue enumerator for values of this option. */
mfxU16 reserved[11];
} mfxExtVPPColorFill;
MFX_PACK_END()
/*! The ChromaSiting enumerator defines chroma location. Use bit-OR'ed values to specify the desired location. */
enum {
MFX_CHROMA_SITING_UNKNOWN = 0x0000, /*!< Unspecified. */
MFX_CHROMA_SITING_VERTICAL_TOP = 0x0001, /*!< Chroma samples are co-sited vertically on the top with the luma samples. */
MFX_CHROMA_SITING_VERTICAL_CENTER = 0x0002, /*!< Chroma samples are not co-sited vertically with the luma samples. */
MFX_CHROMA_SITING_VERTICAL_BOTTOM = 0x0004, /*!< Chroma samples are co-sited vertically on the bottom with the luma samples. */
MFX_CHROMA_SITING_HORIZONTAL_LEFT = 0x0010, /*!< Chroma samples are co-sited horizontally on the left with the luma samples. */
MFX_CHROMA_SITING_HORIZONTAL_CENTER = 0x0020 /*!< Chroma samples are not co-sited horizontally with the luma samples. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
A hint structure that tunes the VPP Color Conversion algorithm when
attached to the mfxVideoParam structure during VPP Init.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_COLOR_CONVERSION. */
mfxU16 ChromaSiting; /*!< See ChromaSiting enumerator for details. */
mfxU16 reserved[27];
} mfxExtColorConversion;
MFX_PACK_END()
/*! The VP9ReferenceFrame enumerator itemizes reference frame type by mfxVP9SegmentParam::ReferenceFrame parameter. */
enum {
MFX_VP9_REF_INTRA = 0, /*!< Intra. */
MFX_VP9_REF_LAST = 1, /*!< Last. */
MFX_VP9_REF_GOLDEN = 2, /*!< Golden. */
MFX_VP9_REF_ALTREF = 3 /*!< Alternative reference. */
};
/*!
The SegmentIdBlockSize enumerator indicates the block size represented by each segment_id in segmentation map.
These values are used with the mfxExtVP9Segmentation::SegmentIdBlockSize parameter.
*/
enum {
MFX_VP9_SEGMENT_ID_BLOCK_SIZE_UNKNOWN = 0, /*!< Unspecified block size. */
MFX_VP9_SEGMENT_ID_BLOCK_SIZE_8x8 = 8, /*!< 8x8 block size. */
MFX_VP9_SEGMENT_ID_BLOCK_SIZE_16x16 = 16, /*!< 16x16 block size. */
MFX_VP9_SEGMENT_ID_BLOCK_SIZE_32x32 = 32, /*!< 32x32 block size. */
MFX_VP9_SEGMENT_ID_BLOCK_SIZE_64x64 = 64, /*!< 64x64 block size. */
};
/*!
The SegmentFeature enumerator indicates features enabled for the segment.
These values are used with the mfxVP9SegmentParam::FeatureEnabled parameter.
*/
enum {
MFX_VP9_SEGMENT_FEATURE_QINDEX = 0x0001, /*!< Quantization index delta. */
MFX_VP9_SEGMENT_FEATURE_LOOP_FILTER = 0x0002, /*!< Loop filter level delta. */
MFX_VP9_SEGMENT_FEATURE_REFERENCE = 0x0004, /*!< Reference frame. */
MFX_VP9_SEGMENT_FEATURE_SKIP = 0x0008 /*!< Skip. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Contains features and parameters for the segment.
*/
typedef struct {
mfxU16 FeatureEnabled; /*!< Indicates which features are enabled for the segment. See the SegmentFeature enumerator for values for this
option. Values from the enumerator can be bit-OR'ed. Support of a particular feature depends on underlying
hardware platform. Application can check which features are supported by calling Query. */
mfxI16 QIndexDelta; /*!< Quantization index delta for the segment. Ignored if MFX_VP9_SEGMENT_FEATURE_QINDEX isn't set in FeatureEnabled.
Valid range for this parameter is [-255, 255]. If QIndexDelta is out of this range, it will be ignored.
If QIndexDelta is within valid range, but sum of base quantization index and QIndexDelta is out of [0, 255],
QIndexDelta will be clamped. */
mfxI16 LoopFilterLevelDelta; /*!< Loop filter level delta for the segment. Ignored if MFX_VP9_SEGMENT_FEATURE_LOOP_FILTER is not set in
FeatureEnabled. Valid range for this parameter is [-63, 63]. If LoopFilterLevelDelta is out of this range,
it will be ignored. If LoopFilterLevelDelta is within valid range, but sum of base loop filter level and
LoopFilterLevelDelta is out of [0, 63], LoopFilterLevelDelta will be clamped. */
mfxU16 ReferenceFrame; /*!< Reference frame for the segment. See VP9ReferenceFrame enumerator for values for this option. Ignored
if MFX_VP9_SEGMENT_FEATURE_REFERENCE isn't set in FeatureEnabled. */
mfxU16 reserved[12];
} mfxVP9SegmentParam;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
In the VP9 encoder it is possible to divide a frame into up to 8 segments and apply particular features (like delta for quantization index or for
loop filter level) on a per-segment basis. "Uncompressed header" of every frame indicates if segmentation is enabled for the current frame,
and (if segmentation enabled) contains full information about features applied to every segment. Every "Mode info block" of a coded
frame has segment_id in the range of 0 to 7.
To enable Segmentation, the mfxExtVP9Segmentation structure with correct settings should be passed to the encoder. It can be attached to the
mfxVideoParam structure during initialization or the MFXVideoENCODE_Reset call (static configuration). If the mfxExtVP9Segmentation buffer isn't
attached during initialization, segmentation is disabled for static configuration. If the buffer isn't attached for the Reset call, the encoder
continues to use static configuration for segmentation which was the default before this Reset call. If the mfxExtVP9Segmentation buffer with
NumSegments=0 is provided during initialization or Reset call, segmentation becomes disabled for static configuration.
The buffer can be attached to the mfxEncodeCtrl structure during runtime (dynamic configuration). Dynamic configuration is applied to the
current frame only. After encoding of the current frame, the encoder will switch to the next dynamic configuration or to static configuration if dynamic configuration
is not provided for next frame).
The SegmentIdBlockSize, NumSegmentIdAlloc, and SegmentId parameters represent a segmentation map. Here, the segmentation map is an array of segment_ids (one
byte per segment_id) for blocks of size NxN in raster scan order. The size NxN is specified by the application and is constant for the whole frame.
If mfxExtVP9Segmentation is attached during initialization and/or during runtime, all three parameters should be set to proper values that do not
conflict with each other and with NumSegments. If any of the parameters are not set or any conflict or error in these parameters is detected by the library, the segmentation
map will be discarded.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VP9_SEGMENTATION. */
mfxU16 NumSegments; /*!< Number of segments for frame. Value 0 means that segmentation is disabled. Sending 0 for a
particular frame will disable segmentation for this frame only. Sending 0 to the Reset API function will
disable segmentation permanently. Segmentation can be enabled again by a subsequent Reset call. */
mfxVP9SegmentParam Segment[8]; /*!< Array of mfxVP9SegmentParam structures containing features and parameters for every segment.
Entries with indexes bigger than NumSegments-1 are ignored. See the mfxVP9SegmentParam structure for
definitions of segment features and their parameters. */
mfxU16 SegmentIdBlockSize; /*!< Size of block (NxN) for segmentation map. See SegmentIdBlockSize enumerator for values for this
option. An encoded block that is bigger than SegmentIdBlockSize uses segment_id taken from it's
top-left sub-block from the segmentation map. The application can check if a particular block size is
supported by calling Query. */
mfxU32 NumSegmentIdAlloc; /*!< Size of buffer allocated for segmentation map (in bytes). Application must assure that
NumSegmentIdAlloc is large enough to cover frame resolution with blocks of size SegmentIdBlockSize.
Otherwise the segmentation map will be discarded. */
union {
mfxU8 *SegmentId; /*!< Pointer to the segmentation map buffer which holds the array of segment_ids in raster scan order. The application
is responsible for allocation and release of this memory. The buffer pointed to by SegmentId, provided during
initialization or Reset call should be considered in use until another SegmentId is provided via Reset
call (if any), or until MFXVideoENCODE_Close is called. The buffer pointed to by SegmentId provided with
mfxEncodeCtrl should be considered in use while the input surface is locked by the library. Every segment_id in the
map should be in the range of 0 to NumSegments-1. If some segment_id is out of valid range, the
segmentation map cannot be applied. If the mfxExtVP9Segmentation buffer is attached to the mfxEncodeCtrl structure in
runtime, SegmentId can be zero. In this case, the segmentation map from static configuration will be used. */
mfxU64 reserved1;
};
mfxU16 reserved[52];
} mfxExtVP9Segmentation;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Specifies temporal layer.
*/
typedef struct {
mfxU16 FrameRateScale; /*!< The ratio between the frame rates of the current temporal layer and the base layer. The library treats a particular
temporal layer as "defined" if it has FrameRateScale > 0. If the base layer is defined, it must have FrameRateScale = 1. FrameRateScale of each subsequent layer (if defined) must be a multiple of and greater than the
FrameRateScale value of previous layer. */
mfxU16 TargetKbps; /*!< Target bitrate for the current temporal layer. Ignored if RateControlMethod is CQP. If RateControlMethod is not CQP, the
application must provide TargetKbps for every defined temporal layer. TargetKbps of each subsequent layer (if defined)
must be greater than the TargetKbps value of the previous layer. */
mfxU16 reserved[14];
} mfxVP9TemporalLayer;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
API allows the encoding of VP9 bitstreams that contain several subset bitstreams that differ in frame rates, also called "temporal layers".
When decoding, each temporal layer can be extracted from the coded stream and decoded separately. The mfxExtVP9TemporalLayers structure
configures the temporal layers for the VP9 encoder. It can be attached to the mfxVideoParam structure during initialization or the
MFXVideoENCODE_Reset call. If the mfxExtVP9TemporalLayers buffer isn't attached during initialization, temporal scalability is disabled. If the buffer isn't attached for the Reset call, the encoder continues to use the temporal scalability configuration that was defined before the Reset call.
In the API, temporal layers are ordered by their frame rates in ascending order. Temporal layer 0 (having the lowest frame rate) is called the base layer.
Each subsequent temporal layer includes all previous layers.
The temporal scalability feature requires a minimum number of allocated reference
frames (controlled by the NumRefFrame parameter). If the NumRefFrame value set by the application isn't enough to build the reference structure for the requested
number of temporal layers, the library corrects the NumRefFrame value. The temporal layer structure is reset (re-started) after key-frames.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VP9_TEMPORAL_LAYERS. */
/*!
The array of temporal layers. Layer[0] specifies the base layer.
The library reads layers from the array when they are defined (FrameRateScale > 0).
All layers starting from first layer with FrameRateScale = 0 are ignored. The last layer that is not ignored is considered the "highest layer".
The frame rate of the highest layer is specified in the mfxVideoParam structure. Frame rates of lower layers are calculated using their FrameRateScale.
TargetKbps of the highest layer should be equal to the TargetKbps value specified in the mfxVideoParam structure. If it is not true, TargetKbps of highest temporal layers has priority.
If there are no defined layers in the Layer array, the temporal scalability feature is disabled. For example, to disable temporal scalability in runtime, the application should
pass mfxExtVP9TemporalLayers buffer to Reset with all FrameRateScales set to 0.
*/
mfxVP9TemporalLayer Layer[8];
mfxU16 reserved[60];
} mfxExtVP9TemporalLayers;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Structure attached to the mfxVideoParam structure. Extends the mfxVideoParam structure with VP9-specific parameters. Used by both decoder and encoder.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VP9_PARAM. */
mfxU16 FrameWidth; /*!< Width of the coded frame in pixels. */
mfxU16 FrameHeight; /*!< Height of the coded frame in pixels. */
mfxU16 WriteIVFHeaders; /*!< Set this option to ON to make the encoder insert IVF container headers to the output stream. The NumFrame field of the IVF
sequence header will be zero. It is the responsibility of the application to update the NumFrame field with the correct value. See the
CodingOptionValue enumerator for values of this option. */
mfxI16 reserved1[6];
mfxI16 QIndexDeltaLumaDC; /*!< Specifies an offset for a particular quantization parameter. */
mfxI16 QIndexDeltaChromaAC; /*!< Specifies an offset for a particular quantization parameter. */
mfxI16 QIndexDeltaChromaDC; /*!< Specifies an offset for a particular quantization parameter. */
/*!
Number of tile rows. Should be power of two. The maximum number of tile rows is 4, per the VP9 specification. In addition, the maximum supported number
of tile rows may depend on the underlying library implementation.
Use the Query API function to check if a particular pair of values (NumTileRows, NumTileColumns)
is supported. In VP9, tile rows have dependencies and cannot be encoded or decoded in parallel. Therefore, tile rows are always encoded by the library in
serial mode (one-by-one).
*/
mfxU16 NumTileRows;
/*!
Number of tile columns. Should be power of two. Restricted with maximum and minimum tile width in luma pixels, as defined in the VP9
specification (4096 and 256 respectively). In addition, the maximum supported number of tile columns may depend on the underlying library
implementation.
Use the Query API function to check if a particular pair of values (NumTileRows, NumTileColumns) is supported. In VP9, tile columns do not have
dependencies and can be encoded/decoded in parallel. Therefore, tile columns can be encoded by the library in both parallel and serial modes.
Parallel mode is automatically utilized by the library when NumTileColumns exceeds 1 and does not exceed the number of tile coding engines on the
platform. In other cases, serial mode is used. Parallel mode is capable of encoding more than 1 tile row (within limitations provided by VP9
specification and particular platform). Serial mode supports only tile grids 1xN and Nx1.
*/
mfxU16 NumTileColumns;
mfxU16 reserved[110];
} mfxExtVP9Param;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used to report encoded unit information.
*/
typedef struct {
mfxU16 Type; /*!< Codec-dependent coding unit type (NALU type for AVC/HEVC, start_code for MPEG2 etc). */
mfxU16 reserved1;
mfxU32 Offset; /*!< Offset relative to the associated mfxBitstream::DataOffset. */
mfxU32 Size; /*!< Unit size, including delimiter. */
mfxU32 reserved[5];
} mfxEncodedUnitInfo;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
/*!
If mfxExtCodingOption3::EncodedUnitsInfo was set to MFX_CODINGOPTION_ON during encoder initialization, the mfxExtEncodedUnitsInfo structure is
attached to the mfxBitstream structure during encoding. It is used to report information about coding units in the resulting bitstream.
The number of filled items in UnitInfo is min(NumUnitsEncoded, NumUnitsAlloc).
For counting a minimal amount of encoded units you can use the following algorithm:
@code
nSEI = amountOfApplicationDefinedSEI;
if (CodingOption3.NumSlice[IPB] != 0 || mfxVideoParam.mfx.NumSlice != 0)
ExpectedAmount = 10 + nSEI + Max(CodingOption3.NumSlice[IPB], mfxVideoParam.mfx.NumSlice);
else if (CodingOption2.NumMBPerSlice != 0)
ExpectedAmount = 10 + nSEI + (FrameWidth * FrameHeight) / (256 * CodingOption2.NumMBPerSlice);
else if (CodingOption2.MaxSliceSize != 0)
ExpectedAmount = 10 + nSEI + Round(MaxBitrate / (FrameRate*CodingOption2.MaxSliceSize));
else
ExpectedAmount = 10 + nSEI;
if (mfxFrameInfo.PictStruct != MFX_PICSTRUCT_PROGRESSIVE)
ExpectedAmount = ExpectedAmount * 2;
if (temporalScaleabilityEnabled)
ExpectedAmount = ExpectedAmount * 2;
@endcode
@note Only supported by the AVC encoder.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODED_UNITS_INFO. */
union {
mfxEncodedUnitInfo *UnitInfo; /*!< Pointer to an array of mfxEncodedUnitsInfo structures whose size is equal to or greater than NumUnitsAlloc. */
mfxU64 reserved1;
};
mfxU16 NumUnitsAlloc; /*!< UnitInfo array size. */
mfxU16 NumUnitsEncoded; /*!< Output field. Number of coding units to report. If NumUnitsEncoded is greater than NumUnitsAlloc, the UnitInfo
array will contain information only for the first NumUnitsAlloc units. User may consider reallocating the
UnitInfo array to avoid this for subsequent frames. */
mfxU16 reserved[22];
} mfxExtEncodedUnitsInfo;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Provides setup for the Motion-Compensated Temporal Filter (MCTF) during the VPP initialization and for control
parameters at runtime. By default, MCTF is off. An application may enable it by adding MFX_EXTBUFF_VPP_MCTF to the mfxExtVPPDoUse buffer or by
attaching mfxExtVppMctf to the mfxVideoParam structure during initialization or reset.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_MCTF. */
mfxU16 FilterStrength; /*!< Value in range of 0 to 20 (inclusive) to indicate the filter strength of MCTF.
The strength of the MCTF process controls the degree of possible change of pixel values eligible for MCTF - the greater the strength value, the larger the change. It is a dimensionless quantity - values in the range of 1 to 20 inclusively imply strength; value 0 stands for AUTO mode and is
valid during initialization or reset only
If an invalid value is given, it is fixed to the default value of 0.
If the field value is in the range of 1 to 20 inclusive, MCTF operates in fixed-strength mode with the given strength of MCTF process.
At runtime, values of 0 and greater than 20 are ignored. */
mfxU16 reserved[27];
} mfxExtVppMctf;
MFX_PACK_END()
/*! Describes type of workload passed to MFXQueryAdapters. */
typedef enum
{
MFX_COMPONENT_ENCODE = 1, /*!< Encode workload. */
MFX_COMPONENT_DECODE = 2, /*!< Decode workload. */
MFX_COMPONENT_VPP = 3 /*!< VPP workload. */
} mfxComponentType;
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Contains workload description, which is accepted by MFXQueryAdapters function.
*/
typedef struct
{
mfxComponentType Type; /*!< Type of workload: Encode, Decode, VPP. See mfxComponentType enumerator for values. */
mfxVideoParam Requirements; /*!< Detailed description of workload. See mfxVideoParam for details. */
mfxU16 reserved[4];
} mfxComponentInfo;
MFX_PACK_END()
/* Adapter description */
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Contains a description of the graphics adapter for the Legacy mode.
*/
typedef struct
{
mfxPlatform Platform; /*!< Platform type description. See mfxPlatform for details. */
mfxU32 Number; /*!< Value which uniquely characterizes media adapter. On Windows* this number can be used for initialization through
DXVA interface (see <a href="https://docs.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgifactory1-enumadapters1">example</a>). */
mfxU16 reserved[14];
} mfxAdapterInfo;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Contains description of all graphics adapters available on the current system.
*/
typedef struct
{
mfxAdapterInfo * Adapters; /*!< Pointer to array of mfxAdapterInfo structs allocated by user. */
mfxU32 NumAlloc; /*!< Length of Adapters array. */
mfxU32 NumActual; /*!< Number of Adapters entries filled by MFXQueryAdapters. */
mfxU16 reserved[4];
} mfxAdaptersInfo;
MFX_PACK_END()
/*! The PartialBitstreamOutput enumerator indicates flags of partial bitstream output type. */
enum {
MFX_PARTIAL_BITSTREAM_NONE = 0, /*!< Do not use partial output */
MFX_PARTIAL_BITSTREAM_SLICE = 1, /*!< Partial bitstream output will be aligned to slice granularity */
MFX_PARTIAL_BITSTREAM_BLOCK = 2, /*!< Partial bitstream output will be aligned to user-defined block size granularity */
MFX_PARTIAL_BITSTREAM_ANY = 3 /*!< Partial bitstream output will be return any coded data available at the end of SyncOperation timeout */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by an encoder to output parts of the bitstream as soon as they are ready. The application can attach this extended buffer to the
mfxVideoParam structure at initialization. If this option is turned ON (Granularity != MFX_PARTIAL_BITSTREAM_NONE), then the encoder can output
bitstream by part based on the required granularity.
This parameter is valid only during initialization and reset. Absence of this buffer means default or previously configured bitstream output
behavior.
@note Not all codecs and implementations support this feature. Use the Query API function to check if this feature is supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_PARTIAL_BITSTREAM_PARAM. */
mfxU32 BlockSize; /*!< Output block granularity for PartialBitstreamGranularity. Valid only for MFX_PARTIAL_BITSTREAM_BLOCK. */
mfxU16 Granularity; /*!< Granularity of the partial bitstream: slice/block/any, all types of granularity state in PartialBitstreamOutput enum. */
mfxU16 reserved[8];
} mfxExtPartialBitstreamParam;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
The mfxExtDeviceAffinityMask structure is used by the application to specify
affinity mask for the device with given device ID. See mfxDeviceDescription
for the device ID definition and sub device indexes. If the implementation
manages CPU threads for some purpose, the user can set the CPU thread affinity
mask by using this structure with DeviceID set to "CPU".
*/
typedef struct {
/*! Extension buffer header. Header.BufferId must be equal to
MFX_EXTBUFF_DEVICE_AFFINITY_MASK. */
mfxExtBuffer Header;
/*! Null terminated string with device ID. In case of CPU affinity mask
it must be equal to "CPU". */
mfxChar DeviceID[MFX_STRFIELD_LEN];
/*! Number of sub devices or threads in case of CPU in the mask. */
mfxU32 NumSubDevices;
/*! Mask array. Every bit represents sub-device (or thread for CPU).
"1" means execution is allowed. "0" means that execution is prohibited on
this sub-device (or thread). Length of the array is equal to the:
"NumSubDevices / 8" and rounded to the closest (from the right) integer.
Bits order within each entry of the mask array is LSB: bit 0 holds data
for sub device with index 0 and bit 8 for sub device with index 8.
Index of sub device is defined by the mfxDeviceDescription structure. */
mfxU8 *Mask;
mfxU32 reserved[4]; /*! Reserved for future use. */
} mfxExtDeviceAffinityMask;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The structure is used by AV1 encoder with more parameter control to encode frame. */
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AV1_BITSTREAM_PARAM. */
mfxU16 WriteIVFHeaders; /*!< Tri-state option to control IVF headers insertion, default is ON.
Writing IVF headers is enabled in the encoder when mfxExtAV1BitstreamParam is attached and its value is ON or zero.
Writing IVF headers is disabled by default in the encoder when mfxExtAV1BitstreamParam is not attached. */
mfxU16 reserved[31];
} mfxExtAV1BitstreamParam;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The structure is used by AV1 encoder with more parameter control to encode frame. */
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AV1_RESOLUTION_PARAM. */
mfxU32 FrameWidth; /*!< Width of the coded frame in pixels, default value is from mfxFrameInfo. */
mfxU32 FrameHeight; /*!< Height of the coded frame in pixels, default value is from mfxFrameInfo. */
mfxU32 reserved[6];
} mfxExtAV1ResolutionParam;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The structure is used by AV1 encoder with more parameter control to encode frame. */
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AV1_TILE_PARAM. */
mfxU16 NumTileRows; /*!< Number of tile rows, default value is 1. */
mfxU16 NumTileColumns; /*!< Number of tile columns, default value is 1. */
mfxU16 NumTileGroups; /*!< Number of tile groups, it will be ignored if the tile groups num is invalid, default value is 1. */
mfxU16 reserved[5];
} mfxExtAV1TileParam;
MFX_PACK_END()
/*!
The AV1 SegmentIdBlockSize enumerator indicates the block size represented by each segment_id in segmentation map.
These values are used with the mfxExtAV1Segmentation::SegmentIdBlockSize parameter.
*/
typedef enum {
MFX_AV1_SEGMENT_ID_BLOCK_SIZE_UNSPECIFIED = 0, /*!< Unspecified block size. */
MFX_AV1_SEGMENT_ID_BLOCK_SIZE_4x4 = 4, /*!< block size 4x4 */
MFX_AV1_SEGMENT_ID_BLOCK_SIZE_8x8 = 8, /*!< block size 8x8 */
MFX_AV1_SEGMENT_ID_BLOCK_SIZE_16x16 = 16, /*!< block size 16x16 */
MFX_AV1_SEGMENT_ID_BLOCK_SIZE_32x32 = 32, /*!< block size 32x32 */
MFX_AV1_SEGMENT_ID_BLOCK_SIZE_64x64 = 64, /*!< block size 64x64 */
MFX_AV1_SEGMENT_ID_BLOCK_SIZE_128x128 = 128 /*!< block size 128x128 */
} mfxAV1SegmentIdBlockSize;
/*!
The AV1 SegmentFeature enumerator indicates features enabled for the segment.
These values are used with the mfxAV1SegmentParam::FeatureEnabled parameter.
*/
enum {
MFX_AV1_SEGMENT_FEATURE_ALT_QINDEX = 0x0001, /*!< use alternate Quantizer. */
MFX_AV1_SEGMENT_FEATURE_ALT_LF_Y_VERT = 0x0002, /*!< use alternate loop filter value on y plane vertical. */
MFX_AV1_SEGMENT_FEATURE_ALT_LF_Y_HORZ = 0x0004, /*!< use alternate loop filter value on y plane horizontal. */
MFX_AV1_SEGMENT_FEATURE_ALT_LF_U = 0x0008, /*!< use alternate loop filter value on u plane. */
MFX_AV1_SEGMENT_FEATURE_ALT_LF_V = 0x0010, /*!< use alternate loop filter value on v plane. */
MFX_AV1_SEGMENT_FEATURE_REFERENCE = 0x0020, /*!< use segment reference frame. */
MFX_AV1_SEGMENT_FEATURE_SKIP = 0x0040, /*!< use segment (0,0) + skip mode. */
MFX_AV1_SEGMENT_FEATURE_GLOBALMV = 0x0080 /*!< use global motion vector. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Contains features and parameters for the segment.
*/
typedef struct {
mfxU16 FeatureEnabled; /*!< Indicates which features are enabled for the segment. See the AV1 SegmentFeature enumerator for values for
this option. Values from the enumerator can be bit-OR'ed. Support of a particular feature depends on underlying
hardware platform. Application can check which features are supported by calling Query. */
mfxI16 AltQIndex; /*!< Quantization index delta for the segment. Ignored if MFX_AV1_SEGMENT_FEATURE_ALT_QINDEX isn't set in FeatureEnabled.
Valid range for this parameter is [-255, 255]. If AltQIndex is out of this range, it will be ignored. If AltQIndex
is within valid range, but sum of base quantization index and AltQIndex is out of [0, 255], AltQIndex will be clamped. */
mfxU16 reserved[30];
} mfxAV1SegmentParam;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
In the AV1 encoder it is possible to divide a frame into up to 8 segments and apply particular features (like delta for quantization index or for
loop filter level) on a per-segment basis. "Uncompressed header" of every frame indicates if segmentation is enabled for the current frame,
and (if segmentation enabled) contains full information about features applied to every segment. Every "Mode info block" of a coded
frame has segment_id in the range of 0 to 7.
To enable Segmentation, the mfxExtAV1Segmentation structure with correct settings should be passed to the encoder. It can be attached to the
mfxVideoParam structure during initialization or the MFXVideoENCODE_Reset call (static configuration). If the mfxExtAV1Segmentation buffer isn't
attached during initialization, segmentation is disabled for static configuration. If the buffer isn't attached for the Reset call, the encoder
continues to use static configuration for segmentation which was the default before this Reset call. If the mfxExtAV1Segmentation buffer with
NumSegments=0 is provided during initialization or Reset call, segmentation becomes disabled for static configuration.
The buffer can be attached to the mfxEncodeCtrl structure during runtime (dynamic configuration). Dynamic configuration is applied to the
current frame only. After encoding of the current frame, the encoder will switch to the next dynamic configuration or to static configuration if
dynamic configuration is not provided for next frame).
The SegmentIdBlockSize, NumSegmentIdAlloc, and SegmentId parameters represent a segmentation map. Here, the segmentation map is an array of
segment_ids (one byte per segment_id) for blocks of size NxN in raster scan order. The size NxN is specified by the application and is constant
for the whole frame.
If mfxExtAV1Segmentation is attached during initialization and/or during runtime, all three parameters should be set to proper values that do not
conflict with each other and with NumSegments. If any of the parameters are not set or any conflict or error in these parameters is detected by
the library, the segmentation map will be discarded.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AV1_SEGMENTATION. */
mfxU8 NumSegments; /*!< Number of segments for frame. Value 0 means that segmentation is disabled. Sending 0 for a
particular frame will disable segmentation for this frame only. Sending 0 to the Reset API function will
disable segmentation permanently. Segmentation can be enabled again by a subsequent Reset call. */
mfxU8 reserved1[3];
mfxAV1SegmentParam Segment[8]; /*!< Array of mfxAV1SegmentParam structures containing features and parameters for every segment.
Entries with indexes bigger than NumSegments-1 are ignored. See the mfxAV1SegmentParam structure for
definitions of segment features and their parameters. */
mfxU16 SegmentIdBlockSize;/*!< Size of block (NxN) for segmentation map. See AV1 SegmentIdBlockSize enumerator for values for this
option. An encoded block that is bigger than AV1 SegmentIdBlockSize uses segment_id taken from it's
top-left sub-block from the segmentation map. The application can check if a particular block size is
supported by calling Query. */
mfxU16 reserved2;
mfxU32 NumSegmentIdAlloc; /*!< Size of buffer allocated for segmentation map (in bytes). Application must assure that
NumSegmentIdAlloc is large enough to cover frame resolution with blocks of size SegmentIdBlockSize.
Otherwise the segmentation map will be discarded. */
mfxU8 * SegmentIds; /*!< Pointer to the segmentation map buffer which holds the array of segment_ids in raster scan order. The application
is responsible for allocation and release of this memory. The buffer pointed to by SegmentId, provided during
initialization or Reset call should be considered in use until another SegmentId is provided via Reset
call (if any), or until MFXVideoENCODE_Close is called. The buffer pointed to by SegmentId provided with
mfxEncodeCtrl should be considered in use while the input surface is locked by the library. Every segment_id in the
map should be in the range of 0 to NumSegments-1. If some segment_id is out of valid range, the
segmentation map cannot be applied. If the mfxExtAV1Segmentation buffer is attached to the mfxEncodeCtrl structure in
runtime, SegmentId can be zero. In this case, the segmentation map from static configuration will be used. */
mfxU16 reserved[36];
} mfxExtAV1Segmentation;
MFX_PACK_END()
/*! The FilmGrainFlags enumerator itemizes flags in AV1 film grain parameters.
The flags are equivalent to respective syntax elements from film_grain_params() section of uncompressed header. */
enum {
MFX_FILM_GRAIN_NO = 0, /*!< Film grain isn't added to this frame. */
MFX_FILM_GRAIN_APPLY = (1 << 0), /*!< Film grain is added to this frame. */
MFX_FILM_GRAIN_UPDATE = (1 << 1), /*!< New set of film grain parameters is sent for this frame. */
MFX_FILM_GRAIN_CHROMA_SCALING_FROM_LUMA = (1 << 2), /*!< Chroma scaling is inferred from luma scaling. */
MFX_FILM_GRAIN_OVERLAP = (1 << 3), /*!< Overlap between film grain blocks is applied. */
MFX_FILM_GRAIN_CLIP_TO_RESTRICTED_RANGE = (1 << 4) /*!< Clipping to the restricted (studio) range is applied after adding the film grain. */
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Defines film grain point. */
typedef struct {
mfxU8 Value; /*!< The x coordinate for the i-th point of the piece-wise linear scaling function for luma/Cb/Cr component. */
mfxU8 Scaling; /*!< The scaling (output) value for the i-th point of the piecewise linear scaling function for luma/Cb/Cr component. */
} mfxAV1FilmGrainPoint;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The structure is used by AV-1 decoder to report film grain parameters for decoded frame. */
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AV1_FILM_GRAIN_PARAM. */
mfxU16 FilmGrainFlags; /*!< Bit map with bit-ORed flags from FilmGrainFlags enum. */
mfxU16 GrainSeed; /*!< Starting value for pseudo-random numbers used during film grain synthesis. */
mfxU8 RefIdx; /*!< Indicate which reference frame contains the film grain parameters to be used for this frame. */
mfxU8 NumYPoints; /*!< The number of points for the piece-wise linear scaling function of the luma component. */
mfxU8 NumCbPoints; /*!< The number of points for the piece-wise linear scaling function of the Cb component. */
mfxU8 NumCrPoints; /*!< The number of points for the piece-wise linear scaling function of the Cr component.*/
mfxAV1FilmGrainPoint PointY[14]; /*!< The array of points for luma component. */
mfxAV1FilmGrainPoint PointCb[10]; /*!< The array of points for Cb component. */
mfxAV1FilmGrainPoint PointCr[10]; /*!< The array of points for Cr component. */
mfxU8 GrainScalingMinus8; /*!< The shift - 8 applied to the values of the chroma component. The grain_scaling_minus_8 can take values of 0..3 and
determines the range and quantization step of the standard deviation of film grain.*/
mfxU8 ArCoeffLag; /*!< The number of auto-regressive coefficients for luma and chroma.*/
mfxU8 ArCoeffsYPlus128[24]; /*!< Auto-regressive coefficients used for the Y plane. */
mfxU8 ArCoeffsCbPlus128[25]; /*!< Auto-regressive coefficients used for the Cb plane. */
mfxU8 ArCoeffsCrPlus128[25]; /*!< The number of points for the piece-wise linear scaling function of the Cr component.*/
mfxU8 ArCoeffShiftMinus6; /*!< The range of the auto-regressive coefficients.
Values of 0, 1, 2, and 3 correspond to the ranges for auto-regressive coefficients of
[-2, 2), [-1, 1), [-0.5, 0.5) and [-0.25, 0.25) respectively.*/
mfxU8 GrainScaleShift; /*!< Downscaling factor of the grain synthesis process for the Gaussian random numbers .*/
mfxU8 CbMult; /*!< The multiplier for the Cb component used in derivation of the input index to the Cb component scaling function.*/
mfxU8 CbLumaMult; /*!< The multiplier for the average luma component used in derivation of the input index to the Cb component scaling function. */
mfxU16 CbOffset; /*!< The offset used in derivation of the input index to the Cb component scaling function.*/
mfxU8 CrMult; /*!< The multiplier for the Cr component used in derivation of the input index to the Cr component scaling function.*/
mfxU8 CrLumaMult; /*!< The multiplier for the average luma component used in derivation of the input index to the Cr component scaling function.*/
mfxU16 CrOffset; /*!< The offset used in derivation of the input index to the Cr component scaling function.*/
mfxU16 reserved[43];
} mfxExtAV1FilmGrainParam;
MFX_PACK_END()
#define MFX_SURFACEARRAY_VERSION MFX_STRUCT_VERSION(1, 0)
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The structure is reference counted object to return array of surfaces allocated and processed by the library. */
typedef struct mfxSurfaceArray
{
mfxHDL Context; /*!< The context of the memory interface. User should not touch (change, set, null) this pointer. */
mfxStructVersion Version; /*!< The version of the structure. */
mfxU16 reserved[3];
/*! @brief
Increments the internal reference counter of the surface. The surface is not destroyed until the surface is released using the mfxSurfaceArray::Release function.
mfxSurfaceArray::AddRef should be used each time a new link to the surface is created (for example, copy structure) for proper surface management.
@param[in] surface Valid mfxSurfaceArray.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfaceArray->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *AddRef)(struct mfxSurfaceArray* surface_array);
/*! @brief
Decrements the internal reference counter of the surface. mfxSurfaceArray::Release should be called after
using the mfxSurfaceArray::AddRef function to add a surface or when allocation logic requires it.
@param[in] surface_array Valid mfxSurfaceArray.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfaceArray->Context is invalid (for example NULL). \n
MFX_ERR_UNDEFINED_BEHAVIOR If Reference Counter of surface is zero before call. \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *Release)(struct mfxSurfaceArray* surface_array);
/*! @brief
Returns current reference counter of mfxSurfaceArray structure.
@param[in] surface Valid surface_array.
@param[out] counter Sets counter to the current reference counter value.
@return
MFX_ERR_NONE If no error. \n
MFX_ERR_NULL_PTR If surface or counter is NULL. \n
MFX_ERR_INVALID_HANDLE If mfxSurfaceArray->Context is invalid (for example NULL). \n
MFX_ERR_UNKNOWN Any internal error.
*/
mfxStatus (MFX_CDECL *GetRefCounter)(struct mfxSurfaceArray* surface_array, mfxU32* counter);
mfxFrameSurface1** Surfaces; /*!< The array of pointers to mfxFrameSurface1. mfxFrameSurface1 surfaces are allocated by the same
agent who allocates mfxSurfaceArray. */
mfxU32 NumSurfaces; /*!<The size of array of pointers to mfxFrameSurface1. */
mfxU32 reserved1;
} mfxSurfaceArray;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The structure is used for VPP channels initialization in Decode_VPP component. */
typedef struct {
mfxFrameInfo VPP; /*!< The configuration parameters of VPP filters per each channel. */
mfxU16 Protected; /*!< Specifies the content protection mechanism. */
mfxU16 IOPattern; /*!< Output memory access types for SDK functions. */
mfxExtBuffer** ExtParam; /*!< Points to an array of pointers to the extra configuration structures; see the ExtendedBufferID enumerator for a list of extended configurations. */
mfxU16 NumExtParam; /*!< The number of extra configuration structures attached to the structure. */
mfxU16 reserved1[7];
} mfxVideoChannelParam;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The structure describes rectangle coordinates that can be used for ROI or for Cropping. */
typedef struct {
mfxU16 Left; /*!< X coordinate of region of top-left corner of rectangle. */
mfxU16 Top; /*!< Y coordinate of region of top-left corner of rectangle. */
mfxU16 Right; /*!< X coordinate of region of bottom-right corner of rectangle. */
mfxU16 Bottom; /*!< Y coordinate of region of bottom-right corner of rectangle. */
} mfxRect;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The structure contains crop parameters which applied by Decode_VPP component to input surfaces before video processing operation.
It is used for letterboxing operations.
*/
typedef struct {
mfxExtBuffer Header; /*! Extension buffer header. BufferId must be equal to MFX_EXTBUFF_CROPS. */
mfxRect Crops; /*!< Crops parameters for letterboxing operations. */
mfxU32 reserved[4];
}mfxExtInCrops;
MFX_PACK_END()
/*! The mfxHyperMode enumerator describes HyperMode implementation behavior. */
typedef enum {
MFX_HYPERMODE_OFF = 0x0, /*!< Don't use HyperMode implementation. */
MFX_HYPERMODE_ON = 0x1, /*!< Enable HyperMode implementation and return error if some issue on initialization. */
MFX_HYPERMODE_ADAPTIVE = 0x2, /*!< Enable HyperMode implementation and switch to single fallback if some issue on initialization. */
} mfxHyperMode;
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The structure is used for HyperMode initialization. */
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. BufferId must be equal to MFX_EXTBUFF_HYPER_MODE_PARAM. */
mfxHyperMode Mode; /*!< HyperMode implementation behavior. */
mfxU16 reserved[19];
} mfxExtHyperModeParam;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The structure is used for universal temporal layer description. */
typedef struct {
mfxU16 FrameRateScale; /*!< The ratio between the frame rates of the current temporal layer and the base layer. The library treats a particular
temporal layer as "defined" if it has FrameRateScale > 0. If the base layer is defined, it must have FrameRateScale = 1.
FrameRateScale of each subsequent layer (if defined) must be a multiple of and greater than the
FrameRateScale value of previous layer. */
mfxU16 reserved[3]; /*!< Reserved for future use. */
union {
/*!< Type of bitrate controls is currently the same across all temporal layers and inherits from common parameters. */
struct {
mfxU32 InitialDelayInKB;/*!< Initial size of the Video Buffering Verifier (VBV) buffer for the current temporal layer.
@note In this context, KB is 1000 bytes and Kbps is 1000 bps. */
mfxU32 BufferSizeInKB; /*!< Represents the maximum possible size of any compressed frames for the current temporal layer. */
mfxU32 TargetKbps; /*!< Target bitrate for the current temporal layer. If RateControlMethod is not CQP, the
application can provide TargetKbps for every defined temporal layer. If TargetKbps per temporal layer is not set then
encoder doesn't apply any special bitrate limitations for the layer. */
mfxU32 MaxKbps; /*!< The maximum bitrate at which the encoded data enters the Video Buffering Verifier (VBV) buffer for the current temporal layer. */
mfxU32 reserved1[16]; /*!< Reserved for future use. */
};
struct {
mfxI32 QPI; /*!< Quantization Parameter (QP) for I-frames for constant QP mode (CQP) for the current temporal layer. Zero QP is not valid and means that the default value is assigned by the library.
Non-zero QPI might be clipped to supported QPI range.
@note Default QPI value is implementation dependent and subject to change without additional notice in this document. */
mfxI32 QPP; /*!< Quantization Parameter (QP) for P-frames for constant QP mode (CQP) for the current temporal layer. Zero QP is not valid and means that the default value is assigned by the library.
Non-zero QPP might be clipped to supported QPI range.
@note Default QPP value is implementation dependent and subject to change without additional notice in this document. */
mfxI32 QPB; /*!< Quantization Parameter (QP) for B-frames for constant QP mode (CQP) for the current temporal layer. Zero QP is not valid and means that the default value is assigned by the library.
Non-zero QPI might be clipped to supported QPB range.
@note Default QPB value is implementation dependent and subject to change without additional notice in this document. */
};
};
mfxU16 reserved2[4]; /*!< Reserved for future use. */
} mfxTemporalLayer;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The structure is used for universal temporal layers description. */
typedef struct {
mfxExtBuffer Header; /*! Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_UNIVERSAL_TEMPORAL_LAYERS. */
mfxU16 NumLayers; /*!< The number of temporal layers. */
mfxU16 BaseLayerPID; /*!< The priority ID of the base layer. The encoder increases the ID for each temporal layer and writes to the prefix NAL unit for AVC and HEVC. */
mfxU16 reserved[2]; /*!< Reserved for future use. */
mfxTemporalLayer *Layers; /*!< The array of temporal layers. */
mfxU16 reserved1[8]; /*!< Reserved for future use. */
} mfxExtTemporalLayers;
MFX_PACK_END()
#ifdef ONEVPL_EXPERIMENTAL
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! The structure is used to configure perceptual encoding prefilter in VPP. */
typedef struct {
mfxExtBuffer Header; /*! Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_PERC_ENC_PREFILTER. */
mfxU16 reserved[252];
} mfxExtVPPPercEncPrefilter;
MFX_PACK_END()
#endif
#ifdef ONEVPL_EXPERIMENTAL
/*! The TuneQuality enumerator specifies tuning option for encode. Multiple tuning options can be combined using bit mask. */
enum {
MFX_ENCODE_TUNE_OFF = 0, /*!< Tuning quality is disabled. */
MFX_ENCODE_TUNE_PSNR = 0x1, /*!< The encoder optimizes quality according to Peak Signal-to-Noise Ratio (PSNR) metric. */
MFX_ENCODE_TUNE_SSIM = 0x2, /*!< The encoder optimizes quality according to Structural Similarity Index Measure (SSIM) metric. */
MFX_ENCODE_TUNE_MS_SSIM = 0x4, /*!< The encoder optimizes quality according to Multi-Scale Structural Similarity Index Measure (MS-SSIM) metric. */
MFX_ENCODE_TUNE_VMAF = 0x8, /*!< The encoder optimizes quality according to Video Multi-Method Assessment Fusion (VMAF) metric. */
MFX_ENCODE_TUNE_PERCEPTUAL = 0x10, /*!< The encoder makes perceptual quality optimization. */
};
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! The structure specifies type of quality optimization used by the encoder. The buffer can also be attached for VPP functions to make correspondent pre-filtering. */
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_TUNE_ENCODE_QUALITY. */
mfxU32 TuneQuality; /*!< The control to specify type of encode quality metric(s) to optimize; See correspondent enum. */
mfxExtBuffer** ExtParam; /*!< Points to an array of pointers to the extra configuration structures; see the ExtendedBufferID enumerator for a list of extended configurations. */
mfxU16 NumExtParam; /*!< The number of extra configuration structures attached to the structure. */
mfxU16 reserved[11];
} mfxExtTuneEncodeQuality;
MFX_PACK_END()
#endif
/*! The mfxAISuperResolutionMode enumerator specifies the mode of AI based super resolution. */
typedef enum {
MFX_AI_SUPER_RESOLUTION_MODE_DISABLED = 0, /*!< Super Resolution is disabled.*/
MFX_AI_SUPER_RESOLUTION_MODE_DEFAULT = 1, /*!< Default super resolution mode. The library selects the most appropriate super resolution mode.*/
#ifdef ONEVPL_EXPERIMENTAL
MFX_AI_SUPER_RESOLUTION_MODE_SHARPEN = 2, /*!< In this mode, super Resolution is optimized or trained to have high sharpness level. This mode is recommended to be used in video conference(camera
noise) or similar usage scenario.*/
MFX_AI_SUPER_RESOLUTION_MODE_ARTIFACTREMOVAL= 3, /*!< In this mode, Super Resolution is optimized or trained to remove encoding artifacts with medium sharpness level. This mode is recommended to be used in
video surveillance or similar usage scenarios which may have camera noise and encoding artifacts due to limited network bandwidth.*/
#endif
} mfxAISuperResolutionMode;
#ifdef ONEVPL_EXPERIMENTAL
typedef enum {
MFX_AI_SUPER_RESOLUTION_ALGORITHM_DEFAULT = 0, /*!< Super Resolution algorithm by default. The library selects the most appropriate super resolution algorithm.*/
MFX_AI_SUPER_RESOLUTION_ALGORITHM_1 = 1, /*!< Super Resolution algorithm1.*/
MFX_AI_SUPER_RESOLUTION_ALGORITHM_2 = 2, /*!< Super Resolution algorithm2, MFX_AI_SUPER_RESOLUTION_ALGORITHM_2 video quality is expected to be better than MFX_AI_SUPER_RESOLUTION_ALGORITHM_1.*/
} mfxAISuperResolutionAlgorithm;
#endif
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
A hint structure that configures AI based super resolution VPP filter.
Super resolution is an AI-powered upscaling feature which converts a low-resolution to high-resolution.
On some platforms this filter is not supported. To query its support, the application should use the same approach that it uses to configure VPP filters:
adding the filter ID to the mfxExtVPPDoUse structure or by attaching the mfxExtVPPAISuperResolution structure directly to the mfxVideoParam structure and
calling the Query API function. If the filter is supported, the function returns a MFX_ERR_NONE status; otherwise, the function returns MFX_ERR_UNSUPPORTED.
If both mfxExtVPPAISuperResolution and mfxExtVPPScaling are attached during initialization, the function will return MFX_ERR_INCOMPATIBLE_VIDEO_PARAM; if both
of them are attached during runtime, the mfxExtVPPAISuperResolution will override the upscaling mode and use super resolution.
If the application needs to switch on and off, the application can set the MFX_AI_SUPER_RESOLUTION_MODE_DISABLED to switch off, MFX_AI_SUPER_RESOLUTION_MODE_DEFAULT
to switch on.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION.*/
mfxAISuperResolutionMode SRMode; /*!< Indicates Super Resolution Mode. mfxAISuperResolutionMode enumerator.*/
#ifdef ONEVPL_EXPERIMENTAL
mfxAISuperResolutionAlgorithm SRAlgorithm; /*!< Indicates Super Resolution Algorithm. mfxAISuperResolutionAlgorithm enumerator.*/
mfxU32 reserved1[15]; /*!< Reserved for future use. */
#else
mfxU32 reserved1[16]; /*!< Reserved for future use. */
#endif
mfxHDL reserved2[4]; /*!< Reserved for future use. */
} mfxExtVPPAISuperResolution;
MFX_PACK_END()
/* The mfxAIFrameInterpolationMode enumerator specifies the mode of AI based frame interpolation. */
typedef enum {
MFX_AI_FRAME_INTERPOLATION_MODE_DISABLE = 0, /*!< AI based frame interpolation is disabled. The library duplicates the frame if AI frame interpolation is disabled.*/
MFX_AI_FRAME_INTERPOLATION_MODE_DEFAULT = 1, /*!< Default AI based frame interpolation mode. The library selects the most appropriate AI based frame interpolation mode.*/
#ifdef ONEVPL_EXPERIMENTAL
MFX_AI_FRAME_INTERPOLATION_MODE_BEST_SPEED = 2, /*!< AI based frame interpolation in best speed.*/
MFX_AI_FRAME_INTERPOLATION_MODE_BEST_QUALITY = 3, /*!< AI based frame interpolation in best quality.*/
#endif
} mfxAIFrameInterpolationMode;
/*!
A hint structure that configures AI based frame interpolation VPP filter.
AI powered frame interpolation feature can reconstruct one or more intermediate frames between two consecutive frames by AI method.
On some platforms this filter is not supported. To query its support, the application should use the same approach that it uses to configure VPP filters:
Attaching the mfxExtVPPAIFrameInterpolation structure directly to the mfxVideoParam structure and setting the frame rate of input and output (FrameRateExtN and FrameRateExtD),
then calling the Query API function. If the filter is supported, the Query function returns a MFX_ERR_NONE status; otherwise, the function returns MFX_ERR_UNSUPPORTED.
As a new method of frame interpolation, the application can attach mfxExtVPPAIFrameInterpolation to mfxVideoParam during initialization for frame interpolation, or attach both
mfxExtVPPAIFrameInterpolation and mfxExtVPPFrameRateConversion to mfxVideoParam and use which mfxExtVPPAIFrameInterpolation is regarded as a new algorithm of mfxExtVPPFrameRateConversion
(MFX_FRCALGM_AI_FRAME_INTERPOLATION).
The applications should follow video processing procedures and call the API mfxStatus MFXVideoVPP_RunFrameVPPAsync(Session, Input, Output, Auxdata, Syncp) to process the frames one by one.
The below is detailed explanation of video processing procedures in this AI frame interpolation case. If the application does not follow the below input/output sequence, the application could
get the unexpected output and get an error return value.
Input: Frame0 Frame1 Frame2 Frame3 FrameN
Output: Frame0 Frame0.5 Frame1 Frame1.5 Frame2 Frame2.5 Frame3 FrameX.5 FrameN
#0 API call: Input Frame0, Output Frame0, Return MFX_ERR_NONE.
#1 API call: Input Frame1, Output Frame0.5 and Return MFX_ERR_MORE_SURFACE.
#2 API call: Input Frame1, Output Frame1, Return MFX_ERR_NONE.
#3 API call: Input Frame2, Output Frame1.5, Return MFX_ERR_MORE_SURFACE.
#4 API call: Input Frame2, Output Frame2, Return MFX_ERR_NONE.
*/
MFX_PACK_BEGIN_STRUCT_W_PTR()
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_VPP_AI_FRAME_INTERPOLATION.*/
mfxAIFrameInterpolationMode FIMode; /*!< Indicates frame interpolation mode. The mfxAIFrameInterpolationMode enumerator.*/
mfxU16 EnableScd; /*!< Indicates if enabling scene change detection(SCD) of the library. Recommend to enable this flag for
better quality. Value 0 means disable SCD, Value 1 means enable SCD.*/
mfxU32 reserved1[24]; /*!< Reserved for future use. */
mfxHDL reserved2[8]; /*!< Reserved for future use. */
} mfxExtVPPAIFrameInterpolation;
MFX_PACK_END()
/*! The mfxQualityInfoMode enumerator specifies the mode of Quality information. */
typedef enum {
MFX_QUALITY_INFO_DISABLE = 0, /*!< Quality reporting disabled. */
MFX_QUALITY_INFO_LEVEL_FRAME = 0x1, /*!< Frame level quality report. */
} mfxQualityInfoMode;
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by the encoder to set quality information report mode for the encoded picture.
@note Not all implementations of the encoder support this extended buffer. The application must use query mode 1 to determine if
the functionality is supported. To do this, the application must attach this extended buffer to the mfxVideoParam structure and
call the MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE then the functionality is supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODED_QUALITY_INFO_MODE. */
mfxQualityInfoMode QualityInfoMode;/*!< See mfxQualityInfoMode enumeration for supported modes. */
mfxU32 reserved[5]; /*!< Reserved for future use. */
} mfxExtQualityInfoMode;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*!
Used by the encoder to report quality information about the encoded picture. The application can attach
this buffer to the mfxBitstream structure before calling MFXVideoENCODE_EncodeFrameAsync function.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODED_QUALITY_INFO_OUTPUT. */
mfxU32 FrameOrder; /*!< Frame display order of encoded picture. */
mfxU32 MSE[3]; /*!< Frame level mean squared errors (MSE) for Y/U/V channel.
@note MSE is stored in U24.8 format. The calculation formula is: PSNR = 10 * log10(256.0 * (2^bitDepth - 1)^2 / (double)MSE)). */
mfxU32 reserved1[50]; /*!< Reserved for future use. */
mfxHDL reserved2[4]; /*!< Reserved for future use. */
} mfxExtQualityInfoOutput;
MFX_PACK_END()
MFX_PACK_BEGIN_USUAL_STRUCT()
/*!
Used by the encoder to set the screen content tools.
@note Not all implementations of the encoder support this extended buffer. The application must use query mode 1 to determine if
the functionality is supported. To do this, the application must attach this extended buffer to the mfxVideoParam structure and
call the MFXVideoENCODE_Query function. If the function returns MFX_ERR_NONE then the functionality is supported.
*/
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_AV1_SCREEN_CONTENT_TOOLS. */
/*!
Set this flag to MFX_CODINGOPTION_ON to enable palette prediction for encoder. Set this flag to MFX_CODINGOPTION_OFF to disable it.
If this flag is set to any other value, the default value will be used which can be obtained from the MFXVideoENCODE_GetVideoParam function after encoding initialization.
See the CodingOptionValue enumerator for values of this option. This parameter is valid only during initialization.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.
*/
mfxU16 Palette;
/*!
Set this flag to MFX_CODINGOPTION_ON to enable intra block copy prediction for encoder. Set this flag to MFX_CODINGOPTION_OFF to disable it.
If this flag is set to any other value, the default value will be used which can be obtained from the MFXVideoENCODE_GetVideoParam function after encoding initialization.
See the CodingOptionValue enumerator for values of this option. This parameter is valid only during initialization.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.
*/
mfxU16 IntraBlockCopy;
mfxU16 reserved[10]; /*!< Reserved for future use. */
} mfxExtAV1ScreenContentTools;
MFX_PACK_END()
/*! The AlphaChannelMode enumerator specifies alpha is straight or pre-multiplied. */
enum {
/*!
RGB and alpha are independent, then the alpha value specifies how solid it is.
We set it to the default value, i.e., the alpha source data is already pre-multiplied, so that the decoded samples of the associated primary picture
should not be multiplied by the interpretation sample values of the auxiliary coded picture in the display process after output from the decoding process.
*/
MFX_ALPHA_MODE_PREMULTIPLIED = 1,
/*!
RGB and alpha are linked, then the alpha value specifies how much it obscures whatever is behind it.
Therefore, the decoded samples of the associated primary picture should be multiplied by the interpretation sample values
of the auxiliary coded picture in the display process after output from the decoding process.
*/
MFX_ALPHA_MODE_STRAIGHT = 2
};
MFX_PACK_BEGIN_USUAL_STRUCT()
/*! Configure the alpha channel encoding. */
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. BufferId must be equal to MFX_EXTBUFF_ALPHA_CHANNEL_ENC_CTRL. */
/*!
Set this flag to MFX_CODINGOPTION_ON to enable alpha channel encoding. See the CodingOptionValue enumerator for values of this option.
This parameter is valid only during initialization.
@note Not all codecs and implementations support this value. Use the Query API function to check if this feature is supported.
*/
mfxU16 EnableAlphaChannelEncoding;
/*!
Specifies alpha is straight or pre-multiplied. See the AlphaChannelMode enumerator for details.
Encoder just record this in the SEI for post-decoding rendering.
*/
mfxU16 AlphaChannelMode;
/*!
Indicates the percentage of the auxiliary alpha layer in the total bitrate. Valid range for this parameter is [1, 99].
We set 25 as the default value, i.e. Alpha(25) : Total(100), then 25% of the bits will be spent on alpha layer encoding whereas the other 75% will be spent on base(YUV) layer.
Affects the following variables: InitialDelayInKB, BufferSizeInKB, TargetKbps, MaxKbps.
*/
mfxU16 AlphaChannelBitrateRatio;
mfxU16 reserved[9];
} mfxExtAlphaChannelEncCtrl;
MFX_PACK_END()
MFX_PACK_BEGIN_STRUCT_W_PTR()
/*! Defines the uncompressed frames surface information and data buffers for alpha channel encoding. */
typedef struct {
mfxExtBuffer Header; /*!< Extension buffer header. BufferId must be equal to MFX_EXTBUFF_ALPHA_CHANNEL_SURFACE. */
mfxFrameSurface1* AlphaSurface; /*!< Alpha channel surface. */
mfxU16 reserved[8];
} mfxExtAlphaChannelSurface;
MFX_PACK_END()
#ifdef __cplusplus
} // extern "C"
#endif
#endif
|