diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index 75adbe7ea0..9bd5a04368 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -234,6 +234,11 @@ static int encode_block(SVQ1EncContext *s, uint8_t *src, uint8_t *ref,
         }
     }
 
+    if (best_mean == -128)
+        best_mean = -127;
+    else if (best_mean == 128)
+        best_mean = 127;
+
     split = 0;
     if (best_score > threshold && level) {
         int score  = 0;
diff --git a/tests/ref/seek/vsynth_lena-svq1 b/tests/ref/seek/vsynth_lena-svq1
index 33fe33e916..36c0fb7f4e 100644
--- a/tests/ref/seek/vsynth_lena-svq1
+++ b/tests/ref/seek/vsynth_lena-svq1
@@ -2,49 +2,49 @@ ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
 ret: 0         st:-1 flags:0  ts:-1.000000
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
 ret: 0         st:-1 flags:1  ts: 1.894167
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517568 size: 25636
+ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517672 size: 25636
 ret: 0         st: 0 flags:0  ts: 0.788359
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326556 size: 23552
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326616 size: 23552
 ret: 0         st: 0 flags:1  ts:-0.317500
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
 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.440000 pts: 1.440000 pos: 517568 size: 25636
+ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517672 size: 25636
 ret: 0         st: 0 flags:0  ts: 0.365000
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 157040 size: 21896
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 157232 size: 21896
 ret: 0         st: 0 flags:1  ts:-0.740859
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
 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: 0.960000 pts: 0.960000 pos: 326556 size: 23552
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326616 size: 23552
 ret: 0         st: 0 flags:0  ts:-0.058359
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
 ret: 0         st: 0 flags:1  ts: 2.835859
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722804 size: 25888
+ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722884 size: 25888
 ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722804 size: 25888
+ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722884 size: 25888
 ret: 0         st:-1 flags:1  ts: 0.624171
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 157040 size: 21896
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 157232 size: 21896
 ret: 0         st: 0 flags:0  ts:-0.481641
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
 ret: 0         st: 0 flags:1  ts: 2.412500
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722804 size: 25888
+ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722884 size: 25888
 ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517568 size: 25636
+ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517672 size: 25636
 ret: 0         st:-1 flags:1  ts: 0.200839
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
 ret: 0         st: 0 flags:0  ts:-0.905000
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
 ret: 0         st: 0 flags:1  ts: 1.989141
-ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722804 size: 25888
+ret: 0         st: 0 flags:1 dts: 1.920000 pts: 1.920000 pos: 722884 size: 25888
 ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326556 size: 23552
+ret: 0         st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 326616 size: 23552
 ret: 0         st:-1 flags:1  ts:-0.222493
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
 ret:-1         st: 0 flags:0  ts: 2.671641
 ret: 0         st: 0 flags:1  ts: 1.565859
-ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517568 size: 25636
+ret: 0         st: 0 flags:1 dts: 1.440000 pts: 1.440000 pos: 517672 size: 25636
 ret: 0         st:-1 flags:0  ts: 0.460008
-ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 157040 size: 21896
+ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 157232 size: 21896
 ret: 0         st:-1 flags:1  ts:-0.645825
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     36 size: 22300
diff --git a/tests/ref/vsynth/vsynth1-svq1 b/tests/ref/vsynth/vsynth1-svq1
index 1970f779fc..e91ef46f17 100644
--- a/tests/ref/vsynth/vsynth1-svq1
+++ b/tests/ref/vsynth/vsynth1-svq1
@@ -1,4 +1,4 @@
-66933a2b34e123a9fc612cbc4dbbe353 *tests/data/fate/vsynth1-svq1.mov
-1334233 tests/data/fate/vsynth1-svq1.mov
-9cc35c54b2c77d36bd7e308b393c1f81 *tests/data/fate/vsynth1-svq1.out.rawvideo
-stddev:    9.58 PSNR: 28.50 MAXDIFF:  210 bytes:  7603200/  7603200
+78cdca850b19faf3aac0b0682207451e *tests/data/fate/vsynth1-svq1.mov
+1333541 tests/data/fate/vsynth1-svq1.mov
+0b9ee47ee4bf735fe3697daad64fc409 *tests/data/fate/vsynth1-svq1.out.rawvideo
+stddev:    9.57 PSNR: 28.50 MAXDIFF:  210 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-svq1 b/tests/ref/vsynth/vsynth2-svq1
index 32a0b80df2..b50ba45e20 100644
--- a/tests/ref/vsynth/vsynth2-svq1
+++ b/tests/ref/vsynth/vsynth2-svq1
@@ -1,4 +1,4 @@
-6ba5415d077304dc73ba8d8aaccb15eb *tests/data/fate/vsynth2-svq1.mov
-940285 tests/data/fate/vsynth2-svq1.mov
-a8cd3b833cd7f570ddbf1e6b3eb125b6 *tests/data/fate/vsynth2-svq1.out.rawvideo
+42578021105a2f526179c5601e635312 *tests/data/fate/vsynth2-svq1.mov
+940337 tests/data/fate/vsynth2-svq1.mov
+ba8f6b721a8e19fe8a6ef92a8cff7479 *tests/data/fate/vsynth2-svq1.out.rawvideo
 stddev:    3.71 PSNR: 36.72 MAXDIFF:  210 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth3-svq1 b/tests/ref/vsynth/vsynth3-svq1
index e760abbdb4..ba1d3d5082 100644
--- a/tests/ref/vsynth/vsynth3-svq1
+++ b/tests/ref/vsynth/vsynth3-svq1
@@ -1,4 +1,4 @@
-1972e0df8be667443992e405cceec291 *tests/data/fate/vsynth3-svq1.mov
-40773 tests/data/fate/vsynth3-svq1.mov
-a1e5334cf67649bf8c7d95dc4d1bf148 *tests/data/fate/vsynth3-svq1.out.rawvideo
+03805cb764c00c2162b2bed24b7f34bd *tests/data/fate/vsynth3-svq1.mov
+40757 tests/data/fate/vsynth3-svq1.mov
+a99efde992a2e3efcc085ecc6920a1e3 *tests/data/fate/vsynth3-svq1.out.rawvideo
 stddev:   14.49 PSNR: 24.91 MAXDIFF:  183 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth_lena-svq1 b/tests/ref/vsynth/vsynth_lena-svq1
index e0614df3f9..94f260865a 100644
--- a/tests/ref/vsynth/vsynth_lena-svq1
+++ b/tests/ref/vsynth/vsynth_lena-svq1
@@ -1,4 +1,4 @@
-bbe2b28fcef16aa088d29984931eea6a *tests/data/fate/vsynth_lena-svq1.mov
-766701 tests/data/fate/vsynth_lena-svq1.mov
-aa03471dac3f49455a33a2b19fda1098 *tests/data/fate/vsynth_lena-svq1.out.rawvideo
+7534b2c6b7fc7201f193e9b4514cdb90 *tests/data/fate/vsynth_lena-svq1.mov
+766817 tests/data/fate/vsynth_lena-svq1.mov
+85261558fa744ef468fe77dbe4d91d8d *tests/data/fate/vsynth_lena-svq1.out.rawvideo
 stddev:    3.23 PSNR: 37.93 MAXDIFF:   61 bytes:  7603200/  7603200
