Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
4acdcfd0
Commit
4acdcfd0
authored
7 years ago
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9527 from mshabunin:mediasdk-fix
parents
273add5d
235b00b6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
20 deletions
+17
-20
cap_mfx_common.hpp
modules/videoio/src/cap_mfx_common.hpp
+0
-10
cap_mfx_writer.cpp
modules/videoio/src/cap_mfx_writer.cpp
+7
-0
test_mfx.cpp
modules/videoio/test/test_mfx.cpp
+10
-10
No files found.
modules/videoio/src/cap_mfx_common.hpp
View file @
4acdcfd0
...
...
@@ -156,16 +156,6 @@ inline std::ostream & operator<<(std::ostream &out, const mfxFrameData &data) {
//==================================================================================================
static
const
int
CC_MPG2
=
FourCC
(
'M'
,
'P'
,
'G'
,
'2'
).
vali32
;
static
const
int
CC_H264
=
FourCC
(
'H'
,
'2'
,
'6'
,
'4'
).
vali32
;
static
const
int
CC_X264
=
FourCC
(
'X'
,
'2'
,
'6'
,
'4'
).
vali32
;
static
const
int
CC_AVC
=
FourCC
(
'A'
,
'V'
,
'C'
,
' '
).
vali32
;
static
const
int
CC_H265
=
FourCC
(
'H'
,
'2'
,
'6'
,
'5'
).
vali32
;
static
const
int
CC_HEVC
=
FourCC
(
'H'
,
'E'
,
'V'
,
'C'
).
vali32
;
static
const
int
CC_VC1
=
FourCC
(
'V'
,
'C'
,
'1'
,
' '
).
vali32
;
//==================================================================================================
template
<
typename
T
>
inline
void
cleanup
(
T
*
&
ptr
)
{
...
...
This diff is collapsed.
Click to expand it.
modules/videoio/src/cap_mfx_writer.cpp
View file @
4acdcfd0
...
...
@@ -11,6 +11,13 @@ using namespace cv;
inline
mfxU32
codecIdByFourCC
(
int
fourcc
)
{
const
int
CC_MPG2
=
FourCC
(
'M'
,
'P'
,
'G'
,
'2'
).
vali32
;
const
int
CC_H264
=
FourCC
(
'H'
,
'2'
,
'6'
,
'4'
).
vali32
;
const
int
CC_X264
=
FourCC
(
'X'
,
'2'
,
'6'
,
'4'
).
vali32
;
const
int
CC_AVC
=
FourCC
(
'A'
,
'V'
,
'C'
,
' '
).
vali32
;
const
int
CC_H265
=
FourCC
(
'H'
,
'2'
,
'6'
,
'5'
).
vali32
;
const
int
CC_HEVC
=
FourCC
(
'H'
,
'E'
,
'V'
,
'C'
).
vali32
;
if
(
fourcc
==
CC_X264
||
fourcc
==
CC_H264
||
fourcc
==
CC_AVC
)
return
MFX_CODEC_AVC
;
else
if
(
fourcc
==
CC_H265
||
fourcc
==
CC_HEVC
)
...
...
This diff is collapsed.
Click to expand it.
modules/videoio/test/test_mfx.cpp
View file @
4acdcfd0
...
...
@@ -30,24 +30,24 @@ TEST(Videoio_MFX, write_invalid)
{
const
string
filename
=
cv
::
tempfile
(
".264"
);
VideoWriter
writer
;
bool
res
;
ASSERT_NO_THROW
(
res
=
writer
.
open
(
CAP_INTEL_MFX
,
filename
,
VideoWriter
::
fourcc
(
'H'
,
'2'
,
'6'
,
'4'
),
1
,
Size
(
641
,
480
),
true
));
bool
res
=
true
;
ASSERT_NO_THROW
(
res
=
writer
.
open
(
filename
,
CAP_INTEL_MFX
,
VideoWriter
::
fourcc
(
'H'
,
'2'
,
'6'
,
'4'
),
1
,
Size
(
641
,
480
),
true
));
EXPECT_FALSE
(
res
);
EXPECT_FALSE
(
writer
.
isOpened
());
ASSERT_NO_THROW
(
res
=
writer
.
open
(
CAP_INTEL_MFX
,
filename
,
VideoWriter
::
fourcc
(
'H'
,
'2'
,
'6'
,
'4'
),
1
,
Size
(
640
,
481
),
true
));
ASSERT_NO_THROW
(
res
=
writer
.
open
(
filename
,
CAP_INTEL_MFX
,
VideoWriter
::
fourcc
(
'H'
,
'2'
,
'6'
,
'4'
),
1
,
Size
(
640
,
481
),
true
));
EXPECT_FALSE
(
res
);
EXPECT_FALSE
(
writer
.
isOpened
());
ASSERT_NO_THROW
(
res
=
writer
.
open
(
CAP_INTEL_MFX
,
filename
,
VideoWriter
::
fourcc
(
'A'
,
'B'
,
'C'
,
'D'
),
1
,
Size
(
640
,
480
),
true
));
ASSERT_NO_THROW
(
res
=
writer
.
open
(
filename
,
CAP_INTEL_MFX
,
VideoWriter
::
fourcc
(
'A'
,
'B'
,
'C'
,
'D'
),
1
,
Size
(
640
,
480
),
true
));
EXPECT_FALSE
(
res
);
EXPECT_FALSE
(
writer
.
isOpened
());
ASSERT_NO_THROW
(
res
=
writer
.
open
(
CAP_INTEL_MFX
,
String
()
,
VideoWriter
::
fourcc
(
'H'
,
'2'
,
'6'
,
'4'
),
1
,
Size
(
640
,
480
),
true
));
ASSERT_NO_THROW
(
res
=
writer
.
open
(
String
(),
CAP_INTEL_MFX
,
VideoWriter
::
fourcc
(
'H'
,
'2'
,
'6'
,
'4'
),
1
,
Size
(
640
,
480
),
true
));
EXPECT_FALSE
(
res
);
EXPECT_FALSE
(
writer
.
isOpened
());
ASSERT_
NO_THROW
(
res
=
writer
.
open
(
CAP_INTEL_MFX
,
filename
,
VideoWriter
::
fourcc
(
'H'
,
'2'
,
'6'
,
'4'
),
0
,
Size
(
640
,
480
),
true
));
ASSERT_
ANY_THROW
(
res
=
writer
.
open
(
filename
,
CAP_INTEL_MFX
,
VideoWriter
::
fourcc
(
'H'
,
'2'
,
'6'
,
'4'
),
0
,
Size
(
640
,
480
),
true
));
EXPECT_FALSE
(
res
);
EXPECT_FALSE
(
writer
.
isOpened
());
ASSERT_NO_THROW
(
res
=
writer
.
open
(
CAP_INTEL_MFX
,
filename
,
VideoWriter
::
fourcc
(
'H'
,
'2'
,
'6'
,
'4'
),
30
,
Size
(
640
,
480
),
true
));
ASSERT_NO_THROW
(
res
=
writer
.
open
(
filename
,
CAP_INTEL_MFX
,
VideoWriter
::
fourcc
(
'H'
,
'2'
,
'6'
,
'4'
),
30
,
Size
(
640
,
480
),
true
));
ASSERT_TRUE
(
res
);
ASSERT_TRUE
(
writer
.
isOpened
());
Mat
t
;
...
...
@@ -103,7 +103,7 @@ TEST_P(Videoio_MFX, read_write_raw)
// Write video
VideoWriter
writer
;
writer
.
open
(
CAP_INTEL_MFX
,
filename
,
fourcc
,
FPS
,
FRAME_SIZE
,
isColor
);
writer
.
open
(
filename
,
CAP_INTEL_MFX
,
fourcc
,
FPS
,
FRAME_SIZE
,
isColor
);
ASSERT_TRUE
(
writer
.
isOpened
());
Mat
frame
(
FRAME_SIZE
,
CV_8UC3
);
for
(
int
i
=
0
;
i
<
FRAME_COUNT
;
++
i
)
...
...
@@ -133,9 +133,9 @@ TEST_P(Videoio_MFX, read_write_raw)
EXPECT_EQ
(
goodFrame
.
type
(),
frame
.
type
());
double
psnr
=
cvtest
::
PSNR
(
goodFrame
,
frame
);
if
(
fourcc
==
VideoWriter
::
fourcc
(
'M'
,
'P'
,
'G'
,
'2'
))
EXPECT_GT
(
psnr
,
3
7
);
// experimentally chosen value
EXPECT_GT
(
psnr
,
3
1
);
// experimentally chosen value
else
EXPECT_GT
(
psnr
,
4
3
);
// experimentally chosen value
EXPECT_GT
(
psnr
,
3
3
);
// experimentally chosen value
goodFrames
.
pop
();
}
EXPECT_FALSE
(
cap
.
read
(
frame
));
...
...
This diff is collapsed.
Click to expand it.
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