tor-browser

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

enc_coeff_order.h (2212B)


      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_COEFF_ORDER_H_
      7 #define LIB_JXL_ENC_COEFF_ORDER_H_
      8 
      9 #include <cstddef>
     10 #include <cstdint>
     11 #include <utility>
     12 
     13 #include "lib/jxl/base/compiler_specific.h"
     14 #include "lib/jxl/base/rect.h"
     15 #include "lib/jxl/base/status.h"
     16 #include "lib/jxl/coeff_order_fwd.h"
     17 #include "lib/jxl/common.h"
     18 #include "lib/jxl/dct_util.h"
     19 #include "lib/jxl/enc_bit_writer.h"
     20 #include "lib/jxl/frame_dimensions.h"
     21 
     22 namespace jxl {
     23 
     24 struct AuxOut;
     25 class AcStrategyImage;
     26 enum class LayerType : uint8_t;
     27 
     28 // Orders that are actually used in part of image. `rect` is in block units.
     29 // Returns {orders that are used, orders that might be made non-default}.
     30 std::pair<uint32_t, uint32_t> ComputeUsedOrders(
     31    SpeedTier speed, const AcStrategyImage& ac_strategy, const Rect& rect);
     32 
     33 // Modify zig-zag order, so that DCT bands with more zeros go later.
     34 // Order of DCT bands with same number of zeros is untouched, so
     35 // permutation will be cheaper to encode.
     36 Status ComputeCoeffOrder(SpeedTier speed, const ACImage& acs,
     37                         const AcStrategyImage& ac_strategy,
     38                         const FrameDimensions& frame_dim,
     39                         uint32_t& all_used_orders, uint32_t prev_used_acs,
     40                         uint32_t current_used_acs,
     41                         uint32_t current_used_orders,
     42                         coeff_order_t* JXL_RESTRICT order);
     43 
     44 Status EncodeCoeffOrders(uint16_t used_orders,
     45                         const coeff_order_t* JXL_RESTRICT order,
     46                         BitWriter* writer, LayerType layer,
     47                         AuxOut* JXL_RESTRICT aux_out);
     48 
     49 // Encoding/decoding of a single permutation. `size`: number of elements in the
     50 // permutation. `skip`: number of elements to skip from the *beginning* of the
     51 // permutation.
     52 Status EncodePermutation(const coeff_order_t* JXL_RESTRICT order, size_t skip,
     53                         size_t size, BitWriter* writer, LayerType layer,
     54                         AuxOut* aux_out);
     55 
     56 }  // namespace jxl
     57 
     58 #endif  // LIB_JXL_ENC_COEFF_ORDER_H_