Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
ffmpeg
Commits
46ce9ded
Commit
46ce9ded
authored
Jun 01, 2013
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tiff: K&R formatting cosmetics
parent
f849a77e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
23 deletions
+27
-23
tiff.c
libavcodec/tiff.c
+24
-20
tiff.h
libavcodec/tiff.h
+3
-3
tiffenc.c
libavcodec/tiffenc.c
+0
-0
No files found.
libavcodec/tiff.c
View file @
46ce9ded
...
@@ -25,19 +25,20 @@
...
@@ -25,19 +25,20 @@
* @author Konstantin Shishkov
* @author Konstantin Shishkov
*/
*/
#include "avcodec.h"
#include "config.h"
#include "config.h"
#if CONFIG_ZLIB
#if CONFIG_ZLIB
#include <zlib.h>
#include <zlib.h>
#endif
#endif
#include "lzw.h"
#include "tiff.h"
#include "faxcompr.h"
#include "internal.h"
#include "mathops.h"
#include "libavutil/attributes.h"
#include "libavutil/attributes.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/imgutils.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "faxcompr.h"
#include "internal.h"
#include "lzw.h"
#include "mathops.h"
#include "tiff.h"
typedef
struct
TiffContext
{
typedef
struct
TiffContext
{
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
...
@@ -78,10 +79,14 @@ static unsigned tget_long(const uint8_t **p, int le)
...
@@ -78,10 +79,14 @@ static unsigned tget_long(const uint8_t **p, int le)
static
unsigned
tget
(
const
uint8_t
**
p
,
int
type
,
int
le
)
static
unsigned
tget
(
const
uint8_t
**
p
,
int
type
,
int
le
)
{
{
switch
(
type
)
{
switch
(
type
)
{
case
TIFF_BYTE
:
return
*
(
*
p
)
++
;
case
TIFF_BYTE
:
case
TIFF_SHORT
:
return
tget_short
(
p
,
le
);
return
*
(
*
p
)
++
;
case
TIFF_LONG
:
return
tget_long
(
p
,
le
);
case
TIFF_SHORT
:
default
:
return
UINT_MAX
;
return
tget_short
(
p
,
le
);
case
TIFF_LONG
:
return
tget_long
(
p
,
le
);
default:
return
UINT_MAX
;
}
}
}
}
...
@@ -151,8 +156,9 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
...
@@ -151,8 +156,9 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
return
ret
;
return
ret
;
}
}
}
}
if
(
s
->
compr
==
TIFF_CCITT_RLE
||
s
->
compr
==
TIFF_G3
if
(
s
->
compr
==
TIFF_CCITT_RLE
||
||
s
->
compr
==
TIFF_G4
)
{
s
->
compr
==
TIFF_G3
||
s
->
compr
==
TIFF_G4
)
{
int
i
,
ret
=
0
;
int
i
,
ret
=
0
;
uint8_t
*
src2
=
av_malloc
((
unsigned
)
size
+
uint8_t
*
src2
=
av_malloc
((
unsigned
)
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
FF_INPUT_BUFFER_PADDING_SIZE
);
...
@@ -206,7 +212,7 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
...
@@ -206,7 +212,7 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
break
;
break
;
case
TIFF_PACKBITS
:
case
TIFF_PACKBITS
:
for
(
pixels
=
0
;
pixels
<
width
;)
{
for
(
pixels
=
0
;
pixels
<
width
;)
{
code
=
(
int8_t
)
*
src
++
;
code
=
(
int8_t
)
*
src
++
;
if
(
code
>=
0
)
{
if
(
code
>=
0
)
{
code
++
;
code
++
;
if
(
pixels
+
code
>
width
)
{
if
(
pixels
+
code
>
width
)
{
...
@@ -339,12 +345,11 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start,
...
@@ -339,12 +345,11 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start,
buf
=
start
+
off
;
buf
=
start
+
off
;
}
}
}
else
{
}
else
{
if
(
count
<=
4
&&
type_sizes
[
type
]
*
count
<=
4
)
{
if
(
count
<=
4
&&
type_sizes
[
type
]
*
count
<=
4
)
buf
-=
4
;
buf
-=
4
;
}
else
{
else
buf
=
start
+
off
;
buf
=
start
+
off
;
}
}
}
if
(
buf
&&
(
buf
<
start
||
buf
>
end_buf
))
{
if
(
buf
&&
(
buf
<
start
||
buf
>
end_buf
))
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
...
@@ -546,12 +551,11 @@ static int decode_frame(AVCodecContext *avctx,
...
@@ -546,12 +551,11 @@ static int decode_frame(AVCodecContext *avctx,
const
uint8_t
*
orig_buf
=
buf
,
*
end_buf
=
buf
+
buf_size
;
const
uint8_t
*
orig_buf
=
buf
,
*
end_buf
=
buf
+
buf_size
;
unsigned
off
;
unsigned
off
;
int
id
,
le
,
ret
;
int
id
,
le
,
ret
;
int
i
,
j
,
entries
;
int
i
,
j
,
entries
,
stride
;
int
stride
;
unsigned
soff
,
ssize
;
unsigned
soff
,
ssize
;
uint8_t
*
dst
;
uint8_t
*
dst
;
//parse image header
//
parse image header
if
(
end_buf
-
buf
<
8
)
if
(
end_buf
-
buf
<
8
)
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
id
=
AV_RL16
(
buf
);
id
=
AV_RL16
(
buf
);
...
@@ -678,6 +682,7 @@ static av_cold int tiff_end(AVCodecContext *avctx)
...
@@ -678,6 +682,7 @@ static av_cold int tiff_end(AVCodecContext *avctx)
AVCodec
ff_tiff_decoder
=
{
AVCodec
ff_tiff_decoder
=
{
.
name
=
"tiff"
,
.
name
=
"tiff"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"TIFF image"
),
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_TIFF
,
.
id
=
AV_CODEC_ID_TIFF
,
.
priv_data_size
=
sizeof
(
TiffContext
),
.
priv_data_size
=
sizeof
(
TiffContext
),
...
@@ -685,5 +690,4 @@ AVCodec ff_tiff_decoder = {
...
@@ -685,5 +690,4 @@ AVCodec ff_tiff_decoder = {
.
close
=
tiff_end
,
.
close
=
tiff_end
,
.
decode
=
decode_frame
,
.
decode
=
decode_frame
,
.
capabilities
=
CODEC_CAP_DR1
,
.
capabilities
=
CODEC_CAP_DR1
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"TIFF image"
),
};
};
libavcodec/tiff.h
View file @
46ce9ded
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
#include <stdint.h>
#include <stdint.h>
/** abridged list of TIFF tags */
/** abridged list of TIFF tags */
enum
TiffTags
{
enum
TiffTags
{
TIFF_SUBFILE
=
0xfe
,
TIFF_SUBFILE
=
0xfe
,
TIFF_WIDTH
=
0x100
,
TIFF_WIDTH
=
0x100
,
TIFF_HEIGHT
,
TIFF_HEIGHT
,
...
@@ -61,7 +61,7 @@ enum TiffTags{
...
@@ -61,7 +61,7 @@ enum TiffTags{
};
};
/** list of TIFF compression types */
/** list of TIFF compression types */
enum
TiffCompr
{
enum
TiffCompr
{
TIFF_RAW
=
1
,
TIFF_RAW
=
1
,
TIFF_CCITT_RLE
,
TIFF_CCITT_RLE
,
TIFF_G3
,
TIFF_G3
,
...
@@ -74,7 +74,7 @@ enum TiffCompr{
...
@@ -74,7 +74,7 @@ enum TiffCompr{
TIFF_DEFLATE
=
0x80B2
TIFF_DEFLATE
=
0x80B2
};
};
enum
TiffTypes
{
enum
TiffTypes
{
TIFF_BYTE
=
1
,
TIFF_BYTE
=
1
,
TIFF_STRING
,
TIFF_STRING
,
TIFF_SHORT
,
TIFF_SHORT
,
...
...
libavcodec/tiffenc.c
View file @
46ce9ded
This diff is collapsed.
Click to expand it.
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