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
fe9a3fbe
Commit
fe9a3fbe
authored
Jan 28, 2011
by
Janne Grunau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
h264: Add Intra and Constrained Baseline profiles to avctx.profile
parent
e86e8581
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
15 deletions
+56
-15
avcodec.h
libavcodec/avcodec.h
+15
-8
h264.c
libavcodec/h264.c
+28
-1
h264.h
libavcodec/h264.h
+6
-0
h264_parser.c
libavcodec/h264_parser.c
+1
-1
h264_ps.c
libavcodec/h264_ps.c
+6
-5
No files found.
libavcodec/avcodec.h
View file @
fe9a3fbe
...
...
@@ -2260,13 +2260,20 @@ typedef struct AVCodecContext {
#define FF_PROFILE_DTS_HD_HRA 50
#define FF_PROFILE_DTS_HD_MA 60
#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag
#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag
#define FF_PROFILE_H264_BASELINE 66
#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED)
#define FF_PROFILE_H264_MAIN 77
#define FF_PROFILE_H264_EXTENDED 88
#define FF_PROFILE_H264_HIGH 100
#define FF_PROFILE_H264_HIGH_10 110
#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA)
#define FF_PROFILE_H264_HIGH_422 122
#define FF_PROFILE_H264_HIGH_444 244
#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA)
#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244
#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA)
#define FF_PROFILE_H264_CAVLC_444 44
/**
...
...
libavcodec/h264.c
View file @
fe9a3fbe
...
...
@@ -1677,6 +1677,33 @@ static void clone_slice(H264Context *dst, H264Context *src)
memcpy
(
dst
->
dequant8_coeff
,
src
->
dequant8_coeff
,
sizeof
(
src
->
dequant8_coeff
));
}
/**
* computes profile from profile_idc and constraint_set?_flags
*
* @param sps SPS
*
* @return profile as defined by FF_PROFILE_H264_*
*/
int
ff_h264_get_profile
(
SPS
*
sps
)
{
int
profile
=
sps
->
profile_idc
;
switch
(
sps
->
profile_idc
)
{
case
FF_PROFILE_H264_BASELINE
:
// constraint_set1_flag set to 1
profile
|=
(
sps
->
constraint_set_flags
&
1
<<
1
)
?
FF_PROFILE_H264_CONSTRAINED
:
0
;
break
;
case
FF_PROFILE_H264_HIGH_10
:
case
FF_PROFILE_H264_HIGH_422
:
case
FF_PROFILE_H264_HIGH_444_PREDICTIVE
:
// constraint_set3_flag set to 1
profile
|=
(
sps
->
constraint_set_flags
&
1
<<
3
)
?
FF_PROFILE_H264_INTRA
:
0
;
break
;
}
return
profile
;
}
/**
* decodes a slice header.
* This will also call MPV_common_init() and frame_start() as needed.
...
...
@@ -1756,7 +1783,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
}
h
->
sps
=
*
h0
->
sps_buffers
[
h
->
pps
.
sps_id
];
s
->
avctx
->
profile
=
h
->
sps
.
profile_idc
;
s
->
avctx
->
profile
=
ff_h264_get_profile
(
&
h
->
sps
)
;
s
->
avctx
->
level
=
h
->
sps
.
level_idc
;
s
->
avctx
->
refs
=
h
->
sps
.
ref_frame_count
;
...
...
libavcodec/h264.h
View file @
fe9a3fbe
...
...
@@ -209,6 +209,7 @@ typedef struct SPS{
int
bit_depth_luma
;
///< bit_depth_luma_minus8 + 8
int
bit_depth_chroma
;
///< bit_depth_chroma_minus8 + 8
int
residual_color_transform_flag
;
///< residual_colour_transform_flag
int
constraint_set_flags
;
///< constraint_set[0-3]_flag
}
SPS
;
/**
...
...
@@ -611,6 +612,11 @@ int ff_h264_decode_sei(H264Context *h);
*/
int
ff_h264_decode_seq_parameter_set
(
H264Context
*
h
);
/**
* compute profile from sps
*/
int
ff_h264_get_profile
(
SPS
*
sps
);
/**
* Decode PPS
*/
...
...
libavcodec/h264_parser.c
View file @
fe9a3fbe
...
...
@@ -187,7 +187,7 @@ static inline int parse_nal_units(AVCodecParserContext *s,
h
->
sps
=
*
h
->
sps_buffers
[
h
->
pps
.
sps_id
];
h
->
frame_num
=
get_bits
(
&
h
->
s
.
gb
,
h
->
sps
.
log2_max_frame_num
);
avctx
->
profile
=
h
->
sps
.
profile_idc
;
avctx
->
profile
=
ff_h264_get_profile
(
&
h
->
sps
)
;
avctx
->
level
=
h
->
sps
.
level_idc
;
if
(
h
->
sps
.
frame_mbs_only_flag
){
...
...
libavcodec/h264_ps.c
View file @
fe9a3fbe
...
...
@@ -267,16 +267,16 @@ static void decode_scaling_matrices(H264Context *h, SPS *sps, PPS *pps, int is_s
int
ff_h264_decode_seq_parameter_set
(
H264Context
*
h
){
MpegEncContext
*
const
s
=
&
h
->
s
;
int
profile_idc
,
level_idc
;
int
profile_idc
,
level_idc
,
constraint_set_flags
=
0
;
unsigned
int
sps_id
;
int
i
;
SPS
*
sps
;
profile_idc
=
get_bits
(
&
s
->
gb
,
8
);
get_bits1
(
&
s
->
gb
)
;
//constraint_set0_flag
get_bits1
(
&
s
->
gb
)
;
//constraint_set1_flag
get_bits1
(
&
s
->
gb
)
;
//constraint_set2_flag
get_bits1
(
&
s
->
gb
)
;
//constraint_set3_flag
constraint_set_flags
|=
get_bits1
(
&
s
->
gb
)
<<
0
;
//constraint_set0_flag
constraint_set_flags
|=
get_bits1
(
&
s
->
gb
)
<<
1
;
//constraint_set1_flag
constraint_set_flags
|=
get_bits1
(
&
s
->
gb
)
<<
2
;
//constraint_set2_flag
constraint_set_flags
|=
get_bits1
(
&
s
->
gb
)
<<
3
;
//constraint_set3_flag
get_bits
(
&
s
->
gb
,
4
);
// reserved
level_idc
=
get_bits
(
&
s
->
gb
,
8
);
sps_id
=
get_ue_golomb_31
(
&
s
->
gb
);
...
...
@@ -291,6 +291,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
sps
->
time_offset_length
=
24
;
sps
->
profile_idc
=
profile_idc
;
sps
->
constraint_set_flags
=
constraint_set_flags
;
sps
->
level_idc
=
level_idc
;
memset
(
sps
->
scaling_matrix4
,
16
,
sizeof
(
sps
->
scaling_matrix4
));
...
...
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