Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
9629701c
Commit
9629701c
authored
9 years ago
by
Mark Thompson
Committed by
Anton Khirnov
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
vaapi_h264: Add -qp option, use it to replace use of -global_quality
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
69b06ed4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/vaapi_encode_h264.c
+18
-3
18 additions, 3 deletions
libavcodec/vaapi_encode_h264.c
with
18 additions
and
3 deletions
libavcodec/vaapi_encode_h264.c
+
18
−
3
View file @
9629701c
...
...
@@ -115,6 +115,10 @@ typedef struct VAAPIEncodeH264Context {
}
hrd_params
;
}
VAAPIEncodeH264Context
;
typedef
struct
VAAPIEncodeH264Options
{
int
qp
;
}
VAAPIEncodeH264Options
;
#define vseq_var(name) vseq->name, name
#define vseq_field(name) vseq->seq_fields.bits.name, name
...
...
@@ -765,8 +769,9 @@ static av_cold int vaapi_encode_h264_init_fixed_qp(AVCodecContext *avctx)
{
VAAPIEncodeContext
*
ctx
=
avctx
->
priv_data
;
VAAPIEncodeH264Context
*
priv
=
ctx
->
priv_data
;
VAAPIEncodeH264Options
*
opt
=
ctx
->
codec_options
;
priv
->
fixed_qp_p
=
avctx
->
global_quality
;
priv
->
fixed_qp_p
=
opt
->
qp
;
if
(
avctx
->
i_quant_factor
>
0
.
0
)
priv
->
fixed_qp_idr
=
(
int
)((
priv
->
fixed_qp_p
*
avctx
->
i_quant_factor
+
avctx
->
i_quant_offset
)
+
0
.
5
);
...
...
@@ -895,13 +900,21 @@ static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx)
return
ff_vaapi_encode_init
(
avctx
,
&
vaapi_encode_type_h264
);
}
#define OFFSET(x) (offsetof(VAAPIEncodeContext, codec_options_data) + \
offsetof(VAAPIEncodeH264Options, x))
#define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
static
const
AVOption
vaapi_encode_h264_options
[]
=
{
{
"qp"
,
"Constant QP (for P frames; scaled by qfactor/qoffset for I/B)"
,
OFFSET
(
qp
),
AV_OPT_TYPE_INT
,
{
.
i64
=
20
},
0
,
52
,
FLAGS
},
{
NULL
},
};
static
const
AVCodecDefault
vaapi_encode_h264_defaults
[]
=
{
{
"profile"
,
"100"
},
{
"level"
,
"51"
},
{
"b"
,
"0"
},
{
"bf"
,
"2"
},
{
"g"
,
"120"
},
{
"global_quality"
,
"20"
},
{
"i_qfactor"
,
"1.0"
},
{
"i_qoffset"
,
"0.0"
},
{
"b_qfactor"
,
"1.2"
},
...
...
@@ -912,6 +925,7 @@ static const AVCodecDefault vaapi_encode_h264_defaults[] = {
static
const
AVClass
vaapi_encode_h264_class
=
{
.
class_name
=
"h264_vaapi"
,
.
item_name
=
av_default_item_name
,
.
option
=
vaapi_encode_h264_options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
...
...
@@ -920,7 +934,8 @@ AVCodec ff_h264_vaapi_encoder = {
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"H.264/AVC (VAAPI)"
),
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_H264
,
.
priv_data_size
=
sizeof
(
VAAPIEncodeContext
),
.
priv_data_size
=
(
sizeof
(
VAAPIEncodeContext
)
+
sizeof
(
VAAPIEncodeH264Options
)),
.
init
=
&
vaapi_encode_h264_init
,
.
encode2
=
&
ff_vaapi_encode2
,
.
close
=
&
ff_vaapi_encode_close
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment