mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
add MMX version for put_no_rnd_h264_chroma_mc8_c, used in VC-1 decoding.
patch by Christophe GISQUET %christophe P gisquet A free P fr% original thread: date: Nov 25, 2007 12:35 AM subject: Re: [FFmpeg-devel] MMX version for put_no_rnd_h264_chroma_mc8_c Originally committed as revision 11298 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
82ed1ca75d
commit
9fa3572903
@ -25,8 +25,10 @@
|
||||
* H264_CHROMA_OP must be defined to empty for put and pavgb/pavgusb for avg
|
||||
* H264_CHROMA_MC8_MV0 must be defined to a (put|avg)_pixels8 function
|
||||
*/
|
||||
static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
|
||||
static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y, int rnd)
|
||||
{
|
||||
DECLARE_ALIGNED_8(static const uint64_t, ff_pw_28) = 0x001C001C001C001CULL;
|
||||
const uint64_t *rnd_reg;
|
||||
DECLARE_ALIGNED_8(uint64_t, AA);
|
||||
DECLARE_ALIGNED_8(uint64_t, DD);
|
||||
int i;
|
||||
@ -44,16 +46,17 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
|
||||
/* 1 dimensional filter only */
|
||||
const int dxy = x ? 1 : stride;
|
||||
|
||||
rnd_reg = rnd ? &ff_pw_4 : &ff_pw_3;
|
||||
|
||||
asm volatile(
|
||||
"movd %0, %%mm5\n\t"
|
||||
"movq %1, %%mm4\n\t"
|
||||
"movq %2, %%mm6\n\t" /* mm6 = rnd */
|
||||
"punpcklwd %%mm5, %%mm5\n\t"
|
||||
"punpckldq %%mm5, %%mm5\n\t" /* mm5 = B = x */
|
||||
"movq %%mm4, %%mm6\n\t"
|
||||
"pxor %%mm7, %%mm7\n\t"
|
||||
"psubw %%mm5, %%mm4\n\t" /* mm4 = A = 8-x */
|
||||
"psrlw $1, %%mm6\n\t" /* mm6 = 4 */
|
||||
:: "rm"(x+y), "m"(ff_pw_8));
|
||||
:: "rm"(x+y), "m"(ff_pw_8), "m"(*rnd_reg));
|
||||
|
||||
for(i=0; i<h; i++) {
|
||||
asm volatile(
|
||||
@ -95,6 +98,7 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
|
||||
}
|
||||
|
||||
/* general case, bilinear */
|
||||
rnd_reg = rnd ? &ff_pw_32 : &ff_pw_28;
|
||||
asm volatile("movd %2, %%mm4\n\t"
|
||||
"movd %3, %%mm6\n\t"
|
||||
"punpcklwd %%mm4, %%mm4\n\t"
|
||||
@ -177,7 +181,7 @@ static void H264_CHROMA_MC8_TMPL(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*
|
||||
"packuswb %%mm3, %%mm2\n\t"
|
||||
H264_CHROMA_OP(%0, %%mm2)
|
||||
"movq %%mm2, %0\n\t"
|
||||
: "=m" (dst[0]) : "m" (ff_pw_32));
|
||||
: "=m" (dst[0]) : "m" (*rnd_reg));
|
||||
dst+= stride;
|
||||
}
|
||||
}
|
||||
|
@ -3371,8 +3371,9 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
|
||||
c->h263_v_loop_filter= h263_v_loop_filter_mmx;
|
||||
c->h263_h_loop_filter= h263_h_loop_filter_mmx;
|
||||
}
|
||||
c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx;
|
||||
c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx_rnd;
|
||||
c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_mmx;
|
||||
c->put_no_rnd_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_mmx_nornd;
|
||||
|
||||
c->h264_idct_dc_add=
|
||||
c->h264_idct_add= ff_h264_idct_add_mmx;
|
||||
@ -3485,7 +3486,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
|
||||
dspfunc(avg_2tap_qpel, 1, 8);
|
||||
#undef dspfunc
|
||||
|
||||
c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_mmx2;
|
||||
c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_mmx2_rnd;
|
||||
c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_mmx2;
|
||||
c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_mmx2;
|
||||
c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_mmx2;
|
||||
@ -3613,7 +3614,7 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
|
||||
dspfunc(avg_2tap_qpel, 0, 16);
|
||||
dspfunc(avg_2tap_qpel, 1, 8);
|
||||
|
||||
c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_3dnow;
|
||||
c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_3dnow_rnd;
|
||||
c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_3dnow;
|
||||
}
|
||||
|
||||
|
@ -1378,6 +1378,16 @@ H264_MC(avg_, 16,mmx2)
|
||||
#define H264_CHROMA_MC2_TMPL put_h264_chroma_mc2_mmx2
|
||||
#define H264_CHROMA_MC8_MV0 put_pixels8_mmx
|
||||
#include "dsputil_h264_template_mmx.c"
|
||||
|
||||
static void put_h264_chroma_mc8_mmx_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
|
||||
{
|
||||
put_h264_chroma_mc8_mmx(dst, src, stride, h, x, y, 1);
|
||||
}
|
||||
static void put_h264_chroma_mc8_mmx_nornd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
|
||||
{
|
||||
put_h264_chroma_mc8_mmx(dst, src, stride, h, x, y, 0);
|
||||
}
|
||||
|
||||
#undef H264_CHROMA_OP
|
||||
#undef H264_CHROMA_OP4
|
||||
#undef H264_CHROMA_MC8_TMPL
|
||||
@ -1393,6 +1403,10 @@ H264_MC(avg_, 16,mmx2)
|
||||
#define H264_CHROMA_MC2_TMPL avg_h264_chroma_mc2_mmx2
|
||||
#define H264_CHROMA_MC8_MV0 avg_pixels8_mmx2
|
||||
#include "dsputil_h264_template_mmx.c"
|
||||
static void avg_h264_chroma_mc8_mmx2_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
|
||||
{
|
||||
avg_h264_chroma_mc8_mmx2(dst, src, stride, h, x, y, 1);
|
||||
}
|
||||
#undef H264_CHROMA_OP
|
||||
#undef H264_CHROMA_OP4
|
||||
#undef H264_CHROMA_MC8_TMPL
|
||||
@ -1407,6 +1421,10 @@ H264_MC(avg_, 16,mmx2)
|
||||
#define H264_CHROMA_MC4_TMPL avg_h264_chroma_mc4_3dnow
|
||||
#define H264_CHROMA_MC8_MV0 avg_pixels8_3dnow
|
||||
#include "dsputil_h264_template_mmx.c"
|
||||
static void avg_h264_chroma_mc8_3dnow_rnd(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y)
|
||||
{
|
||||
avg_h264_chroma_mc8_3dnow(dst, src, stride, h, x, y, 1);
|
||||
}
|
||||
#undef H264_CHROMA_OP
|
||||
#undef H264_CHROMA_OP4
|
||||
#undef H264_CHROMA_MC8_TMPL
|
||||
|
Loading…
x
Reference in New Issue
Block a user