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

Function rgbBench

common/frameut.cpp:557–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

555
556
557void rgbBench(char *filename)
558{
559 unsigned char *buf; int width, height, dstbu;
560 CompressedFrame src; Frame dst; int dstformat;
561
562 for(dstformat = 0; dstformat < PIXELFORMATS - 1; dstformat++)
563 {
564 PF *dstpf = pf_get(dstformat);
565 for(dstbu = 0; dstbu < 2; dstbu++)
566 {
567 if(bmp_load(filename, &buf, &width, 1, &height, PF_RGB,
568 BMPORN_BOTTOMUP) == -1)
569 THROW(bmp_geterr());
570 rrframeheader hdr;
571 memset(&hdr, 0, sizeof(hdr));
572 hdr.width = hdr.framew = width;
573 hdr.height = hdr.frameh = height;
574 hdr.compress = RRCOMP_RGB; hdr.size = width * 3 * height;
575 src.init(hdr, hdr.flags);
576 memcpy(src.bits, buf, width * 3 * height);
577 dst.init(hdr, dstpf->id, dstbu ? FRAME_BOTTOMUP : 0);
578 memset(dst.bits, 0, dst.pitch * dst.hdr.frameh);
579 fprintf(stderr, "RGB (BOTTOM-UP) -> %s (%s)\n", dstpf->name,
580 dstbu ? "BOTTOM-UP" : "TOP-DOWN");
581 double tStart, tTotal = 0.; int iter = 0;
582 do
583 {
584 tStart = GetTime();
585 dst.decompressRGB(src, width, height, false);
586 tTotal += GetTime() - tStart; iter++;
587 } while(tTotal < 1.);
588 fprintf(stderr, "%f Mpixels/sec - ", (double)width * (double)height *
589 (double)iter / 1000000. / tTotal);
590 if(cmpFrame(buf, width, height, dst))
591 fprintf(stderr, "FAILED!\n");
592 else fprintf(stderr, "Passed.\n");
593 free(buf);
594 }
595 fprintf(stderr, "\n");
596 }
597}
598
599
600void usage(char **argv)

Callers 1

mainFunction · 0.85

Calls 7

pf_getFunction · 0.85
bmp_loadFunction · 0.85
bmp_geterrFunction · 0.85
GetTimeFunction · 0.85
cmpFrameFunction · 0.85
decompressRGBMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected