diff mbox series

[FFmpeg-devel,10/14] swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats

Message ID 20240923124017.33659-11-ramiro.polla@gmail.com
State New
Headers show
Series swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed

Commit Message

Ramiro Polla Sept. 23, 2024, 12:40 p.m. UTC
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 (amax, coeff,
and offset) as function arguments.
For bit depths <= 14, amax is 16-bit and offset is 32-bit.
For bit depths > 14, amax is 32-bit and offset is 64-bit.

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

NOTE2: the same issue still exists in rgb2yuv conversions, which is not
       addressed in this commit.
---
 libswscale/aarch64/swscale.c                  |   2 +
 libswscale/hscale.c                           |   8 +-
 libswscale/loongarch/swscale_init_loongarch.c |   2 +
 libswscale/riscv/swscale.c                    |   2 +
 libswscale/swscale.c                          | 109 ++++++++--
 libswscale/swscale_internal.h                 |  12 +-
 libswscale/x86/swscale.c                      |   2 +
 tests/checkasm/sw_range_convert.c             |  80 +++++++-
 .../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/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 +-
 96 files changed, 786 insertions(+), 633 deletions(-)
diff mbox series

Patch

diff --git a/libswscale/aarch64/swscale.c b/libswscale/aarch64/swscale.c
index 653144dbca..21788cad5d 100644
--- a/libswscale/aarch64/swscale.c
+++ b/libswscale/aarch64/swscale.c
@@ -225,6 +225,7 @@  void ff_chrRangeToJpeg_neon(int16_t *dstU, int16_t *dstV, int width);
 
 av_cold void ff_sws_init_range_convert_aarch64(SwsContext *c)
 {
+#if 0
     int cpu_flags = av_get_cpu_flags();
 
     if (have_neon(cpu_flags)) {
@@ -238,6 +239,7 @@  av_cold void ff_sws_init_range_convert_aarch64(SwsContext *c)
             }
         }
     }
+#endif
 }
 
 av_cold void ff_sws_init_swscale_aarch64(SwsContext *c)
diff --git a/libswscale/hscale.c b/libswscale/hscale.c
index 5a949732bf..ec467e5778 100644
--- a/libswscale/hscale.c
+++ b/libswscale/hscale.c
@@ -59,7 +59,9 @@  static int lum_h_scale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int
         }
 
         if (c->lumConvertRange)
-            c->lumConvertRange((int16_t*)dst[dst_pos], dstW);
+            c->lumConvertRange((int16_t*)dst[dst_pos], dstW,
+                               c->lumConvertRange_max,
+                               c->lumConvertRange_coeff, c->lumConvertRange_offset);
 
         desc->dst->plane[0].sliceH += 1;
 
@@ -192,7 +194,9 @@  static int chr_h_scale(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int
         }
 
         if (c->chrConvertRange)
-            c->chrConvertRange((uint16_t*)dst1[dst_pos1+i], (uint16_t*)dst2[dst_pos2+i], dstW);
+            c->chrConvertRange((uint16_t*)dst1[dst_pos1+i], (uint16_t*)dst2[dst_pos2+i], dstW,
+                               c->chrConvertRange_max,
+                               c->chrConvertRange_coeff, c->chrConvertRange_offset);
 
         desc->dst->plane[1].sliceH += 1;
         desc->dst->plane[2].sliceH += 1;
diff --git a/libswscale/loongarch/swscale_init_loongarch.c b/libswscale/loongarch/swscale_init_loongarch.c
index de75ffc6dc..30d5bdeabe 100644
--- a/libswscale/loongarch/swscale_init_loongarch.c
+++ b/libswscale/loongarch/swscale_init_loongarch.c
@@ -26,6 +26,7 @@ 
 
 av_cold void ff_sws_init_range_convert_loongarch(SwsContext *c)
 {
+#if 0
     int cpu_flags = av_get_cpu_flags();
 
     if (have_lsx(cpu_flags)) {
@@ -52,6 +53,7 @@  av_cold void ff_sws_init_range_convert_loongarch(SwsContext *c)
         }
     }
 #endif // #if HAVE_LASX
+#endif
 }
 
 av_cold void ff_sws_init_swscale_loongarch(SwsContext *c)
diff --git a/libswscale/riscv/swscale.c b/libswscale/riscv/swscale.c
index fc592c39d5..131822033b 100644
--- a/libswscale/riscv/swscale.c
+++ b/libswscale/riscv/swscale.c
@@ -28,6 +28,7 @@  void ff_range_chr_from_jpeg_16_rvv(int16_t *, int16_t *, int);
 
 av_cold void ff_sws_init_range_convert_riscv(SwsContext *c)
 {
+#if 0
 #if HAVE_RVV
     int flags = av_get_cpu_flags();
 
@@ -47,6 +48,7 @@  av_cold void ff_sws_init_range_convert_riscv(SwsContext *c)
         c->chrConvertRange = convs[from].chr;
     }
 #endif
+#endif
 }
 
 #define RVV_INPUT(name) \
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 18e213b21b..370e3f6d70 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -156,75 +156,87 @@  static void hScale8To19_c(SwsContext *c, int16_t *_dst, int dstW,
 
 // FIXME all pal and rgb srcFormats could do this conversion as well
 // FIXME all scalers more complex than bilinear could do half of this transform
-static void chrRangeToJpeg_c(int16_t *dstU, int16_t *dstV, int width)
+static void chrRangeToJpeg_c(int16_t *dstU, int16_t *dstV, int width,
+                             int amax, int coeff, int64_t _offset)
 {
+    int offset = _offset;
     int i;
     for (i = 0; i < width; i++) {
-        dstU[i] = (FFMIN(dstU[i], 30775) * 4663 - 9289992) >> 12; // -264
-        dstV[i] = (FFMIN(dstV[i], 30775) * 4663 - 9289992) >> 12; // -264
+        dstU[i] = (FFMIN(dstU[i], amax) * coeff + offset) >> 14;
+        dstV[i] = (FFMIN(dstV[i], amax) * coeff + offset) >> 14;
     }
 }
 
-static void chrRangeFromJpeg_c(int16_t *dstU, int16_t *dstV, int width)
+static void chrRangeFromJpeg_c(int16_t *dstU, int16_t *dstV, int width,
+                               int amax, int coeff, int64_t _offset)
 {
+    int offset = _offset;
     int i;
     for (i = 0; i < width; i++) {
-        dstU[i] = (dstU[i] * 1799 + 4081085) >> 11; // 1469
-        dstV[i] = (dstV[i] * 1799 + 4081085) >> 11; // 1469
+        dstU[i] = (dstU[i] * coeff + offset) >> 14;
+        dstV[i] = (dstV[i] * coeff + offset) >> 14;
     }
 }
 
-static void lumRangeToJpeg_c(int16_t *dst, int width)
+static void lumRangeToJpeg_c(int16_t *dst, int width,
+                             int amax, int coeff, int64_t _offset)
 {
+    int offset = _offset;
     int i;
     for (i = 0; i < width; i++)
-        dst[i] = (FFMIN(dst[i], 30189) * 19077 - 39057361) >> 14;
+        dst[i] = (FFMIN(dst[i], amax) * coeff + offset) >> 14;
 }
 
-static void lumRangeFromJpeg_c(int16_t *dst, int width)
+static void lumRangeFromJpeg_c(int16_t *dst, int width,
+                               int amax, int coeff, int64_t _offset)
 {
+    int offset = _offset;
     int i;
     for (i = 0; i < width; i++)
-        dst[i] = (dst[i] * 14071 + 33561947) >> 14;
+        dst[i] = (dst[i] * coeff + offset) >> 14;
 }
 
-static void chrRangeToJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
+static void chrRangeToJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width,
+                               int amax, int coeff, int64_t offset)
 {
     int i;
     int32_t *dstU = (int32_t *) _dstU;
     int32_t *dstV = (int32_t *) _dstV;
     for (i = 0; i < width; i++) {
-        dstU[i] = (FFMIN(dstU[i], 30775 << 4) * 4663 - (9289992 << 4)) >> 12; // -264
-        dstV[i] = (FFMIN(dstV[i], 30775 << 4) * 4663 - (9289992 << 4)) >> 12; // -264
+        dstU[i] = ((int64_t) FFMIN(dstU[i], amax) * coeff + offset) >> 18;
+        dstV[i] = ((int64_t) FFMIN(dstV[i], amax) * coeff + offset) >> 18;
     }
 }
 
-static void chrRangeFromJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width)
+static void chrRangeFromJpeg16_c(int16_t *_dstU, int16_t *_dstV, int width,
+                                 int amax, int coeff, int64_t offset)
 {
     int i;
     int32_t *dstU = (int32_t *) _dstU;
     int32_t *dstV = (int32_t *) _dstV;
     for (i = 0; i < width; i++) {
-        dstU[i] = (dstU[i] * 1799 + (4081085 << 4)) >> 11; // 1469
-        dstV[i] = (dstV[i] * 1799 + (4081085 << 4)) >> 11; // 1469
+        dstU[i] = ((int64_t) dstU[i] * coeff + offset) >> 18;
+        dstV[i] = ((int64_t) dstV[i] * coeff + offset) >> 18;
     }
 }
 
-static void lumRangeToJpeg16_c(int16_t *_dst, int width)
+static void lumRangeToJpeg16_c(int16_t *_dst, int width,
+                               int amax, int coeff, int64_t offset)
 {
     int i;
     int32_t *dst = (int32_t *) _dst;
     for (i = 0; i < width; i++) {
-        dst[i] = ((int)(FFMIN(dst[i], 30189 << 4) * 4769U - (39057361 << 2))) >> 12;
+        dst[i] = ((int64_t) FFMIN(dst[i], amax) * coeff + offset) >> 18;
     }
 }
 
-static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
+static void lumRangeFromJpeg16_c(int16_t *_dst, int width,
+                                 int amax, int coeff, int64_t offset)
 {
     int i;
     int32_t *dst = (int32_t *) _dst;
     for (i = 0; i < width; i++)
-        dst[i] = ((int)(dst[i]*(14071U/4) + (33561947<<4)/4)) >> 12;
+        dst[i] = ((int64_t) dst[i] * coeff + offset) >> 18;
 }
 
 
@@ -531,11 +543,68 @@  static int swscale(SwsContext *c, const uint8_t *src[],
     return dstY - lastDstY;
 }
 
+// solve for coeff and offset:
+// dst = ((src << src_shift) * coeff + offset) >> (mult_shift + src_shift)
+static void solve_range_convert(int src_min, int src_max,
+                                int dst_min, int dst_max,
+                                int src_bits, int src_shift, int mult_shift,
+                                int *amax, int *coeff, int64_t *offset)
+{
+    const int64_t mult_max = ((1ULL << src_bits) - 1) << mult_shift;
+    int src_range = src_max - src_min;
+    int dst_range = dst_max - dst_min;
+    int total_shift = mult_shift + src_shift;
+    *coeff = AV_CEIL_RSHIFT(((int64_t) dst_range << total_shift) / src_range, src_shift);
+    *offset = ((int64_t) dst_max << total_shift) -
+              ((int64_t) src_max << src_shift) * *coeff;
+
+    // prevent overflows when converting to jpeg range
+    *amax = ROUNDED_DIV(mult_max - *offset, *coeff);
+}
+
+static void init_range_convert_constants(SwsContext *c)
+{
+    const int bit_depth = c->dstBpc ? c->dstBpc : 8;
+    const int src_bits = bit_depth <= 14 ? 15 : 19;
+    const int src_shift = src_bits - bit_depth;
+    const int mult_shift = bit_depth <= 14 ? 14 : 18;
+    const int mpeg_min = 16 << (bit_depth - 8);
+    const int mpeg_max_lum = 235 << (bit_depth - 8);
+    const int mpeg_max_chr = 240 << (bit_depth - 8);
+    const int jpeg_max = (1 << bit_depth) - 1;
+    int src_min, src_max_lum, src_max_chr;
+    int dst_min, dst_max_lum, dst_max_chr;
+    if (c->srcRange) {
+        src_min     = 0;
+        src_max_lum = jpeg_max;
+        src_max_chr = jpeg_max;
+        dst_min     = mpeg_min;
+        dst_max_lum = mpeg_max_lum;
+        dst_max_chr = mpeg_max_chr;
+    } else {
+        src_min     = mpeg_min;
+        src_max_lum = mpeg_max_lum;
+        src_max_chr = mpeg_max_chr;
+        dst_min     = 0;
+        dst_max_lum = jpeg_max;
+        dst_max_chr = jpeg_max;
+    }
+    solve_range_convert(src_min, src_max_lum, dst_min, dst_max_lum,
+                        src_bits, src_shift, mult_shift,
+                        &c->lumConvertRange_max,
+                        &c->lumConvertRange_coeff, &c->lumConvertRange_offset);
+    solve_range_convert(src_min, src_max_chr, dst_min, dst_max_chr,
+                        src_bits, src_shift, mult_shift,
+                        &c->chrConvertRange_max,
+                        &c->chrConvertRange_coeff, &c->chrConvertRange_offset);
+}
+
 av_cold void ff_sws_init_range_convert(SwsContext *c)
 {
     c->lumConvertRange = NULL;
     c->chrConvertRange = NULL;
     if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
+        init_range_convert_constants(c);
         if (c->dstBpc <= 14) {
             if (c->srcRange) {
                 c->lumConvertRange = lumRangeFromJpeg_c;
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 66be22ac05..b072a69b07 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -655,9 +655,17 @@  typedef struct SwsContext {
     /** @} */
 
     /// Color range conversion function for luma plane if needed.
-    void (*lumConvertRange)(int16_t *dst, int width);
+    void (*lumConvertRange)(int16_t *dst, int width,
+                            int amax, int coeff, int64_t offset);
+    int64_t lumConvertRange_offset;
+    int     lumConvertRange_coeff;
+    int     lumConvertRange_max;
     /// Color range conversion function for chroma planes if needed.
-    void (*chrConvertRange)(int16_t *dst1, int16_t *dst2, int width);
+    void (*chrConvertRange)(int16_t *dst1, int16_t *dst2, int width,
+                            int amax, int coeff, int64_t offset);
+    int64_t chrConvertRange_offset;
+    int     chrConvertRange_coeff;
+    int     chrConvertRange_max;
 
     int needs_hcscale; ///< Set if there are chroma planes to be converted.
 
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index a836de734c..d55e45471f 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -474,12 +474,14 @@  RANGE_CONVERT_FUNCS_DECL(avx2);
 
 av_cold void ff_sws_init_range_convert_x86(SwsContext *c)
 {
+#if 0
     int cpu_flags = av_get_cpu_flags();
     if (EXTERNAL_AVX2_FAST(cpu_flags)) {
         RANGE_CONVERT_FUNCS(avx2);
     } else if (EXTERNAL_SSE2(cpu_flags)) {
         RANGE_CONVERT_FUNCS(sse2);
     }
+#endif
 }
 
 av_cold void ff_sws_init_swscale_x86(SwsContext *c)
diff --git a/tests/checkasm/sw_range_convert.c b/tests/checkasm/sw_range_convert.c
index 01c4549e53..7c92135411 100644
--- a/tests/checkasm/sw_range_convert.c
+++ b/tests/checkasm/sw_range_convert.c
@@ -64,8 +64,11 @@  static void check_lumConvertRange(int from)
 
     LOCAL_ALIGNED_32(int16_t, dst0, [LARGEST_INPUT_SIZE * 2]);
     LOCAL_ALIGNED_32(int16_t, dst1, [LARGEST_INPUT_SIZE * 2]);
+    int32_t *dst0_32 = (int32_t *) dst0;
+    int32_t *dst1_32 = (int32_t *) dst1;
 
-    declare_func(void, int16_t *dst, int width);
+    declare_func(void, int16_t *dst, int width,
+                       int amax, int coeff, int64_t offset);
 
     ctx = sws_alloc_context();
     if (sws_init_context(ctx, NULL, NULL) < 0)
@@ -79,6 +82,10 @@  static void check_lumConvertRange(int from)
         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
         int bit_depth = desc->comp[0].depth;
         int sample_size = bit_depth == 16 ? sizeof(int32_t) : sizeof(int16_t);
+        int src_shift = bit_depth <= 14 ? 15 - bit_depth : 19 - bit_depth;
+        int mpeg_min = 16 << (bit_depth - 8);
+        int mpeg_max = 235 << (bit_depth - 8);
+        int jpeg_max = (1 << bit_depth) - 1;
         ctx->srcFormat = pix_fmt;
         ctx->dstFormat = pix_fmt;
         ctx->dstBpc = bit_depth;
@@ -87,12 +94,37 @@  static void check_lumConvertRange(int from)
             int width = input_sizes[dstWi];
             if (check_func(ctx->lumConvertRange, "%s%d_%d", func_str, bit_depth, width)) {
                 randomize_buffers(dst0, dst1, bit_depth, width);
-                call_ref(dst0, width);
-                call_new(dst1, width);
+                if (!from) {
+                    if (bit_depth == 16) {
+                        dst1_32[0] = dst0_32[0] = mpeg_min << src_shift;
+                        dst1_32[1] = dst0_32[1] = mpeg_max << src_shift;
+                    } else {
+                        dst1[0] = dst0[0] = mpeg_min << src_shift;
+                        dst1[1] = dst0[1] = mpeg_max << src_shift;
+                    }
+                }
+                call_ref(dst0, width,
+                         ctx->lumConvertRange_max,
+                         ctx->lumConvertRange_coeff, ctx->lumConvertRange_offset);
+                call_new(dst1, width,
+                         ctx->lumConvertRange_max,
+                         ctx->lumConvertRange_coeff, ctx->lumConvertRange_offset);
                 if (memcmp(dst0, dst1, width * sample_size))
                     fail();
+                if (!from) {
+                    /* check that the mpeg range is respected */
+                    if (bit_depth == 16) {
+                        if ((dst1_32[0] >> src_shift) > 0 || (dst1_32[1] >> src_shift) != jpeg_max)
+                            fail();
+                    } else {
+                        if ((dst1[0] >> src_shift) > 0 || (dst1[1] >> src_shift) != jpeg_max)
+                            fail();
+                    }
+                }
                 if (width == LARGEST_INPUT_SIZE && (bit_depth == 8 || bit_depth == 16))
-                    bench_new(dst1, width);
+                    bench_new(dst1, width,
+                              ctx->lumConvertRange_max,
+                              ctx->lumConvertRange_coeff, ctx->lumConvertRange_offset);
             }
         }
     }
@@ -112,8 +144,11 @@  static void check_chrConvertRange(int from)
     LOCAL_ALIGNED_32(int16_t, dstV0, [LARGEST_INPUT_SIZE * 2]);
     LOCAL_ALIGNED_32(int16_t, dstU1, [LARGEST_INPUT_SIZE * 2]);
     LOCAL_ALIGNED_32(int16_t, dstV1, [LARGEST_INPUT_SIZE * 2]);
+    int32_t *dstU0_32 = (int32_t *) dstU0;
+    int32_t *dstU1_32 = (int32_t *) dstU1;
 
-    declare_func(void, int16_t *dstU, int16_t *dstV, int width);
+    declare_func(void, int16_t *dstU, int16_t *dstV, int width,
+                       int amax, int coeff, int64_t offset);
 
     ctx = sws_alloc_context();
     if (sws_init_context(ctx, NULL, NULL) < 0)
@@ -127,6 +162,10 @@  static void check_chrConvertRange(int from)
         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
         int bit_depth = desc->comp[0].depth;
         int sample_size = bit_depth == 16 ? sizeof(int32_t) : sizeof(int16_t);
+        int src_shift = bit_depth <= 14 ? 15 - bit_depth : 19 - bit_depth;
+        int mpeg_min = 16 << (bit_depth - 8);
+        int mpeg_max = 240 << (bit_depth - 8);
+        int jpeg_max = (1 << bit_depth) - 1;
         ctx->srcFormat = pix_fmt;
         ctx->dstFormat = pix_fmt;
         ctx->dstBpc = bit_depth;
@@ -136,13 +175,38 @@  static void check_chrConvertRange(int from)
             if (check_func(ctx->chrConvertRange, "%s%d_%d", func_str, bit_depth, width)) {
                 randomize_buffers(dstU0, dstU1, bit_depth, width);
                 randomize_buffers(dstV0, dstV1, bit_depth, width);
-                call_ref(dstU0, dstV0, width);
-                call_new(dstU1, dstV1, width);
+                if (!from) {
+                    if (bit_depth == 16) {
+                        dstU1_32[0] = dstU0_32[0] = mpeg_min << src_shift;
+                        dstU1_32[1] = dstU0_32[1] = mpeg_max << src_shift;
+                    } else {
+                        dstU1[0] = dstU0[0] = mpeg_min << src_shift;
+                        dstU1[1] = dstU0[1] = mpeg_max << src_shift;
+                    }
+                }
+                call_ref(dstU0, dstV0, width,
+                         ctx->chrConvertRange_max,
+                         ctx->chrConvertRange_coeff, ctx->chrConvertRange_offset);
+                call_new(dstU1, dstV1, width,
+                         ctx->chrConvertRange_max,
+                         ctx->chrConvertRange_coeff, ctx->chrConvertRange_offset);
                 if (memcmp(dstU0, dstU1, width * sample_size) ||
                     memcmp(dstV0, dstV1, width * sample_size))
                     fail();
+                if (!from) {
+                    /* check that the mpeg range is respected */
+                    if (bit_depth == 16) {
+                        if ((dstU1_32[0] >> src_shift) > 0 || (dstU1_32[1] >> src_shift) != jpeg_max)
+                            fail();
+                    } else {
+                        if ((dstU1[0] >> src_shift) > 0 || (dstU1[1] >> src_shift) != jpeg_max)
+                            fail();
+                    }
+                }
                 if (width == LARGEST_INPUT_SIZE && (bit_depth == 8 || bit_depth == 16))
-                    bench_new(dstU1, dstV1, width);
+                    bench_new(dstU1, dstV1, width,
+                              ctx->chrConvertRange_max,
+                              ctx->chrConvertRange_coeff, ctx->chrConvertRange_offset);
             }
         }
     }
