]> git.sesse.net Git - bmusb/blobdiff - bmusb.cpp
Add a specification for how the official DeckLink driver stores interlaced frmaes.
[bmusb] / bmusb.cpp
index 7f62a19bf7e4f68068ff309de4851e3637f640ca..9c0ff26e7b767cf522ce5184f9be30130e5c61d9 100644 (file)
--- a/bmusb.cpp
+++ b/bmusb.cpp
@@ -1,4 +1,4 @@
-// Intensity Shuttle USB3 capture driver, v0.5
+// Intensity Shuttle USB3 capture driver, v0.5.3
 // Can download 8-bit and 10-bit UYVY/v210 frames from HDMI, quite stable
 // (can do captures for hours at a time with no drops), except during startup
 // 576p60/720p60/1080i60 works, 1080p60 does not work (firmware limitation)
@@ -25,6 +25,7 @@
 
 #include <algorithm>
 #include <atomic>
+#include <chrono>
 #include <condition_variable>
 #include <cstddef>
 #include <cstdint>
@@ -37,6 +38,7 @@
 #include <thread>
 
 using namespace std;
+using namespace std::chrono;
 using namespace std::placeholders;
 
 #define USB_VENDOR_BLACKMAGIC 0x1edb
@@ -362,6 +364,8 @@ void BMUSBCapture::start_new_frame(const uint8_t *start)
        uint16_t timecode = (start[1] << 8) | start[0];
 
        if (current_video_frame.len > 0) {
+               current_video_frame.received_timestamp = steady_clock::now();
+
                // If format is 0x0800 (no signal), add a fake (empty) audio
                // frame to get it out of the queue.
                // TODO: Figure out if there are other formats that come with
@@ -405,6 +409,7 @@ void BMUSBCapture::start_new_audio_block(const uint8_t *start)
        uint16_t format = (start[3] << 8) | start[2];
        uint16_t timecode = (start[1] << 8) | start[0];
        if (current_audio_frame.len > 0) {
+               current_audio_frame.received_timestamp = steady_clock::now();
                //dump_audio_block();
                queue_frame(format, timecode, current_audio_frame, &pending_audio_frames);
        }
@@ -536,6 +541,10 @@ const uint8_t *add_to_frame_fastpath(FrameAllocator::Frame *current_frame, const
 
 #else  // defined(HAS_MULTIVERSIONING)
 
+__attribute__((target("sse4.1")))
+const uint8_t *add_to_frame_fastpath_core(FrameAllocator::Frame *current_frame, const uint8_t *aligned_start, const uint8_t *limit, const char sync_char);
+
+__attribute__((target("avx2")))
 const uint8_t *add_to_frame_fastpath_core(FrameAllocator::Frame *current_frame, const uint8_t *aligned_start, const uint8_t *limit, const char sync_char);
 
 // Does a memcpy and memchr in one to reduce processing time.