annotate pcm_tablegen.c @ 12391:4be72e19ab0e libavcodec

imc: fix undefined float to int conversion Conversion of an out of range float to int is undefined. Clipping to the final range first avoids such problems. This fixes decoding on MIPS, which handles these conversions differently from many other CPUs.
author mru
date Thu, 19 Aug 2010 16:51:26 +0000
parents 263b4ef7ad87
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11571
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
1 /*
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
2 * Generate a header file for hardcoded PCM tables
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
3 *
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
4 * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
5 *
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
6 * This file is part of FFmpeg.
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
7 *
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
12 *
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
16 * Lesser General Public License for more details.
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
17 *
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
21 */
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
22
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
23 #include <stdlib.h>
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
24 #define CONFIG_HARDCODED_TABLES 0
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
25 #include "pcm_tablegen.h"
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
26 #include "tableprint.h"
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
27
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
28 int main(void)
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
29 {
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
30 pcm_alaw_tableinit();
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
31 pcm_ulaw_tableinit();
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
32
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
33 write_fileheader();
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
34
11980
263b4ef7ad87 tablegen: implement and use WRITE_ARRAY macros
flameeyes
parents: 11979
diff changeset
35 WRITE_ARRAY("static const", uint8_t, linear_to_alaw);
263b4ef7ad87 tablegen: implement and use WRITE_ARRAY macros
flameeyes
parents: 11979
diff changeset
36 WRITE_ARRAY("static const", uint8_t, linear_to_ulaw);
11571
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
37
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
38 return 0;
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
39 }
7d324b40c3d6 Allow hardcoding of ulaw and alaw tables.
reimar
parents:
diff changeset
40