Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
ParaEncode
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ParaEncode
Commits
7ae6479d
Commit
7ae6479d
authored
May 17, 2022
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
7683665d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
15 deletions
+67
-15
paraEncode.js
src/paraEncode.js
+8
-0
ENCH264Group.spec.js
tests/ENCH264Group.spec.js
+2
-2
paraEncodeSpec.spec.js
tests/paraEncodeSpec.spec.js
+57
-13
No files found.
src/paraEncode.js
View file @
7ae6479d
...
@@ -55,6 +55,14 @@ export class ParaEncoder {
...
@@ -55,6 +55,14 @@ export class ParaEncoder {
await
this
.
#
grp
.
dispatch
(
pixels
);
await
this
.
#
grp
.
dispatch
(
pixels
);
}
}
directWPrepare
(
size
)
{
return
this
.
#
grp
.
directWPrepare
(
size
);
}
async
directWConfirm
()
{
return
await
this
.
#
grp
.
directWConfirm
();
}
/* Does all frames provide to Encoder be encoded.
/* Does all frames provide to Encoder be encoded.
*
*
* Note: isDone() alwasy return false before eof. */
* Note: isDone() alwasy return false before eof. */
...
...
tests/ENCH264Group.spec.js
View file @
7ae6479d
...
@@ -39,7 +39,7 @@ describe("H264EncWWGroup Spec", () => {
...
@@ -39,7 +39,7 @@ describe("H264EncWWGroup Spec", () => {
},
3000000
)
},
3000000
)
f
it
(
"Encode By H264EncWWGroup with direct write"
,
async
()
=>
{
it
(
"Encode By H264EncWWGroup with direct write"
,
async
()
=>
{
const
RGBAFrameSize
=
1920
*
1080
*
4
;
const
RGBAFrameSize
=
1920
*
1080
*
4
;
let
grp
=
new
H264EncWWGroup
(
"h264enc"
,
8
,
{
let
grp
=
new
H264EncWWGroup
(
"h264enc"
,
8
,
{
encchnlsize
:
RGBAFrameSize
*
10
,
encchnlsize
:
RGBAFrameSize
*
10
,
...
@@ -50,7 +50,7 @@ describe("H264EncWWGroup Spec", () => {
...
@@ -50,7 +50,7 @@ describe("H264EncWWGroup Spec", () => {
await
grp
.
start
();
await
grp
.
start
();
const
data
=
new
Uint8Array
([...
Array
(
RGBAFrameSize
).
keys
()]);
const
data
=
new
Uint8Array
([...
Array
(
RGBAFrameSize
).
keys
()]);
for
(
let
i
=
0
;
i
<
30
0
;
++
i
)
{
for
(
let
i
=
0
;
i
<
30
;
++
i
)
{
let
buffers
=
[];
let
buffers
=
[];
while
(
true
)
{
while
(
true
)
{
buffers
=
grp
.
directWPrepare
(
RGBAFrameSize
);
buffers
=
grp
.
directWPrepare
(
RGBAFrameSize
);
...
...
tests/paraEncodeSpec.spec.js
View file @
7ae6479d
...
@@ -4,20 +4,19 @@ import { sleep, waitCond } from "../src/utils.js";
...
@@ -4,20 +4,19 @@ import { sleep, waitCond } from "../src/utils.js";
let
paraEnc
;
let
paraEnc
;
const
RGBAFrameSize
=
1920
*
1080
*
4
;
const
RGBAFrameSize
=
1920
*
1080
*
4
;
// beforeEach(async () => {
// let trNum = navigator.hardwareConcurrency;
// paraEnc = new ParaEncoder(trNum, {
// codec: "H264",
// config: {
// encchnlsize: RGBAFrameSize * 10,
// bridgechnlsize: Math.pow(2, 25),
// }
// });
// await paraEnc.init();
// }, 20000);
describe
(
"ParaEncoder"
,
()
=>
{
describe
(
"ParaEncoder"
,
()
=>
{
beforeEach
(
async
()
=>
{
let
trNum
=
navigator
.
hardwareConcurrency
;
paraEnc
=
new
ParaEncoder
(
trNum
,
{
codec
:
"H264"
,
config
:
{
encchnlsize
:
RGBAFrameSize
*
10
,
bridgechnlsize
:
Math
.
pow
(
2
,
25
),
}
});
await
paraEnc
.
init
();
},
20000
);
xit
(
"Encode With ParaEncoder"
,
async
()
=>
{
xit
(
"Encode With ParaEncoder"
,
async
()
=>
{
const
data
=
new
Uint8Array
([...
Array
(
RGBAFrameSize
).
keys
()]);
const
data
=
new
Uint8Array
([...
Array
(
RGBAFrameSize
).
keys
()]);
...
@@ -35,3 +34,48 @@ describe("ParaEncoder", () => {
...
@@ -35,3 +34,48 @@ describe("ParaEncoder", () => {
},
3000000
);
},
3000000
);
});
});
describe
(
"ParaEncoder Blockbased"
,
()
=>
{
beforeEach
(
async
()
=>
{
let
trNum
=
navigator
.
hardwareConcurrency
;
paraEnc
=
new
ParaEncoder
(
trNum
,
{
codec
:
"H264"
,
config
:
{
encchnlsize
:
RGBAFrameSize
*
10
,
bridgechnlsize
:
Math
.
pow
(
2
,
25
),
blocksize
:
RGBAFrameSize
,
}
});
await
paraEnc
.
init
();
},
20000
);
it
(
"Encode With DirectWrite"
,
async
()
=>
{
const
data
=
new
Uint8Array
([...
Array
(
RGBAFrameSize
).
keys
()]);
let
st
=
new
Date
();
for
(
let
i
=
0
;
i
<
300
;
++
i
)
{
let
buffers
=
[];
while
(
true
)
{
buffers
=
paraEnc
.
directWPrepare
(
RGBAFrameSize
);
if
(
buffers
.
length
>
0
)
break
;
else
await
sleep
(
30
);
}
expect
(
buffers
.
length
).
toBe
(
1
);
buffers
[
0
].
set
(
data
,
0
);
await
paraEnc
.
directWConfirm
();
}
await
paraEnc
.
encode
(
null
);
await
waitCond
(()
=>
paraEnc
.
isDone
(),
3000000
,
300
);
let
et
=
new
Date
();
let
diff
=
(
et
-
st
)
/
1000
;
console
.
log
(
"Total Elapsed time is "
+
diff
);
},
3000000
);
})
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