diff --git a/tests/ref/fate/filter-alphaextract_alphamerge_rgb b/tests/ref/fate/filter-alphaextract_alphamerge_rgb
index eac9971638..b3c3448210 100644
--- a/tests/ref/fate/filter-alphaextract_alphamerge_rgb
+++ b/tests/ref/fate/filter-alphaextract_alphamerge_rgb
@@ -3,53 +3,53 @@ 
 #codec_id 0: rawvideo
 #dimensions 0: 352x288
 #sar 0: 0/1
-0,          0,          0,        1,   405504, 0x6d5666c8
-0,          1,          1,        1,   405504, 0x4813ba17
-0,          2,          2,        1,   405504, 0x23880ee1
-0,          3,          3,        1,   405504, 0x3709926b
-0,          4,          4,        1,   405504, 0x1748e102
-0,          5,          5,        1,   405504, 0x12b4472b
-0,          6,          6,        1,   405504, 0x0441fe6b
-0,          7,          7,        1,   405504, 0x4fa8d058
-0,          8,          8,        1,   405504, 0xa0d810fb
-0,          9,          9,        1,   405504, 0xaca3ca02
-0,         10,         10,        1,   405504, 0x0afe65ea
-0,         11,         11,        1,   405504, 0xb81a9bd1
-0,         12,         12,        1,   405504, 0xb85f10eb
-0,         13,         13,        1,   405504, 0x4dc5e992
-0,         14,         14,        1,   405504, 0x6e9f8042
-0,         15,         15,        1,   405504, 0xf8e58f43
-0,         16,         16,        1,   405504, 0xc717635c
-0,         17,         17,        1,   405504, 0x5928548d
-0,         18,         18,        1,   405504, 0x8f2295f9
-0,         19,         19,        1,   405504, 0x5c449294
-0,         20,         20,        1,   405504, 0xe8c5d6ef
-0,         21,         21,        1,   405504, 0x3608a811
-0,         22,         22,        1,   405504, 0xa3788a12
-0,         23,         23,        1,   405504, 0x90ad93a3
-0,         24,         24,        1,   405504, 0x26c603bc
-0,         25,         25,        1,   405504, 0x055d69a8
-0,         26,         26,        1,   405504, 0x834747ea
-0,         27,         27,        1,   405504, 0x16eea5dd
-0,         28,         28,        1,   405504, 0xa2af8e0d
-0,         29,         29,        1,   405504, 0x65d2380f
-0,         30,         30,        1,   405504, 0xf4858c72
-0,         31,         31,        1,   405504, 0x90755bc9
-0,         32,         32,        1,   405504, 0xabfac3b0
-0,         33,         33,        1,   405504, 0x4a76adbd
-0,         34,         34,        1,   405504, 0x633183e9
-0,         35,         35,        1,   405504, 0xcb8ff8fe
-0,         36,         36,        1,   405504, 0x9c96074a
-0,         37,         37,        1,   405504, 0x700ea35c
-0,         38,         38,        1,   405504, 0x31bb483c
-0,         39,         39,        1,   405504, 0x50dd7ca7
-0,         40,         40,        1,   405504, 0x047988a0
-0,         41,         41,        1,   405504, 0xe4d7a9dd
-0,         42,         42,        1,   405504, 0x455d82ab
-0,         43,         43,        1,   405504, 0x8f875343
-0,         44,         44,        1,   405504, 0x8be18c94
-0,         45,         45,        1,   405504, 0x75431a7d
-0,         46,         46,        1,   405504, 0x08122c08
-0,         47,         47,        1,   405504, 0xfca4159a
-0,         48,         48,        1,   405504, 0x90c9afd6
-0,         49,         49,        1,   405504, 0x817e3b6a
+0,          0,          0,        1,   405504, 0x91b5634d
+0,          1,          1,        1,   405504, 0x16b3b6c6
+0,          2,          2,        1,   405504, 0x94660b56
+0,          3,          3,        1,   405504, 0x99098f0b
+0,          4,          4,        1,   405504, 0x2a9edda5
+0,          5,          5,        1,   405504, 0xe59d4392
+0,          6,          6,        1,   405504, 0x3172fb02
+0,          7,          7,        1,   405504, 0xa735ccd3
+0,          8,          8,        1,   405504, 0xb0440d78
+0,          9,          9,        1,   405504, 0xa5aac67c
+0,         10,         10,        1,   405504, 0x73d06232
+0,         11,         11,        1,   405504, 0x84f19818
+0,         12,         12,        1,   405504, 0xdf0c0dce
+0,         13,         13,        1,   405504, 0xdf82e624
+0,         14,         14,        1,   405504, 0xf2737cd2
+0,         15,         15,        1,   405504, 0xaa8d8bac
+0,         16,         16,        1,   405504, 0x90695fdb
+0,         17,         17,        1,   405504, 0xb5875106
+0,         18,         18,        1,   405504, 0x6af5929e
+0,         19,         19,        1,   405504, 0x7dff8ef2
+0,         20,         20,        1,   405504, 0x3b28d388
+0,         21,         21,        1,   405504, 0x902aa4d2
+0,         22,         22,        1,   405504, 0x940c869f
+0,         23,         23,        1,   405504, 0xef4c9017
+0,         24,         24,        1,   405504, 0xdb110019
+0,         25,         25,        1,   405504, 0x54b96612
+0,         26,         26,        1,   405504, 0x50de446d
+0,         27,         27,        1,   405504, 0xfb31a27b
+0,         28,         28,        1,   405504, 0xdc678a45
+0,         29,         29,        1,   405504, 0xc4263483
+0,         30,         30,        1,   405504, 0x87a288b1
+0,         31,         31,        1,   405504, 0xb34d5878
+0,         32,         32,        1,   405504, 0xaa69c04c
+0,         33,         33,        1,   405504, 0x625ea9f3
+0,         34,         34,        1,   405504, 0xa56f806d
+0,         35,         35,        1,   405504, 0xcbe0f58d
+0,         36,         36,        1,   405504, 0xeba003e1
+0,         37,         37,        1,   405504, 0x5e22a00c
+0,         38,         38,        1,   405504, 0x4160446c
+0,         39,         39,        1,   405504, 0xee35793d
+0,         40,         40,        1,   405504, 0x604d854c
+0,         41,         41,        1,   405504, 0x6a1ca614
+0,         42,         42,        1,   405504, 0x28cf7f5d
+0,         43,         43,        1,   405504, 0xa1654ff2
+0,         44,         44,        1,   405504, 0xbbbf88d7
+0,         45,         45,        1,   405504, 0x7d8e16d3
+0,         46,         46,        1,   405504, 0x149c286c
+0,         47,         47,        1,   405504, 0x023b1202
+0,         48,         48,        1,   405504, 0xfb37ac74
+0,         49,         49,        1,   405504, 0xb03837d4
diff --git a/tests/ref/fate/filter-pixdesc-gray10be b/tests/ref/fate/filter-pixdesc-gray10be
index 5ef8032e70..1313c9ec3c 100644
--- a/tests/ref/fate/filter-pixdesc-gray10be
+++ b/tests/ref/fate/filter-pixdesc-gray10be
@@ -1 +1 @@ 
-pixdesc-gray10be    987bee0355054fcfc915e1e41aad523a
+pixdesc-gray10be    7ea33650899480c5ff55b4dd1eb21f7a
diff --git a/tests/ref/fate/filter-pixdesc-gray10le b/tests/ref/fate/filter-pixdesc-gray10le
index ea86b22dc5..9f0abb6e81 100644
--- a/tests/ref/fate/filter-pixdesc-gray10le
+++ b/tests/ref/fate/filter-pixdesc-gray10le
@@ -1 +1 @@ 
-pixdesc-gray10le    674bed2aa8686b78dd5fa4b15c15c655
+pixdesc-gray10le    5da6368b2a0a4b86eb2596f7316742df
diff --git a/tests/ref/fate/filter-pixdesc-gray12be b/tests/ref/fate/filter-pixdesc-gray12be
index 6388f14764..0c26a94024 100644
--- a/tests/ref/fate/filter-pixdesc-gray12be
+++ b/tests/ref/fate/filter-pixdesc-gray12be
@@ -1 +1 @@ 
-pixdesc-gray12be    29aeecc116c4b3e0c5109810fbd9ca17
+pixdesc-gray12be    063a64bcfcc5744b931dcade2a513454
diff --git a/tests/ref/fate/filter-pixdesc-gray12le b/tests/ref/fate/filter-pixdesc-gray12le
index 28e900f68e..8e1263dbc1 100644
--- a/tests/ref/fate/filter-pixdesc-gray12le
+++ b/tests/ref/fate/filter-pixdesc-gray12le
@@ -1 +1 @@ 
-pixdesc-gray12le    030882d5b4a502210644f2d520f7b92c
+pixdesc-gray12le    e1a970f626f635590d7f97787360e2db
diff --git a/tests/ref/fate/filter-pixdesc-gray14be b/tests/ref/fate/filter-pixdesc-gray14be
index dc7836a10e..c773db11f1 100644
--- a/tests/ref/fate/filter-pixdesc-gray14be
+++ b/tests/ref/fate/filter-pixdesc-gray14be
@@ -1 +1 @@ 
-pixdesc-gray14be    6c9faae02a63f17d78ae6bff2866c0c1
+pixdesc-gray14be    10eccf800656159d7ef7465d3cef7b6f
diff --git a/tests/ref/fate/filter-pixdesc-gray14le b/tests/ref/fate/filter-pixdesc-gray14le
index 9057875bd1..3b7a67d727 100644
--- a/tests/ref/fate/filter-pixdesc-gray14le
+++ b/tests/ref/fate/filter-pixdesc-gray14le
@@ -1 +1 @@ 
-pixdesc-gray14le    713c6b98b8f22a0716bf3541fb311936
+pixdesc-gray14le    de40970df968149021ca43ead42053ee
diff --git a/tests/ref/fate/filter-pixdesc-gray16be b/tests/ref/fate/filter-pixdesc-gray16be
index b4d28d38a6..66e3852a9d 100644
--- a/tests/ref/fate/filter-pixdesc-gray16be
+++ b/tests/ref/fate/filter-pixdesc-gray16be
@@ -1 +1 @@ 
-pixdesc-gray16be    99e7e54973b479845932e92581292b03
+pixdesc-gray16be    c91b77c5b06f161740f6a2a51e886e2b
diff --git a/tests/ref/fate/filter-pixdesc-gray16le b/tests/ref/fate/filter-pixdesc-gray16le
index 841d3ee1c5..946d813377 100644
--- a/tests/ref/fate/filter-pixdesc-gray16le
+++ b/tests/ref/fate/filter-pixdesc-gray16le
@@ -1 +1 @@ 
-pixdesc-gray16le    33bd1b950d279a4bb22af325905d3604
+pixdesc-gray16le    db565557ed702661047210233a409e58
diff --git a/tests/ref/fate/filter-pixdesc-gray9be b/tests/ref/fate/filter-pixdesc-gray9be
index bf92e299b5..b8819e9f17 100644
--- a/tests/ref/fate/filter-pixdesc-gray9be
+++ b/tests/ref/fate/filter-pixdesc-gray9be
@@ -1 +1 @@ 
-pixdesc-gray9be     19aef736657607fdc6191f5338860580
+pixdesc-gray9be     d85b9070b391069692c49a6e2e0933e9
diff --git a/tests/ref/fate/filter-pixdesc-gray9le b/tests/ref/fate/filter-pixdesc-gray9le
index 4c65fb97c2..54ed158388 100644
--- a/tests/ref/fate/filter-pixdesc-gray9le
+++ b/tests/ref/fate/filter-pixdesc-gray9le
@@ -1 +1 @@ 
-pixdesc-gray9le     f2a28bb71966f5d6e44eedef67e0118a
+pixdesc-gray9le     fd83ed4e5eb472a744fe4f80dafe44df
diff --git a/tests/ref/fate/filter-pixdesc-ya16be b/tests/ref/fate/filter-pixdesc-ya16be
index 124d3aba88..4079e2c485 100644
--- a/tests/ref/fate/filter-pixdesc-ya16be
+++ b/tests/ref/fate/filter-pixdesc-ya16be
@@ -1 +1 @@ 
-pixdesc-ya16be      86059502198a6d6febb5558e984a30fb
+pixdesc-ya16be      77841706de5383974985954a2610feab
diff --git a/tests/ref/fate/filter-pixdesc-ya16le b/tests/ref/fate/filter-pixdesc-ya16le
index f0144be147..711e42eaed 100644
--- a/tests/ref/fate/filter-pixdesc-ya16le
+++ b/tests/ref/fate/filter-pixdesc-ya16le
@@ -1 +1 @@ 
-pixdesc-ya16le      f19f6f76d395a18b88accc83d333cc50
+pixdesc-ya16le      ec8ba00cdba56fb22962f0139953a60b
diff --git a/tests/ref/fate/filter-pixdesc-yuvj411p b/tests/ref/fate/filter-pixdesc-yuvj411p
index 5dfc0dc4cd..f75d9d8973 100644
--- a/tests/ref/fate/filter-pixdesc-yuvj411p
+++ b/tests/ref/fate/filter-pixdesc-yuvj411p
@@ -1 +1 @@ 
-pixdesc-yuvj411p    cac93399031ad86e8de0796b60b5bb8a
+pixdesc-yuvj411p    cfae02914ace41c16a1f8a07edb3e352
diff --git a/tests/ref/fate/filter-pixdesc-yuvj420p b/tests/ref/fate/filter-pixdesc-yuvj420p
index ad2f968a1f..4bf0e618c3 100644
--- a/tests/ref/fate/filter-pixdesc-yuvj420p
+++ b/tests/ref/fate/filter-pixdesc-yuvj420p
@@ -1 +1 @@ 
-pixdesc-yuvj420p    5244374882cf07c3cbcde71940caf8e5
+pixdesc-yuvj420p    7c3e28789af8ed1f8c2d621214067b1c
diff --git a/tests/ref/fate/filter-pixdesc-yuvj422p b/tests/ref/fate/filter-pixdesc-yuvj422p
index 5f80d585d6..57bb236df9 100644
--- a/tests/ref/fate/filter-pixdesc-yuvj422p
+++ b/tests/ref/fate/filter-pixdesc-yuvj422p
@@ -1 +1 @@ 
-pixdesc-yuvj422p    6c9722aa9e0c1b8f9d953efeb93dc318
+pixdesc-yuvj422p    3dfc9370430f44126dc0ffb3d76bcf1b
diff --git a/tests/ref/fate/filter-pixdesc-yuvj440p b/tests/ref/fate/filter-pixdesc-yuvj440p
index c98669285b..2d6d871255 100644
--- a/tests/ref/fate/filter-pixdesc-yuvj440p
+++ b/tests/ref/fate/filter-pixdesc-yuvj440p
@@ -1 +1 @@ 
-pixdesc-yuvj440p    34e6e86ca3ec4e6ef62d533aa2290e8f
+pixdesc-yuvj440p    dceaba9394c974d6082931d68d1d8f96
diff --git a/tests/ref/fate/filter-pixdesc-yuvj444p b/tests/ref/fate/filter-pixdesc-yuvj444p
index 3e182fa6e2..88cbbfeecc 100644
--- a/tests/ref/fate/filter-pixdesc-yuvj444p
+++ b/tests/ref/fate/filter-pixdesc-yuvj444p
@@ -1 +1 @@ 
-pixdesc-yuvj444p    f67694103bb42d74742918adf9ea31c5
+pixdesc-yuvj444p    f5edd2b27eda82be5f2ffa99d9ada215
diff --git a/tests/ref/fate/filter-pixfmts-copy b/tests/ref/fate/filter-pixfmts-copy
index 120129dc1e..7704487f8d 100644
--- a/tests/ref/fate/filter-pixfmts-copy
+++ b/tests/ref/fate/filter-pixfmts-copy
@@ -43,16 +43,16 @@  gbrp9le             699da3a3b324f3fd001a56aee9683384
 gbrpf32be           ae33c2d738af01ae66a5d2b08a7a60b7
 gbrpf32le           4e3305c619337beeeacc5e6b2f42c793
 gray                188590b1231afd231ea910815aef2b25
-gray10be            d486558ecd2e27afc17930be861f0e4c
-gray10le            917d687103b2adcca7132bfc070ca54a
-gray12be            9685614450f1282be433d2b07234ca1f
-gray12le            2700bd7fb3fea56e54eb03e31d6d4e57
-gray14be            19ed2bf25878980d6f81f6ae699024ec
-gray14le            4b148b26b30040c05dc248a8852f31ac
-gray16be            08d997a3faa25a3db9d6be272d282eef
-gray16le            df65eb804360795e3e38a2701fa9641a
-gray9be             6382a14594a8b68f0ec7de25531f9334
-gray9le             4eb1dda58706436e3b69aef29b0089db
+gray10be            0804e8620fcd78599e3df33cb83652aa
+gray10le            705e51fb783ae8167498d09748e44bd2
+gray12be            2163197b5975c0c2900ac7c3f56f45f1
+gray12le            5bf2ca7795dd0524b253aee20f660e73
+gray14be            dccc8bde352b6c8ae65ca2832a383381
+gray14le            56c9e613b09f00a5940c0bf2e938c02e
+gray16be            47a6889ea2dcff9164888a94cccff4de
+gray16le            07ef57f08f51dcc9918441557b124eb8
+gray9be             2bcfb9b929ed9fa0ed4577ed0500a7eb
+gray9le             0171e3a1dfa892fb881207d43ae54997
 grayf32be           f3bf178835f8146aa09d1da94bba4d8a
 grayf32le           fb6ea85bfbc8cd21c51fc0e110197294
 monob               8b04f859fee6a0be856be184acd7a0b5
@@ -107,8 +107,8 @@  xyz12be             a1ef56bf746d71f59669c28e48fc8450
 xyz12le             831ff03c1ba4ef19374686f16a064d8c
 y210le              0736b017e0814daf38d3350c42796f7a
 y212le              825768be8fe92708ae80be84855066ed
-ya16be              37c07787e544f900c87b853253bfc8dd
-ya16le              e8cab8fad88cba6d285b224d8bf0d4df
+ya16be              44ca11addb5bce91f29946f9045864f8
+ya16le              134a14cd131565cd78da54cba2c31a5f
 ya8                 dbb99fbcdc204aaa1a7397ff561f1a67
 yuv410p             5d4d992a7728431aa4e0700f87fb7fd8
 yuv411p             7e1300e89f5bc07939e2c4a6acbdf267
@@ -175,10 +175,10 @@  yuva444p16be        c80c1899789a6411d0025730efc8f01c
 yuva444p16le        2ed56ea50fafda4d226c9b133755dad8
 yuva444p9be         4903fde22b15d28da90761ac1cfcb1c5
 yuva444p9le         4eeb5988df0740fea720da1e31bbb829
-yuvj411p            e003eefa7e2a20f20d33767775417216
-yuvj420p            8f3d8f1b4577d11082d5ab8a901e048d
-yuvj422p            79d480e99e610112f266c833c6cb3d35
-yuvj440p            f4b18310c7174868fc92579f87460876
-yuvj444p            b161e6d5a941e2a4bb7bc56ef8af623f
+yuvj411p            34971e4718d7f239c82bb42383bd4bff
+yuvj420p            72c49563e5d0ea9233b42b5da905a3c3
+yuvj422p            7de461ca2c4bc5dd90cde9a983493e67
+yuvj440p            2143eb9ad0db319975cffb3572956736
+yuvj444p            67f10f1dcf184059559bc7173e2dd3fc
 yuyv422             435c92283b538aa3d8fa2a020b0afd49
 yvyu422             8436c2a760291cc979e0dd62ab8cede0
diff --git a/tests/ref/fate/filter-pixfmts-crop b/tests/ref/fate/filter-pixfmts-crop
index 4731e96fc0..04d23531ad 100644
--- a/tests/ref/fate/filter-pixfmts-crop
+++ b/tests/ref/fate/filter-pixfmts-crop
@@ -43,16 +43,16 @@  gbrp9le             b4cbfa7878706a14295f09212e41f7fe
 gbrpf32be           4f06588a3de6ed0f30436f814eda0909
 gbrpf32le           b2a9df783d8c2156c5aafc561989918d
 gray                0d70b54b4b888ec4dbd89713620ac1ee
