#include "cpp/quantize/wu.h"
#include <stdlib.h>
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <vector>
#include "cpp/utils/utils.h"
namespace material_color_utilities {
struct Box { … };
enum class Direction { … };
constexpr int kIndexBits = …;
constexpr int kIndexCount = …;
constexpr int kTotalSize = …;
constexpr int kMaxColors = …;
IntArray;
DoubleArray;
int GetIndex(int r, int g, int b) { … }
void ConstructHistogram(const std::vector<Argb>& pixels, IntArray& weights,
IntArray& m_r, IntArray& m_g, IntArray& m_b,
DoubleArray& moments) { … }
void ComputeMoments(IntArray& weights, IntArray& m_r, IntArray& m_g,
IntArray& m_b, DoubleArray& moments) { … }
int64_t Top(const Box& cube, const Direction direction, const int position,
const IntArray& moment) { … }
int64_t Bottom(const Box& cube, const Direction direction,
const IntArray& moment) { … }
int64_t Vol(const Box& cube, const IntArray& moment) { … }
double Variance(const Box& cube, const IntArray& weights, const IntArray& m_r,
const IntArray& m_g, const IntArray& m_b,
const DoubleArray& moments) { … }
double Maximize(const Box& cube, const Direction direction, const int first,
const int last, int* cut, const int64_t whole_w,
const int64_t whole_r, const int64_t whole_g,
const int64_t whole_b, const IntArray& weights,
const IntArray& m_r, const IntArray& m_g, const IntArray& m_b) { … }
bool Cut(Box& box1, Box& box2, const IntArray& weights, const IntArray& m_r,
const IntArray& m_g, const IntArray& m_b) { … }
std::vector<Argb> QuantizeWu(const std::vector<Argb>& pixels,
uint16_t max_colors) { … }
}