tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

enc_photon_noise_test.cc (1516B)


      1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file.
      5 
      6 #include "lib/jxl/enc_photon_noise.h"
      7 
      8 #include "lib/jxl/noise.h"
      9 #include "lib/jxl/testing.h"
     10 
     11 namespace jxl {
     12 namespace {
     13 
     14 TEST(EncPhotonNoiseTest, LUTs) {
     15  const double kTolerance = 1e-6;
     16  EXPECT_ARRAY_NEAR(
     17      SimulatePhotonNoise(/*xsize=*/6000, /*ysize=*/4000, /*iso=*/100).lut,
     18      (NoiseParams::Lut{0.00259652, 0.0139648, 0.00681551, 0.00632582,
     19                        0.00694917, 0.00803922, 0.00934574, 0.0107607}),
     20      kTolerance);
     21  EXPECT_ARRAY_NEAR(
     22      SimulatePhotonNoise(/*xsize=*/6000, /*ysize=*/4000, /*iso=*/800).lut,
     23      (NoiseParams::Lut{0.02077220, 0.0420923, 0.01820690, 0.01439020,
     24                        0.01293670, 0.01254030, 0.01277390, 0.0134161}),
     25      kTolerance);
     26  EXPECT_ARRAY_NEAR(
     27      SimulatePhotonNoise(/*xsize=*/6000, /*ysize=*/4000, /*iso=*/6400).lut,
     28      (NoiseParams::Lut{0.1661770, 0.1691120, 0.05309080, 0.03963960,
     29                        0.03357410, 0.03001650, 0.02776740, 0.0263478}),
     30      kTolerance);
     31 
     32  // Lower when measured on a per-pixel basis as there are fewer of them.
     33  EXPECT_ARRAY_NEAR(
     34      SimulatePhotonNoise(/*xsize=*/4000, /*ysize=*/3000, /*iso=*/6400).lut,
     35      (NoiseParams::Lut{0.0830886, 0.1008720, 0.0367748, 0.0280305, 0.0240236,
     36                        0.0218040, 0.0205771, 0.0200058}),
     37      kTolerance);
     38 }
     39 
     40 }  // namespace
     41 }  // namespace jxl