Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D capture on Blackmagic DeckLink 4K Extreme 12G #56

Merged
merged 161 commits into from
Nov 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
161 commits
Select commit Hold shift + click to select a range
8c40e1a
Issue #5: activated Blackmagic CI tests
Aug 2, 2018
7268f28
Issue #5: fixed Blackmagic SDK location pointer
Aug 2, 2018
861ccd2
Issue #14: added artificial scope for data lock to be released before
Aug 9, 2018
9354bc0
Issue #14: first checking execution flag before welcoming new frame data
Aug 9, 2018
ee70ecc
Issue #14: keeping track of number of supported devices via an enum v…
Aug 9, 2018
e404a05
Issue #14: making sure all devices are freed in VideoSourceFactory de…
Aug 9, 2018
c9cd46a
Issue #14: introduced dummy memory allocation to prevent test failure…
Aug 9, 2018
95a9e96
Issue #5, #14: removed 'garbage-collection' tests, as it seems to fol…
dzhoshkun Sep 4, 2018
e67d90e
Issue #5: added bmdVideoInputDualStream3D to the video input format d…
dzhoshkun Sep 14, 2018
8cf8239
Issue #5: DeckLink display mode detector appropriately sets 3D suppor…
dzhoshkun Sep 14, 2018
cf76bee
Issue #5: added a get_video_input_flags method to DeckLink display mo…
dzhoshkun Sep 14, 2018
f2986c1
Issue #5: detect_input_format of BM video source now modifies video i…
dzhoshkun Sep 14, 2018
5e92622
Issue #5: removed bmdVideoInputEnableFormatDetection from video input…
dzhoshkun Sep 28, 2018
e6f6284
Issue #5: Blackmagic video source falls back to non-stereo in case bm…
dzhoshkun Oct 5, 2018
97c77ff
Issue #5: artificial sleep for enabling video streaming factored from…
dzhoshkun Oct 5, 2018
c1fdf3b
Issue #5: added a Python script for testing 3D capture support
dzhoshkun Oct 12, 2018
5da62f1
Issue #5: test script now writes left and right frames
dzhoshkun Oct 14, 2018
2b93497
Issue #5: made video flags an attribute of BM video source
dzhoshkun Oct 14, 2018
5331d27
Issue #5: shell script for testing automated
dzhoshkun Oct 14, 2018
230d8c9
Issue #5: renamed test shell script for clarity
dzhoshkun Oct 14, 2018
dccf3d2
Issue #5: ignoring output folder
dzhoshkun Oct 14, 2018
3e7abdd
Issue #5: shell script changing to session dir to make sure all outpu…
dzhoshkun Oct 14, 2018
3fd7879
Issue #5: added an is_stereo method to BM video source
dzhoshkun Oct 14, 2018
61968a3
Issue #5: hacker-style capturing of stereo frame into an extended buffer
dzhoshkun Oct 14, 2018
499668a
Issue #5: ignoring automated build folder
dzhoshkun Oct 14, 2018
b3edcd5
Issue #5: using BM SDK path on trinidad in shell script
dzhoshkun Oct 15, 2018
03da79c
Issue #5: FrameSaver in Python script simply collecting NumPy arrays …
dzhoshkun Oct 15, 2018
e4a95f7
Issue #5: FrameSaver reports absolute output path now
dzhoshkun Oct 15, 2018
f6d6de0
Issue #5: activated Blackmagic CI tests
Aug 2, 2018
432298a
Issue #14: introduced dummy memory allocation to prevent test failure…
Aug 9, 2018
e54cc20
Issue #5, #14: removed 'garbage-collection' tests, as it seems to fol…
dzhoshkun Sep 4, 2018
9f7198d
Issue #5: added bmdVideoInputDualStream3D to the video input format d…
dzhoshkun Sep 14, 2018
9ac64b2
Issue #5: DeckLink display mode detector appropriately sets 3D suppor…
dzhoshkun Sep 14, 2018
c54a120
Issue #5: added a get_video_input_flags method to DeckLink display mo…
dzhoshkun Sep 14, 2018
56dd425
Issue #5: detect_input_format of BM video source now modifies video i…
dzhoshkun Sep 14, 2018
4528ed0
Issue #5: removed bmdVideoInputEnableFormatDetection from video input…
dzhoshkun Sep 28, 2018
b33e3cb
Issue #5: Blackmagic video source falls back to non-stereo in case bm…
dzhoshkun Oct 5, 2018
e6773a2
Issue #5: artificial sleep for enabling video streaming factored from…
dzhoshkun Oct 5, 2018
7c4284a
Issue #5: added a Python script for testing 3D capture support
dzhoshkun Oct 12, 2018
0b8fbc3
Issue #5: test script now writes left and right frames
dzhoshkun Oct 14, 2018
510d84d
Issue #5: made video flags an attribute of BM video source
dzhoshkun Oct 14, 2018
ff55784
Issue #5: shell script for testing automated
dzhoshkun Oct 14, 2018
199f26d
Issue #5: renamed test shell script for clarity
dzhoshkun Oct 14, 2018
58aa754
Issue #5: ignoring output folder
dzhoshkun Oct 14, 2018
46f90d1
Issue #5: shell script changing to session dir to make sure all outpu…
dzhoshkun Oct 14, 2018
1d5826c
Issue #5: added an is_stereo method to BM video source
dzhoshkun Oct 14, 2018
d303d71
Issue #5: hacker-style capturing of stereo frame into an extended buffer
dzhoshkun Oct 14, 2018
dfe077a
Issue #5: ignoring automated build folder
dzhoshkun Oct 14, 2018
de91c76
Issue #5: using BM SDK path on trinidad in shell script
dzhoshkun Oct 15, 2018
41f1901
Issue #5: FrameSaver in Python script simply collecting NumPy arrays …
dzhoshkun Oct 15, 2018
58c6a1b
Issue #5: FrameSaver reports absolute output path now
dzhoshkun Oct 15, 2018
4c5f596
After rebasing onto master:
dzhoshkun Nov 13, 2018
b2b35f0
Issue #5: running all DeckLink tests for current branch
dzhoshkun Nov 13, 2018
5250cb2
Issue #53: using a lower frame rate with DeckLink 4K Extreme 12G
dzhoshkun Nov 13, 2018
4698daa
Issue #53: using lower frame rate in test launcher as well
dzhoshkun Nov 13, 2018
29472d6
Issue #18: activated Blackmagic CI tests for current branch [ci-skip]
dzhoshkun Nov 13, 2018
e597ce2
Issue #18: added a StereoFrameChecker test utility
dzhoshkun Nov 13, 2018
8a70c7c
Issue #18: added a stereo frames test
dzhoshkun Nov 13, 2018
802a2b6
Issue #18: activated stereo frames test for DeckLink 4K Extreme 12G i…
dzhoshkun Nov 13, 2018
506c4f9
Issue #18: stereo frame checker fails if no frame has been received
dzhoshkun Nov 13, 2018
1f6b46e
Issue #18: activated stereo frames test for DeckLink 4K Extreme 12G i…
dzhoshkun Nov 13, 2018
07700cb
Issue #18: implemented update method of StereoFrameChecker
dzhoshkun Nov 13, 2018
000439e
Issue #18: renamed attribute for clarity
dzhoshkun Nov 14, 2018
5a1b737
Issue #18: stereo frame checker requires at least 2 frames now
dzhoshkun Nov 14, 2018
6fe2dd4
Issue #18: renamed StereoFrameChecker => StereoFrameConsistencyChecker
dzhoshkun Nov 14, 2018
d7f96e9
Issue #18: added a NumPy compatibility checker with a focus on stereo…
dzhoshkun Nov 14, 2018
761ff01
Issue #18: NumPy compatibility checker supports structured arrays for…
dzhoshkun Nov 14, 2018
4d32ddc
Issue #18: activated the NumPy compatibility checker for stereo frames
dzhoshkun Nov 14, 2018
62ed104
Issue #18: custom NumPy data length check based on whether structured…
dzhoshkun Nov 14, 2018
1aaa00a
Issue #18: factored regression tests out of the loop
dzhoshkun Nov 14, 2018
dd9d071
Issue #18: factored backwards compatibility tests out to dedicated class
dzhoshkun Nov 14, 2018
6954e9a
Issue #18: added an optional stereo_index parameter to data method si…
dzhoshkun Nov 14, 2018
94610c4
Issue #18: added an optional stereo_index parameter to data_length me…
dzhoshkun Nov 14, 2018
157df72
Issue #18: moved explanation about stereo frames to class header
dzhoshkun Nov 14, 2018
43ee0e7
Issue #18: added an optional stereo_count parameter to init_from_spec…
dzhoshkun Nov 14, 2018
8afd2bc
Issue #18: added an attribute to keep no of stereo frames
dzhoshkun Nov 14, 2018
e8582bc
Issue #18: data_length method with default parameter in Python
dzhoshkun Nov 15, 2018
53fb1e0
Issue #18: translator for std::out_of_range => IndexError in Python
dzhoshkun Nov 15, 2018
8772c4a
Issue #18: added unit test stubs for stereo frames
dzhoshkun Nov 15, 2018
484ed96
Issue #18: activated stereo frame unit tests in CTest
dzhoshkun Nov 15, 2018
666b97e
Issue #18: extended NumPy compatibility tests with stereo frame test …
dzhoshkun Nov 15, 2018
dae83a6
Issue #18: added a section to tests launcher about new stereo frame u…
dzhoshkun Nov 15, 2018
b096dd7
Issue #18: activated stereo frame nit tests for pip installer
dzhoshkun Nov 15, 2018
06c85a3
Issue #18: implemented NumPy compatibility tests stereo extension
dzhoshkun Nov 15, 2018
8383da5
Issue #18: implemented unit tests for stereo frames
dzhoshkun Nov 15, 2018
20c3e16
Issue #18: added clarification to VideoFrame.data method docstring ab…
dzhoshkun Nov 15, 2018
14bc61f
Issue #18: using required_data_length function to compute data length…
dzhoshkun Nov 15, 2018
9dbff09
Issue #18: exposed stereo_count method to Python
dzhoshkun Nov 15, 2018
36fba1f
Issue #18: data_length now reports only one stereo frame's length
dzhoshkun Nov 15, 2018
3afa602
Issue #18: data_length now checks passed stereo index
dzhoshkun Nov 15, 2018
3ba0075
Issue #18: added support for retrieving stereo frame data
dzhoshkun Nov 15, 2018
1b362ca
Issue #18: VideoFrame constructor now accepts optional stereo count p…
dzhoshkun Nov 15, 2018
38b8f44
Issue #18: exposed constructor's stereo count parameter to Python
dzhoshkun Nov 15, 2018
6aa29a2
Issue #18: init_from_specs now respects stereo count parameter
dzhoshkun Nov 15, 2018
6213fdd
Issue #18: added a const qualifier to stereo index validator
dzhoshkun Nov 15, 2018
57470fc
Issue #18: added optional stereo count parameter to NumPy video frame…
dzhoshkun Nov 15, 2018
3fdbc03
Issue #18: optional VideoFrame constructor parameter exposed to Pytho…
dzhoshkun Nov 15, 2018
308dba8
Issue #18: resetting stereo count upon freeing video frame memory
dzhoshkun Nov 15, 2018
19dd2b2
Issue #18: more robust video frame data retrieval with null check
dzhoshkun Nov 15, 2018
ec5b2f4
Issue #18: syncing stereo count of video frame NumPy wrapper
dzhoshkun Nov 15, 2018
7f15ccb
Issue #18: fixed call to required data length calculator
dzhoshkun Nov 15, 2018
274501d
Issue #18: stereo frame data retrieval in Python
dzhoshkun Nov 15, 2018
d192978
Issue #18: Blackmagic video source now uses new stereo video API
dzhoshkun Nov 16, 2018
9503600
Issue #18: added missing test file copy
dzhoshkun Nov 16, 2018
c09264c
Issue #18: moved stereo capture example files up to blackmagic test f…
dzhoshkun Nov 16, 2018
0710cba
Issue #18: removed convenience script for running stereo capture example
dzhoshkun Nov 16, 2018
61d60ea
Issue #18, #5: added an RTD page with the stereo capture example
dzhoshkun Nov 16, 2018
11679b6
Issue #18: added missing assertion
dzhoshkun Nov 19, 2018
d52c8d4
Issue #18: fixed typo
dzhoshkun Nov 19, 2018
220c666
Issue #18: NumPy API should be activated for stereo tests with BM Dec…
dzhoshkun Nov 19, 2018
34d6a12
Issue #18: added NumPy option to CI for testing BM stereo device
dzhoshkun Nov 19, 2018
c3920ac
Issue #18: fixed import statement in stereo tests
dzhoshkun Nov 19, 2018
daefa5e
Issue #18: revised example for full coverage of new API [ci-skip]
dzhoshkun Nov 19, 2018
bde4415
Issue #18: revised example for compacter output [ci-skip]
dzhoshkun Nov 19, 2018
b534942
Issue #18: added missing working dir directive to test launch
dzhoshkun Nov 19, 2018
0aba9b6
Issue #18: added mono calls to example yielding structured NumPy arra…
dzhoshkun Nov 19, 2018
83e1ca5
Issue #18: further clarification added to example [ci-skip]
dzhoshkun Nov 19, 2018
dab93be
Issue #18: added missing installation steps to CI script
dzhoshkun Nov 20, 2018
5e7ff41
Issue #18: removed unneeded PyYAML installation step
dzhoshkun Nov 20, 2018
598ab12
Issue #18: revised Blackmagic software installation tips [ci-skip]
dzhoshkun Nov 20, 2018
5e7c568
Issue #18: added slicing to example to allow for extracting BGR data …
dzhoshkun Nov 20, 2018
2511eec
Issue #18: added further clarification to example RTD page [ci-skip]
dzhoshkun Nov 20, 2018
a0b31ea
Issue #30: activated CI for current branch
dzhoshkun Nov 21, 2018
1733cf5
Issue #30: added an internal BGRA frame class stub
dzhoshkun Nov 22, 2018
25646ec
Issue #30: activated new class in CMake config
dzhoshkun Nov 22, 2018
9f796cc
Issue #30: added a DeckLink colour converter member to Blackmagic vid…
dzhoshkun Nov 22, 2018
20c93eb
Issue #30: added internal frame buffers for post-capture colour conve…
dzhoshkun Nov 22, 2018
b991e62
Issue #30: releasing DeckLink converter upon destruction
dzhoshkun Nov 22, 2018
627c0ca
Issue #30: creating converter before launching streams
dzhoshkun Nov 22, 2018
e7e3048
Issue #30: releasing post-capture conversion buffers upon destruction
dzhoshkun Nov 22, 2018
8eaab5e
Issue #30: using DeckLink converter for BGRA captures
dzhoshkun Nov 22, 2018
9e538cd
Issue #30: implemented DeckLinkBGRAVideoFrame except for QueryInterfa…
dzhoshkun Nov 22, 2018
299e3b9
Issue #30: fixed pixel buffer length of DeckLinkBGRAVideoFrame
dzhoshkun Nov 22, 2018
07d5e49
Issue #30: fixed copying of data
dzhoshkun Nov 22, 2018
2698e69
Issue #30: implemented QueryInterface
dzhoshkun Nov 22, 2018
60ea434
Issue #30: using bmdFormat12BitRGB instead of bmdFormat8BitBGRA for c…
dzhoshkun Nov 22, 2018
b7b5e07
Issue #59: added note about the specific use of 12-bit RGB format to …
dzhoshkun Nov 22, 2018
af1f2fc
Issue #30: fixed GetBytes method
dzhoshkun Nov 22, 2018
8e33a60
Issue #30: fixed data length computation
dzhoshkun Nov 22, 2018
6b82fb4
Issue #30: using 10-bit YUV instead of 12-bit RGB
dzhoshkun Nov 22, 2018
45bf4d3
Issue #30: removed unused pixel buffer length member
dzhoshkun Nov 23, 2018
f92a50e
Issue #30: input format detector also detects frame dimensions now
dzhoshkun Nov 23, 2018
9e5b18c
Issue #30: using an internal conversion requirement checker method
dzhoshkun Nov 23, 2018
2210449
Issue #30: factored internal BGRA video buffer allocation out to cons…
dzhoshkun Nov 23, 2018
5e14750
Issue #30: reallocating internal BGRA buffers if frame size increases
dzhoshkun Nov 23, 2018
6efd3b0
Issue #30: fixed frame flags for reallocating internal BGRA buffers
dzhoshkun Nov 23, 2018
2f17a9d
Issue #30: internal buffer (re-)allocation not conditional on previou…
dzhoshkun Nov 23, 2018
ae001eb
Issue #30: allocating buffers right after input format detection
dzhoshkun Nov 23, 2018
14590f6
Issue #30: allocating internal BGRA buffers right after input format …
dzhoshkun Nov 23, 2018
7739c0e
Issue #30: using a dedicated smart buffer allocator method
dzhoshkun Nov 23, 2018
db6fb51
Issue #30: internal buffer allocator method now inline
dzhoshkun Nov 23, 2018
95b5b0f
Issue #30: removed unneeded parentheses
dzhoshkun Nov 23, 2018
b1651d2
Issue #30: removed first, unneeded smart buffer allocation
dzhoshkun Nov 23, 2018
78fdeff
Issue #30: fixed use of local var for querying frame dims
dzhoshkun Nov 23, 2018
3032a7b
Issue #30: fixed selective internal buffer initialisation
dzhoshkun Nov 23, 2018
e454108
Issue #30: extra dimension positivity check in smart buffer allocator…
dzhoshkun Nov 23, 2018
4a6c593
Issue #30: deleting internal BGRA buffers upon destruction
dzhoshkun Nov 23, 2018
fbef4fc
Issue #30: doing smart buffer allocation within the mutex scope
dzhoshkun Nov 23, 2018
bac3569
Issue #30: fixed ordering of mutex lock before smart buffer allocation
dzhoshkun Nov 23, 2018
24817f0
Merge pull request #58 from gift-surg/30-12-bit-rgb-to-bgra-converter…
dzhoshkun Nov 23, 2018
d6924f8
Issue #61, #53: reduced frame rate specs in tests
dzhoshkun Nov 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ src/*.egg-info
*.swp
src/tests/pipeline/mtr-build
gg-iss-16
gg-iss-5
bm3d-build
27 changes: 22 additions & 5 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ pypi:
- cd $GiftGrab_venv
- source bin/activate
- pip install pytest
- pip install pyyaml
- ls -alh ./*
- PyPI_INSTALLER="../$GiftGrab_PyPI_DIST_DIR/$(ls ../$GiftGrab_PyPI_DIST_DIR | grep tar.gz)"
- if [ -z "$PyPI_INSTALLER" ]; then exit 1; fi
Expand Down Expand Up @@ -173,6 +172,10 @@ pypi:
- pip install numpy
- $TEST_LAUNCHER numpy bgra; exit_on_fail
- $TEST_LAUNCHER numpy i420; exit_on_fail
# Runt stereo frame tests
- $TEST_LAUNCHER stereo bgra; exit_on_fail
- $TEST_LAUNCHER stereo i420; exit_on_fail
- $TEST_LAUNCHER stereo uyvy; exit_on_fail
# test support for video files
- pip install -vvv --install-option="--hevc" --install-option="--enable-nonfree" --install-option="--nvenc" --install-option="--xvid" --install-option="--vp9" --install-option="--numpy" --install-option="--files" --upgrade "$PyPI_INSTALLER"
- $TEST_LAUNCHER decode hevc bgra; exit_on_fail
Expand Down Expand Up @@ -430,8 +433,9 @@ pypi-blackmagic-decklink-sdi-4k:
- PyPI_INSTALLER="../$GiftGrab_PyPI_DIST_DIR/$(ls ../$GiftGrab_PyPI_DIST_DIR | grep tar.gz)"
- if [ -z "$PyPI_INSTALLER" ]; then exit 1; fi
# because pip seems to be getting confused about install options sometimes:
- pip install PyYAML
- pip install pytest
- pip install numpy
- pip install scipy
- pip install -vvv --install-option="--blackmagic-decklink-sdi-4k" --install-option="--enable-nonfree" --upgrade "$PyPI_INSTALLER"
# run tests
- $TEST_LAUNCHER blackmagic-decklinksdi4k uyvy; exit_on_fail
Expand All @@ -444,6 +448,9 @@ pypi-blackmagic-decklink-sdi-4k:
- 23-support-for-blackmagic-decklink-4k-extreme-12g
- 20-support-for-capturing-bgra-frames-with-blackmagic-devices
- 14-unable-to-free-blackmagic-video-source
- 5-support-for-3d-capture-on-blackmagic-cards
- 18-extend-api-to-support-stereo-streams
- 30-12-bit-rgb-to-bgra-converter-for-decklink

blackmagic-decklink-sdi-4k:
stage: test_cmake
Expand All @@ -466,6 +473,9 @@ blackmagic-decklink-sdi-4k:
- 23-support-for-blackmagic-decklink-4k-extreme-12g
- 20-support-for-capturing-bgra-frames-with-blackmagic-devices
- 14-unable-to-free-blackmagic-video-source
- 5-support-for-3d-capture-on-blackmagic-cards
- 18-extend-api-to-support-stereo-streams
- 30-12-bit-rgb-to-bgra-converter-for-decklink

################## Device: Blackmagic DeckLink 4K Extreme 12G ##################
pypi-blackmagic-decklink-4k-extreme-12g:
Expand Down Expand Up @@ -494,9 +504,10 @@ pypi-blackmagic-decklink-4k-extreme-12g:
- PyPI_INSTALLER="../$GiftGrab_PyPI_DIST_DIR/$(ls ../$GiftGrab_PyPI_DIST_DIR | grep tar.gz)"
- if [ -z "$PyPI_INSTALLER" ]; then exit 1; fi
# because pip seems to be getting confused about install options sometimes:
- pip install PyYAML
- pip install pytest
- pip install -vvv --install-option="--blackmagic-decklink-4k-extreme-12g" --install-option="--enable-nonfree" --upgrade "$PyPI_INSTALLER"
- pip install numpy
- pip install scipy
- pip install -vvv --install-option="--blackmagic-decklink-4k-extreme-12g" --install-option="--enable-nonfree" --install-option="--numpy" --upgrade "$PyPI_INSTALLER"
# run tests
- $TEST_LAUNCHER blackmagic-decklink4kextreme12g uyvy; exit_on_fail
- $TEST_LAUNCHER blackmagic-decklink4kextreme12g bgra; exit_on_fail
Expand All @@ -510,6 +521,9 @@ pypi-blackmagic-decklink-4k-extreme-12g:
- 20-support-for-capturing-bgra-frames-with-blackmagic-devices
- 32-videosourcefactory-destructor-does-not-free-all-devices
- 14-unable-to-free-blackmagic-video-source
- 5-support-for-3d-capture-on-blackmagic-cards
- 18-extend-api-to-support-stereo-streams
- 30-12-bit-rgb-to-bgra-converter-for-decklink

blackmagic-decklink-4k-extreme-12g:
stage: test_cmake
Expand All @@ -520,7 +534,7 @@ blackmagic-decklink-4k-extreme-12g:
- rm -rf "$GiftGrab_BUILD_DIR"
- mkdir -p "$GiftGrab_BUILD_DIR"
- cd "$GiftGrab_BUILD_DIR"
- cmake -D BUILD_PYTHON=ON -D BUILD_TESTS=ON -D USE_BLACKMAGIC_DECKLINK_4K_EXTREME_12G=ON -D ENABLE_NONFREE=ON "$GiftGrab_SOURCE_DIR"
- cmake -D BUILD_PYTHON=ON -D USE_NUMPY=ON -D BUILD_TESTS=ON -D USE_BLACKMAGIC_DECKLINK_4K_EXTREME_12G=ON -D ENABLE_NONFREE=ON "$GiftGrab_SOURCE_DIR"
- make -j; exit_on_fail
- ctest; exit_on_fail
tags:
Expand All @@ -531,3 +545,6 @@ blackmagic-decklink-4k-extreme-12g:
- 20-support-for-capturing-bgra-frames-with-blackmagic-devices
- 32-videosourcefactory-destructor-does-not-free-all-devices
- 14-unable-to-free-blackmagic-video-source
- 5-support-for-3d-capture-on-blackmagic-cards
- 18-extend-api-to-support-stereo-streams
- 30-12-bit-rgb-to-bgra-converter-for-decklink
2 changes: 1 addition & 1 deletion doc/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The parantheses in the version column mean that the listed version has been test
| [libvpx](https://www.webmproject.org/code/) | 1.3.0 | |
| [libVLC (VLC SDK)](https://wiki.videolan.org/LibVLC/) | 3.0.0 release candidate: [nighly build ID: 20160913-0237](http://nightlies.videolan.org/build/source/?C=M;O=D) | Please see the note in the [libVLC installation instructions](tips.md#libvlc) about using libVLC for capturing network streams. |
| [Epiphan Video Grabber SDK](https://www.epiphan.com/support/) | 3.30.3.0007 | Epiphan Video Grabber SDK has a proprietary licence: enabling Epiphan Video Grabber SDK makes GIFT-Grab undistributable. |
| [Blackmagic Desktop Video SDK](https://www.blackmagicdesign.com/support) | 10.4 | Blackmagic Desktop Video SDK has a proprietary licence: enabling support for Blackmagic cards makes GIFT-Grab undistributable. |
| [Blackmagic Desktop Video SDK](https://www.blackmagicdesign.com/support) | 10.11 | Blackmagic Desktop Video SDK has a proprietary licence: enabling support for Blackmagic cards makes GIFT-Grab undistributable. |
| [Python](https://www.python.org/) | 2.7 | |
| [Boost.Python](http://www.boost.org/doc/libs/release/libs/python/) | 1.54.0, and 1.63.0 beta 1 for NumPy support | |
| [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/) | | |
Expand Down
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Examples
scipy
encoding
complex
stereo

Citing GIFT-Grab
^^^^^^^^^^^^^^^^
Expand Down
25 changes: 25 additions & 0 deletions doc/source/stereo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. _Stereo:

Capturing stereo video
======================

GIFT-Grab allows for capturing stereo video streams from frame grabbers supporting this
feature.
The example below demonstrates how stereo frames can be acquired and saved to individual
image files.
Running this example requires GIFT-Grab built/installed with support for
`Blackmagic DeckLink 4K Extreme 12G`_ and NumPy_.
The example uses OpenCV_ to save video frames to disk.

.. _`Blackmagic DeckLink 4K Extreme 12G`: https://github.com/gift-surg/GIFT-Grab/blob/master/doc/pypi.md#blackmagic-decklink-4k-extreme-12g
.. _NumPy: https://github.com/gift-surg/GIFT-Grab/blob/master/doc/pypi.md#numpy
.. _OpenCV: http://www.opencv.org/

The full source code of the example is below.
Please follow the comments and the flow of code.
This example is also available on GitHub_:

.. literalinclude:: ../../src/tests/blackmagic/stereo_capture.py
:language: python

.. _GitHub: https://github.com/gift-surg/GIFT-Grab/blob/master/src/tests/blackmagic/stereo_capture.py
28 changes: 21 additions & 7 deletions doc/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ If you encounter problems installing any dependency, please have a look at the [

## Epiphan Video Grabbing SDK

These instructions are provided for convenience only.
Always check the manufacturer's manuals before proceeding.

1. Download Epiphan video grabbing SDK from [Epiphan support](https://www.epiphan.com/support/) and unpack it, e.g. `wget https://www.epiphan.com/downloads/products/epiphan_sdk-3.30.3.0007.zip; unzip epiphan_sdk-3.30.3.0007.zip`.
1. Change into the sub-folder `epiphan/samples/v2u` and run `make`. This should create a `build` folder here.
1. (Optional) Move the top folder (i.e. the one resulting from unpacking the archive) to a system folder, e.g. `/opt`, for easy access by all users.
Expand All @@ -25,14 +28,25 @@ If you encounter problems installing any dependency, please have a look at the [

## Blackmagic Drivers and Blackmagic Desktop Video SDK

1. Download and unpack [Blackmagic Desktop Video SDK](https://www.blackmagicdesign.com/support).
1. If the resulting folder name has spaces e.g. `Blackmagic DeckLink SDK 10.4`, replace spaces with an underscore, e.g. `Blackmagic_DeckLink_SDK_10.4`.
1. (Optional) Move the resulting folder to a system folder, e.g. `/opt`, for easy access by all users.
1. Specify the **absolute** path of the `SDK` sub-folder of this folder as the `BlackmagicSDK_DIR` environment variable, e.g. `export BlackmagicSDK_DIR="/opt/Blackmagic DeckLink SDK 10.4/SDK"`.
1. Install the driver package appropriate for your system (e.g. `/opt/Blackmagic DeckLink SDK 10.4/deb/amd64/desktopvideo_10.8.4a4_amd64.deb` for a 64-bit Ubuntu Linux).
1. (Optional) Install the MediaExpress application using the package appropriate for your system (e.g. `/opt/Blackmagic DeckLink SDK 10.4/deb/amd64/mediaexpress_3.5.3a1_amd64.deb` for a 64-bit Ubuntu Linux).
1. Check your Blackmagic card's firmware status, and update it if necessary.
These instructions are provided for convenience only.
Always check the manufacturer's manuals before proceeding.

1. Download and unpack [Blackmagic Desktop Video SDK][blackmagic-support].
1. If the resulting folder name has spaces e.g. `Blackmagic DeckLink SDK 10.11.1`, replace spaces with an underscore,
e.g. `Blackmagic_DeckLink_SDK_10.11.1`.
1. (Optional) Move the resulting folder to a system folder, e.g. `/opt`, for easy access by all users.
1. Specify the **absolute** path of this folder as the `BlackmagicSDK_DIR` environment variable, e.g.
`export BlackmagicSDK_DIR="/opt/Blackmagic_DeckLink_SDK_10.11.1"`.
1. Download and unpack [Blackmagic Desktop Video][blackmagic-support].
1. Install the driver package appropriate for your system, e.g.
`dpkg -i Blackmagic_Desktop_Video_Linux_10.11.1/deb/x86_64/desktopvideo_10.11.1a4_amd64.deb`
1. (Optional) Install the GUI components, e.g.
`dpkg -i Blackmagic_Desktop_Video_Linux_10.11.1/deb/x86_64/desktopvideo-gui_10.11.1a4_amd64.deb` and
`dpkg -i Blackmagic_Desktop_Video_Linux_10.11.1/deb/x86_64/mediaexpress_3.5.6a2_amd64.deb`
1. Check your Blackmagic card's firmware status: `BlackmagicFirmwareUpdater status`, and update if necessary, e.g.
`BlackmagicFirmwareUpdater update 0`

[blackmagic-support]: https://www.blackmagicdesign.com/support

## OpenCV

Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ if(USE_BLACKMAGICSDK)
LIST(APPEND SOURCES blackmagicsdk/blackmagicsdk_video_source.cpp)
LIST(APPEND HEADERS blackmagicsdk/deck_link_display_mode_detector.h)
LIST(APPEND SOURCES blackmagicsdk/deck_link_display_mode_detector.cpp)
LIST(APPEND HEADERS blackmagicsdk/deck_link_bgra_video_frame.h)
LIST(APPEND SOURCES blackmagicsdk/deck_link_bgra_video_frame.cpp)
endif(USE_BLACKMAGICSDK)

# Performance benchmarking
Expand Down
36 changes: 29 additions & 7 deletions src/api/videoframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,26 @@ VideoFrame::VideoFrame()
}

VideoFrame::VideoFrame(enum ColourSpace colour, bool manage_data)
: _colour(colour),
_manage_data(manage_data),
_data(nullptr),
_data_length(0)
: _colour(colour)
, _manage_data(manage_data)
, _data(nullptr)
, _data_length(0)
, _stereo_count(1)
{
set_dimensions(0, 0);
}

VideoFrame::VideoFrame(ColourSpace colour, size_t cols, size_t rows)
VideoFrame::VideoFrame(ColourSpace colour, size_t cols, size_t rows,
size_t stereo_count)
: _colour(colour)
, _manage_data(true)
, _data(nullptr)
, _data_length(0)
, _stereo_count(stereo_count)
{
set_dimensions(cols, rows);
size_t data_length = required_data_length(_colour, _cols, _rows);
data_length *= _stereo_count;
allocate_memory(data_length);
set_pixels_black();
}
Expand All @@ -35,6 +39,7 @@ VideoFrame::VideoFrame(const VideoFrame & rhs)
, _manage_data(true)
, _data(nullptr)
, _data_length(0)
, _stereo_count(1)
{
clone(rhs);
}
Expand Down Expand Up @@ -145,8 +150,10 @@ void VideoFrame::operator=(const VideoFrame & rhs)
}

void VideoFrame::init_from_specs(unsigned char * data, size_t data_length,
size_t cols, size_t rows)
size_t cols, size_t rows, size_t stereo_count)
{
_stereo_count = stereo_count;

if (_manage_data)
{
allocate_memory(data_length);
Expand All @@ -161,6 +168,20 @@ void VideoFrame::init_from_specs(unsigned char * data, size_t data_length,
set_dimensions(cols, rows);
}

const size_t VideoFrame::data_length(size_t stereo_index) const
{
validate_stereo_index(stereo_index);
return _data_length / _stereo_count;
}

unsigned char * const VideoFrame::data(size_t stereo_index) const
{
validate_stereo_index(stereo_index);
if (_data == nullptr)
return nullptr;
return &_data[stereo_index * (_data_length / _stereo_count)];
}

void VideoFrame::clone(const VideoFrame & rhs)
{
if (not _manage_data)
Expand All @@ -172,7 +193,7 @@ void VideoFrame::clone(const VideoFrame & rhs)
_manage_data = true;
_colour = rhs._colour;
init_from_specs(rhs._data, rhs._data_length,
rhs._cols, rhs._rows);
rhs._cols, rhs._rows, rhs._stereo_count);
}

void VideoFrame::set_dimensions(size_t cols, size_t rows)
Expand Down Expand Up @@ -213,6 +234,7 @@ void VideoFrame::free_memory()
_data = nullptr;
_data_length = 0;
set_dimensions(0, 0);
_stereo_count = 0;
}
}

Expand Down
Loading