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
37f4d220
Commit
37f4d220
authored
Apr 23, 2017
by
Martin Vignali
Committed by
Michael Niedermayer
May 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libavcodec/exr : fix piz uncompress on big endian
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
cac8de2d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
exr.c
libavcodec/exr.c
+23
-5
No files found.
libavcodec/exr.c
View file @
37f4d220
...
@@ -45,6 +45,11 @@
...
@@ -45,6 +45,11 @@
#include "avcodec.h"
#include "avcodec.h"
#include "bytestream.h"
#include "bytestream.h"
#if HAVE_BIGENDIAN
#include "bswapdsp.h"
#endif
#include "get_bits.h"
#include "get_bits.h"
#include "internal.h"
#include "internal.h"
#include "mathops.h"
#include "mathops.h"
...
@@ -116,6 +121,10 @@ typedef struct EXRContext {
...
@@ -116,6 +121,10 @@ typedef struct EXRContext {
AVFrame
*
picture
;
AVFrame
*
picture
;
AVCodecContext
*
avctx
;
AVCodecContext
*
avctx
;
#if HAVE_BIGENDIAN
BswapDSPContext
bbdsp
;
#endif
enum
ExrCompr
compression
;
enum
ExrCompr
compression
;
enum
ExrPixelType
pixel_type
;
enum
ExrPixelType
pixel_type
;
int
channel_offsets
[
4
];
// 0 = red, 1 = green, 2 = blue and 3 = alpha
int
channel_offsets
[
4
];
// 0 = red, 1 = green, 2 = blue and 3 = alpha
...
@@ -751,7 +760,8 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
...
@@ -751,7 +760,8 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
uint16_t
maxval
,
min_non_zero
,
max_non_zero
;
uint16_t
maxval
,
min_non_zero
,
max_non_zero
;
uint16_t
*
ptr
;
uint16_t
*
ptr
;
uint16_t
*
tmp
=
(
uint16_t
*
)
td
->
tmp
;
uint16_t
*
tmp
=
(
uint16_t
*
)
td
->
tmp
;
uint8_t
*
out
;
uint16_t
*
out
;
uint16_t
*
in
;
int
ret
,
i
,
j
;
int
ret
,
i
,
j
;
int
pixel_half_size
;
/* 1 for half, 2 for float and uint32 */
int
pixel_half_size
;
/* 1 for half, 2 for float and uint32 */
EXRChannel
*
channel
;
EXRChannel
*
channel
;
...
@@ -803,12 +813,11 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
...
@@ -803,12 +813,11 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
apply_lut
(
td
->
lut
,
tmp
,
dsize
/
sizeof
(
uint16_t
));
apply_lut
(
td
->
lut
,
tmp
,
dsize
/
sizeof
(
uint16_t
));
out
=
td
->
uncompressed_data
;
out
=
(
uint16_t
*
)
td
->
uncompressed_data
;
for
(
i
=
0
;
i
<
td
->
ysize
;
i
++
)
{
for
(
i
=
0
;
i
<
td
->
ysize
;
i
++
)
{
tmp_offset
=
0
;
tmp_offset
=
0
;
for
(
j
=
0
;
j
<
s
->
nb_channels
;
j
++
)
{
for
(
j
=
0
;
j
<
s
->
nb_channels
;
j
++
)
{
uint16_t
*
in
;
channel
=
&
s
->
channels
[
j
];
EXRChannel
*
channel
=
&
s
->
channels
[
j
];
if
(
channel
->
pixel_type
==
EXR_HALF
)
if
(
channel
->
pixel_type
==
EXR_HALF
)
pixel_half_size
=
1
;
pixel_half_size
=
1
;
else
else
...
@@ -816,8 +825,13 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
...
@@ -816,8 +825,13 @@ static int piz_uncompress(EXRContext *s, const uint8_t *src, int ssize,
in
=
tmp
+
tmp_offset
*
td
->
xsize
*
td
->
ysize
+
i
*
td
->
xsize
*
pixel_half_size
;
in
=
tmp
+
tmp_offset
*
td
->
xsize
*
td
->
ysize
+
i
*
td
->
xsize
*
pixel_half_size
;
tmp_offset
+=
pixel_half_size
;
tmp_offset
+=
pixel_half_size
;
#if HAVE_BIGENDIAN
s
->
bbdsp
.
bswap16_buf
(
out
,
in
,
td
->
xsize
*
pixel_half_size
);
#else
memcpy
(
out
,
in
,
td
->
xsize
*
2
*
pixel_half_size
);
memcpy
(
out
,
in
,
td
->
xsize
*
2
*
pixel_half_size
);
out
+=
td
->
xsize
*
2
*
pixel_half_size
;
#endif
out
+=
td
->
xsize
*
pixel_half_size
;
}
}
}
}
...
@@ -1793,6 +1807,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
...
@@ -1793,6 +1807,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
s
->
avctx
=
avctx
;
s
->
avctx
=
avctx
;
#if HAVE_BIGENDIAN
ff_bswapdsp_init
(
&
s
->
bbdsp
);
#endif
trc_func
=
avpriv_get_trc_function_from_trc
(
s
->
apply_trc_type
);
trc_func
=
avpriv_get_trc_function_from_trc
(
s
->
apply_trc_type
);
if
(
trc_func
)
{
if
(
trc_func
)
{
for
(
i
=
0
;
i
<
65536
;
++
i
)
{
for
(
i
=
0
;
i
<
65536
;
++
i
)
{
...
...
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