-gray10be            18ed76cab145ab9058cc353fcec6d3c4
-gray10le            fd83f7489880160783ddb125615b4638
-gray12be            472700c26cc49b8d5f74af141f6a0d38
-gray12le            4f6537fe1f32b3963350f8c435009433
-gray14be            302b5b534f64ee15fffe2d3818e8c29c
-gray14le            9c205ae791cbb9e479beb0ece236c05f
-gray16be            38f599da990224de86e3dc7a543121a9
-gray16le            9ff7c866bd98def4e6c91542c1c45f80
-gray9be             8ffcb18d699480f55414bfc21ab33321
-gray9le             4d1932d4968a248584f5e39c25f1dd43
+gray10be            a97f60928c553b9d0e8e44b69ec2970d
+gray10le            bff59b6df8751b5e958d0cd8deb3c31a
+gray12be            5080520ac513da1be65b353a3c208a99
+gray12le            016877eaccd8490fd281b08b582bd832
+gray14be            c0a8c2f0937438d8a54625d90cc44a12
+gray14le            222c5d59a7482e060f0fa117e658c239
+gray16be            a134e7154d1ee810e50ea5887f784cf0
+gray16le            684366a10a68b14dd11a46e90d4706a8
+gray9be             77a834b1795d540074a64d9fb6452b91
+gray9le             1ef37496619ba80bfb870da6573178e6
 grayf32be           cf40ec06a8abe54852b7f85a00549eec
 grayf32le           b672526c9da9c8959ab881f242f6890a
 nv12                92cda427f794374731ec0321ee00caac
@@ -102,8 +102,8 @@  xv30le              a9edb820819b900a4a897fee4562a4fb
 xv36le              567af630bf0209e026e0909b3ca9c436
 xyz12be             cb4571f9aaa7b59f999ef327276104b7
 xyz12le             cd6aae8d26b18bdb4b9d068586276d91
-ya16be              a3d18014454942a96f15a49947c0c55d
-ya16le              3d90169aeab9e9637945cf00ab3e95ae
+ya16be              071add03126a11dc6a06209e9b409f8d
+ya16le              b723211dc0647c944768c6e45e066b36
 ya8                 51a8dd297e35d40b06d3ebe8f4717895
 yuv410p             3bb6c7b64f2c46bc5e8b77198ce4ea58
 yuv411p             693e4afe96998e6dd91734037d75d887
@@ -170,8 +170,8 @@  yuva444p16be        f817caf234aaf5848b2bc9679582ed56
 yuva444p16le        b32ad623fc423f897ff31c4073ea2a6f
 yuva444p9be         48498d994c3c9070f31773e39da306dd
 yuva444p9le         431b0ac211a8f81c15f38fb57a73530c
-yuvj411p            241d393eeaa1517f6b4b23034222994b
-yuvj420p            35583968261c636b9c57ff03fd60eb54
-yuvj422p            c29a94439e96cd5dab7f65eb6dfc2f5c
-yuvj440p            8899d4ce717e32937d58a76df473ba7a
-yuvj444p            6c0d0ad629baaa96fe4dcb00f0f5d9de
+yuvj411p            95a9d0c7a7fa7ffb2a58e5f518da38ee
+yuvj420p            8afe12c91e8b29ce6dd0cecd6b462820
+yuvj422p            4467ab318d1c3866185bee8fda3ab8a2
+yuvj440p            0db10c8b09ab96722b26a64a31619c68
+yuvj444p            136a38c3018146d0243f4667f3e401cd
diff --git a/tests/ref/fate/filter-pixfmts-field b/tests/ref/fate/filter-pixfmts-field
index 0727d733f2..249decfa50 100644
--- a/tests/ref/fate/filter-pixfmts-field
+++ b/tests/ref/fate/filter-pixfmts-field
@@ -43,16 +43,16 @@  gbrp9le             da5d80e6f12cabaa7081bb85d3b7fd30
 gbrpf32be           cd5b0edd510652a0bcfd7e36935e3cb0
 gbrpf32le           9d42fc5331376b5307268498a06613ce
 gray                57fd8e6e00f6be8752726005974cce1b
-gray10be            437713f3d081238cddb738e106e5a27d
-gray10le            c749b80049b152f4ba3e66a72c0c5acc
-gray12be            d34c50810b37e6f97dffdf6a8ab958de
-gray12le            cf71b8fee47ce7821f3ae9f9b62ae39a
-gray14be            2644f330259d70793d789b8dc3c01226
-gray14le            7776a471945d303088012cbc2ff2a2d0
-gray16be            e1700e056de9917744a7ff4ab2ca63fd
-gray16le            338de7ac5f7d36d5ad5ac2c8d5bbea68
-gray9be             25e50940fa300a8f09edfb6eba4fd250
-gray9le             1146cfc1b92bfd07ed238e65ffcd134f
+gray10be            083a7931fea847a4d8b23d38f989a836
+gray10le            1b08650e7c44f8517dd3f37044930729
+gray12be            c02b7fef120c03bf0fddadb5b63a1373
+gray12le            ac129433ead39c0c9f881979345a434d
+gray14be            a5c8b034a5867ba91691fbd68cea2864
+gray14le            39c6b08bd0d934005ace54a2e5821e8e
+gray16be            3f446db33f6dea74ac1d9d6962511c4e
+gray16le            68e4093c88b02f89319298f045d42c0e
+gray9be             2cf4a1297d5231917669df224712b582
+gray9le             46c9cc0de8525d36ed6052afa70de6c3
 grayf32be           72fbfa47b2863658a8a80d588f23b3e7
 grayf32le           6b856bdbf2a2bfcd2bc7d50f109daaf0
 monob               2129cc72a484d7e10a44de9117aa9f80
@@ -107,8 +107,8 @@  xyz12be             d2fa69ec91d3ed862f2dac3f8e7a3437
 xyz12le             02bccd5e0b6824779a1f848b0ea3e3b5
 y210le              025beb25f047a762e3788dbea4b60864
 y212le              ac2a47c45187dd54d0f55293cbffd954
-ya16be              40403b5277364777e0671da4d38e01ac
-ya16le              54f3295f5326a13d456ac53e973ba398
+ya16be              340b98a0addab42db198fc7f9f8df8be
+ya16le              bdd39056e61040860e0e4735fe4472df
 ya8                 28cea4f98ed452bd3da9c752e5e3399c
 yuv410p             a85920d6bd26f51306e2ecbe71d1c554
 yuv411p             9106e283d5dbcfba01c611886d58871a
@@ -175,10 +175,10 @@  yuva444p16be        b10fd7c1b61ac22bdb285f0d91a390f1
 yuva444p16le        cac82ffc36b7052747407663fc5ed510
 yuva444p9be         a6f66d08b3370fdd90987a6143b7b91c
 yuva444p9le         8d0f0b0840096127613920984078ce53
-yuvj411p            0c7caab687fbd33cba04702366b6c401
-yuvj420p            c9bef7e5c1dba1024be992167806ef07
-yuvj422p            ac900a0f9854dc2a0ec2e016ff5487dc
-yuvj440p            6f0d66982a3b96efb341a512314317ca
-yuvj444p            d559f8cf2e68b0cd3abadbb2f3642dd7
+yuvj411p            153d9331f33314f0f83f292e6cc93172
+yuvj420p            341d229790b47cdf3a5d1f93dc3fc0e1
+yuvj422p            941d84f0588a2244d78bb27206ddbf3e
+yuvj440p            5dc7cec24fcd1e9e1a403929c38ed155
+yuvj444p            47600c3e38d2be7975d1f66c7f75f051
 yuyv422             449ca8d4b5a28ccaaa342860b24aeb3c
 yvyu422             6b226a0d4fce5478294d3bd4ecfb46a5
diff --git a/tests/ref/fate/filter-pixfmts-fieldorder b/tests/ref/fate/filter-pixfmts-fieldorder
index 1d7a98ce11..f32ab18f80 100644
--- a/tests/ref/fate/filter-pixfmts-fieldorder
+++ b/tests/ref/fate/filter-pixfmts-fieldorder
@@ -43,16 +43,16 @@  gbrp9le             0d42cc9e222d806c33172781b45cb3e3
 gbrpf32be           cef1384ac5c95cf4b3ea2e49133dbef0
 gbrpf32le           c053b8bf8314196099b1e2e1d0617b75
 gray                d96e0f1c73d3f0b9506d691b5cd36c73
-gray10be            c26c73de96b630f1207ff589b6553ebd
-gray10le            16e4db1d611ec3fa5c9fd8fbdbf1ffcc
-gray12be            1c3285c150e1dddcf0fbee405cfb068e
-gray12le            a57b6199f5690add0ac0150fa95c4988
-gray14be            1e3d0d0421cf84eac93d7ab1964207ff
-gray14le            04899f53627203bd1fe3f17fb0de199c
-gray16be            293a36548ce16543494790f8f7f76a05
-gray16le            84f83f5fcbb5d458efb8395a50a3797e
-gray9be             ec877f5bcf0ea275a6f36c12cc9adf11
-gray9le             fba944fde7923d5089f4f52d12988b9e
+gray10be            3ccbda141912b7cace81b2145005032e
+gray10le            e27718bf9caa54b7b3313c15cec88f20
+gray12be            c892966f917891dbe2badf8281486710
+gray12le            48b193c9afe677304c027aca3b431411
+gray14be            ea1ea4bece62708ba47a7ebbfdd4437e
+gray14le            beb4536b196e50a6fb5deb07580a803c
+gray16be            28b2b79919be3a0b65c0825eb3e98d92
+gray16le            27315595d49a07aa59baee5b78a29408
+gray9be             2bf69a7bae4954221d9f7f18cd5bb390
+gray9le             c45eb848ab86f63f30ceb7206fb41be9
 grayf32be           1aa7960131f880c54fe3c77f13448674
 grayf32le           4029ac9d197f255794c1b9e416520fc7
 nv16                085deb984ab986eb5cc961fe265e30c0
@@ -96,8 +96,8 @@  xyz12be             15f5cda71de5fef9cec5e75e3833b6bc
 xyz12le             7be6c8781f38c21a6b8f602f62ca31e6
 y210le              ee45acfb1386288af98af5313162ff3e
 y212le              2f08fb195b948056c844acb1eee8d649
-ya16be              0f13e0f52586d172aaa07710fa3e8f31
-ya16le              d481d93ea1a1a04d759d9994958983de
+ya16be              d4e77ad7f1f2d168f7715bd595e30eac
+ya16le              270d3042b5dc524194bb28b0eadd735c
 ya8                 055ac5ab5ff8533dd319edc17a398af1
 yuv411p             e4a040e0e786c4dae07d9d3f90a54905
 yuv422p             16ce67249c6ce7ef57a433646ad6dfc1
@@ -140,8 +140,8 @@  yuva444p16be        2f80d411847856e1364659dee8b23485
 yuva444p16le        5796be8d66371b60037fc8053c27e900
 yuva444p9be         a83599c0e9fca08f6b7c6e02c2413fcf
 yuva444p9le         390fcd8f72ee407a8c338667944e3f72
-yuvj411p            73fa99cb96d2f7171bff15bc2e43d963
-yuvj422p            d5e67ce1db5347cf3416069286359f57
-yuvj444p            e915da6b5aa0ee5298771ba0ca187cad
+yuvj411p            2c2dc9e10932a780724b3daa52941122
+yuvj422p            ddc1b65724c14685bc386ef87dfd3014
+yuvj444p            3734c611752ad1bcfe3ea8a0e794cc6d
 yuyv422             a923c5bd4889bec92d872237f6a578ec
 yvyu422             d7a8697f1f5e6a2a27b0df17811b2613
diff --git a/tests/ref/fate/filter-pixfmts-hflip b/tests/ref/fate/filter-pixfmts-hflip
index 43404db154..89f41122b3 100644
--- a/tests/ref/fate/filter-pixfmts-hflip
+++ b/tests/ref/fate/filter-pixfmts-hflip
@@ -43,16 +43,16 @@  gbrp9le             ba7c2631fb2967aa909c66509bd243fe
 gbrpf32be           a53fc24a298bf419051fb57c63cc4cef
 gbrpf32le           b44dae0881043398bfd704a944094737
 gray                8bd4ece1dbf89b20ee785e0515356e07
-gray10be            160dd03e30d33379de92c70ee52c01fd
-gray10le            6baac1da6be3789409b67cd506afe7da
-gray12be            de7b5ef4b513e7e8270c617249d1cbdf
-gray12le            e8d0739ff61649bd82722b3134cbe776
-gray14be            22560aaac37f5bb2982819b752bf4608
-gray14le            d4b2f5e7c4bbd39130655b8f2c55f010
-gray16be            cf7294d9aa23e1b838692ec01ade587b
-gray16le            d91ce41e304419bcf32ac792f01bd64f
-gray9be             ac8d260669479ae720a5b6d4d8639e34
-gray9le             424fc581947bc8c357c9ec5e3c1c04d1
+gray10be            1daf5c1face37d8724a65e905941dcb8
+gray10le            07c5139f97db9d49729f2ea6e77dcedf
+gray12be            2ba74a3890309bb111045e2aedcd2e07
+gray12le            81af0124c72271fd316564d86fcd3f2b
+gray14be            87981e992522a611b28ab5a0ba0ddcb1
+gray14le            95313b7de3f1f2a1471447e57932ada1
+gray16be            4b87b19d657cb45de7f2fe3143d79235
+gray16le            c6c897f86222fd2cd816534cda217dcf
+gray9be             7747115e0cb893bd62ddba43c2009cb7
+gray9le             f5a7332cb42857a87290f87b1ddbbc0e
 grayf32be           a69add7bbf892a71fe81b3b75982dbe2
 grayf32le           4563e176a35dc8a8a07e0829fad5eb88
 nv12                801e58f1be5fd0b5bc4bf007c604b0b4
@@ -102,8 +102,8 @@  xv30le              072aa2b61ce1e764f9d1957e8abee9a9
 xv36le              6e9c3d2334f9fe2a0e6156615e53e272
 xyz12be             25f90259ff8a226befdaec3dfe82996e
 xyz12le             926c0791d59aaff61b2778e8ada3316d
-ya16be              d5b342355bdd9e3197e01b13b7c6301e
-ya16le              d58f154cbbbff85af9917cdb34e819a4
+ya16be              70fa41c32ecaf3370edc38add6096db2
+ya16le              3b2c20f9e80717628ced6c6468507f63
 ya8                 4ad5920716de3d2fbbc49f95adb60345
 yuv410p             c49fd0c55c41185b1580aac77211992b
 yuv411p             c416371077dce13d31bf1dc706111ae7
@@ -170,8 +170,8 @@  yuva444p16be        635fb2720470e0042a7c9b70bf908a2c
 yuva444p16le        6d5bd13f8bb804bd1158c1af732a24e1
 yuva444p9be         3d3e7491192aa4e396015bf8e3755a24
 yuva444p9le         31727b34bc3d5ce726681e90557d39e4
-yuvj411p            70a0abb56a538376aff33c275584b61e
-yuvj420p            83af439c504d41f986adc17059b7fda8
-yuvj422p            daf02a72b26d17d1855b977aa04609fb
-yuvj440p            a4af7a9e3cff6cfc1c8924590ae69807
-yuvj444p            f5937e0183439411673d2ebf8df62e2b
+yuvj411p            e10aea2a7eb813a42b61b1d38a824210
+yuvj420p            f9fdb658ffc44b99c121f2205523a931
+yuvj422p            0cc2d4f6c3d455e1fb708276dab83220
+yuvj440p            3e9d79c6b65d29af67106634335e2c3f
+yuvj444p            7b4325df5cc2f4fdeacaf23a2e2969f8
diff --git a/tests/ref/fate/filter-pixfmts-il b/tests/ref/fate/filter-pixfmts-il
index 4a6f15f074..808dcb3b9b 100644
--- a/tests/ref/fate/filter-pixfmts-il
+++ b/tests/ref/fate/filter-pixfmts-il
@@ -43,16 +43,16 @@  gbrp9le             b310d3cf37f7b41d706155993f8f0584
 gbrpf32be           83722ee41b4397e19bb075ab305147b5
 gbrpf32le           82210a8f9e8708968fa13cf8cf64afe4
 gray                52ae18648161ac43144f5c9cd2127786
-gray10be            8400dec0eefb172849b785d35fc55674
-gray10le            b7d6e49e8d1291f2b0a57d55e9478ef1
-gray12be            c62bc3def5ea217dfb68433905cb9d64
-gray12le            5bd0fef836928e1e19a315782a8c1302
-gray14be            5b3a15c182e2daed65dc39c33fd62735
-gray14le            3573d6870b14256f01800066d36ad862
-gray16be            92c3b09f371b610cc1b6a9776034f4d0
-gray16le            1db278d23a554e01910cedacc6c02521
-gray9be             ed7db5bb2ddc09bc26068c8b858db204
-gray9le             2ec9188f0dcfefef76a09f371d7beb8e
+gray10be            b2c861887056fe39d2fe90379d80e535
+gray10le            f7022c60ad8cb9a9d5f556ad7c7fadaf
+gray12be            c733c108acee8389ae9dfc6262c2bd8b
+gray12le            870d5c2b37d13c25689e1e268749f7a9
+gray14be            230bc18fa759c249573c3dbda2d27173
+gray14le            9dc39323146761e60f5517405e5e40b3
+gray16be            c31bde624d1a2e46eda99a1b982de7aa
+gray16le            46f3aafa3d7d6e7e3504203e6544e19d
+gray9be             1e398c2af40ea86f0db4998793e7a633
+gray9le             43029010dad140bf06d71d5811dc3049
 grayf32be           f36197c9e2ef5c50a995e980c1a37203
 grayf32le           8bf3d295c3ffd53da0e06d0702e7c1ca
 monob               faba75df28033ba7ce3d82ff2a99ee68
@@ -106,8 +106,8 @@  xyz12be             7c7d54c55f136cbbc50b18029f3be0b3
 xyz12le             090ba6b1170baf2b1358b43b971d33b0
 y210le              306ec4238b49dbc8625a97b678ea1c5f
 y212le              d5a2b4677ddb4a3bc3e5cd5cbb20f426
-ya16be              7bc720918bc0132e9717acbde89874e0
-ya16le              61203295a8d39601b841de90f2c9797b
+ya16be              e9591f79c356ca17ec110dc434619a9d
+ya16le              4a28e3c746eb2201d1d62837fbf6b94a
 ya8                 a38d6e288f582f1a04310232ed764afc
 yuv410p             dea1ab8843465adf5b8240b2d98fd85b
 yuv411p             8bf73777a5ff43c126be274245aceff1
@@ -174,10 +174,10 @@  yuva444p16be        97f8cb6ed835c7c5cd2fb112b1e135c7
 yuva444p16le        47170401a8c348d3f05f6530607d066b
 yuva444p9be         d5c0170b41221a9607e6ae586880a383
 yuva444p9le         4948983313f46180666dec85ef30130c
-yuvj411p            91e137f54b2cbbb1c1423c36f031d5f2
-yuvj420p            2b6d8e3b527af5de94963d1bdefe20a9
-yuvj422p            4ce16aa04a5e785b29fd9cdf54bc9ca1
-yuvj440p            36a248ec6f1dc67555ee590651388b15
-yuvj444p            279790fe3c83b07f0a09085d36849c30
+yuvj411p            00a43bbe2be809b40bb4f3d2aab9b002
+yuvj420p            439b952ca598d031958e7c9935665709
+yuvj422p            a2e774f7d6b8d97dd25f230b32fccfa1
+yuvj440p            b631c8e12b68709b225656ee27e9e169
+yuvj444p            d72ec5fb9b911cad30585bf727fceca3
 yuyv422             09af5b85deecfeaef2e00e00fbc12a49
 yvyu422             62c62a80939c34fb7890c0e7791a0321
diff --git a/tests/ref/fate/filter-pixfmts-lut b/tests/ref/fate/filter-pixfmts-lut
index 41c66e2bfc..aa52c08d9f 100644
--- a/tests/ref/fate/filter-pixfmts-lut
+++ b/tests/ref/fate/filter-pixfmts-lut
@@ -13,11 +13,11 @@  gbrp14le            bdfdfd6f36c60497d1cdae791f3cc117
 gbrp16le            df095ef3a20995935cfcaf144afc68b6
 gbrp9le             a8c4e29f4cb627db81ba053e0853e702
 gray                20b14b5e26cd11300ed1249e04082170
-gray10le            8f4140b55e847cc423002b89666db5ea
-gray12le            ea89c02f6b3af49ddaf13364ed33d86d
-gray14le            12bebea325a7822e890675bfc5111f0c
-gray16le            aa10599924fb2440fa12b76e90f57dcb
-gray9le             7d9cc9ad6118674c547a54281d10cf05
+gray10le            4621164b188333c0c196459e93e4d8d0
+gray12le            22af21a88171356565f79f512073c51e
+gray14le            45a1966fcf02649f86960fb4f3622ea3
+gray16le            1734808cf4adb35ac1ac6e63a490af64
+gray9le             9f5079f30687c2eb95b2155fa571fd57
 rgb24               a356171207723a580e7d277078072005
 rgb48le             5c7dd8575836d18c91e09f1915cf9aa9
 rgba                7bc854c2698b78af3e9159a19c2d9d21
@@ -51,7 +51,7 @@  yuva422p            5938a7c7588febb069bd0cd4c447305e
 yuva422p16le        c5ccfdc1a0dc6cb130c07ea61df6f727
 yuva444p            fbcbdc3521d17c702ee521b0893098e4
 yuva444p16le        b7142d28d4d069d7eb019dcaf8b323b1
