[x264-devel] [PATCH 16/32] common: Move shared tables to a common file

Vittorio Giovara vittorio.giovara at gmail.com
Fri Jan 20 15:20:41 CET 2017


---
 Makefile        |  2 +-
 common/common.h |  1 +
 common/tables.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 common/tables.h | 35 +++++++++++++++++++++++++++++++++++
 encoder/set.c   | 22 ----------------------
 5 files changed, 86 insertions(+), 23 deletions(-)
 create mode 100644 common/tables.c
 create mode 100644 common/tables.h

diff --git a/Makefile b/Makefile
index 3350855..e704008 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ SRCS = common/mc.c common/predict.c common/pixel.c common/macroblock.c \
        common/common.c common/osdep.c common/rectangle.c \
        common/set.c common/quant.c common/deblock.c common/vlc.c \
        common/mvpred.c common/bitstream.c \
-       common/log.c common/mem.c common/picture.c common/mathematics.c common/param.c \
+       common/log.c common/mem.c common/picture.c common/mathematics.c common/param.c common/tables.c \
        encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
        encoder/set.c encoder/macroblock.c encoder/cabac.c \
        encoder/cavlc.c encoder/encoder.c encoder/lookahead.c
diff --git a/common/common.h b/common/common.h
index 2e21658..d4d94c0 100644
--- a/common/common.h
+++ b/common/common.h
@@ -110,6 +110,7 @@ do {\
 #include "log.h"
 #include "mem.h"
 #include "mathematics.h"
+#include "tables.h"
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdlib.h>
diff --git a/common/tables.c b/common/tables.c
new file mode 100644
index 0000000..fa4c9a2
--- /dev/null
+++ b/common/tables.c
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * tables.c: const tables
+ *****************************************************************************
+ * Copyright (C) 2003-2017 x264 project
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *          Loren Merritt <lorenm at u.washington.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing at x264.com.
+ *****************************************************************************/
+
+#include "tables.h"
+
+const x264_level_t x264_levels[] =
+{
+    { 10,    1485,    99,    396,     64,    175,  64, 64,  0, 2, 0, 0, 1 },
+    {  9,    1485,    99,    396,    128,    350,  64, 64,  0, 2, 0, 0, 1 }, /* "1b" */
+    { 11,    3000,   396,    900,    192,    500, 128, 64,  0, 2, 0, 0, 1 },
+    { 12,    6000,   396,   2376,    384,   1000, 128, 64,  0, 2, 0, 0, 1 },
+    { 13,   11880,   396,   2376,    768,   2000, 128, 64,  0, 2, 0, 0, 1 },
+    { 20,   11880,   396,   2376,   2000,   2000, 128, 64,  0, 2, 0, 0, 1 },
+    { 21,   19800,   792,   4752,   4000,   4000, 256, 64,  0, 2, 0, 0, 0 },
+    { 22,   20250,  1620,   8100,   4000,   4000, 256, 64,  0, 2, 0, 0, 0 },
+    { 30,   40500,  1620,   8100,  10000,  10000, 256, 32, 22, 2, 0, 1, 0 },
+    { 31,  108000,  3600,  18000,  14000,  14000, 512, 16, 60, 4, 1, 1, 0 },
+    { 32,  216000,  5120,  20480,  20000,  20000, 512, 16, 60, 4, 1, 1, 0 },
+    { 40,  245760,  8192,  32768,  20000,  25000, 512, 16, 60, 4, 1, 1, 0 },
+    { 41,  245760,  8192,  32768,  50000,  62500, 512, 16, 24, 2, 1, 1, 0 },
+    { 42,  522240,  8704,  34816,  50000,  62500, 512, 16, 24, 2, 1, 1, 1 },
+    { 50,  589824, 22080, 110400, 135000, 135000, 512, 16, 24, 2, 1, 1, 1 },
+    { 51,  983040, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 },
+    { 52, 2073600, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 },
+    { 0 }
+};
diff --git a/common/tables.h b/common/tables.h
new file mode 100644
index 0000000..02e86d7
--- /dev/null
+++ b/common/tables.h
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * tables.h: const tables
+ *****************************************************************************
+ * Copyright (C) 2003-2017 x264 project
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *          Loren Merritt <lorenm at u.washington.edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
+ *
+ * This program is also available under a commercial proprietary license.
+ * For more information, contact us at licensing at x264.com.
+ *****************************************************************************/
+
+#ifndef COMMON_TABLES_H
+#define COMMON_TABLES_H
+
+#include <stdint.h>
+#include "x264.h"
+
+extern const x264_level_t x264_levels[];
+
+#endif
diff --git a/encoder/set.c b/encoder/set.c
index 5421eeb..c741baf 100644
--- a/encoder/set.c
+++ b/encoder/set.c
@@ -781,28 +781,6 @@ int x264_sei_avcintra_vanc_write( x264_t *h, bs_t *s, int len )
     return 0;
 }
 
-const x264_level_t x264_levels[] =
-{
-    { 10,    1485,    99,    396,     64,    175,  64, 64,  0, 2, 0, 0, 1 },
-    {  9,    1485,    99,    396,    128,    350,  64, 64,  0, 2, 0, 0, 1 }, /* "1b" */
-    { 11,    3000,   396,    900,    192,    500, 128, 64,  0, 2, 0, 0, 1 },
-    { 12,    6000,   396,   2376,    384,   1000, 128, 64,  0, 2, 0, 0, 1 },
-    { 13,   11880,   396,   2376,    768,   2000, 128, 64,  0, 2, 0, 0, 1 },
-    { 20,   11880,   396,   2376,   2000,   2000, 128, 64,  0, 2, 0, 0, 1 },
-    { 21,   19800,   792,   4752,   4000,   4000, 256, 64,  0, 2, 0, 0, 0 },
-    { 22,   20250,  1620,   8100,   4000,   4000, 256, 64,  0, 2, 0, 0, 0 },
-    { 30,   40500,  1620,   8100,  10000,  10000, 256, 32, 22, 2, 0, 1, 0 },
-    { 31,  108000,  3600,  18000,  14000,  14000, 512, 16, 60, 4, 1, 1, 0 },
-    { 32,  216000,  5120,  20480,  20000,  20000, 512, 16, 60, 4, 1, 1, 0 },
-    { 40,  245760,  8192,  32768,  20000,  25000, 512, 16, 60, 4, 1, 1, 0 },
-    { 41,  245760,  8192,  32768,  50000,  62500, 512, 16, 24, 2, 1, 1, 0 },
-    { 42,  522240,  8704,  34816,  50000,  62500, 512, 16, 24, 2, 1, 1, 1 },
-    { 50,  589824, 22080, 110400, 135000, 135000, 512, 16, 24, 2, 1, 1, 1 },
-    { 51,  983040, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 },
-    { 52, 2073600, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 },
-    { 0 }
-};
-
 #define ERROR(...)\
 {\
     if( verbose )\
-- 
2.10.0



More information about the x264-devel mailing list