| 478 | |
| 479 | |
| 480 | void CompressedFrame::compressRGB(Frame &f) |
| 481 | { |
| 482 | unsigned char *srcptr; |
| 483 | bool bu = (f.flags & FRAME_BOTTOMUP); |
| 484 | |
| 485 | if(f.pf->bpc != 8) |
| 486 | throw(Error("RGB compressor", |
| 487 | "RGB encoding requires 8 bits per component")); |
| 488 | |
| 489 | int dstPitch = f.hdr.width * 3; |
| 490 | int srcStride = bu ? f.pitch : -f.pitch; |
| 491 | init(f.hdr, f.stereo ? RR_LEFT : 0); |
| 492 | srcptr = bu ? f.bits : &f.bits[f.pitch * (f.hdr.height - 1)]; |
| 493 | f.pf->convert(srcptr, f.hdr.width, srcStride, f.hdr.height, bits, dstPitch, |
| 494 | pf_get(PF_RGB)); |
| 495 | hdr.size = dstPitch * f.hdr.height; |
| 496 | |
| 497 | if(f.stereo && f.rbits) |
| 498 | { |
| 499 | init(f.hdr, RR_RIGHT); |
| 500 | if(rbits) |
| 501 | { |
| 502 | srcptr = bu ? f.rbits : &f.rbits[f.pitch * (f.hdr.height - 1)]; |
| 503 | f.pf->convert(srcptr, f.hdr.width, srcStride, f.hdr.height, rbits, |
| 504 | dstPitch, pf_get(PF_RGB)); |
| 505 | rhdr.size = dstPitch * f.hdr.height; |
| 506 | } |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | |
| 511 | void CompressedFrame::init(rrframeheader &h, int buffer) |