annotate x86/h264_intrapred_init.c @ 12530:63edd10ad4bc libavcodec tip

Try to fix crashes introduced by r25218 r25218 made assumptions about the existence of past reference frames that weren't necessarily true.
author darkshikari
date Tue, 28 Sep 2010 09:06:22 +0000
parents 9fef0a8ddd63
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8430
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
1 /*
12438
33ecda76b2f2 Split intra prediction initialization (i.e. assigning of function pointers)
rbultje
parents: 12437
diff changeset
2 * Copyright (c) 2010 Jason Garrett-Glaser
8430
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
3 *
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
4 * This file is part of FFmpeg.
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
5 *
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
10 *
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
14 * Lesser General Public License for more details.
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
15 *
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
19 */
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
20
12475
9fef0a8ddd63 Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents: 12456
diff changeset
21 #include "libavutil/cpu.h"
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
22 #include "libavcodec/h264pred.h"
8430
7768bdfd4f7b Rename libavcodec/i386/ --> libavcodec/x86/.
diego
parents:
diff changeset
23
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
24 void ff_pred16x16_vertical_mmx (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
25 void ff_pred16x16_vertical_sse (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
26 void ff_pred16x16_horizontal_mmx (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
27 void ff_pred16x16_horizontal_mmxext(uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
28 void ff_pred16x16_horizontal_ssse3 (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
29 void ff_pred16x16_dc_mmxext (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
30 void ff_pred16x16_dc_sse2 (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
31 void ff_pred16x16_dc_ssse3 (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
32 void ff_pred16x16_tm_vp8_mmx (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
33 void ff_pred16x16_tm_vp8_mmxext (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
34 void ff_pred16x16_tm_vp8_sse2 (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
35 void ff_pred8x8_dc_rv40_mmxext (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
36 void ff_pred8x8_vertical_mmx (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
37 void ff_pred8x8_horizontal_mmx (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
38 void ff_pred8x8_horizontal_mmxext (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
39 void ff_pred8x8_horizontal_ssse3 (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
40 void ff_pred8x8_tm_vp8_mmx (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
41 void ff_pred8x8_tm_vp8_mmxext (uint8_t *src, int stride);
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
42 void ff_pred8x8_tm_vp8_sse2 (uint8_t *src, int stride);
11953
65470eea7561 Cosmetics: Fix indentation.
cehoyos
parents: 11951
diff changeset
43 void ff_pred8x8_tm_vp8_ssse3 (uint8_t *src, int stride);
12001
953a0949c789 Fix some intra pred MMX functions that used MMXEXT instructions
darkshikari
parents: 11993
diff changeset
44 void ff_pred4x4_dc_mmxext (uint8_t *src, const uint8_t *topright, int stride);
12003
3b761226ea35 Add mmx/mmxext/ssse3 4x4 TM intra pred functions for vp8
darkshikari
parents: 12001
diff changeset
45 void ff_pred4x4_tm_vp8_mmx (uint8_t *src, const uint8_t *topright, int stride);
3b761226ea35 Add mmx/mmxext/ssse3 4x4 TM intra pred functions for vp8
darkshikari
parents: 12001
diff changeset
46 void ff_pred4x4_tm_vp8_mmxext (uint8_t *src, const uint8_t *topright, int stride);
3b761226ea35 Add mmx/mmxext/ssse3 4x4 TM intra pred functions for vp8
darkshikari
parents: 12001
diff changeset
47 void ff_pred4x4_tm_vp8_ssse3 (uint8_t *src, const uint8_t *topright, int stride);
12004
2002ea7c06f6 MMXEXT version of vp8 4x4 vertical pred
darkshikari
parents: 12003
diff changeset
48 void ff_pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int stride);
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
49
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
50 void ff_h264_pred_init_x86(H264PredContext *h, int codec_id)
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
51 {
12475
9fef0a8ddd63 Move mm_support() from libavcodec to libavutil, make it a public
stefano
parents: 12456
diff changeset
52 int mm_flags = av_get_cpu_flags();
12012
2d70a8b0ec8a Add missing mm_support call toff_h264_pred_init_x86.
darkshikari
parents: 12004
diff changeset
53
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
54 #if HAVE_YASM
12456
a5ddb39627fd Rename FF_MM_ symbols related to CPU features flags as AV_CPU_FLAG_
stefano
parents: 12438
diff changeset
55 if (mm_flags & AV_CPU_FLAG_MMX) {
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
56 h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_mmx;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
57 h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmx;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
58 h->pred8x8 [VERT_PRED8x8] = ff_pred8x8_vertical_mmx;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
59 h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmx;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
60 if (codec_id == CODEC_ID_VP8) {
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
61 h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmx;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
62 h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_mmx;
12003
3b761226ea35 Add mmx/mmxext/ssse3 4x4 TM intra pred functions for vp8
darkshikari
parents: 12001
diff changeset
63 h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmx;
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
64 }
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
65 }
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
66
12456
a5ddb39627fd Rename FF_MM_ symbols related to CPU features flags as AV_CPU_FLAG_
stefano
parents: 12438
diff changeset
67 if (mm_flags & AV_CPU_FLAG_MMX2) {
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
68 h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_mmxext;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
69 h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_mmxext;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
70 h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_mmxext;
12001
953a0949c789 Fix some intra pred MMX functions that used MMXEXT instructions
darkshikari
parents: 11993
diff changeset
71 h->pred4x4 [DC_PRED ] = ff_pred4x4_dc_mmxext;
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
72 if (codec_id == CODEC_ID_VP8) {
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
73 h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_mmxext;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
74 h->pred8x8 [DC_PRED8x8 ] = ff_pred8x8_dc_rv40_mmxext;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
75 h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_mmxext;
12003
3b761226ea35 Add mmx/mmxext/ssse3 4x4 TM intra pred functions for vp8
darkshikari
parents: 12001
diff changeset
76 h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_mmxext;
12004
2002ea7c06f6 MMXEXT version of vp8 4x4 vertical pred
darkshikari
parents: 12003
diff changeset
77 h->pred4x4 [VERT_PRED ] = ff_pred4x4_vertical_vp8_mmxext;
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
78 }
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
79 }
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
80
12456
a5ddb39627fd Rename FF_MM_ symbols related to CPU features flags as AV_CPU_FLAG_
stefano
parents: 12438
diff changeset
81 if (mm_flags & AV_CPU_FLAG_SSE) {
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
82 h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_sse;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
83 }
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
84
12456
a5ddb39627fd Rename FF_MM_ symbols related to CPU features flags as AV_CPU_FLAG_
stefano
parents: 12438
diff changeset
85 if (mm_flags & AV_CPU_FLAG_SSE2) {
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
86 h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_sse2;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
87 if (codec_id == CODEC_ID_VP8) {
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
88 h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_tm_vp8_sse2;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
89 h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_sse2;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
90 }
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
91 }
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
92
12456
a5ddb39627fd Rename FF_MM_ symbols related to CPU features flags as AV_CPU_FLAG_
stefano
parents: 12438
diff changeset
93 if (mm_flags & AV_CPU_FLAG_SSSE3) {
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
94 h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_ssse3;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
95 h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_ssse3;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
96 h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_ssse3;
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
97 if (codec_id == CODEC_ID_VP8) {
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
98 h->pred8x8 [PLANE_PRED8x8] = ff_pred8x8_tm_vp8_ssse3;
12003
3b761226ea35 Add mmx/mmxext/ssse3 4x4 TM intra pred functions for vp8
darkshikari
parents: 12001
diff changeset
99 h->pred4x4 [TM_VP8_PRED ] = ff_pred4x4_tm_vp8_ssse3;
11951
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
100 }
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
101 }
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
102 #endif
afee30fe8c26 16x16 and 8x8c x86 SIMD intra pred functions for VP8 and H.264
darkshikari
parents: 11701
diff changeset
103 }