+static inline void transpose_block_8_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize,
+ int w, int h)
+{
+ int x, y;
+ for (y = 0; y < h; y++, dst += dst_linesize, src++)
+ for (x = 0; x < w; x++)
+ dst[x] = src[x*src_linesize];
+}
+
+static void transpose_8x8_8_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize)
+{
+ transpose_block_8_c(src, src_linesize, dst, dst_linesize, 8, 8);
+}
+
+static inline void transpose_block_16_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize,
+ int w, int h)
+{
+ int x, y;
+ for (y = 0; y < h; y++, dst += dst_linesize, src += 2)
+ for (x = 0; x < w; x++)
+ *((uint16_t *)(dst + 2*x)) = *((uint16_t *)(src + x*src_linesize));
+}
+
+static void transpose_8x8_16_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize)
+{
+ transpose_block_16_c(src, src_linesize, dst, dst_linesize, 8, 8);
+}
+
+static inline void transpose_block_24_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize,
+ int w, int h)
+{
+ int x, y;
+ for (y = 0; y < h; y++, dst += dst_linesize) {
+ for (x = 0; x < w; x++) {
+ int32_t v = AV_RB24(src + x*src_linesize + y*3);
+ AV_WB24(dst + 3*x, v);
+ }
+ }
+}
+
+static void transpose_8x8_24_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize)
+{
+ transpose_block_24_c(src, src_linesize, dst, dst_linesize, 8, 8);
+}
+
+static inline void transpose_block_32_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize,
+ int w, int h)
+{
+ int x, y;
+ for (y = 0; y < h; y++, dst += dst_linesize, src += 4) {
+ for (x = 0; x < w; x++)
+ *((uint32_t *)(dst + 4*x)) = *((uint32_t *)(src + x*src_linesize));
+ }
+}
+
+static void transpose_8x8_32_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize)
+{
+ transpose_block_32_c(src, src_linesize, dst, dst_linesize, 8, 8);
+}
+
+static inline void transpose_block_48_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize,
+ int w, int h)
+{
+ int x, y;
+ for (y = 0; y < h; y++, dst += dst_linesize, src += 6) {
+ for (x = 0; x < w; x++) {
+ int64_t v = AV_RB48(src + x*src_linesize);
+ AV_WB48(dst + 6*x, v);
+ }
+ }
+}
+
+static void transpose_8x8_48_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize)
+{
+ transpose_block_48_c(src, src_linesize, dst, dst_linesize, 8, 8);
+}
+
+static inline void transpose_block_64_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize,
+ int w, int h)
+{
+ int x, y;
+ for (y = 0; y < h; y++, dst += dst_linesize, src += 8)
+ for (x = 0; x < w; x++)
+ *((uint64_t *)(dst + 8*x)) = *((uint64_t *)(src + x*src_linesize));
+}
+
+static void transpose_8x8_64_c(uint8_t *src, ptrdiff_t src_linesize,
+ uint8_t *dst, ptrdiff_t dst_linesize)
+{
+ transpose_block_64_c(src, src_linesize, dst, dst_linesize, 8, 8);
+}
+