-yuvj420p            65bc88887c7f06a6221155ca7f9cfca4
-yuvj422p            ff5baffefc8ffe4547653092fd7da200
-yuvj440p            ef3f27270e60ac06582e3ac7c2f3e6fa
-yuvj444p            29378d3fd132c760522c51c3378067b8
+yuvj420p            6ab9a7f52d2b60cbf063467ff086d5ba
+yuvj422p            6efb30df6a364657fa0e841fc46b6853
+yuvj440p            1a57abe3058d40ae78c6a5270a8515c3
+yuvj444p            06cabc5c9bede4ec147d9013ca7a827e
diff --git a/tests/ref/fate/filter-pixfmts-null b/tests/ref/fate/filter-pixfmts-null
index 120129dc1e..7704487f8d 100644
--- a/tests/ref/fate/filter-pixfmts-null
+++ b/tests/ref/fate/filter-pixfmts-null
@@ -43,16 +43,16 @@  gbrp9le             699da3a3b324f3fd001a56aee9683384
 gbrpf32be           ae33c2d738af01ae66a5d2b08a7a60b7
 gbrpf32le           4e3305c619337beeeacc5e6b2f42c793
 gray                188590b1231afd231ea910815aef2b25
-gray10be            d486558ecd2e27afc17930be861f0e4c
-gray10le            917d687103b2adcca7132bfc070ca54a
-gray12be            9685614450f1282be433d2b07234ca1f
-gray12le            2700bd7fb3fea56e54eb03e31d6d4e57
-gray14be            19ed2bf25878980d6f81f6ae699024ec
-gray14le            4b148b26b30040c05dc248a8852f31ac
-gray16be            08d997a3faa25a3db9d6be272d282eef
-gray16le            df65eb804360795e3e38a2701fa9641a
-gray9be             6382a14594a8b68f0ec7de25531f9334
-gray9le             4eb1dda58706436e3b69aef29b0089db
+gray10be            0804e8620fcd78599e3df33cb83652aa
+gray10le            705e51fb783ae8167498d09748e44bd2
+gray12be            2163197b5975c0c2900ac7c3f56f45f1
+gray12le            5bf2ca7795dd0524b253aee20f660e73
+gray14be            dccc8bde352b6c8ae65ca2832a383381
+gray14le            56c9e613b09f00a5940c0bf2e938c02e
+gray16be            47a6889ea2dcff9164888a94cccff4de
+gray16le            07ef57f08f51dcc9918441557b124eb8
+gray9be             2bcfb9b929ed9fa0ed4577ed0500a7eb
+gray9le             0171e3a1dfa892fb881207d43ae54997
 grayf32be           f3bf178835f8146aa09d1da94bba4d8a
 grayf32le           fb6ea85bfbc8cd21c51fc0e110197294
 monob               8b04f859fee6a0be856be184acd7a0b5
@@ -107,8 +107,8 @@  xyz12be             a1ef56bf746d71f59669c28e48fc8450
 xyz12le             831ff03c1ba4ef19374686f16a064d8c
 y210le              0736b017e0814daf38d3350c42796f7a
 y212le              825768be8fe92708ae80be84855066ed
-ya16be              37c07787e544f900c87b853253bfc8dd
-ya16le              e8cab8fad88cba6d285b224d8bf0d4df
+ya16be              44ca11addb5bce91f29946f9045864f8
+ya16le              134a14cd131565cd78da54cba2c31a5f
 ya8                 dbb99fbcdc204aaa1a7397ff561f1a67
 yuv410p             5d4d992a7728431aa4e0700f87fb7fd8
 yuv411p             7e1300e89f5bc07939e2c4a6acbdf267
@@ -175,10 +175,10 @@  yuva444p16be        c80c1899789a6411d0025730efc8f01c
 yuva444p16le        2ed56ea50fafda4d226c9b133755dad8
 yuva444p9be         4903fde22b15d28da90761ac1cfcb1c5
 yuva444p9le         4eeb5988df0740fea720da1e31bbb829
-yuvj411p            e003eefa7e2a20f20d33767775417216
-yuvj420p            8f3d8f1b4577d11082d5ab8a901e048d
-yuvj422p            79d480e99e610112f266c833c6cb3d35
-yuvj440p            f4b18310c7174868fc92579f87460876
-yuvj444p            b161e6d5a941e2a4bb7bc56ef8af623f
+yuvj411p            34971e4718d7f239c82bb42383bd4bff
+yuvj420p            72c49563e5d0ea9233b42b5da905a3c3
+yuvj422p            7de461ca2c4bc5dd90cde9a983493e67
+yuvj440p            2143eb9ad0db319975cffb3572956736
+yuvj444p            67f10f1dcf184059559bc7173e2dd3fc
 yuyv422             435c92283b538aa3d8fa2a020b0afd49
 yvyu422             8436c2a760291cc979e0dd62ab8cede0
diff --git a/tests/ref/fate/filter-pixfmts-pad b/tests/ref/fate/filter-pixfmts-pad
index abf4fceb46..4188ef26c2 100644
--- a/tests/ref/fate/filter-pixfmts-pad
+++ b/tests/ref/fate/filter-pixfmts-pad
@@ -18,11 +18,11 @@  gbrp14le            deb2c3af6b48faa52f6a1f6590a0cdf7
 gbrp16le            a6156d1a37e05ee621b2a343fb158bd6
 gbrp9le             9e827f438e081d334a6cae7e282698b0
 gray                2b9652a8b136316fada371d03ee252bc
-gray10le            0efebad19b92c6d6d915971c17ab55c4
-gray12le            f03613250550d9dc253d46778f6d4bd6
-gray14le            dbac6524c3793469c64fc0ee98d017fd
-gray16le            7b6db54ec8b4d9a8344443a3b3f50377
-gray9le             2d2bc7bd35c48fa61860162cf18a4dcf
+gray10le            47fb6bf7784e8bd70b49f417b2fa28b0
+gray12le            3bf76ed4fa5ba0955ab1157e20b26ef4
+gray14le            c3750188ede607e733065b7f3b17f548
+gray16le            4347c5ca559a06948c1e7e7c2f06657d
+gray9le             99f825e62d5786901dba9abc88878ffb
 nv12                381574979cb04be10c9168540310afad
 nv16                d3a50501d2ea8535489fd5ec49e7866d
 nv21                0fdeb2cdd56cf5a7147dc273456fa217
@@ -43,7 +43,7 @@  rgb48le             ed08db9b1aa50d69b8c3d73db93e390e
 rgba                b157c90191463d34fb3ce77b36c96386
 vuya                44368c0a758ee68e24ce976e3b1b8535
 vuyx                ff637b205b78ee581e393124d0f44f5d
-ya16le              dfc900a8130a7c5e64201557cbaef50a
+ya16le              decf5a0d12ff75bbabd8d8bdf6c5abc0
 ya8                 5d25e9a7975805d3f0dac516a6132b6e
 yuv410p             cb871dcc1e84a7ef1d21f9237b88cf6e
 yuv411p             aec2c1740de9a62db0d41f4dda9121b0
@@ -82,8 +82,8 @@  yuva444p10le        89491ef450706faf23341e401750d907
 yuva444p12le        06c47dba21328165dbb7ebb3da0a2fde
 yuva444p16le        d089b119c8dc964de9af12bfb38f89a0
 yuva444p9le         b824d34ac49a1dc483c772e15310afcd
-yuvj411p            87dbac57b211ab4823c1abbd702f1516
-yuvj420p            1abef62bce65131ca4913eb2006fd860
-yuvj422p            198c57b519e2be14b150889bd7f94898
-yuvj440p            e6533260d197ad15e39319117c57473e
-yuvj444p            26a44748960513783ea676eff409d89a
+yuvj411p            6af7aeffa2cac34c1b46292947a81ef4
+yuvj420p            019c8ac6373600615f5551a48baf09f2
+yuvj422p            32eafd3635b912aff296b5aa8fecbd5a
+yuvj440p            c3ce7ee27f3d77e982a2b94bffab8f41
+yuvj444p            c8f890f2633105ffb45d958ffe788536
diff --git a/tests/ref/fate/filter-pixfmts-pullup b/tests/ref/fate/filter-pixfmts-pullup
index c6ddb3489a..68dfd3c4e2 100644
--- a/tests/ref/fate/filter-pixfmts-pullup
+++ b/tests/ref/fate/filter-pixfmts-pullup
@@ -5,8 +5,8 @@  yuv420p             dba6303cd02cc39cb0db7b546793d565
 yuv422p             d7d3224dd900bb1b96608a28a704360d
 yuv440p             d4c5f20701cfceb4bbf7d75cfcc13514
 yuv444p             7e405274037e7f2ab845d7413a71e16d
-yuvj411p            dc602e7bd3449d16e17e695815616b1e
-yuvj420p            b98ec86eeef2d512aeb2fc4d32ffa656
-yuvj422p            f09c3240bb662477b76ce4da34b4feed
-yuvj440p            8d3ab69e2bbbbbd2f9be323c18922533
-yuvj444p            2dc27560eed5d685354796dcccce853c
+yuvj411p            74be0544b27079ed951ec18cf18544e0
+yuvj420p            33979fc65fcfb52fdfef4f5b50edf25f
+yuvj422p            2503b6825175b63d9d88606687b8cc49
+yuvj440p            c6894fd3a78e2cab6b6d48b6e90d2674
+yuvj444p            dae411a949bd04cfe799da148136bb80
diff --git a/tests/ref/fate/filter-pixfmts-rotate b/tests/ref/fate/filter-pixfmts-rotate
index e4ed81e71a..4a7cbe92bb 100644
--- a/tests/ref/fate/filter-pixfmts-rotate
+++ b/tests/ref/fate/filter-pixfmts-rotate
@@ -30,5 +30,5 @@  yuva444p            459fad5abfd16db9bb6a52761dc74cc1
 yuva444p10le        92f820d3481b7ebcb48b98a73e7b4c90
 yuva444p16le        2ed56ea50fafda4d226c9b133755dad8
 yuva444p9le         4eeb5988df0740fea720da1e31bbb829
-yuvj420p            8f3d8f1b4577d11082d5ab8a901e048d
-yuvj444p            b161e6d5a941e2a4bb7bc56ef8af623f
+yuvj420p            72c49563e5d0ea9233b42b5da905a3c3
+yuvj444p            67f10f1dcf184059559bc7173e2dd3fc
diff --git a/tests/ref/fate/filter-pixfmts-scale b/tests/ref/fate/filter-pixfmts-scale
index 2052d3f2f0..36dff08fef 100644
--- a/tests/ref/fate/filter-pixfmts-scale
+++ b/tests/ref/fate/filter-pixfmts-scale
@@ -43,16 +43,16 @@  gbrp9le             010f7bcd8b2e17065d01a09f0d483218
 gbrpf32be           f3d0cefdf11c861001880772d817aac8
 gbrpf32le           290468205c1c18a0667edfca45061aee
 gray                221201cc7cfc4964eacd8b3e426fd276
-gray10be            9452756d0b37f4f5c7cae7635e22d747
-gray10le            37fd2e1ec6b66410212d39a342e864df
-gray12be            950de5d1b6b943a26c51f6a157e19a14
-gray12le            9c3b154a8bb0a73a3b465892dbc23b36
-gray14be            db9094229f32fb22c5cf06471b9a1cfa
-gray14le            c33308eb8b40142dfd9273249c1cd73a
-gray16be            32891cb0928b1119d8d43a6e1bef0e2b
-gray16le            f96cfb5652b090dad52615930f0ce65f
-gray9be             779dec0c6c2df008128b91622a20daf8
-gray9le             fa87a96ca275f82260358635f838b514
+gray10be            d16a05571246e94b5117004c5276cb7a
+gray10le            0ef4a201ffc7197b316ad47dd81dff45
+gray12be            369e362ecb31db507309589ca4f51d8c
+gray12le            c463d00d75bf491f641aee07c8fefd0e
+gray14be            4756e24785dc8c04017a847abb95e6a9
+gray14le            9df39c65e85228c479766427db23609f
+gray16be            386ac06726336ff35876cb84152dcea1
+gray16le            30504e7d0fdebe7b64c32381399d61c0
+gray9be             82586e4dd7c141493dd445c900a7bdcb
+gray9le             787f5c48ad9008636ba78de2cade71e1
 grayf32be           5e4c715519f53c15f1345df90481e5f5
 grayf32le           2ff1b84023e820307b1ba7a9550115bc
 monob               f01cb0b623357387827902d9d0963435
@@ -107,8 +107,8 @@  xyz12be             c7ba8345998c0141ddc079cdd29b1a40
 xyz12le             95f5d3a0de834cc495c9032a14987cde
 y210le              1c2708a520477f955d1fedf6ca7a41bd
 y212le              39a3c0c843041ad4501b3107dd91ef17
-ya16be              20d4842899d61068f5fb6af478bf26a6
-ya16le              6a05895adce85143ae1c1b3470cb4070
+ya16be              8852f25257c4a0d0d87bdb518611074e
+ya16le              904f4b5c34896a227a773db20a7c0cfb
 ya8                 0a9db5bb4b009de9197eede5e9d19e16
 yuv410p             e8f49b5fb9335b62c074f7f8bb0234fc
 yuv411p             5af32557c93beb482e26e7af693104c6
@@ -175,10 +175,10 @@  yuva444p16be        39ca2e32aa61b210b6c528855d24a16b
 yuva444p16le        cd2e0a001d8175f2204b2eb411c6a801
 yuva444p9be         58add24afbf43ff0ff7079cc1948fb56
 yuva444p9le         077c8cec2c374163d7f7eae27e797bdb
-yuvj411p            d1076331c75ca66bf62497edbd8384f9
-yuvj420p            10390e6dda9cbb4c61fb88bcbb49fc3c
-yuvj422p            996f6672566a4dcd8d272f48f058d49e
-yuvj440p            3d80c9f67f8ef9b2d8a9ae2d37b464a2
-yuvj444p            9f858b9ca3fe949611147414573a904f
+yuvj411p            3477f979cc0065df1a3a644c68fefce3
+yuvj420p            9dda2f9da557a19ce34186bc0a8d80e4
+yuvj422p            0730485df0da481389b3363882adc357
+yuvj440p            592b731e7e1b5d5d70b783e608760fe2
+yuvj444p            e97dba39644b34327d0c40d6d3c208bb
 yuyv422             1704675eff94ad0a03a9a6a3ddf5e0df
 yvyu422             516705a40f43d00e9c41ff47f4f7b802
diff --git a/tests/ref/fate/filter-pixfmts-swapuv b/tests/ref/fate/filter-pixfmts-swapuv
index 676a440699..599113c2a1 100644
--- a/tests/ref/fate/filter-pixfmts-swapuv
+++ b/tests/ref/fate/filter-pixfmts-swapuv
@@ -63,8 +63,8 @@  yuva444p16be        356d72791dfd91861b21630e315d40cb
 yuva444p16le        176591ce074ba8befc5fb279446ca1be
 yuva444p9be         675f0ed3e6572b05f06d9e44611bdff5
 yuva444p9le         bf3ea2bf123a3a1ceedf587682b85cb9
-yuvj411p            361c32e086bd27cf3ded194dc00dc9c5
-yuvj420p            553ac1af571391271d9715e2e8a4a5cc
-yuvj422p            39b613d01cacfcdd9eecf9e0d379a393
-yuvj440p            afed4ad98d6accf5811d439f3a687aa1
-yuvj444p            8de64aff4b7b3895d8cedd67cc10722b
+yuvj411p            2783310ecaee64af7c598cb4dee230ca
+yuvj420p            1e97afbd595bbef1c7459f34777da58e
+yuvj422p            dd42e827d8581b298d2348b7cba30798
+yuvj440p            32a290cae6c0d0699bc214f5ddab58aa
+yuvj444p            fc7948ada4e9849b74d75e422adcc313
diff --git a/tests/ref/fate/filter-pixfmts-tinterlace_cvlpf b/tests/ref/fate/filter-pixfmts-tinterlace_cvlpf
index 99703fa1af..158bae696d 100644
--- a/tests/ref/fate/filter-pixfmts-tinterlace_cvlpf
+++ b/tests/ref/fate/filter-pixfmts-tinterlace_cvlpf
@@ -19,7 +19,7 @@  yuva422p            a8da2806e21a88449079faa7f4303ffa
 yuva422p10le        d2965b5b5a43a7165badaff0718a17d8
 yuva444p            a3f57734d6f72bdf37f8f612ea7cce63
 yuva444p10le        e020512901fd9ac7088898a4e3a8c7c1
-yuvj420p            9f358e311b694bcd01e1a07d1120ade5
-yuvj422p            9a7628a9f1630d35c7176951ddc1b2f6
-yuvj440p            112fe35292c687746ec0c622a42c611b
-yuvj444p            f894438f40950229baa02545daa8812a
+yuvj420p            3de70037f0cd3c26fa45838f896435f3
+yuvj422p            1378b257989a777118af9c21ca8be5f5
+yuvj440p            c3a3502b2410d79a0477af1945070c37
+yuvj444p            11ddd6fdbdfc35b7d7f92123127e42ff
diff --git a/tests/ref/fate/filter-pixfmts-tinterlace_merge b/tests/ref/fate/filter-pixfmts-tinterlace_merge
index fa6151c272..a3437bc4f0 100644
--- a/tests/ref/fate/filter-pixfmts-tinterlace_merge
+++ b/tests/ref/fate/filter-pixfmts-tinterlace_merge
@@ -19,7 +19,7 @@  yuva422p            ca200be80e5bfdb159e1aea57129ed3a
 yuva422p10le        06d4f79ee2ddf31d9fe15af8ca573f46
 yuva444p            9f39c35d6899dcb8b9a9b07c339ca365
 yuva444p10le        b0c54fc3efad73f252d86127407aa1fd
-yuvj420p            844359293bb6ff81549f3fc0090cc587
-yuvj422p            526af049d43974822baa7b48aa1e1098
-yuvj440p            af9285194da8efbc40d93bf8109f9dc5
-yuvj444p            2a3f18b02c17a0c39c6245b8b3639b91
+yuvj420p            de83edccdaa6668e56ea8ae0d3791dcf
+yuvj422p            5296c6e62a45eeeebfb08e6cf5668109
+yuvj440p            ffd0248c6daaa74eb011017c276f25fb
+yuvj444p            8f0dccb7032300a5de282bb03c2b8800
diff --git a/tests/ref/fate/filter-pixfmts-tinterlace_pad b/tests/ref/fate/filter-pixfmts-tinterlace_pad
index 29321e542b..3827942e97 100644
--- a/tests/ref/fate/filter-pixfmts-tinterlace_pad
+++ b/tests/ref/fate/filter-pixfmts-tinterlace_pad
@@ -19,7 +19,7 @@  yuva422p            3426ed1ac9429202d8c29fa62a04d4c3
 yuva422p10le        5c62eaf71afec3f7bc7ae5a327431434
 yuva444p            1b9fc791c7d774b4ba8c9dc836f78cf5
 yuva444p10le        b6161c0f6f5548ba4346a9fda20ea8a8
-yuvj420p            9a872e0c1b3c0b6fe856415696b758bd
-yuvj422p            da3c9ef25528a2ee96746ce44e6969f3
-yuvj440p            a9a5495c6b0e2bf6e561998ea1c356a7
-yuvj444p            085214844e83ad47b4f33303db0ebee6
+yuvj420p            eaa755069abd049f614a217f749c3980
+yuvj422p            b15663197a5efbd7bcf141eb9cfd6fcb
+yuvj440p            76920c27ebb8e76a159c2bb704b10151
+yuvj444p            ba7b8bf2e737d6bcb51dc9722e33c703
diff --git a/tests/ref/fate/filter-pixfmts-tinterlace_vlpf b/tests/ref/fate/filter-pixfmts-tinterlace_vlpf
index 5a5f80b115..ce8143b781 100644
--- a/tests/ref/fate/filter-pixfmts-tinterlace_vlpf
+++ b/tests/ref/fate/filter-pixfmts-tinterlace_vlpf
@@ -19,7 +19,7 @@  yuva422p            ef8fdbe910d68e88e98227b0e99fb5a6
 yuva422p10le        257a4aec41f9b5412179272d8a7fb6f7
 yuva444p            3662eadd5f61a6edbc9d715ea8591415
 yuva444p10le        0905cf5b7f42c11be3f0486a66533c71
-yuvj420p            14c4390b319c5d679184503309060ac3
-yuvj422p            bbe00a26526931b72a024febe1cd6b90
-yuvj440p            f654cf28b7879c6a6c950c3cb9612580
-yuvj444p            c162a4fe7a665f4abf257443703f0d72
+yuvj420p            524c80c1d33cf682316d4a2d210578c8
+yuvj422p            18c7a384e8bb945cc3a478b17d30b764
+yuvj440p            1e0d6e5e95d9fe99d39e8d71a0fa115d
+yuvj444p            1fae347423c97a81cc10ce67ac1c0456
diff --git a/tests/ref/fate/filter-pixfmts-transpose b/tests/ref/fate/filter-pixfmts-transpose
index 0a395f7e71..36379e9bb8 100644
--- a/tests/ref/fate/filter-pixfmts-transpose
+++ b/tests/ref/fate/filter-pixfmts-transpose
@@ -43,16 +43,16 @@  gbrp9le             a5301e978f68b29bfc613b2462ec4888
 gbrpf32be           b90d6189e71afd6ec1f379489884cc8e
 gbrpf32le           48dee2c9cee8ac6582492fd1c7acb183
 gray                c5f8bc6636fd15dbc57deb4bba1e7379
