Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116991

QVideoFrame allocation broken for YUV422P

XMLWordPrintable

    • Linux/X11, Windows
    • c62884178 (dev), c16ef0d7e (dev), 80b4e25ac (dev), f41c57bb8 (6.6), 90f614162 (6.6), 8b432542d (6.6), 6f7525359 (6.5), c5afb08ff (6.5), 0a44aaa6c (tqtc/lts-6.5)

      QVideoFrame allocation is broken for pixel format YUV422P. The U & V planes only have quarter width, but they should have half width. See attached test code.

      I think the commit that broke this is https://github.com/qt/qtmultimedia/commit/0a6a1883b6dde64b195a564a0c02a949d7718b25

      See line 116: https://github.com/qt/qtmultimedia/commit/0a6a1883b6dde64b195a564a0c02a949d7718b25#diff-d317360aabc354bbc245ce504feb2ae70ced4592d8a7d4ee465e50bef15973deL116

      where the computation of the total bytes required changes from 2*s.width()*s.height(), which is correct, to stride * ((height * 3 / 2 + 1) & ~1), which is too small and effectively halves the space left for the U & V planes. Line size is then computed based on (total size - y plane size). So I think it's sufficient to fix this computation of the total size.

      Test output:

      -------------------------------------------------------------------------------
      QVideoFrame.plane_sizes
      -------------------------------------------------------------------------------
      utils-qt/tests/qvideoframe.cpp:44
      ...............................................................................

      utils-qt/tests/qvideoframe.cpp:70: FAILED:
        CHECK( av_plane_linesize == qt_plane_linesize )
      with expansion:
        640 (0x280) == 320 (0x140)
      with messages:
        av_pix_fmt=yuv422p
        qt_pix_fmt=YUV422P
        width=1280, height=720
        plane=1

      utils-qt/tests/qvideoframe.cpp:81: FAILED:
        CHECK( av_plane_size == qt_plane_size )
      with expansion:
        460800 (0x70800) == 230400 (0x38400)
      with messages:
        av_pix_fmt=yuv422p
        qt_pix_fmt=YUV422P
        width=1280, height=720
        plane=1

      utils-qt/tests/qvideoframe.cpp:70: FAILED:
        CHECK( av_plane_linesize == qt_plane_linesize )
      with expansion:
        640 (0x280) == 320 (0x140)
      with messages:
        av_pix_fmt=yuv422p
        qt_pix_fmt=YUV422P
        width=1280, height=720
        plane=2

      utils-qt/tests/qvideoframe.cpp:81: FAILED:
        CHECK( av_plane_size == qt_plane_size )
      with expansion:
        460800 (0x70800) == 230400 (0x38400)
      with messages:
        av_pix_fmt=yuv422p
        qt_pix_fmt=YUV422P
        width=1280, height=720
        plane=2

      ===============================================================================
      test cases:   1 |   0 passed | 1 failed
      assertions: 168 | 164 passed | 4 failed

        1. qvideoframe.cpp
          3 kB
          Mika Fischer
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            johanseg Jøger Hansegård
            mika.fischer Mika Fischer
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: