Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
31c8f2ec
Commit
31c8f2ec
authored
Feb 20, 2014
by
Matti Picus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix code, it turns out only TIFFReadRGBATile needs buffer pointer mangling
parent
46d128e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
grfmt_tiff.cpp
modules/highgui/src/grfmt_tiff.cpp
+12
-15
No files found.
modules/highgui/src/grfmt_tiff.cpp
View file @
31c8f2ec
...
...
@@ -235,19 +235,21 @@ bool TiffDecoder::readData( Mat& img )
{
case
8
:
{
uchar
*
bstart
=
buffer
;
if
(
!
is_tiled
)
ok
=
TIFFReadRGBAStrip
(
tif
,
y
,
(
uint32
*
)
buffer
);
else
{
ok
=
TIFFReadRGBATile
(
tif
,
x
,
y
,
(
uint32
*
)
buffer
);
//Tiles fill the buffer from the bottom up
bstart
+=
(
tile_height0
-
tile_height
)
*
tile_width0
*
4
;
}
if
(
!
ok
)
{
close
();
return
false
;
}
uchar
*
bstart
=
buffer
+
(
tile_height0
-
tile_height
)
*
tile_width0
*
4
;
for
(
i
=
0
;
i
<
tile_height
;
i
++
)
if
(
color
)
icvCvt_BGRA2BGR_8u_C4C3R
(
bstart
+
i
*
tile_width0
*
4
,
0
,
...
...
@@ -273,27 +275,25 @@ bool TiffDecoder::readData( Mat& img )
return
false
;
}
uint16
*
bstart
=
buffer16
+
(
tile_height0
-
tile_height
)
*
tile_width0
*
ncn
;
for
(
i
=
0
;
i
<
tile_height
;
i
++
)
{
if
(
color
)
{
if
(
ncn
==
1
)
{
icvCvt_Gray2BGR_16u_C1C3R
(
b
start
+
i
*
tile_width0
*
ncn
,
0
,
icvCvt_Gray2BGR_16u_C1C3R
(
b
uffer16
+
i
*
tile_width0
*
ncn
,
0
,
(
ushort
*
)(
data
+
img
.
step
*
i
)
+
x
*
3
,
0
,
cvSize
(
tile_width
,
1
)
);
}
else
if
(
ncn
==
3
)
{
icvCvt_RGB2BGR_16u_C3R
(
b
start
+
i
*
tile_width0
*
ncn
,
0
,
icvCvt_RGB2BGR_16u_C3R
(
b
uffer16
+
i
*
tile_width0
*
ncn
,
0
,
(
ushort
*
)(
data
+
img
.
step
*
i
)
+
x
*
3
,
0
,
cvSize
(
tile_width
,
1
)
);
}
else
{
icvCvt_BGRA2BGR_16u_C4C3R
(
b
start
+
i
*
tile_width0
*
ncn
,
0
,
icvCvt_BGRA2BGR_16u_C4C3R
(
b
uffer16
+
i
*
tile_width0
*
ncn
,
0
,
(
ushort
*
)(
data
+
img
.
step
*
i
)
+
x
*
3
,
0
,
cvSize
(
tile_width
,
1
),
2
);
}
...
...
@@ -303,12 +303,12 @@ bool TiffDecoder::readData( Mat& img )
if
(
ncn
==
1
)
{
memcpy
((
ushort
*
)(
data
+
img
.
step
*
i
)
+
x
,
b
start
+
i
*
tile_width0
*
ncn
,
b
uffer16
+
i
*
tile_width0
*
ncn
,
tile_width
*
sizeof
(
buffer16
[
0
]));
}
else
{
icvCvt_BGRA2Gray_16u_CnC1R
(
b
start
+
i
*
tile_width0
*
ncn
,
0
,
icvCvt_BGRA2Gray_16u_CnC1R
(
b
uffer16
+
i
*
tile_width0
*
ncn
,
0
,
(
ushort
*
)(
data
+
img
.
step
*
i
)
+
x
,
0
,
cvSize
(
tile_width
,
1
),
ncn
,
2
);
}
...
...
@@ -331,21 +331,18 @@ bool TiffDecoder::readData( Mat& img )
return
false
;
}
float
*
fstart
=
buffer32
+
(
tile_height0
-
tile_height
)
*
tile_width0
*
sizeof
(
buffer32
[
0
]);
double
*
dstart
=
buffer64
+
(
tile_height0
-
tile_height
)
*
tile_width0
*
sizeof
(
buffer64
[
0
]);
for
(
i
=
0
;
i
<
tile_height
;
i
++
)
{
if
(
dst_bpp
==
32
)
{
memcpy
((
float
*
)(
data
+
img
.
step
*
i
)
+
x
,
fstart
+
i
*
tile_width0
*
ncn
,
buffer32
+
i
*
tile_width0
*
ncn
,
tile_width
*
sizeof
(
buffer32
[
0
]));
}
else
{
memcpy
((
double
*
)(
data
+
img
.
step
*
i
)
+
x
,
dstart
+
i
*
tile_width0
*
ncn
,
buffer64
+
i
*
tile_width0
*
ncn
,
tile_width
*
sizeof
(
buffer64
[
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