FFmpeg/tests/ref/lavf
Ramiro Polla 384fe39623 swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats
There is an issue with the constants used in YUV to YUV range conversion,
where the upper bound is not respected when converting to mpeg range.

With this commit, the constants are calculated at runtime, depending on
the bit depth. This approach also allows us to more easily understand how
the constants are derived.

For bit depths <= 14, the number of fixed point bits has been set to 14
for all conversions, to simplify the code.
For bit depths > 14, the number of fixed points bits has been raised and
set to 18, to allow for the conversion to be accurate enough for the mpeg
range to be respected.

The convert functions now take the conversion constants (coeff and offset)
as function arguments.
For bit depths <= 14, coeff is unsigned 16-bit and offset is 32-bit.
For bit depths > 14, coeff is unsigned 32-bit and offset is 64-bit.

x86_64:
chrRangeFromJpeg8_1920_c:    2127.4   2125.0  (1.00x)
chrRangeFromJpeg16_1920_c:   2325.2   2127.2  (1.09x)
chrRangeToJpeg8_1920_c:      3166.9   3168.7  (1.00x)
chrRangeToJpeg16_1920_c:     2152.4   3164.8  (0.68x)
lumRangeFromJpeg8_1920_c:    1263.0   1302.5  (0.97x)
lumRangeFromJpeg16_1920_c:   1080.5   1299.2  (0.83x)
lumRangeToJpeg8_1920_c:      1886.8   2112.2  (0.89x)
lumRangeToJpeg16_1920_c:     1077.0   1906.5  (0.56x)

aarch64 A55:
chrRangeFromJpeg8_1920_c:   28835.2  28835.6  (1.00x)
chrRangeFromJpeg16_1920_c:  28839.8  32680.8  (0.88x)
chrRangeToJpeg8_1920_c:     23074.7  23075.4  (1.00x)
chrRangeToJpeg16_1920_c:    17318.9  24996.0  (0.69x)
lumRangeFromJpeg8_1920_c:   15389.7  15384.5  (1.00x)
lumRangeFromJpeg16_1920_c:  15388.2  17306.7  (0.89x)
lumRangeToJpeg8_1920_c:     19227.8  19226.6  (1.00x)
lumRangeToJpeg16_1920_c:    15387.0  21146.3  (0.73x)

aarch64 A76:
chrRangeFromJpeg8_1920_c:    6324.4   6268.1  (1.01x)
chrRangeFromJpeg16_1920_c:   6339.9  11521.5  (0.55x)
chrRangeToJpeg8_1920_c:      9656.0   9612.8  (1.00x)
chrRangeToJpeg16_1920_c:     6340.4  11651.8  (0.54x)
lumRangeFromJpeg8_1920_c:    4422.0   4420.8  (1.00x)
lumRangeFromJpeg16_1920_c:   4420.9   5762.0  (0.77x)
lumRangeToJpeg8_1920_c:      5949.1   5977.5  (1.00x)
lumRangeToJpeg16_1920_c:     4446.8   5946.2  (0.75x)

NOTE: all simd optimizations for range_convert have been disabled.
      they will be re-enabled when they are fixed for each architecture.

NOTE2: the same issue still exists in rgb2yuv conversions, which is not
       addressed in this commit.
