| 305 | |
| 306 | |
| 307 | void VGLTrans::Compressor::compressSend(Frame *f, Frame *lastf) |
| 308 | { |
| 309 | CompressedFrame cframe; |
| 310 | |
| 311 | if(!f) return; |
| 312 | int tilesizex = fconfig.tilesize ? fconfig.tilesize : f->hdr.width; |
| 313 | int tilesizey = fconfig.tilesize ? fconfig.tilesize : f->hdr.height; |
| 314 | int i, j, n = 0; |
| 315 | |
| 316 | if(f->hdr.compress == RRCOMP_YUV) |
| 317 | { |
| 318 | profComp.startFrame(); |
| 319 | cframe = *f; |
| 320 | profComp.endFrame(f->hdr.framew * f->hdr.frameh, 0, 1); |
| 321 | parent->sendHeader(cframe.hdr); |
| 322 | parent->send((char *)cframe.bits, cframe.hdr.size); |
| 323 | return; |
| 324 | } |
| 325 | |
| 326 | bytes = 0; |
| 327 | for(i = 0; i < f->hdr.height; i += tilesizey) |
| 328 | { |
| 329 | int height = tilesizey, y = i; |
| 330 | |
| 331 | if(f->hdr.height - i < (3 * tilesizey / 2)) |
| 332 | { |
| 333 | height = f->hdr.height - i; i += tilesizey; |
| 334 | } |
| 335 | for(j = 0; j < f->hdr.width; j += tilesizex, n++) |
| 336 | { |
| 337 | int width = tilesizex, x = j; |
| 338 | |
| 339 | if(f->hdr.width - j < (3 * tilesizex / 2)) |
| 340 | { |
| 341 | width = f->hdr.width - j; j += tilesizex; |
| 342 | } |
| 343 | if(n % nprocs != myRank) continue; |
| 344 | if(fconfig.interframe) |
| 345 | { |
| 346 | if(f->tileEquals(lastf, x, y, width, height)) continue; |
| 347 | } |
| 348 | Frame *tile = f->getTile(x, y, width, height); |
| 349 | CompressedFrame *ctile = NULL; |
| 350 | if(myRank > 0) { ctile = new CompressedFrame(); } |
| 351 | else ctile = &cframe; |
| 352 | profComp.startFrame(); |
| 353 | *ctile = *tile; |
| 354 | double frames = (double)(tile->hdr.width * tile->hdr.height) / |
| 355 | (double)(tile->hdr.framew * tile->hdr.frameh); |
| 356 | profComp.endFrame(tile->hdr.width * tile->hdr.height, 0, frames); |
| 357 | bytes += ctile->hdr.size; |
| 358 | if(ctile->stereo) bytes += ctile->rhdr.size; |
| 359 | delete tile; |
| 360 | if(myRank == 0) |
| 361 | { |
| 362 | parent->sendHeader(ctile->hdr); |
| 363 | parent->send((char *)ctile->bits, ctile->hdr.size); |
| 364 | if(ctile->stereo && ctile->rbits) |
no test coverage detected