-gray10be            48b421da79c195fd91dffb8fca79a8a2
-gray10le            7774e3296916b896afa46f626334a280
-gray12be            89f1c4b7821b771f6d967f9db871f8ef
-gray12le            43d392c3dcbd79b47cce31f2006c5050
-gray14be            5e2d1eb84d6d375502b3210d572d7433
-gray14le            6114774e9d07b08ec52fabaf6d0ee85a
-gray16be            4aef307021a91b1de67f1d4381a39132
-gray16le            76f2afe156edca7ae05cfa4e5867126e
-gray9be             2c425fa532c940d226822da8b3592310
-gray9le             bcc575942910b3c72eaa72e8794f3acd
+gray10be            502e8c53160bb81e319f7f03f3d7fba7
+gray10le            0fe4b6d29e7602bb9e49a1cd6c32cf86
+gray12be            c7d7eac33931374348a0337d324c3128
+gray12le            eebfb191ab4ba2a967e8bed120402b09
+gray14be            009e0b4b4e9451b965fccfe5e7cd6538
+gray14le            8a6ca251b3508829bdd8471f05fb3e77
+gray16be            b1810df6c6d9503c4c3199f11329498d
+gray16le            d2a227ad4fbd39fd366ecd73d73095f6
+gray9be             6ef99621245fcc00806e520a0a4419d4
+gray9le             6bbd43b7d385b5c3e299bee18a88f9e2
 grayf32be           823288e1ec497bb1f22c070e502e5272
 grayf32le           6e9ec0e1cac3617f3041e681afd2c575
 nv12                1965e3826144686748f2f6b516fca5ba
@@ -94,8 +94,8 @@  xv30le              b1ac5a12f46d32c70acb63f89838ab76
 xv36le              a819ca57db4187a3effe2bd5e374e932
 xyz12be             68e5cba640f6e4ef72dff950e88b5342
 xyz12le             8b6b6a6db4d7561e80db88ccaecce7a9
-ya16be              3e161cb5f225922a80fefdc9cc02a4f9
-ya16le              5b3f6c06850b1678cbfc2c79cc448547
+ya16be              6098f7d2ede0aab6b2d93d2b4f4d915a
+ya16le              1fae63e3e320ba9e6c12c29a48c44eff
 ya8                 d4b7a62f80681fa44c977ff3a64f4ce4
 yuv410p             4c0143429edd30aa01493447c90132ea
 yuv420p             2fa5b2201c75034206cc20e2c6134aed
@@ -136,5 +136,5 @@  yuva444p16be        9fd2f00ea9bef8e488228bc0b47b28cb
 yuva444p16le        ae9fd8d1baea0f8626b963816d667d2d
 yuva444p9be         4ce11ae57780f74c78cdd5c06be4bded
 yuva444p9le         1b9cc85fd6ab0c7e240915a99e98d1c1
-yuvj420p            9603b8dd64daec41f0514197989c2b19
-yuvj444p            66ec9b3219df9eb2c1315d293602ab42
+yuvj420p            2cea5eeece3a96e582a08d5cd847bc60
+yuvj444p            f8e14f5cbfdb786af97f42b2c88d1df0
diff --git a/tests/ref/fate/filter-pixfmts-vflip b/tests/ref/fate/filter-pixfmts-vflip
index 5ba28917a7..169716f53a 100644
--- a/tests/ref/fate/filter-pixfmts-vflip
+++ b/tests/ref/fate/filter-pixfmts-vflip
@@ -43,16 +43,16 @@  gbrp9le             26e103a4ab99fb3f58667df490997a36
 gbrpf32be           3eaa2d475754c2b4ae3c59dbdb7ccd84
 gbrpf32le           0267e215c3d11ae22414c3e29e665896
 gray                41811422d5819ed69389357294384c10
-gray10be            52710b3ab3ccf6101d28109f58cd48c4
-gray10le            9c432a163f0cfe9ee2a4b72ae8a7c307
-gray12be            7423ce8a77fbc40c5d4776eb28fec60a
-gray12le            808158633559d7deebc7dac2d79e88f8
-gray14be            68b14e31a089d6bd1fa2082d66d004da
-gray14le            3842b874a9b05ce2ae3cad9ef7131013
-gray16be            29f24ba7cb0fc4fd2ae78963d008f6e6
-gray16le            a37e9c4ea76e8eeddc2af8f600ba2c10
-gray9be             dda11d4ffd62b414012ffc4667fb4971
-gray9le             159bf6482d217b2b8276eb2216cd7a09
+gray10be            8a49315bcba5cdaffe7ef55cdb5f5148
+gray10le            dd71c7da4d205a081f54e46e76b6a1ed
+gray12be            ca43b3f79c517a41c19164c417baa28d
+gray12le            86166fd2485f65867eb8be3b5447e921
+gray14be            57bde02df9aa6156f973c9e0ab60663a
+gray14le            2b76ab2c6de4a9a1b4e5d49e8b537a6d
+gray16be            8e0f23aa0e5736f4ae8e08273201c854
+gray16le            25122a3f501e454affd3e99bac82ce51
+gray9be             cd524d242f2ac6ea39ef4bb85c9691f3
+gray9le             8a3264fc4192fcd9ca2008ca4782a451
 grayf32be           c1ba5943a0d24d70e6a280f37e4f4593
 grayf32le           8e6c048a5b3b8b26d3a5ddfce255f3f6
 monob               7810c4857822ccfc844d78f5e803269a
@@ -107,8 +107,8 @@  xyz12be             810644e008deb231850d779aaa27cc7e
 xyz12le             829701db461b43533cf9241e0743bc61
 y210le              9544c81f8e1fc95e9fa4009dbecfea25
 y212le              c801725ae31e3b8f5be269359d49f191
-ya16be              55b1dbbe4d56ed0d22461685ce85520d
-ya16le              d5bf02471823a16dc523a46cace0101a
+ya16be              00ce554a8fae06a9e00ffb4913ae5590
+ya16le              319693c0834d9cd18b7e8f10ec6d0764
 ya8                 4299c6ca3b470a7d8a420e26eb485b1d
 yuv410p             c7adfe96c8e043a6cb9290c39bf8063c
 yuv411p             3fce29db403a25f81be39e01aaf6ff3a
@@ -175,10 +175,10 @@  yuva444p16be        b8801dccf64b3eadc2a5b5db67ae0b0f
 yuva444p16le        8e72ae66754badf5d1eeb094e6bf0ddc
 yuva444p9be         bcd845394351ca6d15e947342802957d
 yuva444p9le         7727a93765ed38dfd25e3d6b7a38fa63
-yuvj411p            260f51b360dc00b2222f4cb39fa05e36
-yuvj420p            fab4394239b08bdb7638215a42d56eaf
-yuvj422p            0309c2b34aa4d74f58048fe320a02b83
-yuvj440p            f5e3a92fa46e57e2c613fc9aaad18e9d
-yuvj444p            ca4b3662259ba15a6297a44ef64414b7
+yuvj411p            6c5e907ad7ee7dd01d0bcc08e23eea15
+yuvj420p            7fbd7c14b19d456eb94f9057543cf09b
+yuvj422p            4ddc9d92a557525d60537a0dd0ed85f9
+yuvj440p            c16ed3f249f15aedc7e92ebd75a360e9
+yuvj444p            f9ce1c46d7fa29cb3ab9845206f2ca0f
 yuyv422             8f02b2332fe9bb782f88627c99f32ee8
 yvyu422             bd8cb985c2e1f9c32dc6b865bdf20637
diff --git a/tests/ref/fate/fitsenc-gray b/tests/ref/fate/fitsenc-gray
index 46eb76c43b..9948c8198e 100644
--- a/tests/ref/fate/fitsenc-gray
+++ b/tests/ref/fate/fitsenc-gray
@@ -4,7 +4,7 @@ 
 #dimensions 0: 72x36
 #sar 0: 0/1
 0,          0,          0,        1,     2880, 0xd2d83752
-0,          1,          1,        1,     2880, 0x77246e79
+0,          1,          1,        1,     2880, 0x496b6e6a
 0,          2,          2,        1,     2880, 0xdf480c1f
 0,          3,          3,        1,     2880, 0x559247a9
 0,          4,          4,        1,     2880, 0xc3df2cc4
diff --git a/tests/ref/fate/fitsenc-gray16be b/tests/ref/fate/fitsenc-gray16be
index ec4e0efd3c..61f82c7cd5 100644
--- a/tests/ref/fate/fitsenc-gray16be
+++ b/tests/ref/fate/fitsenc-gray16be
@@ -3,8 +3,8 @@ 
 #codec_id 0: fits
 #dimensions 0: 72x36
 #sar 0: 0/1
-0,          0,          0,        1,     5760, 0x317ba180
-0,          1,          1,        1,     5760, 0x439c9e40
-0,          2,          2,        1,     5760, 0x6136ff8f
-0,          3,          3,        1,     5760, 0x2c331324
-0,          4,          4,        1,     5760, 0x2f0816c1
+0,          0,          0,        1,     5760, 0xca17f406
+0,          1,          1,        1,     5760, 0x710f524b
+0,          2,          2,        1,     5760, 0xef5909b1
+0,          3,          3,        1,     5760, 0x1eea9780
+0,          4,          4,        1,     5760, 0x405f3732
diff --git a/tests/ref/fate/gifenc-gray b/tests/ref/fate/gifenc-gray
index 324aff49bd..fcfd016ede 100644
--- a/tests/ref/fate/gifenc-gray
+++ b/tests/ref/fate/gifenc-gray
@@ -3,22 +3,22 @@ 
 #codec_id 0: gif
 #dimensions 0: 217x217
 #sar 0: 0/1
-0,          0,          0,        1,     1368, 0x6cf0befd
+0,          0,          0,        1,     1365, 0x2d6ebb8e
 0,          1,          1,        1,      158, 0xcd173bb4, F=0x0
-0,          2,          2,        1,      163, 0x4f7a451d, F=0x0
+0,          2,          2,        1,      163, 0x71594579, F=0x0
 0,          3,          3,        1,      152, 0x17723839, F=0x0
-0,          4,          4,        1,      160, 0x67854056, F=0x0
-0,          5,          5,        1,      144, 0x0dc43ead, F=0x0
-0,          6,          6,        1,      142, 0xb0d73867, F=0x0
-0,          7,          7,        1,      137, 0xd8f333a1, F=0x0
-0,          8,          8,        1,      131, 0x32f93270, F=0x0
+0,          4,          4,        1,      161, 0x27b041b0, F=0x0
+0,          5,          5,        1,      146, 0x94483995, F=0x0
+0,          6,          6,        1,      144, 0xdd853755, F=0x0
+0,          7,          7,        1,      139, 0x4f6535f4, F=0x0
+0,          8,          8,        1,      131, 0x247b3196, F=0x0
 0,          9,          9,        1,      131, 0xf27b2e93, F=0x0
-0,         10,         10,        1,      158, 0x152842d2, F=0x0
-0,         11,         11,        1,      142, 0x12733116, F=0x0
-0,         12,         12,        1,      142, 0x28f03160, F=0x0
+0,         10,         10,        1,      157, 0xc92f41c8, F=0x0
+0,         11,         11,        1,      144, 0x0ec836d2, F=0x0
+0,         12,         12,        1,      141, 0x05913882, F=0x0
 0,         13,         13,        1,      131, 0x038d2dda, F=0x0
-0,         14,         14,        1,      135, 0xb96c33a3, F=0x0
-0,         15,         15,        1,      127, 0x4cbf2d59, F=0x0
+0,         14,         14,        1,      140, 0x2a3d33a3, F=0x0
+0,         15,         15,        1,      125, 0x3b2c2b94, F=0x0
 0,         16,         16,        1,      146, 0xff013760, F=0x0
 0,         17,         17,        1,      148, 0xa14d3c03, F=0x0
 0,         18,         18,        1,      130, 0x139430b3, F=0x0
@@ -29,60 +29,60 @@ 
 0,         23,         23,        1,      132, 0x3fdc3311, F=0x0
 0,         24,         24,        1,      130, 0x84c2330a, F=0x0
 0,         25,         25,        1,      130, 0x9c0033f1, F=0x0
-0,         26,         26,        1,      131, 0x62eb32f5, F=0x0
-0,         27,         27,        1,      126, 0x326e328e, F=0x0
-0,         28,         28,        1,      167, 0x8c8f4674, F=0x0
-0,         29,         29,        1,      148, 0x340d32d5, F=0x0
-0,         30,         30,        1,      171, 0xac2549fa, F=0x0
+0,         26,         26,        1,      130, 0xfeed352c, F=0x0
+0,         27,         27,        1,      127, 0x540532ff, F=0x0
+0,         28,         28,        1,      160, 0x6bf6414c, F=0x0
+0,         29,         29,        1,      149, 0x61bc32aa, F=0x0
+0,         30,         30,        1,      172, 0xa5c24c7f, F=0x0
 0,         31,         31,        1,      150, 0xe77535b1, F=0x0
-0,         32,         32,        1,      178, 0x2c0b4c3a, F=0x0
+0,         32,         32,        1,      179, 0xf1754ed9, F=0x0
 0,         33,         33,        1,      154, 0xe99137bb, F=0x0
-0,         34,         34,        1,      140, 0x525535c1, F=0x0
-0,         35,         35,        1,      121, 0xdfdc2d02, F=0x0
-0,         36,         36,        1,      140, 0x4db8345b, F=0x0
+0,         34,         34,        1,      137, 0xe2313733, F=0x0
+0,         35,         35,        1,      119, 0x85792b3f, F=0x0
+0,         36,         36,        1,      139, 0x2df935be, F=0x0
 0,         37,         37,        1,      128, 0x32e92f77, F=0x0
-0,         38,         38,        1,      143, 0x06663646, F=0x0
-0,         39,         39,        1,      131, 0xbcef3180, F=0x0
+0,         38,         38,        1,      143, 0x234c388f, F=0x0
+0,         39,         39,        1,      132, 0x1c493292, F=0x0
 0,         40,         40,        1,      127, 0xa8b92f17, F=0x0
 0,         41,         41,        1,      127, 0xc88e300a, F=0x0
 0,         42,         42,        1,      128, 0x2b3932e6, F=0x0
-0,         43,         43,        1,      122, 0x89332dc5, F=0x0
-0,         44,         44,        1,      133, 0x2b1d37ee, F=0x0
-0,         45,         45,        1,      125, 0x4c5e32ab, F=0x0
+0,         43,         43,        1,      123, 0x9c572c65, F=0x0
+0,         44,         44,        1,      128, 0xadb733f9, F=0x0
+0,         45,         45,        1,      124, 0x1269318f, F=0x0
 0,         46,         46,        1,      124, 0x83122eaa, F=0x0
-0,         47,         47,        1,      132, 0xa3953564, F=0x0
+0,         47,         47,        1,      132, 0xa51b3553, F=0x0
 0,         48,         48,        1,      125, 0xae672fd9, F=0x0
-0,         49,         49,        1,      143, 0xd5d8390e, F=0x0
-0,         50,         50,        1,      139, 0xebab3726, F=0x0
-0,         51,         51,        1,      130, 0x4c9b358b, F=0x0
-0,         52,         52,        1,      130, 0x14993609, F=0x0
-0,         53,         53,        1,      132, 0x2ced3637, F=0x0
-0,         54,         54,        1,      134, 0xb27f3881, F=0x0
-0,         55,         55,        1,      125, 0x0402336b, F=0x0
-0,         56,         56,        1,      117, 0xf8a7310f, F=0x0
-0,         57,         57,        1,      128, 0x07752f60, F=0x0
-0,         58,         58,        1,      128, 0xf4d430da, F=0x0
-0,         59,         59,        1,      130, 0xbf9733aa, F=0x0
+0,         49,         49,        1,      140, 0x3fd237ec, F=0x0
+0,         50,         50,        1,      141, 0xc4503a2e, F=0x0
+0,         51,         51,        1,      130, 0x43ce3420, F=0x0
+0,         52,         52,        1,      127, 0xe52431e5, F=0x0
+0,         53,         53,        1,      133, 0x56113690, F=0x0
+0,         54,         54,        1,      131, 0xe14f39c8, F=0x0
+0,         55,         55,        1,      125, 0x7d673199, F=0x0
+0,         56,         56,        1,      118, 0x8ef72ff1, F=0x0
+0,         57,         57,        1,      126, 0xdf3c3244, F=0x0
+0,         58,         58,        1,      127, 0xe3b631b7, F=0x0
+0,         59,         59,        1,      130, 0xc94b34d2, F=0x0
 0,         60,         60,        1,      124, 0x199f2f0e, F=0x0
 0,         61,         61,        1,      127, 0x84ff32b6, F=0x0
 0,         62,         62,        1,      124, 0x8d63305e, F=0x0
 0,         63,         63,        1,      127, 0x7d6130f4, F=0x0
 0,         64,         64,        1,      126, 0x78c83176, F=0x0
-0,         65,         65,        1,      145, 0x3ec33e58, F=0x0
-0,         66,         66,        1,      157, 0xb5764127, F=0x0
-0,         67,         67,        1,      123, 0xd9bd309d, F=0x0
-0,         68,         68,        1,      139, 0x93bc3ce8, F=0x0
-0,         69,         69,        1,      123, 0x67813058, F=0x0
-0,         70,         70,        1,      108, 0x176e2b80, F=0x0
+0,         65,         65,        1,      146, 0xb4ba42b3, F=0x0
+0,         66,         66,        1,      158, 0xddae40f3, F=0x0
+0,         67,         67,        1,      122, 0xf5ad31fa, F=0x0
+0,         68,         68,        1,      139, 0x22953aab, F=0x0
+0,         69,         69,        1,      123, 0x697a3097, F=0x0
+0,         70,         70,        1,      109, 0x07c62b00, F=0x0
 0,         71,         71,        1,      117, 0x2ab12db9, F=0x0
 0,         72,         72,        1,      128, 0xb52130fe, F=0x0
 0,         73,         73,        1,      124, 0x62102d4e, F=0x0
 0,         74,         74,        1,      114, 0x186f2dc7, F=0x0
 0,         75,         75,        1,      104, 0x74ec2761, F=0x0
 0,         76,         76,        1,      107, 0x9ba32643, F=0x0
-0,         77,         77,        1,      127, 0xa8ef3544, F=0x0
+0,         77,         77,        1,      130, 0xc72d31d2, F=0x0
 0,         78,         78,        1,      127, 0xcd7e3051, F=0x0
-0,         79,         79,        1,      221, 0x9d035e74, F=0x0
+0,         79,         79,        1,      218, 0xaee05fb4, F=0x0
 0,         80,         80,        1,      217, 0x99d45fbc, F=0x0
 0,         81,         81,        1,      128, 0xc9522cfc, F=0x0
 0,         82,         82,        1,      127, 0x934f3004, F=0x0
@@ -95,70 +95,70 @@ 
 0,         89,         89,        1,      127, 0x53f73452, F=0x0
 0,         90,         90,        1,      123, 0xc54931ba, F=0x0
 0,         91,         91,        1,      170, 0x3055476c, F=0x0
-0,         92,         92,        1,      132, 0xc6e431a9, F=0x0
-0,         93,         93,        1,      124, 0x00e02e2c, F=0x0
-0,         94,         94,        1,       92, 0x838f2429, F=0x0
+0,         92,         92,        1,      130, 0x6f21315d, F=0x0
+0,         93,         93,        1,      125, 0x9c7d308e, F=0x0
+0,         94,         94,        1,       92, 0xa7fa2459, F=0x0
 0,         95,         95,        1,      184, 0xcee75528, F=0x0
-0,         96,         96,        1,      145, 0xcbb533f9, F=0x0
-0,         97,         97,        1,      187, 0x025b53b3, F=0x0
-0,         98,         98,        1,      158, 0x73dc3de6, F=0x0
+0,         96,         96,        1,      146, 0xae0e33d0, F=0x0
+0,         97,         97,        1,      194, 0x4a955ccc, F=0x0
+0,         98,         98,        1,      155, 0x95c63de8, F=0x0
 0,         99,         99,        1,      148, 0x489e3a52, F=0x0
-0,        100,        100,        1,      137, 0xf4c23446, F=0x0
-0,        101,        101,        1,      154, 0xc7eb3a4c, F=0x0
-0,        102,        102,        1,      141, 0x175d328b, F=0x0
-0,        103,        103,        1,      198, 0x22615c9f, F=0x0
-0,        104,        104,        1,      167, 0x9f3c40f0, F=0x0
-0,        105,        105,        1,      196, 0x66495290, F=0x0
-0,        106,        106,        1,      171, 0x10b14318, F=0x0
-0,        107,        107,        1,      152, 0x0e8538ba, F=0x0
-0,        108,        108,        1,      144, 0xa7e83928, F=0x0
-0,        109,        109,        1,      158, 0x2b6f3bb5, F=0x0
-0,        110,        110,        1,      142, 0x242d3ac1, F=0x0
-0,        111,        111,        1,      206, 0xf7935cd2, F=0x0
-0,        112,        112,        1,      177, 0xc96a46b4, F=0x0
-0,        113,        113,        1,      218, 0x96145d0c, F=0x0
-0,        114,        114,        1,      182, 0xdb8e4b9e, F=0x0
-0,        115,        115,        1,      145, 0x58483725, F=0x0
-0,        116,        116,        1,      130, 0xe26b33a3, F=0x0
-0,        117,        117,        1,      160, 0x162d3c34, F=0x0
-0,        118,        118,        1,      145, 0x77cd3b1f, F=0x0
+0,        100,        100,        1,      136, 0x3cde3057, F=0x0
+0,        101,        101,        1,      154, 0xcbf43b1f, F=0x0
+0,        102,        102,        1,      140, 0x13e43414, F=0x0
+0,        103,        103,        1,      196, 0x59fc5aa4, F=0x0
+0,        104,        104,        1,      163, 0x0ae93def, F=0x0
+0,        105,        105,        1,      197, 0x08495215, F=0x0
+0,        106,        106,        1,      170, 0xc227425f, F=0x0
+0,        107,        107,        1,      152, 0x0c5f38af, F=0x0
+0,        108,        108,        1,      142, 0x5b1436e4, F=0x0
+0,        109,        109,        1,      160, 0x911a3c1e, F=0x0
+0,        110,        110,        1,      141, 0x56ab349c, F=0x0
+0,        111,        111,        1,      207, 0x47ec5d5f, F=0x0
+0,        112,        112,        1,      176, 0x74e34896, F=0x0
+0,        113,        113,        1,      220, 0xb5435dc3, F=0x0
+0,        114,        114,        1,      185, 0x7a894edb, F=0x0
+0,        115,        115,        1,      144, 0xebef358b, F=0x0
+0,        116,        116,        1,      130, 0xb415324f, F=0x0
+0,        117,        117,        1,      159, 0xc83e3aa3, F=0x0
+0,        118,        118,        1,      145, 0x541b3a61, F=0x0
 0,        119,        119,        1,      164, 0xfd024449, F=0x0
