diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-05-25 00:56:03 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-05-25 21:35:12 +0200 |
| commit | 1f30ea2ec7548ccbc639370b2ed0347bef05015b (patch) | |
| tree | 80a54d0c466c525e0221ead9f88b3c0b81da3816 /src/lib/image.cc | |
| parent | 71f3520ea315fb65ff151c99aa0b64fc8dccdb1d (diff) | |
Add video_to_full_range implementation for RGB48LE.
Diffstat (limited to 'src/lib/image.cc')
| -rw-r--r-- | src/lib/image.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc index eff53a2aa..5b926d77c 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -1440,6 +1440,22 @@ Image::video_range_to_full_range () } break; } + case AV_PIX_FMT_RGB48LE: + { + float const factor = 65536.0 / 56064.0; + uint16_t* p = reinterpret_cast<uint16_t*>(data()[0]); + int const lines = sample_size(0).height; + for (int y = 0; y < lines; ++y) { + uint16_t* q = p; + int const line_size_pixels = line_size()[0] / 2; + for (int x = 0; x < line_size_pixels; ++x) { + *q = clamp(lrintf((*q - 4096) * factor), 0L, 65535L); + ++q; + } + p += stride()[0] / 2; + } + break; + } case AV_PIX_FMT_GBRP12LE: { float const factor = 4096.0 / 3504.0; |
