2012-12-15 20:46:02 +03:00
|
|
|
/*
|
x86/videodsp_init: Add back lost author attribution
Code originates from:
910b9f30 libavcodec/dsputil.c (David Conrad 2010-05-27 04:39:27 +0000 334) void ff_emulated_edge_mc(uint8_t *buf, const uint8_t *src, int linesize, int block_w, int block_h,
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 335) int src_x, int src_y, int w, int h){
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 336) int x, y;
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 337) int start_y, start_x, end_y, end_x;
b5a093b3 libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-25 20:22:36 +0000 338)
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 339) if(src_y>= h){
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 340) src+= (h-1-src_y)*linesize;
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 341) src_y=h-1;
225f9c44 libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-15 00:25:53 +0000 342) }else if(src_y<=-block_h){
225f9c44 libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-15 00:25:53 +0000 343) src+= (1-block_h-src_y)*linesize;
225f9c44 libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-15 00:25:53 +0000 344) src_y=1-block_h;
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 345) }
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 346) if(src_x>= w){
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 347) src+= (w-1-src_x);
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 348) src_x=w-1;
225f9c44 libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-15 00:25:53 +0000 349) }else if(src_x<=-block_w){
225f9c44 libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-15 00:25:53 +0000 350) src+= (1-block_w-src_x);
225f9c44 libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-15 00:25:53 +0000 351) src_x=1-block_w;
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 352) }
93a21abd libavcodec/mpegvideo.c (Michael Niedermayer 2002-07-14 18:37:35 +0000 353)
b8a78f41 libavcodec/mpegvideo.c (Michael Niedermayer 2002-11-10 11:46:59 +0000 354) start_y= FFMAX(0, -src_y);
b8a78f41 libavcodec/mpegvideo.c (Michael Niedermayer 2002-11-10 11:46:59 +0000 355) start_x= FFMAX(0, -src_x);
b8a78f41 libavcodec/mpegvideo.c (Michael Niedermayer 2002-11-10 11:46:59 +0000 356) end_y= FFMIN(block_h, h-src_y);
b8a78f41 libavcodec/mpegvideo.c (Michael Niedermayer 2002-11-10 11:46:59 +0000 357) end_x= FFMIN(block_w, w-src_x);
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-21 20:26:09 +03:00
|
|
|
* Copyright (C) 2002-2012 Michael Niedermayer
|
2012-12-15 20:46:02 +03:00
|
|
|
* Copyright (C) 2012 Ronald S. Bultje
|
|
|
|
*
|
2012-12-21 20:37:52 +03:00
|
|
|
* This file is part of FFmpeg.
|
2012-12-15 20:46:02 +03:00
|
|
|
*
|
2012-12-21 20:37:52 +03:00
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2012-12-15 20:46:02 +03:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
2012-12-21 20:37:52 +03:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2012-12-15 20:46:02 +03:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-12-21 20:37:52 +03:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2012-12-15 20:46:02 +03:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2013-02-01 12:31:59 +03:00
|
|
|
#include "libavutil/attributes.h"
|
2012-12-21 19:18:43 +03:00
|
|
|
#include "libavutil/avassert.h"
|
2012-12-15 20:46:02 +03:00
|
|
|
#include "libavutil/common.h"
|
|
|
|
#include "libavutil/cpu.h"
|
|
|
|
#include "libavutil/mem.h"
|
|
|
|
#include "libavutil/x86/asm.h"
|
2013-08-20 15:46:58 +03:00
|
|
|
#include "libavutil/x86/cpu.h"
|
2012-12-15 20:46:02 +03:00
|
|
|
#include "libavcodec/videodsp.h"
|
|
|
|
|
|
|
|
#if HAVE_YASM
|
2013-09-20 15:01:19 +03:00
|
|
|
typedef void emu_edge_vfix_func(uint8_t *dst, x86_reg dst_stride,
|
|
|
|
const uint8_t *src, x86_reg src_stride,
|
|
|
|
x86_reg start_y, x86_reg end_y, x86_reg bh);
|
|
|
|
typedef void emu_edge_vvar_func(uint8_t *dst, x86_reg dst_stride,
|
|
|
|
const uint8_t *src, x86_reg src_stride,
|
|
|
|
x86_reg start_y, x86_reg end_y, x86_reg bh,
|
|
|
|
x86_reg w);
|
|
|
|
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix1_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix2_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix3_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix4_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix5_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix6_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix7_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix8_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix9_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix10_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix11_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix12_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix13_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix14_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix15_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix16_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix17_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix18_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix19_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix20_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix21_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix22_mmx;
|
|
|
|
#if ARCH_X86_32
|
2014-08-29 01:32:32 +03:00
|
|
|
static emu_edge_vfix_func * const vfixtbl_mmx[22] = {
|
2013-09-20 15:01:19 +03:00
|
|
|
&ff_emu_edge_vfix1_mmx, &ff_emu_edge_vfix2_mmx, &ff_emu_edge_vfix3_mmx,
|
|
|
|
&ff_emu_edge_vfix4_mmx, &ff_emu_edge_vfix5_mmx, &ff_emu_edge_vfix6_mmx,
|
|
|
|
&ff_emu_edge_vfix7_mmx, &ff_emu_edge_vfix8_mmx, &ff_emu_edge_vfix9_mmx,
|
|
|
|
&ff_emu_edge_vfix10_mmx, &ff_emu_edge_vfix11_mmx, &ff_emu_edge_vfix12_mmx,
|
|
|
|
&ff_emu_edge_vfix13_mmx, &ff_emu_edge_vfix14_mmx, &ff_emu_edge_vfix15_mmx,
|
|
|
|
&ff_emu_edge_vfix16_mmx, &ff_emu_edge_vfix17_mmx, &ff_emu_edge_vfix18_mmx,
|
|
|
|
&ff_emu_edge_vfix19_mmx, &ff_emu_edge_vfix20_mmx, &ff_emu_edge_vfix21_mmx,
|
|
|
|
&ff_emu_edge_vfix22_mmx
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
extern emu_edge_vvar_func ff_emu_edge_vvar_mmx;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix16_sse;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix17_sse;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix18_sse;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix19_sse;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix20_sse;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix21_sse;
|
|
|
|
extern emu_edge_vfix_func ff_emu_edge_vfix22_sse;
|
2014-08-29 01:32:32 +03:00
|
|
|
static emu_edge_vfix_func * const vfixtbl_sse[22] = {
|
2013-09-20 15:01:19 +03:00
|
|
|
ff_emu_edge_vfix1_mmx, ff_emu_edge_vfix2_mmx, ff_emu_edge_vfix3_mmx,
|
|
|
|
ff_emu_edge_vfix4_mmx, ff_emu_edge_vfix5_mmx, ff_emu_edge_vfix6_mmx,
|
|
|
|
ff_emu_edge_vfix7_mmx, ff_emu_edge_vfix8_mmx, ff_emu_edge_vfix9_mmx,
|
|
|
|
ff_emu_edge_vfix10_mmx, ff_emu_edge_vfix11_mmx, ff_emu_edge_vfix12_mmx,
|
|
|
|
ff_emu_edge_vfix13_mmx, ff_emu_edge_vfix14_mmx, ff_emu_edge_vfix15_mmx,
|
|
|
|
ff_emu_edge_vfix16_sse, ff_emu_edge_vfix17_sse, ff_emu_edge_vfix18_sse,
|
|
|
|
ff_emu_edge_vfix19_sse, ff_emu_edge_vfix20_sse, ff_emu_edge_vfix21_sse,
|
|
|
|
ff_emu_edge_vfix22_sse
|
|
|
|
};
|
|
|
|
extern emu_edge_vvar_func ff_emu_edge_vvar_sse;
|
|
|
|
|
|
|
|
typedef void emu_edge_hfix_func(uint8_t *dst, x86_reg dst_stride,
|
|
|
|
x86_reg start_x, x86_reg bh);
|
|
|
|
typedef void emu_edge_hvar_func(uint8_t *dst, x86_reg dst_stride,
|
|
|
|
x86_reg start_x, x86_reg n_words, x86_reg bh);
|
|
|
|
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix2_mmx;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix4_mmx;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix6_mmx;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix8_mmx;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix10_mmx;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix12_mmx;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix14_mmx;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix16_mmx;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix18_mmx;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix20_mmx;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix22_mmx;
|
|
|
|
#if ARCH_X86_32
|
2014-08-29 01:32:32 +03:00
|
|
|
static emu_edge_hfix_func * const hfixtbl_mmx[11] = {
|
2013-09-20 15:01:19 +03:00
|
|
|
ff_emu_edge_hfix2_mmx, ff_emu_edge_hfix4_mmx, ff_emu_edge_hfix6_mmx,
|
|
|
|
ff_emu_edge_hfix8_mmx, ff_emu_edge_hfix10_mmx, ff_emu_edge_hfix12_mmx,
|
|
|
|
ff_emu_edge_hfix14_mmx, ff_emu_edge_hfix16_mmx, ff_emu_edge_hfix18_mmx,
|
|
|
|
ff_emu_edge_hfix20_mmx, ff_emu_edge_hfix22_mmx
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
extern emu_edge_hvar_func ff_emu_edge_hvar_mmx;
|
2013-10-24 13:54:32 +03:00
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix16_sse2;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix18_sse2;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix20_sse2;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix22_sse2;
|
2014-08-29 01:32:32 +03:00
|
|
|
static emu_edge_hfix_func * const hfixtbl_sse2[11] = {
|
2014-06-28 06:33:52 +03:00
|
|
|
ff_emu_edge_hfix2_mmx, ff_emu_edge_hfix4_mmx, ff_emu_edge_hfix6_mmx,
|
|
|
|
ff_emu_edge_hfix8_mmx, ff_emu_edge_hfix10_mmx, ff_emu_edge_hfix12_mmx,
|
|
|
|
ff_emu_edge_hfix14_mmx, ff_emu_edge_hfix16_sse2, ff_emu_edge_hfix18_sse2,
|
|
|
|
ff_emu_edge_hfix20_sse2, ff_emu_edge_hfix22_sse2
|
2013-09-20 15:01:19 +03:00
|
|
|
};
|
2013-10-24 13:54:32 +03:00
|
|
|
extern emu_edge_hvar_func ff_emu_edge_hvar_sse2;
|
2014-09-24 00:42:35 +03:00
|
|
|
#if HAVE_AVX2_EXTERNAL
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix8_avx2;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix10_avx2;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix12_avx2;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix14_avx2;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix16_avx2;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix18_avx2;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix20_avx2;
|
|
|
|
extern emu_edge_hfix_func ff_emu_edge_hfix22_avx2;
|
|
|
|
static emu_edge_hfix_func * const hfixtbl_avx2[11] = {
|
|
|
|
ff_emu_edge_hfix2_mmx, ff_emu_edge_hfix4_mmx, ff_emu_edge_hfix6_mmx,
|
|
|
|
ff_emu_edge_hfix8_avx2, ff_emu_edge_hfix10_avx2, ff_emu_edge_hfix12_avx2,
|
|
|
|
ff_emu_edge_hfix14_avx2, ff_emu_edge_hfix16_avx2, ff_emu_edge_hfix18_avx2,
|
|
|
|
ff_emu_edge_hfix20_avx2, ff_emu_edge_hfix22_avx2
|
|
|
|
};
|
|
|
|
extern emu_edge_hvar_func ff_emu_edge_hvar_avx2;
|
|
|
|
#endif
|
2013-09-20 15:01:19 +03:00
|
|
|
|
2013-10-14 04:13:10 +03:00
|
|
|
static av_always_inline void emulated_edge_mc(uint8_t *dst, const uint8_t *src,
|
|
|
|
ptrdiff_t dst_stride,
|
|
|
|
ptrdiff_t src_stride,
|
2013-09-20 15:01:19 +03:00
|
|
|
x86_reg block_w, x86_reg block_h,
|
|
|
|
x86_reg src_x, x86_reg src_y,
|
|
|
|
x86_reg w, x86_reg h,
|
2014-09-24 00:29:21 +03:00
|
|
|
emu_edge_vfix_func * const *vfix_tbl,
|
2013-09-20 15:01:19 +03:00
|
|
|
emu_edge_vvar_func *v_extend_var,
|
2014-09-24 00:29:21 +03:00
|
|
|
emu_edge_hfix_func * const *hfix_tbl,
|
2013-09-20 15:01:19 +03:00
|
|
|
emu_edge_hvar_func *h_extend_var)
|
2012-12-15 20:46:02 +03:00
|
|
|
{
|
2013-09-20 15:01:19 +03:00
|
|
|
x86_reg start_y, start_x, end_y, end_x, src_y_add = 0, p;
|
2012-12-21 19:18:43 +03:00
|
|
|
|
2013-10-14 04:13:10 +03:00
|
|
|
if (!w || !h)
|
2012-12-21 19:18:43 +03:00
|
|
|
return;
|
2012-12-15 20:46:02 +03:00
|
|
|
|
2015-07-08 00:49:04 +02:00
|
|
|
av_assert2(block_w <= FFABS(dst_stride));
|
|
|
|
|
2012-12-15 20:46:02 +03:00
|
|
|
if (src_y >= h) {
|
2013-09-20 15:01:19 +03:00
|
|
|
src -= src_y*src_stride;
|
2012-12-21 19:18:43 +03:00
|
|
|
src_y_add = h - 1;
|
2012-12-15 20:46:02 +03:00
|
|
|
src_y = h - 1;
|
|
|
|
} else if (src_y <= -block_h) {
|
2013-09-20 15:01:19 +03:00
|
|
|
src -= src_y*src_stride;
|
2012-12-21 19:18:43 +03:00
|
|
|
src_y_add = 1 - block_h;
|
2012-12-15 20:46:02 +03:00
|
|
|
src_y = 1 - block_h;
|
|
|
|
}
|
|
|
|
if (src_x >= w) {
|
|
|
|
src += w - 1 - src_x;
|
|
|
|
src_x = w - 1;
|
|
|
|
} else if (src_x <= -block_w) {
|
|
|
|
src += 1 - block_w - src_x;
|
|
|
|
src_x = 1 - block_w;
|
|
|
|
}
|
|
|
|
|
|
|
|
start_y = FFMAX(0, -src_y);
|
|
|
|
start_x = FFMAX(0, -src_x);
|
|
|
|
end_y = FFMIN(block_h, h-src_y);
|
|
|
|
end_x = FFMIN(block_w, w-src_x);
|
2012-12-21 19:18:43 +03:00
|
|
|
av_assert2(start_x < end_x && block_w > 0);
|
|
|
|
av_assert2(start_y < end_y && block_h > 0);
|
2012-12-15 20:46:02 +03:00
|
|
|
|
|
|
|
// fill in the to-be-copied part plus all above/below
|
2013-09-20 15:01:19 +03:00
|
|
|
src += (src_y_add + start_y) * src_stride + start_x;
|
|
|
|
w = end_x - start_x;
|
|
|
|
if (w <= 22) {
|
|
|
|
vfix_tbl[w - 1](dst + start_x, dst_stride, src, src_stride,
|
|
|
|
start_y, end_y, block_h);
|
|
|
|
} else {
|
|
|
|
v_extend_var(dst + start_x, dst_stride, src, src_stride,
|
|
|
|
start_y, end_y, block_h, w);
|
|
|
|
}
|
|
|
|
|
|
|
|
// fill left
|
|
|
|
if (start_x) {
|
|
|
|
if (start_x <= 22) {
|
|
|
|
hfix_tbl[(start_x - 1) >> 1](dst, dst_stride, start_x, block_h);
|
|
|
|
} else {
|
|
|
|
h_extend_var(dst, dst_stride,
|
|
|
|
start_x, (start_x + 1) >> 1, block_h);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// fill right
|
|
|
|
p = block_w - end_x;
|
|
|
|
if (p) {
|
|
|
|
if (p <= 22) {
|
|
|
|
hfix_tbl[(p - 1) >> 1](dst + end_x - (p & 1), dst_stride,
|
|
|
|
-!(p & 1), block_h);
|
|
|
|
} else {
|
|
|
|
h_extend_var(dst + end_x - (p & 1), dst_stride,
|
|
|
|
-!(p & 1), (p + 1) >> 1, block_h);
|
|
|
|
}
|
|
|
|
}
|
2012-12-15 20:46:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#if ARCH_X86_32
|
|
|
|
static av_noinline void emulated_edge_mc_mmx(uint8_t *buf, const uint8_t *src,
|
2013-10-14 04:13:10 +03:00
|
|
|
ptrdiff_t buf_stride,
|
|
|
|
ptrdiff_t src_stride,
|
2012-12-15 20:46:02 +03:00
|
|
|
int block_w, int block_h,
|
|
|
|
int src_x, int src_y, int w, int h)
|
|
|
|
{
|
2013-10-14 04:13:10 +03:00
|
|
|
emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h,
|
2013-09-20 15:01:19 +03:00
|
|
|
src_x, src_y, w, h, vfixtbl_mmx, &ff_emu_edge_vvar_mmx,
|
|
|
|
hfixtbl_mmx, &ff_emu_edge_hvar_mmx);
|
2012-12-15 20:46:02 +03:00
|
|
|
}
|
|
|
|
|
2013-11-15 15:56:05 +03:00
|
|
|
static av_noinline void emulated_edge_mc_sse(uint8_t *buf, const uint8_t *src,
|
2013-10-14 04:13:10 +03:00
|
|
|
ptrdiff_t buf_stride,
|
|
|
|
ptrdiff_t src_stride,
|
2012-12-15 20:46:02 +03:00
|
|
|
int block_w, int block_h,
|
|
|
|
int src_x, int src_y, int w, int h)
|
|
|
|
{
|
2013-10-14 04:13:10 +03:00
|
|
|
emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h,
|
2013-10-24 13:54:32 +03:00
|
|
|
src_x, src_y, w, h, vfixtbl_sse, &ff_emu_edge_vvar_sse,
|
2014-06-28 06:33:52 +03:00
|
|
|
hfixtbl_mmx, &ff_emu_edge_hvar_mmx);
|
2013-10-24 13:54:32 +03:00
|
|
|
}
|
2013-10-10 04:24:20 +03:00
|
|
|
#endif
|
2013-10-24 13:54:32 +03:00
|
|
|
|
2013-11-15 15:56:05 +03:00
|
|
|
static av_noinline void emulated_edge_mc_sse2(uint8_t *buf, const uint8_t *src,
|
|
|
|
ptrdiff_t buf_stride,
|
|
|
|
ptrdiff_t src_stride,
|
2013-10-24 13:54:32 +03:00
|
|
|
int block_w, int block_h,
|
2013-10-24 13:54:32 +03:00
|
|
|
int src_x, int src_y, int w,
|
|
|
|
int h)
|
2013-10-24 13:54:32 +03:00
|
|
|
{
|
2013-11-15 15:56:05 +03:00
|
|
|
emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h,
|
|
|
|
src_x, src_y, w, h, vfixtbl_sse, &ff_emu_edge_vvar_sse,
|
2013-10-24 13:54:32 +03:00
|
|
|
hfixtbl_sse2, &ff_emu_edge_hvar_sse2);
|
2012-12-15 20:46:02 +03:00
|
|
|
}
|
2014-09-24 00:42:35 +03:00
|
|
|
|
|
|
|
#if HAVE_AVX2_EXTERNAL
|
|
|
|
static av_noinline void emulated_edge_mc_avx2(uint8_t *buf, const uint8_t *src,
|
|
|
|
ptrdiff_t buf_stride,
|
|
|
|
ptrdiff_t src_stride,
|
|
|
|
int block_w, int block_h,
|
|
|
|
int src_x, int src_y, int w,
|
|
|
|
int h)
|
|
|
|
{
|
|
|
|
emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h,
|
|
|
|
src_x, src_y, w, h, vfixtbl_sse, &ff_emu_edge_vvar_sse,
|
|
|
|
hfixtbl_avx2, &ff_emu_edge_hvar_avx2);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_AVX2_EXTERNAL */
|
2012-12-15 20:46:02 +03:00
|
|
|
#endif /* HAVE_YASM */
|
|
|
|
|
|
|
|
void ff_prefetch_mmxext(uint8_t *buf, ptrdiff_t stride, int h);
|
|
|
|
void ff_prefetch_3dnow(uint8_t *buf, ptrdiff_t stride, int h);
|
|
|
|
|
2013-02-01 12:31:59 +03:00
|
|
|
av_cold void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc)
|
2012-12-15 20:46:02 +03:00
|
|
|
{
|
|
|
|
#if HAVE_YASM
|
2013-07-17 21:19:24 +03:00
|
|
|
int cpu_flags = av_get_cpu_flags();
|
2012-12-15 20:46:02 +03:00
|
|
|
|
|
|
|
#if ARCH_X86_32
|
2013-08-20 15:46:58 +03:00
|
|
|
if (EXTERNAL_MMX(cpu_flags) && bpc <= 8) {
|
2012-12-15 20:46:02 +03:00
|
|
|
ctx->emulated_edge_mc = emulated_edge_mc_mmx;
|
|
|
|
}
|
2013-08-20 15:46:58 +03:00
|
|
|
if (EXTERNAL_AMD3DNOW(cpu_flags)) {
|
2012-12-15 20:46:02 +03:00
|
|
|
ctx->prefetch = ff_prefetch_3dnow;
|
|
|
|
}
|
|
|
|
#endif /* ARCH_X86_32 */
|
2013-08-20 15:46:58 +03:00
|
|
|
if (EXTERNAL_MMXEXT(cpu_flags)) {
|
2012-12-15 20:46:02 +03:00
|
|
|
ctx->prefetch = ff_prefetch_mmxext;
|
|
|
|
}
|
2013-10-24 13:54:32 +03:00
|
|
|
#if ARCH_X86_32
|
2013-08-20 15:46:58 +03:00
|
|
|
if (EXTERNAL_SSE(cpu_flags) && bpc <= 8) {
|
2012-12-15 20:46:02 +03:00
|
|
|
ctx->emulated_edge_mc = emulated_edge_mc_sse;
|
|
|
|
}
|
2013-10-24 13:54:32 +03:00
|
|
|
#endif /* ARCH_X86_32 */
|
|
|
|
if (EXTERNAL_SSE2(cpu_flags) && bpc <= 8) {
|
|
|
|
ctx->emulated_edge_mc = emulated_edge_mc_sse2;
|
|
|
|
}
|
2014-09-24 00:42:35 +03:00
|
|
|
#if HAVE_AVX2_EXTERNAL
|
|
|
|
if (EXTERNAL_AVX2(cpu_flags) && bpc <= 8) {
|
|
|
|
ctx->emulated_edge_mc = emulated_edge_mc_avx2;
|
|
|
|
}
|
|
|
|
#endif
|
2012-12-15 20:46:02 +03:00
|
|
|
#endif /* HAVE_YASM */
|
|
|
|
}
|