Commit af19f78f authored by Zdenek Kabelac's avatar Zdenek Kabelac

* using DSPContext - so each codec could use its local (sub)set of CPU extension

* these are untested - users/developers please check

Originally committed as revision 1197 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 85bd5526
......@@ -281,61 +281,61 @@ void put_pixels16_axp_asm(uint8_t *block, const uint8_t *pixels,
put_pixels_axp_asm(block + 8, pixels + 8, line_size, h);
}
void dsputil_init_alpha(void)
void dsputil_init_alpha(DSPContext* c, unsigned mask)
{
put_pixels_tab[0][0] = put_pixels16_axp_asm;
put_pixels_tab[0][1] = put_pixels16_x2_axp;
put_pixels_tab[0][2] = put_pixels16_y2_axp;
put_pixels_tab[0][3] = put_pixels16_xy2_axp;
put_no_rnd_pixels_tab[0][0] = put_pixels16_axp_asm;
put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_axp;
put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_axp;
put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_axp;
avg_pixels_tab[0][0] = avg_pixels16_axp;
avg_pixels_tab[0][1] = avg_pixels16_x2_axp;
avg_pixels_tab[0][2] = avg_pixels16_y2_axp;
avg_pixels_tab[0][3] = avg_pixels16_xy2_axp;
avg_no_rnd_pixels_tab[0][0] = avg_no_rnd_pixels16_axp;
avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_axp;
avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_axp;
avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy2_axp;
put_pixels_tab[1][0] = put_pixels_axp_asm;
put_pixels_tab[1][1] = put_pixels_x2_axp;
put_pixels_tab[1][2] = put_pixels_y2_axp;
put_pixels_tab[1][3] = put_pixels_xy2_axp;
put_no_rnd_pixels_tab[1][0] = put_pixels_axp_asm;
put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels_x2_axp;
put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels_y2_axp;
put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels_xy2_axp;
avg_pixels_tab[1][0] = avg_pixels_axp;
avg_pixels_tab[1][1] = avg_pixels_x2_axp;
avg_pixels_tab[1][2] = avg_pixels_y2_axp;
avg_pixels_tab[1][3] = avg_pixels_xy2_axp;
avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels_axp;
avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels_x2_axp;
avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels_y2_axp;
avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels_xy2_axp;
clear_blocks = clear_blocks_axp;
c->put_pixels_tab[0][0] = put_pixels16_axp_asm;
c->put_pixels_tab[0][1] = put_pixels16_x2_axp;
c->put_pixels_tab[0][2] = put_pixels16_y2_axp;
c->put_pixels_tab[0][3] = put_pixels16_xy2_axp;
c->put_no_rnd_pixels_tab[0][0] = put_pixels16_axp_asm;
c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_axp;
c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_axp;
c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_axp;
c->avg_pixels_tab[0][0] = avg_pixels16_axp;
c->avg_pixels_tab[0][1] = avg_pixels16_x2_axp;
c->avg_pixels_tab[0][2] = avg_pixels16_y2_axp;
c->avg_pixels_tab[0][3] = avg_pixels16_xy2_axp;
c->avg_no_rnd_pixels_tab[0][0] = avg_no_rnd_pixels16_axp;
c->avg_no_rnd_pixels_tab[0][1] = avg_no_rnd_pixels16_x2_axp;
c->avg_no_rnd_pixels_tab[0][2] = avg_no_rnd_pixels16_y2_axp;
c->avg_no_rnd_pixels_tab[0][3] = avg_no_rnd_pixels16_xy2_axp;
c->put_pixels_tab[1][0] = put_pixels_axp_asm;
c->put_pixels_tab[1][1] = put_pixels_x2_axp;
c->put_pixels_tab[1][2] = put_pixels_y2_axp;
c->put_pixels_tab[1][3] = put_pixels_xy2_axp;
c->put_no_rnd_pixels_tab[1][0] = put_pixels_axp_asm;
c->put_no_rnd_pixels_tab[1][1] = put_no_rnd_pixels_x2_axp;
c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels_y2_axp;
c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels_xy2_axp;
c->avg_pixels_tab[1][0] = avg_pixels_axp;
c->avg_pixels_tab[1][1] = avg_pixels_x2_axp;
c->avg_pixels_tab[1][2] = avg_pixels_y2_axp;
c->avg_pixels_tab[1][3] = avg_pixels_xy2_axp;
c->avg_no_rnd_pixels_tab[1][0] = avg_no_rnd_pixels_axp;
c->avg_no_rnd_pixels_tab[1][1] = avg_no_rnd_pixels_x2_axp;
c->avg_no_rnd_pixels_tab[1][2] = avg_no_rnd_pixels_y2_axp;
c->avg_no_rnd_pixels_tab[1][3] = avg_no_rnd_pixels_xy2_axp;
c->clear_blocks = clear_blocks_axp;
/* amask clears all bits that correspond to present features. */
if (amask(AMASK_MVI) == 0) {
put_pixels_clamped = put_pixels_clamped_mvi_asm;
add_pixels_clamped = add_pixels_clamped_mvi_asm;
get_pixels = get_pixels_mvi;
diff_pixels = diff_pixels_mvi;
pix_abs8x8 = pix_abs8x8_mvi;
pix_abs16x16 = pix_abs16x16_mvi_asm;
pix_abs16x16_x2 = pix_abs16x16_x2_mvi;
pix_abs16x16_y2 = pix_abs16x16_y2_mvi;
pix_abs16x16_xy2 = pix_abs16x16_xy2_mvi;
c->put_pixels_clamped = put_pixels_clamped_mvi_asm;
c->add_pixels_clamped = add_pixels_clamped_mvi_asm;
c->get_pixels = get_pixels_mvi;
c->diff_pixels = diff_pixels_mvi;
c->pix_abs8x8 = pix_abs8x8_mvi;
c->pix_abs16x16 = pix_abs16x16_mvi_asm;
c->pix_abs16x16_x2 = pix_abs16x16_x2_mvi;
c->pix_abs16x16_y2 = pix_abs16x16_y2_mvi;
c->pix_abs16x16_xy2 = pix_abs16x16_xy2_mvi;
}
}
......@@ -223,30 +223,30 @@ static void ff_fdct_mlib(DCTELEM *data)
mlib_VideoDCT8x8_S16_S16 (data, data);
}
void dsputil_init_mlib(void)
void dsputil_init_mlib(DSPContext* c, unsigned mask)
{
put_pixels_tab[0][0] = put_pixels16_mlib;
put_pixels_tab[0][1] = put_pixels16_x2_mlib;
put_pixels_tab[0][2] = put_pixels16_y2_mlib;
put_pixels_tab[0][3] = put_pixels16_xy2_mlib;
put_pixels_tab[1][0] = put_pixels8_mlib;
put_pixels_tab[1][1] = put_pixels8_x2_mlib;
put_pixels_tab[1][2] = put_pixels8_y2_mlib;
put_pixels_tab[1][3] = put_pixels8_xy2_mlib;
avg_pixels_tab[0][0] = avg_pixels16_mlib;
avg_pixels_tab[0][1] = avg_pixels16_x2_mlib;
avg_pixels_tab[0][2] = avg_pixels16_y2_mlib;
avg_pixels_tab[0][3] = avg_pixels16_xy2_mlib;
avg_pixels_tab[1][0] = avg_pixels8_mlib;
avg_pixels_tab[1][1] = avg_pixels8_x2_mlib;
avg_pixels_tab[1][2] = avg_pixels8_y2_mlib;
avg_pixels_tab[1][3] = avg_pixels8_xy2_mlib;
put_no_rnd_pixels_tab[0][0] = put_pixels16_mlib;
put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib;
add_pixels_clamped = add_pixels_clamped_mlib;
c->put_pixels_tab[0][0] = put_pixels16_mlib;
c->put_pixels_tab[0][1] = put_pixels16_x2_mlib;
c->put_pixels_tab[0][2] = put_pixels16_y2_mlib;
c->put_pixels_tab[0][3] = put_pixels16_xy2_mlib;
c->put_pixels_tab[1][0] = put_pixels8_mlib;
c->put_pixels_tab[1][1] = put_pixels8_x2_mlib;
c->put_pixels_tab[1][2] = put_pixels8_y2_mlib;
c->put_pixels_tab[1][3] = put_pixels8_xy2_mlib;
c->avg_pixels_tab[0][0] = avg_pixels16_mlib;
c->avg_pixels_tab[0][1] = avg_pixels16_x2_mlib;
c->avg_pixels_tab[0][2] = avg_pixels16_y2_mlib;
c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mlib;
c->avg_pixels_tab[1][0] = avg_pixels8_mlib;
c->avg_pixels_tab[1][1] = avg_pixels8_x2_mlib;
c->avg_pixels_tab[1][2] = avg_pixels8_y2_mlib;
c->avg_pixels_tab[1][3] = avg_pixels8_xy2_mlib;
c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mlib;
c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mlib;
c->add_pixels_clamped = add_pixels_clamped_mlib;
}
void MPV_common_init_mlib(MpegEncContext *s)
......
......@@ -23,7 +23,7 @@
#include "dsputil_altivec.h"
#endif
void dsputil_init_ppc(void)
void dsputil_init_ppc(DSPContext* c, unsigned mask)
{
// Common optimisations whether Altivec or not
......@@ -32,11 +32,11 @@ void dsputil_init_ppc(void)
#if HAVE_ALTIVEC
if (has_altivec()) {
// Altivec specific optimisations
pix_abs16x16 = pix_abs16x16_altivec;
pix_abs8x8 = pix_abs8x8_altivec;
pix_sum = pix_sum_altivec;
diff_pixels = diff_pixels_altivec;
get_pixels = get_pixels_altivec;
c->pix_abs16x16 = pix_abs16x16_altivec;
c->pix_abs8x8 = pix_abs8x8_altivec;
c->pix_sum = pix_sum_altivec;
c->diff_pixels = diff_pixels_altivec;
c->get_pixels = get_pixels_altivec;
} else
#endif
{
......
......@@ -103,16 +103,16 @@ static void put_pixels16_mmi(uint8_t *block, const uint8_t *pixels, int line_siz
}
void dsputil_init_mmi(void)
void dsputil_init_mmi(DSPContext* c, unsigned mask)
{
clear_blocks = clear_blocks_mmi;
put_pixels_tab[1][0] = put_pixels8_mmi;
put_no_rnd_pixels_tab[1][0] = put_pixels8_mmi;
put_pixels_tab[0][0] = put_pixels16_mmi;
put_no_rnd_pixels_tab[0][0] = put_pixels16_mmi;
get_pixels = get_pixels_mmi;
c->clear_blocks = clear_blocks_mmi;
c->put_pixels_tab[1][0] = put_pixels8_mmi;
c->put_no_rnd_pixels_tab[1][0] = put_pixels8_mmi;
c->put_pixels_tab[0][0] = put_pixels16_mmi;
c->put_no_rnd_pixels_tab[0][0] = put_pixels16_mmi;
c->get_pixels = get_pixels_mmi;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment