| 432 | |
| 433 | |
| 434 | void CompressedFrame::compressYUV(Frame &f) |
| 435 | { |
| 436 | int tjflags = 0; |
| 437 | |
| 438 | if(f.hdr.subsamp != 4) throw(Error("YUV encoder", "Invalid argument")); |
| 439 | if(f.pf->bpc != 8) |
| 440 | throw(Error("YUV encoder", "YUV encoding requires 8 bits per component")); |
| 441 | |
| 442 | init(f.hdr, 0); |
| 443 | if(f.flags & FRAME_BOTTOMUP) tjflags |= TJ_BOTTOMUP; |
| 444 | TRY_TJ(tjEncodeYUV2(tjhnd, f.bits, f.hdr.width, f.pitch, f.hdr.height, |
| 445 | tjpf[f.pf->id], bits, TJSUBSAMP(f.hdr.subsamp), tjflags)); |
| 446 | hdr.size = (unsigned int)tjBufSizeYUV(f.hdr.width, f.hdr.height, |
| 447 | TJSUBSAMP(f.hdr.subsamp)); |
| 448 | } |
| 449 | |
| 450 | |
| 451 | void CompressedFrame::compressJPEG(Frame &f) |