From f79432a26edf0fa5d7ca76680ff6f4eb5e048223 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Mon, 5 Sep 2005 10:26:11 +0000
Subject: [PATCH] set a few variables correctly

Originally committed as revision 4560 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/svq1.c             | 9 ++++++++-
 tests/ffmpeg.regression.ref   | 6 +++---
 tests/rotozoom.regression.ref | 8 ++++----
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/libavcodec/svq1.c b/libavcodec/svq1.c
index e59f1c731b8..b94472e3430 100644
--- a/libavcodec/svq1.c
+++ b/libavcodec/svq1.c
@@ -1118,8 +1118,15 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane
         s->m.b8_stride= 2*s->m.mb_width+1;
         s->m.f_code=1;
         s->m.pict_type= s->picture.pict_type;
-        s->m.qscale= s->picture.quality/FF_QP2LAMBDA;
         s->m.me_method= s->avctx->me_method;
+        s->m.me.scene_change_score=0;
+        s->m.flags= s->avctx->flags;
+//        s->m.out_format = FMT_H263;
+//        s->m.unrestricted_mv= 1;
+        
+        s->m.lambda= s->picture.quality;
+        s->m.qscale= (s->m.lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
+        s->m.lambda2= (s->m.lambda*s->m.lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT;
         
         if(!s->motion_val8[plane]){
             s->motion_val8 [plane]= av_mallocz((s->m.b8_stride*block_height*2 + 2)*2*sizeof(int16_t));
diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref
index 3c102d528b7..1a2f5910b89 100644
--- a/tests/ffmpeg.regression.ref
+++ b/tests/ffmpeg.regression.ref
@@ -131,9 +131,9 @@ e1da20e3f52f4d2aa18e9486986161fc *./data/a-dv.dv
 7200000 ./data/a-dv.dv
 55612d1a7246c82a32414638d601ac95 *./data/out.yuv
 stddev:  9.15 PSNR:28.88 bytes:7602176
-b5b6275f58f012de73644bbaa9080097 *./data/a-svq1.mov
-1383999 ./data/a-svq1.mov
-ccc201054669e94717022bb4f2aea4ce *./data/out.yuv
+4e718e1813052765a966b37e42b26014 *./data/a-svq1.mov
+1379819 ./data/a-svq1.mov
+bbff871d1475e1eee4231a08e075de2c *./data/out.yuv
 stddev: 10.99 PSNR:27.30 bytes:7602176
 21f8ff9f1daacd9133683bb4ea0f50a4 *./data/a-mp2.mp2
 95712 ./data/a-mp2.mp2
diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref
index 35e12db9283..9adb98c9bd1 100644
--- a/tests/rotozoom.regression.ref
+++ b/tests/rotozoom.regression.ref
@@ -131,10 +131,10 @@ a553532dcd54c1c421b52c3b6fece6ef *./data/a-dv.dv
 7200000 ./data/a-dv.dv
 1a1717b271a7536d641d5e1750d852d9 *./data/out.yuv
 stddev:  3.16 PSNR:38.12 bytes:7602176
-920c610ec324b772d882b0717e375943 *./data/a-svq1.mov
-768683 ./data/a-svq1.mov
-89b1946242e6998e05fc9a6e09668edd *./data/out.yuv
-stddev:  3.43 PSNR:37.39 bytes:7602176
+102bc57b87c9ab3b25e903a357783a65 *./data/a-svq1.mov
+769519 ./data/a-svq1.mov
+44777d1ddbccd0ef7f8d08394465670c *./data/out.yuv
+stddev:  3.44 PSNR:37.38 bytes:7602176
 21f8ff9f1daacd9133683bb4ea0f50a4 *./data/a-mp2.mp2
 95712 ./data/a-mp2.mp2
 6956f2c5185c4edbae648c614992a14b *./data/out.wav
-- 
GitLab