Skip to content

Commit

Permalink
Another fix for raw black & white level >= 0
Browse files Browse the repository at this point in the history
  • Loading branch information
masc4ii committed Oct 27, 2019
1 parent 89d80a7 commit 29d6984
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/processing/raw_processing.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,9 +1489,12 @@ void processingSetBlackAndWhiteLevel( processingObject_t * processing,
{
/* Convert levels to 16bit */
int bits_shift = 16 - mlvBitDepth;
if(mlvBlackLevel) processing->black_level = mlvBlackLevel << bits_shift;
else processing->black_level = 0;
if(mlvWhiteLevel)
if( mlvBlackLevel >= 0 )
{
if(mlvBlackLevel) processing->black_level = mlvBlackLevel << bits_shift;
else processing->black_level = 0;
}
if( mlvWhiteLevel >= 0 )
{
processing->white_level = mlvWhiteLevel << bits_shift;
/* Lowering white level a bit avoids pink grain in highlihgt reconstruction */
Expand Down Expand Up @@ -1526,13 +1529,13 @@ void processingSetBlackLevel(processingObject_t * processing, int mlvBlackLevel,
{
processingSetBlackAndWhiteLevel( processing,
mlvBlackLevel,
0, // if zero leave value untouched
-1, // if -1 leave value untouched
mlvBitDepth );
}
void processingSetWhiteLevel(processingObject_t * processing, int mlvWhiteLevel, int mlvBitDepth)
{
processingSetBlackAndWhiteLevel( processing,
0, // if zero leave value untouched
-1, // if -1 leave value untouched
mlvWhiteLevel,
mlvBitDepth );
}
Expand Down

0 comments on commit 29d6984

Please sign in to comment.