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
254f653b
Commit
254f653b
authored
Apr 01, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/jpeglsdec: add PAL8 support
Fixes Ticket3478 Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
87907201
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
3 deletions
+48
-3
jpeglsdec.c
libavcodec/jpeglsdec.c
+45
-3
mjpegdec.c
libavcodec/mjpegdec.c
+2
-0
mjpegdec.h
libavcodec/mjpegdec.h
+1
-0
No files found.
libavcodec/jpeglsdec.c
View file @
254f653b
...
...
@@ -50,8 +50,9 @@
int
ff_jpegls_decode_lse
(
MJpegDecodeContext
*
s
)
{
int
id
;
int
tid
,
wt
,
maxtab
,
i
,
j
;
skip
_bits
(
&
s
->
gb
,
16
);
/* length: FIXME: verify field validity */
int
len
=
get
_bits
(
&
s
->
gb
,
16
);
/* length: FIXME: verify field validity */
id
=
get_bits
(
&
s
->
gb
,
8
);
switch
(
id
)
{
...
...
@@ -66,9 +67,50 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
//FIXME quant table?
break
;
case
2
:
s
->
palette_index
=
0
;
case
3
:
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"palette not supported
\n
"
);
return
AVERROR
(
ENOSYS
);
tid
=
get_bits
(
&
s
->
gb
,
8
);
wt
=
get_bits
(
&
s
->
gb
,
8
);
if
(
len
<
5
)
return
AVERROR_INVALIDDATA
;
if
(
wt
<
1
||
wt
>
MAX_COMPONENTS
)
{
avpriv_request_sample
(
s
->
avctx
,
"wt %d"
,
wt
);
return
AVERROR_PATCHWELCOME
;
}
if
((
5
+
wt
*
(
s
->
maxval
+
1
))
<
65535
)
maxtab
=
s
->
maxval
;
else
maxtab
=
65530
/
wt
-
1
;
if
(
s
->
avctx
->
debug
&
FF_DEBUG_PICT_INFO
)
{
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"LSE palette %d tid:%d wt:%d maxtab:%d
\n
"
,
id
,
tid
,
wt
,
maxtab
);
}
if
(
maxtab
>=
256
)
{
avpriv_request_sample
(
s
->
avctx
,
">8bit palette"
);
return
AVERROR_PATCHWELCOME
;
}
maxtab
=
FFMIN
(
maxtab
,
(
len
-
5
)
/
wt
+
s
->
palette_index
);
if
(
s
->
palette_index
>
maxtab
)
return
AVERROR_INVALIDDATA
;
if
((
s
->
avctx
->
pix_fmt
==
AV_PIX_FMT_GRAY8
||
s
->
avctx
->
pix_fmt
==
AV_PIX_FMT_PAL8
)
&&
(
s
->
picture_ptr
->
format
==
AV_PIX_FMT_GRAY8
||
s
->
picture_ptr
->
format
==
AV_PIX_FMT_PAL8
))
{
uint32_t
*
pal
=
s
->
picture_ptr
->
data
[
1
];
s
->
picture_ptr
->
format
=
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_PAL8
;
for
(
i
=
s
->
palette_index
;
i
<
maxtab
;
i
++
)
{
pal
[
i
]
=
0
;
for
(
j
=
0
;
j
<
wt
;
j
++
)
{
pal
[
i
]
|=
get_bits
(
&
s
->
gb
,
8
)
<<
(
8
*
wt
);
}
}
s
->
palette_index
=
i
;
}
break
;
case
4
:
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"oversize image not supported
\n
"
);
return
AVERROR
(
ENOSYS
);
...
...
libavcodec/mjpegdec.c
View file @
254f653b
...
...
@@ -517,6 +517,8 @@ unk_pixfmt:
s
->
upscale_h
=
s
->
upscale_v
=
0
;
if
(
s
->
nb_components
>
1
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_RGB24
;
else
if
(
s
->
palette_index
&&
s
->
bits
<=
8
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_PAL8
;
else
if
(
s
->
bits
<=
8
)
s
->
avctx
->
pix_fmt
=
AV_PIX_FMT_GRAY8
;
else
...
...
libavcodec/mjpegdec.h
View file @
254f653b
...
...
@@ -102,6 +102,7 @@ typedef struct MJpegDecodeContext {
int16_t
(
*
blocks
[
MAX_COMPONENTS
])[
64
];
///< intermediate sums (progressive mode)
uint8_t
*
last_nnz
[
MAX_COMPONENTS
];
uint64_t
coefs_finished
[
MAX_COMPONENTS
];
///< bitmask of which coefs have been completely decoded (progressive mode)
int
palette_index
;
ScanTable
scantable
;
DSPContext
dsp
;
HpelDSPContext
hdsp
;
...
...
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