mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-01-12 00:06:51 +08:00
avcodec/{png,mov}enc: use EOTF gamma approximation for gAMA chunk
This is how images encoded with specific transfer function should be viewed. Image viewers that doesn't support named trc metadata, will fallback to simple gAMA value and both of those cases should produce the same image apperance for the viewer. Fixes: https://github.com/mpv-player/mpv/issues/13438 Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This commit is contained in:
@@ -323,7 +323,7 @@ static int png_get_chrm(enum AVColorPrimaries prim, uint8_t *buf)
|
||||
|
||||
static int png_get_gama(enum AVColorTransferCharacteristic trc, uint8_t *buf)
|
||||
{
|
||||
double gamma = av_csp_approximate_trc_gamma(trc);
|
||||
double gamma = av_csp_approximate_eotf_gamma(trc);
|
||||
if (gamma <= 1e-6)
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -2523,7 +2523,7 @@ static int mov_write_gama_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *tra
|
||||
{
|
||||
uint32_t gama = 0;
|
||||
if (gamma <= 0.0)
|
||||
gamma = av_csp_approximate_trc_gamma(track->par->color_trc);
|
||||
gamma = av_csp_approximate_eotf_gamma(track->par->color_trc);
|
||||
av_log(s, AV_LOG_DEBUG, "gamma value %g\n", gamma);
|
||||
|
||||
if (gamma > 1e-6) {
|
||||
|
||||
Reference in New Issue
Block a user