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
3df77b58
Commit
3df77b58
authored
Mar 17, 2017
by
Konda Raju
Committed by
Luca Barbato
Mar 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nvenc: Allow different const qps for I, P and B frames
Signed-off-by:
Luca Barbato
<
lu_zero@gentoo.org
>
parent
ca960161
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
nvenc.c
libavcodec/nvenc.c
+19
-9
No files found.
libavcodec/nvenc.c
View file @
3df77b58
...
@@ -511,10 +511,26 @@ static int nvenc_map_preset(NVENCContext *ctx)
...
@@ -511,10 +511,26 @@ static int nvenc_map_preset(NVENCContext *ctx)
static
void
set_constqp
(
AVCodecContext
*
avctx
,
NV_ENC_RC_PARAMS
*
rc
)
static
void
set_constqp
(
AVCodecContext
*
avctx
,
NV_ENC_RC_PARAMS
*
rc
)
{
{
NVENCContext
*
ctx
=
avctx
->
priv_data
;
rc
->
rateControlMode
=
NV_ENC_PARAMS_RC_CONSTQP
;
rc
->
rateControlMode
=
NV_ENC_PARAMS_RC_CONSTQP
;
rc
->
constQP
.
qpInterB
=
avctx
->
global_quality
;
if
(
ctx
->
init_qp_p
>=
0
)
{
rc
->
constQP
.
qpInterP
=
ctx
->
init_qp_p
;
if
(
ctx
->
init_qp_i
>=
0
&&
ctx
->
init_qp_b
>=
0
)
{
rc
->
constQP
.
qpIntra
=
ctx
->
init_qp_i
;
rc
->
constQP
.
qpInterB
=
ctx
->
init_qp_b
;
}
else
if
(
avctx
->
i_quant_factor
!=
0
.
0
&&
avctx
->
b_quant_factor
!=
0
.
0
)
{
rc
->
constQP
.
qpIntra
=
av_clip
(
rc
->
constQP
.
qpInterP
*
fabs
(
avctx
->
i_quant_factor
)
+
avctx
->
i_quant_offset
+
0
.
5
,
0
,
51
);
rc
->
constQP
.
qpInterB
=
av_clip
(
rc
->
constQP
.
qpInterP
*
fabs
(
avctx
->
b_quant_factor
)
+
avctx
->
b_quant_offset
+
0
.
5
,
0
,
51
);
}
else
{
rc
->
constQP
.
qpIntra
=
rc
->
constQP
.
qpInterP
;
rc
->
constQP
.
qpInterB
=
rc
->
constQP
.
qpInterP
;
}
}
else
if
(
avctx
->
global_quality
>=
0
)
{
rc
->
constQP
.
qpInterP
=
avctx
->
global_quality
;
rc
->
constQP
.
qpInterP
=
avctx
->
global_quality
;
rc
->
constQP
.
qpInterB
=
avctx
->
global_quality
;
rc
->
constQP
.
qpIntra
=
avctx
->
global_quality
;
rc
->
constQP
.
qpIntra
=
avctx
->
global_quality
;
}
}
}
static
void
set_vbr
(
AVCodecContext
*
avctx
,
NV_ENC_RC_PARAMS
*
rc
)
static
void
set_vbr
(
AVCodecContext
*
avctx
,
NV_ENC_RC_PARAMS
*
rc
)
...
@@ -575,12 +591,6 @@ static void nvenc_override_rate_control(AVCodecContext *avctx,
...
@@ -575,12 +591,6 @@ static void nvenc_override_rate_control(AVCodecContext *avctx,
switch
(
ctx
->
rc
)
{
switch
(
ctx
->
rc
)
{
case
NV_ENC_PARAMS_RC_CONSTQP
:
case
NV_ENC_PARAMS_RC_CONSTQP
:
if
(
avctx
->
global_quality
<
0
)
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"The constant quality rate-control requires "
"the 'global_quality' option set.
\n
"
);
return
;
}
set_constqp
(
avctx
,
rc
);
set_constqp
(
avctx
,
rc
);
return
;
return
;
case
NV_ENC_PARAMS_RC_2_PASS_VBR
:
case
NV_ENC_PARAMS_RC_2_PASS_VBR
:
...
...
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