[Mplayer-cvslog] CVS: main/libavcodec/i386 mpegvideo.c,NONE,1.1 dsputil_mmx.c,1.1,1.2
Nick Kurshev
nick at mplayer.dev.hu
Mon Jul 16 11:16:22 CEST 2001
Update of /cvsroot/mplayer/main/libavcodec/i386
In directory mplayer:/var/tmp.root/cvs-serv25971/main/libavcodec/i386
Modified Files:
dsputil_mmx.c
Added Files:
mpegvideo.c
Log Message:
Minor x86 & MMX optimization
--- NEW FILE ---
/*
* The simplest mpeg encoder (well, it was the simplest!)
* Copyright (c) 2000,2001 Gerard Lantau.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Optimized for ia32 cpus by Nick Kurshev <nickols_k at mail.ru>
*/
void MPV_frame_start(MpegEncContext *s)
{
if (s->pict_type == B_TYPE) {
__asm __volatile(
"movl (%1), %%eax\n\t"
"movl 4(%1), %%edx\n\t"
"movl 8(%1), %%ecx\n\t"
"movl %%eax, (%0)\n\t"
"movl %%edx, 4(%0)\n\t"
"movl %%ecx, 8(%0)\n\t"
:
:"r"(s->current_picture), "r"(s->aux_picture)
:"eax","edx","ecx","memory");
} else {
/* swap next and last */
__asm __volatile(
"movl (%1), %%eax\n\t"
"movl 4(%1), %%edx\n\t"
"movl 8(%1), %%ecx\n\t"
"xchgl (%0), %%eax\n\t"
"xchgl 4(%0), %%edx\n\t"
"xchgl 8(%0), %%ecx\n\t"
"movl %%eax, (%1)\n\t"
"movl %%edx, 4(%1)\n\t"
"movl %%ecx, 8(%1)\n\t"
"movl %%eax, (%2)\n\t"
"movl %%edx, 4(%2)\n\t"
"movl %%ecx, 8(%2)\n\t"
:
:"r"(s->last_picture), "r"(s->next_picture), "r"(s->current_picture)
:"eax","edx","ecx","memory");
}
}
Index: dsputil_mmx.c
===================================================================
RCS file: /cvsroot/mplayer/main/libavcodec/i386/dsputil_mmx.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dsputil_mmx.c 10 Jul 2001 21:34:14 -0000 1.1
+++ dsputil_mmx.c 16 Jul 2001 09:16:20 -0000 1.2
@@ -103,3 +103,22 @@
}
emms();
}
+
+static void put_pixels_long(UINT8 *block, const UINT8 *pixels, int line_size, int h)
+{
+ UINT32 *p;
+ const UINT32 *pix;
+ p = (UINT32*)block;
+ pix = (UINT32*)pixels;
+ do {
+ __asm __volatile(
+ "movq %1, %%mm0\n\t"
+ "movq %%mm0, %0\n\t"
+ :"=m"(p[0])
+ :"m"(pix[0])
+ :"memory");
+ pix = (UINT32*) ((char*)pix + line_size);
+ p = (UINT32*) ((char*)p + line_size);
+ } while (--h);
+ emms();
+}
More information about the MPlayer-cvslog
mailing list