MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / compressJPEG

Method compressJPEG

common/Frame.cpp:451–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449
450
451void CompressedFrame::compressJPEG(Frame &f)
452{
453 int tjflags = 0;
454
455 if(f.hdr.qual > 100 || f.hdr.subsamp > 16 || !IS_POW2(f.hdr.subsamp))
456 throw(Error("JPEG compressor", "Invalid argument"));
457 if(f.pf->bpc != 8)
458 throw(Error("JPEG compressor",
459 "JPEG compression requires 8 bits per component"));
460
461 init(f.hdr, f.stereo ? RR_LEFT : 0);
462 if(f.flags & FRAME_BOTTOMUP) tjflags |= TJ_BOTTOMUP;
463 unsigned long size;
464 TRY_TJ(tjCompress2(tjhnd, f.bits, f.hdr.width, f.pitch, f.hdr.height,
465 tjpf[f.pf->id], &bits, &size, TJSUBSAMP(f.hdr.subsamp), f.hdr.qual,
466 tjflags | TJFLAG_NOREALLOC));
467 hdr.size = (unsigned int)size;
468 if(f.stereo && f.rbits)
469 {
470 init(f.hdr, RR_RIGHT);
471 if(rbits)
472 TRY_TJ(tjCompress2(tjhnd, f.rbits, f.hdr.width, f.pitch, f.hdr.height,
473 tjpf[f.pf->id], &rbits, &size, TJSUBSAMP(f.hdr.subsamp), f.hdr.qual,
474 tjflags | TJFLAG_NOREALLOC));
475 rhdr.size = (unsigned int)size;
476 }
477}
478
479
480void CompressedFrame::compressRGB(Frame &f)

Callers

nothing calls this directly

Calls 2

ErrorClass · 0.50
initFunction · 0.50

Tested by

no test coverage detected