Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
MomentaMedia
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
景炳强
MomentaMedia
Commits
11f91a59
Commit
11f91a59
authored
Dec 05, 2022
by
景炳强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "support 4K input"
This reverts commit
b5827fb1
.
parent
b5827fb1
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
5 additions
and
123 deletions
+5
-123
MomentaMedia/include/Threads/ProcessThread.h
+2
-9
MomentaMedia/include/Utils/Common.h
+0
-3
MomentaMedia/src/BlackMagicDesign/DeckLinkOutputDevice.cpp
+2
-8
MomentaMedia/src/MomentaMedia.cpp
+0
-7
MomentaMedia/src/NDI/NDIOutputThread.cpp
+0
-7
MomentaMedia/src/Threads/CaptureThread.cpp
+0
-6
MomentaMedia/src/Threads/ProcessThread.cpp
+1
-50
MomentaMedia/src/Utils/Image.cpp
+0
-33
No files found.
MomentaMedia/include/Threads/ProcessThread.h
View file @
11f91a59
...
...
@@ -19,6 +19,8 @@ const QString MODE_ACK = "checked_ok";
#define CROP720WIDTH 720
#define CROPHEIGHT 1080
#define USE_1080P 1
class
RoiMessage
{
public
:
...
...
@@ -124,14 +126,6 @@ public:
return
*
this
;
}
RoiMessage
(
int
X
,
int
Y
,
int
W
,
int
H
)
:
x
(
X
),
y
(
Y
),
w
(
W
),
h
(
H
),
timecode
(
0
)
{}
bool
IsValid
()
{
return
x
>
0
&&
y
>
0
&&
w
>
0
&&
h
>
0
;
...
...
@@ -185,7 +179,6 @@ private:
void
WorkCutImage720p
(
std
::
shared_ptr
<
Image
>&
pImage
,
RoiMessage
&
roi
);
void
cutRun
();
void
cutRunFront
();
void
cutRunFrontFixedRegion
();
private
:
//SampleQueue<Image> taskPrerollQueue;
SampleQueue
<
std
::
shared_ptr
<
Image
>>
taskImageQueue
;
...
...
MomentaMedia/include/Utils/Common.h
View file @
11f91a59
...
...
@@ -3,9 +3,6 @@
#include "DeckLinkAPI.h"
#include <QDateTime.h>
#define USE_4K 1
#define USE_1080P 1
long
GetRowBytesFromPixelFormat
(
long
width
,
BMDPixelFormat
pixelFormat
);
...
...
MomentaMedia/src/BlackMagicDesign/DeckLinkOutputDevice.cpp
View file @
11f91a59
...
...
@@ -144,12 +144,6 @@ bool DeckLinkOutputDevice::StartPlayback(BMDDisplayMode displayMode, bool enable
#else
outputDisplayMode
=
BMDDisplayMode
::
bmdModeHD720p50
;
#endif
#if USE_4K
outputDisplayMode
=
bmdModeHD1080i50
;
#endif
// Pass through RP188 timecode and VANC from input frame. VITC timecode is forwarded with VANC
BMDVideoOutputFlags
outputFlags
=
(
BMDVideoOutputFlags
)(
bmdVideoOutputRP188
|
bmdVideoOutputVANC
);
ComPtr
<
IDeckLinkDisplayMode
>
deckLinkDisplayMode
;
...
...
@@ -536,7 +530,7 @@ void DeckLinkOutputDevice::checkEndOfPreroll()
void
DeckLinkOutputDevice
::
AddFrame
(
std
::
shared_ptr
<
Image
>
image
)
{
START_SLOT_TIME_COUNTER
if
(
!
image
->
IsValid
())
if
(
!
image
->
IsValid
())
return
;
if
(
outputVideoFrameQueue
.
Size
()
>=
4
)
...
...
@@ -546,7 +540,7 @@ void DeckLinkOutputDevice::AddFrame(std::shared_ptr<Image> image)
{
outputVideoFrameQueue
.
Reset
();
}
if
(
image
)
outputVideoFrameQueue
.
Push
(
image
);
if
(
image
)
outputVideoFrameQueue
.
Push
(
image
);
END_SLOT_TIME_COUNTER
}
void
DeckLinkOutputDevice
::
AddAudioFrame
(
std
::
shared_ptr
<
AudioPacket
>
audio_packet
)
...
...
MomentaMedia/src/MomentaMedia.cpp
View file @
11f91a59
...
...
@@ -10,7 +10,6 @@
#include "Utils/CustomEvents.h"
#include "Utils/Image.h"
#include "DeckLinkAPI.h"
#include "Utils/Common.h"
int
OutputDeleyTime
=
5
;
...
...
@@ -247,15 +246,9 @@ void MomentaMedia::AddDevice(ComPtr<IDeckLink>& deckLink)
deviceIdStr
=
rx
.
cap
(
0
);
int
deviceId
=
deviceIdStr
.
toInt
();
#if USE_4K
if
(
deviceName
.
contains
(
"DeckLink 8K Pro (1)"
)
||
deviceName
.
contains
(
"DeckLink 8K Pro (2)"
))
#else
if
(
deviceId
<
5
)
#endif
{
// Input Device
bool
active
=
IsDeviceActive
(
deckLink
);
InputDevices
[
deckLink
]
=
(
active
?
DeviceState
::
Available
:
DeviceState
::
Inactive
);
...
...
MomentaMedia/src/NDI/NDIOutputThread.cpp
View file @
11f91a59
...
...
@@ -6,8 +6,6 @@
#include <cstdlib>
#include <atomic>
#include "NDI/NDIOutputThread.h"
#include "Utils/Common.h"
#include "libyuv.h"
extern
qint64
StartTimeStamp
;
...
...
@@ -96,12 +94,7 @@ void NDIOutputThread::run()
START_TIME_COUNTER
if
(
frame
->
IsValid
())
{
#if USE_4K
libyuv
::
ARGBScale
(
frame
->
GetBytes
(),
3840
<<
2
,
3840
,
2160
,
Frame
.
p_data
,
1920
<<
2
,
1920
,
1080
,
libyuv
::
FilterMode
::
kFilterNone
);
#else
frame
->
Fill
(
Frame
.
p_data
,
Frame
.
xres
*
Frame
.
yres
*
4
);
#endif
//qDebug() << "wgt-----------------------------"<<"ndi(" << NDISenderName << ")timestamp : " << frame->getInputFrameCurTimeStamp() - StartTimeStamp << "\n";
//Frame.timestamp = frame->getInputFrameCurTimeStamp();
Frame
.
timestamp
=
frame
->
getInputFrameSequence
();
...
...
MomentaMedia/src/Threads/CaptureThread.cpp
View file @
11f91a59
#include "Threads/CaptureThread.h"
#include "Utils/Common.h"
static
int64_t
GetCurrTimeMS
()
{
...
...
@@ -62,13 +61,8 @@ void CaptureThread::AddFrame(ComPtr<IDeckLinkVideoInputFrame> videoFrame, const
if
(
videoFrame
->
GetWidth
()
<=
0
||
videoFrame
->
GetHeight
()
<=
0
)
return
;
#if USE_4K
if
(
videoFrame
->
GetWidth
()
!=
3840
||
videoFrame
->
GetHeight
()
!=
2160
)
return
;
#else
if
(
videoFrame
->
GetWidth
()
!=
1920
||
videoFrame
->
GetHeight
()
!=
1080
)
return
;
#endif
if
(
taskQueue
.
size
()
>=
4
)
qDebug
()
<<
"CaptureThread::AddFrame::qsize::"
<<
idx
<<
"
\t
"
<<
taskQueue
.
size
()
<<
"
\n
"
;
...
...
MomentaMedia/src/Threads/ProcessThread.cpp
View file @
11f91a59
#include "Threads/ProcessThread.h"
#include "opencv2/opencv.hpp"
#include "libyuv.h"
#include "Utils//Common.h"
#define CUTBUFFERMAXSIZE 125*2
...
...
@@ -127,29 +126,6 @@ void ProcessThread::ReadDatagrams()
END_SLOT_TIME_COUNTER
}
void
ProcessThread
::
cutRunFrontFixedRegion
()
{
RoiMessage
roiMsg
(
560
,
0
,
800
,
1080
);
while
(
true
)
{
std
::
shared_ptr
<
Image
>
image
=
nullptr
;
if
(
taskImageQueue
.
WaitFor
())
{
if
(
taskImageQueue
.
Front
(
image
))
{
if
(
!
image
)
{
taskImageQueue
.
Pop
();
continue
;
}
WorkCutImage
(
image
,
roiMsg
);
taskImageQueue
.
Pop
();
}
}
}
}
void
ProcessThread
::
cutRunFront
()
{
bool
continue_flag
=
false
;
...
...
@@ -482,7 +458,6 @@ void ProcessThread::run()
{
//cutRun();
cutRunFront
();
//cutRunFrontFixedRegion();
}
void
ProcessThread
::
WorkCutImage
(
std
::
shared_ptr
<
Image
>&
pImage
,
RoiMessage
&
roi
)
...
...
@@ -525,31 +500,7 @@ void ProcessThread::WorkCutImage(std::shared_ptr<Image>& pImage, RoiMessage& roi
// qDebug() << "ProcessThread::run::qsize::" << idx << "\t" << taskImageQueue.Size() << "\n";
//qDebug() << "ROI- " << idx << " " << roi.X() << " " << roi.Y() << " " << roi.Width() << " " << roi.Height() << "\n";
#if USE_4K
size_t
size
=
roi
.
Width
()
*
roi
.
Height
()
<<
2
<<
2
;
uint8_t
*
buff1
=
new
uint8_t
[
size
];
libyuv
::
ConvertToARGB
(
pImage
->
GetBytes
(),
(
3840
*
2160
<<
2
),
buff1
,
(
roi
.
Height
()
<<
2
<<
1
),
roi
.
X
()
<<
1
,
roi
.
Y
()
<<
1
,
3840
,
2160
,
roi
.
Width
()
<<
1
,
roi
.
Height
()
<<
1
,
libyuv
::
kRotate90
,
libyuv
::
FOURCC_ARGB
);
uint8_t
*
buff2
=
new
uint8_t
[
1440
*
1080
<<
2
];
libyuv
::
ARGBScale
(
buff1
,
(
roi
.
Height
()
<<
2
<<
1
),
roi
.
Height
()
<<
1
,
roi
.
Width
()
<<
1
,
buff2
,
1440
<<
2
,
1440
,
1080
,
libyuv
::
FilterMode
::
kFilterNone
);
uint8_t
*
buff3
=
new
uint8_t
[
1920
*
1080
<<
2
];
memset
(
buff3
,
0
,
(
1920
*
1080
<<
2
));
libyuv
::
ARGBCopy
(
buff2
,
1440
<<
2
,
(
buff3
+
BlackBottomHeight
*
4
),
1920
<<
2
,
1440
,
1080
);
cv
::
Mat
bgra
=
cv
::
Mat
(
1080
,
1920
,
CV_8UC4
,
buff3
);
pImage
->
SetMat
(
bgra
);
delete
[]
buff1
;
delete
[]
buff2
;
delete
[]
buff3
;
emit
PushFrame
(
pImage
);
#elif USE_1080P
#if USE_1080P
//qDebug() << "wgt------------idx:" << idx << ",cut image of timestamp : " << pImage->getInputFrameCurTimeStamp() << ", cur image of x : " << roi.X() << "\n";
size_t
size
=
roi
.
Width
()
*
roi
.
Height
()
<<
2
;
uint8_t
*
buff1
=
new
uint8_t
[
size
];
...
...
MomentaMedia/src/Utils/Image.cpp
View file @
11f91a59
#include "Utils/Image.h"
#include "Utils/ComPtr.h"
#include "opencv2/core.hpp"
#include "Utils/Common.h"
Image
::
Image
()
:
mat
()
{
...
...
@@ -10,72 +9,40 @@ Image::Image() : mat()
Image
::
Image
(
IDeckLinkVideoInputFrame
*
videoFrame
)
{
#if USE_4K
if
(
videoFrame
->
GetWidth
()
!=
3840
||
videoFrame
->
GetHeight
()
!=
2160
)
{
return
;
}
#else
if
(
videoFrame
->
GetWidth
()
!=
1920
||
videoFrame
->
GetHeight
()
!=
1080
)
{
return
;
}
#endif
inVideoFrame
=
MakeComPtr
<
DeckLinkInputVideoFrame
>
(
videoFrame
);
ConvertDeckLinkVideoFrame2Mat
(
inVideoFrame
,
mat
);
}
Image
::
Image
(
ComPtr
<
DeckLinkInputVideoFrame
>
videoFrame
)
{
#if USE_4K
if
(
videoFrame
->
GetWidth
()
!=
3840
||
videoFrame
->
GetHeight
()
!=
2160
)
{
return
;
}
#else
if
(
videoFrame
->
GetWidth
()
!=
1920
||
videoFrame
->
GetHeight
()
!=
1080
)
{
return
;
}
#endif
inVideoFrame
=
videoFrame
;
ConvertDeckLinkVideoFrame2Mat
(
videoFrame
,
mat
);
}
Image
::
Image
(
ComPtr
<
IDeckLinkVideoInputFrame
>
videoFrame
)
{
#if USE_4K
if
(
videoFrame
->
GetWidth
()
!=
3840
||
videoFrame
->
GetHeight
()
!=
2160
)
{
return
;
}
#else
if
(
videoFrame
->
GetWidth
()
!=
1920
||
videoFrame
->
GetHeight
()
!=
1080
)
{
return
;
}
#endif
inVideoFrame
=
MakeComPtr
<
DeckLinkInputVideoFrame
>
(
videoFrame
.
Get
());
ConvertDeckLinkVideoFrame2Mat
(
inVideoFrame
,
mat
);
}
Image
::
Image
(
ComPtr
<
IDeckLinkVideoInputFrame
>
videoFrame
,
const
qint64
&
curtimestamp
,
const
qint64
&
sequence
)
:
inputFrameCurTimeStamp
(
curtimestamp
),
sequenceNum
(
sequence
)
{
#if USE_4K
if
(
videoFrame
->
GetWidth
()
!=
3840
||
videoFrame
->
GetHeight
()
!=
2160
)
{
return
;
}
#else
if
(
videoFrame
->
GetWidth
()
!=
1920
||
videoFrame
->
GetHeight
()
!=
1080
)
{
return
;
}
#endif
inVideoFrame
=
MakeComPtr
<
DeckLinkInputVideoFrame
>
(
videoFrame
.
Get
());
ConvertDeckLinkVideoFrame2Mat
(
inVideoFrame
,
mat
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment