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
9427d92f
Commit
9427d92f
authored
May 11, 2016
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nvenc: add support for lossless encoding
Based on a patch by Philip Langdale <philipl@overt.org>
parent
795329dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
nvenc.c
libavcodec/nvenc.c
+13
-0
nvenc_h264.c
libavcodec/nvenc_h264.c
+2
-0
No files found.
libavcodec/nvenc.c
View file @
9427d92f
...
...
@@ -494,6 +494,14 @@ static void set_vbr(AVCodecContext *avctx, NV_ENC_RC_PARAMS *rc)
}
}
static
void
set_lossless
(
AVCodecContext
*
avctx
,
NV_ENC_RC_PARAMS
*
rc
)
{
rc
->
rateControlMode
=
NV_ENC_PARAMS_RC_CONSTQP
;
rc
->
constQP
.
qpInterB
=
0
;
rc
->
constQP
.
qpInterP
=
0
;
rc
->
constQP
.
qpIntra
=
0
;
}
static
void
nvenc_override_rate_control
(
AVCodecContext
*
avctx
,
NV_ENC_RC_PARAMS
*
rc
)
{
...
...
@@ -554,6 +562,8 @@ static void nvenc_setup_rate_control(AVCodecContext *avctx)
if
(
ctx
->
rc
>
0
)
{
nvenc_override_rate_control
(
avctx
,
rc
);
}
else
if
(
ctx
->
flags
&
NVENC_LOSSLESS
)
{
set_lossless
(
avctx
,
rc
);
}
else
if
(
avctx
->
global_quality
>
0
)
{
set_constqp
(
avctx
,
rc
);
}
else
if
(
avctx
->
qmin
>=
0
&&
avctx
->
qmax
>=
0
)
{
...
...
@@ -591,6 +601,9 @@ static int nvenc_setup_h264_config(AVCodecContext *avctx)
h264
->
maxNumRefFrames
=
avctx
->
refs
;
h264
->
idrPeriod
=
cc
->
gopLength
;
if
(
ctx
->
flags
&
NVENC_LOSSLESS
)
h264
->
qpPrimeYZeroTransformBypassFlag
=
1
;
if
(
ctx
->
profile
)
avctx
->
profile
=
ctx
->
profile
;
...
...
libavcodec/nvenc_h264.c
View file @
9427d92f
...
...
@@ -35,6 +35,8 @@ static const AVOption options[] = {
{
"ll"
,
"low latency"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRESET_LOW_LATENCY_DEFAULT
},
0
,
0
,
VE
,
"preset"
},
{
"llhq"
,
"low latency hq"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRESET_LOW_LATENCY_HQ
},
0
,
0
,
VE
,
"preset"
},
{
"llhp"
,
"low latency hp"
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRESET_LOW_LATENCY_HP
},
0
,
0
,
VE
,
"preset"
},
{
"lossless"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRESET_LOSSLESS_DEFAULT
},
0
,
0
,
VE
,
"preset"
},
{
"losslesshp"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
PRESET_LOSSLESS_HP
},
0
,
0
,
VE
,
"preset"
},
{
"profile"
,
"Set the encoding profile"
,
OFFSET
(
profile
),
AV_OPT_TYPE_INT
,
{
.
i64
=
NV_ENC_H264_PROFILE_HIGH
},
NV_ENC_H264_PROFILE_BASELINE
,
NV_ENC_H264_PROFILE_CONSTRAINED_HIGH
,
VE
,
"profile"
},
{
"baseline"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
NV_ENC_H264_PROFILE_BASELINE
},
0
,
0
,
VE
,
"profile"
},
{
"main"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{
.
i64
=
NV_ENC_H264_PROFILE_MAIN
},
0
,
0
,
VE
,
"profile"
},
...
...
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