diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-02-24 14:22:52 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-02-27 15:30:12 +0100 |
commit | e7ca57d857a5e9897ef13b14ad7479c7e2d2494c (patch) | |
tree | 89111007f666bb25bbf7ba22830ce12b6fc0891d /libavcodec/proresdsp.c | |
parent | 37cf9c53259eeee6d4bf3ed51f0dd91edeff742f (diff) | |
download | ffmpeg-e7ca57d857a5e9897ef13b14ad7479c7e2d2494c.tar.gz |
avcodec/simple_idct: Move ProRes-only code to proresdsp.c
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/proresdsp.c')
-rw-r--r-- | libavcodec/proresdsp.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c index 20de1cab4f..17726a56e0 100644 --- a/libavcodec/proresdsp.c +++ b/libavcodec/proresdsp.c @@ -24,9 +24,55 @@ #include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "libavutil/common.h" +#include "libavutil/intreadwrite.h" #include "idctdsp.h" #include "proresdsp.h" -#include "simple_idct.h" + +#define IN_IDCT_DEPTH 16 +#define PRORES_ONLY + +#define BIT_DEPTH 10 +#define EXTRA_SHIFT +#include "simple_idct_template.c" +#undef BIT_DEPTH +#undef EXTRA_SHIFT + +#define BIT_DEPTH 12 +#include "simple_idct_template.c" +#undef BIT_DEPTH + +/** + * Special version of ff_simple_idct_int16_10bit() which does dequantization + * and scales by a factor of 2 more between the two IDCTs to account + * for larger scale of input coefficients. + */ +static void prores_idct_10(int16_t *restrict block, const int16_t *restrict qmat) +{ + for (int i = 0; i < 64; i++) + block[i] *= qmat[i]; + + for (int i = 0; i < 8; i++) + idctRowCondDC_extrashift_10(block + i*8, 2); + + for (int i = 0; i < 8; i++) { + block[i] += 8192; + idctSparseCol_extrashift_10(block + i); + } +} + +static void prores_idct_12(int16_t *restrict block, const int16_t *restrict qmat) +{ + for (int i = 0; i < 64; i++) + block[i] *= qmat[i]; + + for (int i = 0; i < 8; i++) + idctRowCondDC_int16_12bit(block + i*8, 0); + + for (int i = 0; i < 8; i++) { + block[i] += 8192; + idctSparseCol_int16_12bit(block + i); + } +} #define CLIP_MIN (1 << 2) ///< minimum value for clipping resulting pixels #define CLIP_MAX_10 (1 << 10) - CLIP_MIN - 1 ///< maximum value for clipping resulting pixels @@ -65,13 +111,13 @@ static void put_pixels_12(uint16_t *dst, ptrdiff_t linesize, const int16_t *in) static void prores_idct_put_10_c(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat) { - ff_prores_idct_10(block, qmat); + prores_idct_10(block, qmat); put_pixels_10(out, linesize >> 1, block); } static void prores_idct_put_12_c(uint16_t *out, ptrdiff_t linesize, int16_t *block, const int16_t *qmat) { - ff_prores_idct_12(block, qmat); + prores_idct_12(block, qmat); put_pixels_12(out, linesize >> 1, block); } |