-0,        120,        120,        1,      148, 0x68293a64, F=0x0
-0,        121,        121,        1,      187, 0x8643475d, F=0x0
+0,        120,        120,        1,      145, 0xa5f83b96, F=0x0
+0,        121,        121,        1,      185, 0x03f046a4, F=0x0
 0,        122,        122,        1,      124, 0xe904324b, F=0x0
 0,        123,        123,        1,      126, 0xb3482fed, F=0x0
 0,        124,        124,        1,      131, 0x60183155, F=0x0
-0,        125,        125,        1,      133, 0xf592319f, F=0x0
-0,        126,        126,        1,      202, 0xb53c5af2, F=0x0
+0,        125,        125,        1,      134, 0x56f03273, F=0x0
+0,        126,        126,        1,      205, 0x2a6e626e, F=0x0
 0,        127,        127,        1,      130, 0xe2503351, F=0x0
-0,        128,        128,        1,      132, 0x2c1a3433, F=0x0
+0,        128,        128,        1,      131, 0x182334ce, F=0x0
 0,        129,        129,        1,      141, 0x772f36f2, F=0x0
 0,        130,        130,        1,      134, 0x5f2f3838, F=0x0
-0,        131,        131,        1,      216, 0x659c5fca, F=0x0
+0,        131,        131,        1,      216, 0xe33f62a0, F=0x0
 0,        132,        132,        1,      139, 0x4876362d, F=0x0
-0,        133,        133,        1,      122, 0x96d13129, F=0x0
+0,        133,        133,        1,      123, 0xe7313384, F=0x0
 0,        134,        134,        1,      137, 0x875238ec, F=0x0
 0,        135,        135,        1,      128, 0x953e3481, F=0x0
-0,        136,        136,        1,      172, 0x6390470d, F=0x0
-0,        137,        137,        1,      253, 0xe4e37282, F=0x0
+0,        136,        136,        1,      171, 0x27f046be, F=0x0
+0,        137,        137,        1,      260, 0xdd5678d7, F=0x0
 0,        138,        138,        1,      223, 0xca0060e6, F=0x0
 0,        139,        139,        1,      233, 0x20d96471, F=0x0
 0,        140,        140,        1,      131, 0x07302c8c, F=0x0
 0,        141,        141,        1,      132, 0x808b30dd, F=0x0
 0,        142,        142,        1,      133, 0xa91231c3, F=0x0
-0,        143,        143,        1,      130, 0x9a3a33d8, F=0x0
+0,        143,        143,        1,      131, 0xcca134de, F=0x0
 0,        144,        144,        1,      232, 0x00826277, F=0x0
 0,        145,        145,        1,      247, 0x2edf6c06, F=0x0
-0,        146,        146,        1,      135, 0xd47b35de, F=0x0
-0,        147,        147,        1,      134, 0xc9c0330d, F=0x0
-0,        148,        148,        1,      132, 0x2d0e3263, F=0x0
-0,        149,        149,        1,      134, 0x5bd737ba, F=0x0
-0,        150,        150,        1,      131, 0x67223298, F=0x0
-0,        151,        151,        1,      125, 0xf483315a, F=0x0
-0,        152,        152,        1,      127, 0xb83e31a0, F=0x0
+0,        146,        146,        1,      134, 0x9b8c3501, F=0x0
+0,        147,        147,        1,      137, 0x11a734bd, F=0x0
+0,        148,        148,        1,      133, 0x44f733c9, F=0x0
+0,        149,        149,        1,      137, 0xceb7375b, F=0x0
+0,        150,        150,        1,      128, 0x204232ef, F=0x0
+0,        151,        151,        1,      125, 0x87f8304e, F=0x0
+0,        152,        152,        1,      128, 0x5b4232b0, F=0x0
 0,        153,        153,        1,      125, 0x2dc033ab, F=0x0
-0,        154,        154,        1,      157, 0x438344e2, F=0x0
-0,        155,        155,        1,      135, 0xd01739e4, F=0x0
+0,        154,        154,        1,      158, 0x07fe453b, F=0x0
+0,        155,        155,        1,      135, 0xc73c392f, F=0x0
 0,        156,        156,        1,      121, 0x834a3276, F=0x0
 0,        157,        157,        1,      136, 0x243b3b8a, F=0x0
 0,        158,        158,        1,      119, 0x47893201, F=0x0
@@ -166,10 +166,10 @@ 
 0,        160,        160,        1,      245, 0x68786756, F=0x0
 0,        161,        161,        1,      241, 0xa531647c, F=0x0
 0,        162,        162,        1,      168, 0x5d6a4447, F=0x0
-0,        163,        163,        1,      133, 0x55de34ee, F=0x0
+0,        163,        163,        1,      133, 0x4c5034b1, F=0x0
 0,        164,        164,        1,      139, 0xde613ccd, F=0x0
-0,        165,        165,        1,      239, 0xf26b6ede, F=0x0
-0,        166,        166,        1,      161, 0x6fed41b5, F=0x0
+0,        165,        165,        1,      238, 0xfe9b6adc, F=0x0
+0,        166,        166,        1,      160, 0x3be741b4, F=0x0
 0,        167,        167,        1,      134, 0x011c3786, F=0x0
 0,        168,        168,        1,      121, 0xf0532db8, F=0x0
 0,        169,        169,        1,      133, 0x58b63448, F=0x0
diff --git a/tests/ref/fate/idroq-video-encode b/tests/ref/fate/idroq-video-encode
index f777247efd..725e725c26 100644
--- a/tests/ref/fate/idroq-video-encode
+++ b/tests/ref/fate/idroq-video-encode
@@ -1 +1 @@ 
-6d8303bb56b8da2a63efef323aea235e
+d50d6d32d39b4f787b74e4e10bb6d3d3
diff --git a/tests/ref/fate/jpg-icc b/tests/ref/fate/jpg-icc
index 54ef63c501..a8d56c8b30 100644
--- a/tests/ref/fate/jpg-icc
+++ b/tests/ref/fate/jpg-icc
@@ -1,11 +1,11 @@ 
-0a323df5cdfb9574e329b9831be054a6 *tests/data/fate/jpg-icc.mjpeg
-11010 tests/data/fate/jpg-icc.mjpeg
+5c83d22a628d01c095704f58328f63c9 *tests/data/fate/jpg-icc.mjpeg
+11016 tests/data/fate/jpg-icc.mjpeg
 #tb 0: 1/25
 #media_type 0: video
 #codec_id 0: rawvideo
 #dimensions 0: 128x128
 #sar 0: 1/1
-0,          0,          0,        1,    49152, 0xaac06b42
+0,          0,          0,        1,    49152, 0xea4329bc
 [FRAME]
 media_type=video
 stream_index=0
@@ -19,7 +19,7 @@  best_effort_timestamp_time=0.000000
 duration=1
 duration_time=0.040000
 pkt_pos=0
-pkt_size=11010
+pkt_size=11016
 width=128
 height=128
 crop_top=0
diff --git a/tests/ref/fate/sws-yuv-colorspace b/tests/ref/fate/sws-yuv-colorspace
index bcf3c4b89c..567ba58b28 100644
--- a/tests/ref/fate/sws-yuv-colorspace
+++ b/tests/ref/fate/sws-yuv-colorspace
@@ -3,4 +3,4 @@ 
 #codec_id 0: rawvideo
 #dimensions 0: 352x288
 #sar 0: 0/1
-0,          0,          0,        1,   152064, 0xcbcb97b9
+0,          0,          0,        1,   152064, 0xa0ea302b
diff --git a/tests/ref/fate/sws-yuv-range b/tests/ref/fate/sws-yuv-range
index 5b6f93b225..fe7da35d81 100644
--- a/tests/ref/fate/sws-yuv-range
+++ b/tests/ref/fate/sws-yuv-range
@@ -3,4 +3,4 @@ 
 #codec_id 0: rawvideo
 #dimensions 0: 352x288
 #sar 0: 0/1
-0,          0,          0,        1,   152064, 0xe75c71a9
+0,          0,          0,        1,   152064, 0xd7b70cfe
diff --git a/tests/ref/fate/vvc-conformance-SCALING_A_1 b/tests/ref/fate/vvc-conformance-SCALING_A_1
index 9bbcef5f21..f43b66e2c1 100644
--- a/tests/ref/fate/vvc-conformance-SCALING_A_1
+++ b/tests/ref/fate/vvc-conformance-SCALING_A_1
@@ -3,67 +3,67 @@ 
 #codec_id 0: rawvideo
 #dimensions 0: 416x240
 #sar 0: 0/1
-0,          0,          0,        1,   299520, 0x27dd1b2d
-0,          1,          1,        1,   299520, 0x52e867b2
-0,          2,          2,        1,   299520, 0xa92e81d0
-0,          3,          3,        1,   299520, 0xb426b45b
-0,          4,          4,        1,   299520, 0x193dc7ab
-0,          5,          5,        1,   299520, 0x2de07de7
-0,          6,          6,        1,   299520, 0xddbf3031
-0,          7,          7,        1,   299520, 0xc28a5a6a
-0,          8,          8,        1,   299520, 0x97394e00
-0,          9,          9,        1,   299520, 0xace5f7f1
-0,         10,         10,        1,   299520, 0xcfb8f84d
-0,         11,         11,        1,   299520, 0xb8ef5236
-0,         12,         12,        1,   299520, 0xa5e14ea9
-0,         13,         13,        1,   299520, 0x30d62a71
-0,         14,         14,        1,   299520, 0xb07129e5
-0,         15,         15,        1,   299520, 0x85e9c08d
-0,         16,         16,        1,   299520, 0x068e1753
-0,         17,         17,        1,   299520, 0x2e0bbf9c
-0,         18,         18,        1,   299520, 0xb0213afe
-0,         19,         19,        1,   299520, 0x2c993d36
-0,         20,         20,        1,   299520, 0x79f7d0c0
-0,         21,         21,        1,   299520, 0xa75d835b
-0,         22,         22,        1,   299520, 0x5497fa81
-0,         23,         23,        1,   299520, 0x33fc772c
-0,         24,         24,        1,   299520, 0xd7d9a6bd
-0,         25,         25,        1,   299520, 0xe6b6c262
-0,         26,         26,        1,   299520, 0x2daf6987
-0,         27,         27,        1,   299520, 0x928e5295
-0,         28,         28,        1,   299520, 0x428a392f
-0,         29,         29,        1,   299520, 0xff9714b1
-0,         30,         30,        1,   299520, 0x9f24b36f
-0,         31,         31,        1,   299520, 0x4972405a
-0,         32,         32,        1,   299520, 0xc9acdc15
-0,         33,         33,        1,   299520, 0x6ff81a68
-0,         34,         34,        1,   299520, 0x951265bd
-0,         35,         35,        1,   299520, 0x32e209ec
-0,         36,         36,        1,   299520, 0xee22557b
-0,         37,         37,        1,   299520, 0xaa71222d
-0,         38,         38,        1,   299520, 0x039bd94c
-0,         39,         39,        1,   299520, 0x2dca58d2
-0,         40,         40,        1,   299520, 0x8603c0b2
-0,         41,         41,        1,   299520, 0xf1e77de0
-0,         42,         42,        1,   299520, 0xa84f9f09
-0,         43,         43,        1,   299520, 0xd0719f99
-0,         44,         44,        1,   299520, 0x97c2ef64
-0,         45,         45,        1,   299520, 0x24e44c6b
-0,         46,         46,        1,   299520, 0xf98ee710
-0,         47,         47,        1,   299520, 0x1e9329a0
-0,         48,         48,        1,   299520, 0x36eaab8c
-0,         49,         49,        1,   299520, 0x442bf6cd
-0,         50,         50,        1,   299520, 0xa8060bde
-0,         51,         51,        1,   299520, 0x16a4f18b
-0,         52,         52,        1,   299520, 0x5ea5fd61
-0,         53,         53,        1,   299520, 0x8ff17e20
-0,         54,         54,        1,   299520, 0x97bb99b7
-0,         55,         55,        1,   299520, 0x26387fec
-0,         56,         56,        1,   299520, 0x77bb8af0
-0,         57,         57,        1,   299520, 0xf1efa9ae
-0,         58,         58,        1,   299520, 0xa05e64e5
-0,         59,         59,        1,   299520, 0xb5d66d2a
-0,         60,         60,        1,   299520, 0xeb5b0ecf
-0,         61,         61,        1,   299520, 0xb1175e7d
-0,         62,         62,        1,   299520, 0xc41b6b9c
-0,         63,         63,        1,   299520, 0xc5108eed
+0,          0,          0,        1,   299520, 0xf774c1ce
+0,          1,          1,        1,   299520, 0x934234c5
+0,          2,          2,        1,   299520, 0xc45896b0
+0,          3,          3,        1,   299520, 0xf0ae99e2
+0,          4,          4,        1,   299520, 0x7390a989
+0,          5,          5,        1,   299520, 0xfe75a9d3
+0,          6,          6,        1,   299520, 0x40b32514
+0,          7,          7,        1,   299520, 0xd6326413
+0,          8,          8,        1,   299520, 0x01784546
+0,          9,          9,        1,   299520, 0x0a13eb22
+0,         10,         10,        1,   299520, 0x1982d8a7
+0,         11,         11,        1,   299520, 0x822d42a7
+0,         12,         12,        1,   299520, 0x30095b39
+0,         13,         13,        1,   299520, 0xa55809ae
+0,         14,         14,        1,   299520, 0x8dad2885
+0,         15,         15,        1,   299520, 0xc4c985de
+0,         16,         16,        1,   299520, 0x9f6f14ee
+0,         17,         17,        1,   299520, 0xa4538c1b
+0,         18,         18,        1,   299520, 0x69c2f1b3
+0,         19,         19,        1,   299520, 0x1d85fe95
+0,         20,         20,        1,   299520, 0x4a08a4a8
+0,         21,         21,        1,   299520, 0xfe04785e
+0,         22,         22,        1,   299520, 0x62bc03a0
+0,         23,         23,        1,   299520, 0x840f6273
+0,         24,         24,        1,   299520, 0x11a7b894
+0,         25,         25,        1,   299520, 0x17f4be4e
+0,         26,         26,        1,   299520, 0xc2f16fc9
+0,         27,         27,        1,   299520, 0x96184a3a
+0,         28,         28,        1,   299520, 0x5e602fce
+0,         29,         29,        1,   299520, 0xa6534def
+0,         30,         30,        1,   299520, 0x6851cd6a
+0,         31,         31,        1,   299520, 0x21fd29b1
+0,         32,         32,        1,   299520, 0x3fc3d15e
+0,         33,         33,        1,   299520, 0xc8324156
+0,         34,         34,        1,   299520, 0x6dd882c8
+0,         35,         35,        1,   299520, 0x83cd304f
+0,         36,         36,        1,   299520, 0x3490724d
+0,         37,         37,        1,   299520, 0x4b977534
+0,         38,         38,        1,   299520, 0xfa153316
+0,         39,         39,        1,   299520, 0x88e88599
+0,         40,         40,        1,   299520, 0x5104fdc4
+0,         41,         41,        1,   299520, 0x50b1b8bc
+0,         42,         42,        1,   299520, 0x1c28bfea
+0,         43,         43,        1,   299520, 0xab11fbf2
+0,         44,         44,        1,   299520, 0xc0f74abf
+0,         45,         45,        1,   299520, 0x9736b2d2
+0,         46,         46,        1,   299520, 0x9f08211a
+0,         47,         47,        1,   299520, 0x9a8870af
+0,         48,         48,        1,   299520, 0xa6f514ad
+0,         49,         49,        1,   299520, 0x28bf93c1
+0,         50,         50,        1,   299520, 0x09b5b375
+0,         51,         51,        1,   299520, 0x23fed29a
+0,         52,         52,        1,   299520, 0xea60b7b3
+0,         53,         53,        1,   299520, 0x01d73fba
+0,         54,         54,        1,   299520, 0x92f85b76
+0,         55,         55,        1,   299520, 0x365f2edc
+0,         56,         56,        1,   299520, 0x16842aa0
+0,         57,         57,        1,   299520, 0xdce85111
+0,         58,         58,        1,   299520, 0x442825b2
+0,         59,         59,        1,   299520, 0x0cb820e1
+0,         60,         60,        1,   299520, 0x9bf0a464
+0,         61,         61,        1,   299520, 0x874fed73
+0,         62,         62,        1,   299520, 0xd6bcf3bb
+0,         63,         63,        1,   299520, 0x6fff2203
diff --git a/tests/ref/lavf/gray16be.fits b/tests/ref/lavf/gray16be.fits
index a0526f3db8..2da8055bdf 100644
--- a/tests/ref/lavf/gray16be.fits
+++ b/tests/ref/lavf/gray16be.fits
@@ -1,3 +1,3 @@ 
-262658f437a256cd843db2b401bc20a9 *tests/data/lavf/lavf.gray16be.fits
+4e9e67d04c06fe83a5392f56be39fed8 *tests/data/lavf/lavf.gray16be.fits
 5184000 tests/data/lavf/lavf.gray16be.fits
-tests/data/lavf/lavf.gray16be.fits CRC=0x737e8998
+tests/data/lavf/lavf.gray16be.fits CRC=0x05fd7cc4
diff --git a/tests/ref/lavf/gray16be.pam b/tests/ref/lavf/gray16be.pam
index 1182b83db2..36cc1e7e52 100644
--- a/tests/ref/lavf/gray16be.pam
+++ b/tests/ref/lavf/gray16be.pam
@@ -1,3 +1,3 @@ 
-740eb42157af9e9eed46b70ba6a6cf4d *tests/data/images/gray16be.pam/02.gray16be.pam
+c97bf08c315eb0053fd6e8c13d483da4 *tests/data/images/gray16be.pam/02.gray16be.pam
 202823 tests/data/images/gray16be.pam/02.gray16be.pam
-tests/data/images/gray16be.pam/%02d.gray16be.pam CRC=0x893f10ef
+tests/data/images/gray16be.pam/%02d.gray16be.pam CRC=0xd679c0f0
diff --git a/tests/ref/lavf/gray16be.png b/tests/ref/lavf/gray16be.png
index 4f4ce179d2..48d3b00878 100644
--- a/tests/ref/lavf/gray16be.png
+++ b/tests/ref/lavf/gray16be.png
@@ -1,3 +1,3 @@ 
-6cf54c13aa407b77547cf6dfe23ecba3 *tests/data/images/gray16be.png/02.gray16be.png
-47365 tests/data/images/gray16be.png/02.gray16be.png
-tests/data/images/gray16be.png/%02d.gray16be.png CRC=0x893f10ef
+0e388f5a62d49c0197030c6d87026bca *tests/data/images/gray16be.png/02.gray16be.png
+47171 tests/data/images/gray16be.png/02.gray16be.png
+tests/data/images/gray16be.png/%02d.gray16be.png CRC=0xd679c0f0
diff --git a/tests/ref/lavf/jpg b/tests/ref/lavf/jpg
index 94cee61ad7..1420d46c6c 100644
--- a/tests/ref/lavf/jpg
+++ b/tests/ref/lavf/jpg
@@ -1,3 +1,3 @@ 
-1e7c6d937f21c045e0b238a83f62f3c5 *tests/data/images/jpg/02.jpg
-26037 tests/data/images/jpg/02.jpg
-tests/data/images/jpg/%02d.jpg CRC=0xe3509f33
+64885ae70c3450b50196ce687a672dbe *tests/data/images/jpg/02.jpg
+26062 tests/data/images/jpg/02.jpg
+tests/data/images/jpg/%02d.jpg CRC=0x1c357a3e
diff --git a/tests/ref/lavf/smjpeg b/tests/ref/lavf/smjpeg
index 7547fe34c5..832b8e99a6 100644
--- a/tests/ref/lavf/smjpeg
+++ b/tests/ref/lavf/smjpeg
@@ -1,3 +1,3 @@ 
-f574f78207dee180a04cf7fb8c14d8ee *tests/data/lavf/lavf.smjpeg
-728246 tests/data/lavf/lavf.smjpeg
-tests/data/lavf/lavf.smjpeg CRC=0x54dd6147
+659757345ce01f8a5c4c1373bd073d41 *tests/data/lavf/lavf.smjpeg
+728268 tests/data/lavf/lavf.smjpeg
+tests/data/lavf/lavf.smjpeg CRC=0x29d58fb8
diff --git a/tests/ref/pixfmt/yuvj420p b/tests/ref/pixfmt/yuvj420p
index 47a729ed45..dc524b4b28 100644
--- a/tests/ref/pixfmt/yuvj420p
+++ b/tests/ref/pixfmt/yuvj420p
@@ -1,2 +1,2 @@ 
-e176bd14185788110e055f945de7f95f *tests/data/pixfmt/yuvj420p.yuv
+1bf1ab64d323264f31428164ea50bc12 *tests/data/pixfmt/yuvj420p.yuv
 304128 tests/data/pixfmt/yuvj420p.yuv
