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
d94b11a7
Commit
d94b11a7
authored
Feb 10, 2016
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg_filter: Factor get_compliance_unofficial_pix_fmts() out
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
82d2aa2b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
20 deletions
+24
-20
ffmpeg_filter.c
ffmpeg_filter.c
+24
-20
No files found.
ffmpeg_filter.c
View file @
d94b11a7
...
...
@@ -38,13 +38,9 @@
#include "libavutil/imgutils.h"
#include "libavutil/samplefmt.h"
enum
AVPixelFormat
choose_pixel_fmt
(
AVStream
*
st
,
AVCodecContext
*
enc_ctx
,
AVCodec
*
codec
,
enum
AVPixelFormat
target
)
static
const
enum
AVPixelFormat
*
get_compliance_unofficial_pix_fmts
(
enum
AVCodecID
codec_id
,
const
enum
AVPixelFormat
default_formats
[])
{
if
(
codec
&&
codec
->
pix_fmts
)
{
const
enum
AVPixelFormat
*
p
=
codec
->
pix_fmts
;
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
target
);
int
has_alpha
=
desc
?
desc
->
nb_components
%
2
==
0
:
0
;
enum
AVPixelFormat
best
=
AV_PIX_FMT_NONE
;
static
const
enum
AVPixelFormat
mjpeg_formats
[]
=
{
AV_PIX_FMT_YUVJ420P
,
AV_PIX_FMT_YUVJ422P
,
AV_PIX_FMT_YUVJ444P
,
AV_PIX_FMT_YUV420P
,
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_YUV444P
,
...
...
@@ -55,12 +51,25 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx, AVCod
AV_PIX_FMT_YUV420P
,
AV_PIX_FMT_YUV444P
,
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_NONE
};
if
(
enc_ctx
->
strict_std_compliance
<=
FF_COMPLIANCE_UNOFFICIAL
)
{
if
(
enc_ctx
->
codec_id
==
AV_CODEC_ID_MJPEG
)
{
p
=
mjpeg_formats
;
}
else
if
(
enc_ctx
->
codec_id
==
AV_CODEC_ID_LJPEG
)
{
p
=
ljpeg_formats
;
if
(
codec_id
==
AV_CODEC_ID_MJPEG
)
{
return
mjpeg_formats
;
}
else
if
(
codec_id
==
AV_CODEC_ID_LJPEG
)
{
return
ljpeg_formats
;
}
else
{
return
default_formats
;
}
}
enum
AVPixelFormat
choose_pixel_fmt
(
AVStream
*
st
,
AVCodecContext
*
enc_ctx
,
AVCodec
*
codec
,
enum
AVPixelFormat
target
)
{
if
(
codec
&&
codec
->
pix_fmts
)
{
const
enum
AVPixelFormat
*
p
=
codec
->
pix_fmts
;
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
target
);
int
has_alpha
=
desc
?
desc
->
nb_components
%
2
==
0
:
0
;
enum
AVPixelFormat
best
=
AV_PIX_FMT_NONE
;
if
(
enc_ctx
->
strict_std_compliance
<=
FF_COMPLIANCE_UNOFFICIAL
)
{
p
=
get_compliance_unofficial_pix_fmts
(
enc_ctx
->
codec_id
,
p
);
}
for
(;
*
p
!=
AV_PIX_FMT_NONE
;
p
++
)
{
best
=
avcodec_find_best_pix_fmt_of_2
(
best
,
*
p
,
target
,
has_alpha
,
NULL
);
...
...
@@ -130,12 +139,7 @@ static char *choose_pix_fmts(OutputStream *ost)
p
=
ost
->
enc
->
pix_fmts
;
if
(
ost
->
enc_ctx
->
strict_std_compliance
<=
FF_COMPLIANCE_UNOFFICIAL
)
{
if
(
ost
->
enc_ctx
->
codec_id
==
AV_CODEC_ID_MJPEG
)
{
p
=
(
const
enum
AVPixelFormat
[])
{
AV_PIX_FMT_YUVJ420P
,
AV_PIX_FMT_YUVJ422P
,
AV_PIX_FMT_YUV420P
,
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_NONE
};
}
else
if
(
ost
->
enc_ctx
->
codec_id
==
AV_CODEC_ID_LJPEG
)
{
p
=
(
const
enum
AVPixelFormat
[])
{
AV_PIX_FMT_YUVJ420P
,
AV_PIX_FMT_YUVJ422P
,
AV_PIX_FMT_YUVJ444P
,
AV_PIX_FMT_YUV420P
,
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_YUV444P
,
AV_PIX_FMT_BGRA
,
AV_PIX_FMT_NONE
};
}
p
=
get_compliance_unofficial_pix_fmts
(
ost
->
enc_ctx
->
codec_id
,
p
);
}
for
(;
*
p
!=
AV_PIX_FMT_NONE
;
p
++
)
{
...
...
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