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
a4743d25
Commit
a4743d25
authored
Oct 07, 2017
by
Mateusz
Committed by
Paul B Mahol
Oct 26, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/yuv4mpeg: add gray9/10/12 support
Signed-off-by:
Mateusz Brzostek
<
mateuszb@poczta.onet.pl
>
parent
f2c86705
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
yuv4mpegdec.c
libavformat/yuv4mpegdec.c
+6
-0
yuv4mpegenc.c
libavformat/yuv4mpegenc.c
+20
-3
No files found.
libavformat/yuv4mpegdec.c
View file @
a4743d25
...
...
@@ -126,6 +126,12 @@ static int yuv4_read_header(AVFormatContext *s)
pix_fmt
=
AV_PIX_FMT_YUV444P
;
}
else
if
(
strncmp
(
"mono16"
,
tokstart
,
6
)
==
0
)
{
pix_fmt
=
AV_PIX_FMT_GRAY16
;
}
else
if
(
strncmp
(
"mono12"
,
tokstart
,
6
)
==
0
)
{
pix_fmt
=
AV_PIX_FMT_GRAY12
;
}
else
if
(
strncmp
(
"mono10"
,
tokstart
,
6
)
==
0
)
{
pix_fmt
=
AV_PIX_FMT_GRAY10
;
}
else
if
(
strncmp
(
"mono9"
,
tokstart
,
5
)
==
0
)
{
pix_fmt
=
AV_PIX_FMT_GRAY9
;
}
else
if
(
strncmp
(
"mono"
,
tokstart
,
4
)
==
0
)
{
pix_fmt
=
AV_PIX_FMT_GRAY8
;
}
else
{
...
...
libavformat/yuv4mpegenc.c
View file @
a4743d25
...
...
@@ -69,6 +69,15 @@ static int yuv4_generate_header(AVFormatContext *s, char* buf)
case
AV_PIX_FMT_GRAY8
:
colorspace
=
" Cmono"
;
break
;
case
AV_PIX_FMT_GRAY9
:
colorspace
=
" Cmono9"
;
break
;
case
AV_PIX_FMT_GRAY10
:
colorspace
=
" Cmono10"
;
break
;
case
AV_PIX_FMT_GRAY12
:
colorspace
=
" Cmono12"
;
break
;
case
AV_PIX_FMT_GRAY16
:
colorspace
=
" Cmono16"
;
break
;
...
...
@@ -184,6 +193,9 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
case
AV_PIX_FMT_YUV422P
:
case
AV_PIX_FMT_YUV444P
:
break
;
case
AV_PIX_FMT_GRAY9
:
case
AV_PIX_FMT_GRAY10
:
case
AV_PIX_FMT_GRAY12
:
case
AV_PIX_FMT_GRAY16
:
case
AV_PIX_FMT_YUV420P9
:
case
AV_PIX_FMT_YUV422P9
:
...
...
@@ -213,7 +225,8 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
ptr
+=
frame
->
linesize
[
0
];
}
if
(
st
->
codecpar
->
format
!=
AV_PIX_FMT_GRAY8
&&
if
(
st
->
codecpar
->
format
!=
AV_PIX_FMT_GRAY8
&&
st
->
codecpar
->
format
!=
AV_PIX_FMT_GRAY9
&&
st
->
codecpar
->
format
!=
AV_PIX_FMT_GRAY10
&&
st
->
codecpar
->
format
!=
AV_PIX_FMT_GRAY12
&&
st
->
codecpar
->
format
!=
AV_PIX_FMT_GRAY16
)
{
// Adjust for smaller Cb and Cr planes
av_pix_fmt_get_chroma_sub_sample
(
st
->
codecpar
->
format
,
&
h_chroma_shift
,
...
...
@@ -255,11 +268,14 @@ static int yuv4_write_header(AVFormatContext *s)
"stream, some mjpegtools might not work.
\n
"
);
break
;
case
AV_PIX_FMT_GRAY8
:
case
AV_PIX_FMT_GRAY16
:
case
AV_PIX_FMT_YUV420P
:
case
AV_PIX_FMT_YUV422P
:
case
AV_PIX_FMT_YUV444P
:
break
;
case
AV_PIX_FMT_GRAY9
:
case
AV_PIX_FMT_GRAY10
:
case
AV_PIX_FMT_GRAY12
:
case
AV_PIX_FMT_GRAY16
:
case
AV_PIX_FMT_YUV420P9
:
case
AV_PIX_FMT_YUV422P9
:
case
AV_PIX_FMT_YUV444P9
:
...
...
@@ -291,7 +307,8 @@ static int yuv4_write_header(AVFormatContext *s)
"yuv444p10, yuv422p10, yuv420p10, "
"yuv444p12, yuv422p12, yuv420p12, "
"yuv444p14, yuv422p14, yuv420p14, "
"yuv444p16, yuv422p16, yuv420p16 "
"yuv444p16, yuv422p16, yuv420p16, "
"gray9, gray10, gray12 "
"and gray16 pixel formats. "
"Use -pix_fmt to select one.
\n
"
);
return
AVERROR
(
EIO
);
...
...
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