summaryrefslogtreecommitdiff
path: root/ffmpeg1/libavcodec/dv_tablegen.h
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-08-26 15:10:18 +0100
committerTim Redfern <tim@eclectronics.org>2013-08-26 15:10:18 +0100
commit150c9823e71a161e97003849cf8b2f55b21520bd (patch)
tree3559c840cf403d1386708b2591d58f928c7b160d /ffmpeg1/libavcodec/dv_tablegen.h
parentb4b1e2630c95d5e6014463f7608d59dc2322a3b8 (diff)
adding ffmpeg specific version
Diffstat (limited to 'ffmpeg1/libavcodec/dv_tablegen.h')
-rw-r--r--ffmpeg1/libavcodec/dv_tablegen.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/ffmpeg1/libavcodec/dv_tablegen.h b/ffmpeg1/libavcodec/dv_tablegen.h
new file mode 100644
index 0000000..e8cdc21
--- /dev/null
+++ b/ffmpeg1/libavcodec/dv_tablegen.h
@@ -0,0 +1,97 @@
+/*
+ * Header file for hardcoded DV tables
+ *
+ * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_DV_TABLEGEN_H
+#define AVCODEC_DV_TABLEGEN_H
+
+#include <stdint.h>
+
+#include "dv_vlc_data.h"
+
+#if CONFIG_SMALL
+#define DV_VLC_MAP_RUN_SIZE 15
+#define DV_VLC_MAP_LEV_SIZE 23
+#else
+#define DV_VLC_MAP_RUN_SIZE 64
+#define DV_VLC_MAP_LEV_SIZE 512 //FIXME sign was removed so this should be /2 but needs check
+#endif
+
+/* VLC encoding lookup table */
+typedef struct dv_vlc_pair {
+ uint32_t vlc;
+ uint32_t size;
+} dv_vlc_pair;
+
+#if CONFIG_HARDCODED_TABLES
+#define dv_vlc_map_tableinit()
+#include "libavcodec/dv_tables.h"
+#else
+static struct dv_vlc_pair dv_vlc_map[DV_VLC_MAP_RUN_SIZE][DV_VLC_MAP_LEV_SIZE];
+
+static void dv_vlc_map_tableinit(void)
+{
+ int i, j;
+ for (i = 0; i < NB_DV_VLC - 1; i++) {
+ if (dv_vlc_run[i] >= DV_VLC_MAP_RUN_SIZE)
+ continue;
+#if CONFIG_SMALL
+ if (dv_vlc_level[i] >= DV_VLC_MAP_LEV_SIZE)
+ continue;
+#endif
+
+ if (dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size != 0)
+ continue;
+
+ dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].vlc =
+ dv_vlc_bits[i] << (!!dv_vlc_level[i]);
+ dv_vlc_map[dv_vlc_run[i]][dv_vlc_level[i]].size =
+ dv_vlc_len[i] + (!!dv_vlc_level[i]);
+ }
+ for (i = 0; i < DV_VLC_MAP_RUN_SIZE; i++) {
+#if CONFIG_SMALL
+ for (j = 1; j < DV_VLC_MAP_LEV_SIZE; j++) {
+ if (dv_vlc_map[i][j].size == 0) {
+ dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
+ (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size));
+ dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size +
+ dv_vlc_map[0][j].size;
+ }
+ }
+#else
+ for (j = 1; j < DV_VLC_MAP_LEV_SIZE/2; j++) {
+ if (dv_vlc_map[i][j].size == 0) {
+ dv_vlc_map[i][j].vlc = dv_vlc_map[0][j].vlc |
+ (dv_vlc_map[i-1][0].vlc << (dv_vlc_map[0][j].size));
+ dv_vlc_map[i][j].size = dv_vlc_map[i-1][0].size +
+ dv_vlc_map[0][j].size;
+ }
+ dv_vlc_map[i][((uint16_t)(-j))&0x1ff].vlc =
+ dv_vlc_map[i][j].vlc | 1;
+ dv_vlc_map[i][((uint16_t)(-j))&0x1ff].size =
+ dv_vlc_map[i][j].size;
+ }
+#endif
+ }
+}
+#endif /* CONFIG_HARDCODED_TABLES */
+
+#endif /* AVCODEC_DV_TABLEGEN_H */