| 59 | } |
| 60 | |
| 61 | void ColorStream::populateFrame(libfreenect2::Frame* srcFrame, int srcX, int srcY, OniFrame* dstFrame, int dstX, int dstY, int width, int height) const |
| 62 | { |
| 63 | dstFrame->sensorType = getSensorType(); |
| 64 | dstFrame->stride = dstFrame->width * 3; |
| 65 | |
| 66 | // copy stream buffer from freenect |
| 67 | switch (video_mode.pixelFormat) |
| 68 | { |
| 69 | default: |
| 70 | LogError("Pixel format " + to_string(video_mode.pixelFormat) + " not supported by populateFrame()"); |
| 71 | return; |
| 72 | |
| 73 | case ONI_PIXEL_FORMAT_RGB888: |
| 74 | if (reg->isEnabled()) { |
| 75 | libfreenect2::Frame registered(512, 424, 4); |
| 76 | |
| 77 | reg->colorFrameRGB888(srcFrame, ®istered); |
| 78 | |
| 79 | copyFrame(static_cast<uint8_t*>(registered.data), srcX, srcY, registered.width * registered.bytes_per_pixel, |
| 80 | static_cast<uint8_t*>(dstFrame->data), dstX, dstY, dstFrame->stride, |
| 81 | width, height, mirroring); |
| 82 | } else { |
| 83 | copyFrame(static_cast<uint8_t*>(srcFrame->data), srcX, srcY, srcFrame->width * srcFrame->bytes_per_pixel, |
| 84 | static_cast<uint8_t*>(dstFrame->data), dstX, dstY, dstFrame->stride, |
| 85 | width, height, mirroring); |
| 86 | } |
| 87 | return; |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | void ColorStream::copyFrame(uint8_t* srcPix, int srcX, int srcY, int srcStride, uint8_t* dstPix, int dstX, int dstY, int dstStride, int width, int height, bool mirroring) |
| 92 | { |
nothing calls this directly
no test coverage detected