summaryrefslogtreecommitdiff
path: root/libswscale/x86/swscale_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-15 21:08:51 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-15 23:33:04 +0100
commit5e947aeb5945efb34757103f32726041646f4a4d (patch)
tree776722dcd66ac2a97f12276c3e1f01a773c23242 /libswscale/x86/swscale_template.c
parent5ad43af9a62cfd5422dc22f37dd2a2327fa75b7c (diff)
sws/x86: improve rounding for yuv2yuvX
This tries to compensate for the errors introduced by the rounding of pmulhw Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/x86/swscale_template.c')
-rw-r--r--libswscale/x86/swscale_template.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c
index 62265db30f..f2567c1d8b 100644
--- a/libswscale/x86/swscale_template.c
+++ b/libswscale/x86/swscale_template.c
@@ -71,9 +71,20 @@ static void RENAME(yuv2yuvX)(const int16_t *filter, int filterSize,
const uint8_t *dither, int offset)
{
dither_8to16(dither, offset);
- __asm__ volatile(\
+ filterSize--;
+ __asm__ volatile(
+ "movd %0, %%mm1\n\t"
+ "punpcklwd %%mm1, %%mm1\n\t"
+ "punpckldq %%mm1, %%mm1\n\t"
+ "psllw $3, %%mm1\n\t"
+ "paddw %%mm1, %%mm3\n\t"
+ "paddw %%mm1, %%mm4\n\t"
"psraw $4, %%mm3\n\t"
"psraw $4, %%mm4\n\t"
+ ::"m"(filterSize)
+ );
+
+ __asm__ volatile(\
"movq %%mm3, %%mm6\n\t"
"movq %%mm4, %%mm7\n\t"
"movl %3, %%ecx\n\t"