aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/i386/dsputil_mmx.c
diff options
context:
space:
mode:
authorZdenek Kabelac <kabi@informatics.muni.cz>2002-11-11 09:40:17 +0000
committerZdenek Kabelac <kabi@informatics.muni.cz>2002-11-11 09:40:17 +0000
commiteb4b3dd3c3ea1ca705b51613fb800c10c99a47bb (patch)
treec8e001972c5212f766a2bf6a41a3059c135f24bb /libavcodec/i386/dsputil_mmx.c
parentfb602cd15e2401e5305afd57f501783f4b636303 (diff)
downloadffmpeg-eb4b3dd3c3ea1ca705b51613fb800c10c99a47bb.tar.gz
* using DSPContext - so each codec could use its local (sub)set of CPU extension
Originally committed as revision 1194 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/i386/dsputil_mmx.c')
-rw-r--r--libavcodec/i386/dsputil_mmx.c241
1 files changed, 120 insertions, 121 deletions
diff --git a/libavcodec/i386/dsputil_mmx.c b/libavcodec/i386/dsputil_mmx.c
index 708d0b091b..94b88b70e6 100644
--- a/libavcodec/i386/dsputil_mmx.c
+++ b/libavcodec/i386/dsputil_mmx.c
@@ -22,7 +22,7 @@
#include "../dsputil.h"
int mm_flags; /* multimedia extension flags */
-
+/* FIXME use them in static form */
int pix_abs16x16_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_x2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_y2_mmx(UINT8 *blk1, UINT8 *blk2, int lx);
@@ -242,7 +242,7 @@ static void diff_pixels_mmx(DCTELEM *block, const UINT8 *s1, const UINT8 *s2, in
);
}
-static void put_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
+void put_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
{
const DCTELEM *p;
UINT8 *pix;
@@ -297,7 +297,7 @@ static void put_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line
:"memory");
}
-static void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
+void add_pixels_clamped_mmx(const DCTELEM *block, UINT8 *pixels, int line_size)
{
const DCTELEM *p;
UINT8 *pix;
@@ -457,7 +457,7 @@ static int pix_sum16_mmx(UINT8 * pix, int line_size){
static void just_return() { return; }
#endif
-void dsputil_init_mmx(void)
+void dsputil_init_mmx(DSPContext* c, unsigned mask)
{
mm_flags = mm_support();
#if 0
@@ -476,112 +476,112 @@ void dsputil_init_mmx(void)
#endif
if (mm_flags & MM_MMX) {
- get_pixels = get_pixels_mmx;
- diff_pixels = diff_pixels_mmx;
- put_pixels_clamped = put_pixels_clamped_mmx;
- add_pixels_clamped = add_pixels_clamped_mmx;
- clear_blocks= clear_blocks_mmx;
- pix_sum= pix_sum16_mmx;
-
- pix_abs16x16 = pix_abs16x16_mmx;
- pix_abs16x16_x2 = pix_abs16x16_x2_mmx;
- pix_abs16x16_y2 = pix_abs16x16_y2_mmx;
- pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx;
- pix_abs8x8 = pix_abs8x8_mmx;
- pix_abs8x8_x2 = pix_abs8x8_x2_mmx;
- pix_abs8x8_y2 = pix_abs8x8_y2_mmx;
- pix_abs8x8_xy2= pix_abs8x8_xy2_mmx;
-
- put_pixels_tab[0][0] = put_pixels16_mmx;
- put_pixels_tab[0][1] = put_pixels16_x2_mmx;
- put_pixels_tab[0][2] = put_pixels16_y2_mmx;
- put_pixels_tab[0][3] = put_pixels16_xy2_mmx;
-
- put_no_rnd_pixels_tab[0][0] = put_pixels16_mmx;
- put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx;
- put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx;
- put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_mmx;
-
- avg_pixels_tab[0][0] = avg_pixels16_mmx;
- avg_pixels_tab[0][1] = avg_pixels16_x2_mmx;
- avg_pixels_tab[0][2] = avg_pixels16_y2_mmx;
- avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx;
-
- avg_no_rnd_pixels_tab[0][0] = avg_no_rnd_pixels16_mmx;
- avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_mmx;
- avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_mmx;
- avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy2_mmx;
-
- put_pixels_tab[1][0] = put_pixels8_mmx;
- put_pixels_tab[1][1] = put_pixels8_x2_mmx;
- put_pixels_tab[1][2] = put_pixels8_y2_mmx;
- put_pixels_tab[1][3] = put_pixels8_xy2_mmx;
-
- put_no_rnd_pixels_tab[1][0] = put_pixels8_mmx;
- put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx;
- put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx;
- put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_mmx;
-
- avg_pixels_tab[1][0] = avg_pixels8_mmx;
- avg_pixels_tab[1][1] = avg_pixels8_x2_mmx;
- avg_pixels_tab[1][2] = avg_pixels8_y2_mmx;
- avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx;
-
- avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels8_mmx;
- avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_mmx;
- avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_mmx;
- avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_mmx;
+ c->get_pixels = get_pixels_mmx;
+ c->diff_pixels = diff_pixels_mmx;
+ c->put_pixels_clamped = put_pixels_clamped_mmx;
+ c->add_pixels_clamped = add_pixels_clamped_mmx;
+ c->clear_blocks = clear_blocks_mmx;
+ c->pix_sum = pix_sum16_mmx;
+
+ c->pix_abs16x16 = pix_abs16x16_mmx;
+ c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx;
+ c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx;
+ c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx;
+ c->pix_abs8x8 = pix_abs8x8_mmx;
+ c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx;
+ c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx;
+ c->pix_abs8x8_xy2 = pix_abs8x8_xy2_mmx;
+
+ c->put_pixels_tab[0][0] = put_pixels16_mmx;
+ c->put_pixels_tab[0][1] = put_pixels16_x2_mmx;
+ c->put_pixels_tab[0][2] = put_pixels16_y2_mmx;
+ c->put_pixels_tab[0][3] = put_pixels16_xy2_mmx;
+
+ c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mmx;
+ c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx;
+ c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx;
+ c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_mmx;
+
+ c->avg_pixels_tab[0][0] = avg_pixels16_mmx;
+ c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmx;
+ c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx;
+ c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx;
+
+ c->avg_no_rnd_pixels_tab[0][0] = avg_no_rnd_pixels16_mmx;
+ c->avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_mmx;
+ c->avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_mmx;
+ c->avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy2_mmx;
+
+ c->put_pixels_tab[1][0] = put_pixels8_mmx;
+ c->put_pixels_tab[1][1] = put_pixels8_x2_mmx;
+ c->put_pixels_tab[1][2] = put_pixels8_y2_mmx;
+ c->put_pixels_tab[1][3] = put_pixels8_xy2_mmx;
+
+ c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mmx;
+ c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx;
+ c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx;
+ c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_mmx;
+
+ c->avg_pixels_tab[1][0] = avg_pixels8_mmx;
+ c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx;
+ c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx;
+ c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx;
+
+ c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels8_mmx;
+ c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels8_x2_mmx;
+ c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels8_y2_mmx;
+ c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels8_xy2_mmx;
if (mm_flags & MM_MMXEXT) {
- pix_abs16x16 = pix_abs16x16_mmx2;
- pix_abs16x16_x2 = pix_abs16x16_x2_mmx2;
- pix_abs16x16_y2 = pix_abs16x16_y2_mmx2;
- pix_abs16x16_xy2= pix_abs16x16_xy2_mmx2;
-
- pix_abs8x8 = pix_abs8x8_mmx2;
- pix_abs8x8_x2 = pix_abs8x8_x2_mmx2;
- pix_abs8x8_y2 = pix_abs8x8_y2_mmx2;
- pix_abs8x8_xy2= pix_abs8x8_xy2_mmx2;
-
- put_pixels_tab[0][1] = put_pixels16_x2_mmx2;
- put_pixels_tab[0][2] = put_pixels16_y2_mmx2;
- put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2;
- put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx2;
-
- avg_pixels_tab[0][0] = avg_pixels16_mmx2;
- avg_pixels_tab[0][1] = avg_pixels16_x2_mmx2;
- avg_pixels_tab[0][2] = avg_pixels16_y2_mmx2;
- avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2;
-
- put_pixels_tab[1][1] = put_pixels8_x2_mmx2;
- put_pixels_tab[1][2] = put_pixels8_y2_mmx2;
- put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx2;
- put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx2;
-
- avg_pixels_tab[1][0] = avg_pixels8_mmx2;
- avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2;
- avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2;
- avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2;
+ c->pix_abs16x16 = pix_abs16x16_mmx2;
+ c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx2;
+ c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx2;
+ c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx2;
+
+ c->pix_abs8x8 = pix_abs8x8_mmx2;
+ c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx2;
+ c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx2;
+ c->pix_abs8x8_xy2 = pix_abs8x8_xy2_mmx2;
+
+ c->put_pixels_tab[0][1] = put_pixels16_x2_mmx2;
+ c->put_pixels_tab[0][2] = put_pixels16_y2_mmx2;
+ c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx2;
+ c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx2;
+
+ c->avg_pixels_tab[0][0] = avg_pixels16_mmx2;
+ c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmx2;
+ c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmx2;
+ c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx2;
+
+ c->put_pixels_tab[1][1] = put_pixels8_x2_mmx2;
+ c->put_pixels_tab[1][2] = put_pixels8_y2_mmx2;
+ c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx2;
+ c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx2;
+
+ c->avg_pixels_tab[1][0] = avg_pixels8_mmx2;
+ c->avg_pixels_tab[1][1] = avg_pixels8_x2_mmx2;
+ c->avg_pixels_tab[1][2] = avg_pixels8_y2_mmx2;
+ c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx2;
} else if (mm_flags & MM_3DNOW) {
- put_pixels_tab[0][1] = put_pixels16_x2_3dnow;
- put_pixels_tab[0][2] = put_pixels16_y2_3dnow;
- put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow;
- put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow;
-
- avg_pixels_tab[0][0] = avg_pixels16_3dnow;
- avg_pixels_tab[0][1] = avg_pixels16_x2_3dnow;
- avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow;
- avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow;
-
- put_pixels_tab[1][1] = put_pixels8_x2_3dnow;
- put_pixels_tab[1][2] = put_pixels8_y2_3dnow;
- put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow;
- put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow;
-
- avg_pixels_tab[1][0] = avg_pixels8_3dnow;
- avg_pixels_tab[1][1] = avg_pixels8_x2_3dnow;
- avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow;
- avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow;
+ c->put_pixels_tab[0][1] = put_pixels16_x2_3dnow;
+ c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow;
+ c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow;
+ c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow;
+
+ c->avg_pixels_tab[0][0] = avg_pixels16_3dnow;
+ c->avg_pixels_tab[0][1] = avg_pixels16_x2_3dnow;
+ c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow;
+ c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow;
+
+ c->put_pixels_tab[1][1] = put_pixels8_x2_3dnow;
+ c->put_pixels_tab[1][2] = put_pixels8_y2_3dnow;
+ c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_3dnow;
+ c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_3dnow;
+
+ c->avg_pixels_tab[1][0] = avg_pixels8_3dnow;
+ c->avg_pixels_tab[1][1] = avg_pixels8_x2_3dnow;
+ c->avg_pixels_tab[1][2] = avg_pixels8_y2_3dnow;
+ c->avg_pixels_tab[1][3] = avg_pixels8_xy2_3dnow;
}
}
@@ -624,25 +624,24 @@ void dsputil_init_mmx(void)
/* remove any non bit exact operation (testing purpose). NOTE that
this function should be kept as small as possible because it is
always difficult to test automatically non bit exact cases. */
-void dsputil_set_bit_exact_mmx(void)
+void dsputil_set_bit_exact_mmx(DSPContext* c, unsigned mask)
{
if (mm_flags & MM_MMX) {
-
/* MMX2 & 3DNOW */
- put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx;
- put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx;
- avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx;
- put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx;
- put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx;
- avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx;
+ c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmx;
+ c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmx;
+ c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmx;
+ c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels8_x2_mmx;
+ c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_mmx;
+ c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mmx;
if (mm_flags & MM_MMXEXT) {
- pix_abs16x16_x2 = pix_abs16x16_x2_mmx;
- pix_abs16x16_y2 = pix_abs16x16_y2_mmx;
- pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx;
- pix_abs8x8_x2 = pix_abs8x8_x2_mmx;
- pix_abs8x8_y2 = pix_abs8x8_y2_mmx;
- pix_abs8x8_xy2= pix_abs8x8_xy2_mmx;
+ c->pix_abs16x16_x2 = pix_abs16x16_x2_mmx;
+ c->pix_abs16x16_y2 = pix_abs16x16_y2_mmx;
+ c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mmx;
+ c->pix_abs8x8_x2 = pix_abs8x8_x2_mmx;
+ c->pix_abs8x8_y2 = pix_abs8x8_y2_mmx;
+ c->pix_abs8x8_xy2= pix_abs8x8_xy2_mmx;
}
}
}