docs: private static void smoothBlocks(List< Block > blocks) {
  
          for (int i = 0; i < blocks.size(); i++) {
              Block block = blocks.get(i);
              EncodingMode last = (i > 0 ? blocks.get(i - 1).mode : EncodingMode.FALSE);
              EncodingMode next = (i < blocks.size() - 1 ? blocks.get(i + 1).mode : EncodingMode.FALSE);
              if (block.mode == EncodingMode.NUM) {
                  if (i == 0) { /* first block */
                      if (next == EncodingMode.TEX && block.length < 8) {
                          block.mode = EncodingMode.TEX;
                      } else if (next == EncodingMode.BYT && block.length == 1) {
                          block.mode = EncodingMode.BYT;
                      }
                  } else if (i == blocks.size() - 1) { /* last block */
                      if (last == EncodingMode.TEX && block.length < 7) {
                          block.mode = EncodingMode.TEX;
                      } else if (last == EncodingMode.BYT && block.length == 1) {
                          block.mode = EncodingMode.BYT;
                      }
                  } else { /* not first or last block */
                      if (last == EncodingMode.BYT && next == EncodingMode.BYT && block.length < 4) {
                          block.mode = EncodingMode.BYT;
                      } else if (last == EncodingMode.BYT && next == EncodingMode.TEX && block.length < 4) {
                          block.mode = EncodingMode.TEX;
                      } else if (last == EncodingMode.TEX && next == EncodingMode.BYT && block.length < 5) {
                          block.mode = EncodingMode.TEX;
                      } else if (last == EncodingMode.TEX && next == EncodingMode.TEX && block.length < 8) {
                          block.mode = EncodingMode.TEX;
                      } else if (last == EncodingMode.NUM && next == EncodingMode.TEX && block.length < 8) {
                          block.mode = EncodingMode.TEX;
                      }
                  }
              }
          }
  
          mergeBlocks(blocks);
  
          for (int i = 0; i < blocks.size(); i++) {
              Block block = blocks.get(i);
              EncodingMode last = (i > 0 ? blocks.get(i - 1).mode : EncodingMode.FALSE);
              EncodingMode next = (i < blocks.size() - 1 ? blocks.get(i + 1).mode : EncodingMode.FALSE);
              if (block.mode == EncodingMode.TEX && i > 0) { /* not the first */
                  if (i == blocks.size() - 1) { /* the last one */
                      if (last == EncodingMode.BYT && block.length == 1) {
                          block.mode = EncodingMode.BYT;
                      }
                  } else { /* not the last one */
                      if (last == EncodingMode.BYT && next == EncodingMode.BYT && block.length < 5) {
                          block.mode = EncodingMode.BYT;
                      }
                      if (((last == EncodingMode.BYT && next != EncodingMode.BYT) ||
                           (last != EncodingMode.BYT && next == EncodingMode.BYT)) && (block.length < 3)) {
                          block.mode = EncodingMode.BYT;
                      }
                  }
              }
          }
  
          mergeBlocks(blocks);
      }