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

media: uapi: move MPEG-2 stateless controls out of staging

Until now, the MPEG-2 V4L2 API was not exported as a public API,
and only defined in a private media header (media/mpeg2-ctrls.h).

After reviewing the MPEG-2 specification in detail, and reworking
the controls so they match the MPEG-2 semantics properly,
we can consider it ready.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Tested-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Tested-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

Ezequiel Garcia and committed by
Mauro Carvalho Chehab
f4815b39 3c994c6d

+367 -369
+214
Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
··· 1244 1244 * - __u8 1245 1245 - ``padding[3]`` 1246 1246 - Applications and drivers must set this to zero. 1247 + 1248 + .. _v4l2-codec-stateless-mpeg2: 1249 + 1250 + ``V4L2_CID_STATELESS_MPEG2_SEQUENCE (struct)`` 1251 + Specifies the sequence parameters (as extracted from the bitstream) for the 1252 + associated MPEG-2 slice data. This includes fields matching the syntax 1253 + elements from the sequence header and sequence extension parts of the 1254 + bitstream as specified by :ref:`mpeg2part2`. 1255 + 1256 + .. c:type:: v4l2_ctrl_mpeg2_sequence 1257 + 1258 + .. raw:: latex 1259 + 1260 + \small 1261 + 1262 + .. cssclass:: longtable 1263 + 1264 + .. tabularcolumns:: |p{1.4cm}|p{6.5cm}|p{9.4cm}| 1265 + 1266 + .. flat-table:: struct v4l2_ctrl_mpeg2_sequence 1267 + :header-rows: 0 1268 + :stub-columns: 0 1269 + :widths: 1 1 2 1270 + 1271 + * - __u16 1272 + - ``horizontal_size`` 1273 + - The width of the displayable part of the frame's luminance component. 1274 + * - __u16 1275 + - ``vertical_size`` 1276 + - The height of the displayable part of the frame's luminance component. 1277 + * - __u32 1278 + - ``vbv_buffer_size`` 1279 + - Used to calculate the required size of the video buffering verifier, 1280 + defined (in bits) as: 16 * 1024 * vbv_buffer_size. 1281 + * - __u16 1282 + - ``profile_and_level_indication`` 1283 + - The current profile and level indication as extracted from the 1284 + bitstream. 1285 + * - __u8 1286 + - ``chroma_format`` 1287 + - The chrominance sub-sampling format (1: 4:2:0, 2: 4:2:2, 3: 4:4:4). 1288 + * - __u8 1289 + - ``flags`` 1290 + - See :ref:`MPEG-2 Sequence Flags <mpeg2_sequence_flags>`. 1291 + 1292 + .. _mpeg2_sequence_flags: 1293 + 1294 + ``MPEG-2 Sequence Flags`` 1295 + 1296 + .. cssclass:: longtable 1297 + 1298 + .. flat-table:: 1299 + :header-rows: 0 1300 + :stub-columns: 0 1301 + :widths: 1 1 2 1302 + 1303 + * - ``V4L2_MPEG2_SEQ_FLAG_PROGRESSIVE`` 1304 + - 0x01 1305 + - Indication that all the frames for the sequence are progressive instead 1306 + of interlaced. 1307 + 1308 + .. raw:: latex 1309 + 1310 + \normalsize 1311 + 1312 + ``V4L2_CID_STATELESS_MPEG2_PICTURE (struct)`` 1313 + Specifies the picture parameters (as extracted from the bitstream) for the 1314 + associated MPEG-2 slice data. This includes fields matching the syntax 1315 + elements from the picture header and picture coding extension parts of the 1316 + bitstream as specified by :ref:`mpeg2part2`. 1317 + 1318 + .. c:type:: v4l2_ctrl_mpeg2_picture 1319 + 1320 + .. raw:: latex 1321 + 1322 + \small 1323 + 1324 + .. cssclass:: longtable 1325 + 1326 + .. tabularcolumns:: |p{1.0cm}|p{5.6cm}|p{10.7cm}| 1327 + 1328 + .. flat-table:: struct v4l2_ctrl_mpeg2_picture 1329 + :header-rows: 0 1330 + :stub-columns: 0 1331 + :widths: 1 1 2 1332 + 1333 + * - __u64 1334 + - ``backward_ref_ts`` 1335 + - Timestamp of the V4L2 capture buffer to use as backward reference, used 1336 + with B-coded and P-coded frames. The timestamp refers to the 1337 + ``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the 1338 + :c:func:`v4l2_timeval_to_ns()` function to convert the struct 1339 + :c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64. 1340 + * - __u64 1341 + - ``forward_ref_ts`` 1342 + - Timestamp for the V4L2 capture buffer to use as forward reference, used 1343 + with B-coded frames. The timestamp refers to the ``timestamp`` field in 1344 + struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` 1345 + function to convert the struct :c:type:`timeval` in struct 1346 + :c:type:`v4l2_buffer` to a __u64. 1347 + * - __u32 1348 + - ``flags`` 1349 + - See :ref:`MPEG-2 Picture Flags <mpeg2_picture_flags>`. 1350 + * - __u8 1351 + - ``f_code[2][2]`` 1352 + - Motion vector codes. 1353 + * - __u8 1354 + - ``picture_coding_type`` 1355 + - Picture coding type for the frame covered by the current slice 1356 + (V4L2_MPEG2_PICTURE_CODING_TYPE_I, V4L2_MPEG2_PICTURE_CODING_TYPE_P or 1357 + V4L2_MPEG2_PICTURE_CODING_TYPE_B). 1358 + * - __u8 1359 + - ``picture_structure`` 1360 + - Picture structure (1: interlaced top field, 2: interlaced bottom field, 1361 + 3: progressive frame). 1362 + * - __u8 1363 + - ``intra_dc_precision`` 1364 + - Precision of Discrete Cosine transform (0: 8 bits precision, 1365 + 1: 9 bits precision, 2: 10 bits precision, 3: 11 bits precision). 1366 + * - __u8 1367 + - ``reserved[5]`` 1368 + - Applications and drivers must set this to zero. 1369 + 1370 + .. _mpeg2_picture_flags: 1371 + 1372 + ``MPEG-2 Picture Flags`` 1373 + 1374 + .. cssclass:: longtable 1375 + 1376 + .. flat-table:: 1377 + :header-rows: 0 1378 + :stub-columns: 0 1379 + :widths: 1 1 2 1380 + 1381 + * - ``V4L2_MPEG2_PIC_FLAG_TOP_FIELD_FIRST`` 1382 + - 0x00000001 1383 + - If set and it's an interlaced stream, top field is output first. 1384 + * - ``V4L2_MPEG2_PIC_FLAG_FRAME_PRED_DCT`` 1385 + - 0x00000002 1386 + - If set only frame-DCT and frame prediction are used. 1387 + * - ``V4L2_MPEG2_PIC_FLAG_CONCEALMENT_MV`` 1388 + - 0x00000004 1389 + - If set motion vectors are coded for intra macroblocks. 1390 + * - ``V4L2_MPEG2_PIC_FLAG_Q_SCALE_TYPE`` 1391 + - 0x00000008 1392 + - This flag affects the inverse quantization process. 1393 + * - ``V4L2_MPEG2_PIC_FLAG_INTRA_VLC`` 1394 + - 0x00000010 1395 + - This flag affects the decoding of transform coefficient data. 1396 + * - ``V4L2_MPEG2_PIC_FLAG_ALT_SCAN`` 1397 + - 0x00000020 1398 + - This flag affects the decoding of transform coefficient data. 1399 + * - ``V4L2_MPEG2_PIC_FLAG_REPEAT_FIRST`` 1400 + - 0x00000040 1401 + - This flag affects the decoding process of progressive frames. 1402 + * - ``V4L2_MPEG2_PIC_FLAG_PROGRESSIVE`` 1403 + - 0x00000080 1404 + - Indicates whether the current frame is progressive. 1405 + 1406 + .. raw:: latex 1407 + 1408 + \normalsize 1409 + 1410 + ``V4L2_CID_STATELESS_MPEG2_QUANTISATION (struct)`` 1411 + Specifies quantisation matrices, in zigzag scanning order, for the 1412 + associated MPEG-2 slice data. This control is initialized by the kernel 1413 + to the matrices default values. If a bitstream transmits a user-defined 1414 + quantisation matrices load, applications are expected to use this control. 1415 + Applications are also expected to set the control loading the default 1416 + values, if the quantisation matrices need to be reset, for instance on a 1417 + sequence header. This process is specified by section 6.3.7. 1418 + "Quant matrix extension" of the specification. 1419 + 1420 + .. c:type:: v4l2_ctrl_mpeg2_quantisation 1421 + 1422 + .. tabularcolumns:: |p{0.8cm}|p{8.0cm}|p{8.5cm}| 1423 + 1424 + .. cssclass:: longtable 1425 + 1426 + .. raw:: latex 1427 + 1428 + \small 1429 + 1430 + .. flat-table:: struct v4l2_ctrl_mpeg2_quantisation 1431 + :header-rows: 0 1432 + :stub-columns: 0 1433 + :widths: 1 1 2 1434 + 1435 + * - __u8 1436 + - ``intra_quantiser_matrix[64]`` 1437 + - The quantisation matrix coefficients for intra-coded frames, in zigzag 1438 + scanning order. It is relevant for both luma and chroma components, 1439 + although it can be superseded by the chroma-specific matrix for 1440 + non-4:2:0 YUV formats. 1441 + * - __u8 1442 + - ``non_intra_quantiser_matrix[64]`` 1443 + - The quantisation matrix coefficients for non-intra-coded frames, in 1444 + zigzag scanning order. It is relevant for both luma and chroma 1445 + components, although it can be superseded by the chroma-specific matrix 1446 + for non-4:2:0 YUV formats. 1447 + * - __u8 1448 + - ``chroma_intra_quantiser_matrix[64]`` 1449 + - The quantisation matrix coefficients for the chominance component of 1450 + intra-coded frames, in zigzag scanning order. Only relevant for 1451 + non-4:2:0 YUV formats. 1452 + * - __u8 1453 + - ``chroma_non_intra_quantiser_matrix[64]`` 1454 + - The quantisation matrix coefficients for the chrominance component of 1455 + non-intra-coded frames, in zigzag scanning order. Only relevant for 1456 + non-4:2:0 YUV formats. 1457 + 1458 + .. raw:: latex 1459 + 1460 + \normalsize
-216
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst
··· 1606 1606 ``V4L2_CID_MPEG_VIDEO_H264_HIER_CODING_L6_BR (integer)`` 1607 1607 Indicates bit rate (bps) for hierarchical coding layer 6 for H264 encoder. 1608 1608 1609 - .. _v4l2-mpeg-mpeg2: 1610 - 1611 - ``V4L2_CID_MPEG_VIDEO_MPEG2_SEQUENCE (struct)`` 1612 - Specifies the sequence parameters (as extracted from the bitstream) for the 1613 - associated MPEG-2 slice data. This includes fields matching the syntax 1614 - elements from the sequence header and sequence extension parts of the 1615 - bitstream as specified by :ref:`mpeg2part2`. 1616 - 1617 - .. note:: 1618 - 1619 - This compound control is not yet part of the public kernel API and 1620 - it is expected to change. 1621 - 1622 - .. c:type:: v4l2_ctrl_mpeg2_sequence 1623 - 1624 - .. cssclass:: longtable 1625 - 1626 - .. tabularcolumns:: |p{1.4cm}|p{6.5cm}|p{9.4cm}| 1627 - 1628 - .. flat-table:: struct v4l2_ctrl_mpeg2_sequence 1629 - :header-rows: 0 1630 - :stub-columns: 0 1631 - :widths: 1 1 2 1632 - 1633 - * - __u16 1634 - - ``horizontal_size`` 1635 - - The width of the displayable part of the frame's luminance component. 1636 - * - __u16 1637 - - ``vertical_size`` 1638 - - The height of the displayable part of the frame's luminance component. 1639 - * - __u32 1640 - - ``vbv_buffer_size`` 1641 - - Used to calculate the required size of the video buffering verifier, 1642 - defined (in bits) as: 16 * 1024 * vbv_buffer_size. 1643 - * - __u16 1644 - - ``profile_and_level_indication`` 1645 - - The current profile and level indication as extracted from the 1646 - bitstream. 1647 - * - __u8 1648 - - ``chroma_format`` 1649 - - The chrominance sub-sampling format (1: 4:2:0, 2: 4:2:2, 3: 4:4:4). 1650 - * - __u8 1651 - - ``flags`` 1652 - - See :ref:`MPEG-2 Sequence Flags <mpeg2_sequence_flags>`. 1653 - 1654 - .. _mpeg2_sequence_flags: 1655 - 1656 - ``MPEG-2 Sequence Flags`` 1657 - 1658 - .. cssclass:: longtable 1659 - 1660 - .. flat-table:: 1661 - :header-rows: 0 1662 - :stub-columns: 0 1663 - :widths: 1 1 2 1664 - 1665 - * - ``V4L2_MPEG2_SEQ_FLAG_PROGRESSIVE`` 1666 - - 0x01 1667 - - Indication that all the frames for the sequence are progressive instead 1668 - of interlaced. 1669 - 1670 - ``V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE (struct)`` 1671 - Specifies the picture parameters (as extracted from the bitstream) for the 1672 - associated MPEG-2 slice data. This includes fields matching the syntax 1673 - elements from the picture header and picture coding extension parts of the 1674 - bitstream as specified by :ref:`mpeg2part2`. 1675 - 1676 - .. note:: 1677 - 1678 - This compound control is not yet part of the public kernel API and 1679 - it is expected to change. 1680 - 1681 - .. c:type:: v4l2_ctrl_mpeg2_picture 1682 - 1683 - .. raw:: latex 1684 - 1685 - \small 1686 - 1687 - .. cssclass:: longtable 1688 - 1689 - .. tabularcolumns:: |p{1.0cm}|p{5.6cm}|p{10.7cm}| 1690 - 1691 - .. flat-table:: struct v4l2_ctrl_mpeg2_picture 1692 - :header-rows: 0 1693 - :stub-columns: 0 1694 - :widths: 1 1 2 1695 - 1696 - * - __u64 1697 - - ``backward_ref_ts`` 1698 - - Timestamp of the V4L2 capture buffer to use as backward reference, used 1699 - with B-coded and P-coded frames. The timestamp refers to the 1700 - ``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the 1701 - :c:func:`v4l2_timeval_to_ns()` function to convert the struct 1702 - :c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64. 1703 - * - __u64 1704 - - ``forward_ref_ts`` 1705 - - Timestamp for the V4L2 capture buffer to use as forward reference, used 1706 - with B-coded frames. The timestamp refers to the ``timestamp`` field in 1707 - struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` 1708 - function to convert the struct :c:type:`timeval` in struct 1709 - :c:type:`v4l2_buffer` to a __u64. 1710 - * - __u32 1711 - - ``flags`` 1712 - - See :ref:`MPEG-2 Picture Flags <mpeg2_picture_flags>`. 1713 - * - __u8 1714 - - ``f_code[2][2]`` 1715 - - Motion vector codes. 1716 - * - __u8 1717 - - ``picture_coding_type`` 1718 - - Picture coding type for the frame covered by the current slice 1719 - (V4L2_MPEG2_PICTURE_CODING_TYPE_I, V4L2_MPEG2_PICTURE_CODING_TYPE_P or 1720 - V4L2_MPEG2_PICTURE_CODING_TYPE_B). 1721 - * - __u8 1722 - - ``picture_structure`` 1723 - - Picture structure (1: interlaced top field, 2: interlaced bottom field, 1724 - 3: progressive frame). 1725 - * - __u8 1726 - - ``intra_dc_precision`` 1727 - - Precision of Discrete Cosine transform (0: 8 bits precision, 1728 - 1: 9 bits precision, 2: 10 bits precision, 3: 11 bits precision). 1729 - * - __u8 1730 - - ``reserved[5]`` 1731 - - Applications and drivers must set this to zero. 1732 - 1733 - 1734 - .. _mpeg2_picture_flags: 1735 - 1736 - ``MPEG-2 Picture Flags`` 1737 - 1738 - .. cssclass:: longtable 1739 - 1740 - .. flat-table:: 1741 - :header-rows: 0 1742 - :stub-columns: 0 1743 - :widths: 1 1 2 1744 - 1745 - * - ``V4L2_MPEG2_PIC_FLAG_TOP_FIELD_FIRST`` 1746 - - 0x00000001 1747 - - If set and it's an interlaced stream, top field is output first. 1748 - * - ``V4L2_MPEG2_PIC_FLAG_FRAME_PRED_DCT`` 1749 - - 0x00000002 1750 - - If set only frame-DCT and frame prediction are used. 1751 - * - ``V4L2_MPEG2_PIC_FLAG_CONCEALMENT_MV`` 1752 - - 0x00000004 1753 - - If set motion vectors are coded for intra macroblocks. 1754 - * - ``V4L2_MPEG2_PIC_FLAG_Q_SCALE_TYPE`` 1755 - - 0x00000008 1756 - - This flag affects the inverse quantization process. 1757 - * - ``V4L2_MPEG2_PIC_FLAG_INTRA_VLC`` 1758 - - 0x00000010 1759 - - This flag affects the decoding of transform coefficient data. 1760 - * - ``V4L2_MPEG2_PIC_FLAG_ALT_SCAN`` 1761 - - 0x00000020 1762 - - This flag affects the decoding of transform coefficient data. 1763 - * - ``V4L2_MPEG2_PIC_FLAG_REPEAT_FIRST`` 1764 - - 0x00000040 1765 - - This flag affects the decoding process of progressive frames. 1766 - * - ``V4L2_MPEG2_PIC_FLAG_PROGRESSIVE`` 1767 - - 0x00000080 1768 - - Indicates whether the current frame is progressive. 1769 - 1770 - .. raw:: latex 1771 - 1772 - \normalsize 1773 - 1774 - ``V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION (struct)`` 1775 - Specifies quantisation matrices (as extracted from the bitstream) for the 1776 - associated MPEG-2 slice data. 1777 - 1778 - .. note:: 1779 - 1780 - This compound control is not yet part of the public kernel API and 1781 - it is expected to change. 1782 - 1783 - .. c:type:: v4l2_ctrl_mpeg2_quantisation 1784 - 1785 - .. tabularcolumns:: |p{0.8cm}|p{8.0cm}|p{8.5cm}| 1786 - 1787 - .. cssclass:: longtable 1788 - 1789 - .. raw:: latex 1790 - 1791 - \small 1792 - 1793 - .. flat-table:: struct v4l2_ctrl_mpeg2_quantisation 1794 - :header-rows: 0 1795 - :stub-columns: 0 1796 - :widths: 1 1 2 1797 - 1798 - * - __u8 1799 - - ``intra_quantiser_matrix[64]`` 1800 - - The quantisation matrix coefficients for intra-coded frames, in zigzag 1801 - scanning order. It is relevant for both luma and chroma components, 1802 - although it can be superseded by the chroma-specific matrix for 1803 - non-4:2:0 YUV formats. 1804 - * - __u8 1805 - - ``non_intra_quantiser_matrix[64]`` 1806 - - The quantisation matrix coefficients for non-intra-coded frames, in 1807 - zigzag scanning order. It is relevant for both luma and chroma 1808 - components, although it can be superseded by the chroma-specific matrix 1809 - for non-4:2:0 YUV formats. 1810 - * - __u8 1811 - - ``chroma_intra_quantiser_matrix[64]`` 1812 - - The quantisation matrix coefficients for the chominance component of 1813 - intra-coded frames, in zigzag scanning order. Only relevant for 1814 - non-4:2:0 YUV formats. 1815 - * - __u8 1816 - - ``chroma_non_intra_quantiser_matrix[64]`` 1817 - - The quantisation matrix coefficients for the chrominance component of 1818 - non-intra-coded frames, in zigzag scanning order. Only relevant for 1819 - non-4:2:0 YUV formats. 1820 - 1821 - .. raw:: latex 1822 - 1823 - \normalsize 1824 - 1825 1609 ``V4L2_CID_FWHT_I_FRAME_QP (integer)`` 1826 1610 Quantization parameter for an I frame for FWHT. Valid range: from 1 1827 1611 to 31.
+5 -5
Documentation/userspace-api/media/v4l/pixfmt-compressed.rst
··· 112 112 - 'MG2S' 113 113 - MPEG-2 parsed slice data, as extracted from the MPEG-2 bitstream. 114 114 This format is adapted for stateless video decoders that implement a 115 - MPEG-2 pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`). 115 + MPEG-2 pipeline with the :ref:`stateless_decoder`. 116 116 Metadata associated with the frame to decode is required to be passed 117 - through the ``V4L2_CID_MPEG_VIDEO_MPEG2_SEQUENCE`` and 118 - ``V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE`` controls. 117 + through the ``V4L2_CID_STATELESS_MPEG2_SEQUENCE`` and 118 + ``V4L2_CID_STATELESS_MPEG2_PICTURE`` controls. 119 119 Quantisation matrices can optionally be specified through the 120 - ``V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION`` control. 121 - See the :ref:`associated Codec Control IDs <v4l2-mpeg-mpeg2>`. 120 + ``V4L2_CID_STATELESS_MPEG2_QUANTISATION`` control. 121 + See the :ref:`associated Codec Control IDs <v4l2-codec-stateless-mpeg2>`. 122 122 Exactly one output and one capture buffer must be provided for use with 123 123 this pixel format. The output buffer must contain the appropriate number 124 124 of macroblocks to decode a full corresponding frame to the matching
+12
Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
··· 221 221 - ``p_vp8_frame`` 222 222 - A pointer to a struct :c:type:`v4l2_ctrl_vp8_frame`. Valid if this control is 223 223 of type ``V4L2_CTRL_TYPE_VP8_FRAME``. 224 + * - struct :c:type:`v4l2_ctrl_mpeg2_sequence` * 225 + - ``p_mpeg2_sequence`` 226 + - A pointer to a struct :c:type:`v4l2_ctrl_mpeg2_sequence`. Valid if this control is 227 + of type ``V4L2_CTRL_TYPE_MPEG2_SEQUENCE``. 228 + * - struct :c:type:`v4l2_ctrl_mpeg2_picture` * 229 + - ``p_mpeg2_picture`` 230 + - A pointer to a struct :c:type:`v4l2_ctrl_mpeg2_picture`. Valid if this control is 231 + of type ``V4L2_CTRL_TYPE_MPEG2_PICTURE``. 232 + * - struct :c:type:`v4l2_ctrl_mpeg2_quantisation` * 233 + - ``p_mpeg2_quantisation`` 234 + - A pointer to a struct :c:type:`v4l2_ctrl_mpeg2_quantisation`. Valid if this control is 235 + of type ``V4L2_CTRL_TYPE_MPEG2_QUANTISATION``. 224 236 * - struct :c:type:`v4l2_ctrl_hdr10_cll_info` * 225 237 - ``p_hdr10_cll`` 226 238 - A pointer to a struct :c:type:`v4l2_ctrl_hdr10_cll_info`. Valid if this control is
+6 -6
drivers/media/v4l2-core/v4l2-ctrls.c
··· 977 977 case V4L2_CID_MPEG_VIDEO_LTR_COUNT: return "LTR Count"; 978 978 case V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX: return "Frame LTR Index"; 979 979 case V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES: return "Use LTR Frames"; 980 - case V4L2_CID_MPEG_VIDEO_MPEG2_SEQUENCE: return "MPEG-2 Sequence Header"; 981 - case V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE: return "MPEG-2 Picture Header"; 982 - case V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION: return "MPEG-2 Quantisation Matrices"; 983 980 case V4L2_CID_FWHT_I_FRAME_QP: return "FWHT I-Frame QP Value"; 984 981 case V4L2_CID_FWHT_P_FRAME_QP: return "FWHT P-Frame QP Value"; 985 982 ··· 1225 1228 case V4L2_CID_STATELESS_H264_DECODE_PARAMS: return "H264 Decode Parameters"; 1226 1229 case V4L2_CID_STATELESS_FWHT_PARAMS: return "FWHT Stateless Parameters"; 1227 1230 case V4L2_CID_STATELESS_VP8_FRAME: return "VP8 Frame Parameters"; 1231 + case V4L2_CID_STATELESS_MPEG2_SEQUENCE: return "MPEG-2 Sequence Header"; 1232 + case V4L2_CID_STATELESS_MPEG2_PICTURE: return "MPEG-2 Picture Header"; 1233 + case V4L2_CID_STATELESS_MPEG2_QUANTISATION: return "MPEG-2 Quantisation Matrices"; 1228 1234 1229 1235 /* Colorimetry controls */ 1230 1236 /* Keep the order of the 'case's the same as in v4l2-controls.h! */ ··· 1500 1500 case V4L2_CID_RDS_TX_ALT_FREQS: 1501 1501 *type = V4L2_CTRL_TYPE_U32; 1502 1502 break; 1503 - case V4L2_CID_MPEG_VIDEO_MPEG2_SEQUENCE: 1503 + case V4L2_CID_STATELESS_MPEG2_SEQUENCE: 1504 1504 *type = V4L2_CTRL_TYPE_MPEG2_SEQUENCE; 1505 1505 break; 1506 - case V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE: 1506 + case V4L2_CID_STATELESS_MPEG2_PICTURE: 1507 1507 *type = V4L2_CTRL_TYPE_MPEG2_PICTURE; 1508 1508 break; 1509 - case V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION: 1509 + case V4L2_CID_STATELESS_MPEG2_QUANTISATION: 1510 1510 *type = V4L2_CTRL_TYPE_MPEG2_QUANTISATION; 1511 1511 break; 1512 1512 case V4L2_CID_STATELESS_FWHT_PARAMS:
+3 -3
drivers/staging/media/hantro/hantro_drv.c
··· 298 298 }, { 299 299 .codec = HANTRO_MPEG2_DECODER, 300 300 .cfg = { 301 - .id = V4L2_CID_MPEG_VIDEO_MPEG2_SEQUENCE, 301 + .id = V4L2_CID_STATELESS_MPEG2_SEQUENCE, 302 302 }, 303 303 }, { 304 304 .codec = HANTRO_MPEG2_DECODER, 305 305 .cfg = { 306 - .id = V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE, 306 + .id = V4L2_CID_STATELESS_MPEG2_PICTURE, 307 307 }, 308 308 }, { 309 309 .codec = HANTRO_MPEG2_DECODER, 310 310 .cfg = { 311 - .id = V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION, 311 + .id = V4L2_CID_STATELESS_MPEG2_QUANTISATION, 312 312 }, 313 313 }, { 314 314 .codec = HANTRO_VP8_DECODER,
+3 -3
drivers/staging/media/hantro/hantro_g1_mpeg2_dec.c
··· 83 83 { 84 84 struct v4l2_ctrl_mpeg2_quantisation *q; 85 85 86 - q = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION); 86 + q = hantro_get_ctrl(ctx, V4L2_CID_STATELESS_MPEG2_QUANTISATION); 87 87 hantro_mpeg2_dec_copy_qtable(ctx->mpeg2_dec.qtable.cpu, q); 88 88 vdpu_write_relaxed(vpu, ctx->mpeg2_dec.qtable.dma, G1_REG_QTABLE_BASE); 89 89 } ··· 160 160 hantro_start_prepare_run(ctx); 161 161 162 162 seq = hantro_get_ctrl(ctx, 163 - V4L2_CID_MPEG_VIDEO_MPEG2_SEQUENCE); 163 + V4L2_CID_STATELESS_MPEG2_SEQUENCE); 164 164 pic = hantro_get_ctrl(ctx, 165 - V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE); 165 + V4L2_CID_STATELESS_MPEG2_PICTURE); 166 166 167 167 reg = G1_REG_DEC_AXI_RD_ID(0) | 168 168 G1_REG_DEC_TIMEOUT_E(1) |
+3 -3
drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c
··· 85 85 { 86 86 struct v4l2_ctrl_mpeg2_quantisation *q; 87 87 88 - q = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION); 88 + q = hantro_get_ctrl(ctx, V4L2_CID_STATELESS_MPEG2_QUANTISATION); 89 89 hantro_mpeg2_dec_copy_qtable(ctx->mpeg2_dec.qtable.cpu, q); 90 90 vdpu_write_relaxed(vpu, ctx->mpeg2_dec.qtable.dma, VDPU_REG_QTABLE_BASE); 91 91 } ··· 162 162 hantro_start_prepare_run(ctx); 163 163 164 164 seq = hantro_get_ctrl(ctx, 165 - V4L2_CID_MPEG_VIDEO_MPEG2_SEQUENCE); 165 + V4L2_CID_STATELESS_MPEG2_SEQUENCE); 166 166 pic = hantro_get_ctrl(ctx, 167 - V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE); 167 + V4L2_CID_STATELESS_MPEG2_PICTURE); 168 168 169 169 reg = VDPU_REG_DEC_ADV_PRE_DIS(0) | 170 170 VDPU_REG_DEC_SCMD_DIS(0) |
+3 -3
drivers/staging/media/sunxi/cedrus/cedrus.c
··· 31 31 static const struct cedrus_control cedrus_controls[] = { 32 32 { 33 33 .cfg = { 34 - .id = V4L2_CID_MPEG_VIDEO_MPEG2_SEQUENCE, 34 + .id = V4L2_CID_STATELESS_MPEG2_SEQUENCE, 35 35 }, 36 36 .codec = CEDRUS_CODEC_MPEG2, 37 37 }, 38 38 { 39 39 .cfg = { 40 - .id = V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE, 40 + .id = V4L2_CID_STATELESS_MPEG2_PICTURE, 41 41 }, 42 42 .codec = CEDRUS_CODEC_MPEG2, 43 43 }, 44 44 { 45 45 .cfg = { 46 - .id = V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION, 46 + .id = V4L2_CID_STATELESS_MPEG2_QUANTISATION, 47 47 }, 48 48 .codec = CEDRUS_CODEC_MPEG2, 49 49 },
+3 -3
drivers/staging/media/sunxi/cedrus/cedrus_dec.c
··· 41 41 switch (ctx->src_fmt.pixelformat) { 42 42 case V4L2_PIX_FMT_MPEG2_SLICE: 43 43 run.mpeg2.sequence = cedrus_find_control_data(ctx, 44 - V4L2_CID_MPEG_VIDEO_MPEG2_SEQUENCE); 44 + V4L2_CID_STATELESS_MPEG2_SEQUENCE); 45 45 run.mpeg2.picture = cedrus_find_control_data(ctx, 46 - V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE); 46 + V4L2_CID_STATELESS_MPEG2_PICTURE); 47 47 run.mpeg2.quantisation = cedrus_find_control_data(ctx, 48 - V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION); 48 + V4L2_CID_STATELESS_MPEG2_QUANTISATION); 49 49 break; 50 50 51 51 case V4L2_PIX_FMT_H264_SLICE:
-126
include/media/mpeg2-ctrls.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * These are the MPEG2 state controls for use with stateless MPEG-2 4 - * codec drivers. 5 - * 6 - * It turns out that these structs are not stable yet and will undergo 7 - * more changes. So keep them private until they are stable and ready to 8 - * become part of the official public API. 9 - */ 10 - 11 - #ifndef _MPEG2_CTRLS_H_ 12 - #define _MPEG2_CTRLS_H_ 13 - 14 - #define V4L2_CID_MPEG_VIDEO_MPEG2_QUANTISATION (V4L2_CID_CODEC_BASE+251) 15 - #define V4L2_CID_MPEG_VIDEO_MPEG2_SEQUENCE (V4L2_CID_CODEC_BASE+252) 16 - #define V4L2_CID_MPEG_VIDEO_MPEG2_PICTURE (V4L2_CID_CODEC_BASE+253) 17 - 18 - /* enum v4l2_ctrl_type type values */ 19 - #define V4L2_MPEG2_SEQ_FLAG_PROGRESSIVE 0x01 20 - 21 - /** 22 - * struct v4l2_ctrl_mpeg2_sequence - MPEG-2 sequence header 23 - * 24 - * All the members on this structure match the sequence header and sequence 25 - * extension syntaxes as specified by the MPEG-2 specification. 26 - * 27 - * Fields horizontal_size, vertical_size and vbv_buffer_size are a 28 - * combination of respective _value and extension syntax elements, 29 - * as described in section 6.3.3 "Sequence header". 30 - * 31 - * @horizontal_size: combination of elements horizontal_size_value and 32 - * horizontal_size_extension. 33 - * @vertical_size: combination of elements vertical_size_value and 34 - * vertical_size_extension. 35 - * @vbv_buffer_size: combination of elements vbv_buffer_size_value and 36 - * vbv_buffer_size_extension. 37 - * @profile_and_level_indication: see MPEG-2 specification. 38 - * @chroma_format: see MPEG-2 specification. 39 - * @flags: see V4L2_MPEG2_SEQ_FLAG_{}. 40 - */ 41 - struct v4l2_ctrl_mpeg2_sequence { 42 - __u16 horizontal_size; 43 - __u16 vertical_size; 44 - __u32 vbv_buffer_size; 45 - __u16 profile_and_level_indication; 46 - __u8 chroma_format; 47 - __u8 flags; 48 - }; 49 - 50 - #define V4L2_MPEG2_PIC_CODING_TYPE_I 1 51 - #define V4L2_MPEG2_PIC_CODING_TYPE_P 2 52 - #define V4L2_MPEG2_PIC_CODING_TYPE_B 3 53 - #define V4L2_MPEG2_PIC_CODING_TYPE_D 4 54 - 55 - #define V4L2_MPEG2_PIC_TOP_FIELD 0x1 56 - #define V4L2_MPEG2_PIC_BOTTOM_FIELD 0x2 57 - #define V4L2_MPEG2_PIC_FRAME 0x3 58 - 59 - #define V4L2_MPEG2_PIC_FLAG_TOP_FIELD_FIRST 0x0001 60 - #define V4L2_MPEG2_PIC_FLAG_FRAME_PRED_DCT 0x0002 61 - #define V4L2_MPEG2_PIC_FLAG_CONCEALMENT_MV 0x0004 62 - #define V4L2_MPEG2_PIC_FLAG_Q_SCALE_TYPE 0x0008 63 - #define V4L2_MPEG2_PIC_FLAG_INTRA_VLC 0x0010 64 - #define V4L2_MPEG2_PIC_FLAG_ALT_SCAN 0x0020 65 - #define V4L2_MPEG2_PIC_FLAG_REPEAT_FIRST 0x0040 66 - #define V4L2_MPEG2_PIC_FLAG_PROGRESSIVE 0x0080 67 - 68 - /** 69 - * struct v4l2_ctrl_mpeg2_picture - MPEG-2 picture header 70 - * 71 - * All the members on this structure match the picture header and picture 72 - * coding extension syntaxes as specified by the MPEG-2 specification. 73 - * 74 - * @backward_ref_ts: timestamp of the V4L2 capture buffer to use as 75 - * reference for backward prediction. 76 - * @forward_ref_ts: timestamp of the V4L2 capture buffer to use as 77 - * reference for forward prediction. These timestamp refers to the 78 - * timestamp field in struct v4l2_buffer. Use v4l2_timeval_to_ns() 79 - * to convert the struct timeval to a __u64. 80 - * @flags: see V4L2_MPEG2_PIC_FLAG_{}. 81 - * @f_code[2][2]: see MPEG-2 specification. 82 - * @picture_coding_type: see MPEG-2 specification. 83 - * @picture_structure: see V4L2_MPEG2_PIC_{}_FIELD. 84 - * @intra_dc_precision: see MPEG-2 specification. 85 - * @reserved: padding field. Should be zeroed by applications. 86 - */ 87 - struct v4l2_ctrl_mpeg2_picture { 88 - __u64 backward_ref_ts; 89 - __u64 forward_ref_ts; 90 - __u32 flags; 91 - __u8 f_code[2][2]; 92 - __u8 picture_coding_type; 93 - __u8 picture_structure; 94 - __u8 intra_dc_precision; 95 - __u8 reserved[5]; 96 - }; 97 - 98 - /** 99 - * struct v4l2_ctrl_mpeg2_quantisation - MPEG-2 quantisation 100 - * 101 - * Quantization matrices as specified by section 6.3.7 102 - * "Quant matrix extension". 103 - * 104 - * @intra_quantiser_matrix: The quantisation matrix coefficients 105 - * for intra-coded frames, in zigzag scanning order. It is relevant 106 - * for both luma and chroma components, although it can be superseded 107 - * by the chroma-specific matrix for non-4:2:0 YUV formats. 108 - * @non_intra_quantiser_matrix: The quantisation matrix coefficients 109 - * for non-intra-coded frames, in zigzag scanning order. It is relevant 110 - * for both luma and chroma components, although it can be superseded 111 - * by the chroma-specific matrix for non-4:2:0 YUV formats. 112 - * @chroma_intra_quantiser_matrix: The quantisation matrix coefficients 113 - * for the chominance component of intra-coded frames, in zigzag scanning 114 - * order. Only relevant for 4:2:2 and 4:4:4 YUV formats. 115 - * @chroma_non_intra_quantiser_matrix: The quantisation matrix coefficients 116 - * for the chrominance component of non-intra-coded frames, in zigzag scanning 117 - * order. Only relevant for 4:2:2 and 4:4:4 YUV formats. 118 - */ 119 - struct v4l2_ctrl_mpeg2_quantisation { 120 - __u8 intra_quantiser_matrix[64]; 121 - __u8 non_intra_quantiser_matrix[64]; 122 - __u8 chroma_intra_quantiser_matrix[64]; 123 - __u8 chroma_non_intra_quantiser_matrix[64]; 124 - }; 125 - 126 - #endif
-1
include/media/v4l2-ctrls.h
··· 17 17 * Include the stateless codec compound control definitions. 18 18 * This will move to the public headers once this API is fully stable. 19 19 */ 20 - #include <media/mpeg2-ctrls.h> 21 20 #include <media/hevc-ctrls.h> 22 21 23 22 /* forward references */
+112
include/uapi/linux/v4l2-controls.h
··· 1862 1862 __u64 flags; 1863 1863 }; 1864 1864 1865 + /* Stateless MPEG-2 controls */ 1866 + 1867 + #define V4L2_MPEG2_SEQ_FLAG_PROGRESSIVE 0x01 1868 + 1869 + #define V4L2_CID_STATELESS_MPEG2_SEQUENCE (V4L2_CID_CODEC_STATELESS_BASE+220) 1870 + /** 1871 + * struct v4l2_ctrl_mpeg2_sequence - MPEG-2 sequence header 1872 + * 1873 + * All the members on this structure match the sequence header and sequence 1874 + * extension syntaxes as specified by the MPEG-2 specification. 1875 + * 1876 + * Fields horizontal_size, vertical_size and vbv_buffer_size are a 1877 + * combination of respective _value and extension syntax elements, 1878 + * as described in section 6.3.3 "Sequence header". 1879 + * 1880 + * @horizontal_size: combination of elements horizontal_size_value and 1881 + * horizontal_size_extension. 1882 + * @vertical_size: combination of elements vertical_size_value and 1883 + * vertical_size_extension. 1884 + * @vbv_buffer_size: combination of elements vbv_buffer_size_value and 1885 + * vbv_buffer_size_extension. 1886 + * @profile_and_level_indication: see MPEG-2 specification. 1887 + * @chroma_format: see MPEG-2 specification. 1888 + * @flags: see V4L2_MPEG2_SEQ_FLAG_{}. 1889 + */ 1890 + struct v4l2_ctrl_mpeg2_sequence { 1891 + __u16 horizontal_size; 1892 + __u16 vertical_size; 1893 + __u32 vbv_buffer_size; 1894 + __u16 profile_and_level_indication; 1895 + __u8 chroma_format; 1896 + __u8 flags; 1897 + }; 1898 + 1899 + #define V4L2_MPEG2_PIC_CODING_TYPE_I 1 1900 + #define V4L2_MPEG2_PIC_CODING_TYPE_P 2 1901 + #define V4L2_MPEG2_PIC_CODING_TYPE_B 3 1902 + #define V4L2_MPEG2_PIC_CODING_TYPE_D 4 1903 + 1904 + #define V4L2_MPEG2_PIC_TOP_FIELD 0x1 1905 + #define V4L2_MPEG2_PIC_BOTTOM_FIELD 0x2 1906 + #define V4L2_MPEG2_PIC_FRAME 0x3 1907 + 1908 + #define V4L2_MPEG2_PIC_FLAG_TOP_FIELD_FIRST 0x0001 1909 + #define V4L2_MPEG2_PIC_FLAG_FRAME_PRED_DCT 0x0002 1910 + #define V4L2_MPEG2_PIC_FLAG_CONCEALMENT_MV 0x0004 1911 + #define V4L2_MPEG2_PIC_FLAG_Q_SCALE_TYPE 0x0008 1912 + #define V4L2_MPEG2_PIC_FLAG_INTRA_VLC 0x0010 1913 + #define V4L2_MPEG2_PIC_FLAG_ALT_SCAN 0x0020 1914 + #define V4L2_MPEG2_PIC_FLAG_REPEAT_FIRST 0x0040 1915 + #define V4L2_MPEG2_PIC_FLAG_PROGRESSIVE 0x0080 1916 + 1917 + #define V4L2_CID_STATELESS_MPEG2_PICTURE (V4L2_CID_CODEC_STATELESS_BASE+221) 1918 + /** 1919 + * struct v4l2_ctrl_mpeg2_picture - MPEG-2 picture header 1920 + * 1921 + * All the members on this structure match the picture header and picture 1922 + * coding extension syntaxes as specified by the MPEG-2 specification. 1923 + * 1924 + * @backward_ref_ts: timestamp of the V4L2 capture buffer to use as 1925 + * reference for backward prediction. 1926 + * @forward_ref_ts: timestamp of the V4L2 capture buffer to use as 1927 + * reference for forward prediction. These timestamp refers to the 1928 + * timestamp field in struct v4l2_buffer. Use v4l2_timeval_to_ns() 1929 + * to convert the struct timeval to a __u64. 1930 + * @flags: see V4L2_MPEG2_PIC_FLAG_{}. 1931 + * @f_code: see MPEG-2 specification. 1932 + * @picture_coding_type: see MPEG-2 specification. 1933 + * @picture_structure: see V4L2_MPEG2_PIC_{}_FIELD. 1934 + * @intra_dc_precision: see MPEG-2 specification. 1935 + * @reserved: padding field. Should be zeroed by applications. 1936 + */ 1937 + struct v4l2_ctrl_mpeg2_picture { 1938 + __u64 backward_ref_ts; 1939 + __u64 forward_ref_ts; 1940 + __u32 flags; 1941 + __u8 f_code[2][2]; 1942 + __u8 picture_coding_type; 1943 + __u8 picture_structure; 1944 + __u8 intra_dc_precision; 1945 + __u8 reserved[5]; 1946 + }; 1947 + 1948 + #define V4L2_CID_STATELESS_MPEG2_QUANTISATION (V4L2_CID_CODEC_STATELESS_BASE+222) 1949 + /** 1950 + * struct v4l2_ctrl_mpeg2_quantisation - MPEG-2 quantisation 1951 + * 1952 + * Quantisation matrices as specified by section 6.3.7 1953 + * "Quant matrix extension". 1954 + * 1955 + * @intra_quantiser_matrix: The quantisation matrix coefficients 1956 + * for intra-coded frames, in zigzag scanning order. It is relevant 1957 + * for both luma and chroma components, although it can be superseded 1958 + * by the chroma-specific matrix for non-4:2:0 YUV formats. 1959 + * @non_intra_quantiser_matrix: The quantisation matrix coefficients 1960 + * for non-intra-coded frames, in zigzag scanning order. It is relevant 1961 + * for both luma and chroma components, although it can be superseded 1962 + * by the chroma-specific matrix for non-4:2:0 YUV formats. 1963 + * @chroma_intra_quantiser_matrix: The quantisation matrix coefficients 1964 + * for the chominance component of intra-coded frames, in zigzag scanning 1965 + * order. Only relevant for 4:2:2 and 4:4:4 YUV formats. 1966 + * @chroma_non_intra_quantiser_matrix: The quantisation matrix coefficients 1967 + * for the chrominance component of non-intra-coded frames, in zigzag scanning 1968 + * order. Only relevant for 4:2:2 and 4:4:4 YUV formats. 1969 + */ 1970 + struct v4l2_ctrl_mpeg2_quantisation { 1971 + __u8 intra_quantiser_matrix[64]; 1972 + __u8 non_intra_quantiser_matrix[64]; 1973 + __u8 chroma_intra_quantiser_matrix[64]; 1974 + __u8 chroma_non_intra_quantiser_matrix[64]; 1975 + }; 1976 + 1865 1977 #define V4L2_CID_COLORIMETRY_CLASS_BASE (V4L2_CTRL_CLASS_COLORIMETRY | 0x900) 1866 1978 #define V4L2_CID_COLORIMETRY_CLASS (V4L2_CTRL_CLASS_COLORIMETRY | 1) 1867 1979
+3
include/uapi/linux/videodev2.h
··· 1747 1747 struct v4l2_ctrl_h264_decode_params __user *p_h264_decode_params; 1748 1748 struct v4l2_ctrl_fwht_params __user *p_fwht_params; 1749 1749 struct v4l2_ctrl_vp8_frame __user *p_vp8_frame; 1750 + struct v4l2_ctrl_mpeg2_sequence __user *p_mpeg2_sequence; 1751 + struct v4l2_ctrl_mpeg2_picture __user *p_mpeg2_picture; 1752 + struct v4l2_ctrl_mpeg2_quantisation __user *p_mpeg2_quantisation; 1750 1753 void __user *ptr; 1751 1754 }; 1752 1755 } __attribute__ ((packed));