29 DECLARE_ALIGNED(16,
static const uint16_t, pw_7f)[8] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F};
30 DECLARE_ALIGNED(16,
static const uint16_t, pw_ff)[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
32 #if HAVE_MMXEXT_INLINE 34 int width,
int thresh,
46 "pxor %%mm7, %%mm7 \n" 47 "pshufw $0, %%mm5, %%mm5 \n" 50 "movq 8(%5), %%mm4 \n" 53 "movd (%2,%0), %%mm0 \n" 54 "movd (%3,%0), %%mm1 \n" 55 "punpcklbw %%mm7, %%mm0 \n" 56 "punpcklwd %%mm1, %%mm1 \n" 58 "pxor %%mm2, %%mm2 \n" 59 "psubw %%mm0, %%mm1 \n" 60 "psubw %%mm1, %%mm2 \n" 61 "pmaxsw %%mm1, %%mm2 \n" 62 "pmulhuw %%mm5, %%mm2 \n" 63 "psubw %%mm6, %%mm2 \n" 64 "pminsw %%mm7, %%mm2 \n" 65 "pmullw %%mm2, %%mm2 \n" 66 "paddw %%mm3, %%mm0 \n" 68 "pmulhw %%mm2, %%mm1 \n" 69 "paddw %%mm1, %%mm0 \n" 71 "packuswb %%mm0, %%mm0 \n" 72 "movd %%mm0, (%1,%0) \n" 76 "movd (%2,%0), %%mm0 \n" 77 "movd (%3,%0), %%mm1 \n" 78 "punpcklbw %%mm7, %%mm0 \n" 79 "punpcklwd %%mm1, %%mm1 \n" 81 "pxor %%mm2, %%mm2 \n" 82 "psubw %%mm0, %%mm1 \n" 83 "psubw %%mm1, %%mm2 \n" 84 "pmaxsw %%mm1, %%mm2 \n" 85 "pmulhuw %%mm5, %%mm2 \n" 86 "psubw %%mm6, %%mm2 \n" 87 "pminsw %%mm7, %%mm2 \n" 88 "pmullw %%mm2, %%mm2 \n" 89 "paddw %%mm4, %%mm0 \n" 91 "pmulhw %%mm2, %%mm1 \n" 92 "paddw %%mm1, %%mm0 \n" 94 "packuswb %%mm0, %%mm0 \n" 95 "movd %%mm0, (%1,%0) \n" 102 :
"r"(dst+width),
"r"(src+
width),
"r"(dc+width/2),
103 "rm"(thresh),
"r"(dithers),
"m"(*pw_7f)
109 #if HAVE_SSSE3_INLINE 110 static void gradfun_filter_line_ssse3(
uint8_t *dst,
const uint8_t *src,
const uint16_t *dc,
int width,
int thresh,
const uint16_t *dithers)
122 "pxor %%xmm7, %%xmm7 \n" 123 "pshuflw $0,%%xmm5, %%xmm5 \n" 124 "movdqa %6, %%xmm6 \n" 125 "punpcklqdq %%xmm5, %%xmm5 \n" 126 "movdqa %5, %%xmm4 \n" 128 "movq (%2,%0), %%xmm0 \n" 129 "movq (%3,%0), %%xmm1 \n" 130 "punpcklbw %%xmm7, %%xmm0 \n" 131 "punpcklwd %%xmm1, %%xmm1 \n" 132 "psllw $7, %%xmm0 \n" 133 "psubw %%xmm0, %%xmm1 \n" 134 "pabsw %%xmm1, %%xmm2 \n" 135 "pmulhuw %%xmm5, %%xmm2 \n" 136 "psubw %%xmm6, %%xmm2 \n" 137 "pminsw %%xmm7, %%xmm2 \n" 138 "pmullw %%xmm2, %%xmm2 \n" 139 "psllw $2, %%xmm1 \n" 140 "paddw %%xmm4, %%xmm0 \n" 141 "pmulhw %%xmm2, %%xmm1 \n" 142 "paddw %%xmm1, %%xmm0 \n" 143 "psraw $7, %%xmm0 \n" 144 "packuswb %%xmm0, %%xmm0 \n" 145 "movq %%xmm0, (%1,%0) \n" 149 :
"r"(dst+width),
"r"(src+
width),
"r"(dc+width/2),
150 "rm"(thresh),
"m"(*dithers),
"m"(*pw_7f)
157 static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *
buf,
const uint16_t *buf1,
const uint8_t *src,
int src_linesize,
int width)
160 intptr_t x = -2*width;\ 162 "movdqa %6, %%xmm7 \n"\ 164 load" (%4,%0), %%xmm0 \n"\ 165 load" (%5,%0), %%xmm1 \n"\ 166 "movdqa %%xmm0, %%xmm2 \n"\ 167 "movdqa %%xmm1, %%xmm3 \n"\ 168 "psrlw $8, %%xmm0 \n"\ 169 "psrlw $8, %%xmm1 \n"\ 170 "pand %%xmm7, %%xmm2 \n"\ 171 "pand %%xmm7, %%xmm3 \n"\ 172 "paddw %%xmm1, %%xmm0 \n"\ 173 "paddw %%xmm3, %%xmm2 \n"\ 174 "paddw %%xmm2, %%xmm0 \n"\ 175 "paddw (%2,%0), %%xmm0 \n"\ 176 "movdqa (%1,%0), %%xmm1 \n"\ 177 "movdqa %%xmm0, (%1,%0) \n"\ 178 "psubw %%xmm1, %%xmm0 \n"\ 179 "movdqa %%xmm0, (%3,%0) \n"\ 187 "r"(src+width*2+src_linesize),\ 191 if (((intptr_t) src | src_linesize) & 15) {
205 #if HAVE_MMXEXT_INLINE 209 #if HAVE_SSSE3_INLINE
memory handling functions
#define DECLARE_ALIGNED(n, t, v)
Holds instance-specific information for gradfun.
Macro definitions for various function/variable attributes.
#define AV_CPU_FLAG_MMXEXT
SSE integer functions or AMD MMX ext.
#define AV_CPU_FLAG_SSSE3
Conroe SSSE3 functions.
void ff_gradfun_filter_line_c(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers)
FIXME Range Coding of cr are mx and my are Motion Vector top and top right vectors is used as motion vector prediction the used motion vector is the sum of the predictor and(mvx_diff, mvy_diff)*mv_scale Intra DC Predicton block[y][x] dc[1]
av_cold void ff_gradfun_init_x86(GradFunContext *gf)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
void(* filter_line)(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers)
DSP functions.
const uint8_t dithers[8][8][8]
void(* blur_line)(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width)
else dst[i][x+y *dst_stride[i]]
#define AV_CPU_FLAG_SSE2
PIV SSE2 functions.