[SCM] libav/experimental: Add a simple base64 encoder for use in tests
siretart at users.alioth.debian.org
siretart at users.alioth.debian.org
Sun Jun 30 17:12:46 UTC 2013
The following commit has been merged in the experimental branch:
commit ce3a841da1a9d7ad6094a7b8e5f4c79a9a353211
Author: Måns Rullgård <mans at mansr.com>
Date: Mon Jul 26 23:43:56 2010 +0000
Add a simple base64 encoder for use in tests
Originally committed as revision 24526 to svn://svn.ffmpeg.org/ffmpeg/trunk
diff --git a/Makefile b/Makefile
index 8c0d5b6..bba9d9a 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ OBJS = $(addsuffix .o, $(PROGS-yes)) cmdutils.o
MANPAGES = $(addprefix doc/, $(addsuffix .1, $(PROGS-yes)))
HTMLPAGES = $(addprefix doc/, $(addsuffix -doc.html, $(PROGS-yes)))
TOOLS = $(addprefix tools/, $(addsuffix $(EXESUF), cws2fws pktdumper probetest qt-faststart trasher))
-HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr)
+HOSTPROGS = $(addprefix tests/, audiogen videogen rotozoom tiny_psnr base64)
BASENAMES = ffmpeg ffplay ffprobe ffserver
ALLPROGS = $(addsuffix $(EXESUF), $(BASENAMES))
@@ -159,7 +159,7 @@ testclean:
$(RM) -r tests/vsynth1 tests/vsynth2 tests/data
$(RM) $(addprefix tests/,$(CLEANSUFFIXES))
$(RM) tests/seek_test$(EXESUF) tests/seek_test.o
- $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr))
+ $(RM) $(addprefix tests/,$(addsuffix $(HOSTEXESUF),audiogen videogen rotozoom tiny_psnr base64))
clean:: testclean
$(RM) $(ALLPROGS) $(ALLPROGS_G)
diff --git a/libavcodec/mdct_tablegen.c b/tests/base64.c
similarity index 51%
copy from libavcodec/mdct_tablegen.c
copy to tests/base64.c
index 6205f06..75ba8bc 100644
--- a/libavcodec/mdct_tablegen.c
+++ b/tests/base64.c
@@ -1,8 +1,4 @@
/*
- * Generate a header file for hardcoded MDCT tables
- *
- * Copyright (c) 2009 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
- *
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
@@ -20,30 +16,38 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <stdlib.h>
-#define CONFIG_HARDCODED_TABLES 0
-#define SINETABLE_CONST
-#define SINETABLE(size) \
- float ff_sine_##size[size]
-#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-#include "mdct_tablegen.h"
-#include "tableprint.h"
+/*
+ * Based on libavutil/base64.c
+ */
+
+#include <stdio.h>
int main(void)
{
- int i;
+ static const char b64[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ unsigned i_bits = 0;
+ int i_shift = 0;
+ int out_len = 0;
+ int in;
- write_fileheader();
+#define putb64() do { \
+ putchar(b64[(i_bits << 6 >> i_shift) & 0x3f]); \
+ out_len++; \
+ i_shift -= 6; \
+ } while (0)
- for (i = 5; i <= 12; i++) {
- ff_init_ff_sine_windows(i);
- printf("SINETABLE(%4i) = {\n", 1 << i);
- write_float_array(ff_sine_windows[i], 1 << i);
- printf("};\n");
+ while ((in = getchar()) != EOF) {
+ i_bits = (i_bits << 8) + in;
+ i_shift += 8;
+ while (i_shift > 6)
+ putb64();
}
+ while (i_shift > 0)
+ putb64();
+ while (out_len++ & 3)
+ putchar('=');
+ putchar('\n');
return 0;
}
--
Libav/FFmpeg packaging
More information about the pkg-multimedia-commits
mailing list