MCPcopy Create free account
hub / github.com/AIRLegend/aitrack / Dequeue

Method Dequeue

PS3Driver/src/ps3eye.cpp:483–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

481 }
482
483 void Dequeue(uint8_t* new_frame, int frame_width, int frame_height, PS3EYECam::EOutputFormat outputFormat)
484 {
485 std::unique_lock<std::mutex> lock(mutex);
486
487 // If there is no data in the buffer, wait until data becomes available
488 empty_condition.wait(lock, [this] () { return available != 0; });
489
490 // Copy from internal buffer
491 uint8_t* source = frame_buffer + frame_size * tail;
492
493 if (outputFormat == PS3EYECam::EOutputFormat::Bayer)
494 {
495 memcpy(new_frame, source, frame_size);
496 }
497 else if (outputFormat == PS3EYECam::EOutputFormat::BGR ||
498 outputFormat == PS3EYECam::EOutputFormat::RGB)
499 {
500 DebayerRGB(frame_width, frame_height, source, new_frame, outputFormat == PS3EYECam::EOutputFormat::BGR);
501 }
502 else if (outputFormat == PS3EYECam::EOutputFormat::Gray)
503 {
504 DebayerGray(frame_width, frame_height, source, new_frame);
505 }
506 // Update tail and available count
507 tail = (tail + 1) % num_frames;
508 available--;
509 }
510
511 void DebayerGray(int frame_width, int frame_height, const uint8_t* inBayer, uint8_t* outBuffer)
512 {

Callers 1

getFrameMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected