chromium/third_party/brotli/enc/block_splitter.c

/* Copyright 2013 Google Inc. All Rights Reserved.

   Distributed under MIT license.
   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/

/* Block split point selection utilities. */

#include "block_splitter.h"

#include <string.h>  /* memcpy, memset */

#include "../common/platform.h"
#include "bit_cost.h"
#include "cluster.h"
#include "command.h"
#include "fast_log.h"
#include "histogram.h"
#include "memory.h"
#include "quality.h"

#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif

static const size_t kMaxLiteralHistograms =;
static const size_t kMaxCommandHistograms =;
static const double kLiteralBlockSwitchCost =;
static const double kCommandBlockSwitchCost =;
static const double kDistanceBlockSwitchCost =;
static const size_t kLiteralStrideLength =;
static const size_t kCommandStrideLength =;
static const size_t kDistanceStrideLength =;
static const size_t kSymbolsPerLiteralHistogram =;
static const size_t kSymbolsPerCommandHistogram =;
static const size_t kSymbolsPerDistanceHistogram =;
static const size_t kMinLengthForBlockSplitting =;
static const size_t kIterMulForRefining =;
static const size_t kMinItersForRefining =;

static size_t CountLiterals(const Command* cmds, const size_t num_commands) {}

static void CopyLiteralsToByteArray(const Command* cmds,
                                    const size_t num_commands,
                                    const uint8_t* data,
                                    const size_t offset,
                                    const size_t mask,
                                    uint8_t* literals) {}

static BROTLI_INLINE uint32_t MyRand(uint32_t* seed) {}

static BROTLI_INLINE double BitCost(size_t count) {}

#define HISTOGRAMS_PER_BATCH
#define CLUSTERS_PER_BATCH

#define FN
#define DataType
/* NOLINTNEXTLINE(build/include) */
#include "block_splitter_inc.h"
#undef DataType
#undef FN

#define FN
#define DataType
/* NOLINTNEXTLINE(build/include) */
#include "block_splitter_inc.h"
#undef FN

#define FN
/* NOLINTNEXTLINE(build/include) */
#include "block_splitter_inc.h"
#undef DataType
#undef FN

void BrotliInitBlockSplit(BlockSplit* self) {}

void BrotliDestroyBlockSplit(MemoryManager* m, BlockSplit* self) {}

/* Extracts literals, command distance and prefix codes, then applies
 * SplitByteVector to create partitioning. */
void BrotliSplitBlock(MemoryManager* m,
                      const Command* cmds,
                      const size_t num_commands,
                      const uint8_t* data,
                      const size_t pos,
                      const size_t mask,
                      const BrotliEncoderParams* params,
                      BlockSplit* literal_split,
                      BlockSplit* insert_and_copy_split,
                      BlockSplit* dist_split) {}

#if defined(BROTLI_TEST)
size_t CountLiteralsForTest(const Command*, const size_t);
size_t CountLiteralsForTest(const Command* cmds, const size_t num_commands) {
  return CountLiterals(cmds, num_commands);
}

void CopyLiteralsToByteArrayForTest(const Command*,
    const size_t, const uint8_t*, const size_t, const size_t, uint8_t*);
void CopyLiteralsToByteArrayForTest(const Command* cmds,
    const size_t num_commands, const uint8_t* data, const size_t offset,
    const size_t mask, uint8_t* literals) {
  CopyLiteralsToByteArray(cmds, num_commands, data, offset, mask, literals);
}
#endif

#if defined(__cplusplus) || defined(c_plusplus)
}  /* extern "C" */
#endif