24 #define FILTER(src, stride) \ 25 ((21*((src)[ 0*stride] + (src)[1*stride]) \ 26 -7*((src)[-1*stride] + (src)[2*stride]) \ 27 +3*((src)[-2*stride] + (src)[3*stride]) \ 28 -1*((src)[-3*stride] + (src)[4*stride]) + 16) >> 5) 35 for (y = 0; y <
height; y++) {
36 for (x = -3; x < width+5; x++)
37 dstv[x] = av_clip_uint8(
FILTER(src+x, stride));
39 for (x = 0; x <
width; x++)
40 dstc[x] = av_clip_uint8(
FILTER(dstv+x, 1));
42 for (x = 0; x <
width; x++)
43 dsth[x] = av_clip_uint8(
FILTER(src+x, 1));
52 #define PIXOP_BILINEAR(PFX, OP, WIDTH) \ 53 static void ff_ ## PFX ## _dirac_pixels ## WIDTH ## _bilinear_c(uint8_t *dst, const uint8_t *src[5], int stride, int h) \ 56 const uint8_t *s0 = src[0]; \ 57 const uint8_t *s1 = src[1]; \ 58 const uint8_t *s2 = src[2]; \ 59 const uint8_t *s3 = src[3]; \ 60 const uint8_t *w = src[4]; \ 63 for (x = 0; x < WIDTH; x++) { \ 64 OP(dst[x], (s0[x]*w[0] + s1[x]*w[1] + s2[x]*w[2] + s3[x]*w[3] + 8) >> 4); \ 75 #define OP_PUT(dst, val) (dst) = (val) 76 #define OP_AVG(dst, val) (dst) = (((dst) + (val) + 1)>>1) 85 #define op_scale1(x) block[x] = av_clip_uint8( (block[x]*weight + (1<<(log2_denom-1))) >> log2_denom) 86 #define op_scale2(x) dst[x] = av_clip_uint8( (src[x]*weights + dst[x]*weightd + (1<<(log2_denom-1))) >> log2_denom) 88 #define DIRAC_WEIGHT(W) \ 89 static void weight_dirac_pixels ## W ## _c(uint8_t *block, int stride, int log2_denom, \ 90 int weight, int h) { \ 93 for (x = 0; x < W; x++) { \ 100 static void biweight_dirac_pixels ## W ## _c(uint8_t *dst, const uint8_t *src, int stride, int log2_denom, \ 101 int weightd, int weights, int h) { \ 104 for (x = 0; x < W; x++) { \ 117 #define ADD_OBMC(xblen) \ 118 static void add_obmc ## xblen ## _c(uint16_t *dst, const uint8_t *src, int stride, \ 119 const uint8_t *obmc_weight, int yblen) \ 123 for (x = 0; x < xblen; x += 2) { \ 124 dst[x ] += src[x ] * obmc_weight[x ]; \ 125 dst[x+1] += src[x+1] * obmc_weight[x+1]; \ 140 int16_t *
src = (int16_t *)_src;
141 for (y = 0; y <
height; y++) {
142 for (x = 0; x <
width; x+=4) {
143 dst[x ] = av_clip_uint8(src[x ] + 128);
144 dst[x+1] = av_clip_uint8(src[x+1] + 128);
145 dst[x+2] = av_clip_uint8(src[x+2] + 128);
146 dst[x+3] = av_clip_uint8(src[x+3] + 128);
149 src += src_stride >> 1;
153 #define PUT_SIGNED_RECT_CLAMPED(PX) \ 154 static void put_signed_rect_clamped_ ## PX ## bit_c(uint8_t *_dst, int dst_stride, const uint8_t *_src, \ 155 int src_stride, int width, int height) \ 158 uint16_t *dst = (uint16_t *)_dst; \ 159 int32_t *src = (int32_t *)_src; \ 160 for (y = 0; y < height; y++) { \ 161 for (x = 0; x < width; x+=4) { \ 162 dst[x ] = av_clip_uintp2(src[x ] + (1U << (PX - 1)), PX); \ 163 dst[x+1] = av_clip_uintp2(src[x+1] + (1U << (PX - 1)), PX); \ 164 dst[x+2] = av_clip_uintp2(src[x+2] + (1U << (PX - 1)), PX); \ 165 dst[x+3] = av_clip_uintp2(src[x+3] + (1U << (PX - 1)), PX); \ 167 dst += dst_stride >> 1; \ 168 src += src_stride >> 2; \ 176 const int16_t *idwt,
int idwt_stride,
181 for (y = 0; y <
height; y++) {
182 for (x = 0; x <
width; x+=2) {
183 dst[x ] = av_clip_uint8(((src[x ]+32)>>6) + idwt[x ]);
184 dst[x+1] = av_clip_uint8(((src[x+1]+32)>>6) + idwt[x+1]);
192 #define DEQUANT_SUBBAND(PX) \ 193 static void dequant_subband_ ## PX ## _c(uint8_t *src, uint8_t *dst, ptrdiff_t stride, \ 194 const int qf, const int qs, int tot_v, int tot_h) \ 197 for (y = 0; y < tot_v; y++) { \ 198 PX c, sign, *src_r = (PX *)src, *dst_r = (PX *)dst; \ 199 for (i = 0; i < tot_h; i++) { \ 201 sign = FFSIGN(c)*(!!c); \ 202 c = (FFABS(c)*(unsigned)qf + qs) >> 2; \ 205 src += tot_h << (sizeof(PX) >> 1); \ 213 #define PIXFUNC(PFX, WIDTH) \ 214 c->PFX ## _dirac_pixels_tab[WIDTH>>4][0] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _c; \ 215 c->PFX ## _dirac_pixels_tab[WIDTH>>4][1] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _l2_c; \ 216 c->PFX ## _dirac_pixels_tab[WIDTH>>4][2] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _l4_c; \ 217 c->PFX ## _dirac_pixels_tab[WIDTH>>4][3] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _bilinear_c #define PUT_SIGNED_RECT_CLAMPED(PX)
void ff_diracdsp_init_x86(DiracDSPContext *c)
#define FILTER(src, stride)
static void put_signed_rect_clamped_8bit_c(uint8_t *dst, int dst_stride, const uint8_t *_src, int src_stride, int width, int height)
dirac_weight_func weight_dirac_pixels_tab[3]
void(* add_rect_clamped)(uint8_t *dst, const uint16_t *src, int stride, const int16_t *idwt, int idwt_stride, int width, int height)
#define DEQUANT_SUBBAND(PX)
#define PIXOP_BILINEAR(PFX, OP, WIDTH)
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)
av_cold void ff_diracdsp_init(DiracDSPContext *c)
void(* add_dirac_obmc[3])(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen)
Libavcodec external API header.
dirac_biweight_func biweight_dirac_pixels_tab[3]
#define PIXFUNC(PFX, WIDTH)
static void dirac_hpel_filter(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, const uint8_t *src, int stride, int width, int height)
void(* dequant_subband[4])(uint8_t *src, uint8_t *dst, ptrdiff_t stride, const int qf, const int qs, int tot_v, int tot_h)
void(* dirac_hpel_filter)(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, const uint8_t *src, int stride, int width, int height)
void(* put_signed_rect_clamped[3])(uint8_t *dst, int dst_stride, const uint8_t *src, int src_stride, int width, int height)