~phatforge/libav/fixup

« back to all changes in this revision

Viewing changes to libavcodec/dct.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2011-04-30 14:27:42 UTC
  • mfrom: (1.1.2 experimental)
  • Revision ID: james.westby@ubuntu.com-20110430142742-quvblxk1tj6adlh5
Tags: 4:0.7~b1-1ubuntu1
* Merge from debian. Remaining changes:
  - don't build against libfaad, libdirac, librtmp and libopenjpeg
    (all in universe)
  - explicitly --enable-pic on powerpc, cf. LP #654666
  - different arm configure bits that should probably better be
    merged into debian
* Cherry-picked from git: 
  - install doc/APIChanges and refer to them in NEWS.Debian (Closes: #623682)
  - don't try to install non-existing documentation, fixes FTBFS on powerpc

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
5
5
 * Copyright (c) 2010 Vitor Sessak
6
6
 *
7
 
 * This file is part of FFmpeg.
 
7
 * This file is part of Libav.
8
8
 *
9
 
 * FFmpeg is free software; you can redistribute it and/or
 
9
 * Libav is free software; you can redistribute it and/or
10
10
 * modify it under the terms of the GNU Lesser General Public
11
11
 * License as published by the Free Software Foundation; either
12
12
 * version 2.1 of the License, or (at your option) any later version.
13
13
 *
14
 
 * FFmpeg is distributed in the hope that it will be useful,
 
14
 * Libav is distributed in the hope that it will be useful,
15
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
17
 * Lesser General Public License for more details.
18
18
 *
19
19
 * You should have received a copy of the GNU Lesser General Public
20
 
 * License along with FFmpeg; if not, write to the Free Software
 
20
 * License along with Libav; if not, write to the Free Software
21
21
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22
22
 */
23
23
 
29
29
 
30
30
#include <math.h>
31
31
#include "libavutil/mathematics.h"
32
 
#include "fft.h"
 
32
#include "dct.h"
 
33
 
 
34
#define DCT32_FLOAT
 
35
#include "dct32.c"
33
36
 
34
37
/* sin((M_PI * x / (2*n)) */
35
38
#define SIN(s,n,x) (s->costab[(n) - (x)])
55
58
    }
56
59
 
57
60
    data[n/2] *= 2;
58
 
    ff_rdft_calc(&ctx->rdft, data);
 
61
    ctx->rdft.rdft_calc(&ctx->rdft, data);
59
62
 
60
63
    data[0] *= 0.5f;
61
64
 
89
92
        data[n - i] = tmp1 + s;
90
93
    }
91
94
 
92
 
    ff_rdft_calc(&ctx->rdft, data);
 
95
    ctx->rdft.rdft_calc(&ctx->rdft, data);
93
96
    data[n] = data[1];
94
97
    data[1] = next;
95
98
 
117
120
 
118
121
    data[1] = 2 * next;
119
122
 
120
 
    ff_rdft_calc(&ctx->rdft, data);
 
123
    ctx->rdft.rdft_calc(&ctx->rdft, data);
121
124
 
122
125
    for (i = 0; i < n / 2; i++) {
123
126
        float tmp1 = data[i        ] * inv_n;
148
151
        data[n-i-1] = tmp1 - s;
149
152
    }
150
153
 
151
 
    ff_rdft_calc(&ctx->rdft, data);
 
154
    ctx->rdft.rdft_calc(&ctx->rdft, data);
152
155
 
153
156
    next = data[1] * 0.5;
154
157
    data[1] *= -1;
167
170
    }
168
171
}
169
172
 
170
 
void ff_dct_calc(DCTContext *s, FFTSample *data)
 
173
static void dct32_func(DCTContext *ctx, FFTSample *data)
171
174
{
172
 
    s->dct_calc(s, data);
 
175
    ctx->dct32(data, data);
173
176
}
174
177
 
175
178
av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
200
203
    case DCT_III: s->dct_calc = ff_dct_calc_III_c; break;
201
204
    case DST_I  : s->dct_calc = ff_dst_calc_I_c; break;
202
205
    }
 
206
 
 
207
    if (inverse == DCT_II && nbits == 5)
 
208
        s->dct_calc = dct32_func;
 
209
 
 
210
    s->dct32 = dct32;
 
211
    if (HAVE_MMX)     ff_dct_init_mmx(s);
 
212
 
203
213
    return 0;
204
214
}
205
215