message: vertexcodec: Move transpose code to a separate function
diff: @@ -729,25 +729,8 @@ __m128i unzigzag8(__m128i v)
  return _mm_xor_si128(xl, xr);
  }
  -static const unsigned char* decodeVertexBlock(const unsigned char* data, const unsigned char* data_end, unsigned char* vertex_data, size_t vertex_count, size_t vertex_size, const unsigned int* prediction, unsigned char last_vertex[256])
  -{
  - assert(vertex_count > 0 && vertex_count <= kVertexBlockMaxSize);
  - assert(vertex_size % 16 == 0); // TODO
  -
  - unsigned char buffer[kVertexBlockMaxSize * 16];
  - unsigned char transposed[kVertexBlockMaxSize * 16];
  -
  - size_t vertex_count_aligned = (vertex_count + kByteGroupSize - 1) & ~(kByteGroupSize - 1);
  -
  - for (size_t k = 0; k < vertex_size; k += 16)
  - {
  - for (size_t j = 0; j < 16; ++j)
  +static void transposeVertexBlock16(unsigned char* transposed, const unsigned char* buffer, size_t vertex_count_aligned)
  {
  - data = decodeBytes(data, data_end, buffer + j * vertex_count_aligned, vertex_count_aligned);
  - if (!data)
  - return 0;
  - }
  -
  for (size_t j = 0; j < vertex_count_aligned; j += 16)
  {
  __m128i r0 = _mm_loadu_si128(reinterpret_cast<const __m128i*>(buffer + j + 0 * vertex_count_aligned));
  @@ -786,6 +769,28 @@ static const unsigned char* decodeVertexBlock(const unsigned char* data, const u
  _mm_storeu_si128(reinterpret_cast<__m128i*>(transposed + j * 16 + 14 * 16), r14);
  _mm_storeu_si128(reinterpret_cast<__m128i*>(transposed + j * 16 + 15 * 16), r15);
  }
  +}
  +
  +static const unsigned char* decodeVertexBlock(const unsigned char* data, const unsigned char* data_end, unsigned char* vertex_data, size_t vertex_count, size_t vertex_size, const unsigned int* prediction, unsigned char last_vertex[256])
  +{
  + assert(vertex_count > 0 && vertex_count <= kVertexBlockMaxSize);
  + assert(vertex_size % 16 == 0); // TODO
  +
  + unsigned char buffer[kVertexBlockMaxSize * 16];
  + unsigned char transposed[kVertexBlockMaxSize * 16];
  +
  + size_t vertex_count_aligned = (vertex_count + kByteGroupSize - 1) & ~(kByteGroupSize - 1);
  +
  + for (size_t k = 0; k < vertex_size; k += 16)
  + {
  + for (size_t j = 0; j < 16; ++j)
  + {
  + data = decodeBytes(data, data_end, buffer + j * vertex_count_aligned, vertex_count_aligned);
  + if (!data)
  + return 0;
  + }
  +
  + transposeVertexBlock16(transposed, buffer, vertex_count_aligned);
  size_t vertex_offset = k;
  