Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
ffmpeg.wasm-core
Commits
9f4bff83
Commit
9f4bff83
authored
Jul 25, 2015
by
Timo Rothenpieler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/nvenc: Delay frame output to increase encoding speed
parent
15bcbc9d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
nvenc.c
libavcodec/nvenc.c
+6
-1
No files found.
libavcodec/nvenc.c
View file @
9f4bff83
...
@@ -163,6 +163,7 @@ typedef struct NvencContext
...
@@ -163,6 +163,7 @@ typedef struct NvencContext
int
cbr
;
int
cbr
;
int
twopass
;
int
twopass
;
int
gpu
;
int
gpu
;
int
buffer_delay
;
}
NvencContext
;
}
NvencContext
;
static
const
NvencValuePair
nvenc_h264_level_pairs
[]
=
{
static
const
NvencValuePair
nvenc_h264_level_pairs
[]
=
{
...
@@ -692,6 +693,9 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
...
@@ -692,6 +693,9 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
num_mbs
=
((
avctx
->
width
+
15
)
>>
4
)
*
((
avctx
->
height
+
15
)
>>
4
);
num_mbs
=
((
avctx
->
width
+
15
)
>>
4
)
*
((
avctx
->
height
+
15
)
>>
4
);
ctx
->
max_surface_count
=
(
num_mbs
>=
8160
)
?
32
:
48
;
ctx
->
max_surface_count
=
(
num_mbs
>=
8160
)
?
32
:
48
;
if
(
ctx
->
buffer_delay
>=
ctx
->
max_surface_count
)
ctx
->
buffer_delay
=
ctx
->
max_surface_count
-
1
;
ctx
->
init_encode_params
.
enableEncodeAsync
=
0
;
ctx
->
init_encode_params
.
enableEncodeAsync
=
0
;
ctx
->
init_encode_params
.
enablePTD
=
1
;
ctx
->
init_encode_params
.
enablePTD
=
1
;
...
@@ -1373,7 +1377,7 @@ static int nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
...
@@ -1373,7 +1377,7 @@ static int nvenc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
}
}
}
}
if
(
ctx
->
output_surface_ready_queue
.
count
)
{
if
(
ctx
->
output_surface_ready_queue
.
count
&&
(
!
frame
||
ctx
->
output_surface_ready_queue
.
count
+
ctx
->
output_surface_queue
.
count
>=
ctx
->
buffer_delay
)
)
{
tmpoutsurf
=
out_surf_queue_dequeue
(
&
ctx
->
output_surface_ready_queue
);
tmpoutsurf
=
out_surf_queue_dequeue
(
&
ctx
->
output_surface_ready_queue
);
res
=
process_output_surface
(
avctx
,
pkt
,
tmpoutsurf
);
res
=
process_output_surface
(
avctx
,
pkt
,
tmpoutsurf
);
...
@@ -1410,6 +1414,7 @@ static const AVOption options[] = {
...
@@ -1410,6 +1414,7 @@ static const AVOption options[] = {
{
"cbr"
,
"Use cbr encoding mode"
,
OFFSET
(
cbr
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
1
,
VE
},
{
"cbr"
,
"Use cbr encoding mode"
,
OFFSET
(
cbr
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
1
,
VE
},
{
"2pass"
,
"Use 2pass cbr encoding mode (low latency mode only)"
,
OFFSET
(
twopass
),
AV_OPT_TYPE_INT
,
{
.
i64
=
-
1
},
-
1
,
1
,
VE
},
{
"2pass"
,
"Use 2pass cbr encoding mode (low latency mode only)"
,
OFFSET
(
twopass
),
AV_OPT_TYPE_INT
,
{
.
i64
=
-
1
},
-
1
,
1
,
VE
},
{
"gpu"
,
"Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on."
,
OFFSET
(
gpu
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
INT_MAX
,
VE
},
{
"gpu"
,
"Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on."
,
OFFSET
(
gpu
),
AV_OPT_TYPE_INT
,
{
.
i64
=
0
},
0
,
INT_MAX
,
VE
},
{
"delay"
,
"Delays frame output by the given amount of frames."
,
OFFSET
(
buffer_delay
),
AV_OPT_TYPE_INT
,
{
.
i64
=
INT_MAX
},
0
,
INT_MAX
,
VE
},
{
NULL
}
{
NULL
}
};
};
...
...
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