summaryrefslogtreecommitdiff
path: root/libavcodec/texturedsp.h
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2022-03-19 20:51:24 +0100
committerMarton Balint <cus@passwd.hu>2022-04-10 20:12:23 +0200
commit541d3755e92da34b69df8c3c08d0d66cc4b05afd (patch)
tree8c7ef4098affff00b3663a5b5131248b9aa93696 /libavcodec/texturedsp.h
parent80e997b0818a36b1b28e39d745c466d01038aa1f (diff)
downloadffmpeg-541d3755e92da34b69df8c3c08d0d66cc4b05afd.tar.gz
avcodec/texturedsp: add TextureDSPThreadContext for common decode/encode function
This will allow using a common threaded decode or encode function from most codecs using texture DSP functions. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavcodec/texturedsp.h')
-rw-r--r--libavcodec/texturedsp.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/libavcodec/texturedsp.h b/libavcodec/texturedsp.h
index 90ceb2b6aa..e15d3c2b02 100644
--- a/libavcodec/texturedsp.h
+++ b/libavcodec/texturedsp.h
@@ -39,6 +39,8 @@
#include <stddef.h>
#include <stdint.h>
+#include "avcodec.h"
+
#define TEXTURE_BLOCK_W 4
#define TEXTURE_BLOCK_H 4
@@ -60,7 +62,28 @@ typedef struct TextureDSPContext {
int (*dxn3dc_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
} TextureDSPContext;
+typedef struct TextureDSPThreadContext {
+ union {
+ const uint8_t *in; // Input frame data
+ uint8_t *out; // Output frame data
+ } frame_data;
+ ptrdiff_t stride; // Frame linesize
+ union {
+ const uint8_t *in; // Compressed texture for decompression
+ uint8_t *out; // Compressed texture of compression
+ } tex_data;
+ int tex_ratio; // Number of compressed bytes in a texture block
+ int raw_ratio; // Number bytes in a line of a raw block
+ int slice_count; // Number of slices for threaded operations
+
+ /* Pointer to the selected compress or decompress function. */
+ int (*tex_funct)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
+} TextureDSPThreadContext;
+
void ff_texturedsp_init(TextureDSPContext *c);
void ff_texturedspenc_init(TextureDSPContext *c);
+int ff_texturedsp_decompress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);
+int ff_texturedsp_compress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);
+
#endif /* AVCODEC_TEXTUREDSP_H */