2012-10-07 15:41:10 +00:00
|
|
|
/*
|
|
|
|
* VC-1 and WMV3 - DSP functions MMX-optimized
|
|
|
|
* Copyright (c) 2007 Christophe GISQUET <christophe.gisquet@free.fr>
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person
|
|
|
|
* obtaining a copy of this software and associated documentation
|
|
|
|
* files (the "Software"), to deal in the Software without
|
|
|
|
* restriction, including without limitation the rights to use,
|
|
|
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following
|
|
|
|
* conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
|
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
|
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "libavutil/cpu.h"
|
|
|
|
#include "libavutil/x86/cpu.h"
|
|
|
|
#include "libavcodec/vc1dsp.h"
|
2013-05-07 23:52:57 +00:00
|
|
|
#include "dsputil_x86.h"
|
2012-10-07 15:41:10 +00:00
|
|
|
#include "vc1dsp.h"
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#define LOOP_FILTER(EXT) \
|
|
|
|
void ff_vc1_v_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
|
|
|
|
void ff_vc1_h_loop_filter4_ ## EXT(uint8_t *src, int stride, int pq); \
|
|
|
|
void ff_vc1_v_loop_filter8_ ## EXT(uint8_t *src, int stride, int pq); \
|
|
|
|
void ff_vc1_h_loop_filter8_ ## EXT(uint8_t *src, int stride, int pq); \
|
|
|
|
\
|
|
|
|
static void vc1_v_loop_filter16_ ## EXT(uint8_t *src, int stride, int pq) \
|
|
|
|
{ \
|
|
|
|
ff_vc1_v_loop_filter8_ ## EXT(src, stride, pq); \
|
|
|
|
ff_vc1_v_loop_filter8_ ## EXT(src+8, stride, pq); \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
static void vc1_h_loop_filter16_ ## EXT(uint8_t *src, int stride, int pq) \
|
|
|
|
{ \
|
|
|
|
ff_vc1_h_loop_filter8_ ## EXT(src, stride, pq); \
|
|
|
|
ff_vc1_h_loop_filter8_ ## EXT(src+8*stride, stride, pq); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#if HAVE_YASM
|
2012-07-15 16:49:44 +00:00
|
|
|
LOOP_FILTER(mmxext)
|
2012-10-07 15:41:10 +00:00
|
|
|
LOOP_FILTER(sse2)
|
|
|
|
LOOP_FILTER(ssse3)
|
|
|
|
|
|
|
|
void ff_vc1_h_loop_filter8_sse4(uint8_t *src, int stride, int pq);
|
|
|
|
|
|
|
|
static void vc1_h_loop_filter16_sse4(uint8_t *src, int stride, int pq)
|
|
|
|
{
|
|
|
|
ff_vc1_h_loop_filter8_sse4(src, stride, pq);
|
|
|
|
ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq);
|
|
|
|
}
|
2013-02-26 16:29:48 +00:00
|
|
|
|
|
|
|
static void avg_vc1_mspel_mc00_mmxext(uint8_t *dst, const uint8_t *src,
|
2013-03-08 21:40:03 +00:00
|
|
|
ptrdiff_t stride, int rnd)
|
2013-02-26 16:29:48 +00:00
|
|
|
{
|
|
|
|
ff_avg_pixels8_mmxext(dst, src, stride, 8);
|
|
|
|
}
|
2012-10-07 15:41:10 +00:00
|
|
|
#endif /* HAVE_YASM */
|
|
|
|
|
2012-07-27 12:09:52 +00:00
|
|
|
void ff_put_vc1_chroma_mc8_nornd_mmx (uint8_t *dst, uint8_t *src,
|
2012-10-07 15:41:10 +00:00
|
|
|
int stride, int h, int x, int y);
|
2012-07-09 22:04:18 +00:00
|
|
|
void ff_avg_vc1_chroma_mc8_nornd_mmxext(uint8_t *dst, uint8_t *src,
|
|
|
|
int stride, int h, int x, int y);
|
2012-07-27 12:09:52 +00:00
|
|
|
void ff_avg_vc1_chroma_mc8_nornd_3dnow(uint8_t *dst, uint8_t *src,
|
2012-10-07 15:41:10 +00:00
|
|
|
int stride, int h, int x, int y);
|
2012-07-27 12:09:52 +00:00
|
|
|
void ff_put_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, uint8_t *src,
|
2012-10-07 15:41:10 +00:00
|
|
|
int stride, int h, int x, int y);
|
2012-07-27 12:09:52 +00:00
|
|
|
void ff_avg_vc1_chroma_mc8_nornd_ssse3(uint8_t *dst, uint8_t *src,
|
2012-10-07 15:41:10 +00:00
|
|
|
int stride, int h, int x, int y);
|
|
|
|
|
|
|
|
|
|
|
|
av_cold void ff_vc1dsp_init_x86(VC1DSPContext *dsp)
|
|
|
|
{
|
2013-07-17 18:19:24 +00:00
|
|
|
int cpu_flags = av_get_cpu_flags();
|
2012-10-07 15:41:10 +00:00
|
|
|
|
2013-07-17 18:19:24 +00:00
|
|
|
if (INLINE_MMX(cpu_flags))
|
2012-10-07 15:41:10 +00:00
|
|
|
ff_vc1dsp_init_mmx(dsp);
|
|
|
|
|
2013-07-17 18:19:24 +00:00
|
|
|
if (INLINE_MMXEXT(cpu_flags))
|
2012-10-07 15:41:10 +00:00
|
|
|
ff_vc1dsp_init_mmxext(dsp);
|
|
|
|
|
|
|
|
#define ASSIGN_LF(EXT) \
|
|
|
|
dsp->vc1_v_loop_filter4 = ff_vc1_v_loop_filter4_ ## EXT; \
|
|
|
|
dsp->vc1_h_loop_filter4 = ff_vc1_h_loop_filter4_ ## EXT; \
|
|
|
|
dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_ ## EXT; \
|
|
|
|
dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_ ## EXT; \
|
|
|
|
dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_ ## EXT; \
|
|
|
|
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_ ## EXT
|
|
|
|
|
|
|
|
#if HAVE_YASM
|
2013-08-20 12:46:58 +00:00
|
|
|
if (EXTERNAL_MMX(cpu_flags)) {
|
2012-07-27 12:09:52 +00:00
|
|
|
dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_nornd_mmx;
|
2012-10-07 15:41:10 +00:00
|
|
|
}
|
2013-08-20 13:32:00 +00:00
|
|
|
if (EXTERNAL_AMD3DNOW(cpu_flags)) {
|
|
|
|
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_3dnow;
|
|
|
|
}
|
2013-08-20 12:46:58 +00:00
|
|
|
if (EXTERNAL_MMXEXT(cpu_flags)) {
|
2012-07-15 16:49:44 +00:00
|
|
|
ASSIGN_LF(mmxext);
|
2012-07-09 22:04:18 +00:00
|
|
|
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_mmxext;
|
2013-02-26 16:29:48 +00:00
|
|
|
|
|
|
|
dsp->avg_vc1_mspel_pixels_tab[0] = avg_vc1_mspel_mc00_mmxext;
|
2012-10-07 15:41:10 +00:00
|
|
|
}
|
2013-08-20 12:46:58 +00:00
|
|
|
if (EXTERNAL_SSE2(cpu_flags)) {
|
2012-10-07 15:41:10 +00:00
|
|
|
dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2;
|
|
|
|
dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2;
|
|
|
|
dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2;
|
|
|
|
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2;
|
|
|
|
}
|
2013-08-20 12:46:58 +00:00
|
|
|
if (EXTERNAL_SSSE3(cpu_flags)) {
|
2012-10-07 15:41:10 +00:00
|
|
|
ASSIGN_LF(ssse3);
|
2012-07-27 12:09:52 +00:00
|
|
|
dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_nornd_ssse3;
|
|
|
|
dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_ssse3;
|
2012-10-07 15:41:10 +00:00
|
|
|
}
|
2013-08-20 12:46:58 +00:00
|
|
|
if (EXTERNAL_SSE4(cpu_flags)) {
|
2012-10-07 15:41:10 +00:00
|
|
|
dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse4;
|
|
|
|
dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse4;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_YASM */
|
|
|
|
}
|