2010-08-30 18:34:13 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2010 Jason Garrett-Glaser
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* 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
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2010-09-08 17:07:14 +02:00
|
|
|
#include "libavutil/cpu.h"
|
2010-08-30 18:34:13 +02:00
|
|
|
#include "libavcodec/h264pred.h"
|
|
|
|
|
|
|
|
void ff_pred16x16_vertical_mmx (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_vertical_sse (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_horizontal_mmx (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_horizontal_mmxext(uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_horizontal_ssse3 (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_dc_mmxext (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_dc_sse2 (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_dc_ssse3 (uint8_t *src, int stride);
|
2010-10-06 00:06:18 +02:00
|
|
|
void ff_pred16x16_plane_h264_mmx (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_h264_mmx2 (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_h264_sse2 (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_h264_ssse3 (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_rv40_mmx (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_rv40_mmx2 (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_rv40_sse2 (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_rv40_ssse3 (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_svq3_mmx (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_svq3_mmx2 (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_svq3_sse2 (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_plane_svq3_ssse3 (uint8_t *src, int stride);
|
2010-08-30 18:34:13 +02:00
|
|
|
void ff_pred16x16_tm_vp8_mmx (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_tm_vp8_mmxext (uint8_t *src, int stride);
|
|
|
|
void ff_pred16x16_tm_vp8_sse2 (uint8_t *src, int stride);
|
2010-12-29 18:42:34 +01:00
|
|
|
void ff_pred8x8_top_dc_mmxext (uint8_t *src, int stride);
|
2010-08-30 18:34:13 +02:00
|
|
|
void ff_pred8x8_dc_rv40_mmxext (uint8_t *src, int stride);
|
2010-12-29 19:00:26 +01:00
|
|
|
void ff_pred8x8_dc_mmxext (uint8_t *src, int stride);
|
2010-08-30 18:34:13 +02:00
|
|
|
void ff_pred8x8_vertical_mmx (uint8_t *src, int stride);
|
|
|
|
void ff_pred8x8_horizontal_mmx (uint8_t *src, int stride);
|
|
|
|
void ff_pred8x8_horizontal_mmxext (uint8_t *src, int stride);
|
|
|
|
void ff_pred8x8_horizontal_ssse3 (uint8_t *src, int stride);
|
2010-10-06 00:06:18 +02:00
|
|
|
void ff_pred8x8_plane_mmx (uint8_t *src, int stride);
|
|
|
|
void ff_pred8x8_plane_mmx2 (uint8_t *src, int stride);
|
|
|
|
void ff_pred8x8_plane_sse2 (uint8_t *src, int stride);
|
|
|
|
void ff_pred8x8_plane_ssse3 (uint8_t *src, int stride);
|
2010-08-30 18:34:13 +02:00
|
|
|
void ff_pred8x8_tm_vp8_mmx (uint8_t *src, int stride);
|
|
|
|
void ff_pred8x8_tm_vp8_mmxext (uint8_t *src, int stride);
|
|
|
|
void ff_pred8x8_tm_vp8_sse2 (uint8_t *src, int stride);
|
|
|
|
void ff_pred8x8_tm_vp8_ssse3 (uint8_t *src, int stride);
|
2010-12-29 19:11:27 +01:00
|
|
|
void ff_pred8x8l_top_dc_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
|
|
|
|
void ff_pred8x8l_top_dc_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
|
2010-12-29 19:33:10 +01:00
|
|
|
void ff_pred8x8l_dc_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
|
|
|
|
void ff_pred8x8l_dc_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
|
2010-12-29 19:40:53 +01:00
|
|
|
void ff_pred8x8l_horizontal_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
|
|
|
|
void ff_pred8x8l_horizontal_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
|
2010-12-29 19:46:40 +01:00
|
|
|
void ff_pred8x8l_vertical_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
|
|
|
|
void ff_pred8x8l_vertical_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
|
2010-12-29 20:02:50 +01:00
|
|
|
void ff_pred8x8l_down_left_sse2 (uint8_t *src, int has_topleft, int has_topright, int stride);
|
|
|
|
void ff_pred8x8l_down_left_ssse3 (uint8_t *src, int has_topleft, int has_topright, int stride);
|
2010-12-29 20:12:02 +01:00
|
|
|
void ff_pred8x8l_down_right_mmxext (uint8_t *src, int has_topleft, int has_topright, int stride);
|
2010-08-30 18:34:13 +02:00
|
|
|
void ff_pred4x4_dc_mmxext (uint8_t *src, const uint8_t *topright, int stride);
|
2010-12-24 23:43:07 +01:00
|
|
|
void ff_pred4x4_down_left_mmxext (uint8_t *src, const uint8_t *topright, int stride);
|
2010-08-30 18:34:13 +02:00
|
|
|
void ff_pred4x4_tm_vp8_mmx (uint8_t *src, const uint8_t *topright, int stride);
|
|
|
|
void ff_pred4x4_tm_vp8_mmxext (uint8_t *src, const uint8_t *topright, int stride);
|
|
|
|
void ff_pred4x4_tm_vp8_ssse3 (uint8_t *src, const uint8_t *topright, int stride);
|
|
|
|
void ff_pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int stride);
|
|
|
|
|
|
|
|
void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
|
|
|
|
{
|
2010-09-08 17:07:14 +02:00
|
|
|
int mm_flags = av_get_cpu_flags();
|
2010-08-30 18:34:13 +02:00
|
|
|
|
|
|
|
#if HAVE_YASM
|
2010-09-04 11:59:08 +02:00
|
|
|
if (mm_flags & AV_CPU_FLAG_MMX) {
|
2010-08-30 18:34:13 +02:00
|
|
|
h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_mmx;
|
|
|
|
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx;
|
|
|
|
h->pred8x8 [VERT_PRED8x8] = ff_pred8x8_vertical_mmx;
|
|
|
|
h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx;
|
|
|
|
if (codec_id == CODEC_ID_VP8) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmx;
|
|
|
|
h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_mmx;
|
|
|
|
h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx;
|
2010-10-06 00:06:18 +02:00
|
|
|
} else {
|
|
|
|
h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx;
|
|
|
|
if (codec_id == CODEC_ID_SVQ3) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx;
|
|
|
|
} else if (codec_id == CODEC_ID_RV40) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx;
|
|
|
|
} else {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx;
|
|
|
|
}
|
2010-08-30 18:34:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-04 11:59:08 +02:00
|
|
|
if (mm_flags & AV_CPU_FLAG_MMX2) {
|
2010-08-30 18:34:13 +02:00
|
|
|
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext;
|
|
|
|
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmxext;
|
|
|
|
h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext;
|
2010-12-29 19:11:27 +01:00
|
|
|
#if CONFIG_GPL
|
|
|
|
h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_mmxext;
|
2010-12-29 19:33:10 +01:00
|
|
|
h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_mmxext;
|
2010-12-29 19:40:53 +01:00
|
|
|
h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_mmxext;
|
2010-12-29 19:46:40 +01:00
|
|
|
h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_mmxext;
|
2010-12-29 20:12:02 +01:00
|
|
|
h->pred8x8l [DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_mmxext;
|
2010-12-29 19:11:27 +01:00
|
|
|
#endif
|
2010-08-30 18:34:13 +02:00
|
|
|
h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext;
|
2010-12-29 18:34:00 +01:00
|
|
|
#if CONFIG_GPL
|
2010-12-24 23:43:07 +01:00
|
|
|
if (codec_id == CODEC_ID_VP8 || codec_id == CODEC_ID_H264)
|
|
|
|
h->pred4x4 [DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_mmxext;
|
2010-12-29 18:42:34 +01:00
|
|
|
if (codec_id == CODEC_ID_SVQ3 || codec_id == CODEC_ID_H264) {
|
|
|
|
h->pred8x8 [TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_mmxext;
|
2010-12-29 19:00:26 +01:00
|
|
|
h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_mmxext;
|
2010-12-29 18:42:34 +01:00
|
|
|
}
|
2010-12-29 18:34:00 +01:00
|
|
|
#endif
|
2010-08-30 18:34:13 +02:00
|
|
|
if (codec_id == CODEC_ID_VP8) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmxext;
|
|
|
|
h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext;
|
|
|
|
h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_mmxext;
|
|
|
|
h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmxext;
|
|
|
|
h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext;
|
2010-10-06 00:06:18 +02:00
|
|
|
} else {
|
|
|
|
h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_mmx2;
|
|
|
|
if (codec_id == CODEC_ID_SVQ3) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx2;
|
|
|
|
} else if (codec_id == CODEC_ID_RV40) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx2;
|
|
|
|
} else {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_mmx2;
|
|
|
|
}
|
2010-08-30 18:34:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-04 11:59:08 +02:00
|
|
|
if (mm_flags & AV_CPU_FLAG_SSE) {
|
2010-08-30 18:34:13 +02:00
|
|
|
h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse;
|
|
|
|
}
|
|
|
|
|
2010-09-04 11:59:08 +02:00
|
|
|
if (mm_flags & AV_CPU_FLAG_SSE2) {
|
2010-08-30 18:34:13 +02:00
|
|
|
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2;
|
2010-12-29 20:02:50 +01:00
|
|
|
#if CONFIG_GPL
|
|
|
|
h->pred8x8l [DIAG_DOWN_LEFT_PRED] = ff_pred8x8l_down_left_sse2;
|
|
|
|
#endif
|
2010-08-30 18:34:13 +02:00
|
|
|
if (codec_id == CODEC_ID_VP8) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2;
|
|
|
|
h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2;
|
2010-10-06 00:06:18 +02:00
|
|
|
} else {
|
|
|
|
h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_sse2;
|
|
|
|
if (codec_id == CODEC_ID_SVQ3) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_sse2;
|
|
|
|
} else if (codec_id == CODEC_ID_RV40) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_sse2;
|
|
|
|
} else {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_sse2;
|
|
|
|
}
|
2010-08-30 18:34:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-04 11:59:08 +02:00
|
|
|
if (mm_flags & AV_CPU_FLAG_SSSE3) {
|
2010-08-30 18:34:13 +02:00
|
|
|
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3;
|
|
|
|
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3;
|
|
|
|
h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3;
|
2010-12-29 19:11:27 +01:00
|
|
|
#if CONFIG_GPL
|
|
|
|
h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_ssse3;
|
2010-12-29 19:33:10 +01:00
|
|
|
h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_ssse3;
|
2010-12-29 19:40:53 +01:00
|
|
|
h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_ssse3;
|
2010-12-29 19:46:40 +01:00
|
|
|
h->pred8x8l [VERT_PRED ] = ff_pred8x8l_vertical_ssse3;
|
2010-12-29 20:02:50 +01:00
|
|
|
h->pred8x8l [DIAG_DOWN_LEFT_PRED] = ff_pred8x8l_down_left_ssse3;
|
2010-12-29 19:11:27 +01:00
|
|
|
#endif
|
2010-08-30 18:34:13 +02:00
|
|
|
if (codec_id == CODEC_ID_VP8) {
|
|
|
|
h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_ssse3;
|
|
|
|
h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3;
|
2010-10-06 00:06:18 +02:00
|
|
|
} else {
|
|
|
|
h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_plane_ssse3;
|
|
|
|
if (codec_id == CODEC_ID_SVQ3) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_ssse3;
|
|
|
|
} else if (codec_id == CODEC_ID_RV40) {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_ssse3;
|
|
|
|
} else {
|
|
|
|
h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_h264_ssse3;
|
|
|
|
}
|
2010-08-30 18:34:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|