Mercurial > libavcodec.hg
annotate aacenc.h @ 12494:94eaea836bf4 libavcodec
Check avctx width/height more thoroughly (e.g. all values 0 except width would
have been accepted before).
Also do not fail if they are invalid but instead override them to 0.
This allows decoding e.g. MPEG video when only the container values are corrupted.
For encoding a value of 0,0 of course makes no sense, but was allowed
through before and will be caught by an extra check in the encode function.
author | reimar |
---|---|
date | Wed, 15 Sep 2010 04:46:55 +0000 |
parents | 73f923159384 |
children |
rev | line source |
---|---|
9935
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
1 /* |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
2 * AAC encoder |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
3 * Copyright (C) 2008 Konstantin Shishkov |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
4 * |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
5 * This file is part of FFmpeg. |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
6 * |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
11 * |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
16 * |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
20 */ |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
21 |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
22 #ifndef AVCODEC_AACENC_H |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
23 #define AVCODEC_AACENC_H |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
24 |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
25 #include "avcodec.h" |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
26 #include "put_bits.h" |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
27 #include "dsputil.h" |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
28 |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
29 #include "aac.h" |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
30 |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
31 #include "psymodel.h" |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
32 |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
33 struct AACEncContext; |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
34 |
9936 | 35 typedef struct AACCoefficientsEncoder { |
9935
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
36 void (*search_for_quantizers)(AVCodecContext *avctx, struct AACEncContext *s, |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
37 SingleChannelElement *sce, const float lambda); |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
38 void (*encode_window_bands_info)(struct AACEncContext *s, SingleChannelElement *sce, |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
39 int win, int group_len, const float lambda); |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
40 void (*quantize_and_encode_band)(struct AACEncContext *s, PutBitContext *pb, const float *in, int size, |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
41 int scale_idx, int cb, const float lambda); |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
42 void (*search_for_ms)(struct AACEncContext *s, ChannelElement *cpe, const float lambda); |
9936 | 43 } AACCoefficientsEncoder; |
9935
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
44 |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
45 extern AACCoefficientsEncoder ff_aac_coders[]; |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
46 |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
47 /** |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
48 * AAC encoder context |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
49 */ |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
50 typedef struct AACEncContext { |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
51 PutBitContext pb; |
10199 | 52 FFTContext mdct1024; ///< long (1024 samples) frame transform context |
53 FFTContext mdct128; ///< short (128 samples) frame transform context | |
9935
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
54 DSPContext dsp; |
11369 | 55 DECLARE_ALIGNED(16, FFTSample, output)[2048]; ///< temporary buffer for MDCT input coefficients |
9935
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
56 int16_t* samples; ///< saved preprocessed input |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
57 |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
58 int samplerate_index; ///< MPEG-4 samplerate index |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
59 |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
60 ChannelElement *cpe; ///< channel elements |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
61 FFPsyContext psy; |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
62 struct FFPsyPreprocessContext* psypp; |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
63 AACCoefficientsEncoder *coder; |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
64 int cur_channel; |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
65 int last_frame; |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
66 float lambda; |
11731
73f923159384
aacenc: Use exact values when quantizing, not fuzzy values.
alexc
parents:
11369
diff
changeset
|
67 DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients |
11369 | 68 DECLARE_ALIGNED(16, float, scoefs)[1024]; ///< scaled coefficients |
9935
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
69 } AACEncContext; |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
70 |
d09283aeeef8
Merge the AAC encoder from SoC svn. It is still considered experimental.
alexc
parents:
diff
changeset
|
71 #endif /* AVCODEC_AACENC_H */ |