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
81ccc31f
Commit
81ccc31f
authored
May 27, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
j2kdec: merge decode_tile cblk handling from jpeg2000
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
2c5a5c5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
36 deletions
+39
-36
j2kdec.c
libavcodec/j2kdec.c
+39
-36
No files found.
libavcodec/j2kdec.c
View file @
81ccc31f
...
...
@@ -789,59 +789,62 @@ static int decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile)
Jpeg2000ResLevel
*
rlevel
=
comp
->
reslevel
+
reslevelno
;
/* Loop on bands */
for
(
bandno
=
0
;
bandno
<
rlevel
->
nbands
;
bandno
++
)
{
int
nb_precincts
,
precno
;
Jpeg2000Band
*
band
=
rlevel
->
band
+
bandno
;
int
cblkx
,
cblky
,
cblkno
=
0
,
xx0
,
x0
,
xx1
,
y0
,
yy0
,
yy1
,
bandpos
;
int
cblkx
,
cblky
,
cblkno
=
0
,
bandpos
;
bandpos
=
bandno
+
(
reslevelno
>
0
);
yy0
=
bandno
==
0
?
0
:
comp
->
reslevel
[
reslevelno
-
1
].
coord
[
1
][
1
]
-
comp
->
reslevel
[
reslevelno
-
1
].
coord
[
1
][
0
];
y0
=
yy0
;
yy1
=
FFMIN
(
ff_jpeg2000_ceildivpow2
(
band
->
coord
[
1
][
0
]
+
1
,
band
->
log2_cblk_height
)
<<
band
->
log2_cblk_height
,
band
->
coord
[
1
][
1
])
-
band
->
coord
[
1
][
0
]
+
yy0
;
if
(
band
->
coord
[
0
][
0
]
==
band
->
coord
[
0
][
1
]
||
band
->
coord
[
1
][
0
]
==
band
->
coord
[
1
][
1
])
continue
;
for
(
cblky
=
0
;
cblky
<
band
->
cblkny
;
cblky
++
)
{
if
(
reslevelno
==
0
||
bandno
==
1
)
xx0
=
0
;
else
xx0
=
comp
->
reslevel
[
reslevelno
-
1
].
coord
[
0
][
1
]
-
comp
->
reslevel
[
reslevelno
-
1
].
coord
[
0
][
0
];
x0
=
xx0
;
xx1
=
FFMIN
(
ff_jpeg2000_ceildivpow2
(
band
->
coord
[
0
][
0
]
+
1
,
band
->
log2_cblk_width
)
<<
band
->
log2_cblk_width
,
band
->
coord
[
0
][
1
])
-
band
->
coord
[
0
][
0
]
+
xx0
;
for
(
cblkx
=
0
;
cblkx
<
band
->
cblknx
;
cblkx
++
,
cblkno
++
)
{
int
y
,
x
;
decode_cblk
(
s
,
codsty
,
&
t1
,
band
->
cblk
+
cblkno
,
xx1
-
xx0
,
yy1
-
yy0
,
bandpos
);
nb_precincts
=
rlevel
->
num_precincts_x
*
rlevel
->
num_precincts_y
;
/* Loop on precincts */
for
(
precno
=
0
;
precno
<
nb_precincts
;
precno
++
)
{
Jpeg2000Prec
*
prec
=
band
->
prec
+
precno
;
/* Loop on codeblocks */
for
(
cblkno
=
0
;
cblkno
<
prec
->
nb_codeblocks_width
*
prec
->
nb_codeblocks_height
;
cblkno
++
)
{
int
x
,
y
;
int
i
,
j
;
Jpeg2000Cblk
*
cblk
=
prec
->
cblk
+
cblkno
;
decode_cblk
(
s
,
codsty
,
&
t1
,
cblk
,
cblk
->
coord
[
0
][
1
]
-
cblk
->
coord
[
0
][
0
],
cblk
->
coord
[
1
][
1
]
-
cblk
->
coord
[
1
][
0
],
bandpos
);
/* Manage band offsets */
x
=
cblk
->
coord
[
0
][
0
];
y
=
cblk
->
coord
[
1
][
0
];
if
(
codsty
->
transform
==
FF_DWT53
)
{
for
(
y
=
yy0
;
y
<
yy1
;
y
+=
s
->
cdy
[
compno
])
{
int
*
ptr
=
t1
.
data
[
y
-
yy0
];
for
(
x
=
xx0
;
x
<
xx1
;
x
+=
s
->
cdx
[
compno
])
{
comp
->
data
[(
comp
->
coord
[
0
][
1
]
-
comp
->
coord
[
0
][
0
])
*
y
+
x
]
=
*
ptr
++
>>
1
;
for
(
j
=
0
;
j
<
(
cblk
->
coord
[
1
][
1
]
-
cblk
->
coord
[
1
][
0
]);
++
j
)
{
int
*
datap
=
&
comp
->
data
[(
comp
->
coord
[
0
][
1
]
-
comp
->
coord
[
0
][
0
])
*
(
y
+
j
)
+
x
];
int
*
ptr
=
t1
.
data
[
j
];
for
(
i
=
0
;
i
<
(
cblk
->
coord
[
0
][
1
]
-
cblk
->
coord
[
0
][
0
]);
++
i
)
{
datap
[
i
]
=
ptr
[
i
]
>>
1
;
}
}
}
else
{
for
(
y
=
yy0
;
y
<
yy1
;
y
+=
s
->
cdy
[
compno
])
{
int
*
ptr
=
t1
.
data
[
y
-
yy0
];
for
(
x
=
xx0
;
x
<
xx1
;
x
+=
s
->
cdx
[
compno
])
{
int
tmp
=
((
int64_t
)
*
ptr
++
)
*
((
int64_t
)
band
->
stepsize
)
>>
13
,
tmp2
;
for
(
j
=
0
;
j
<
(
cblk
->
coord
[
1
][
1
]
-
cblk
->
coord
[
1
][
0
]);
++
j
)
{
int
*
datap
=
&
comp
->
data
[(
comp
->
coord
[
0
][
1
]
-
comp
->
coord
[
0
][
0
])
*
(
y
+
j
)
+
x
];
int
*
ptr
=
t1
.
data
[
j
];
for
(
i
=
0
;
i
<
(
cblk
->
coord
[
0
][
1
]
-
cblk
->
coord
[
0
][
0
]);
++
i
)
{
int
tmp
=
((
int64_t
)
ptr
[
i
])
*
((
int64_t
)
band
->
stepsize
)
>>
13
,
tmp2
;
tmp2
=
FFABS
(
tmp
>>
1
)
+
(
tmp
&
1
);
comp
->
data
[(
comp
->
coord
[
0
][
1
]
-
comp
->
coord
[
0
][
0
])
*
y
+
x
]
=
tmp
<
0
?
-
tmp2
:
tmp2
;
datap
[
i
]
=
tmp
<
0
?
-
tmp2
:
tmp2
;
}
}
}
xx0
=
xx1
;
xx1
=
FFMIN
(
xx1
+
(
1
<<
band
->
log2_cblk_width
),
band
->
coord
[
0
][
1
]
-
band
->
coord
[
0
][
0
]
+
x0
);
}
yy0
=
yy1
;
yy1
=
FFMIN
(
yy1
+
(
1
<<
band
->
log2_cblk_height
),
band
->
coord
[
1
][
1
]
-
band
->
coord
[
1
][
0
]
+
y0
);
}
}
}
}
/* end cblk */
}
/*end prec */
}
/* end band */
}
/* end reslevel */
ff_j2k_dwt_decode
(
&
comp
->
dwt
,
comp
->
data
);
src
[
compno
]
=
comp
->
data
;
}
}
/*end comp */
/* inverse MCT transformation */
if
(
tile
->
codsty
[
0
].
mct
)
mct_decode
(
s
,
tile
);
...
...
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