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
9d508e49
Commit
9d508e49
authored
Aug 22, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libx264: add 'cqp' private option.
Deprecate corresponding global option.
parent
d5dc8cc2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
6 deletions
+13
-6
avcodec.h
libavcodec/avcodec.h
+3
-2
libx264.c
libavcodec/libx264.c
+9
-3
options.c
libavcodec/options.c
+1
-1
No files found.
libavcodec/avcodec.h
View file @
9d508e49
...
@@ -2385,14 +2385,15 @@ typedef struct AVCodecContext {
...
@@ -2385,14 +2385,15 @@ typedef struct AVCodecContext {
* @deprecated use 'crf' libx264 private option
* @deprecated use 'crf' libx264 private option
*/
*/
attribute_deprecated
float
crf
;
attribute_deprecated
float
crf
;
#endif
/**
/**
* constant quantization parameter rate control method
* constant quantization parameter rate control method
* - encoding: Set by user.
* - encoding: Set by user.
* - decoding: unused
* - decoding: unused
* @deprecated use 'cqp' libx264 private option
*/
*/
int
cqp
;
attribute_deprecated
int
cqp
;
#endif
/**
/**
* minimum GOP size
* minimum GOP size
...
...
libavcodec/libx264.c
View file @
9d508e49
...
@@ -42,6 +42,7 @@ typedef struct X264Context {
...
@@ -42,6 +42,7 @@ typedef struct X264Context {
char
*
profile
;
char
*
profile
;
int
fastfirstpass
;
int
fastfirstpass
;
float
crf
;
float
crf
;
int
cqp
;
}
X264Context
;
}
X264Context
;
static
void
X264_log
(
void
*
p
,
int
level
,
const
char
*
fmt
,
va_list
args
)
static
void
X264_log
(
void
*
p
,
int
level
,
const
char
*
fmt
,
va_list
args
)
...
@@ -281,16 +282,18 @@ static av_cold int X264_init(AVCodecContext *avctx)
...
@@ -281,16 +282,18 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4
->
params
.
rc
.
i_rc_method
=
X264_RC_CRF
;
x4
->
params
.
rc
.
i_rc_method
=
X264_RC_CRF
;
x4
->
params
.
rc
.
f_rf_constant
=
avctx
->
crf
;
x4
->
params
.
rc
.
f_rf_constant
=
avctx
->
crf
;
x4
->
params
.
rc
.
f_rf_constant_max
=
avctx
->
crf_max
;
x4
->
params
.
rc
.
f_rf_constant_max
=
avctx
->
crf_max
;
}
else
}
else
if
(
avctx
->
cqp
>
-
1
)
{
#endif
if
(
avctx
->
cqp
>
-
1
)
{
x4
->
params
.
rc
.
i_rc_method
=
X264_RC_CQP
;
x4
->
params
.
rc
.
i_rc_method
=
X264_RC_CQP
;
x4
->
params
.
rc
.
i_qp_constant
=
avctx
->
cqp
;
x4
->
params
.
rc
.
i_qp_constant
=
avctx
->
cqp
;
}
}
#endif
if
(
x4
->
crf
>=
0
)
{
if
(
x4
->
crf
>=
0
)
{
x4
->
params
.
rc
.
i_rc_method
=
X264_RC_CRF
;
x4
->
params
.
rc
.
i_rc_method
=
X264_RC_CRF
;
x4
->
params
.
rc
.
f_rf_constant
=
x4
->
crf
;
x4
->
params
.
rc
.
f_rf_constant
=
x4
->
crf
;
}
else
if
(
x4
->
cqp
>=
0
)
{
x4
->
params
.
rc
.
i_rc_method
=
X264_RC_CQP
;
x4
->
params
.
rc
.
i_qp_constant
=
x4
->
cqp
;
}
}
}
}
...
@@ -343,7 +346,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
...
@@ -343,7 +346,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
avctx
->
has_b_frames
=
x4
->
params
.
i_bframe
?
avctx
->
has_b_frames
=
x4
->
params
.
i_bframe
?
x4
->
params
.
i_bframe_pyramid
?
2
:
1
:
0
;
x4
->
params
.
i_bframe_pyramid
?
2
:
1
:
0
;
avctx
->
bit_rate
=
x4
->
params
.
rc
.
i_bitrate
*
1000
;
avctx
->
bit_rate
=
x4
->
params
.
rc
.
i_bitrate
*
1000
;
#if FF_API_X264_GLOBAL_OPTS
avctx
->
crf
=
x4
->
params
.
rc
.
f_rf_constant
;
avctx
->
crf
=
x4
->
params
.
rc
.
f_rf_constant
;
#endif
x4
->
enc
=
x264_encoder_open
(
&
x4
->
params
);
x4
->
enc
=
x264_encoder_open
(
&
x4
->
params
);
if
(
!
x4
->
enc
)
if
(
!
x4
->
enc
)
...
@@ -376,6 +381,7 @@ static const AVOption options[] = {
...
@@ -376,6 +381,7 @@ static const AVOption options[] = {
{
"profile"
,
"Set profile restrictions (cf. x264 --fullhelp) "
,
OFFSET
(
profile
),
FF_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
VE
},
{
"profile"
,
"Set profile restrictions (cf. x264 --fullhelp) "
,
OFFSET
(
profile
),
FF_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
VE
},
{
"fastfirstpass"
,
"Use fast settings when encoding first pass"
,
OFFSET
(
fastfirstpass
),
FF_OPT_TYPE_INT
,
{
1
},
0
,
1
,
VE
},
{
"fastfirstpass"
,
"Use fast settings when encoding first pass"
,
OFFSET
(
fastfirstpass
),
FF_OPT_TYPE_INT
,
{
1
},
0
,
1
,
VE
},
{
"crf"
,
"Select the quality for constant quality mode"
,
OFFSET
(
crf
),
FF_OPT_TYPE_FLOAT
,
{
-
1
},
-
1
,
FLT_MAX
,
VE
},
{
"crf"
,
"Select the quality for constant quality mode"
,
OFFSET
(
crf
),
FF_OPT_TYPE_FLOAT
,
{
-
1
},
-
1
,
FLT_MAX
,
VE
},
{
"cqp"
,
"Constant quantization parameter rate control method"
,
OFFSET
(
cqp
),
FF_OPT_TYPE_INT
,
{
-
1
},
-
1
,
INT_MAX
,
VE
},
{
NULL
},
{
NULL
},
};
};
...
...
libavcodec/options.c
View file @
9d508e49
...
@@ -377,8 +377,8 @@ static const AVOption options[]={
...
@@ -377,8 +377,8 @@ static const AVOption options[]={
{
"brd_scale"
,
"downscales frames for dynamic B-frame decision"
,
OFFSET
(
brd_scale
),
FF_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
0
,
10
,
V
|
E
},
{
"brd_scale"
,
"downscales frames for dynamic B-frame decision"
,
OFFSET
(
brd_scale
),
FF_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
0
,
10
,
V
|
E
},
#if FF_API_X264_GLOBAL_OPTS
#if FF_API_X264_GLOBAL_OPTS
{
"crf"
,
"enables constant quality mode, and selects the quality (x264)"
,
OFFSET
(
crf
),
FF_OPT_TYPE_FLOAT
,
{.
dbl
=
DEFAULT
},
0
,
51
,
V
|
E
},
{
"crf"
,
"enables constant quality mode, and selects the quality (x264)"
,
OFFSET
(
crf
),
FF_OPT_TYPE_FLOAT
,
{.
dbl
=
DEFAULT
},
0
,
51
,
V
|
E
},
#endif
{
"cqp"
,
"constant quantization parameter rate control method"
,
OFFSET
(
cqp
),
FF_OPT_TYPE_INT
,
{.
dbl
=
-
1
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"cqp"
,
"constant quantization parameter rate control method"
,
OFFSET
(
cqp
),
FF_OPT_TYPE_INT
,
{.
dbl
=
-
1
},
INT_MIN
,
INT_MAX
,
V
|
E
},
#endif
{
"keyint_min"
,
"minimum interval between IDR-frames (x264)"
,
OFFSET
(
keyint_min
),
FF_OPT_TYPE_INT
,
{.
dbl
=
25
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"keyint_min"
,
"minimum interval between IDR-frames (x264)"
,
OFFSET
(
keyint_min
),
FF_OPT_TYPE_INT
,
{.
dbl
=
25
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"refs"
,
"reference frames to consider for motion compensation (Snow)"
,
OFFSET
(
refs
),
FF_OPT_TYPE_INT
,
{.
dbl
=
1
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"refs"
,
"reference frames to consider for motion compensation (Snow)"
,
OFFSET
(
refs
),
FF_OPT_TYPE_INT
,
{.
dbl
=
1
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"chromaoffset"
,
"chroma qp offset from luma"
,
OFFSET
(
chromaoffset
),
FF_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
{
"chromaoffset"
,
"chroma qp offset from luma"
,
OFFSET
(
chromaoffset
),
FF_OPT_TYPE_INT
,
{.
dbl
=
DEFAULT
},
INT_MIN
,
INT_MAX
,
V
|
E
},
...
...
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