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
598f7d04
Commit
598f7d04
authored
Jan 27, 2015
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DNxHD: Simplify pixel format detection
Error out in case of unknown values.
parent
41e03e28
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
25 deletions
+20
-25
dnxhddec.c
libavcodec/dnxhddec.c
+20
-25
No files found.
libavcodec/dnxhddec.c
View file @
598f7d04
...
...
@@ -133,35 +133,30 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
av_dlog
(
ctx
->
avctx
,
"width %d, height %d
\n
"
,
ctx
->
width
,
ctx
->
height
);
ctx
->
is_444
=
0
;
if
(
buf
[
0x4
]
==
0x2
)
{
ctx
->
avctx
->
pix_fmt
=
AV_PIX_FMT_YUV444P10
;
ctx
->
avctx
->
bits_per_raw_sample
=
10
;
if
(
ctx
->
bit_depth
!=
10
)
{
ff_blockdsp_init
(
&
ctx
->
bdsp
,
ctx
->
avctx
)
;
ff_idctdsp_init
(
&
ctx
->
idsp
,
ctx
->
avctx
);
ctx
->
bit_depth
=
10
;
if
(
!
ctx
->
bit_depth
)
{
ff_blockdsp_init
(
&
ctx
->
bdsp
,
ctx
->
avctx
);
ff_idctdsp_init
(
&
ctx
->
idsp
,
ctx
->
avctx
)
;
}
if
(
buf
[
0x21
]
==
0x58
)
{
/* 10 bit */
ctx
->
bit_depth
=
ctx
->
avctx
->
bits_per_raw_sample
=
10
;
if
(
buf
[
0x4
]
==
0x2
)
{
ctx
->
decode_dct_block
=
dnxhd_decode_dct_block_10_444
;
}
ctx
->
is_444
=
1
;
}
else
if
(
buf
[
0x21
]
&
0x40
)
{
ctx
->
avctx
->
pix_fmt
=
AV_PIX_FMT_YUV422P10
;
ctx
->
avctx
->
bits_per_raw_sample
=
10
;
if
(
ctx
->
bit_depth
!=
10
)
{
ff_blockdsp_init
(
&
ctx
->
bdsp
,
ctx
->
avctx
);
ff_idctdsp_init
(
&
ctx
->
idsp
,
ctx
->
avctx
);
ctx
->
bit_depth
=
10
;
ctx
->
avctx
->
pix_fmt
=
AV_PIX_FMT_YUV444P10
;
ctx
->
is_444
=
1
;
}
else
{
ctx
->
decode_dct_block
=
dnxhd_decode_dct_block_10
;
ctx
->
avctx
->
pix_fmt
=
AV_PIX_FMT_YUV422P10
;
}
}
else
{
}
else
if
(
buf
[
0x21
]
==
0x38
)
{
/* 8 bit */
ctx
->
bit_depth
=
ctx
->
avctx
->
bits_per_raw_sample
=
8
;
ctx
->
avctx
->
pix_fmt
=
AV_PIX_FMT_YUV422P
;
ctx
->
avctx
->
bits_per_raw_sample
=
8
;
if
(
ctx
->
bit_depth
!=
8
)
{
ff_blockdsp_init
(
&
ctx
->
bdsp
,
ctx
->
avctx
);
ff_idctdsp_init
(
&
ctx
->
idsp
,
ctx
->
avctx
);
ctx
->
bit_depth
=
8
;
ctx
->
decode_dct_block
=
dnxhd_decode_dct_block_8
;
}
ctx
->
decode_dct_block
=
dnxhd_decode_dct_block_8
;
}
else
{
av_log
(
ctx
->
avctx
,
AV_LOG_ERROR
,
"invalid bit depth value (%d).
\n
"
,
buf
[
0x21
]);
return
AVERROR_INVALIDDATA
;
}
cid
=
AV_RB32
(
buf
+
0x28
);
...
...
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