5 namespace tdc {
namespace esp {
11 return a.
len == 1 || b.
len == 1;
21 }
else if (a.
len + b.
len == 3) {
27 }
else if (a.
len + b.
len == 4) {
34 DCHECK(
false) <<
"should never happen";
40 if (blocks.size() < 2)
return;
42 auto adjust2 = [&](
auto f) {
44 auto read_it = blocks.begin();
45 auto write_it = blocks.begin();
48 while ((!queue.
full()) && (read_it != blocks.end())) {
55 while(queue.
view().size() > 0) {
72 size_t diff = read_it - write_it;
73 for (
size_t i = 0; i < diff; i++) {
78 adjust2([](
auto& vec) {
88 if (!has_one)
return false;
94 if (
needs_merge(a, b) && a.type == 2 && b.type == 2) {
95 if (
merge(a, b, 2) == 1) {
105 if (
needs_merge(a, b) && a.type == 2 && b.type == 2) {
106 if (
merge(a, b, 2) == 1) {
112 if (
merge(a, b, 3) == 1) {
117 if (
needs_merge(a, b) && (a.type == 1 || b.type == 1)) {
118 if (
merge(a, b, 1) == 1) {
126 if (v.size() > 0 && v[0].len > 1) {
130 DCHECK(
false) <<
"should not be reached";
Contains the text compression and encoding framework.
bool needs_merge(const TypedBlock &a)
void adjust_blocks(std::vector< TypedBlock > &blocks)
size_t merge(TypedBlock &a, TypedBlock &b, size_t type)