comparison postproc/swscale.c @ 2680:e8a534509557

green line fix for dstw%8!=0
author michael
date Sun, 04 Nov 2001 13:50:20 +0000
parents 555cb027c7a7
children 96c1d1e6cb9e
comparison
equal deleted inserted replaced
2679:ae59ad941b42 2680:e8a534509557
9 #include <string.h> 9 #include <string.h>
10 #include "../config.h" 10 #include "../config.h"
11 #include "swscale.h" 11 #include "swscale.h"
12 #include "../mmx_defs.h" 12 #include "../mmx_defs.h"
13 #undef MOVNTQ 13 #undef MOVNTQ
14 #undef PAVGB
14 15
15 //#undef HAVE_MMX2 16 //#undef HAVE_MMX2
16 //#undef HAVE_MMX 17 //#undef HAVE_MMX
17 //#undef ARCH_X86 18 //#undef ARCH_X86
18 #define DITHER1XBPP 19 #define DITHER1XBPP
1397 // used to detect a horizontal size change 1398 // used to detect a horizontal size change
1398 static int old_dstw= -1; 1399 static int old_dstw= -1;
1399 static int old_s_xinc= -1; 1400 static int old_s_xinc= -1;
1400 #endif 1401 #endif
1401 1402
1402 int srcWidth= (dstw*s_xinc + 0x8000)>>16; 1403 int srcWidth;
1403 int dstUVw= fullUVIpol ? dstw : dstw/2; 1404 int dstUVw;
1404 int i; 1405 int i;
1406
1407 if(((dstw + 7)&(~7)) >= dststride) dstw&= ~7;
1408
1409 srcWidth= (dstw*s_xinc + 0x8000)>>16;
1410 dstUVw= fullUVIpol ? dstw : dstw/2;
1405 1411
1406 #ifdef HAVE_MMX2 1412 #ifdef HAVE_MMX2
1407 canMMX2BeUsed= (s_xinc <= 0x10000 && (dstw&31)==0 && (srcWidth&15)==0) ? 1 : 0; 1413 canMMX2BeUsed= (s_xinc <= 0x10000 && (dstw&31)==0 && (srcWidth&15)==0) ? 1 : 0;
1408 #endif 1414 #endif
1409 1415
1418 if(fullUVIpol && !(dstbpp==12)) s_xinc2= s_xinc>>1; 1424 if(fullUVIpol && !(dstbpp==12)) s_xinc2= s_xinc>>1;
1419 else s_xinc2= s_xinc; 1425 else s_xinc2= s_xinc;
1420 // force calculation of the horizontal interpolation of the first line 1426 // force calculation of the horizontal interpolation of the first line
1421 1427
1422 if(y==0){ 1428 if(y==0){
1429 // printf("dstw %d, srcw %d, mmx2 %d\n", dstw, srcWidth, canMMX2BeUsed);
1423 s_last_ypos=-99; 1430 s_last_ypos=-99;
1424 s_last_y1pos=-99; 1431 s_last_y1pos=-99;
1425 s_srcypos= s_yinc/2 - 0x8000; 1432 s_srcypos= s_yinc/2 - 0x8000;
1426 s_ypos=0; 1433 s_ypos=0;
1427 1434
1428 // clean the buffers so that no green stuff is drawen if the width is not sane (%8=0) 1435 // clean the buffers so that no green stuff is drawen if the width is not sane (%8=0)
1429 for(i=dstw-2; i<dstw+20; i++) 1436 for(i=dstw-2; i<dstw+20; i++)
1430 { 1437 {
1431 pix_buf_uv[0][i] = pix_buf_uv[1][i] 1438 pix_buf_uv[0][i] = pix_buf_uv[1][i]
1432 = pix_buf_uv[0][2048+i] = pix_buf_uv[1][2048+i] = 128; 1439 = pix_buf_uv[0][2048+i] = pix_buf_uv[1][2048+i] = 128*128;
1433 pix_buf_uv[0][i/2] = pix_buf_uv[1][i/2] 1440 pix_buf_uv[0][i/2] = pix_buf_uv[1][i/2]
1434 = pix_buf_uv[0][2048+i/2] = pix_buf_uv[1][2048+i/2] = 128; 1441 = pix_buf_uv[0][2048+i/2] = pix_buf_uv[1][2048+i/2] = 128*128;
1435 pix_buf_y[0][i]= pix_buf_y[1][i]= 0; 1442 pix_buf_y[0][i]= pix_buf_y[1][i]= 0;
1436 } 1443 }
1437 1444
1438 #ifdef HAVE_MMX2 1445 #ifdef HAVE_MMX2
1439 // cant downscale !!! 1446 // cant downscale !!!