libjxl

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

chroma_from_luma.cc (954B)


      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/chroma_from_luma.h"
      7 
      8 #include "lib/jxl/image_ops.h"
      9 
     10 namespace jxl {
     11 
     12 StatusOr<ColorCorrelationMap> ColorCorrelationMap::Create(size_t xsize,
     13                                                           size_t ysize,
     14                                                           bool XYB) {
     15   ColorCorrelationMap result;
     16   size_t xblocks = DivCeil(xsize, kColorTileDim);
     17   size_t yblocks = DivCeil(ysize, kColorTileDim);
     18   JXL_ASSIGN_OR_RETURN(result.ytox_map, ImageSB::Create(xblocks, yblocks));
     19   JXL_ASSIGN_OR_RETURN(result.ytob_map, ImageSB::Create(xblocks, yblocks));
     20   ZeroFillImage(&result.ytox_map);
     21   ZeroFillImage(&result.ytob_map);
     22   if (!XYB) {
     23     result.base_correlation_b_ = 0;
     24   }
     25   result.RecomputeDCFactors();
     26   return result;
     27 }
     28 
     29 }  // namespace jxl