summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2017-09-28 21:37:46 +0200
committerTom Butterworth <bangnoise@gmail.com>2017-10-16 15:34:14 +0100
commit50a20de6b9edd1d893fe0ea652ccf796dd9850fb (patch)
tree5f46dbbe0cff7f84975c7f45f4ed37805dc8c533
parentd4d4629dfe727d4c890fc7a19eb7e22eb155fce8 (diff)
libavcodec/texturedspenc : add rgtc1_u_alpha encoding func
this func encode the alpha channel of the rgba input to an rgtc1u block Signed-off-by: Tom Butterworth <bangnoise@gmail.com>
-rw-r--r--libavcodec/texturedspenc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libavcodec/texturedspenc.c b/libavcodec/texturedspenc.c
index 8b2863033b..ae2e95e23f 100644
--- a/libavcodec/texturedspenc.c
+++ b/libavcodec/texturedspenc.c
@@ -647,9 +647,26 @@ static int dxt5ys_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
return 16;
}
+/**
+ * Compress one block of RGBA pixels in a RGTC1U texture and store the
+ * resulting bytes in 'dst'. Use the alpha channel of the input image.
+ *
+ * @param dst output buffer.
+ * @param stride scanline in bytes.
+ * @param block block to compress.
+ * @return how much texture data has been written.
+ */
+static int rgtc1u_alpha_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
+{
+ compress_alpha(dst, stride, block);
+
+ return 8;
+}
+
av_cold void ff_texturedspenc_init(TextureDSPContext *c)
{
c->dxt1_block = dxt1_block;
c->dxt5_block = dxt5_block;
c->dxt5ys_block = dxt5ys_block;
+ c->rgtc1u_alpha_block = rgtc1u_alpha_block;
}