Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: uapi: Add VP9 stateless decoder controls

Add the VP9 stateless decoder controls plus the documentation that goes
with it.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Co-developed-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Co-developed-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Andrzej Pietrasiewicz and committed by
Mauro Carvalho Chehab
b88dbe38 bb91e46e

+1103
+10
Documentation/userspace-api/media/v4l/biblio.rst
··· 417 417 :title: RFC 6386: "VP8 Data Format and Decoding Guide" 418 418 419 419 :author: J. Bankoski et al. 420 + 421 + .. _vp9: 422 + 423 + VP9 424 + === 425 + 426 + 427 + :title: VP9 Bitstream & Decoding Process Specification 428 + 429 + :author: Adrian Grange (Google), Peter de Rivaz (Argon Design), Jonathan Hunt (Argon Design)
+573
Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
··· 1458 1458 .. raw:: latex 1459 1459 1460 1460 \normalsize 1461 + 1462 + .. _v4l2-codec-stateless-vp9: 1463 + 1464 + ``V4L2_CID_STATELESS_VP9_COMPRESSED_HDR (struct)`` 1465 + Stores VP9 probabilities updates as parsed from the current compressed frame 1466 + header. A value of zero in an array element means no update of the relevant 1467 + probability. Motion vector-related updates contain a new value or zero. All 1468 + other updates contain values translated with inv_map_table[] (see 6.3.5 in 1469 + :ref:`vp9`). 1470 + 1471 + .. c:type:: v4l2_ctrl_vp9_compressed_hdr 1472 + 1473 + .. tabularcolumns:: |p{1cm}|p{4.8cm}|p{11.4cm}| 1474 + 1475 + .. cssclass:: longtable 1476 + 1477 + .. flat-table:: struct v4l2_ctrl_vp9_compressed_hdr 1478 + :header-rows: 0 1479 + :stub-columns: 0 1480 + :widths: 1 1 2 1481 + 1482 + * - __u8 1483 + - ``tx_mode`` 1484 + - Specifies the TX mode. See :ref:`TX Mode <vp9_tx_mode>` for more details. 1485 + * - __u8 1486 + - ``tx8[2][1]`` 1487 + - TX 8x8 probabilities delta. 1488 + * - __u8 1489 + - ``tx16[2][2]`` 1490 + - TX 16x16 probabilities delta. 1491 + * - __u8 1492 + - ``tx32[2][3]`` 1493 + - TX 32x32 probabilities delta. 1494 + * - __u8 1495 + - ``coef[4][2][2][6][6][3]`` 1496 + - Coefficient probabilities delta. 1497 + * - __u8 1498 + - ``skip[3]`` 1499 + - Skip probabilities delta. 1500 + * - __u8 1501 + - ``inter_mode[7][3]`` 1502 + - Inter prediction mode probabilities delta. 1503 + * - __u8 1504 + - ``interp_filter[4][2]`` 1505 + - Interpolation filter probabilities delta. 1506 + * - __u8 1507 + - ``is_inter[4]`` 1508 + - Is inter-block probabilities delta. 1509 + * - __u8 1510 + - ``comp_mode[5]`` 1511 + - Compound prediction mode probabilities delta. 1512 + * - __u8 1513 + - ``single_ref[5][2]`` 1514 + - Single reference probabilities delta. 1515 + * - __u8 1516 + - ``comp_ref[5]`` 1517 + - Compound reference probabilities delta. 1518 + * - __u8 1519 + - ``y_mode[4][9]`` 1520 + - Y prediction mode probabilities delta. 1521 + * - __u8 1522 + - ``uv_mode[10][9]`` 1523 + - UV prediction mode probabilities delta. 1524 + * - __u8 1525 + - ``partition[16][3]`` 1526 + - Partition probabilities delta. 1527 + * - __u8 1528 + - ``mv.joint[3]`` 1529 + - Motion vector joint probabilities delta. 1530 + * - __u8 1531 + - ``mv.sign[2]`` 1532 + - Motion vector sign probabilities delta. 1533 + * - __u8 1534 + - ``mv.classes[2][10]`` 1535 + - Motion vector class probabilities delta. 1536 + * - __u8 1537 + - ``mv.class0_bit[2]`` 1538 + - Motion vector class0 bit probabilities delta. 1539 + * - __u8 1540 + - ``mv.bits[2][10]`` 1541 + - Motion vector bits probabilities delta. 1542 + * - __u8 1543 + - ``mv.class0_fr[2][2][3]`` 1544 + - Motion vector class0 fractional bit probabilities delta. 1545 + * - __u8 1546 + - ``mv.fr[2][3]`` 1547 + - Motion vector fractional bit probabilities delta. 1548 + * - __u8 1549 + - ``mv.class0_hp[2]`` 1550 + - Motion vector class0 high precision fractional bit probabilities delta. 1551 + * - __u8 1552 + - ``mv.hp[2]`` 1553 + - Motion vector high precision fractional bit probabilities delta. 1554 + 1555 + .. _vp9_tx_mode: 1556 + 1557 + ``TX Mode`` 1558 + 1559 + .. tabularcolumns:: |p{6.5cm}|p{0.5cm}|p{10.3cm}| 1560 + 1561 + .. flat-table:: 1562 + :header-rows: 0 1563 + :stub-columns: 0 1564 + :widths: 1 1 2 1565 + 1566 + * - ``V4L2_VP9_TX_MODE_ONLY_4X4`` 1567 + - 0 1568 + - Transform size is 4x4. 1569 + * - ``V4L2_VP9_TX_MODE_ALLOW_8X8`` 1570 + - 1 1571 + - Transform size can be up to 8x8. 1572 + * - ``V4L2_VP9_TX_MODE_ALLOW_16X16`` 1573 + - 2 1574 + - Transform size can be up to 16x16. 1575 + * - ``V4L2_VP9_TX_MODE_ALLOW_32X32`` 1576 + - 3 1577 + - transform size can be up to 32x32. 1578 + * - ``V4L2_VP9_TX_MODE_SELECT`` 1579 + - 4 1580 + - Bitstream contains the transform size for each block. 1581 + 1582 + See section '7.3.1 Tx mode semantics' of the :ref:`vp9` specification for more details. 1583 + 1584 + ``V4L2_CID_STATELESS_VP9_FRAME (struct)`` 1585 + Specifies the frame parameters for the associated VP9 frame decode request. 1586 + This includes the necessary parameters for configuring a stateless hardware 1587 + decoding pipeline for VP9. The bitstream parameters are defined according 1588 + to :ref:`vp9`. 1589 + 1590 + .. c:type:: v4l2_ctrl_vp9_frame 1591 + 1592 + .. raw:: latex 1593 + 1594 + \small 1595 + 1596 + .. tabularcolumns:: |p{4.7cm}|p{5.5cm}|p{7.1cm}| 1597 + 1598 + .. cssclass:: longtable 1599 + 1600 + .. flat-table:: struct v4l2_ctrl_vp9_frame 1601 + :header-rows: 0 1602 + :stub-columns: 0 1603 + :widths: 1 1 2 1604 + 1605 + * - struct :c:type:`v4l2_vp9_loop_filter` 1606 + - ``lf`` 1607 + - Loop filter parameters. See struct :c:type:`v4l2_vp9_loop_filter` for more details. 1608 + * - struct :c:type:`v4l2_vp9_quantization` 1609 + - ``quant`` 1610 + - Quantization parameters. See :c:type:`v4l2_vp9_quantization` for more details. 1611 + * - struct :c:type:`v4l2_vp9_segmentation` 1612 + - ``seg`` 1613 + - Segmentation parameters. See :c:type:`v4l2_vp9_segmentation` for more details. 1614 + * - __u32 1615 + - ``flags`` 1616 + - Combination of V4L2_VP9_FRAME_FLAG_* flags. See :ref:`Frame Flags<vp9_frame_flags>`. 1617 + * - __u16 1618 + - ``compressed_header_size`` 1619 + - Compressed header size in bytes. 1620 + * - __u16 1621 + - ``uncompressed_header_size`` 1622 + - Uncompressed header size in bytes. 1623 + * - __u16 1624 + - ``frame_width_minus_1`` 1625 + - Add 1 to get the frame width expressed in pixels. See section 7.2.3 in :ref:`vp9`. 1626 + * - __u16 1627 + - ``frame_height_minus_1`` 1628 + - Add 1 to get the frame height expressed in pixels. See section 7.2.3 in :ref:`vp9`. 1629 + * - __u16 1630 + - ``render_width_minus_1`` 1631 + - Add 1 to get the expected render width expressed in pixels. This is 1632 + not used during the decoding process but might be used by HW scalers to 1633 + prepare a frame that's ready for scanout. See section 7.2.4 in :ref:`vp9`. 1634 + * - __u16 1635 + - render_height_minus_1 1636 + - Add 1 to get the expected render height expressed in pixels. This is 1637 + not used during the decoding process but might be used by HW scalers to 1638 + prepare a frame that's ready for scanout. See section 7.2.4 in :ref:`vp9`. 1639 + * - __u64 1640 + - ``last_frame_ts`` 1641 + - "last" reference buffer timestamp. 1642 + The timestamp refers to the ``timestamp`` field in 1643 + struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` 1644 + function to convert the struct :c:type:`timeval` in struct 1645 + :c:type:`v4l2_buffer` to a __u64. 1646 + * - __u64 1647 + - ``golden_frame_ts`` 1648 + - "golden" reference buffer timestamp. 1649 + The timestamp refers to the ``timestamp`` field in 1650 + struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` 1651 + function to convert the struct :c:type:`timeval` in struct 1652 + :c:type:`v4l2_buffer` to a __u64. 1653 + * - __u64 1654 + - ``alt_frame_ts`` 1655 + - "alt" reference buffer timestamp. 1656 + The timestamp refers to the ``timestamp`` field in 1657 + struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` 1658 + function to convert the struct :c:type:`timeval` in struct 1659 + :c:type:`v4l2_buffer` to a __u64. 1660 + * - __u8 1661 + - ``ref_frame_sign_bias`` 1662 + - a bitfield specifying whether the sign bias is set for a given 1663 + reference frame. See :ref:`Reference Frame Sign Bias<vp9_ref_frame_sign_bias>` 1664 + for more details. 1665 + * - __u8 1666 + - ``reset_frame_context`` 1667 + - specifies whether the frame context should be reset to default values. See 1668 + :ref:`Reset Frame Context<vp9_reset_frame_context>` for more details. 1669 + * - __u8 1670 + - ``frame_context_idx`` 1671 + - Frame context that should be used/updated. 1672 + * - __u8 1673 + - ``profile`` 1674 + - VP9 profile. Can be 0, 1, 2 or 3. 1675 + * - __u8 1676 + - ``bit_depth`` 1677 + - Component depth in bits. Can be 8, 10 or 12. Note that not all profiles 1678 + support 10 and/or 12 bits depths. 1679 + * - __u8 1680 + - ``interpolation_filter`` 1681 + - Specifies the filter selection used for performing inter prediction. See 1682 + :ref:`Interpolation Filter<vp9_interpolation_filter>` for more details. 1683 + * - __u8 1684 + - ``tile_cols_log2`` 1685 + - Specifies the base 2 logarithm of the width of each tile (where the 1686 + width is measured in units of 8x8 blocks). Shall be less than or equal 1687 + to 6. 1688 + * - __u8 1689 + - ``tile_rows_log2`` 1690 + - Specifies the base 2 logarithm of the height of each tile (where the 1691 + height is measured in units of 8x8 blocks). 1692 + * - __u8 1693 + - ``reference_mode`` 1694 + - Specifies the type of inter prediction to be used. See 1695 + :ref:`Reference Mode<vp9_reference_mode>` for more details. 1696 + * - __u8 1697 + - ``reserved[7]`` 1698 + - Applications and drivers must set this to zero. 1699 + 1700 + .. raw:: latex 1701 + 1702 + \normalsize 1703 + 1704 + .. _vp9_frame_flags: 1705 + 1706 + ``Frame Flags`` 1707 + 1708 + .. tabularcolumns:: |p{10.0cm}|p{1.2cm}|p{6.1cm}| 1709 + 1710 + .. flat-table:: 1711 + :header-rows: 0 1712 + :stub-columns: 0 1713 + :widths: 1 1 2 1714 + 1715 + * - ``V4L2_VP9_FRAME_FLAG_KEY_FRAME`` 1716 + - 0x001 1717 + - The frame is a key frame. 1718 + * - ``V4L2_VP9_FRAME_FLAG_SHOW_FRAME`` 1719 + - 0x002 1720 + - The frame should be displayed. 1721 + * - ``V4L2_VP9_FRAME_FLAG_ERROR_RESILIENT`` 1722 + - 0x004 1723 + - The decoding should be error resilient. 1724 + * - ``V4L2_VP9_FRAME_FLAG_INTRA_ONLY`` 1725 + - 0x008 1726 + - The frame does not reference other frames. 1727 + * - ``V4L2_VP9_FRAME_FLAG_ALLOW_HIGH_PREC_MV`` 1728 + - 0x010 1729 + - The frame can use high precision motion vectors. 1730 + * - ``V4L2_VP9_FRAME_FLAG_REFRESH_FRAME_CTX`` 1731 + - 0x020 1732 + - Frame context should be updated after decoding. 1733 + * - ``V4L2_VP9_FRAME_FLAG_PARALLEL_DEC_MODE`` 1734 + - 0x040 1735 + - Parallel decoding is used. 1736 + * - ``V4L2_VP9_FRAME_FLAG_X_SUBSAMPLING`` 1737 + - 0x080 1738 + - Vertical subsampling is enabled. 1739 + * - ``V4L2_VP9_FRAME_FLAG_Y_SUBSAMPLING`` 1740 + - 0x100 1741 + - Horizontal subsampling is enabled. 1742 + * - ``V4L2_VP9_FRAME_FLAG_COLOR_RANGE_FULL_SWING`` 1743 + - 0x200 1744 + - The full UV range is used. 1745 + 1746 + .. _vp9_ref_frame_sign_bias: 1747 + 1748 + ``Reference Frame Sign Bias`` 1749 + 1750 + .. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}| 1751 + 1752 + .. flat-table:: 1753 + :header-rows: 0 1754 + :stub-columns: 0 1755 + :widths: 1 1 2 1756 + 1757 + * - ``V4L2_VP9_SIGN_BIAS_LAST`` 1758 + - 0x1 1759 + - Sign bias is set for the last reference frame. 1760 + * - ``V4L2_VP9_SIGN_BIAS_GOLDEN`` 1761 + - 0x2 1762 + - Sign bias is set for the golden reference frame. 1763 + * - ``V4L2_VP9_SIGN_BIAS_ALT`` 1764 + - 0x2 1765 + - Sign bias is set for the alt reference frame. 1766 + 1767 + .. _vp9_reset_frame_context: 1768 + 1769 + ``Reset Frame Context`` 1770 + 1771 + .. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}| 1772 + 1773 + .. flat-table:: 1774 + :header-rows: 0 1775 + :stub-columns: 0 1776 + :widths: 1 1 2 1777 + 1778 + * - ``V4L2_VP9_RESET_FRAME_CTX_NONE`` 1779 + - 0 1780 + - Do not reset any frame context. 1781 + * - ``V4L2_VP9_RESET_FRAME_CTX_SPEC`` 1782 + - 1 1783 + - Reset the frame context pointed to by 1784 + :c:type:`v4l2_ctrl_vp9_frame`.frame_context_idx. 1785 + * - ``V4L2_VP9_RESET_FRAME_CTX_ALL`` 1786 + - 2 1787 + - Reset all frame contexts. 1788 + 1789 + See section '7.2 Uncompressed header semantics' of the :ref:`vp9` specification 1790 + for more details. 1791 + 1792 + .. _vp9_interpolation_filter: 1793 + 1794 + ``Interpolation Filter`` 1795 + 1796 + .. tabularcolumns:: |p{9.0cm}|p{1.2cm}|p{7.1cm}| 1797 + 1798 + .. flat-table:: 1799 + :header-rows: 0 1800 + :stub-columns: 0 1801 + :widths: 1 1 2 1802 + 1803 + * - ``V4L2_VP9_INTERP_FILTER_EIGHTTAP`` 1804 + - 0 1805 + - Eight tap filter. 1806 + * - ``V4L2_VP9_INTERP_FILTER_EIGHTTAP_SMOOTH`` 1807 + - 1 1808 + - Eight tap smooth filter. 1809 + * - ``V4L2_VP9_INTERP_FILTER_EIGHTTAP_SHARP`` 1810 + - 2 1811 + - Eeight tap sharp filter. 1812 + * - ``V4L2_VP9_INTERP_FILTER_BILINEAR`` 1813 + - 3 1814 + - Bilinear filter. 1815 + * - ``V4L2_VP9_INTERP_FILTER_SWITCHABLE`` 1816 + - 4 1817 + - Filter selection is signaled at the block level. 1818 + 1819 + See section '7.2.7 Interpolation filter semantics' of the :ref:`vp9` specification 1820 + for more details. 1821 + 1822 + .. _vp9_reference_mode: 1823 + 1824 + ``Reference Mode`` 1825 + 1826 + .. tabularcolumns:: |p{9.6cm}|p{0.5cm}|p{7.2cm}| 1827 + 1828 + .. flat-table:: 1829 + :header-rows: 0 1830 + :stub-columns: 0 1831 + :widths: 1 1 2 1832 + 1833 + * - ``V4L2_VP9_REFERENCE_MODE_SINGLE_REFERENCE`` 1834 + - 0 1835 + - Indicates that all the inter blocks use only a single reference frame 1836 + to generate motion compensated prediction. 1837 + * - ``V4L2_VP9_REFERENCE_MODE_COMPOUND_REFERENCE`` 1838 + - 1 1839 + - Requires all the inter blocks to use compound mode. Single reference 1840 + frame prediction is not allowed. 1841 + * - ``V4L2_VP9_REFERENCE_MODE_SELECT`` 1842 + - 2 1843 + - Allows each individual inter block to select between single and 1844 + compound prediction modes. 1845 + 1846 + See section '7.3.6 Frame reference mode semantics' of the :ref:`vp9` specification for more details. 1847 + 1848 + .. c:type:: v4l2_vp9_segmentation 1849 + 1850 + Encodes the quantization parameters. See section '7.2.10 Segmentation 1851 + params syntax' of the :ref:`vp9` specification for more details. 1852 + 1853 + .. tabularcolumns:: |p{0.8cm}|p{5cm}|p{11.4cm}| 1854 + 1855 + .. cssclass:: longtable 1856 + 1857 + .. flat-table:: struct v4l2_vp9_segmentation 1858 + :header-rows: 0 1859 + :stub-columns: 0 1860 + :widths: 1 1 2 1861 + 1862 + * - __u8 1863 + - ``feature_data[8][4]`` 1864 + - Data attached to each feature. Data entry is only valid if the feature 1865 + is enabled. The array shall be indexed with segment number as the first dimension 1866 + (0..7) and one of V4L2_VP9_SEG_* as the second dimension. 1867 + See :ref:`Segment Feature IDs<vp9_segment_feature>`. 1868 + * - __u8 1869 + - ``feature_enabled[8]`` 1870 + - Bitmask defining which features are enabled in each segment. The value for each 1871 + segment is a combination of V4L2_VP9_SEGMENT_FEATURE_ENABLED(id) values where id is 1872 + one of V4L2_VP9_SEG_*. See :ref:`Segment Feature IDs<vp9_segment_feature>`. 1873 + * - __u8 1874 + - ``tree_probs[7]`` 1875 + - Specifies the probability values to be used when decoding a Segment-ID. 1876 + See '5.15. Segmentation map' section of :ref:`vp9` for more details. 1877 + * - __u8 1878 + - ``pred_probs[3]`` 1879 + - Specifies the probability values to be used when decoding a 1880 + Predicted-Segment-ID. See '6.4.14. Get segment id syntax' 1881 + section of :ref:`vp9` for more details. 1882 + * - __u8 1883 + - ``flags`` 1884 + - Combination of V4L2_VP9_SEGMENTATION_FLAG_* flags. See 1885 + :ref:`Segmentation Flags<vp9_segmentation_flags>`. 1886 + * - __u8 1887 + - ``reserved[5]`` 1888 + - Applications and drivers must set this to zero. 1889 + 1890 + .. _vp9_segment_feature: 1891 + 1892 + ``Segment feature IDs`` 1893 + 1894 + .. tabularcolumns:: |p{6.0cm}|p{1cm}|p{10.3cm}| 1895 + 1896 + .. flat-table:: 1897 + :header-rows: 0 1898 + :stub-columns: 0 1899 + :widths: 1 1 2 1900 + 1901 + * - ``V4L2_VP9_SEG_LVL_ALT_Q`` 1902 + - 0 1903 + - Quantizer segment feature. 1904 + * - ``V4L2_VP9_SEG_LVL_ALT_L`` 1905 + - 1 1906 + - Loop filter segment feature. 1907 + * - ``V4L2_VP9_SEG_LVL_REF_FRAME`` 1908 + - 2 1909 + - Reference frame segment feature. 1910 + * - ``V4L2_VP9_SEG_LVL_SKIP`` 1911 + - 3 1912 + - Skip segment feature. 1913 + * - ``V4L2_VP9_SEG_LVL_MAX`` 1914 + - 4 1915 + - Number of segment features. 1916 + 1917 + .. _vp9_segmentation_flags: 1918 + 1919 + ``Segmentation Flags`` 1920 + 1921 + .. tabularcolumns:: |p{10.6cm}|p{0.8cm}|p{5.9cm}| 1922 + 1923 + .. flat-table:: 1924 + :header-rows: 0 1925 + :stub-columns: 0 1926 + :widths: 1 1 2 1927 + 1928 + * - ``V4L2_VP9_SEGMENTATION_FLAG_ENABLED`` 1929 + - 0x01 1930 + - Indicates that this frame makes use of the segmentation tool. 1931 + * - ``V4L2_VP9_SEGMENTATION_FLAG_UPDATE_MAP`` 1932 + - 0x02 1933 + - Indicates that the segmentation map should be updated during the 1934 + decoding of this frame. 1935 + * - ``V4L2_VP9_SEGMENTATION_FLAG_TEMPORAL_UPDATE`` 1936 + - 0x04 1937 + - Indicates that the updates to the segmentation map are coded 1938 + relative to the existing segmentation map. 1939 + * - ``V4L2_VP9_SEGMENTATION_FLAG_UPDATE_DATA`` 1940 + - 0x08 1941 + - Indicates that new parameters are about to be specified for each 1942 + segment. 1943 + * - ``V4L2_VP9_SEGMENTATION_FLAG_ABS_OR_DELTA_UPDATE`` 1944 + - 0x10 1945 + - Indicates that the segmentation parameters represent the actual values 1946 + to be used. 1947 + 1948 + .. c:type:: v4l2_vp9_quantization 1949 + 1950 + Encodes the quantization parameters. See section '7.2.9 Quantization params 1951 + syntax' of the VP9 specification for more details. 1952 + 1953 + .. tabularcolumns:: |p{0.8cm}|p{4cm}|p{12.4cm}| 1954 + 1955 + .. cssclass:: longtable 1956 + 1957 + .. flat-table:: struct v4l2_vp9_quantization 1958 + :header-rows: 0 1959 + :stub-columns: 0 1960 + :widths: 1 1 2 1961 + 1962 + * - __u8 1963 + - ``base_q_idx`` 1964 + - Indicates the base frame qindex. 1965 + * - __s8 1966 + - ``delta_q_y_dc`` 1967 + - Indicates the Y DC quantizer relative to base_q_idx. 1968 + * - __s8 1969 + - ``delta_q_uv_dc`` 1970 + - Indicates the UV DC quantizer relative to base_q_idx. 1971 + * - __s8 1972 + - ``delta_q_uv_ac`` 1973 + - Indicates the UV AC quantizer relative to base_q_idx. 1974 + * - __u8 1975 + - ``reserved[4]`` 1976 + - Applications and drivers must set this to zero. 1977 + 1978 + .. c:type:: v4l2_vp9_loop_filter 1979 + 1980 + This structure contains all loop filter related parameters. See sections 1981 + '7.2.8 Loop filter semantics' of the :ref:`vp9` specification for more details. 1982 + 1983 + .. tabularcolumns:: |p{0.8cm}|p{4cm}|p{12.4cm}| 1984 + 1985 + .. cssclass:: longtable 1986 + 1987 + .. flat-table:: struct v4l2_vp9_loop_filter 1988 + :header-rows: 0 1989 + :stub-columns: 0 1990 + :widths: 1 1 2 1991 + 1992 + * - __s8 1993 + - ``ref_deltas[4]`` 1994 + - Contains the adjustment needed for the filter level based on the chosen 1995 + reference frame. 1996 + * - __s8 1997 + - ``mode_deltas[2]`` 1998 + - Contains the adjustment needed for the filter level based on the chosen 1999 + mode. 2000 + * - __u8 2001 + - ``level`` 2002 + - Indicates the loop filter strength. 2003 + * - __u8 2004 + - ``sharpness`` 2005 + - Indicates the sharpness level. 2006 + * - __u8 2007 + - ``flags`` 2008 + - Combination of V4L2_VP9_LOOP_FILTER_FLAG_* flags. 2009 + See :ref:`Loop Filter Flags <vp9_loop_filter_flags>`. 2010 + * - __u8 2011 + - ``reserved[7]`` 2012 + - Applications and drivers must set this to zero. 2013 + 2014 + 2015 + .. _vp9_loop_filter_flags: 2016 + 2017 + ``Loop Filter Flags`` 2018 + 2019 + .. tabularcolumns:: |p{9.6cm}|p{0.5cm}|p{7.2cm}| 2020 + 2021 + .. flat-table:: 2022 + :header-rows: 0 2023 + :stub-columns: 0 2024 + :widths: 1 1 2 2025 + 2026 + * - ``V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED`` 2027 + - 0x1 2028 + - When set, the filter level depends on the mode and reference frame used 2029 + to predict a block. 2030 + * - ``V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE`` 2031 + - 0x2 2032 + - When set, the bitstream contains additional syntax elements that 2033 + specify which mode and reference frame deltas are to be updated.
+15
Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
··· 172 172 - VP9 compressed video frame. The encoder generates one 173 173 compressed frame per buffer, and the decoder requires one 174 174 compressed frame per buffer. 175 + * .. _V4L2-PIX-FMT-VP9-FRAME: 176 + 177 + - ``V4L2_PIX_FMT_VP9_FRAME`` 178 + - 'VP9F' 179 + - VP9 parsed frame, including the frame header, as extracted from the container. 180 + This format is adapted for stateless video decoders that implement a 181 + VP9 pipeline with the :ref:`stateless_decoder`. 182 + Metadata associated with the frame to decode is required to be passed 183 + through the ``V4L2_CID_STATELESS_VP9_FRAME`` and 184 + the ``V4L2_CID_STATELESS_VP9_COMPRESSED_HDR`` controls. 185 + See the :ref:`associated Codec Control IDs <v4l2-codec-stateless-vp9>`. 186 + Exactly one output and one capture buffer must be provided for use with 187 + this pixel format. The output buffer must contain the appropriate number 188 + of macroblocks to decode a full corresponding frame to the matching 189 + capture buffer. 175 190 * .. _V4L2-PIX-FMT-HEVC: 176 191 177 192 - ``V4L2_PIX_FMT_HEVC``
+8
Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
··· 233 233 - ``p_mpeg2_quantisation`` 234 234 - A pointer to a struct :c:type:`v4l2_ctrl_mpeg2_quantisation`. Valid if this control is 235 235 of type ``V4L2_CTRL_TYPE_MPEG2_QUANTISATION``. 236 + * - struct :c:type:`v4l2_ctrl_vp9_compressed_hdr` * 237 + - ``p_vp9_compressed_hdr_probs`` 238 + - A pointer to a struct :c:type:`v4l2_ctrl_vp9_compressed_hdr`. Valid if this 239 + control is of type ``V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR``. 240 + * - struct :c:type:`v4l2_ctrl_vp9_frame` * 241 + - ``p_vp9_frame`` 242 + - A pointer to a struct :c:type:`v4l2_ctrl_vp9_frame`. Valid if this 243 + control is of type ``V4L2_CTRL_TYPE_VP9_FRAME``. 236 244 * - struct :c:type:`v4l2_ctrl_hdr10_cll_info` * 237 245 - ``p_hdr10_cll`` 238 246 - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_cll_info`. Valid if this control is
+12
Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
··· 513 513 - n/a 514 514 - A struct :c:type:`v4l2_ctrl_hevc_decode_params`, containing HEVC 515 515 decoding parameters for stateless video decoders. 516 + * - ``V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR`` 517 + - n/a 518 + - n/a 519 + - n/a 520 + - A struct :c:type:`v4l2_ctrl_vp9_compressed_hdr`, containing VP9 521 + probabilities updates for stateless video decoders. 522 + * - ``V4L2_CTRL_TYPE_VP9_FRAME`` 523 + - n/a 524 + - n/a 525 + - n/a 526 + - A struct :c:type:`v4l2_ctrl_vp9_frame`, containing VP9 527 + frame decode parameters for stateless video decoders. 516 528 517 529 .. raw:: latex 518 530
+2
Documentation/userspace-api/media/videodev2.h.rst.exceptions
··· 149 149 replace symbol V4L2_CTRL_TYPE_AREA :c:type:`v4l2_ctrl_type` 150 150 replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`v4l2_ctrl_type` 151 151 replace symbol V4L2_CTRL_TYPE_VP8_FRAME :c:type:`v4l2_ctrl_type` 152 + replace symbol V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR :c:type:`v4l2_ctrl_type` 153 + replace symbol V4L2_CTRL_TYPE_VP9_FRAME :c:type:`v4l2_ctrl_type` 152 154 replace symbol V4L2_CTRL_TYPE_HDR10_CLL_INFO :c:type:`v4l2_ctrl_type` 153 155 replace symbol V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY :c:type:`v4l2_ctrl_type` 154 156
+180
drivers/media/v4l2-core/v4l2-ctrls-core.c
··· 283 283 case V4L2_CTRL_TYPE_MPEG2_PICTURE: 284 284 pr_cont("MPEG2_PICTURE"); 285 285 break; 286 + case V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR: 287 + pr_cont("VP9_COMPRESSED_HDR"); 288 + break; 289 + case V4L2_CTRL_TYPE_VP9_FRAME: 290 + pr_cont("VP9_FRAME"); 291 + break; 286 292 default: 287 293 pr_cont("unknown type %d", ctrl->type); 288 294 break; ··· 322 316 memset(&(s).padding, 0, sizeof((s).padding)) 323 317 #define zero_reserved(s) \ 324 318 memset(&(s).reserved, 0, sizeof((s).reserved)) 319 + 320 + static int 321 + validate_vp9_lf_params(struct v4l2_vp9_loop_filter *lf) 322 + { 323 + unsigned int i; 324 + 325 + if (lf->flags & ~(V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED | 326 + V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE)) 327 + return -EINVAL; 328 + 329 + /* That all values are in the accepted range. */ 330 + if (lf->level > GENMASK(5, 0)) 331 + return -EINVAL; 332 + 333 + if (lf->sharpness > GENMASK(2, 0)) 334 + return -EINVAL; 335 + 336 + for (i = 0; i < ARRAY_SIZE(lf->ref_deltas); i++) 337 + if (lf->ref_deltas[i] < -63 || lf->ref_deltas[i] > 63) 338 + return -EINVAL; 339 + 340 + for (i = 0; i < ARRAY_SIZE(lf->mode_deltas); i++) 341 + if (lf->mode_deltas[i] < -63 || lf->mode_deltas[i] > 63) 342 + return -EINVAL; 343 + 344 + zero_reserved(*lf); 345 + return 0; 346 + } 347 + 348 + static int 349 + validate_vp9_quant_params(struct v4l2_vp9_quantization *quant) 350 + { 351 + if (quant->delta_q_y_dc < -15 || quant->delta_q_y_dc > 15 || 352 + quant->delta_q_uv_dc < -15 || quant->delta_q_uv_dc > 15 || 353 + quant->delta_q_uv_ac < -15 || quant->delta_q_uv_ac > 15) 354 + return -EINVAL; 355 + 356 + zero_reserved(*quant); 357 + return 0; 358 + } 359 + 360 + static int 361 + validate_vp9_seg_params(struct v4l2_vp9_segmentation *seg) 362 + { 363 + unsigned int i, j; 364 + 365 + if (seg->flags & ~(V4L2_VP9_SEGMENTATION_FLAG_ENABLED | 366 + V4L2_VP9_SEGMENTATION_FLAG_UPDATE_MAP | 367 + V4L2_VP9_SEGMENTATION_FLAG_TEMPORAL_UPDATE | 368 + V4L2_VP9_SEGMENTATION_FLAG_UPDATE_DATA | 369 + V4L2_VP9_SEGMENTATION_FLAG_ABS_OR_DELTA_UPDATE)) 370 + return -EINVAL; 371 + 372 + for (i = 0; i < ARRAY_SIZE(seg->feature_enabled); i++) { 373 + if (seg->feature_enabled[i] & 374 + ~V4L2_VP9_SEGMENT_FEATURE_ENABLED_MASK) 375 + return -EINVAL; 376 + } 377 + 378 + for (i = 0; i < ARRAY_SIZE(seg->feature_data); i++) { 379 + const int range[] = { 255, 63, 3, 0 }; 380 + 381 + for (j = 0; j < ARRAY_SIZE(seg->feature_data[j]); j++) { 382 + if (seg->feature_data[i][j] < -range[j] || 383 + seg->feature_data[i][j] > range[j]) 384 + return -EINVAL; 385 + } 386 + } 387 + 388 + zero_reserved(*seg); 389 + return 0; 390 + } 391 + 392 + static int 393 + validate_vp9_compressed_hdr(struct v4l2_ctrl_vp9_compressed_hdr *hdr) 394 + { 395 + if (hdr->tx_mode > V4L2_VP9_TX_MODE_SELECT) 396 + return -EINVAL; 397 + 398 + return 0; 399 + } 400 + 401 + static int 402 + validate_vp9_frame(struct v4l2_ctrl_vp9_frame *frame) 403 + { 404 + int ret; 405 + 406 + /* Make sure we're not passed invalid flags. */ 407 + if (frame->flags & ~(V4L2_VP9_FRAME_FLAG_KEY_FRAME | 408 + V4L2_VP9_FRAME_FLAG_SHOW_FRAME | 409 + V4L2_VP9_FRAME_FLAG_ERROR_RESILIENT | 410 + V4L2_VP9_FRAME_FLAG_INTRA_ONLY | 411 + V4L2_VP9_FRAME_FLAG_ALLOW_HIGH_PREC_MV | 412 + V4L2_VP9_FRAME_FLAG_REFRESH_FRAME_CTX | 413 + V4L2_VP9_FRAME_FLAG_PARALLEL_DEC_MODE | 414 + V4L2_VP9_FRAME_FLAG_X_SUBSAMPLING | 415 + V4L2_VP9_FRAME_FLAG_Y_SUBSAMPLING | 416 + V4L2_VP9_FRAME_FLAG_COLOR_RANGE_FULL_SWING)) 417 + return -EINVAL; 418 + 419 + if (frame->flags & V4L2_VP9_FRAME_FLAG_ERROR_RESILIENT && 420 + frame->flags & V4L2_VP9_FRAME_FLAG_REFRESH_FRAME_CTX) 421 + return -EINVAL; 422 + 423 + if (frame->profile > V4L2_VP9_PROFILE_MAX) 424 + return -EINVAL; 425 + 426 + if (frame->reset_frame_context > V4L2_VP9_RESET_FRAME_CTX_ALL) 427 + return -EINVAL; 428 + 429 + if (frame->frame_context_idx >= V4L2_VP9_NUM_FRAME_CTX) 430 + return -EINVAL; 431 + 432 + /* 433 + * Profiles 0 and 1 only support 8-bit depth, profiles 2 and 3 only 10 434 + * and 12 bit depths. 435 + */ 436 + if ((frame->profile < 2 && frame->bit_depth != 8) || 437 + (frame->profile >= 2 && 438 + (frame->bit_depth != 10 && frame->bit_depth != 12))) 439 + return -EINVAL; 440 + 441 + /* Profile 0 and 2 only accept YUV 4:2:0. */ 442 + if ((frame->profile == 0 || frame->profile == 2) && 443 + (!(frame->flags & V4L2_VP9_FRAME_FLAG_X_SUBSAMPLING) || 444 + !(frame->flags & V4L2_VP9_FRAME_FLAG_Y_SUBSAMPLING))) 445 + return -EINVAL; 446 + 447 + /* Profile 1 and 3 only accept YUV 4:2:2, 4:4:0 and 4:4:4. */ 448 + if ((frame->profile == 1 || frame->profile == 3) && 449 + ((frame->flags & V4L2_VP9_FRAME_FLAG_X_SUBSAMPLING) && 450 + (frame->flags & V4L2_VP9_FRAME_FLAG_Y_SUBSAMPLING))) 451 + return -EINVAL; 452 + 453 + if (frame->interpolation_filter > V4L2_VP9_INTERP_FILTER_SWITCHABLE) 454 + return -EINVAL; 455 + 456 + /* 457 + * According to the spec, tile_cols_log2 shall be less than or equal 458 + * to 6. 459 + */ 460 + if (frame->tile_cols_log2 > 6) 461 + return -EINVAL; 462 + 463 + if (frame->reference_mode > V4L2_VP9_REFERENCE_MODE_SELECT) 464 + return -EINVAL; 465 + 466 + ret = validate_vp9_lf_params(&frame->lf); 467 + if (ret) 468 + return ret; 469 + 470 + ret = validate_vp9_quant_params(&frame->quant); 471 + if (ret) 472 + return ret; 473 + 474 + ret = validate_vp9_seg_params(&frame->seg); 475 + if (ret) 476 + return ret; 477 + 478 + zero_reserved(*frame); 479 + return 0; 480 + } 325 481 326 482 /* 327 483 * Compound controls validation requires setting unused fields/flags to zero ··· 857 689 858 690 case V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX: 859 691 break; 692 + 693 + case V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR: 694 + return validate_vp9_compressed_hdr(p); 695 + 696 + case V4L2_CTRL_TYPE_VP9_FRAME: 697 + return validate_vp9_frame(p); 860 698 861 699 case V4L2_CTRL_TYPE_AREA: 862 700 area = p; ··· 1428 1254 break; 1429 1255 case V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY: 1430 1256 elem_size = sizeof(struct v4l2_ctrl_hdr10_mastering_display); 1257 + break; 1258 + case V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR: 1259 + elem_size = sizeof(struct v4l2_ctrl_vp9_compressed_hdr); 1260 + break; 1261 + case V4L2_CTRL_TYPE_VP9_FRAME: 1262 + elem_size = sizeof(struct v4l2_ctrl_vp9_frame); 1431 1263 break; 1432 1264 case V4L2_CTRL_TYPE_AREA: 1433 1265 elem_size = sizeof(struct v4l2_area);
+8
drivers/media/v4l2-core/v4l2-ctrls-defs.c
··· 1178 1178 case V4L2_CID_STATELESS_MPEG2_SEQUENCE: return "MPEG-2 Sequence Header"; 1179 1179 case V4L2_CID_STATELESS_MPEG2_PICTURE: return "MPEG-2 Picture Header"; 1180 1180 case V4L2_CID_STATELESS_MPEG2_QUANTISATION: return "MPEG-2 Quantisation Matrices"; 1181 + case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR: return "VP9 Probabilities Updates"; 1182 + case V4L2_CID_STATELESS_VP9_FRAME: return "VP9 Frame Decode Parameters"; 1181 1183 1182 1184 /* Colorimetry controls */ 1183 1185 /* Keep the order of the 'case's the same as in v4l2-controls.h! */ ··· 1507 1505 break; 1508 1506 case V4L2_CID_MPEG_VIDEO_HEVC_DECODE_PARAMS: 1509 1507 *type = V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS; 1508 + break; 1509 + case V4L2_CID_STATELESS_VP9_COMPRESSED_HDR: 1510 + *type = V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR; 1511 + break; 1512 + case V4L2_CID_STATELESS_VP9_FRAME: 1513 + *type = V4L2_CTRL_TYPE_VP9_FRAME; 1510 1514 break; 1511 1515 case V4L2_CID_UNIT_CELL_SIZE: 1512 1516 *type = V4L2_CTRL_TYPE_AREA;
+1
drivers/media/v4l2-core/v4l2-ioctl.c
··· 1413 1413 case V4L2_PIX_FMT_VP8: descr = "VP8"; break; 1414 1414 case V4L2_PIX_FMT_VP8_FRAME: descr = "VP8 Frame"; break; 1415 1415 case V4L2_PIX_FMT_VP9: descr = "VP9"; break; 1416 + case V4L2_PIX_FMT_VP9_FRAME: descr = "VP9 Frame"; break; 1416 1417 case V4L2_PIX_FMT_HEVC: descr = "HEVC"; break; /* aka H.265 */ 1417 1418 case V4L2_PIX_FMT_HEVC_SLICE: descr = "HEVC Parsed Slice Data"; break; 1418 1419 case V4L2_PIX_FMT_FWHT: descr = "FWHT"; break; /* used in vicodec */
+4
include/media/v4l2-ctrls.h
··· 50 50 * @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params. 51 51 * @p_h264_pred_weights: Pointer to a struct v4l2_ctrl_h264_pred_weights. 52 52 * @p_vp8_frame: Pointer to a VP8 frame params structure. 53 + * @p_vp9_compressed_hdr_probs: Pointer to a VP9 frame compressed header probs structure. 54 + * @p_vp9_frame: Pointer to a VP9 frame params structure. 53 55 * @p_hevc_sps: Pointer to an HEVC sequence parameter set structure. 54 56 * @p_hevc_pps: Pointer to an HEVC picture parameter set structure. 55 57 * @p_hevc_slice_params: Pointer to an HEVC slice parameters structure. ··· 82 80 struct v4l2_ctrl_hevc_sps *p_hevc_sps; 83 81 struct v4l2_ctrl_hevc_pps *p_hevc_pps; 84 82 struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; 83 + struct v4l2_ctrl_vp9_compressed_hdr *p_vp9_compressed_hdr_probs; 84 + struct v4l2_ctrl_vp9_frame *p_vp9_frame; 85 85 struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll; 86 86 struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering; 87 87 struct v4l2_area *p_area;
+284
include/uapi/linux/v4l2-controls.h
··· 2018 2018 __u32 min_display_mastering_luminance; 2019 2019 }; 2020 2020 2021 + /* Stateless VP9 controls */ 2022 + 2023 + #define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED 0x1 2024 + #define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE 0x2 2025 + 2026 + /** 2027 + * struct v4l2_vp9_loop_filter - VP9 loop filter parameters 2028 + * 2029 + * @ref_deltas: contains the adjustment needed for the filter level based on the 2030 + * chosen reference frame. If this syntax element is not present in the bitstream, 2031 + * users should pass its last value. 2032 + * @mode_deltas: contains the adjustment needed for the filter level based on the 2033 + * chosen mode. If this syntax element is not present in the bitstream, users should 2034 + * pass its last value. 2035 + * @level: indicates the loop filter strength. 2036 + * @sharpness: indicates the sharpness level. 2037 + * @flags: combination of V4L2_VP9_LOOP_FILTER_FLAG_{} flags. 2038 + * @reserved: padding field. Should be zeroed by applications. 2039 + * 2040 + * This structure contains all loop filter related parameters. See sections 2041 + * '7.2.8 Loop filter semantics' of the VP9 specification for more details. 2042 + */ 2043 + struct v4l2_vp9_loop_filter { 2044 + __s8 ref_deltas[4]; 2045 + __s8 mode_deltas[2]; 2046 + __u8 level; 2047 + __u8 sharpness; 2048 + __u8 flags; 2049 + __u8 reserved[7]; 2050 + }; 2051 + 2052 + /** 2053 + * struct v4l2_vp9_quantization - VP9 quantization parameters 2054 + * 2055 + * @base_q_idx: indicates the base frame qindex. 2056 + * @delta_q_y_dc: indicates the Y DC quantizer relative to base_q_idx. 2057 + * @delta_q_uv_dc: indicates the UV DC quantizer relative to base_q_idx. 2058 + * @delta_q_uv_ac: indicates the UV AC quantizer relative to base_q_idx. 2059 + * @reserved: padding field. Should be zeroed by applications. 2060 + * 2061 + * Encodes the quantization parameters. See section '7.2.9 Quantization params 2062 + * syntax' of the VP9 specification for more details. 2063 + */ 2064 + struct v4l2_vp9_quantization { 2065 + __u8 base_q_idx; 2066 + __s8 delta_q_y_dc; 2067 + __s8 delta_q_uv_dc; 2068 + __s8 delta_q_uv_ac; 2069 + __u8 reserved[4]; 2070 + }; 2071 + 2072 + #define V4L2_VP9_SEGMENTATION_FLAG_ENABLED 0x01 2073 + #define V4L2_VP9_SEGMENTATION_FLAG_UPDATE_MAP 0x02 2074 + #define V4L2_VP9_SEGMENTATION_FLAG_TEMPORAL_UPDATE 0x04 2075 + #define V4L2_VP9_SEGMENTATION_FLAG_UPDATE_DATA 0x08 2076 + #define V4L2_VP9_SEGMENTATION_FLAG_ABS_OR_DELTA_UPDATE 0x10 2077 + 2078 + #define V4L2_VP9_SEG_LVL_ALT_Q 0 2079 + #define V4L2_VP9_SEG_LVL_ALT_L 1 2080 + #define V4L2_VP9_SEG_LVL_REF_FRAME 2 2081 + #define V4L2_VP9_SEG_LVL_SKIP 3 2082 + #define V4L2_VP9_SEG_LVL_MAX 4 2083 + 2084 + #define V4L2_VP9_SEGMENT_FEATURE_ENABLED(id) (1 << (id)) 2085 + #define V4L2_VP9_SEGMENT_FEATURE_ENABLED_MASK 0xf 2086 + 2087 + /** 2088 + * struct v4l2_vp9_segmentation - VP9 segmentation parameters 2089 + * 2090 + * @feature_data: data attached to each feature. Data entry is only valid if 2091 + * the feature is enabled. The array shall be indexed with segment number as 2092 + * the first dimension (0..7) and one of V4L2_VP9_SEG_{} as the second dimension. 2093 + * @feature_enabled: bitmask defining which features are enabled in each segment. 2094 + * The value for each segment is a combination of V4L2_VP9_SEGMENT_FEATURE_ENABLED(id) 2095 + * values where id is one of V4L2_VP9_SEG_LVL_{}. 2096 + * @tree_probs: specifies the probability values to be used when decoding a 2097 + * Segment-ID. See '5.15. Segmentation map' section of the VP9 specification 2098 + * for more details. 2099 + * @pred_probs: specifies the probability values to be used when decoding a 2100 + * Predicted-Segment-ID. See '6.4.14. Get segment id syntax' section of :ref:`vp9` 2101 + * for more details. 2102 + * @flags: combination of V4L2_VP9_SEGMENTATION_FLAG_{} flags. 2103 + * @reserved: padding field. Should be zeroed by applications. 2104 + * 2105 + * Encodes the quantization parameters. See section '7.2.10 Segmentation params syntax' of 2106 + * the VP9 specification for more details. 2107 + */ 2108 + struct v4l2_vp9_segmentation { 2109 + __s16 feature_data[8][4]; 2110 + __u8 feature_enabled[8]; 2111 + __u8 tree_probs[7]; 2112 + __u8 pred_probs[3]; 2113 + __u8 flags; 2114 + __u8 reserved[5]; 2115 + }; 2116 + 2117 + #define V4L2_VP9_FRAME_FLAG_KEY_FRAME 0x001 2118 + #define V4L2_VP9_FRAME_FLAG_SHOW_FRAME 0x002 2119 + #define V4L2_VP9_FRAME_FLAG_ERROR_RESILIENT 0x004 2120 + #define V4L2_VP9_FRAME_FLAG_INTRA_ONLY 0x008 2121 + #define V4L2_VP9_FRAME_FLAG_ALLOW_HIGH_PREC_MV 0x010 2122 + #define V4L2_VP9_FRAME_FLAG_REFRESH_FRAME_CTX 0x020 2123 + #define V4L2_VP9_FRAME_FLAG_PARALLEL_DEC_MODE 0x040 2124 + #define V4L2_VP9_FRAME_FLAG_X_SUBSAMPLING 0x080 2125 + #define V4L2_VP9_FRAME_FLAG_Y_SUBSAMPLING 0x100 2126 + #define V4L2_VP9_FRAME_FLAG_COLOR_RANGE_FULL_SWING 0x200 2127 + 2128 + #define V4L2_VP9_SIGN_BIAS_LAST 0x1 2129 + #define V4L2_VP9_SIGN_BIAS_GOLDEN 0x2 2130 + #define V4L2_VP9_SIGN_BIAS_ALT 0x4 2131 + 2132 + #define V4L2_VP9_RESET_FRAME_CTX_NONE 0 2133 + #define V4L2_VP9_RESET_FRAME_CTX_SPEC 1 2134 + #define V4L2_VP9_RESET_FRAME_CTX_ALL 2 2135 + 2136 + #define V4L2_VP9_INTERP_FILTER_EIGHTTAP 0 2137 + #define V4L2_VP9_INTERP_FILTER_EIGHTTAP_SMOOTH 1 2138 + #define V4L2_VP9_INTERP_FILTER_EIGHTTAP_SHARP 2 2139 + #define V4L2_VP9_INTERP_FILTER_BILINEAR 3 2140 + #define V4L2_VP9_INTERP_FILTER_SWITCHABLE 4 2141 + 2142 + #define V4L2_VP9_REFERENCE_MODE_SINGLE_REFERENCE 0 2143 + #define V4L2_VP9_REFERENCE_MODE_COMPOUND_REFERENCE 1 2144 + #define V4L2_VP9_REFERENCE_MODE_SELECT 2 2145 + 2146 + #define V4L2_VP9_PROFILE_MAX 3 2147 + 2148 + #define V4L2_CID_STATELESS_VP9_FRAME (V4L2_CID_CODEC_STATELESS_BASE + 300) 2149 + /** 2150 + * struct v4l2_ctrl_vp9_frame - VP9 frame decoding control 2151 + * 2152 + * @lf: loop filter parameters. See &v4l2_vp9_loop_filter for more details. 2153 + * @quant: quantization parameters. See &v4l2_vp9_quantization for more details. 2154 + * @seg: segmentation parameters. See &v4l2_vp9_segmentation for more details. 2155 + * @flags: combination of V4L2_VP9_FRAME_FLAG_{} flags. 2156 + * @compressed_header_size: compressed header size in bytes. 2157 + * @uncompressed_header_size: uncompressed header size in bytes. 2158 + * @frame_width_minus_1: add 1 to it and you'll get the frame width expressed in pixels. 2159 + * @frame_height_minus_1: add 1 to it and you'll get the frame height expressed in pixels. 2160 + * @render_width_minus_1: add 1 to it and you'll get the expected render width expressed in 2161 + * pixels. This is not used during the decoding process but might be used by HW scalers 2162 + * to prepare a frame that's ready for scanout. 2163 + * @render_height_minus_1: add 1 to it and you'll get the expected render height expressed in 2164 + * pixels. This is not used during the decoding process but might be used by HW scalers 2165 + * to prepare a frame that's ready for scanout. 2166 + * @last_frame_ts: "last" reference buffer timestamp. 2167 + * The timestamp refers to the timestamp field in struct v4l2_buffer. 2168 + * Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64. 2169 + * @golden_frame_ts: "golden" reference buffer timestamp. 2170 + * The timestamp refers to the timestamp field in struct v4l2_buffer. 2171 + * Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64. 2172 + * @alt_frame_ts: "alt" reference buffer timestamp. 2173 + * The timestamp refers to the timestamp field in struct v4l2_buffer. 2174 + * Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64. 2175 + * @ref_frame_sign_bias: a bitfield specifying whether the sign bias is set for a given 2176 + * reference frame. Either of V4L2_VP9_SIGN_BIAS_{}. 2177 + * @reset_frame_context: specifies whether the frame context should be reset to default values. 2178 + * Either of V4L2_VP9_RESET_FRAME_CTX_{}. 2179 + * @frame_context_idx: frame context that should be used/updated. 2180 + * @profile: VP9 profile. Can be 0, 1, 2 or 3. 2181 + * @bit_depth: bits per components. Can be 8, 10 or 12. Note that not all profiles support 2182 + * 10 and/or 12 bits depths. 2183 + * @interpolation_filter: specifies the filter selection used for performing inter prediction. 2184 + * Set to one of V4L2_VP9_INTERP_FILTER_{}. 2185 + * @tile_cols_log2: specifies the base 2 logarithm of the width of each tile (where the width 2186 + * is measured in units of 8x8 blocks). Shall be less than or equal to 6. 2187 + * @tile_rows_log2: specifies the base 2 logarithm of the height of each tile (where the height 2188 + * is measured in units of 8x8 blocks). 2189 + * @reference_mode: specifies the type of inter prediction to be used. 2190 + * Set to one of V4L2_VP9_REFERENCE_MODE_{}. 2191 + * @reserved: padding field. Should be zeroed by applications. 2192 + */ 2193 + struct v4l2_ctrl_vp9_frame { 2194 + struct v4l2_vp9_loop_filter lf; 2195 + struct v4l2_vp9_quantization quant; 2196 + struct v4l2_vp9_segmentation seg; 2197 + __u32 flags; 2198 + __u16 compressed_header_size; 2199 + __u16 uncompressed_header_size; 2200 + __u16 frame_width_minus_1; 2201 + __u16 frame_height_minus_1; 2202 + __u16 render_width_minus_1; 2203 + __u16 render_height_minus_1; 2204 + __u64 last_frame_ts; 2205 + __u64 golden_frame_ts; 2206 + __u64 alt_frame_ts; 2207 + __u8 ref_frame_sign_bias; 2208 + __u8 reset_frame_context; 2209 + __u8 frame_context_idx; 2210 + __u8 profile; 2211 + __u8 bit_depth; 2212 + __u8 interpolation_filter; 2213 + __u8 tile_cols_log2; 2214 + __u8 tile_rows_log2; 2215 + __u8 reference_mode; 2216 + __u8 reserved[7]; 2217 + }; 2218 + 2219 + #define V4L2_VP9_NUM_FRAME_CTX 4 2220 + 2221 + /** 2222 + * struct v4l2_vp9_mv_probs - VP9 Motion vector probability updates 2223 + * @joint: motion vector joint probability updates. 2224 + * @sign: motion vector sign probability updates. 2225 + * @classes: motion vector class probability updates. 2226 + * @class0_bit: motion vector class0 bit probability updates. 2227 + * @bits: motion vector bits probability updates. 2228 + * @class0_fr: motion vector class0 fractional bit probability updates. 2229 + * @fr: motion vector fractional bit probability updates. 2230 + * @class0_hp: motion vector class0 high precision fractional bit probability updates. 2231 + * @hp: motion vector high precision fractional bit probability updates. 2232 + * 2233 + * This structure contains new values of motion vector probabilities. 2234 + * A value of zero in an array element means there is no update of the relevant probability. 2235 + * See `struct v4l2_vp9_prob_updates` for details. 2236 + */ 2237 + struct v4l2_vp9_mv_probs { 2238 + __u8 joint[3]; 2239 + __u8 sign[2]; 2240 + __u8 classes[2][10]; 2241 + __u8 class0_bit[2]; 2242 + __u8 bits[2][10]; 2243 + __u8 class0_fr[2][2][3]; 2244 + __u8 fr[2][3]; 2245 + __u8 class0_hp[2]; 2246 + __u8 hp[2]; 2247 + }; 2248 + 2249 + #define V4L2_CID_STATELESS_VP9_COMPRESSED_HDR (V4L2_CID_CODEC_STATELESS_BASE + 301) 2250 + 2251 + #define V4L2_VP9_TX_MODE_ONLY_4X4 0 2252 + #define V4L2_VP9_TX_MODE_ALLOW_8X8 1 2253 + #define V4L2_VP9_TX_MODE_ALLOW_16X16 2 2254 + #define V4L2_VP9_TX_MODE_ALLOW_32X32 3 2255 + #define V4L2_VP9_TX_MODE_SELECT 4 2256 + 2257 + /** 2258 + * struct v4l2_ctrl_vp9_compressed_hdr - VP9 probability updates control 2259 + * @tx_mode: specifies the TX mode. Set to one of V4L2_VP9_TX_MODE_{}. 2260 + * @tx8: TX 8x8 probability updates. 2261 + * @tx16: TX 16x16 probability updates. 2262 + * @tx32: TX 32x32 probability updates. 2263 + * @coef: coefficient probability updates. 2264 + * @skip: skip probability updates. 2265 + * @inter_mode: inter mode probability updates. 2266 + * @interp_filter: interpolation filter probability updates. 2267 + * @is_inter: is inter-block probability updates. 2268 + * @comp_mode: compound prediction mode probability updates. 2269 + * @single_ref: single ref probability updates. 2270 + * @comp_ref: compound ref probability updates. 2271 + * @y_mode: Y prediction mode probability updates. 2272 + * @uv_mode: UV prediction mode probability updates. 2273 + * @partition: partition probability updates. 2274 + * @mv: motion vector probability updates. 2275 + * 2276 + * This structure holds the probabilities update as parsed in the compressed 2277 + * header (Spec 6.3). These values represent the value of probability update after 2278 + * being translated with inv_map_table[] (see 6.3.5). A value of zero in an array element 2279 + * means that there is no update of the relevant probability. 2280 + * 2281 + * This control is optional and needs to be used when dealing with the hardware which is 2282 + * not capable of parsing the compressed header itself. Only drivers which need it will 2283 + * implement it. 2284 + */ 2285 + struct v4l2_ctrl_vp9_compressed_hdr { 2286 + __u8 tx_mode; 2287 + __u8 tx8[2][1]; 2288 + __u8 tx16[2][2]; 2289 + __u8 tx32[2][3]; 2290 + __u8 coef[4][2][2][6][6][3]; 2291 + __u8 skip[3]; 2292 + __u8 inter_mode[7][3]; 2293 + __u8 interp_filter[4][2]; 2294 + __u8 is_inter[4]; 2295 + __u8 comp_mode[5]; 2296 + __u8 single_ref[5][2]; 2297 + __u8 comp_ref[5]; 2298 + __u8 y_mode[4][9]; 2299 + __u8 uv_mode[10][9]; 2300 + __u8 partition[16][3]; 2301 + 2302 + struct v4l2_vp9_mv_probs mv; 2303 + }; 2304 + 2021 2305 /* MPEG-compression definitions kept for backwards compatibility */ 2022 2306 #ifndef __KERNEL__ 2023 2307 #define V4L2_CTRL_CLASS_MPEG V4L2_CTRL_CLASS_CODEC
+6
include/uapi/linux/videodev2.h
··· 703 703 #define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */ 704 704 #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') /* VP8 parsed frame */ 705 705 #define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */ 706 + #define V4L2_PIX_FMT_VP9_FRAME v4l2_fourcc('V', 'P', '9', 'F') /* VP9 parsed frame */ 706 707 #define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC aka H.265 */ 707 708 #define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */ 708 709 #define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */ ··· 1760 1759 struct v4l2_ctrl_mpeg2_sequence __user *p_mpeg2_sequence; 1761 1760 struct v4l2_ctrl_mpeg2_picture __user *p_mpeg2_picture; 1762 1761 struct v4l2_ctrl_mpeg2_quantisation __user *p_mpeg2_quantisation; 1762 + struct v4l2_ctrl_vp9_compressed_hdr __user *p_vp9_compressed_hdr_probs; 1763 + struct v4l2_ctrl_vp9_frame __user *p_vp9_frame; 1763 1764 void __user *ptr; 1764 1765 }; 1765 1766 } __attribute__ ((packed)); ··· 1826 1823 V4L2_CTRL_TYPE_MPEG2_QUANTISATION = 0x0250, 1827 1824 V4L2_CTRL_TYPE_MPEG2_SEQUENCE = 0x0251, 1828 1825 V4L2_CTRL_TYPE_MPEG2_PICTURE = 0x0252, 1826 + 1827 + V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR = 0x0260, 1828 + V4L2_CTRL_TYPE_VP9_FRAME = 0x0261, 1829 1829 }; 1830 1830 1831 1831 /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */