Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
x264
Commits
95cdb743
Commit
95cdb743
authored
Aug 08, 2017
by
Vittorio Giovara
Committed by
Anton Mitrofanov
Dec 24, 2017
Browse files
Support writing the alternative transfer SEI message
parent
c98d02be
Changes
7
Hide whitespace changes
Inline
Side-by-side
common/base.c
View file @
95cdb743
...
...
@@ -409,6 +409,7 @@ void x264_param_default( x264_param_t *param )
param
->
b_pic_struct
=
0
;
param
->
b_fake_interlaced
=
0
;
param
->
i_frame_packing
=
-
1
;
param
->
i_alternative_transfer
=
2
;
/* undef */
param
->
b_opencl
=
0
;
param
->
i_opencl_device
=
0
;
param
->
opencl_device_id
=
NULL
;
...
...
@@ -936,6 +937,8 @@ int x264_param_parse( x264_param_t *p, const char *name, const char *value )
p
->
vui
.
i_chroma_loc
=
atoi
(
value
);
b_error
=
(
p
->
vui
.
i_chroma_loc
<
0
||
p
->
vui
.
i_chroma_loc
>
5
);
}
OPT
(
"alternative-transfer"
)
b_error
|=
parse_enum
(
value
,
x264_transfer_names
,
&
p
->
i_alternative_transfer
);
OPT
(
"fps"
)
{
if
(
sscanf
(
value
,
"%u/%u"
,
&
p
->
i_fps_num
,
&
p
->
i_fps_den
)
!=
2
)
...
...
common/base.h
View file @
95cdb743
...
...
@@ -119,6 +119,7 @@ enum sei_payload_type_e
SEI_RECOVERY_POINT
=
6
,
SEI_DEC_REF_PIC_MARKING
=
7
,
SEI_FRAME_PACKING
=
45
,
SEI_ALTERNATIVE_TRANSFER
=
147
,
};
#define X264_BFRAME_MAX 16
...
...
encoder/encoder.c
View file @
95cdb743
...
...
@@ -3636,6 +3636,15 @@ int x264_encoder_encode( x264_t *h,
overhead
+=
h
->
out
.
nal
[
h
->
out
.
i_nal
-
1
].
i_payload
+
SEI_OVERHEAD
;
}
if
(
h
->
param
.
i_alternative_transfer
!=
2
)
{
nal_start
(
h
,
NAL_SEI
,
NAL_PRIORITY_DISPOSABLE
);
x264_sei_alternative_transfer_write
(
h
,
&
h
->
out
.
bs
);
if
(
nal_end
(
h
)
)
return
-
1
;
overhead
+=
h
->
out
.
nal
[
h
->
out
.
i_nal
-
1
].
i_payload
+
SEI_OVERHEAD
;
}
/* generate sei pic timing */
if
(
h
->
sps
->
vui
.
b_pic_struct_present
||
h
->
sps
->
vui
.
b_nal_hrd_parameters_present
)
{
...
...
encoder/set.c
View file @
95cdb743
...
...
@@ -690,6 +690,23 @@ void x264_sei_frame_packing_write( x264_t *h, bs_t *s )
x264_sei_write
(
s
,
tmp_buf
,
bs_pos
(
&
q
)
/
8
,
SEI_FRAME_PACKING
);
}
void
x264_sei_alternative_transfer_write
(
x264_t
*
h
,
bs_t
*
s
)
{
bs_t
q
;
ALIGNED_4
(
uint8_t
tmp_buf
[
100
]
);
M32
(
tmp_buf
)
=
0
;
// shut up gcc
bs_init
(
&
q
,
tmp_buf
,
100
);
bs_realign
(
&
q
);
bs_write
(
&
q
,
8
,
h
->
param
.
i_alternative_transfer
);
// preferred_transfer_characteristics
bs_align_10
(
&
q
);
bs_flush
(
&
q
);
x264_sei_write
(
s
,
tmp_buf
,
bs_pos
(
&
q
)
/
8
,
SEI_ALTERNATIVE_TRANSFER
);
}
void
x264_filler_write
(
x264_t
*
h
,
bs_t
*
s
,
int
filler
)
{
bs_realign
(
s
);
...
...
encoder/set.h
View file @
95cdb743
...
...
@@ -51,6 +51,8 @@ void x264_sei_pic_timing_write( x264_t *h, bs_t *s );
void
x264_sei_dec_ref_pic_marking_write
(
x264_t
*
h
,
bs_t
*
s
);
#define x264_sei_frame_packing_write x264_template(sei_frame_packing_write)
void
x264_sei_frame_packing_write
(
x264_t
*
h
,
bs_t
*
s
);
#define x264_sei_alternative_transfer_write x264_template(sei_alternative_transfer_write)
void
x264_sei_alternative_transfer_write
(
x264_t
*
h
,
bs_t
*
s
);
#define x264_sei_avcintra_umid_write x264_template(sei_avcintra_umid_write)
int
x264_sei_avcintra_umid_write
(
x264_t
*
h
,
bs_t
*
s
);
#define x264_sei_avcintra_vanc_write x264_template(sei_avcintra_vanc_write)
...
...
x264.c
View file @
95cdb743
...
...
@@ -868,7 +868,10 @@ static void help( x264_param_t *defaults, int longhelp )
strtable_lookup
(
x264_colmatrix_names
,
defaults
->
vui
.
i_colmatrix
)
);
H2
(
" --chromaloc <integer> Specify chroma sample location (0 to 5) [%d]
\n
"
,
defaults
->
vui
.
i_chroma_loc
);
H2
(
" --alternative-transfer <string> Specify an alternative transfer
\n
"
" characteristics [
\"
%s
\"
]
\n
"
" - same values as --transfer
\n
"
,
strtable_lookup
(
x264_transfer_names
,
defaults
->
i_alternative_transfer
)
);
H2
(
" --nal-hrd <string> Signal HRD information (requires vbv-bufsize)
\n
"
" - none, vbr, cbr (cbr not allowed in .mp4)
\n
"
);
H2
(
" --filler Force hard-CBR and generate filler (implied by
\n
"
...
...
@@ -1142,6 +1145,7 @@ static struct option long_options[] =
{
"pulldown"
,
required_argument
,
NULL
,
OPT_PULLDOWN
},
{
"fake-interlaced"
,
no_argument
,
NULL
,
0
},
{
"frame-packing"
,
required_argument
,
NULL
,
0
},
{
"alternative-transfer"
,
required_argument
,
NULL
,
0
},
{
"vf"
,
required_argument
,
NULL
,
OPT_VIDEO_FILTER
},
{
"video-filter"
,
required_argument
,
NULL
,
OPT_VIDEO_FILTER
},
{
"input-fmt"
,
required_argument
,
NULL
,
OPT_INPUT_FMT
},
...
...
x264.h
View file @
95cdb743
...
...
@@ -45,7 +45,7 @@ extern "C" {
#include
"x264_config.h"
#define X264_BUILD 15
4
#define X264_BUILD 15
5
/* Application developers planning to link against a shared library version of
* libx264 from a Microsoft Visual Studio or similar development environment
...
...
@@ -460,6 +460,9 @@ typedef struct x264_param_t
/* frame packing arrangement flag */
int
i_frame_packing
;
/* alternative transfer SEI */
int
i_alternative_transfer
;
/* Muxing parameters */
int
b_aud
;
/* generate access unit delimiters */
int
b_repeat_headers
;
/* put SPS/PPS before each keyframe */
...
...
Write
Preview
Supports
Markdown
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