Ticket #8644: diff
File diff, 6.2 KB (added by , 18 years ago) |
---|
-
graphics/mpeg_player.cpp
380 396 // would be done here. See the Berkeley mpeg_play sources. 381 397 382 398 CR = CB = (i - 128); 383 Cr_r_tab[i] = (int16) ( (0.419 / 0.299) * CR) ;384 Cr_g_tab[i] = (int16) (-(0.299 / 0.419) * CR) ;399 Cr_r_tab[i] = (int16) ( (0.419 / 0.299) * CR) + 256; 400 Cr_g_tab[i] = (int16) (-(0.299 / 0.419) * CR) + 1024; 385 401 Cb_g_tab[i] = (int16) (-(0.114 / 0.331) * CB); 386 Cb_b_tab[i] = (int16) ( (0.587 / 0.331) * CB) ;402 Cb_b_tab[i] = (int16) ( (0.587 / 0.331) * CB) + 1792; 387 403 } 388 404 389 405 // Set up entries 0-255 in rgb-to-pixel value tables. … … 422 438 } 423 439 424 440 void BaseAnimationState::plotYUV1x(int width, int height, byte *const *dat) { 425 OverlayColor *ptr = _overlay;426 427 441 byte *lum = dat[0]; 428 442 byte *cr = dat[2]; 429 443 byte *cb = dat[1]; … … 434 448 int16 crb_g; 435 449 int16 cb_b; 436 450 437 OverlayColor *row1 = ptr;438 OverlayColor *row2 = ptr+ _movieWidth;451 OverlayColor *row1 = _overlay; 452 OverlayColor *row2 = row1 + _movieWidth; 439 453 440 int x , y;454 int x; 441 455 442 for ( y = 0; y < height; y += 2) {456 for (; height > 0; height -= 2) { 443 457 OverlayColor *r1 = row1; 444 458 OverlayColor *r2 = row2; 445 459 446 for (x = 0; x < width; x += 2) {447 register byteL;460 for (x = width; x > 0; x -= 2) { 461 register OverlayColor *L; 448 462 449 cr_r = 0 * 768 + 256 +_colorTab[*cr + 0 * 256];450 crb_g = 1 * 768 + 256 +_colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256];451 cb_b = 2 * 768 + 256 +_colorTab[*cb + 3 * 256];463 cr_r = _colorTab[*cr + 0 * 256]; 464 crb_g = _colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256]; 465 cb_b = _colorTab[*cb + 3 * 256]; 452 466 ++cr; 453 467 ++cb; 454 468 455 L = *lum++;456 *r1++ = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];469 L = &_rgbToPix[*lum++]; 470 *r1++ = L[cr_r] | L[crb_g] | L[cb_b]; 457 471 458 L = *lum++;459 *r1++ = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];460 472 L = &_rgbToPix[*lum++]; 473 *r1++ = L[cr_r] | L[crb_g] | L[cb_b]; 474 461 475 // Now, do second row. 462 476 463 L = *lum2++;464 *r2++ = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];477 L = &_rgbToPix[*lum2++]; 478 *r2++ = L[cr_r] | L[crb_g] | L[cb_b]; 465 479 466 L = *lum2++;467 *r2++ = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];480 L = &_rgbToPix[*lum2++]; 481 *r2++ = L[cr_r] | L[crb_g] | L[cb_b]; 468 482 } 469 483 470 484 lum += width; … … 475 489 } 476 490 477 491 void BaseAnimationState::plotYUV2x(int width, int height, byte *const *dat) { 478 OverlayColor *ptr = _overlay;479 480 492 byte *lum = dat[0]; 481 493 byte *cr = dat[2]; 482 494 byte *cb = dat[1]; … … 487 499 int16 crb_g; 488 500 int16 cb_b; 489 501 490 OverlayColor *row1 = ptr;491 OverlayColor *row2 = ptr+ 2 * 2 * _movieWidth;502 OverlayColor *row1 = _overlay; 503 OverlayColor *row2 = row1 + 2 * 2 * _movieWidth; 492 504 493 int x , y;505 int x; 494 506 495 for ( y = 0; y < height; y += 2) {507 for (; height > 0; height -= 2) { 496 508 OverlayColor *r1 = row1; 497 509 OverlayColor *r2 = row2; 498 510 499 for (x = 0; x < width; x += 2) {500 register byteL;501 register OverlayColor C;511 for (x = width; x > 0; x -= 2) { 512 register OverlayColor *L; 513 register OverlayColor C; 502 514 503 cr_r = 0 * 768 + 256 +_colorTab[*cr + 0 * 256];504 crb_g = 1 * 768 + 256 +_colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256];505 cb_b = 2 * 768 + 256 +_colorTab[*cb + 3 * 256];515 cr_r = _colorTab[*cr + 0 * 256]; 516 crb_g = _colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256]; 517 cb_b = _colorTab[*cb + 3 * 256]; 506 518 ++cr; 507 519 ++cb; 508 520 509 L = *lum++;510 C = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];521 L = &_rgbToPix[*lum++]; 522 C = L[cr_r] | L[crb_g] | L[cb_b]; 511 523 *r1++ = C; 512 524 *r1++ = C; 513 525 514 L = *lum++;515 C = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];526 L = &_rgbToPix[*lum++]; 527 C = L[cr_r] | L[crb_g] | L[cb_b]; 516 528 *r1++ = C; 517 529 *r1++ = C; 518 530 519 531 // Now, do second row. 520 532 521 L = *lum2++;522 C = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];533 L = &_rgbToPix[*lum2++]; 534 C = L[cr_r] | L[crb_g] | L[cb_b]; 523 535 *r2++ = C; 524 536 *r2++ = C; 525 537 526 L = *lum2++;527 C = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];538 L = &_rgbToPix[*lum2++]; 539 C = L[cr_r] | L[crb_g] | L[cb_b]; 528 540 *r2++ = C; 529 541 *r2++ = C; 530 542 } … … 540 552 } 541 553 542 554 void BaseAnimationState::plotYUV3x(int width, int height, byte *const *dat) { 543 OverlayColor *ptr = _overlay;544 545 555 byte *lum = dat[0]; 546 556 byte *cr = dat[2]; 547 557 byte *cb = dat[1]; … … 552 562 int16 crb_g; 553 563 int16 cb_b; 554 564 555 OverlayColor *row1 = ptr;556 OverlayColor *row2 = ptr+ 3 * 3 * _movieWidth;565 OverlayColor *row1 = _overlay; 566 OverlayColor *row2 = row1 + 3 * 3 * _movieWidth; 557 567 558 int x , y;568 int x; 559 569 560 for ( y = 0; y < height; y += 2) {570 for (; height > 0; height -= 2) { 561 571 OverlayColor *r1 = row1; 562 572 OverlayColor *r2 = row2; 563 573 564 for (x = 0; x < width; x += 2) {565 register byteL;566 register OverlayColor C;574 for (x = width; x > 0; x -= 2) { 575 register OverlayColor *L; 576 register OverlayColor C; 567 577 568 cr_r = 0 * 768 + 256 +_colorTab[*cr + 0 * 256];569 crb_g = 1 * 768 + 256 +_colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256];570 cb_b = 2 * 768 + 256 +_colorTab[*cb + 3 * 256];578 cr_r = _colorTab[*cr + 0 * 256]; 579 crb_g = _colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256]; 580 cb_b = _colorTab[*cb + 3 * 256]; 571 581 ++cr; 572 582 ++cb; 573 583 574 L = *lum++;575 C = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];584 L = &_rgbToPix[*lum++]; 585 C = L[cr_r] | L[crb_g] | L[cb_b]; 576 586 *r1++ = C; 577 587 *r1++ = C; 578 588 *r1++ = C; 579 589 580 L = *lum++;581 C = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];590 L = &_rgbToPix[*lum++]; 591 C = L[cr_r] | L[crb_g] | L[cb_b]; 582 592 *r1++ = C; 583 593 *r1++ = C; 584 594 *r1++ = C; 585 595 586 596 // Now, do second row. 587 597 588 L = *lum2++;589 C = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];598 L = &_rgbToPix[*lum2++]; 599 C = L[cr_r] | L[crb_g] | L[cb_b]; 590 600 *r2++ = C; 591 601 *r2++ = C; 592 602 *r2++ = C; 593 603 594 L = *lum2++;595 C = _rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L +cb_b];604 L = &_rgbToPix[*lum2++]; 605 C = L[cr_r] | L[crb_g] | L[cb_b]; 596 606 *r2++ = C; 597 607 *r2++ = C; 598 608 *r2++ = C;