| 88 | } |
| 89 | |
| 90 | av_cold int avcodec_dct_init(AVDCT *dsp) |
| 91 | { |
| 92 | AVCodecContext *avctx = avcodec_alloc_context3(NULL); |
| 93 | |
| 94 | if (!avctx) |
| 95 | return AVERROR(ENOMEM); |
| 96 | |
| 97 | avctx->idct_algo = dsp->idct_algo; |
| 98 | avctx->dct_algo = dsp->dct_algo; |
| 99 | avctx->bits_per_raw_sample = dsp->bits_per_sample; |
| 100 | |
| 101 | #define COPY(src, name) memcpy(&dsp->name, &src.name, sizeof(dsp->name)) |
| 102 | |
| 103 | #if CONFIG_IDCTDSP |
| 104 | { |
| 105 | IDCTDSPContext idsp = {0}; |
| 106 | ff_idctdsp_init(&idsp, avctx); |
| 107 | COPY(idsp, idct); |
| 108 | COPY(idsp, idct_permutation); |
| 109 | } |
| 110 | #endif |
| 111 | |
| 112 | #if CONFIG_FDCTDSP |
| 113 | { |
| 114 | FDCTDSPContext fdsp; |
| 115 | ff_fdctdsp_init(&fdsp, avctx); |
| 116 | COPY(fdsp, fdct); |
| 117 | } |
| 118 | #endif |
| 119 | |
| 120 | #if CONFIG_PIXBLOCKDSP |
| 121 | { |
| 122 | PixblockDSPContext pdsp; |
| 123 | ff_pixblockdsp_init(&pdsp, dsp->bits_per_sample); |
| 124 | COPY(pdsp, get_pixels); |
| 125 | COPY(pdsp, get_pixels_unaligned); |
| 126 | } |
| 127 | #endif |
| 128 | |
| 129 | avcodec_free_context(&avctx); |
| 130 | |
| 131 | return 0; |
| 132 | } |
no test coverage detected