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
d66de380
Commit
d66de380
authored
May 27, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
j2kdec: merge get_tlm() from jpeg2000
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
8cf57efd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
j2kdec.c
libavcodec/j2kdec.c
+46
-0
No files found.
libavcodec/j2kdec.c
View file @
d66de380
...
...
@@ -432,6 +432,48 @@ static int get_sot(Jpeg2000DecoderContext *s)
return
0
;
}
/* Tile-part lengths: see ISO 15444-1:2002, section A.7.1
* Used to know the number of tile parts and lengths.
* There may be multiple TLMs in the header.
* TODO: The function is not used for tile-parts management, nor anywhere else.
* It can be useful to allocate memory for tile parts, before managing the SOT
* markers. Parsing the TLM header is needed to increment the input header
* buffer.
* This marker is mandatory for DCI. */
static
uint8_t
get_tlm
(
Jpeg2000DecoderContext
*
s
,
int
n
)
{
uint8_t
Stlm
,
ST
,
SP
,
tile_tlm
,
i
;
bytestream2_get_byte
(
&
s
->
g
);
/* Ztlm: skipped */
Stlm
=
bytestream2_get_byte
(
&
s
->
g
);
// too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02);
ST
=
(
Stlm
>>
4
)
&
0x03
;
// TODO: Manage case of ST = 0b11 --> raise error
SP
=
(
Stlm
>>
6
)
&
0x01
;
tile_tlm
=
(
n
-
4
)
/
((
SP
+
1
)
*
2
+
ST
);
for
(
i
=
0
;
i
<
tile_tlm
;
i
++
)
{
switch
(
ST
)
{
case
0
:
break
;
case
1
:
bytestream2_get_byte
(
&
s
->
g
);
break
;
case
2
:
bytestream2_get_be16
(
&
s
->
g
);
break
;
case
3
:
bytestream2_get_be32
(
&
s
->
g
);
break
;
}
if
(
SP
==
0
)
{
bytestream2_get_be16
(
&
s
->
g
);
}
else
{
bytestream2_get_be32
(
&
s
->
g
);
}
}
return
0
;
}
static
int
init_tile
(
Jpeg2000DecoderContext
*
s
,
int
tileno
)
{
int
compno
;
...
...
@@ -994,6 +1036,10 @@ static int decode_codestream(Jpeg2000DecoderContext *s)
// the comment is ignored
bytestream2_skip
(
&
s
->
g
,
len
-
2
);
break
;
case
JPEG2000_TLM
:
// Tile-part lengths
ret
=
get_tlm
(
s
,
len
);
break
;
default:
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"unsupported marker 0x%.4X at pos 0x%x
\n
"
,
marker
,
bytestream2_tell
(
&
s
->
g
)
-
4
);
bytestream2_skip
(
&
s
->
g
,
len
-
2
);
...
...
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