diff --git a/libavcodec/msvideo1enc.c b/libavcodec/msvideo1enc.c index d5088feeb8..e0efb4823f 100644 --- a/libavcodec/msvideo1enc.c +++ b/libavcodec/msvideo1enc.c @@ -110,7 +110,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, bestscore = 0; for(j = 0; j < 4; j++){ for(i = 0; i < 4*3; i++){ - int t = prevptr[x*3 + i + j*p->linesize[0]] - c->block[i + j*4*3]; + int t = prevptr[x*3 + i - j*3*avctx->width] - c->block[i + j*4*3]; bestscore += t*t; } } @@ -204,14 +204,14 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, for(j = 0; j < 4; j++) for(i = 0; i < 4; i++) for(k = 0; k < 3; k++) - prevptr[i*3 + k - j*3*avctx->width] = c->avg[k]; + prevptr[x*3 + i*3 + k - j*3*avctx->width] = c->avg[k]; break; case MODE_2COL: for(j = 0; j < 4; j++){ for(i = 0; i < 4; i++){ flags |= (c->output[i + j*4]^1) << (i + j*4); for(k = 0; k < 3; k++) - prevptr[i*3 + k - j*3*avctx->width] = c->codebook[c->output[i + j*4]*3 + k]; + prevptr[x*3 + i*3 + k - j*3*avctx->width] = c->codebook[c->output[i + j*4]*3 + k]; } } bytestream_put_le16(&dst, flags); @@ -223,7 +223,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, for(i = 0; i < 4; i++){ flags |= (c->output2[remap[i + j*4]]^1) << (i + j*4); for(k = 0; k < 3; k++) - prevptr[i*3 + k - j*3*avctx->width] = c->codebook2[(c->output2[remap[i+j*4]] + (i&2) + (j&2)*2)*3 + k]; + prevptr[x*3 + i*3 + k - j*3*avctx->width] = c->codebook2[(c->output2[remap[i+j*4]] + (i&2) + (j&2)*2)*3 + k]; } } bytestream_put_le16(&dst, flags); diff --git a/tests/ref/fate/vsynth1-msvideo1 b/tests/ref/fate/vsynth1-msvideo1 index b59274c973..46022b6014 100644 --- a/tests/ref/fate/vsynth1-msvideo1 +++ b/tests/ref/fate/vsynth1-msvideo1 @@ -1,4 +1,4 @@ -afe516f762a598f3f9c7ae8a9f288d3e *tests/data/fate/vsynth1-msvideo1.avi -2162264 tests/data/fate/vsynth1-msvideo1.avi -ef76473f7be587dac7676a69835e43ce *tests/data/fate/vsynth1-msvideo1.out.rawvideo -stddev: 11.80 PSNR: 26.69 MAXDIFF: 151 bytes: 7603200/ 7603200 +75a0f6680e23a50477826caec1a41bb9 *tests/data/fate/vsynth1-msvideo1.avi +2051904 tests/data/fate/vsynth1-msvideo1.avi +f4605ac6df556a3ca7053c49aaac04d8 *tests/data/fate/vsynth1-msvideo1.out.rawvideo +stddev: 11.89 PSNR: 26.62 MAXDIFF: 159 bytes: 7603200/ 7603200 diff --git a/tests/ref/fate/vsynth2-msvideo1 b/tests/ref/fate/vsynth2-msvideo1 index 8338ac4fb5..77d8cea41e 100644 --- a/tests/ref/fate/vsynth2-msvideo1 +++ b/tests/ref/fate/vsynth2-msvideo1 @@ -1,4 +1,4 @@ -e70658b8b97eb4c7e63b2081c3a602de *tests/data/fate/vsynth2-msvideo1.avi -1259308 tests/data/fate/vsynth2-msvideo1.avi -cd83ffcbc73573044e3aead3094229e5 *tests/data/fate/vsynth2-msvideo1.out.rawvideo -stddev: 7.42 PSNR: 30.72 MAXDIFF: 123 bytes: 7603200/ 7603200 +8d7e8eb05771d0341d88c30892908960 *tests/data/fate/vsynth2-msvideo1.avi +914572 tests/data/fate/vsynth2-msvideo1.avi +9a6ac7c0171286f009d159b59fdc1154 *tests/data/fate/vsynth2-msvideo1.out.rawvideo +stddev: 7.97 PSNR: 30.10 MAXDIFF: 123 bytes: 7603200/ 7603200