diff --git a/tests/ref/pixfmt/yuvj422p b/tests/ref/pixfmt/yuvj422p
index 6ab97d59db..5a8291e13a 100644
--- a/tests/ref/pixfmt/yuvj422p
+++ b/tests/ref/pixfmt/yuvj422p
@@ -1,2 +1,2 @@ 
-472028e46a81c98d9b2477507def4723 *tests/data/pixfmt/yuvj422p.yuv
+641d058a9a1e586c368f08a6d698b297 *tests/data/pixfmt/yuvj422p.yuv
 304128 tests/data/pixfmt/yuvj422p.yuv
diff --git a/tests/ref/pixfmt/yuvj440p b/tests/ref/pixfmt/yuvj440p
index 2beeae52c1..b7710fec07 100644
--- a/tests/ref/pixfmt/yuvj440p
+++ b/tests/ref/pixfmt/yuvj440p
@@ -1,2 +1,2 @@ 
-4d8d402c45d913038d4b725396719111 *tests/data/pixfmt/yuvj440p.yuv
+6480e61c5309b7e967c9e20a129fc824 *tests/data/pixfmt/yuvj440p.yuv
 304128 tests/data/pixfmt/yuvj440p.yuv
diff --git a/tests/ref/pixfmt/yuvj444p b/tests/ref/pixfmt/yuvj444p
index 63fb813d4b..8fe643c6a8 100644
--- a/tests/ref/pixfmt/yuvj444p
+++ b/tests/ref/pixfmt/yuvj444p
@@ -1,2 +1,2 @@ 
-c10442da177c9f1d12be3c53be6fa12c *tests/data/pixfmt/yuvj444p.yuv
+7e5e7f9271f060cb3ca681b8a86c41fa *tests/data/pixfmt/yuvj444p.yuv
 304128 tests/data/pixfmt/yuvj444p.yuv
diff --git a/tests/ref/seek/lavf-jpg b/tests/ref/seek/lavf-jpg
index 545f59da57..78e8255fac 100644
--- a/tests/ref/seek/lavf-jpg
+++ b/tests/ref/seek/lavf-jpg
@@ -1,4 +1,4 @@ 
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size: 25641
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     -1 size: 25633
 ret:-EINVAL    st:-1 flags:0  ts:-1.000000
 ret:-EINVAL    st:-1 flags:1  ts: 1.894167
 ret:-EINVAL    st: 0 flags:0  ts: 0.800000
@@ -6,7 +6,7 @@  ret:-EINVAL    st: 0 flags:1  ts:-0.320000
 ret:-EINVAL    st:-1 flags:0  ts: 2.576668
 ret:-EINVAL    st:-1 flags:1  ts: 1.470835
 ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:     -1 size: 25316
+ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:     -1 size: 25312
 ret:-EINVAL    st: 0 flags:1  ts:-0.760000
 ret:-EINVAL    st:-1 flags:0  ts: 2.153336
 ret:-EINVAL    st:-1 flags:1  ts: 1.047503
@@ -18,7 +18,7 @@  ret:-EINVAL    st: 0 flags:0  ts:-0.480000
 ret:-EINVAL    st: 0 flags:1  ts: 2.400000
 ret:-EINVAL    st:-1 flags:0  ts: 1.306672
 ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:     -1 size: 25788
+ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:     -1 size: 25799
 ret:-EINVAL    st: 0 flags:0  ts:-0.920000
 ret:-EINVAL    st: 0 flags:1  ts: 2.000000
 ret:-EINVAL    st:-1 flags:0  ts: 0.883340
@@ -26,5 +26,5 @@  ret:-EINVAL    st:-1 flags:1  ts:-0.222493
 ret:-EINVAL    st: 0 flags:0  ts: 2.680000
 ret:-EINVAL    st: 0 flags:1  ts: 1.560000
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:     -1 size: 25487
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:     -1 size: 25489
 ret:-EINVAL    st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/vsynth_lena-mjpeg b/tests/ref/seek/vsynth_lena-mjpeg
index 71f798e929..41f0c615ea 100644
--- a/tests/ref/seek/vsynth_lena-mjpeg
+++ b/tests/ref/seek/vsynth_lena-mjpeg
@@ -1,46 +1,46 @@ 
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5652 size: 11209
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5652 size: 11224
 ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5652 size: 11209
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5652 size: 11224
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 592412 size: 14066
+ret: 0         st: 0 flags:1 dts: 1.880000 pts: 1.880000 pos: 592510 size: 14069
 ret: 0         st: 0 flags:0  ts: 0.800000
-ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 232652 size: 12269
+ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos: 232724 size: 12267
 ret:-1         st: 0 flags:1  ts:-0.320000
 ret:-1         st:-1 flags:0  ts: 2.576668
 ret: 0         st:-1 flags:1  ts: 1.470835
-ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 453104 size: 13735
+ret: 0         st: 0 flags:1 dts: 1.480000 pts: 1.480000 pos: 453244 size: 13732
 ret: 0         st: 0 flags:0  ts: 0.360000
-ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 104118 size: 11213
+ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos: 104162 size: 11211
 ret:-1         st: 0 flags:1  ts:-0.760000
 ret:-1         st:-1 flags:0  ts: 2.153336
 ret: 0         st:-1 flags:1  ts: 1.047503
-ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 307404 size: 12723
+ret: 0         st: 0 flags:1 dts: 1.040000 pts: 1.040000 pos: 307478 size: 12725
 ret: 0         st: 0 flags:0  ts:-0.040000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5652 size: 11209
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5652 size: 11224
 ret: 0         st: 0 flags:1  ts: 2.840000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 620564 size: 14125
+ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 620688 size: 14145
 ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 536264 size: 13966
+ret: 0         st: 0 flags:1 dts: 1.720000 pts: 1.720000 pos: 536394 size: 13965
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 184478 size: 11981
+ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos: 184556 size: 11973
 ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5652 size: 11209
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5652 size: 11224
 ret: 0         st: 0 flags:1  ts: 2.400000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 620564 size: 14125
+ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 620688 size: 14145
 ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 398934 size: 13340
+ret: 0         st: 0 flags:1 dts: 1.320000 pts: 1.320000 pos: 399054 size: 13347
 ret: 0         st:-1 flags:1  ts: 0.200839
-ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:  59904 size: 10972
+ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos:  59930 size: 10980
 ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5652 size: 11209
+ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:   5652 size: 11224
 ret: 0         st: 0 flags:1  ts: 2.000000
-ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 620564 size: 14125
+ret: 0         st: 0 flags:1 dts: 1.960000 pts: 1.960000 pos: 620688 size: 14145
 ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 257220 size: 12407
+ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos: 257278 size: 12415
 ret:-1         st:-1 flags:1  ts:-0.222493
 ret:-1         st: 0 flags:0  ts: 2.680000
 ret: 0         st: 0 flags:1  ts: 1.560000
-ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 480710 size: 13831
+ret: 0         st: 0 flags:1 dts: 1.560000 pts: 1.560000 pos: 480846 size: 13843
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 137920 size: 11458
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 137982 size: 11451
 ret:-1         st:-1 flags:1  ts:-0.645825
diff --git a/tests/ref/seek/vsynth_lena-roqvideo b/tests/ref/seek/vsynth_lena-roqvideo
index 50a0a335c7..a10b74c4e5 100644
--- a/tests/ref/seek/vsynth_lena-roqvideo
+++ b/tests/ref/seek/vsynth_lena-roqvideo
@@ -1,4 +1,4 @@ 
-ret: 0         st: 0 flags:0 dts: 0.000000 pts: 0.000000 pos:     24 size: 26814
+ret: 0         st: 0 flags:0 dts: 0.000000 pts: 0.000000 pos:     24 size: 26626
 ret:-1         st:-1 flags:0  ts:-1.000000
 ret:-1         st:-1 flags:1  ts: 1.894167
 ret:-1         st: 0 flags:0  ts: 0.800000
diff --git a/tests/ref/vsynth/vsynth1-amv b/tests/ref/vsynth/vsynth1-amv
index e4652c5c90..0d18974e6f 100644
--- a/tests/ref/vsynth/vsynth1-amv
+++ b/tests/ref/vsynth/vsynth1-amv
@@ -1,4 +1,4 @@ 
-9e155fcedb3b853876e9ea4233971803 *tests/data/fate/vsynth1-amv.avi
-1365500 tests/data/fate/vsynth1-amv.avi
-e38681b9527b6d2531942f8a176a0265 *tests/data/fate/vsynth1-amv.out.rawvideo
-stddev:   10.07 PSNR: 28.06 MAXDIFF:   98 bytes:  7603200/  7603200
+1bd1eeaa3a5d27a3be6e2a549e588763 *tests/data/fate/vsynth1-amv.avi
+1365424 tests/data/fate/vsynth1-amv.avi
+07e3626f8c41d03fe35e11da1664d8bb *tests/data/fate/vsynth1-amv.out.rawvideo
+stddev:   10.07 PSNR: 28.06 MAXDIFF:   95 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth1-mjpeg b/tests/ref/vsynth/vsynth1-mjpeg
index aa441d312a..89ed7dd9c0 100644
--- a/tests/ref/vsynth/vsynth1-mjpeg
+++ b/tests/ref/vsynth/vsynth1-mjpeg
@@ -1,4 +1,4 @@ 
-63ea9bd494e16bad8f3a0c8dbb3dc11e *tests/data/fate/vsynth1-mjpeg.avi
-1391380 tests/data/fate/vsynth1-mjpeg.avi
-9a3b8169c251d19044f7087a95458c55 *tests/data/fate/vsynth1-mjpeg.out.rawvideo
+827f4da674de95b4227aadda8dbdaa77 *tests/data/fate/vsynth1-mjpeg.avi
+1391436 tests/data/fate/vsynth1-mjpeg.avi
+f46e58458ea57495a494650f7153829d *tests/data/fate/vsynth1-mjpeg.out.rawvideo
 stddev:    7.87 PSNR: 30.21 MAXDIFF:   63 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth1-mjpeg-422 b/tests/ref/vsynth/vsynth1-mjpeg-422
index dda3928a4b..095f2b2497 100644
--- a/tests/ref/vsynth/vsynth1-mjpeg-422
+++ b/tests/ref/vsynth/vsynth1-mjpeg-422
@@ -1,4 +1,4 @@ 
-82d8874bfe13f56ec466b206a08a4402 *tests/data/fate/vsynth1-mjpeg-422.avi
-1611832 tests/data/fate/vsynth1-mjpeg-422.avi
-c35eea486c6d72050f4848eab64032b5 *tests/data/fate/vsynth1-mjpeg-422.out.rawvideo
+eb0f7dc02efd5f4ab7ea3c73617801a3 *tests/data/fate/vsynth1-mjpeg-422.avi
+1611674 tests/data/fate/vsynth1-mjpeg-422.avi
+bc62d53cce32a595a0c6e9c318e4ce3e *tests/data/fate/vsynth1-mjpeg-422.out.rawvideo
 stddev:    7.45 PSNR: 30.69 MAXDIFF:   63 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth1-mjpeg-444 b/tests/ref/vsynth/vsynth1-mjpeg-444
index 66a0efcf95..77609c5a45 100644
--- a/tests/ref/vsynth/vsynth1-mjpeg-444
+++ b/tests/ref/vsynth/vsynth1-mjpeg-444
@@ -1,4 +1,4 @@ 
-2dd741cbee9b3499826beca7c7d3b8dc *tests/data/fate/vsynth1-mjpeg-444.avi
-1831614 tests/data/fate/vsynth1-mjpeg-444.avi
-313a4a76af13d5879ea4910107b7ea74 *tests/data/fate/vsynth1-mjpeg-444.out.rawvideo
+bfde676dad356228f77aa319f046db8a *tests/data/fate/vsynth1-mjpeg-444.avi
+1831606 tests/data/fate/vsynth1-mjpeg-444.avi
+c51ee467d03242dfc1e4536b0485d00f *tests/data/fate/vsynth1-mjpeg-444.out.rawvideo
 stddev:    7.37 PSNR: 30.77 MAXDIFF:   63 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth1-mjpeg-huffman b/tests/ref/vsynth/vsynth1-mjpeg-huffman
index e8c3f0fb63..7591c5b393 100644
--- a/tests/ref/vsynth/vsynth1-mjpeg-huffman
+++ b/tests/ref/vsynth/vsynth1-mjpeg-huffman
@@ -1,4 +1,4 @@ 
-63ea9bd494e16bad8f3a0c8dbb3dc11e *tests/data/fate/vsynth1-mjpeg-huffman.avi
-1391380 tests/data/fate/vsynth1-mjpeg-huffman.avi
-9a3b8169c251d19044f7087a95458c55 *tests/data/fate/vsynth1-mjpeg-huffman.out.rawvideo
+827f4da674de95b4227aadda8dbdaa77 *tests/data/fate/vsynth1-mjpeg-huffman.avi
+1391436 tests/data/fate/vsynth1-mjpeg-huffman.avi
+f46e58458ea57495a494650f7153829d *tests/data/fate/vsynth1-mjpeg-huffman.out.rawvideo
 stddev:    7.87 PSNR: 30.21 MAXDIFF:   63 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth1-mjpeg-trell b/tests/ref/vsynth/vsynth1-mjpeg-trell
index cf2a7ff16e..e978c636de 100644
--- a/tests/ref/vsynth/vsynth1-mjpeg-trell
+++ b/tests/ref/vsynth/vsynth1-mjpeg-trell
@@ -1,4 +1,4 @@ 
-d9410fa80c07edbd2a2b44ceb06086ca *tests/data/fate/vsynth1-mjpeg-trell.avi
-1360456 tests/data/fate/vsynth1-mjpeg-trell.avi
-0266b223bdd7928426a951164bb4a366 *tests/data/fate/vsynth1-mjpeg-trell.out.rawvideo
-stddev:    7.68 PSNR: 30.42 MAXDIFF:   62 bytes:  7603200/  7603200
+e097a118dd37b3ab5607278d7b675ea3 *tests/data/fate/vsynth1-mjpeg-trell.avi
+1361112 tests/data/fate/vsynth1-mjpeg-trell.avi
+548de4f6098cbc3d8b65574bb93faf09 *tests/data/fate/vsynth1-mjpeg-trell.out.rawvideo
+stddev:    7.67 PSNR: 30.42 MAXDIFF:   62 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth1-mjpeg-trell-huffman b/tests/ref/vsynth/vsynth1-mjpeg-trell-huffman
index 20ce783a6b..f54b3663f1 100644
--- a/tests/ref/vsynth/vsynth1-mjpeg-trell-huffman
+++ b/tests/ref/vsynth/vsynth1-mjpeg-trell-huffman
@@ -1,4 +1,4 @@ 
-d9410fa80c07edbd2a2b44ceb06086ca *tests/data/fate/vsynth1-mjpeg-trell-huffman.avi
-1360456 tests/data/fate/vsynth1-mjpeg-trell-huffman.avi
-0266b223bdd7928426a951164bb4a366 *tests/data/fate/vsynth1-mjpeg-trell-huffman.out.rawvideo
-stddev:    7.68 PSNR: 30.42 MAXDIFF:   62 bytes:  7603200/  7603200
+e097a118dd37b3ab5607278d7b675ea3 *tests/data/fate/vsynth1-mjpeg-trell-huffman.avi
+1361112 tests/data/fate/vsynth1-mjpeg-trell-huffman.avi
+548de4f6098cbc3d8b65574bb93faf09 *tests/data/fate/vsynth1-mjpeg-trell-huffman.out.rawvideo
+stddev:    7.67 PSNR: 30.42 MAXDIFF:   62 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth1-roqvideo b/tests/ref/vsynth/vsynth1-roqvideo
index 2cca94224b..815728853a 100644
--- a/tests/ref/vsynth/vsynth1-roqvideo
+++ b/tests/ref/vsynth/vsynth1-roqvideo
@@ -1,4 +1,4 @@ 
-8037e62b2707a246e787bb1723b752b9 *tests/data/fate/vsynth1-roqvideo.roq
-102571 tests/data/fate/vsynth1-roqvideo.roq
-9e3bb47e5e9708392d7eba8f944b6920 *tests/data/fate/vsynth1-roqvideo.out.rawvideo
-stddev:    7.75 PSNR: 30.34 MAXDIFF:   88 bytes:  7603200/   760320
+6bf28e056156fcf72957aa59871825e9 *tests/data/fate/vsynth1-roqvideo.roq
+102042 tests/data/fate/vsynth1-roqvideo.roq
+a5e17412ec25917b1fb63c7bbfbfcbb1 *tests/data/fate/vsynth1-roqvideo.out.rawvideo
+stddev:    7.73 PSNR: 30.36 MAXDIFF:   90 bytes:  7603200/   760320
diff --git a/tests/ref/vsynth/vsynth2-amv b/tests/ref/vsynth/vsynth2-amv
index 088b5ce143..d6bd48ec3c 100644
--- a/tests/ref/vsynth/vsynth2-amv
+++ b/tests/ref/vsynth/vsynth2-amv
@@ -1,4 +1,4 @@ 
-a77c55410820d0e0883c76f557774bcf *tests/data/fate/vsynth2-amv.avi
-912552 tests/data/fate/vsynth2-amv.avi
-5b7fe07a366b176e35d2564ecf95ebe9 *tests/data/fate/vsynth2-amv.out.rawvideo
+941ed6b53403451a73927347c62ea64d *tests/data/fate/vsynth2-amv.avi
+912764 tests/data/fate/vsynth2-amv.avi
+d689ffdf1a965dce94086299e2660e6b *tests/data/fate/vsynth2-amv.out.rawvideo
 stddev:    4.91 PSNR: 34.31 MAXDIFF:   71 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-mjpeg b/tests/ref/vsynth/vsynth2-mjpeg
index cf80937dc6..b3954bbb5f 100644
--- a/tests/ref/vsynth/vsynth2-mjpeg
+++ b/tests/ref/vsynth/vsynth2-mjpeg
@@ -1,4 +1,4 @@ 
-9bf00cd3188b7395b798bb10df376243 *tests/data/fate/vsynth2-mjpeg.avi
-792742 tests/data/fate/vsynth2-mjpeg.avi
-2b8c59c59e33d6ca7c85d31c5eeab7be *tests/data/fate/vsynth2-mjpeg.out.rawvideo
+2a959ad89469d88894d03dc9ce83e8b9 *tests/data/fate/vsynth2-mjpeg.avi
+792950 tests/data/fate/vsynth2-mjpeg.avi
+fe498d9edaa947e435e4f353c194ef3d *tests/data/fate/vsynth2-mjpeg.out.rawvideo
 stddev:    4.87 PSNR: 34.37 MAXDIFF:   55 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-mjpeg-422 b/tests/ref/vsynth/vsynth2-mjpeg-422
index b162bb32c7..4978501f35 100644
--- a/tests/ref/vsynth/vsynth2-mjpeg-422
+++ b/tests/ref/vsynth/vsynth2-mjpeg-422
@@ -1,4 +1,4 @@ 
-e37720892c9ee9d02842cc50bf20181e *tests/data/fate/vsynth2-mjpeg-422.avi
-877786 tests/data/fate/vsynth2-mjpeg-422.avi
-4a1b18eeb8b0f3dccc2c0e6a9f8c876d *tests/data/fate/vsynth2-mjpeg-422.out.rawvideo
+67a35df8ef714568db0362f4dce400fb *tests/data/fate/vsynth2-mjpeg-422.avi
+877718 tests/data/fate/vsynth2-mjpeg-422.avi
+7fae296bb4290d09971a629040eac072 *tests/data/fate/vsynth2-mjpeg-422.out.rawvideo
 stddev:    4.69 PSNR: 34.69 MAXDIFF:   55 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-mjpeg-444 b/tests/ref/vsynth/vsynth2-mjpeg-444
index c461e87cbf..6321301571 100644
--- a/tests/ref/vsynth/vsynth2-mjpeg-444
+++ b/tests/ref/vsynth/vsynth2-mjpeg-444
@@ -1,4 +1,4 @@ 
-28c9331da946a4ba76947cef290fe184 *tests/data/fate/vsynth2-mjpeg-444.avi
-1005052 tests/data/fate/vsynth2-mjpeg-444.avi
-6417f5a4be03ca7854f0a1be429a286e *tests/data/fate/vsynth2-mjpeg-444.out.rawvideo
+24e04a6e3b645b3314e522cc6b4d3fb7 *tests/data/fate/vsynth2-mjpeg-444.avi
+1005214 tests/data/fate/vsynth2-mjpeg-444.avi
+fbeca59755dfb2b5e2f2c9781756d634 *tests/data/fate/vsynth2-mjpeg-444.out.rawvideo
 stddev:    4.57 PSNR: 34.93 MAXDIFF:   55 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-mjpeg-huffman b/tests/ref/vsynth/vsynth2-mjpeg-huffman
