tor-browser

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

enc_butteraugli_comparator.h (1311B)


      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 #ifndef LIB_JXL_ENC_BUTTERAUGLI_COMPARATOR_H_
      7 #define LIB_JXL_ENC_BUTTERAUGLI_COMPARATOR_H_
      8 
      9 #include <jxl/cms_interface.h>
     10 #include <stddef.h>
     11 
     12 #include <memory>
     13 
     14 #include "lib/jxl/base/status.h"
     15 #include "lib/jxl/butteraugli/butteraugli.h"
     16 #include "lib/jxl/enc_comparator.h"
     17 #include "lib/jxl/image.h"
     18 #include "lib/jxl/image_bundle.h"
     19 
     20 namespace jxl {
     21 
     22 class JxlButteraugliComparator : public Comparator {
     23 public:
     24  explicit JxlButteraugliComparator(const ButteraugliParams& params,
     25                                    const JxlCmsInterface& cms);
     26 
     27  Status SetReferenceImage(const ImageBundle& ref) override;
     28  Status SetLinearReferenceImage(const Image3F& linear);
     29 
     30  Status CompareWith(const ImageBundle& actual, ImageF* diffmap,
     31                     float* score) override;
     32 
     33  float GoodQualityScore() const override;
     34  float BadQualityScore() const override;
     35 
     36 private:
     37  ButteraugliParams params_;
     38  JxlCmsInterface cms_;
     39  std::unique_ptr<ButteraugliComparator> comparator_;
     40  size_t xsize_ = 0;
     41  size_t ysize_ = 0;
     42  float intensity_target_ = 0.f;
     43 };
     44 
     45 }  // namespace jxl
     46 
     47 #endif  // LIB_JXL_ENC_BUTTERAUGLI_COMPARATOR_H_