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
016c5b06
Commit
016c5b06
authored
Jun 03, 2013
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tiff: refactor fax support in a separate function
parent
10393768
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
32 deletions
+33
-32
tiff.c
libavcodec/tiff.c
+33
-32
No files found.
libavcodec/tiff.c
View file @
016c5b06
...
...
@@ -142,6 +142,38 @@ static int tiff_unpack_zlib(TiffContext *s, uint8_t *dst, int stride,
}
#endif
static
int
tiff_unpack_fax
(
TiffContext
*
s
,
uint8_t
*
dst
,
int
stride
,
const
uint8_t
*
src
,
int
size
,
int
lines
)
{
int
i
,
ret
=
0
;
uint8_t
*
src2
=
av_malloc
((
unsigned
)
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
src2
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Error allocating temporary buffer
\n
"
);
return
AVERROR
(
ENOMEM
);
}
if
(
s
->
fax_opts
&
2
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Uncompressed fax mode is not supported (yet)
\n
"
);
av_free
(
src2
);
return
AVERROR_INVALIDDATA
;
}
if
(
!
s
->
fill_order
)
{
memcpy
(
src2
,
src
,
size
);
}
else
{
for
(
i
=
0
;
i
<
size
;
i
++
)
src2
[
i
]
=
ff_reverse
[
src
[
i
]];
}
memset
(
src2
+
size
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
ret
=
ff_ccitt_unpack
(
s
->
avctx
,
src2
,
size
,
dst
,
lines
,
stride
,
s
->
compr
,
s
->
fax_opts
);
av_free
(
src2
);
return
ret
;
}
static
int
tiff_unpack_strip
(
TiffContext
*
s
,
uint8_t
*
dst
,
int
stride
,
const
uint8_t
*
src
,
int
size
,
int
lines
)
{
...
...
@@ -171,38 +203,7 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
if
(
s
->
compr
==
TIFF_CCITT_RLE
||
s
->
compr
==
TIFF_G3
||
s
->
compr
==
TIFF_G4
)
{
int
i
,
ret
=
0
;
uint8_t
*
src2
=
av_malloc
((
unsigned
)
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
src2
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Error allocating temporary buffer
\n
"
);
return
AVERROR
(
ENOMEM
);
}
if
(
s
->
fax_opts
&
2
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Uncompressed fax mode is not supported (yet)
\n
"
);
av_free
(
src2
);
return
AVERROR_INVALIDDATA
;
}
if
(
!
s
->
fill_order
)
{
memcpy
(
src2
,
src
,
size
);
}
else
{
for
(
i
=
0
;
i
<
size
;
i
++
)
src2
[
i
]
=
ff_reverse
[
src
[
i
]];
}
memset
(
src2
+
size
,
0
,
FF_INPUT_BUFFER_PADDING_SIZE
);
switch
(
s
->
compr
)
{
case
TIFF_CCITT_RLE
:
case
TIFF_G3
:
case
TIFF_G4
:
ret
=
ff_ccitt_unpack
(
s
->
avctx
,
src2
,
size
,
dst
,
lines
,
stride
,
s
->
compr
,
s
->
fax_opts
);
break
;
}
av_free
(
src2
);
return
ret
;
return
tiff_unpack_fax
(
s
,
dst
,
stride
,
src
,
size
,
lines
);
}
for
(
line
=
0
;
line
<
lines
;
line
++
)
{
if
(
src
-
ssrc
>
size
)
{
...
...
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