Mercurial > libavcodec.hg
annotate h264dspenc.c @ 12197:fbf4d5b1b664 libavcodec
Remove FF_MM_SSE2/3 flags for CPUs where this is generally not faster than
regular MMX code. Examples of this are the Core1 CPU. Instead, set a new flag,
FF_MM_SSE2/3SLOW, which can be checked for particular SSE2/3 functions that
have been checked specifically on such CPUs and are actually faster than
their MMX counterparts.
In addition, use this flag to enable particular VP8 and LPC SSE2 functions
that are faster than their MMX counterparts.
Based on a patch by Loren Merritt <lorenm AT u washington edu>.
author | rbultje |
---|---|
date | Mon, 19 Jul 2010 22:38:23 +0000 |
parents | 7dd2a45249a9 |
children |
rev | line source |
---|---|
5410 | 1 /* |
2 * H.264/MPEG-4 Part 10 (Base profile) encoder. | |
3 * | |
4 * DSP functions | |
5 * | |
6 * Copyright (c) 2006 Expertisecentrum Digitale Media, UHasselt | |
7 * | |
8 * FFmpeg is free software; you can redistribute it and/or | |
9 * modify it under the terms of the GNU Lesser General Public | |
10 * License as published by the Free Software Foundation; either | |
11 * version 2.1 of the License, or (at your option) any later version. | |
12 * | |
13 * FFmpeg is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Lesser General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU Lesser General Public | |
19 * License along with FFmpeg; if not, write to the Free Software | |
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
21 */ | |
22 | |
23 /** | |
11644
7dd2a45249a9
Remove explicit filename from Doxygen @file commands.
diego
parents:
10867
diff
changeset
|
24 * @file |
5410 | 25 * H.264 encoder related DSP utils |
26 * | |
27 */ | |
28 | |
29 #include "dsputil.h" | |
30 | |
31 #define H264_DCT_PART1(X) \ | |
32 a = block[0][X]+block[3][X]; \ | |
33 c = block[0][X]-block[3][X]; \ | |
34 b = block[1][X]+block[2][X]; \ | |
35 d = block[1][X]-block[2][X]; \ | |
36 pieces[0][X] = a+b; \ | |
37 pieces[2][X] = a-b; \ | |
38 pieces[1][X] = (c<<1)+d; \ | |
39 pieces[3][X] = c-(d<<1); | |
40 | |
41 #define H264_DCT_PART2(X) \ | |
42 a = pieces[X][0]+pieces[X][3]; \ | |
43 c = pieces[X][0]-pieces[X][3]; \ | |
44 b = pieces[X][1]+pieces[X][2]; \ | |
45 d = pieces[X][1]-pieces[X][2]; \ | |
46 block[0][X] = a+b; \ | |
47 block[2][X] = a-b; \ | |
48 block[1][X] = (c<<1)+d; \ | |
49 block[3][X] = c-(d<<1); | |
50 | |
51 /** | |
52 * Transform the provided matrix using the H.264 modified DCT. | |
53 * @note | |
54 * we'll always work with transposed input blocks, to avoid having to make a | |
55 * distinction between C and mmx implementations. | |
56 * | |
57 * @param block transposed input block | |
58 */ | |
59 static void h264_dct_c(DCTELEM block[4][4]) | |
60 { | |
61 DCTELEM pieces[4][4]; | |
62 DCTELEM a, b, c, d; | |
63 | |
64 H264_DCT_PART1(0); | |
65 H264_DCT_PART1(1); | |
66 H264_DCT_PART1(2); | |
67 H264_DCT_PART1(3); | |
68 H264_DCT_PART2(0); | |
69 H264_DCT_PART2(1); | |
70 H264_DCT_PART2(2); | |
71 H264_DCT_PART2(3); | |
72 } | |
73 | |
10867 | 74 av_cold void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx) |
5410 | 75 { |
76 c->h264_dct = h264_dct_c; | |
77 } | |
78 |