index 0cf998b4fe..17601e20f8 100644
--- a/tests/ref/vsynth/vsynth2-mjpeg-huffman
+++ b/tests/ref/vsynth/vsynth2-mjpeg-huffman
@@ -1,4 +1,4 @@ 
-9bf00cd3188b7395b798bb10df376243 *tests/data/fate/vsynth2-mjpeg-huffman.avi
-792742 tests/data/fate/vsynth2-mjpeg-huffman.avi
-2b8c59c59e33d6ca7c85d31c5eeab7be *tests/data/fate/vsynth2-mjpeg-huffman.out.rawvideo
+2a959ad89469d88894d03dc9ce83e8b9 *tests/data/fate/vsynth2-mjpeg-huffman.avi
+792950 tests/data/fate/vsynth2-mjpeg-huffman.avi
+fe498d9edaa947e435e4f353c194ef3d *tests/data/fate/vsynth2-mjpeg-huffman.out.rawvideo
 stddev:    4.87 PSNR: 34.37 MAXDIFF:   55 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-mjpeg-trell b/tests/ref/vsynth/vsynth2-mjpeg-trell
index e1acb33d88..993aaca60f 100644
--- a/tests/ref/vsynth/vsynth2-mjpeg-trell
+++ b/tests/ref/vsynth/vsynth2-mjpeg-trell
@@ -1,4 +1,4 @@ 
-a59d99d31d24875161504820d4266e4d *tests/data/fate/vsynth2-mjpeg-trell.avi
-734728 tests/data/fate/vsynth2-mjpeg-trell.avi
-42376126213c73c86b408882e24ba015 *tests/data/fate/vsynth2-mjpeg-trell.out.rawvideo
-stddev:    5.03 PSNR: 34.09 MAXDIFF:   67 bytes:  7603200/  7603200
+d6a09ff8a46c297934496d8089cdd2a2 *tests/data/fate/vsynth2-mjpeg-trell.avi
+734896 tests/data/fate/vsynth2-mjpeg-trell.avi
+8612dfee87e32268f6f533188a097785 *tests/data/fate/vsynth2-mjpeg-trell.out.rawvideo
+stddev:    5.03 PSNR: 34.10 MAXDIFF:   67 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-mjpeg-trell-huffman b/tests/ref/vsynth/vsynth2-mjpeg-trell-huffman
index 36867400d2..de7a029315 100644
--- a/tests/ref/vsynth/vsynth2-mjpeg-trell-huffman
+++ b/tests/ref/vsynth/vsynth2-mjpeg-trell-huffman
@@ -1,4 +1,4 @@ 
-a59d99d31d24875161504820d4266e4d *tests/data/fate/vsynth2-mjpeg-trell-huffman.avi
-734728 tests/data/fate/vsynth2-mjpeg-trell-huffman.avi
-42376126213c73c86b408882e24ba015 *tests/data/fate/vsynth2-mjpeg-trell-huffman.out.rawvideo
-stddev:    5.03 PSNR: 34.09 MAXDIFF:   67 bytes:  7603200/  7603200
+d6a09ff8a46c297934496d8089cdd2a2 *tests/data/fate/vsynth2-mjpeg-trell-huffman.avi
+734896 tests/data/fate/vsynth2-mjpeg-trell-huffman.avi
+8612dfee87e32268f6f533188a097785 *tests/data/fate/vsynth2-mjpeg-trell-huffman.out.rawvideo
+stddev:    5.03 PSNR: 34.10 MAXDIFF:   67 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-roqvideo b/tests/ref/vsynth/vsynth2-roqvideo
index 32a90fd8a7..7f9f5e10ce 100644
--- a/tests/ref/vsynth/vsynth2-roqvideo
+++ b/tests/ref/vsynth/vsynth2-roqvideo
@@ -1,4 +1,4 @@ 
-f6caa394394e07b16c73fa2bb4807a88 *tests/data/fate/vsynth2-roqvideo.roq
-92517 tests/data/fate/vsynth2-roqvideo.roq
-a80f3f01b06b062ae416bee6a65917e9 *tests/data/fate/vsynth2-roqvideo.out.rawvideo
-stddev:    4.87 PSNR: 34.37 MAXDIFF:   73 bytes:  7603200/   760320
+39aceb753338756e780f067832f58e69 *tests/data/fate/vsynth2-roqvideo.roq
+92204 tests/data/fate/vsynth2-roqvideo.roq
+09a8944612ed507675e27ace78fd66e8 *tests/data/fate/vsynth2-roqvideo.out.rawvideo
+stddev:    4.90 PSNR: 34.32 MAXDIFF:   73 bytes:  7603200/   760320
diff --git a/tests/ref/vsynth/vsynth3-amv b/tests/ref/vsynth/vsynth3-amv
index d2859c7c23..8363065234 100644
--- a/tests/ref/vsynth/vsynth3-amv
+++ b/tests/ref/vsynth/vsynth3-amv
@@ -1,4 +1,4 @@ 
-be6f013af371ab9d350e4998e86d2ea4 *tests/data/fate/vsynth3-amv.avi
-33932 tests/data/fate/vsynth3-amv.avi
-f916c620790a9cf2674391610985ae27 *tests/data/fate/vsynth3-amv.out.rawvideo
-stddev:   11.58 PSNR: 26.85 MAXDIFF:   89 bytes:    86700/    86700
+c7378bd1962651926ad554601dc3d841 *tests/data/fate/vsynth3-amv.avi
+33922 tests/data/fate/vsynth3-amv.avi
+96438ff23210bef0b7c969d89419169b *tests/data/fate/vsynth3-amv.out.rawvideo
+stddev:   11.58 PSNR: 26.85 MAXDIFF:   91 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth3-mjpeg b/tests/ref/vsynth/vsynth3-mjpeg
index 4b3371ec22..ebcbc784e5 100644
--- a/tests/ref/vsynth/vsynth3-mjpeg
+++ b/tests/ref/vsynth/vsynth3-mjpeg
@@ -1,4 +1,4 @@ 
-eec435352485fec167179a63405505be *tests/data/fate/vsynth3-mjpeg.avi
-48156 tests/data/fate/vsynth3-mjpeg.avi
-c4fe7a2669afbd96c640748693fc4e30 *tests/data/fate/vsynth3-mjpeg.out.rawvideo
-stddev:    8.60 PSNR: 29.43 MAXDIFF:   58 bytes:    86700/    86700
+62a7732fcb9288a7223671b23ce06fa0 *tests/data/fate/vsynth3-mjpeg.avi
+48170 tests/data/fate/vsynth3-mjpeg.avi
+a6daba607898eb6e1a172c2368084a67 *tests/data/fate/vsynth3-mjpeg.out.rawvideo
+stddev:    8.61 PSNR: 29.43 MAXDIFF:   58 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth3-mjpeg-422 b/tests/ref/vsynth/vsynth3-mjpeg-422
index c364c79a11..cc2bbe2224 100644
--- a/tests/ref/vsynth/vsynth3-mjpeg-422
+++ b/tests/ref/vsynth/vsynth3-mjpeg-422
@@ -1,4 +1,4 @@ 
-396394fab0d456443a3929a33f8c0d59 *tests/data/fate/vsynth3-mjpeg-422.avi
-52606 tests/data/fate/vsynth3-mjpeg-422.avi
-a332893cb0603f2f505fe5d3bf105519 *tests/data/fate/vsynth3-mjpeg-422.out.rawvideo
-stddev:    8.23 PSNR: 29.82 MAXDIFF:   58 bytes:    86700/    86700
+9aa0f90dac7ef923a0be0d93ca7dc039 *tests/data/fate/vsynth3-mjpeg-422.avi
+52620 tests/data/fate/vsynth3-mjpeg-422.avi
+7c64ab866add1e59fe7c34feed006df1 *tests/data/fate/vsynth3-mjpeg-422.out.rawvideo
+stddev:    8.22 PSNR: 29.82 MAXDIFF:   58 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth3-mjpeg-444 b/tests/ref/vsynth/vsynth3-mjpeg-444
index 0e38744fd2..1149953b62 100644
--- a/tests/ref/vsynth/vsynth3-mjpeg-444
+++ b/tests/ref/vsynth/vsynth3-mjpeg-444
@@ -1,4 +1,4 @@ 
-3f2dca7be789eb7818c69ec716c0d831 *tests/data/fate/vsynth3-mjpeg-444.avi
-53958 tests/data/fate/vsynth3-mjpeg-444.avi
-79a901f2ed85d82cf1c674fab3d3ef72 *tests/data/fate/vsynth3-mjpeg-444.out.rawvideo
+c063ea1cddfc2a360b92f05d1811ea93 *tests/data/fate/vsynth3-mjpeg-444.avi
+53954 tests/data/fate/vsynth3-mjpeg-444.avi
+8bbbfeab8b3f6788719e1f0f77ce8612 *tests/data/fate/vsynth3-mjpeg-444.out.rawvideo
 stddev:    8.21 PSNR: 29.84 MAXDIFF:   58 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth3-mjpeg-huffman b/tests/ref/vsynth/vsynth3-mjpeg-huffman
index 634a1a52fc..00a4cef6f0 100644
--- a/tests/ref/vsynth/vsynth3-mjpeg-huffman
+++ b/tests/ref/vsynth/vsynth3-mjpeg-huffman
@@ -1,4 +1,4 @@ 
-eec435352485fec167179a63405505be *tests/data/fate/vsynth3-mjpeg-huffman.avi
-48156 tests/data/fate/vsynth3-mjpeg-huffman.avi
-c4fe7a2669afbd96c640748693fc4e30 *tests/data/fate/vsynth3-mjpeg-huffman.out.rawvideo
-stddev:    8.60 PSNR: 29.43 MAXDIFF:   58 bytes:    86700/    86700
+62a7732fcb9288a7223671b23ce06fa0 *tests/data/fate/vsynth3-mjpeg-huffman.avi
+48170 tests/data/fate/vsynth3-mjpeg-huffman.avi
+a6daba607898eb6e1a172c2368084a67 *tests/data/fate/vsynth3-mjpeg-huffman.out.rawvideo
+stddev:    8.61 PSNR: 29.43 MAXDIFF:   58 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth3-mjpeg-trell b/tests/ref/vsynth/vsynth3-mjpeg-trell
index 5b386c7eed..5bfa3e0e12 100644
--- a/tests/ref/vsynth/vsynth3-mjpeg-trell
+++ b/tests/ref/vsynth/vsynth3-mjpeg-trell
@@ -1,4 +1,4 @@ 
-484fa337b71c06a0206243814c4894b0 *tests/data/fate/vsynth3-mjpeg-trell.avi
-47816 tests/data/fate/vsynth3-mjpeg-trell.avi
-f0ccfe4584d193fd6d690a85a70db188 *tests/data/fate/vsynth3-mjpeg-trell.out.rawvideo
+7cbc02d85a572b5ea871c014ce27ab4c *tests/data/fate/vsynth3-mjpeg-trell.avi
+47834 tests/data/fate/vsynth3-mjpeg-trell.avi
+07822517628b20d54621df666ea79af3 *tests/data/fate/vsynth3-mjpeg-trell.out.rawvideo
 stddev:    8.27 PSNR: 29.78 MAXDIFF:   55 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth3-mjpeg-trell-huffman b/tests/ref/vsynth/vsynth3-mjpeg-trell-huffman
index 719029f37a..965a9e7792 100644
--- a/tests/ref/vsynth/vsynth3-mjpeg-trell-huffman
+++ b/tests/ref/vsynth/vsynth3-mjpeg-trell-huffman
@@ -1,4 +1,4 @@ 
-484fa337b71c06a0206243814c4894b0 *tests/data/fate/vsynth3-mjpeg-trell-huffman.avi
-47816 tests/data/fate/vsynth3-mjpeg-trell-huffman.avi
-f0ccfe4584d193fd6d690a85a70db188 *tests/data/fate/vsynth3-mjpeg-trell-huffman.out.rawvideo
+7cbc02d85a572b5ea871c014ce27ab4c *tests/data/fate/vsynth3-mjpeg-trell-huffman.avi
+47834 tests/data/fate/vsynth3-mjpeg-trell-huffman.avi
+07822517628b20d54621df666ea79af3 *tests/data/fate/vsynth3-mjpeg-trell-huffman.out.rawvideo
 stddev:    8.27 PSNR: 29.78 MAXDIFF:   55 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth_lena-amv b/tests/ref/vsynth/vsynth_lena-amv
index e4bf72574c..394d4baca3 100644
--- a/tests/ref/vsynth/vsynth_lena-amv
+++ b/tests/ref/vsynth/vsynth_lena-amv
@@ -1,4 +1,4 @@ 
-49552a6ac39f27568fab1a4644aa5ddd *tests/data/fate/vsynth_lena-amv.avi
-761980 tests/data/fate/vsynth_lena-amv.avi
-f256ad9feefb499c6569d06d868eb496 *tests/data/fate/vsynth_lena-amv.out.rawvideo
+5581dbc80cb27a1eef5581d013367121 *tests/data/fate/vsynth_lena-amv.avi
+762122 tests/data/fate/vsynth_lena-amv.avi
+9c8639a19d924d9e3e71c97a95e9ad09 *tests/data/fate/vsynth_lena-amv.out.rawvideo
 stddev:    4.30 PSNR: 35.46 MAXDIFF:   65 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth_lena-mjpeg b/tests/ref/vsynth/vsynth_lena-mjpeg
index e30ddc7677..f56928dd55 100644
--- a/tests/ref/vsynth/vsynth_lena-mjpeg
+++ b/tests/ref/vsynth/vsynth_lena-mjpeg
@@ -1,4 +1,4 @@ 
-007c989af621445dc7c9bd248b9df3b4 *tests/data/fate/vsynth_lena-mjpeg.avi
-635498 tests/data/fate/vsynth_lena-mjpeg.avi
-9d4bd90e9abfa18192383b4adc23c8d4 *tests/data/fate/vsynth_lena-mjpeg.out.rawvideo
-stddev:    4.32 PSNR: 35.40 MAXDIFF:   49 bytes:  7603200/  7603200
+d8b968d6ecaa83bb120eb0dd08c3f6df *tests/data/fate/vsynth_lena-mjpeg.avi
+635642 tests/data/fate/vsynth_lena-mjpeg.avi
+095f88a721813c2a1c34b26303c1139a *tests/data/fate/vsynth_lena-mjpeg.out.rawvideo
+stddev:    4.33 PSNR: 35.40 MAXDIFF:   49 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth_lena-mjpeg-422 b/tests/ref/vsynth/vsynth_lena-mjpeg-422
index f94ae5815d..bb862da006 100644
--- a/tests/ref/vsynth/vsynth_lena-mjpeg-422
+++ b/tests/ref/vsynth/vsynth_lena-mjpeg-422
@@ -1,4 +1,4 @@ 
-e867bc5e8e4e4555846c61b3cb4580a6 *tests/data/fate/vsynth_lena-mjpeg-422.avi
-707376 tests/data/fate/vsynth_lena-mjpeg-422.avi
-451ac80989c4e14445cf951fd7f83b6d *tests/data/fate/vsynth_lena-mjpeg-422.out.rawvideo
+494812cc00c2d51df2d9cbc03dc9eecd *tests/data/fate/vsynth_lena-mjpeg-422.avi
+707466 tests/data/fate/vsynth_lena-mjpeg-422.avi
+16d2be35266d303dff3361e4535e8dd8 *tests/data/fate/vsynth_lena-mjpeg-422.out.rawvideo
 stddev:    4.18 PSNR: 35.70 MAXDIFF:   49 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth_lena-mjpeg-444 b/tests/ref/vsynth/vsynth_lena-mjpeg-444
index cb4c0a12db..cef6dd9eec 100644
--- a/tests/ref/vsynth/vsynth_lena-mjpeg-444
+++ b/tests/ref/vsynth/vsynth_lena-mjpeg-444
@@ -1,4 +1,4 @@ 
-9a36b201c4f68051441b1ee1307a2cc2 *tests/data/fate/vsynth_lena-mjpeg-444.avi
-807628 tests/data/fate/vsynth_lena-mjpeg-444.avi
-34edcb9c87ff7aac456a4fb07f43504b *tests/data/fate/vsynth_lena-mjpeg-444.out.rawvideo
+52996e606d20fe34c327a206be066091 *tests/data/fate/vsynth_lena-mjpeg-444.avi
+807472 tests/data/fate/vsynth_lena-mjpeg-444.avi
+0db1c1942d750b107acf2acfbe08eacb *tests/data/fate/vsynth_lena-mjpeg-444.out.rawvideo
 stddev:    4.05 PSNR: 35.96 MAXDIFF:   49 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth_lena-mjpeg-huffman b/tests/ref/vsynth/vsynth_lena-mjpeg-huffman
index 6ac1b740a4..5f5e19bb67 100644
--- a/tests/ref/vsynth/vsynth_lena-mjpeg-huffman
+++ b/tests/ref/vsynth/vsynth_lena-mjpeg-huffman
@@ -1,4 +1,4 @@ 
-007c989af621445dc7c9bd248b9df3b4 *tests/data/fate/vsynth_lena-mjpeg-huffman.avi
-635498 tests/data/fate/vsynth_lena-mjpeg-huffman.avi
-9d4bd90e9abfa18192383b4adc23c8d4 *tests/data/fate/vsynth_lena-mjpeg-huffman.out.rawvideo
-stddev:    4.32 PSNR: 35.40 MAXDIFF:   49 bytes:  7603200/  7603200
+d8b968d6ecaa83bb120eb0dd08c3f6df *tests/data/fate/vsynth_lena-mjpeg-huffman.avi
+635642 tests/data/fate/vsynth_lena-mjpeg-huffman.avi
+095f88a721813c2a1c34b26303c1139a *tests/data/fate/vsynth_lena-mjpeg-huffman.out.rawvideo
+stddev:    4.33 PSNR: 35.40 MAXDIFF:   49 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth_lena-mjpeg-trell b/tests/ref/vsynth/vsynth_lena-mjpeg-trell
index 86332b2010..ca7f1b1d03 100644
--- a/tests/ref/vsynth/vsynth_lena-mjpeg-trell
+++ b/tests/ref/vsynth/vsynth_lena-mjpeg-trell
@@ -1,4 +1,4 @@ 
-6eb36ab28a082f496f1f3bc165704a68 *tests/data/fate/vsynth_lena-mjpeg-trell.avi
-582534 tests/data/fate/vsynth_lena-mjpeg-trell.avi
-dcb183a6a5fa06e7234d46dd97ceb8ec *tests/data/fate/vsynth_lena-mjpeg-trell.out.rawvideo
-stddev:    4.51 PSNR: 35.05 MAXDIFF:   60 bytes:  7603200/  7603200
+8217aef7ee16709b2c0591a9a28d9bb8 *tests/data/fate/vsynth_lena-mjpeg-trell.avi
+582648 tests/data/fate/vsynth_lena-mjpeg-trell.avi
+8c5c05e82a959ccc8b3c4ba8e4123bbe *tests/data/fate/vsynth_lena-mjpeg-trell.out.rawvideo
+stddev:    4.51 PSNR: 35.04 MAXDIFF:   60 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth_lena-mjpeg-trell-huffman b/tests/ref/vsynth/vsynth_lena-mjpeg-trell-huffman
index 91fcd19994..2eb1658363 100644
--- a/tests/ref/vsynth/vsynth_lena-mjpeg-trell-huffman
+++ b/tests/ref/vsynth/vsynth_lena-mjpeg-trell-huffman
@@ -1,4 +1,4 @@ 
-6eb36ab28a082f496f1f3bc165704a68 *tests/data/fate/vsynth_lena-mjpeg-trell-huffman.avi
-582534 tests/data/fate/vsynth_lena-mjpeg-trell-huffman.avi
-dcb183a6a5fa06e7234d46dd97ceb8ec *tests/data/fate/vsynth_lena-mjpeg-trell-huffman.out.rawvideo
-stddev:    4.51 PSNR: 35.05 MAXDIFF:   60 bytes:  7603200/  7603200
+8217aef7ee16709b2c0591a9a28d9bb8 *tests/data/fate/vsynth_lena-mjpeg-trell-huffman.avi
+582648 tests/data/fate/vsynth_lena-mjpeg-trell-huffman.avi
+8c5c05e82a959ccc8b3c4ba8e4123bbe *tests/data/fate/vsynth_lena-mjpeg-trell-huffman.out.rawvideo
+stddev:    4.51 PSNR: 35.04 MAXDIFF:   60 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth_lena-roqvideo b/tests/ref/vsynth/vsynth_lena-roqvideo
index 10f2014089..46cc43aa30 100644
--- a/tests/ref/vsynth/vsynth_lena-roqvideo
+++ b/tests/ref/vsynth/vsynth_lena-roqvideo
@@ -1,4 +1,4 @@ 
-1a43cd71c91f2ef42d11a81419bff3bd *tests/data/fate/vsynth_lena-roqvideo.roq
-94810 tests/data/fate/vsynth_lena-roqvideo.roq
-97cda6096430c0ab7a43a0e120cd3e91 *tests/data/fate/vsynth_lena-roqvideo.out.rawvideo
-stddev:    3.81 PSNR: 36.50 MAXDIFF:   49 bytes:  7603200/   760320
+f76de43fceb11710a593addde02c6863 *tests/data/fate/vsynth_lena-roqvideo.roq
+94846 tests/data/fate/vsynth_lena-roqvideo.roq
+9cbeb8e11ddf92694318ab8f413dd296 *tests/data/fate/vsynth_lena-roqvideo.out.rawvideo
+stddev:    3.80 PSNR: 36.52 MAXDIFF:   67 bytes:  7603200/   760320