2024-12-05 21:10:29 +01:00
..
aiff fate/lavf-audio: Test writing AIFF-native tags 2024-03-17 16:08:13 +01:00
al
apng Revert "tests/fate: disable compression for zlib-based codecs" 2024-10-16 17:38:57 -03:00
apng.png Revert "tests/fate: disable compression for zlib-based codecs" 2024-10-16 17:38:57 -03:00
asf fftools/ffmpeg: propagate frame durations to packets when encoding 2023-04-19 21:12:03 +02:00
ast avformat/pcm: decrease target audio frame per sec to 10 2024-03-16 19:19:42 +01:00
au
avi
bmp tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
caf
dfpwm fate/lavf-audio: Add dfpwm test 2022-09-18 17:48:52 +02:00
dpx tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
dv
dv_ntsc fftools/ffmpeg_enc: do not round frame durations prematurely 2023-10-03 16:57:02 +02:00
dv_pal
flm
flv
gbrap.fits
gbrap16be.fits
gbrp.fits
gbrp10le.dpx tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
gbrp12le.dpx tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
gbrp16be.fits
gbrpf32be.pfm avcodec/pnm: avoid mirroring PFM images vertically 2022-12-27 10:41:25 -03:00
gbrpf32le.pfm avcodec/pnm: avoid mirroring PFM images vertically 2022-12-27 10:41:25 -03:00
gif tests/fate: fix mismatches between requested and actually used pixel formats 2023-07-20 20:30:13 +02:00
gray.fits
gray.pam tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
gray.xwd tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
gray16be.fits swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats 2024-12-05 21:10:29 +01:00
gray16be.pam swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats 2024-12-05 21:10:29 +01:00
gray16be.png swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats 2024-12-05 21:10:29 +01:00
grayf32be.pfm avcodec/pnm: avoid mirroring PFM images vertically 2022-12-27 10:41:25 -03:00
grayf32le.pfm avcodec/pnm: avoid mirroring PFM images vertically 2022-12-27 10:41:25 -03:00
gxf
gxf_ntsc fftools/ffmpeg_enc: do not round frame durations prematurely 2023-10-03 16:57:02 +02:00
gxf_pal
ircam
ismv fftools/ffmpeg_enc: do not round frame durations prematurely 2023-10-03 16:57:02 +02:00
jpg swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats 2024-12-05 21:10:29 +01:00
mka avformat/matroskaenc: Write default duration for audio 2023-10-02 12:22:20 +02:00
mkv avcodec/pnm: explicitly tag color range 2023-11-09 12:53:35 +01:00
mkv_attachment avcodec/pnm: explicitly tag color range 2023-11-09 12:53:35 +01:00
mmf
monob.pam tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
monow.xwd tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
mov avformat/pcm: decrease target audio frame per sec to 10 2024-03-16 19:19:42 +01:00
mov_hybrid_frag movenc: Add an option for resilient, hybrid fragmented/non-fragmented muxing 2024-06-24 11:24:04 +03:00
mov_rtphint avformat/pcm: decrease target audio frame per sec to 10 2024-03-16 19:19:42 +01:00
mp4 fftools/ffmpeg_enc: do not round frame durations prematurely 2023-10-03 16:57:02 +02:00
mpg fftools/ffmpeg_enc: do not round frame durations prematurely 2023-10-03 16:57:02 +02:00
mxf avcodec/pnm: explicitly tag color range 2023-11-09 12:53:35 +01:00
mxf_d10 fftools/ffmpeg_enc: apply -top to individual encoded frames 2023-09-18 17:15:53 +02:00
mxf_dv25 lavc/dv: remove ff_dvvideo_init() 2022-09-05 08:02:28 +02:00
mxf_dvcpro50
mxf_dvcpro100 avformat/mxfenc: fix stored/sampled/displayed width/height 2023-03-26 22:04:44 +02:00
mxf_ffv1 avformat/mxfenc: SMPTE RDD 48:2018 Amd 1:2022 support 2023-03-25 19:28:36 +01:00
mxf_opatom avformat/mxfenc: fix stored/sampled/displayed width/height 2023-03-26 22:04:44 +02:00
mxf_opatom_audio
none.gbrapf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
none.gbrpf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
none.grayf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
nut
ogg avformat/oggenc: don't flush twice when the last packet is side data only 2023-01-03 21:35:03 -03:00
pam tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
pbmpipe
pcx tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
peak.wav
peak_only.wav
pgm tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
pgmpipe
png Revert "tests/fate: disable compression for zlib-based codecs" 2024-10-16 17:38:57 -03:00
ppm tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
ppmpipe
qoi tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
qoipipe fate: add QOI/XBM/XWD image2pipe tests 2022-12-03 19:38:11 +01:00
rgb4_byte.xwd tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
rgb8.xwd tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
rgb48be.pam tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
rgb48be.png Revert "tests/fate: disable compression for zlib-based codecs" 2024-10-16 17:38:57 -03:00
rgb48le.dpx tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
rgb48le_10.dpx tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
rgb555be.xwd tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
rgb565be.xwd tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
rgba.pam tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
rgba.xwd tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
rgba64le.dpx tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
rle.gbrapf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
rle.gbrpf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
rle.grayf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
rm ac3: convert to lavu/tx 2022-11-06 14:39:27 +01:00
rso
s16.voc avformat/pcm: decrease target audio frame per sec to 10 2024-03-16 19:19:42 +01:00
sgi avcodec/sgidec: Use planar pixel formats 2022-10-05 14:38:51 +02:00
smjpeg swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats 2024-12-05 21:10:29 +01:00
sox
sun tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
swf
tga tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
tiff tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
ts
tta
ul
voc avformat/pcm: decrease target audio frame per sec to 10 2024-03-16 19:19:42 +01:00
w64
wav
wbmp avcodec: WBMP (Wireless Application Protocol Bitmap) image format 2022-08-07 19:18:18 +10:00
wtv
wv
xbm tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
xbmpipe fate: add QOI/XBM/XWD image2pipe tests 2022-12-03 19:38:11 +01:00
xwd tests/fate-run: Allow to skip file checksums for lavf_image 2022-08-02 02:27:05 +02:00
xwdpipe fate: add QOI/XBM/XWD image2pipe tests 2022-12-03 19:38:11 +01:00
y4m avcodec/pnm: explicitly tag color range 2023-11-09 12:53:35 +01:00
zip1.gbrapf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
zip1.gbrpf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
zip1.grayf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
zip16.gbrapf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
zip16.gbrpf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00
zip16.grayf32le.exr fate/lavf-image: Disable file checksums for exr tests 2022-08-02 02:30:26 +02:00