From e8b9e1e2942355660e246cf4b9a18ce1a095419f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 5 Jul 2012 01:32:13 +0200 Subject: [PATCH] dsputil: extend things to 12 and 14 bits Signed-off-by: Michael Niedermayer --- libavcodec/dsputil.c | 28 ++++++++++++++++++++++++++++ libavcodec/dsputil.h | 6 ++++++ libavcodec/dsputil_template.c | 28 +++++++++++++++++++--------- 3 files changed, 53 insertions(+), 9 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index 9b32dff117..05140e32ea 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -43,6 +43,7 @@ uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, }; uint32_t ff_squareTbl[512] = {0, }; +#define pixeltmp int16_t #define BIT_DEPTH 9 #include "dsputil_template.c" #undef BIT_DEPTH @@ -51,8 +52,21 @@ uint32_t ff_squareTbl[512] = {0, }; #include "dsputil_template.c" #undef BIT_DEPTH +#undef pixeltmp +#define pixeltmp int32_t +#define BIT_DEPTH 12 +#include "dsputil_template.c" +#undef BIT_DEPTH + +#define BIT_DEPTH 14 +#include "dsputil_template.c" +#undef BIT_DEPTH + +#undef pixeltmp +#define pixeltmp int16_t #define BIT_DEPTH 8 #include "dsputil_template.c" +#undef pixeltmp // 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size #define pb_7f (~0UL/255 * 0x7f) @@ -3147,6 +3161,20 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) BIT_DEPTH_FUNCS(10, _16); } break; + case 12: + if (c->dct_bits == 32) { + BIT_DEPTH_FUNCS(12, _32); + } else { + BIT_DEPTH_FUNCS(12, _16); + } + break; + case 14: + if (c->dct_bits == 32) { + BIT_DEPTH_FUNCS(14, _32); + } else { + BIT_DEPTH_FUNCS(14, _16); + } + break; default: av_assert0(avctx->bits_per_raw_sample<=8 || avctx->codec_type != AVMEDIA_TYPE_VIDEO); BIT_DEPTH_FUNCS(8, _16); diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index c1397980f9..af1104825f 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -72,6 +72,8 @@ void ff_h264_chroma_dc_dequant_idct_ ## depth ## _c(DCTELEM *block, int qmul); H264_IDCT( 8) H264_IDCT( 9) H264_IDCT(10) +H264_IDCT(12) +H264_IDCT(14) void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *output, DCTELEM *input, int qp); void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc); @@ -98,6 +100,8 @@ void ff_avg_pixels16x16_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride); PUTAVG_PIXELS( 8) PUTAVG_PIXELS( 9) PUTAVG_PIXELS(10) +PUTAVG_PIXELS(12) +PUTAVG_PIXELS(14) #define ff_put_pixels8x8_c ff_put_pixels8x8_8_c #define ff_avg_pixels8x8_c ff_avg_pixels8x8_8_c @@ -211,6 +215,8 @@ void ff_emulated_edge_mc_ ## depth (uint8_t *buf, const uint8_t *src, int linesi EMULATED_EDGE(8) EMULATED_EDGE(9) EMULATED_EDGE(10) +EMULATED_EDGE(12) +EMULATED_EDGE(14) void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); diff --git a/libavcodec/dsputil_template.c b/libavcodec/dsputil_template.c index 85d4fec7dc..72d8d4ae59 100644 --- a/libavcodec/dsputil_template.c +++ b/libavcodec/dsputil_template.c @@ -829,7 +829,7 @@ static av_unused void FUNC(OPNAME ## h264_qpel2_v_lowpass)(uint8_t *p_dst, uint8 }\ }\ \ -static av_unused void FUNC(OPNAME ## h264_qpel2_hv_lowpass)(uint8_t *p_dst, int16_t *tmp, uint8_t *p_src, int dstStride, int tmpStride, int srcStride){\ +static av_unused void FUNC(OPNAME ## h264_qpel2_hv_lowpass)(uint8_t *p_dst, pixeltmp *tmp, uint8_t *p_src, int dstStride, int tmpStride, int srcStride){\ const int h=2;\ const int w=2;\ const int pad = (BIT_DEPTH > 9) ? (-10 * ((1< 9) ? (-10 * ((1< 9) ? (-10 * ((1<