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
a41b69b5
Commit
a41b69b5
authored
Sep 09, 2017
by
Mark Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cbs_mpeg2: Add support for picture display extension
parent
067a9dde
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
cbs_mpeg2.h
libavcodec/cbs_mpeg2.h
+8
-0
cbs_mpeg2_syntax_template.c
libavcodec/cbs_mpeg2_syntax_template.c
+44
-0
No files found.
libavcodec/cbs_mpeg2.h
View file @
a41b69b5
...
...
@@ -160,6 +160,11 @@ typedef struct MPEG2RawQuantMatrixExtension {
uint8_t
chroma_non_intra_quantiser_matrix
[
64
];
}
MPEG2RawQuantMatrixExtension
;
typedef
struct
MPEG2RawPictureDisplayExtension
{
uint16_t
frame_centre_horizontal_offset
[
3
];
uint16_t
frame_centre_vertical_offset
[
3
];
}
MPEG2RawPictureDisplayExtension
;
typedef
struct
MPEG2RawExtensionData
{
uint8_t
extension_start_code
;
uint8_t
extension_start_code_identifier
;
...
...
@@ -169,6 +174,7 @@ typedef struct MPEG2RawExtensionData {
MPEG2RawSequenceDisplayExtension
sequence_display
;
MPEG2RawQuantMatrixExtension
quant_matrix
;
MPEG2RawPictureCodingExtension
picture_coding
;
MPEG2RawPictureDisplayExtension
picture_display
;
}
data
;
}
MPEG2RawExtensionData
;
...
...
@@ -206,6 +212,8 @@ typedef struct CodedBitstreamMPEG2Context {
uint16_t
vertical_size
;
uint8_t
scalable
;
uint8_t
scalable_mode
;
uint8_t
progressive_sequence
;
uint8_t
number_of_frame_centre_offsets
;
// Write buffer.
uint8_t
*
write_buffer
;
...
...
libavcodec/cbs_mpeg2_syntax_template.c
View file @
a41b69b5
...
...
@@ -101,6 +101,7 @@ static int FUNC(sequence_extension)(CodedBitstreamContext *ctx, RWContext *rw,
current
->
horizontal_size_extension
<<
12
;
mpeg2
->
vertical_size
=
(
mpeg2
->
vertical_size
&
0xfff
)
|
current
->
vertical_size_extension
<<
12
;
mpeg2
->
progressive_sequence
=
current
->
progressive_sequence
;
ui
(
12
,
bit_rate_extension
);
marker_bit
();
...
...
@@ -183,6 +184,7 @@ static int FUNC(picture_header)(CodedBitstreamContext *ctx, RWContext *rw,
static
int
FUNC
(
picture_coding_extension
)(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
MPEG2RawPictureCodingExtension
*
current
)
{
CodedBitstreamMPEG2Context
*
mpeg2
=
ctx
->
priv_data
;
int
err
;
HEADER
(
"Picture Coding Extension"
);
...
...
@@ -204,6 +206,27 @@ static int FUNC(picture_coding_extension)(CodedBitstreamContext *ctx, RWContext
ui
(
1
,
chroma_420_type
);
ui
(
1
,
progressive_frame
);
if
(
mpeg2
->
progressive_sequence
)
{
if
(
current
->
repeat_first_field
)
{
if
(
current
->
top_field_first
)
mpeg2
->
number_of_frame_centre_offsets
=
3
;
else
mpeg2
->
number_of_frame_centre_offsets
=
2
;
}
else
{
mpeg2
->
number_of_frame_centre_offsets
=
1
;
}
}
else
{
if
(
current
->
picture_structure
==
1
||
// Top field.
current
->
picture_structure
==
2
)
{
// Bottom field.
mpeg2
->
number_of_frame_centre_offsets
=
1
;
}
else
{
if
(
current
->
repeat_first_field
)
mpeg2
->
number_of_frame_centre_offsets
=
3
;
else
mpeg2
->
number_of_frame_centre_offsets
=
2
;
}
}
ui
(
1
,
composite_display_flag
);
if
(
current
->
composite_display_flag
)
{
ui
(
1
,
v_axis
);
...
...
@@ -250,6 +273,24 @@ static int FUNC(quant_matrix_extension)(CodedBitstreamContext *ctx, RWContext *r
return
0
;
}
static
int
FUNC
(
picture_display_extension
)(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
MPEG2RawPictureDisplayExtension
*
current
)
{
CodedBitstreamMPEG2Context
*
mpeg2
=
ctx
->
priv_data
;
int
err
,
i
;
HEADER
(
"Picture Display Extension"
);
for
(
i
=
0
;
i
<
mpeg2
->
number_of_frame_centre_offsets
;
i
++
)
{
ui
(
16
,
frame_centre_horizontal_offset
[
i
]);
marker_bit
();
ui
(
16
,
frame_centre_vertical_offset
[
i
]);
marker_bit
();
}
return
0
;
}
static
int
FUNC
(
extension_data
)(
CodedBitstreamContext
*
ctx
,
RWContext
*
rw
,
MPEG2RawExtensionData
*
current
)
{
...
...
@@ -270,6 +311,9 @@ static int FUNC(extension_data)(CodedBitstreamContext *ctx, RWContext *rw,
case
3
:
return
FUNC
(
quant_matrix_extension
)
(
ctx
,
rw
,
&
current
->
data
.
quant_matrix
);
case
7
:
return
FUNC
(
picture_display_extension
)
(
ctx
,
rw
,
&
current
->
data
.
picture_display
);
case
8
:
return
FUNC
(
picture_coding_extension
)
(
ctx
,
rw
,
&
current
->
data
.
picture_coding
);
...
...
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