X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fdiracdsp.c;h=12f27ce68464cc99e920e82a527e9fbd83b44485;hb=fe71fde24685b5da052f38c9cd3522714de6d6ab;hp=e82b58767eb4d025624602458844b7965a95f343;hpb=1ac8a1821abd8803eaf48562c788c5ae5d634915;p=ffmpeg diff --git a/libavcodec/diracdsp.c b/libavcodec/diracdsp.c index e82b58767eb..12f27ce6846 100644 --- a/libavcodec/diracdsp.c +++ b/libavcodec/diracdsp.c @@ -151,23 +151,28 @@ static void put_signed_rect_clamped_8bit_c(uint8_t *dst, int dst_stride, const u } } -static void put_signed_rect_clamped_10bit_c(uint8_t *_dst, int dst_stride, const uint8_t *_src, int src_stride, int width, int height) -{ - int x, y; - uint16_t *dst = (uint16_t *)_dst; - int32_t *src = (int32_t *)_src; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x+=4) { - dst[x ] = av_clip(src[x ] + 512, 0, (1 << 10) - 1); - dst[x+1] = av_clip(src[x+1] + 512, 0, (1 << 10) - 1); - dst[x+2] = av_clip(src[x+2] + 512, 0, (1 << 10) - 1); - dst[x+3] = av_clip(src[x+3] + 512, 0, (1 << 10) - 1); - } - dst += dst_stride >> 1; - src += src_stride >> 2; - } +#define PUT_SIGNED_RECT_CLAMPED(PX) \ +static void put_signed_rect_clamped_ ## PX ## bit_c(uint8_t *_dst, int dst_stride, const uint8_t *_src, \ + int src_stride, int width, int height) \ +{ \ + int x, y; \ + uint16_t *dst = (uint16_t *)_dst; \ + int32_t *src = (int32_t *)_src; \ + for (y = 0; y < height; y++) { \ + for (x = 0; x < width; x+=4) { \ + dst[x ] = av_clip_uintp2(src[x ] + (1 << (PX - 1)), PX); \ + dst[x+1] = av_clip_uintp2(src[x+1] + (1 << (PX - 1)), PX); \ + dst[x+2] = av_clip_uintp2(src[x+2] + (1 << (PX - 1)), PX); \ + dst[x+3] = av_clip_uintp2(src[x+3] + (1 << (PX - 1)), PX); \ + } \ + dst += dst_stride >> 1; \ + src += src_stride >> 2; \ + } \ } +PUT_SIGNED_RECT_CLAMPED(10) +PUT_SIGNED_RECT_CLAMPED(12) + static void add_rect_clamped_c(uint8_t *dst, const uint16_t *src, int stride, const int16_t *idwt, int idwt_stride, int width, int height) @@ -197,6 +202,7 @@ av_cold void ff_diracdsp_init(DiracDSPContext *c) c->add_rect_clamped = add_rect_clamped_c; c->put_signed_rect_clamped[0] = put_signed_rect_clamped_8bit_c; c->put_signed_rect_clamped[1] = put_signed_rect_clamped_10bit_c; + c->put_signed_rect_clamped[2] = put_signed_rect_clamped_12bit_c; c->add_dirac_obmc[0] = add_obmc8_c; c->add_dirac_obmc[1] = add_obmc16_c;