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