[FFmpeg-devel] [PATCH] x86/motion_est: port mmxext and sse2 sad functions to yasm
Christophe Gisquet
christophe.gisquet at gmail.com
Fri Sep 12 10:04:57 CEST 2014
Hi,
2014-09-12 0:51 GMT+02:00 James Almer <jamrial at gmail.com>:
> TODO: Port mmx.
There are mmxext versions, so I suggest dropping them altogether.
There are probably FFmpeg hackers younger than the CPUs affected.
I unfortunately don't have time to review the actual asm changes, but:
> +;-------------------------------------------------------------------------------------------
> +;int ff_sad_xy2_<opt>(MpegEncContext *v, uint8_t *blk2, uint8_t *blk1, int stride, int h);
> +;-------------------------------------------------------------------------------------------
> +%macro SAD_XY2 1
> +cglobal sad%1_xy2, 5, 5, 7, v, pix1, pix2, stride, h
[...]
> +INIT_MMX mmxext
> +SAD_XY2 8
> +SAD_XY2 16
> +INIT_XMM sse2
> +SAD_XY2 16
[...]
> +int ff_sad8_xy2_mmxext(MpegEncContext *v, uint8_t *blk2, uint8_t *blk1,
> + int stride, int h);
> +int ff_sad16_xy2_mmxext(MpegEncContext *v, uint8_t *blk2, uint8_t *blk1,
> + int stride, int h);
> +int ff_sad16_xy2_sse2(MpegEncContext *v, uint8_t *blk2, uint8_t *blk1,
> + int stride, int h);
[...]
> + if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
> + c->pix_abs[0][3] = ff_sad16_xy2_mmxext;
> + c->pix_abs[1][3] = ff_sad8_xy2_mmxext;
> + }
> }
>
> if (EXTERNAL_SSE2(cpu_flags)) {
> @@ -833,6 +727,16 @@ av_cold void ff_me_cmp_init_x86(MECmpContext *c, AVCodecContext *avctx)
> c->hadamard8_diff[0] = ff_hadamard8_diff16_sse2;
> c->hadamard8_diff[1] = ff_hadamard8_diff_sse2;
> #endif
> + if (!(cpu_flags & AV_CPU_FLAG_SSE2SLOW) && avctx->codec_id != AV_CODEC_ID_SNOW) {
> + c->sad[0] = ff_sad16_sse2;
> + c->pix_abs[0][0] = ff_sad16_sse2;
> + c->pix_abs[0][1] = ff_sad16_x2_sse2;
> + c->pix_abs[0][2] = ff_sad16_y2_sse2;
> +
> + if (!(avctx->flags & CODEC_FLAG_BITEXACT)) {
> + c->pix_abs[0][3] = ff_sad16_xy2_sse2;
> + }
> + }
Could you maybe mark them explicitely as "approximate" versions, like
I did there:
http://git.videolan.org/?p=ffmpeg.git;a=commit;h=17ac9980555a0afc5b4633a538c5170c8ceacc04
I have no problem with this being in the same patch.
If I'm not mistaken, some of the ones you are porting are only used if
supplying the right commandline flags for MPEG-2 encoding.
FYI, there is a SSSE3 decoder version here:
http://git.videolan.org/?p=ffmpeg.git;a=commit;h=81aa0f4604f98da692f2689c84968f90354a92ea
Thank you,
--
Christophe
More information about the ffmpeg-devel
mailing list