[FFmpeg-devel] [PATCH v3 0/7] swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats

Ramiro Polla ramiro.polla at gmail.com
Sat Nov 30 17:23:35 EET 2024


Changes since v2:
- changed the type of some ints to better represent their signedness and range
  (no changes in performance, but it makes the code clearer);
- added more comments about the integer types for coeff and offset depending
  on SwsInternal->dstBpc;
- reordered new fields in SwsInternal to avoid holes;

Ramiro Polla (7):
  swscale/range_convert: saturate output instead of limiting input
  swscale/aarch64/range_convert: saturate output instead of limiting
    input
  swscale/range_convert: fix mpeg ranges in yuv range conversion for
    non-8-bit pixel formats
  swscale/x86/range_convert: update sse2 and avx2 range_convert
    functions to new API
  swscale/x86: add sse2, sse4, and avx2 {lum,chr}ConvertRange16
  swscale/aarch64/range_convert: update neon range_convert functions to
    new API
  swscale/aarch64: add neon {lum,chr}ConvertRange16

 libswscale/aarch64/range_convert_neon.S       | 152 ++++++++++----
 libswscale/aarch64/swscale.c                  |  36 +++-
 libswscale/hscale.c                           |   6 +-
 libswscale/loongarch/swscale_init_loongarch.c |   5 +
 libswscale/riscv/swscale.c                    |   5 +
 libswscale/swscale.c                          | 122 ++++++++++--
 libswscale/swscale_internal.h                 |  26 ++-
 libswscale/x86/range_convert.asm              | 161 ++++++++++-----
 libswscale/x86/swscale.c                      |  50 ++++-
 tests/checkasm/sw_range_convert.c             |  74 ++++++-
 .../fate/filter-alphaextract_alphamerge_rgb   | 100 +++++-----
 tests/ref/fate/filter-pixdesc-gray10be        |   2 +-
 tests/ref/fate/filter-pixdesc-gray10le        |   2 +-
 tests/ref/fate/filter-pixdesc-gray12be        |   2 +-
 tests/ref/fate/filter-pixdesc-gray12le        |   2 +-
 tests/ref/fate/filter-pixdesc-gray14be        |   2 +-
 tests/ref/fate/filter-pixdesc-gray14le        |   2 +-
 tests/ref/fate/filter-pixdesc-gray16be        |   2 +-
 tests/ref/fate/filter-pixdesc-gray16le        |   2 +-
 tests/ref/fate/filter-pixdesc-gray9be         |   2 +-
 tests/ref/fate/filter-pixdesc-gray9le         |   2 +-
 tests/ref/fate/filter-pixdesc-ya16be          |   2 +-
 tests/ref/fate/filter-pixdesc-ya16le          |   2 +-
 tests/ref/fate/filter-pixdesc-yuvj411p        |   2 +-
 tests/ref/fate/filter-pixdesc-yuvj420p        |   2 +-
 tests/ref/fate/filter-pixdesc-yuvj422p        |   2 +-
 tests/ref/fate/filter-pixdesc-yuvj440p        |   2 +-
 tests/ref/fate/filter-pixdesc-yuvj444p        |   2 +-
 tests/ref/fate/filter-pixfmts-copy            |  34 ++--
 tests/ref/fate/filter-pixfmts-crop            |  34 ++--
 tests/ref/fate/filter-pixfmts-field           |  34 ++--
 tests/ref/fate/filter-pixfmts-fieldorder      |  30 +--
 tests/ref/fate/filter-pixfmts-hflip           |  34 ++--
 tests/ref/fate/filter-pixfmts-il              |  34 ++--
 tests/ref/fate/filter-pixfmts-lut             |  18 +-
 tests/ref/fate/filter-pixfmts-null            |  34 ++--
 tests/ref/fate/filter-pixfmts-pad             |  22 +--
 tests/ref/fate/filter-pixfmts-pullup          |  10 +-
 tests/ref/fate/filter-pixfmts-rotate          |   4 +-
 tests/ref/fate/filter-pixfmts-scale           |  34 ++--
 tests/ref/fate/filter-pixfmts-swapuv          |  10 +-
 .../ref/fate/filter-pixfmts-tinterlace_cvlpf  |   8 +-
 .../ref/fate/filter-pixfmts-tinterlace_merge  |   8 +-
 tests/ref/fate/filter-pixfmts-tinterlace_pad  |   8 +-
 tests/ref/fate/filter-pixfmts-tinterlace_vlpf |   8 +-
 tests/ref/fate/filter-pixfmts-transpose       |  28 +--
 tests/ref/fate/filter-pixfmts-vflip           |  34 ++--
 tests/ref/fate/fitsenc-gray                   |   2 +-
 tests/ref/fate/fitsenc-gray16be               |  10 +-
 tests/ref/fate/gifenc-gray                    | 186 +++++++++---------
 tests/ref/fate/idroq-video-encode             |   2 +-
 tests/ref/fate/jpg-icc                        |   8 +-
 tests/ref/fate/sws-yuv-colorspace             |   2 +-
 tests/ref/fate/sws-yuv-range                  |   2 +-
 tests/ref/fate/vvc-conformance-SCALING_A_1    | 128 ++++++------
 tests/ref/lavf/gray16be.fits                  |   4 +-
 tests/ref/lavf/gray16be.pam                   |   4 +-
 tests/ref/lavf/gray16be.png                   |   6 +-
 tests/ref/lavf/jpg                            |   6 +-
 tests/ref/lavf/smjpeg                         |   6 +-
 tests/ref/pixfmt/gbrp-gray                    |   2 +-
 tests/ref/pixfmt/gbrp-gray10be                |   2 +-
 tests/ref/pixfmt/gbrp-gray10le                |   2 +-
 tests/ref/pixfmt/gbrp-gray12be                |   2 +-
 tests/ref/pixfmt/gbrp-gray12le                |   2 +-
 tests/ref/pixfmt/gbrp-gray16be                |   2 +-
 tests/ref/pixfmt/gbrp-gray16le                |   2 +-
 tests/ref/pixfmt/gbrp-yuvj420p                |   2 +-
 tests/ref/pixfmt/gbrp-yuvj422p                |   2 +-
 tests/ref/pixfmt/gbrp-yuvj440p                |   2 +-
 tests/ref/pixfmt/gbrp-yuvj444p                |   2 +-
 tests/ref/pixfmt/gbrp10-gray                  |   2 +-
 tests/ref/pixfmt/gbrp10-gray10be              |   2 +-
 tests/ref/pixfmt/gbrp10-gray10le              |   2 +-
 tests/ref/pixfmt/gbrp10-gray12be              |   2 +-
 tests/ref/pixfmt/gbrp10-gray12le              |   2 +-
 tests/ref/pixfmt/gbrp10-gray16be              |   2 +-
 tests/ref/pixfmt/gbrp10-gray16le              |   2 +-
 tests/ref/pixfmt/gbrp10-yuvj420p              |   2 +-
 tests/ref/pixfmt/gbrp10-yuvj422p              |   2 +-
 tests/ref/pixfmt/gbrp10-yuvj440p              |   2 +-
 tests/ref/pixfmt/gbrp10-yuvj444p              |   2 +-
 tests/ref/pixfmt/gbrp12-gray                  |   2 +-
 tests/ref/pixfmt/gbrp12-gray10be              |   2 +-
 tests/ref/pixfmt/gbrp12-gray10le              |   2 +-
 tests/ref/pixfmt/gbrp12-gray12be              |   2 +-
 tests/ref/pixfmt/gbrp12-gray12le              |   2 +-
 tests/ref/pixfmt/gbrp12-gray16be              |   2 +-
 tests/ref/pixfmt/gbrp12-gray16le              |   2 +-
 tests/ref/pixfmt/gbrp12-yuvj420p              |   2 +-
 tests/ref/pixfmt/gbrp12-yuvj422p              |   2 +-
 tests/ref/pixfmt/gbrp12-yuvj440p              |   2 +-
 tests/ref/pixfmt/gbrp12-yuvj444p              |   2 +-
 tests/ref/pixfmt/gbrp16-gray16be              |   2 +-
 tests/ref/pixfmt/gbrp16-gray16le              |   2 +-
 tests/ref/pixfmt/rgb24-gray                   |   2 +-
 tests/ref/pixfmt/rgb24-gray10be               |   2 +-
 tests/ref/pixfmt/rgb24-gray10le               |   2 +-
 tests/ref/pixfmt/rgb24-gray12be               |   2 +-
 tests/ref/pixfmt/rgb24-gray12le               |   2 +-
 tests/ref/pixfmt/rgb24-gray16be               |   2 +-
 tests/ref/pixfmt/rgb24-gray16le               |   2 +-
 tests/ref/pixfmt/rgb24-yuvj420p               |   2 +-
 tests/ref/pixfmt/rgb24-yuvj422p               |   2 +-
 tests/ref/pixfmt/rgb24-yuvj440p               |   2 +-
 tests/ref/pixfmt/rgb24-yuvj444p               |   2 +-
 tests/ref/pixfmt/rgb48-gray                   |   2 +-
 tests/ref/pixfmt/rgb48-gray10be               |   2 +-
 tests/ref/pixfmt/rgb48-gray10le               |   2 +-
 tests/ref/pixfmt/rgb48-gray12be               |   2 +-
 tests/ref/pixfmt/rgb48-gray12le               |   2 +-
 tests/ref/pixfmt/rgb48-gray16be               |   2 +-
 tests/ref/pixfmt/rgb48-gray16le               |   2 +-
 tests/ref/pixfmt/rgb48-yuvj420p               |   2 +-
 tests/ref/pixfmt/rgb48-yuvj422p               |   2 +-
 tests/ref/pixfmt/rgb48-yuvj440p               |   2 +-
 tests/ref/pixfmt/rgb48-yuvj444p               |   2 +-
 tests/ref/pixfmt/yuv444p-gray10be             |   2 +-
 tests/ref/pixfmt/yuv444p-gray10le             |   2 +-
 tests/ref/pixfmt/yuv444p-gray12be             |   2 +-
 tests/ref/pixfmt/yuv444p-gray12le             |   2 +-
 tests/ref/pixfmt/yuv444p-gray16be             |   2 +-
 tests/ref/pixfmt/yuv444p-gray16le             |   2 +-
 tests/ref/pixfmt/yuv444p-yuvj420p             |   2 +-
 tests/ref/pixfmt/yuv444p-yuvj422p             |   2 +-
 tests/ref/pixfmt/yuv444p-yuvj440p             |   2 +-
 tests/ref/pixfmt/yuv444p10-gray               |   2 +-
 tests/ref/pixfmt/yuv444p10-gray10be           |   2 +-
 tests/ref/pixfmt/yuv444p10-gray10le           |   2 +-
 tests/ref/pixfmt/yuv444p10-gray12be           |   2 +-
 tests/ref/pixfmt/yuv444p10-gray12le           |   2 +-
 tests/ref/pixfmt/yuv444p10-gray16be           |   2 +-
 tests/ref/pixfmt/yuv444p10-gray16le           |   2 +-
 tests/ref/pixfmt/yuv444p10-yuvj420p           |   2 +-
 tests/ref/pixfmt/yuv444p10-yuvj422p           |   2 +-
 tests/ref/pixfmt/yuv444p10-yuvj440p           |   2 +-
 tests/ref/pixfmt/yuv444p10-yuvj444p           |   2 +-
 tests/ref/pixfmt/yuv444p12-gray               |   2 +-
 tests/ref/pixfmt/yuv444p12-gray10be           |   2 +-
 tests/ref/pixfmt/yuv444p12-gray10le           |   2 +-
 tests/ref/pixfmt/yuv444p12-gray12be           |   2 +-
 tests/ref/pixfmt/yuv444p12-gray12le           |   2 +-
 tests/ref/pixfmt/yuv444p12-gray16be           |   2 +-
 tests/ref/pixfmt/yuv444p12-gray16le           |   2 +-
 tests/ref/pixfmt/yuv444p12-yuvj420p           |   2 +-
 tests/ref/pixfmt/yuv444p12-yuvj422p           |   2 +-
 tests/ref/pixfmt/yuv444p12-yuvj440p           |   2 +-
 tests/ref/pixfmt/yuv444p12-yuvj444p           |   2 +-
 tests/ref/pixfmt/yuv444p16-gray16be           |   2 +-
 tests/ref/pixfmt/yuv444p16-gray16le           |   2 +-
 tests/ref/pixfmt/yuvj420p                     |   2 +-
 tests/ref/pixfmt/yuvj422p                     |   2 +-
 tests/ref/pixfmt/yuvj440p                     |   2 +-
 tests/ref/pixfmt/yuvj444p                     |   2 +-
 tests/ref/seek/lavf-jpg                       |   8 +-
 tests/ref/seek/vsynth_lena-mjpeg              |  40 ++--
 tests/ref/seek/vsynth_lena-roqvideo           |   2 +-
 tests/ref/vsynth/vsynth1-amv                  |   8 +-
 tests/ref/vsynth/vsynth1-mjpeg                |   6 +-
 tests/ref/vsynth/vsynth1-mjpeg-422            |   6 +-
 tests/ref/vsynth/vsynth1-mjpeg-444            |   6 +-
 tests/ref/vsynth/vsynth1-mjpeg-huffman        |   6 +-
 tests/ref/vsynth/vsynth1-mjpeg-trell          |   8 +-
 tests/ref/vsynth/vsynth1-mjpeg-trell-huffman  |   8 +-
 tests/ref/vsynth/vsynth1-roqvideo             |   8 +-
 tests/ref/vsynth/vsynth2-amv                  |   6 +-
 tests/ref/vsynth/vsynth2-mjpeg                |   6 +-
 tests/ref/vsynth/vsynth2-mjpeg-422            |   6 +-
 tests/ref/vsynth/vsynth2-mjpeg-444            |   6 +-
 tests/ref/vsynth/vsynth2-mjpeg-huffman        |   6 +-
 tests/ref/vsynth/vsynth2-mjpeg-trell          |   8 +-
 tests/ref/vsynth/vsynth2-mjpeg-trell-huffman  |   8 +-
 tests/ref/vsynth/vsynth2-roqvideo             |   8 +-
 tests/ref/vsynth/vsynth3-amv                  |   8 +-
 tests/ref/vsynth/vsynth3-mjpeg                |   8 +-
 tests/ref/vsynth/vsynth3-mjpeg-422            |   8 +-
 tests/ref/vsynth/vsynth3-mjpeg-444            |   6 +-
 tests/ref/vsynth/vsynth3-mjpeg-huffman        |   8 +-
 tests/ref/vsynth/vsynth3-mjpeg-trell          |   6 +-
 tests/ref/vsynth/vsynth3-mjpeg-trell-huffman  |   6 +-
 tests/ref/vsynth/vsynth_lena-amv              |   6 +-
 tests/ref/vsynth/vsynth_lena-mjpeg            |   8 +-
 tests/ref/vsynth/vsynth_lena-mjpeg-422        |   6 +-
 tests/ref/vsynth/vsynth_lena-mjpeg-444        |   6 +-
 tests/ref/vsynth/vsynth_lena-mjpeg-huffman    |   8 +-
 tests/ref/vsynth/vsynth_lena-mjpeg-trell      |   8 +-
 .../vsynth/vsynth_lena-mjpeg-trell-huffman    |   8 +-
 tests/ref/vsynth/vsynth_lena-roqvideo         |   8 +-
 188 files changed, 1193 insertions(+), 826 deletions(-)

-- 
2.39.5



More information about the ffmpeg-devel mailing list