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
310f9dd6
Commit
310f9dd6
authored
May 30, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
j2k/jpeg2000: merge pix_fmt setting code
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
6f7de3d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
29 deletions
+38
-29
j2kdec.c
libavcodec/j2kdec.c
+18
-7
jpeg2000dec.c
libavcodec/jpeg2000dec.c
+20
-22
No files found.
libavcodec/j2kdec.c
View file @
310f9dd6
...
...
@@ -215,22 +215,33 @@ static int get_siz(Jpeg2000DecoderContext *s)
s
->
reduction_factor
);
switch
(
s
->
ncomponents
)
{
case
1
:
if
(
s
->
precision
>
8
)
{
if
(
s
->
precision
>
8
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GRAY16
;
}
else
{
else
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GRAY8
;
}
break
;
case
3
:
if
(
s
->
precision
>
8
)
{
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB48
;
}
else
{
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB24
;
switch
(
s
->
avctx
->
profile
)
{
case
FF_PROFILE_JPEG2000_DCINEMA_2K
:
case
FF_PROFILE_JPEG2000_DCINEMA_4K
:
/* XYZ color-space for digital cinema profiles */
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_XYZ12
;
break
;
default:
if
(
s
->
precision
>
8
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB48
;
else
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB24
;
break
;
}
break
;
case
4
:
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_RGBA
;
break
;
default:
/* pixel format can not be identified */
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_NONE
;
break
;
}
...
...
libavcodec/jpeg2000dec.c
View file @
310f9dd6
...
...
@@ -213,37 +213,35 @@ static int get_siz(Jpeg2000DecoderContext *s)
s
->
avctx
->
height
=
ff_jpeg2000_ceildivpow2
(
s
->
height
-
s
->
image_offset_y
,
s
->
reduction_factor
);
switch
(
s
->
avctx
->
profile
)
{
case
FF_PROFILE_JPEG2000_DCINEMA_2K
:
case
FF_PROFILE_JPEG2000_DCINEMA_4K
:
/* XYZ color-space for digital cinema profiles */
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_XYZ12
;
switch
(
s
->
ncomponents
)
{
case
1
:
if
(
s
->
precision
>
8
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GRAY16
;
else
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GRAY8
;
break
;
default:
/* For other profiles selects color-space according number of
* components and bit depth precision. */
switch
(
s
->
ncomponents
)
{
case
1
:
if
(
s
->
precision
>
8
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GRAY16
;
else
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GRAY8
;
case
3
:
switch
(
s
->
avctx
->
profile
)
{
case
FF_PROFILE_JPEG2000_DCINEMA_2K
:
case
FF_PROFILE_JPEG2000_DCINEMA_4K
:
/* XYZ color-space for digital cinema profiles */
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_XYZ12
;
break
;
case
3
:
default
:
if
(
s
->
precision
>
8
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB48
;
else
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB24
;
break
;
case
4
:
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_BGRA
;
break
;
default:
/* pixel format can not be identified */
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_NONE
;
break
;
}
break
;
case
4
:
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_RGBA
;
break
;
default:
/* pixel format can not be identified */
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_NONE
;
break
;
}
return
0
;
}
...
...
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