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
30d7dcce
Commit
30d7dcce
authored
May 28, 2013
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tiff: add helper function for fill_order case
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
b257d9a0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
22 deletions
+21
-22
tiff.c
libavcodec/tiff.c
+21
-22
No files found.
libavcodec/tiff.c
View file @
30d7dcce
...
@@ -411,6 +411,19 @@ static void av_always_inline horizontal_fill(unsigned int bpp, uint8_t* dst,
...
@@ -411,6 +411,19 @@ static void av_always_inline horizontal_fill(unsigned int bpp, uint8_t* dst,
}
}
}
}
static
int
deinvert_buffer
(
TiffContext
*
s
,
const
uint8_t
*
src
,
int
size
)
{
int
i
;
av_fast_padded_malloc
(
&
s
->
deinvert_buf
,
&
s
->
deinvert_buf_size
,
size
);
if
(
!
s
->
deinvert_buf
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
size
;
i
++
)
s
->
deinvert_buf
[
i
]
=
ff_reverse
[
src
[
i
]];
return
0
;
}
static
int
tiff_unpack_strip
(
TiffContext
*
s
,
uint8_t
*
dst
,
int
stride
,
static
int
tiff_unpack_strip
(
TiffContext
*
s
,
uint8_t
*
dst
,
int
stride
,
const
uint8_t
*
src
,
int
size
,
int
lines
)
const
uint8_t
*
src
,
int
size
,
int
lines
)
{
{
...
@@ -423,31 +436,23 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
...
@@ -423,31 +436,23 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
#if CONFIG_ZLIB
#if CONFIG_ZLIB
if
(
s
->
compr
==
TIFF_DEFLATE
||
s
->
compr
==
TIFF_ADOBE_DEFLATE
)
{
if
(
s
->
compr
==
TIFF_DEFLATE
||
s
->
compr
==
TIFF_ADOBE_DEFLATE
)
{
uint8_t
*
src2
=
NULL
,
*
zbuf
;
uint8_t
*
zbuf
;
unsigned
long
outlen
;
unsigned
long
outlen
;
int
i
,
ret
;
int
ret
;
outlen
=
width
*
lines
;
outlen
=
width
*
lines
;
zbuf
=
av_malloc
(
outlen
);
zbuf
=
av_malloc
(
outlen
);
if
(
!
zbuf
)
if
(
!
zbuf
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
if
(
s
->
fill_order
)
{
if
(
s
->
fill_order
)
{
src2
=
av_malloc
((
unsigned
)
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
((
ret
=
deinvert_buffer
(
s
,
src
,
size
))
<
0
)
if
(
!
src2
)
{
return
ret
;
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Error allocating temporary buffer
\n
"
);
ssrc
=
src
=
s
->
deinvert_buf
;
av_free
(
zbuf
);
return
AVERROR
(
ENOMEM
);
}
for
(
i
=
0
;
i
<
size
;
i
++
)
src2
[
i
]
=
ff_reverse
[
src
[
i
]];
memset
(
src2
+
size
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
src
=
src2
;
}
}
ret
=
tiff_uncompress
(
zbuf
,
&
outlen
,
src
,
size
);
ret
=
tiff_uncompress
(
zbuf
,
&
outlen
,
src
,
size
);
if
(
ret
!=
Z_OK
)
{
if
(
ret
!=
Z_OK
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Uncompressing failed (%lu of %lu) with error %d
\n
"
,
outlen
,
"Uncompressing failed (%lu of %lu) with error %d
\n
"
,
outlen
,
(
unsigned
long
)
width
*
lines
,
ret
);
(
unsigned
long
)
width
*
lines
,
ret
);
av_free
(
src2
);
av_free
(
zbuf
);
av_free
(
zbuf
);
return
AVERROR_UNKNOWN
;
return
AVERROR_UNKNOWN
;
}
}
...
@@ -461,21 +466,15 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
...
@@ -461,21 +466,15 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
dst
+=
stride
;
dst
+=
stride
;
src
+=
width
;
src
+=
width
;
}
}
av_free
(
src2
);
av_free
(
zbuf
);
av_free
(
zbuf
);
return
0
;
return
0
;
}
}
#endif
#endif
if
(
s
->
compr
==
TIFF_LZW
)
{
if
(
s
->
compr
==
TIFF_LZW
)
{
if
(
s
->
fill_order
)
{
if
(
s
->
fill_order
)
{
int
i
;
if
((
ret
=
deinvert_buffer
(
s
,
src
,
size
))
<
0
)
av_fast_padded_malloc
(
&
s
->
deinvert_buf
,
&
s
->
deinvert_buf_size
,
size
);
return
ret
;
if
(
!
s
->
deinvert_buf
)
ssrc
=
src
=
s
->
deinvert_buf
;
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
size
;
i
++
)
s
->
deinvert_buf
[
i
]
=
ff_reverse
[
src
[
i
]];
src
=
s
->
deinvert_buf
;
ssrc
=
src
;
}
}
if
(
size
>
1
&&
!
src
[
0
]
&&
(
src
[
1
]
&
1
))
{
if
(
size
>
1
&&
!
src
[
0
]
&&
(
src
[
1
]
&
1
))
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Old style LZW is unsupported
\n
"
);
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Old style LZW is unsupported
\n
"
);
...
...
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