annotate h264dspenc.c @ 12330:18c7965807bf libavcodec

Change max_framesize for small final frame.
author jbr
date Sat, 31 Jul 2010 20:52:33 +0000
parents 7dd2a45249a9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5410
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
1 /*
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
2 * H.264/MPEG-4 Part 10 (Base profile) encoder.
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
3 *
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
4 * DSP functions
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
5 *
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
6 * Copyright (c) 2006 Expertisecentrum Digitale Media, UHasselt
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
7 *
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
12 *
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
16 * Lesser General Public License for more details.
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
17 *
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
21 */
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
22
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
23 /**
11644
7dd2a45249a9 Remove explicit filename from Doxygen @file commands.
diego
parents: 10867
diff changeset
24 * @file
5410
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
25 * H.264 encoder related DSP utils
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
26 *
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
27 */
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
28
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
29 #include "dsputil.h"
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
30
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
31 #define H264_DCT_PART1(X) \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
32 a = block[0][X]+block[3][X]; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
33 c = block[0][X]-block[3][X]; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
34 b = block[1][X]+block[2][X]; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
35 d = block[1][X]-block[2][X]; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
36 pieces[0][X] = a+b; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
37 pieces[2][X] = a-b; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
38 pieces[1][X] = (c<<1)+d; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
39 pieces[3][X] = c-(d<<1);
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
40
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
41 #define H264_DCT_PART2(X) \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
42 a = pieces[X][0]+pieces[X][3]; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
43 c = pieces[X][0]-pieces[X][3]; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
44 b = pieces[X][1]+pieces[X][2]; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
45 d = pieces[X][1]-pieces[X][2]; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
46 block[0][X] = a+b; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
47 block[2][X] = a-b; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
48 block[1][X] = (c<<1)+d; \
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
49 block[3][X] = c-(d<<1);
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
50
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
51 /**
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
52 * Transform the provided matrix using the H.264 modified DCT.
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
53 * @note
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
54 * we'll always work with transposed input blocks, to avoid having to make a
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
55 * distinction between C and mmx implementations.
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
56 *
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
57 * @param block transposed input block
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
58 */
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
59 static void h264_dct_c(DCTELEM block[4][4])
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
60 {
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
61 DCTELEM pieces[4][4];
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
62 DCTELEM a, b, c, d;
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
63
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
64 H264_DCT_PART1(0);
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
65 H264_DCT_PART1(1);
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
66 H264_DCT_PART1(2);
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
67 H264_DCT_PART1(3);
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
68 H264_DCT_PART2(0);
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
69 H264_DCT_PART2(1);
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
70 H264_DCT_PART2(2);
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
71 H264_DCT_PART2(3);
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
72 }
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
73
10867
bf309c7ce615 More av_cold for infrequently called functions.
zuxy
parents: 8718
diff changeset
74 av_cold void ff_h264dspenc_init(DSPContext* c, AVCodecContext *avctx)
5410
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
75 {
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
76 c->h264_dct = h264_dct_c;
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
77 }
1efd5aa20168 Rename h264dsp.c to h264dspenc.c
takis
parents:
diff changeset
78