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
d7529b03
Commit
d7529b03
authored
Aug 31, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/tiff: set color_trc, remove sRGB conversion
parent
63689b16
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
tiff.c
libavcodec/tiff.c
+8
-10
No files found.
libavcodec/tiff.c
View file @
d7529b03
...
...
@@ -773,16 +773,8 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
return
0
;
}
static
float
av_always_inline
linear_to_srgb
(
float
value
)
{
if
(
value
<=
0
.
003130
8
f
)
return
value
*
12
.
92
f
;
else
return
powf
(
value
*
1
.
055
f
,
1
.
0
f
/
2
.
4
f
)
-
0
.
055
f
;
}
/**
* Map stored raw sensor values into linear reference values (see: DNG Specification - Chapter 5)
* Then convert to sRGB color space.
*/
static
uint16_t
av_always_inline
dng_process_color16
(
uint16_t
value
,
const
uint16_t
*
lut
,
...
...
@@ -800,8 +792,7 @@ static uint16_t av_always_inline dng_process_color16(uint16_t value,
// Color scaling
value_norm
=
(
float
)
value
*
scale_factor
;
// Color space conversion (sRGB)
value
=
av_clip_uint16_c
((
uint16_t
)(
linear_to_srgb
(
value_norm
)
*
0xFFFF
));
value
=
av_clip_uint16_c
(
value_norm
*
65535
);
return
value
;
}
...
...
@@ -1920,6 +1911,13 @@ again:
}
}
if
(
s
->
photometric
==
TIFF_PHOTOMETRIC_LINEAR_RAW
||
s
->
photometric
==
TIFF_PHOTOMETRIC_CFA
)
{
p
->
color_trc
=
AVCOL_TRC_LINEAR
;
}
else
if
(
s
->
photometric
==
TIFF_PHOTOMETRIC_BLACK_IS_ZERO
)
{
p
->
color_trc
=
AVCOL_TRC_GAMMA22
;
}
/* Handle DNG images with JPEG-compressed tiles */
if
(
is_dng
&&
s
->
is_tiled
)
{
...
...
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