libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

loop_filter.h (2121B)


      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_LOOP_FILTER_H_
      7 #define LIB_JXL_LOOP_FILTER_H_
      8 
      9 // Parameters for loop filter(s), stored in each frame.
     10 
     11 #include <stddef.h>
     12 #include <stdint.h>
     13 
     14 #include "lib/jxl/base/compiler_specific.h"
     15 #include "lib/jxl/base/status.h"
     16 #include "lib/jxl/dec_bit_reader.h"
     17 #include "lib/jxl/field_encodings.h"
     18 
     19 namespace jxl {
     20 
     21 struct LoopFilter : public Fields {
     22   LoopFilter();
     23   JXL_FIELDS_NAME(LoopFilter)
     24 
     25   Status VisitFields(Visitor* JXL_RESTRICT visitor) override;
     26 
     27   size_t Padding() const {
     28     static const size_t padding_per_epf_iter[4] = {0, 2, 3, 6};
     29     return padding_per_epf_iter[epf_iters] + (gab ? 1 : 0);
     30   }
     31 
     32   mutable bool all_default;
     33 
     34   // --- Gaborish convolution
     35   bool gab;
     36 
     37   bool gab_custom;
     38   float gab_x_weight1;
     39   float gab_x_weight2;
     40   float gab_y_weight1;
     41   float gab_y_weight2;
     42   float gab_b_weight1;
     43   float gab_b_weight2;
     44 
     45   // --- Edge-preserving filter
     46 
     47   // Number of EPF stages to apply. 0 means EPF disabled. 1 applies only the
     48   // first stage, 2 applies both stages and 3 applies the first stage twice and
     49   // the second stage once.
     50   uint32_t epf_iters;
     51 
     52   bool epf_sharp_custom;
     53   enum { kEpfSharpEntries = 8 };
     54   float epf_sharp_lut[kEpfSharpEntries];
     55 
     56   bool epf_weight_custom;      // Custom weight params
     57   float epf_channel_scale[3];  // Relative weight of each channel
     58   float epf_pass1_zeroflush;   // Minimum weight for first pass
     59   float epf_pass2_zeroflush;   // Minimum weight for second pass
     60 
     61   bool epf_sigma_custom;        // Custom sigma parameters
     62   float epf_quant_mul;          // Sigma is ~ this * quant
     63   float epf_pass0_sigma_scale;  // Multiplier for sigma in pass 0
     64   float epf_pass2_sigma_scale;  // Multiplier for sigma in the second pass
     65   float epf_border_sad_mul;     // (inverse) multiplier for sigma on borders
     66 
     67   float epf_sigma_for_modular;
     68 
     69   uint64_t extensions;
     70 
     71   bool nonserialized_is_modular = false;
     72 };
     73 
     74 }  // namespace jxl
     75 
     76 #endif  // LIB_JXL_LOOP_FILTER_H_