libjxl

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

enc_ar_control_field.h (1572B)


      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_AR_CONTROL_FIELD_H_
      7 #define LIB_JXL_ENC_AR_CONTROL_FIELD_H_
      8 
      9 #include <stddef.h>
     10 
     11 #include <vector>
     12 
     13 #include "lib/jxl/ac_strategy.h"
     14 #include "lib/jxl/enc_params.h"
     15 #include "lib/jxl/frame_header.h"
     16 #include "lib/jxl/image.h"
     17 
     18 namespace jxl {
     19 
     20 struct PassesEncoderState;
     21 
     22 struct ArControlFieldHeuristics {
     23   struct TempImages {
     24     Status InitOnce() {
     25       if (laplacian_sqrsum.xsize() != 0) return true;
     26       JXL_ASSIGN_OR_RETURN(laplacian_sqrsum,
     27                            ImageF::Create(kEncTileDim + 4, kEncTileDim + 4));
     28       JXL_ASSIGN_OR_RETURN(sqrsum_00,
     29                            ImageF::Create(kEncTileDim / 4, kEncTileDim / 4));
     30       JXL_ASSIGN_OR_RETURN(
     31           sqrsum_22, ImageF::Create(kEncTileDim / 4 + 1, kEncTileDim / 4 + 1));
     32       return true;
     33     }
     34 
     35     ImageF laplacian_sqrsum;
     36     ImageF sqrsum_00;
     37     ImageF sqrsum_22;
     38   };
     39 
     40   void PrepareForThreads(size_t num_threads) {
     41     temp_images.resize(num_threads);
     42   }
     43 
     44   Status RunRect(const CompressParams& cparams, const FrameHeader& frame_header,
     45                  const Rect& block_rect, const Image3F& opsin,
     46                  const Rect& opsin_rect, const ImageF& quant_field,
     47                  const AcStrategyImage& ac_strategy, ImageB* epf_sharpness,
     48                  size_t thread);
     49 
     50   std::vector<TempImages> temp_images;
     51 };
     52 
     53 }  // namespace jxl
     54 
     55 #endif  // LIB_JXL_AR_ENC_CONTROL_FIELD_H_