History

avcodec/texturedsp: Add separate TextureDSPEncContext

ff_texturedspenc_init() doesn't support most of the function types supported for decoding; add a separate context containing only pointers for the actually supported types.

Andreas Rheinhardt committed 2 years ago

Commit a3fc9fb1 parent 8f791305 files · +11 −5Browse files

Showing the changes to libavcodec (5 of 5 files). Show all

Unified · Split

5 files
  1. libavcodec/dxvenc.c +1 −1
  2. libavcodec/hapenc.c +1 −1
  3. libavcodec/texturedsp.h +7 −1
  4. libavcodec/texturedspenc.c +1 −1
  5. libavcodec/vbnenc.c +1 −1
libavcodec/dxvenc.c+1−1
@@ -266,7 +266,7 @@ static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt, · 265 unmodified lines
266static av_cold int dxv_init(AVCodecContext *avctx)266static av_cold int dxv_init(AVCodecContext *avctx)
267{267{
268 DXVEncContext *ctx = avctx->priv_data;268 DXVEncContext *ctx = avctx->priv_data;
269 TextureDSPContext texdsp;269 TextureDSPEncContext texdsp;
270 int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);270 int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
271 271
272 if (ret < 0) {272 if (ret < 0) {
libavcodec/hapenc.c+1−1
@@ -232,7 +232,7 @@ static int hap_encode(AVCodecContext *avctx, AVPacket *pkt, · 231 unmodified lines
232static av_cold int hap_init(AVCodecContext *avctx)232static av_cold int hap_init(AVCodecContext *avctx)
233{233{
234 HapContext *ctx = avctx->priv_data;234 HapContext *ctx = avctx->priv_data;
235 TextureDSPContext dxtc;235 TextureDSPEncContext dxtc;
236 int corrected_chunk_count;236 int corrected_chunk_count;
237 int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);237 int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
238 238
libavcodec/texturedsp.h+7−1
@@ -62,6 +62,12 @@ typedef struct TextureDSPContext { · 61 unmodified lines
62 int (*dxn3dc_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);62 int (*dxn3dc_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
63} TextureDSPContext;63} TextureDSPContext;
64 64
65typedef struct TextureDSPEncContext {
66 int (*dxt1_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
67 int (*dxt5_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
68 int (*dxt5ys_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
69} TextureDSPEncContext;
70
65typedef struct TextureDSPThreadContext {71typedef struct TextureDSPThreadContext {
66 union {72 union {
67 const uint8_t *in; // Input frame data73 const uint8_t *in; // Input frame data
@@ -81,7 +87,7 @@ typedef struct TextureDSPThreadContext { · 13 unmodified lines
81} TextureDSPThreadContext;87} TextureDSPThreadContext;
82 88
83void ff_texturedsp_init(TextureDSPContext *c);89void ff_texturedsp_init(TextureDSPContext *c);
84void ff_texturedspenc_init(TextureDSPContext *c);90void ff_texturedspenc_init(TextureDSPEncContext *c);
85 91
86int ff_texturedsp_decompress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);92int ff_texturedsp_decompress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);
87int ff_texturedsp_compress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);93int ff_texturedsp_compress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb);
libavcodec/texturedspenc.c+1−1
@@ -647,7 +647,7 @@ static int dxt5ys_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block) · 646 unmodified lines
647 return 16;647 return 16;
648}648}
649 649
650av_cold void ff_texturedspenc_init(TextureDSPContext *c)650av_cold void ff_texturedspenc_init(TextureDSPEncContext *c)
651{651{
652 c->dxt1_block = dxt1_block;652 c->dxt1_block = dxt1_block;
653 c->dxt5_block = dxt5_block;653 c->dxt5_block = dxt5_block;
libavcodec/vbnenc.c+1−1
@@ -36,7 +36,7 @@ · 35 unmodified lines
36 36
37typedef struct VBNContext {37typedef struct VBNContext {
38 AVClass *class;38 AVClass *class;
39 TextureDSPContext dxtc;39 TextureDSPEncContext dxtc;
40 int format;40 int format;
41 TextureDSPThreadContext enc;41 TextureDSPThreadContext enc;
42} VBNContext;42} VBNContext;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t