Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
4c1aac89
Commit
4c1aac89
authored
May 02, 2017
by
Carl Eugen Hoyos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc/jpeg2000dec: Read the sample aspect ratio from the jp2 resolution box.
parent
dad54e3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
jpeg2000dec.c
libavcodec/jpeg2000dec.c
+33
-0
No files found.
libavcodec/jpeg2000dec.c
View file @
4c1aac89
...
...
@@ -26,6 +26,7 @@
*/
#include <inttypes.h>
#include <math.h>
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
...
...
@@ -106,6 +107,7 @@ typedef struct Jpeg2000DecoderContext {
int
tile_width
,
tile_height
;
unsigned
numXtiles
,
numYtiles
;
int
maxtilelen
;
AVRational
sar
;
Jpeg2000CodingStyle
codsty
[
4
];
Jpeg2000QuantStyle
qntsty
[
4
];
...
...
@@ -2058,6 +2060,34 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s)
if
(
cn
<
4
&&
asoc
<
4
)
s
->
cdef
[
cn
]
=
asoc
;
}
}
else
if
(
atom2
==
MKBETAG
(
'r'
,
'e'
,
's'
,
' '
)
&&
atom2_size
>=
18
)
{
int64_t
vnum
,
vden
,
hnum
,
hden
,
vexp
,
hexp
;
uint32_t
resx
;
bytestream2_skip
(
&
s
->
g
,
4
);
resx
=
bytestream2_get_be32u
(
&
s
->
g
);
if
(
resx
!=
MKBETAG
(
'r'
,
'e'
,
's'
,
'c'
)
&&
resx
!=
MKBETAG
(
'r'
,
'e'
,
's'
,
'd'
))
{
bytestream2_seek
(
&
s
->
g
,
atom2_end
,
SEEK_SET
);
continue
;
}
vnum
=
bytestream2_get_be16u
(
&
s
->
g
);
vden
=
bytestream2_get_be16u
(
&
s
->
g
);
hnum
=
bytestream2_get_be16u
(
&
s
->
g
);
hden
=
bytestream2_get_be16u
(
&
s
->
g
);
vexp
=
bytestream2_get_byteu
(
&
s
->
g
);
hexp
=
bytestream2_get_byteu
(
&
s
->
g
);
if
(
vexp
>
hexp
)
{
vexp
-=
hexp
;
hexp
=
0
;
}
else
{
hexp
-=
vexp
;
vexp
=
0
;
}
if
(
INT64_MAX
/
(
hnum
*
vden
)
>
pow
(
10
,
hexp
)
&&
INT64_MAX
/
(
vnum
*
hden
)
>
pow
(
10
,
vexp
))
av_reduce
(
&
s
->
sar
.
den
,
&
s
->
sar
.
num
,
hnum
*
vden
*
pow
(
10
,
hexp
),
vnum
*
hden
*
pow
(
10
,
vexp
),
INT32_MAX
);
}
bytestream2_seek
(
&
s
->
g
,
atom2_end
,
SEEK_SET
);
}
while
(
atom_end
-
atom2_end
>=
8
);
...
...
@@ -2140,6 +2170,9 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
if
(
s
->
avctx
->
pix_fmt
==
AV_PIX_FMT_PAL8
)
memcpy
(
picture
->
data
[
1
],
s
->
palette
,
256
*
sizeof
(
uint32_t
));
if
(
s
->
sar
.
num
&&
s
->
sar
.
den
)
avctx
->
sample_aspect_ratio
=
s
->
sar
;
s
->
sar
.
num
=
s
->
sar
.
den
=
0
;
return
bytestream2_tell
(
&
s
->
g
);
...
...
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