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
993a5afa
Commit
993a5afa
authored
Apr 07, 2014
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read aspect ratio from tiff image files.
parent
845414bb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
tiff.c
libavcodec/tiff.c
+20
-1
exif-image-tiff
tests/ref/fate/exif-image-tiff
+1
-1
No files found.
libavcodec/tiff.c
View file @
993a5afa
...
@@ -58,6 +58,7 @@ typedef struct TiffContext {
...
@@ -58,6 +58,7 @@ typedef struct TiffContext {
int
fax_opts
;
int
fax_opts
;
int
predictor
;
int
predictor
;
int
fill_order
;
int
fill_order
;
uint32_t
res
[
4
];
int
strips
,
rps
,
sstype
;
int
strips
,
rps
,
sstype
;
int
sot
;
int
sot
;
...
@@ -566,9 +567,19 @@ static int init_image(TiffContext *s, ThreadFrame *frame)
...
@@ -566,9 +567,19 @@ static int init_image(TiffContext *s, ThreadFrame *frame)
return
0
;
return
0
;
}
}
static
void
set_sar
(
TiffContext
*
s
,
unsigned
tag
,
unsigned
num
,
unsigned
den
)
{
int
offset
=
tag
==
TIFF_YRES
?
2
:
0
;
s
->
res
[
offset
++
]
=
num
;
s
->
res
[
offset
]
=
den
;
if
(
s
->
res
[
0
]
&&
s
->
res
[
1
]
&&
s
->
res
[
2
]
&&
s
->
res
[
3
])
av_reduce
(
&
s
->
avctx
->
sample_aspect_ratio
.
num
,
&
s
->
avctx
->
sample_aspect_ratio
.
den
,
s
->
res
[
2
]
*
(
uint64_t
)
s
->
res
[
1
],
s
->
res
[
0
]
*
(
uint64_t
)
s
->
res
[
3
],
INT32_MAX
);
}
static
int
tiff_decode_tag
(
TiffContext
*
s
,
AVFrame
*
frame
)
static
int
tiff_decode_tag
(
TiffContext
*
s
,
AVFrame
*
frame
)
{
{
unsigned
tag
,
type
,
count
,
off
,
value
=
0
;
unsigned
tag
,
type
,
count
,
off
,
value
=
0
,
value2
=
0
;
int
i
,
j
,
k
,
pos
,
start
;
int
i
,
j
,
k
,
pos
,
start
;
int
ret
;
int
ret
;
uint32_t
*
pal
;
uint32_t
*
pal
;
...
@@ -587,6 +598,10 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
...
@@ -587,6 +598,10 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
case
TIFF_LONG
:
case
TIFF_LONG
:
value
=
ff_tget
(
&
s
->
gb
,
type
,
s
->
le
);
value
=
ff_tget
(
&
s
->
gb
,
type
,
s
->
le
);
break
;
break
;
case
TIFF_RATIONAL
:
value
=
ff_tget
(
&
s
->
gb
,
TIFF_LONG
,
s
->
le
);
value2
=
ff_tget
(
&
s
->
gb
,
TIFF_LONG
,
s
->
le
);
break
;
case
TIFF_STRING
:
case
TIFF_STRING
:
if
(
count
<=
4
)
{
if
(
count
<=
4
)
{
break
;
break
;
...
@@ -717,6 +732,10 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
...
@@ -717,6 +732,10 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
break
;
break
;
case
TIFF_XRES
:
case
TIFF_YRES
:
set_sar
(
s
,
tag
,
value
,
value2
);
break
;
case
TIFF_TILE_BYTE_COUNTS
:
case
TIFF_TILE_BYTE_COUNTS
:
case
TIFF_TILE_LENGTH
:
case
TIFF_TILE_LENGTH
:
case
TIFF_TILE_OFFSETS
:
case
TIFF_TILE_OFFSETS
:
...
...
tests/ref/fate/exif-image-tiff
View file @
993a5afa
...
@@ -14,7 +14,7 @@ pkt_size=67604
...
@@ -14,7 +14,7 @@ pkt_size=67604
width=200
width=200
height=112
height=112
pix_fmt=rgb24
pix_fmt=rgb24
sample_aspect_ratio=
N/A
sample_aspect_ratio=
1:1
pict_type=?
pict_type=?
coded_picture_number=0
coded_picture_number=0
display_picture_number=0
display_picture_number=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