Ticket #2304: bmovl-stride.patch
| File bmovl-stride.patch, 3.4 KB (added by , 10 years ago) |
|---|
-
libmpcodecs/vf_bmovl.c
old new put_image(struct vf_instance *vf, mp_ima 328 328 memset( vf->priv->bitmap.a + (ypos*vf->priv->w) + imgx, 0, imgw ); 329 329 memset( vf->priv->bitmap.oa + (ypos*vf->priv->w) + imgx, 0, imgw ); 330 330 if(ypos%2) { 331 memset( vf->priv->bitmap.u + ((ypos/2)* dmpi->stride[1]) + (imgx/2), 128, imgw/2 );332 memset( vf->priv->bitmap.v + ((ypos/2)* dmpi->stride[2]) + (imgx/2), 128, imgw/2 );331 memset( vf->priv->bitmap.u + ((ypos/2)*vf->priv->w) + (imgx/2), 128, imgw/2 ); 332 memset( vf->priv->bitmap.v + ((ypos/2)*vf->priv->w) + (imgx/2), 128, imgw/2 ); 333 333 } 334 334 } // Recalculate area that contains graphics 335 335 if( (imgx <= vf->priv->x1) && ( (imgw+imgx) >= vf->priv->x2) ) { … … put_image(struct vf_instance *vf, mp_ima 389 389 vf->priv->bitmap.oa[pos] = alpha; 390 390 vf->priv->bitmap.a[pos] = INRANGE((alpha+imgalpha),0,255); 391 391 if((buf_y%2) && ((buf_x/pxsz)%2)) { 392 pos = ( ((buf_y+imgy)/2) * dmpi->stride[1]) + (((buf_x/pxsz)+imgx)/2);392 pos = ( ((buf_y+imgy)/2) * vf->priv->w ) + (((buf_x/pxsz)+imgx)/2); 393 393 vf->priv->bitmap.u[pos] = rgb2u(red,green,blue); 394 394 vf->priv->bitmap.v[pos] = rgb2v(red,green,blue); 395 395 } … … put_image(struct vf_instance *vf, mp_ima 421 421 } else { // Blit the bitmap to the videoscreen, pixel for pixel 422 422 for( ypos=vf->priv->y1 ; ypos < vf->priv->y2 ; ypos++ ) { 423 423 for ( xpos=vf->priv->x1 ; xpos < vf->priv->x2 ; xpos++ ) { 424 pos = (ypos * dmpi->stride[0]) + xpos; 424 int s = ypos * vf->priv->w + xpos; 425 int d = ypos * dmpi->stride[0] + xpos; 425 426 426 alpha = vf->priv->bitmap.a[ pos];427 alpha = vf->priv->bitmap.a[s]; 427 428 428 429 if (alpha == 0) continue; // Completly transparent pixel 429 430 430 431 if (alpha == 255) { // Opaque pixel 431 dmpi->planes[0][ pos] = vf->priv->bitmap.y[pos];432 dmpi->planes[0][d] = vf->priv->bitmap.y[s]; 432 433 if ((ypos%2) && (xpos%2)) { 433 pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2); 434 dmpi->planes[1][pos] = vf->priv->bitmap.u[pos]; 435 dmpi->planes[2][pos] = vf->priv->bitmap.v[pos]; 434 s = (ypos/2) * vf->priv->w + xpos/2; 435 d = (ypos/2) * dmpi->stride[1] + xpos/2; 436 dmpi->planes[1][d] = vf->priv->bitmap.u[s]; 437 dmpi->planes[2][d] = vf->priv->bitmap.v[s]; 436 438 } 437 439 } else { // Alphablended pixel 438 dmpi->planes[0][ pos] =439 ((255 - alpha) * (int)dmpi->planes[0][ pos] +440 alpha * (int)vf->priv->bitmap.y[ pos]) >> 8;440 dmpi->planes[0][d] = 441 ((255 - alpha) * (int)dmpi->planes[0][d] + 442 alpha * (int)vf->priv->bitmap.y[s]) >> 8; 441 443 442 444 if ((ypos%2) && (xpos%2)) { 443 pos = ( (ypos/2) * dmpi->stride[1] ) + (xpos/2); 444 445 dmpi->planes[1][pos] = 446 ((255 - alpha) * (int)dmpi->planes[1][pos] + 447 alpha * (int)vf->priv->bitmap.u[pos]) >> 8; 448 449 dmpi->planes[2][pos] = 450 ((255 - alpha) * (int)dmpi->planes[2][pos] + 451 alpha * (int)vf->priv->bitmap.v[pos]) >> 8; 445 s = (ypos/2) * vf->priv->w + xpos/2; 446 d = (ypos/2) * dmpi->stride[1] + xpos/2; 447 dmpi->planes[1][d] = 448 ((255 - alpha) * (int)dmpi->planes[1][d] + 449 alpha * (int)vf->priv->bitmap.u[s]) >> 8; 450 dmpi->planes[2][d] = 451 ((255 - alpha) * (int)dmpi->planes[2][d] + 452 alpha * (int)vf->priv->bitmap.v[s]) >> 8; 452 453 } 453 454 } 454 455 } // for xpos
