tonemap/colortemp

This commit is contained in:
Brooke Vibber 2024-05-27 08:44:17 -07:00
parent 7ccc3bd282
commit fbde3670d7

View file

@ -36,6 +36,8 @@ $options = [
'crop-height' => false,
'crop-left' => false,
'crop-top' => false,
'tonemap' => 'hable',
'colortemperature' => false,
];
while ( count( $args ) > 0 && substr( $args[0], 0, 2 ) == '--' ) {
@ -66,7 +68,8 @@ if ( count ( $args ) < 2 ) {
" --dither enable dithering in 8-bit downconversion\n" .
" --width=n override frame width in pixels\n" .
" --height=n override frame height in pixels\n" .
" --keyframe-int=n set keyframe interval (default 0)\n"
" --keyframe-int=n set keyframe interval (default 0)\n" .
" --tonemap=mode set HDR tone mapping mode (hable, clip, etc)\n"
);
}
[ $src, $dest ] = $args;
@ -325,6 +328,7 @@ function convert( $src, $dest, $options ) {
$sdrNits = 80;
$peak = $peakNits / $sdrNits;
$vibrance = floatval( $options['vibrance'] );
$tonemap = $options['tonemap'];
$filters = [];
if ( $options['crop-width'] || $options['crop-height'] ) {
@ -336,7 +340,11 @@ function convert( $src, $dest, $options ) {
if ( $exposure ) {
$filters[] = "exposure=$exposure";
}
$filters[] = "tonemap=hable:peak=$peak:desat=0.0";
$colortemperature = $options['colortemperature'];
if ( $colortemperature ) {
$filters[] = "colortemperature=$colortemperature";
}
$filters[] = "tonemap=$tonemap:peak=$peak:desat=0.0";
if ( $options['dither'] ) {
$dither = ":dither=ordered";
} else {