summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMohamed Tarek <mt@rockbox.org>2010-04-30 12:20:25 +0000
committerMohamed Tarek <mt@rockbox.org>2010-04-30 12:20:25 +0000
commitfe147cec651486d39967f24d0d1bbe6ae1cd067b (patch)
treeef15055d39c17e05c91f591b5d4f264bfd421e5e /apps
parentcf43e5083b9e0f87de262ea31fd8067225ebfcda (diff)
downloadrockbox-fe147cec651486d39967f24d0d1bbe6ae1cd067b.tar.gz
rockbox-fe147cec651486d39967f24d0d1bbe6ae1cd067b.tar.bz2
rockbox-fe147cec651486d39967f24d0d1bbe6ae1cd067b.zip
Modify the ffmpeg source files in apps/codecs/libwmapro in order to compile the codec standalone.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25764 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs/libwmapro/Makefile11
-rw-r--r--apps/codecs/libwmapro/README.rockbox33
-rw-r--r--apps/codecs/libwmapro/avcodec.h12
-rw-r--r--apps/codecs/libwmapro/bitstream.c3
-rw-r--r--apps/codecs/libwmapro/dsputil.c49
-rw-r--r--apps/codecs/libwmapro/fft.c4
-rw-r--r--apps/codecs/libwmapro/fft.h2
-rw-r--r--apps/codecs/libwmapro/libavutil/avutil.h6
-rw-r--r--apps/codecs/libwmapro/libavutil/bswap.h2
-rw-r--r--apps/codecs/libwmapro/libavutil/common.h3
-rw-r--r--apps/codecs/libwmapro/libavutil/internal.h6
-rw-r--r--apps/codecs/libwmapro/libavutil/intreadwrite.h2
-rw-r--r--apps/codecs/libwmapro/libavutil/mathematics.c4
-rw-r--r--apps/codecs/libwmapro/libavutil/mathematics.h6
-rw-r--r--apps/codecs/libwmapro/libavutil/mem.c2
-rw-r--r--apps/codecs/libwmapro/mdct_tablegen.h2
-rw-r--r--apps/codecs/libwmapro/wma.c8
-rw-r--r--apps/codecs/libwmapro/wmaprodec.c20
18 files changed, 123 insertions, 52 deletions
diff --git a/apps/codecs/libwmapro/Makefile b/apps/codecs/libwmapro/Makefile
new file mode 100644
index 0000000000..74334ffad5
--- /dev/null
+++ b/apps/codecs/libwmapro/Makefile
@@ -0,0 +1,11 @@
+STD = c99
+LINK = -lm
+CFLAGS = -Wall -std=$(STD)
+TARGET = test
+OBJS = wmaprodec.c wma.c dsputil.c mdct.c fft.c bitstream.c libavutil/log.c libavutil/mem.c libavutil/mathematics.c
+$(TARGET): $(OBJS)
+ gcc $(CFLAGS) $(OBJS) $(LINK) -o $(TARGET)
+
+clean:
+ rm -f $(TARGET) *~ *.o libavutil/*.o
+
diff --git a/apps/codecs/libwmapro/README.rockbox b/apps/codecs/libwmapro/README.rockbox
new file mode 100644
index 0000000000..9b6e7d7507
--- /dev/null
+++ b/apps/codecs/libwmapro/README.rockbox
@@ -0,0 +1,33 @@
+Library: libwmapro
+Imported: 2010-04-30 by Mohamed Tarek
+
+This set of files form the files needed from ffmpeg's libavcodec and libavutil
+to build a standalone wma professional decoder.
+
+LICENSING INFORMATION
+
+ffmpeg is licensed under the Lesser GNU General Public License and the file
+wmaprodec.c is copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion
+and copyright (c) 2008 - 2009 Sascha Sommer, Benjamin Larsson.
+
+IMPORT DETAILS
+
+Based on ffmpeg svn r228866 dated 15 April 2010.
+
+Currently, the files contain minimal changes from their original state in order
+to be able to compile cleanly.
+
+The file wmaprodec.c contains a main function that is just a stub to make sure
+linking is done properly and without errors.
+
+COMPILING
+
+A make file is included that would compile and link the files when the "make"
+command is executed without arguments in any Unix-like environment.
+
+The file porduces an output binary called "test" that, as of now (30 April 2010)
+, is still useless.
+
+To clean the compiler output and retain just the source code, the following
+command should be executed:
+make clean
diff --git a/apps/codecs/libwmapro/avcodec.h b/apps/codecs/libwmapro/avcodec.h
index add4b100ae..da67b32fa2 100644
--- a/apps/codecs/libwmapro/avcodec.h
+++ b/apps/codecs/libwmapro/avcodec.h
@@ -1090,7 +1090,7 @@ typedef struct AVCodecContext {
* - encoding: MUST be set by user.
* - decoding: Set by libavcodec.
*/
- AVRational time_base;
+ //AVRational time_base;
/* video only */
/**
@@ -1116,7 +1116,7 @@ typedef struct AVCodecContext {
* - encoding: Set by user.
* - decoding: Set by libavcodec.
*/
- enum PixelFormat pix_fmt;
+ //enum PixelFormat pix_fmt;
/**
* Frame rate emulation. If not zero, the lower layer (i.e. format handler)
@@ -1660,7 +1660,7 @@ typedef struct AVCodecContext {
* - encoding: Set by user.
* - decoding: Set by libavcodec.
*/
- AVRational sample_aspect_ratio;
+ //AVRational sample_aspect_ratio;
/**
* the picture in the bitstream
@@ -2677,7 +2677,7 @@ typedef struct AVCodec {
* Will be called when seeking
*/
void (*flush)(AVCodecContext *);
- const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
+ //const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0}
const enum PixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1
/**
* Descriptive name for the codec, meant to be more human readable than name.
@@ -2719,7 +2719,7 @@ typedef struct AVHWAccel {
*
* Only hardware accelerated formats are supported here.
*/
- enum PixelFormat pix_fmt;
+ //enum PixelFormat pix_fmt;
/**
* Hardware accelerated codec capabilities.
@@ -3885,7 +3885,7 @@ int av_parse_video_frame_size(int *width_ptr, int *height_ptr, const char *str);
* @param[in,out] frame_rate pointer to the AVRational which will contain the detected
* frame rate
*/
-int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
+//int av_parse_video_frame_rate(AVRational *frame_rate, const char *str);
/**
* Logs a generic warning message about a missing feature. This function is
diff --git a/apps/codecs/libwmapro/bitstream.c b/apps/codecs/libwmapro/bitstream.c
index 1e24099cc8..47234e10e1 100644
--- a/apps/codecs/libwmapro/bitstream.c
+++ b/apps/codecs/libwmapro/bitstream.c
@@ -65,7 +65,8 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
int i;
if(length==0) return;
-
+/* The following define was just added to make the codec (wma pro) compile */
+#define CONFIG_SMALL 0
if(CONFIG_SMALL || words < 16 || put_bits_count(pb)&7){
for(i=0; i<words; i++) put_bits(pb, 16, AV_RB16(src + 2*i));
}else{
diff --git a/apps/codecs/libwmapro/dsputil.c b/apps/codecs/libwmapro/dsputil.c
index bbfdb6ae8d..b09311925a 100644
--- a/apps/codecs/libwmapro/dsputil.c
+++ b/apps/codecs/libwmapro/dsputil.c
@@ -29,17 +29,18 @@
#include "avcodec.h"
#include "dsputil.h"
-#include "simple_idct.h"
-#include "faandct.h"
-#include "faanidct.h"
+//#include "simple_idct.h"
+//#include "faandct.h"
+//#include "faanidct.h"
#include "mathops.h"
-#include "mpegvideo.h"
-#include "config.h"
-#include "lpc.h"
-#include "ac3dec.h"
-#include "vorbis.h"
-#include "png.h"
+//#include "mpegvideo.h"
+//#include "config.h"
+//#include "lpc.h"
+//#include "ac3dec.h"
+//#include "vorbis.h"
+//#include "png.h"
+#if 0
uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP] = {0, };
uint32_t ff_squareTbl[512] = {0, };
@@ -3797,6 +3798,8 @@ WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c)
WRAPPER8_16_SQ(rd8x8_c, rd16_c)
WRAPPER8_16_SQ(bit8x8_c, bit16_c)
+#endif /* 0 */
+
static void vector_fmul_c(float *dst, const float *src, int len){
int i;
for(i=0; i<len; i++)
@@ -3838,7 +3841,7 @@ static void vector_fmul_scalar_c(float *dst, const float *src, float mul,
for (i = 0; i < len; i++)
dst[i] = src[i] * mul;
}
-
+#if 0
static void vector_fmul_sv_scalar_2_c(float *dst, const float *src,
const float **sv, float mul, int len)
{
@@ -3911,6 +3914,7 @@ static void int32_to_float_fmul_scalar_c(float *dst, const int *src, float mul,
dst[i] = src[i] * mul;
}
+
static inline uint32_t clipf_c_one(uint32_t a, uint32_t mini,
uint32_t maxi, uint32_t maxisign)
{
@@ -4176,9 +4180,10 @@ int ff_check_alignment(void){
}
return 0;
}
-
+#endif
av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
{
+#if 0
int i;
ff_check_alignment();
@@ -4486,20 +4491,22 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
#if CONFIG_LPC
c->lpc_compute_autocorr = ff_lpc_compute_autocorr;
#endif
+
+#endif /* 0 */
c->vector_fmul = vector_fmul_c;
c->vector_fmul_reverse = vector_fmul_reverse_c;
c->vector_fmul_add = vector_fmul_add_c;
c->vector_fmul_window = ff_vector_fmul_window_c;
- c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
- c->vector_clipf = vector_clipf_c;
- c->float_to_int16 = ff_float_to_int16_c;
- c->float_to_int16_interleave = ff_float_to_int16_interleave_c;
- c->scalarproduct_int16 = scalarproduct_int16_c;
- c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;
- c->scalarproduct_float = scalarproduct_float_c;
- c->butterflies_float = butterflies_float_c;
+ //c->int32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c;
+ //c->vector_clipf = vector_clipf_c;
+ //c->float_to_int16 = ff_float_to_int16_c;
+ //c->float_to_int16_interleave = ff_float_to_int16_interleave_c;
+ //c->scalarproduct_int16 = scalarproduct_int16_c;
+ //c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;
+ //c->scalarproduct_float = scalarproduct_float_c;
+ //c->butterflies_float = butterflies_float_c;
c->vector_fmul_scalar = vector_fmul_scalar_c;
-
+#if 0
c->vector_fmul_sv_scalar[0] = vector_fmul_sv_scalar_2_c;
c->vector_fmul_sv_scalar[1] = vector_fmul_sv_scalar_4_c;
@@ -4561,5 +4568,5 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
default:
av_log(avctx, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
}
+#endif /* 0 */
}
-
diff --git a/apps/codecs/libwmapro/fft.c b/apps/codecs/libwmapro/fft.c
index 7275d98e9f..bc1b4f1796 100644
--- a/apps/codecs/libwmapro/fft.c
+++ b/apps/codecs/libwmapro/fft.c
@@ -109,11 +109,11 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
#endif
s->exptab1 = NULL;
s->split_radix = 1;
-
+#if 0
if (ARCH_ARM) ff_fft_init_arm(s);
if (HAVE_ALTIVEC) ff_fft_init_altivec(s);
if (HAVE_MMX) ff_fft_init_mmx(s);
-
+#endif
if (s->split_radix) {
for(j=4; j<=nbits; j++) {
ff_init_ff_cos_tabs(j);
diff --git a/apps/codecs/libwmapro/fft.h b/apps/codecs/libwmapro/fft.h
index 1f5b2e86da..26d51e984a 100644
--- a/apps/codecs/libwmapro/fft.h
+++ b/apps/codecs/libwmapro/fft.h
@@ -23,7 +23,7 @@
#define AVCODEC_FFT_H
#include <stdint.h>
-#include "config.h"
+//#include "config.h"
#include "libavutil/mem.h"
#include "avfft.h"
diff --git a/apps/codecs/libwmapro/libavutil/avutil.h b/apps/codecs/libwmapro/libavutil/avutil.h
index 1523de6753..1b858f1fe6 100644
--- a/apps/codecs/libwmapro/libavutil/avutil.h
+++ b/apps/codecs/libwmapro/libavutil/avutil.h
@@ -81,9 +81,9 @@ enum AVMediaType {
#include "common.h"
#include "error.h"
#include "mathematics.h"
-#include "rational.h"
-#include "intfloat_readwrite.h"
+//#include "rational.h"
+//#include "intfloat_readwrite.h"
#include "log.h"
-#include "pixfmt.h"
+//#include "pixfmt.h"
#endif /* AVUTIL_AVUTIL_H */
diff --git a/apps/codecs/libwmapro/libavutil/bswap.h b/apps/codecs/libwmapro/libavutil/bswap.h
index 74c7af3026..5743e126b8 100644
--- a/apps/codecs/libwmapro/libavutil/bswap.h
+++ b/apps/codecs/libwmapro/libavutil/bswap.h
@@ -27,7 +27,7 @@
#define AVUTIL_BSWAP_H
#include <stdint.h>
-#include "config.h"
+//#include "config.h"
#include "attributes.h"
#if ARCH_ARM
diff --git a/apps/codecs/libwmapro/libavutil/common.h b/apps/codecs/libwmapro/libavutil/common.h
index fae0b5b09b..48732a29dd 100644
--- a/apps/codecs/libwmapro/libavutil/common.h
+++ b/apps/codecs/libwmapro/libavutil/common.h
@@ -290,7 +290,8 @@ static inline av_const int av_ceil_log2(int x)
#include "mem.h"
-#ifdef HAVE_AV_CONFIG_H
+//#ifdef HAVE_AV_CONFIG_H
+#if 1
# include "internal.h"
#endif /* HAVE_AV_CONFIG_H */
diff --git a/apps/codecs/libwmapro/libavutil/internal.h b/apps/codecs/libwmapro/libavutil/internal.h
index b47db3d8c6..2b8da1d8c2 100644
--- a/apps/codecs/libwmapro/libavutil/internal.h
+++ b/apps/codecs/libwmapro/libavutil/internal.h
@@ -34,9 +34,9 @@
#include <stdint.h>
#include <stddef.h>
#include <assert.h>
-#include "config.h"
+//#include "config.h"
#include "attributes.h"
-#include "timer.h"
+//#include "timer.h"
#ifndef attribute_align_arg
#if (!defined(__ICC) || __ICC > 1110) && AV_GCC_VERSION_AT_LEAST(4,2)
@@ -191,7 +191,7 @@
}\
}
-#include "libm.h"
+//#include "libm.h"
/**
* Returns NULL if CONFIG_SMALL is true, otherwise the argument
diff --git a/apps/codecs/libwmapro/libavutil/intreadwrite.h b/apps/codecs/libwmapro/libavutil/intreadwrite.h
index c8026f0872..87098d707d 100644
--- a/apps/codecs/libwmapro/libavutil/intreadwrite.h
+++ b/apps/codecs/libwmapro/libavutil/intreadwrite.h
@@ -20,7 +20,7 @@
#define AVUTIL_INTREADWRITE_H
#include <stdint.h>
-#include "config.h"
+//#include "config.h"
#include "bswap.h"
#include "common.h"
diff --git a/apps/codecs/libwmapro/libavutil/mathematics.c b/apps/codecs/libwmapro/libavutil/mathematics.c
index 81d47c1bf1..04f3e870d1 100644
--- a/apps/codecs/libwmapro/libavutil/mathematics.c
+++ b/apps/codecs/libwmapro/libavutil/mathematics.c
@@ -129,7 +129,7 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){
int64_t av_rescale(int64_t a, int64_t b, int64_t c){
return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
}
-
+#if 0
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
int64_t b= bq.num * (int64_t)cq.den;
int64_t c= cq.num * (int64_t)bq.den;
@@ -143,7 +143,7 @@ int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){
if (av_rescale_rnd(ts_b, b, a, AV_ROUND_DOWN) < ts_a) return 1;
return 0;
}
-
+#endif
#ifdef TEST
#include "integer.h"
#undef printf
diff --git a/apps/codecs/libwmapro/libavutil/mathematics.h b/apps/codecs/libwmapro/libavutil/mathematics.h
index e198aef8cb..a09d3e9ad8 100644
--- a/apps/codecs/libwmapro/libavutil/mathematics.h
+++ b/apps/codecs/libwmapro/libavutil/mathematics.h
@@ -24,7 +24,7 @@
#include <stdint.h>
#include <math.h>
#include "attributes.h"
-#include "rational.h"
+//#include "rational.h"
#ifndef M_E
#define M_E 2.7182818284590452354 /* e */
@@ -84,7 +84,7 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_cons
/**
* Rescales a 64-bit integer by 2 rational numbers.
*/
-int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
+//int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
/**
* Compares 2 timestamps each in its own timebases.
@@ -92,7 +92,7 @@ int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
* is outside the int64_t range when represented in the others timebase.
* @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position
*/
-int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
+//int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
#endif /* AVUTIL_MATHEMATICS_H */
diff --git a/apps/codecs/libwmapro/libavutil/mem.c b/apps/codecs/libwmapro/libavutil/mem.c
index 4d776d4450..7c37e9be9f 100644
--- a/apps/codecs/libwmapro/libavutil/mem.c
+++ b/apps/codecs/libwmapro/libavutil/mem.c
@@ -24,7 +24,7 @@
* default memory allocator for libavutil
*/
-#include "config.h"
+//#include "config.h"
#include <limits.h>
#include <stdlib.h>
diff --git a/apps/codecs/libwmapro/mdct_tablegen.h b/apps/codecs/libwmapro/mdct_tablegen.h
index 1722c3b4d0..9f130aa6b5 100644
--- a/apps/codecs/libwmapro/mdct_tablegen.h
+++ b/apps/codecs/libwmapro/mdct_tablegen.h
@@ -24,7 +24,7 @@
// do not use libavutil/mathematics.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 "../libavutil/attributes.h"
+#include "libavutil/attributes.h"
#if !CONFIG_HARDCODED_TABLES
SINETABLE( 32);
diff --git a/apps/codecs/libwmapro/wma.c b/apps/codecs/libwmapro/wma.c
index 65780459aa..5306634c7c 100644
--- a/apps/codecs/libwmapro/wma.c
+++ b/apps/codecs/libwmapro/wma.c
@@ -21,11 +21,11 @@
#include "avcodec.h"
#include "wma.h"
-#include "wmadata.h"
+//#include "wmadata.h"
#undef NDEBUG
#include <assert.h>
-
+#if 0
/* XXX: use same run/length optimization as mpeg decoders */
//FIXME maybe split decode / encode or pass flag
static void init_coef_vlc(VLC *vlc, uint16_t **prun_table,
@@ -65,6 +65,7 @@ static void init_coef_vlc(VLC *vlc, uint16_t **prun_table,
*pint_table = int_table;
av_free(level_table);
}
+#endif /* 0 */
/**
*@brief Get the samples per frame for this stream.
@@ -106,6 +107,7 @@ int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version,
return frame_len_bits;
}
+#if 0
int ff_wma_init(AVCodecContext *avctx, int flags2)
{
WMACodecContext *s = avctx->priv_data;
@@ -426,7 +428,7 @@ int ff_wma_end(AVCodecContext *avctx)
return 0;
}
-
+#endif /* 0 */
/**
* Decode an uncompressed coefficient.
* @param s codec context
diff --git a/apps/codecs/libwmapro/wmaprodec.c b/apps/codecs/libwmapro/wmaprodec.c
index 82f1b3623b..88d317d5f6 100644
--- a/apps/codecs/libwmapro/wmaprodec.c
+++ b/apps/codecs/libwmapro/wmaprodec.c
@@ -94,6 +94,14 @@
#include "dsputil.h"
#include "wma.h"
+/* Some defines to make it compile */
+#define AVERROR_INVALIDDATA -1
+#define AVERROR_PATCHWELCOME -2
+#ifndef M_PI
+#define M_PI 3.14159265358979323846 /* pi */
+#endif
+#define av_log_ask_for_sample(...)
+
/** current decoder limitations */
#define WMAPRO_MAX_CHANNELS 8 ///< max number of handled channels
#define MAX_SUBFRAMES 32 ///< max number of subframes per channel
@@ -444,9 +452,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
/** calculate sine values for the decorrelation matrix */
for (i = 0; i < 33; i++)
sin64[i] = sin(i*M_PI / 64.0);
-
+#if 0
if (avctx->debug & FF_DEBUG_BITSTREAM)
dump_context(s);
+#endif
avctx->channel_layout = channel_mask;
return 0;
@@ -1559,7 +1568,7 @@ static void flush(AVCodecContext *avctx)
s->packet_loss = 1;
}
-
+#if 0
/**
*@brief wmapro decoder
*/
@@ -1576,3 +1585,10 @@ AVCodec wmapro_decoder = {
.flush= flush,
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"),
};
+#endif
+
+int main(void)
+{
+ /* possible test program - just here now to ensure linking is done properly */
+ return 0;
+}