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_NOISE_H_
7 #define LIB_JXL_ENC_NOISE_H_
8 
9 // Noise parameter estimation.
10 
11 #include <stddef.h>
12 
13 #include "lib/jxl/aux_out_fwd.h"
14 #include "lib/jxl/base/status.h"
15 #include "lib/jxl/enc_bit_writer.h"
16 #include "lib/jxl/image.h"
17 #include "lib/jxl/noise.h"
18 
19 namespace jxl {
20 
21 // Get parameters of the noise for NoiseParams model
22 // Returns whether a valid noise model (with HasAny()) is set.
23 Status GetNoiseParameter(const Image3F& opsin, NoiseParams* noise_params,
24                          float quality_coef);
25 
26 // Does not write anything if `noise_params` are empty. Otherwise, caller must
27 // set FrameHeader.flags.kNoise.
28 void EncodeNoise(const NoiseParams& noise_params, BitWriter* writer,
29                  size_t layer, AuxOut* aux_out);
30 
31 }  // namespace jxl
32 
33 #endif  // LIB_JXL_ENC_NOISE_H_
34