aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNedeljko Babic <nedeljko.babic@imgtec.com>2015-07-20 13:36:20 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-22 23:23:29 +0200
commita9d986c2ced87d074ba307f9d6f213c5caae88ee (patch)
treeaa242d6e80065d4e739a44a5c07c9f06c69b44c0
parent4845f6687d4f1ddcb1ed57b09b09f284e8500fc1 (diff)
downloadffmpeg-a9d986c2ced87d074ba307f9d6f213c5caae88ee.tar.gz
avcodec: Minor macro polishing
Use macros from aac_defines.h for adding suffixes instead of local macros. Signed-off-by: Nedeljko Babic <nedeljko.babic@imgtec.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/cbrt_tablegen.h5
-rw-r--r--libavcodec/cbrt_tablegen_template.c2
-rw-r--r--libavcodec/sinewin.h17
-rw-r--r--libavcodec/sinewin_tablegen.h21
-rw-r--r--libavcodec/sinewin_tablegen_template.c14
5 files changed, 21 insertions, 38 deletions
diff --git a/libavcodec/cbrt_tablegen.h b/libavcodec/cbrt_tablegen.h
index 07ef392f65..27a3e3ae29 100644
--- a/libavcodec/cbrt_tablegen.h
+++ b/libavcodec/cbrt_tablegen.h
@@ -26,12 +26,11 @@
#include <stdint.h>
#include <math.h>
#include "libavutil/attributes.h"
+#include "libavcodec/aac_defines.h"
#if USE_FIXED
-#define CBRT_RENAME(a) a ## _fixed
#define CBRT(x) (int)floor((x).f * 8192 + 0.5)
#else
-#define CBRT_RENAME(a) a
#define CBRT(x) x.i
#endif
@@ -46,7 +45,7 @@
#else
static uint32_t cbrt_tab[1 << 13];
-static av_cold void CBRT_RENAME(cbrt_tableinit)(void)
+static av_cold void AAC_RENAME(cbrt_tableinit)(void)
{
if (!cbrt_tab[(1<<13) - 1]) {
int i;
diff --git a/libavcodec/cbrt_tablegen_template.c b/libavcodec/cbrt_tablegen_template.c
index a8c04956d8..9dd2cf5de6 100644
--- a/libavcodec/cbrt_tablegen_template.c
+++ b/libavcodec/cbrt_tablegen_template.c
@@ -27,7 +27,7 @@
int main(void)
{
- CBRT_RENAME(cbrt_tableinit)();
+ AAC_RENAME(cbrt_tableinit)();
write_fileheader();
diff --git a/libavcodec/sinewin.h b/libavcodec/sinewin.h
index 5f0a74afa9..27c107ce59 100644
--- a/libavcodec/sinewin.h
+++ b/libavcodec/sinewin.h
@@ -23,6 +23,7 @@
#include "config.h"
#include "libavutil/mem.h"
+#include "libavcodec/aac_defines.h"
#if CONFIG_HARDCODED_TABLES
# define SINETABLE_CONST const
@@ -34,28 +35,20 @@
#define USE_FIXED 0
#endif
-#if USE_FIXED
-#define SINEWIN_SUFFIX(a) a ## _fixed
-#define INTFLOAT int
-#else
-#define SINEWIN_SUFFIX(a) a
-#define INTFLOAT float
-#endif
-
#define SINETABLE(size) \
- SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, SINEWIN_SUFFIX(ff_sine_##size))[size]
+ SINETABLE_CONST DECLARE_ALIGNED(32, INTFLOAT, AAC_RENAME(ff_sine_##size))[size]
/**
* Generate a sine window.
* @param window pointer to half window
* @param n size of half window
*/
-void SINEWIN_SUFFIX(ff_sine_window_init)(INTFLOAT *window, int n);
+void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n);
/**
* initialize the specified entry of ff_sine_windows
*/
-void SINEWIN_SUFFIX(ff_init_ff_sine_windows)(int index);
+void AAC_RENAME(ff_init_ff_sine_windows)(int index);
extern SINETABLE( 32);
extern SINETABLE( 64);
@@ -67,6 +60,6 @@ extern SINETABLE(2048);
extern SINETABLE(4096);
extern SINETABLE(8192);
-extern SINETABLE_CONST INTFLOAT * const SINEWIN_SUFFIX(ff_sine_windows)[14];
+extern SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[14];
#endif /* AVCODEC_SINEWIN_H */
diff --git a/libavcodec/sinewin_tablegen.h b/libavcodec/sinewin_tablegen.h
index e1623b472a..4432135f19 100644
--- a/libavcodec/sinewin_tablegen.h
+++ b/libavcodec/sinewin_tablegen.h
@@ -27,6 +27,7 @@
// do not use libavutil/libm.h since this is compiled both
// for the host and the target and config.h is only valid for the target
#include <math.h>
+#include "libavcodec/aac_defines.h"
#include "libavutil/attributes.h"
#include "libavutil/common.h"
@@ -49,33 +50,29 @@ SINETABLE(8192);
#endif
#if USE_FIXED
-#define SINEWIN_SUFFIX(a) a ## _fixed
-#define INTFLOAT int
#define SIN_FIX(a) (int)floor((a) * 0x80000000 + 0.5)
#else
-#define SINEWIN_SUFFIX(a) a
-#define INTFLOAT float
#define SIN_FIX(a) a
#endif
-SINETABLE_CONST INTFLOAT * const SINEWIN_SUFFIX(ff_sine_windows)[] = {
+SINETABLE_CONST INTFLOAT * const AAC_RENAME(ff_sine_windows)[] = {
NULL, NULL, NULL, NULL, NULL, // unused
- SINEWIN_SUFFIX(ff_sine_32) , SINEWIN_SUFFIX(ff_sine_64), SINEWIN_SUFFIX(ff_sine_128),
- SINEWIN_SUFFIX(ff_sine_256), SINEWIN_SUFFIX(ff_sine_512), SINEWIN_SUFFIX(ff_sine_1024),
- SINEWIN_SUFFIX(ff_sine_2048), SINEWIN_SUFFIX(ff_sine_4096), SINEWIN_SUFFIX(ff_sine_8192)
+ AAC_RENAME(ff_sine_32) , AAC_RENAME(ff_sine_64), AAC_RENAME(ff_sine_128),
+ AAC_RENAME(ff_sine_256), AAC_RENAME(ff_sine_512), AAC_RENAME(ff_sine_1024),
+ AAC_RENAME(ff_sine_2048), AAC_RENAME(ff_sine_4096), AAC_RENAME(ff_sine_8192)
};
// Generate a sine window.
-av_cold void SINEWIN_SUFFIX(ff_sine_window_init)(INTFLOAT *window, int n) {
+av_cold void AAC_RENAME(ff_sine_window_init)(INTFLOAT *window, int n) {
int i;
for(i = 0; i < n; i++)
window[i] = SIN_FIX(sinf((i + 0.5) * (M_PI / (2.0 * n))));
}
-av_cold void SINEWIN_SUFFIX(ff_init_ff_sine_windows)(int index) {
- assert(index >= 0 && index < FF_ARRAY_ELEMS(SINEWIN_SUFFIX(ff_sine_windows)));
+av_cold void AAC_RENAME(ff_init_ff_sine_windows)(int index) {
+ assert(index >= 0 && index < FF_ARRAY_ELEMS(AAC_RENAME(ff_sine_windows)));
#if !CONFIG_HARDCODED_TABLES
- SINEWIN_SUFFIX(ff_sine_window_init)(SINEWIN_SUFFIX(ff_sine_windows)[index], 1 << index);
+ AAC_RENAME(ff_sine_window_init)(AAC_RENAME(ff_sine_windows)[index], 1 << index);
#endif
}
diff --git a/libavcodec/sinewin_tablegen_template.c b/libavcodec/sinewin_tablegen_template.c
index 45547c43c4..43ce1ba82e 100644
--- a/libavcodec/sinewin_tablegen_template.c
+++ b/libavcodec/sinewin_tablegen_template.c
@@ -21,24 +21,18 @@
*/
#include <stdlib.h>
+#include "libavcodec/aac_defines.h"
#define CONFIG_HARDCODED_TABLES 0
#if USE_FIXED
-#define ADD_SUFFIX(a) a ## _fixed
-#define INTFLOAT int
#define WRITE_FUNC write_int32_t_array
-
#else
-
-#define ADD_SUFFIX(a) a
-#define INTFLOAT float
#define WRITE_FUNC write_float_array
-
#endif
#define SINETABLE_CONST
#define SINETABLE(size) \
- INTFLOAT ADD_SUFFIX(ff_sine_##size)[size]
+ INTFLOAT AAC_RENAME(ff_sine_##size)[size]
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
#include "sinewin_tablegen.h"
#include "tableprint.h"
@@ -50,9 +44,9 @@ int main(void)
write_fileheader();
for (i = 5; i <= 13; i++) {
- ADD_SUFFIX(ff_init_ff_sine_windows)(i);
+ AAC_RENAME(ff_init_ff_sine_windows)(i);
printf("SINETABLE(%4i) = {\n", 1 << i);
- WRITE_FUNC(ADD_SUFFIX(ff_sine_windows)[i], 1 << i);
+ WRITE_FUNC(AAC_RENAME(ff_sine_windows)[i], 1 << i);
printf("};\n");
}