summaryrefslogtreecommitdiff
path: root/apps/codecs
diff options
context:
space:
mode:
authorMohamed Tarek <mt@rockbox.org>2009-05-12 13:21:34 +0000
committerMohamed Tarek <mt@rockbox.org>2009-05-12 13:21:34 +0000
commitf2c18d6922257c6610f4c01ed09ce318295bee68 (patch)
treeb71ccdd43d0213c1b78bebbe7593ebb4d25306af /apps/codecs
parent950c4747e3c519372382e6b5a7e84bfd22e12d5c (diff)
downloadrockbox-f2c18d6922257c6610f4c01ed09ce318295bee68.zip
rockbox-f2c18d6922257c6610f4c01ed09ce318295bee68.tar.gz
rockbox-f2c18d6922257c6610f4c01ed09ce318295bee68.tar.bz2
rockbox-f2c18d6922257c6610f4c01ed09ce318295bee68.tar.xz
-Remove calls to av_log() and use DEBUGF/printf instead, thuse removing
libavutil/log.[c/h] and libavutil/avutil.h. -Take necessary defines to bitstream.h from libavutil/intreadwrite.h to remove the latter. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20918 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/libcook/Makefile.test2
-rw-r--r--apps/codecs/libcook/bitstream.c14
-rw-r--r--apps/codecs/libcook/bitstream.h28
-rw-r--r--apps/codecs/libcook/cook.c62
-rw-r--r--apps/codecs/libcook/libavutil/avutil.h63
-rw-r--r--apps/codecs/libcook/libavutil/internal.h4
-rw-r--r--apps/codecs/libcook/libavutil/intreadwrite.h192
-rw-r--r--apps/codecs/libcook/libavutil/log.c89
-rw-r--r--apps/codecs/libcook/libavutil/log.h116
-rw-r--r--apps/codecs/libcook/main.c11
10 files changed, 71 insertions, 510 deletions
diff --git a/apps/codecs/libcook/Makefile.test b/apps/codecs/libcook/Makefile.test
index cb8630d..d90cda2 100644
--- a/apps/codecs/libcook/Makefile.test
+++ b/apps/codecs/libcook/Makefile.test
@@ -1,5 +1,5 @@
CFLAGS = -Wall -O3
-OBJS = main.o bitstream.o cook.o libavutil/log.o libavutil/mem.o rm2wav.o
+OBJS = main.o bitstream.o cook.o libavutil/mem.o rm2wav.o
cooktest: $(OBJS)
gcc -o cooktest $(OBJS)
diff --git a/apps/codecs/libcook/bitstream.c b/apps/codecs/libcook/bitstream.c
index 6c8915d..3b0c0a7 100644
--- a/apps/codecs/libcook/bitstream.c
+++ b/apps/codecs/libcook/bitstream.c
@@ -152,7 +152,7 @@ static int build_table(VLC *vlc, int table_nb_bits,
table_size = 1 << table_nb_bits;
table_index = alloc_table(vlc, table_size, flags & (INIT_VLC_USE_STATIC|INIT_VLC_USE_NEW_STATIC));
#ifdef DEBUG_VLC
- av_log(NULL,AV_LOG_DEBUG,"new table index=%d size=%d code_prefix=%x n=%d\n",
+ printf("new table index=%d size=%d code_prefix=%x n=%d\n",
table_index, table_size, code_prefix, n_prefix);
#endif
if (table_index < 0)
@@ -176,7 +176,7 @@ static int build_table(VLC *vlc, int table_nb_bits,
else
GET_DATA(symbol, symbols, i, symbols_wrap, symbols_size);
#if defined(DEBUG_VLC) && 0
- av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code);
+ printf("i=%d n=%d code=0x%x\n", i, n, code);
#endif
/* if code matches the prefix, it is in the table */
n -= n_prefix;
@@ -193,11 +193,11 @@ static int build_table(VLC *vlc, int table_nb_bits,
if(flags & INIT_VLC_LE)
j = (code >> n_prefix) + (k<<n);
#ifdef DEBUG_VLC
- av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n",
+ printf("%4x: code=%d n=%d\n",
j, i, n);
#endif
if (table[j][1] /*bits*/ != 0) {
- av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
+ printf("incorrect codes\n");
return -1;
}
table[j][1] = n; //bits
@@ -208,7 +208,7 @@ static int build_table(VLC *vlc, int table_nb_bits,
n -= table_nb_bits;
j = (code >> ((flags & INIT_VLC_LE) ? n_prefix : n)) & ((1 << table_nb_bits) - 1);
#ifdef DEBUG_VLC
- av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n",
+ printf("%4x: n=%d (subtable)\n",
j, n);
#endif
/* compute table size */
@@ -297,7 +297,7 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
}
#ifdef DEBUG_VLC
- av_log(NULL,AV_LOG_DEBUG,"build table nb_codes=%d\n", nb_codes);
+ printf("build table nb_codes=%d\n", nb_codes);
#endif
if (build_table(vlc, nb_bits, nb_codes,
@@ -309,7 +309,7 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
return -1;
}
if((flags & INIT_VLC_USE_NEW_STATIC) && vlc->table_size != vlc->table_allocated)
- av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated);
+ printf("needed %d had %d\n", vlc->table_size, vlc->table_allocated);
return 0;
}
diff --git a/apps/codecs/libcook/bitstream.h b/apps/codecs/libcook/bitstream.h
index e3e3d77..2319a4d 100644
--- a/apps/codecs/libcook/bitstream.h
+++ b/apps/codecs/libcook/bitstream.h
@@ -31,10 +31,20 @@
#include <assert.h>
#include "libavutil/bswap.h"
#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/log.h"
+//#include "libavutil/log.h"
//#include "mathops.h"
+/* The following 2 defines are taken from libavutil/intreadwrite.h */
+#define AV_RB32(x) ((((const uint8_t*)(x))[0] << 24) | \
+ (((const uint8_t*)(x))[1] << 16) | \
+ (((const uint8_t*)(x))[2] << 8) | \
+ ((const uint8_t*)(x))[3])
+#define AV_WB32(p, d) do { \
+ ((uint8_t*)(p))[3] = (d); \
+ ((uint8_t*)(p))[2] = (d)>>8; \
+ ((uint8_t*)(p))[1] = (d)>>16; \
+ ((uint8_t*)(p))[0] = (d)>>24; } while(0)
+
#if defined(ALT_BITSTREAM_READER_LE) && !defined(ALT_BITSTREAM_READER)
# define ALT_BITSTREAM_READER
#endif
@@ -731,7 +741,7 @@ static inline int check_marker(GetBitContext *s, const char *msg)
{
int bit= get_bits1(s);
if(!bit)
- av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg);
+ printf("Marker bit missing %s\n", msg);
return bit;
}
@@ -892,17 +902,17 @@ static inline void print_bin(int bits, int n){
int i;
for(i=n-1; i>=0; i--){
- av_log(NULL, AV_LOG_DEBUG, "%d", (bits>>i)&1);
+ printf("%d", (bits>>i)&1);
}
for(i=n; i<24; i++)
- av_log(NULL, AV_LOG_DEBUG, " ");
+ printf(" ");
}
static inline int get_bits_trace(GetBitContext *s, int n, char *file, const char *func, int line){
int r= get_bits(s, n);
print_bin(r, n);
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line);
+ printf("%5d %2d %3d bit @%5d in %s %s:%d\n", r, n, r, get_bits_count(s)-n, file, func, line);
return r;
}
static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits, int max_depth, char *file, const char *func, int line){
@@ -914,7 +924,7 @@ static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], int bits
print_bin(bits2, len);
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line);
+ printf("%5d %2d %3d vlc @%5d in %s %s:%d\n", bits2, len, r, pos, file, func, line);
return r;
}
static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const char *func, int line){
@@ -922,7 +932,7 @@ static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const cha
int r= get_xbits(s, n);
print_bin(show, n);
- av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line);
+ printf("%5d %2d %3d xbt @%5d in %s %s:%d\n", show, n, r, get_bits_count(s)-n, file, func, line);
return r;
}
@@ -932,7 +942,7 @@ static inline int get_xbits_trace(GetBitContext *s, int n, char *file, const cha
#define get_vlc(s, vlc) get_vlc_trace(s, (vlc)->table, (vlc)->bits, 3, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#define get_vlc2(s, tab, bits, max) get_vlc_trace(s, tab, bits, max, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define tprintf(p, ...) av_log(p, AV_LOG_DEBUG, __VA_ARGS__)
+#define tprintf(p, ...) printf
#else //TRACE
#define tprintf(p, ...) {}
diff --git a/apps/codecs/libcook/cook.c b/apps/codecs/libcook/cook.c
index 5b2c59a..fd80c1b 100644
--- a/apps/codecs/libcook/cook.c
+++ b/apps/codecs/libcook/cook.c
@@ -70,7 +70,11 @@ const uint8_t ff_log2_tab[256]={
#define SUBBAND_SIZE 20
#define MAX_SUBPACKETS 5
//#define COOKDEBUG
-#define DEBUGF(message,args ...) av_log(NULL,AV_LOG_ERROR,message,## args)
+#if 0
+#define DEBUGF(message,args ...) printf
+#else
+#define DEBUGF(...)
+#endif
/**
* Random bit stream generator.
@@ -89,19 +93,19 @@ static int inline cook_random(COOKContext *q)
#ifdef COOKDEBUG
static void dump_int_table(int* table, int size, int delimiter) {
int i=0;
- av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
+ DEBUGF("\n[%d]: ",i);
for (i=0 ; i<size ; i++) {
- av_log(NULL, AV_LOG_ERROR, "%d, ", table[i]);
- if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
+ DEBUGF("%d, ", table[i]);
+ if ((i+1)%delimiter == 0) DEBUGF("\n[%d]: ",i+1);
}
}
static void dump_short_table(short* table, int size, int delimiter) {
int i=0;
- av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
+ DEBUGF("\n[%d]: ",i);
for (i=0 ; i<size ; i++) {
- av_log(NULL, AV_LOG_ERROR, "%d, ", table[i]);
- if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
+ DEBUGF("%d, ", table[i]);
+ if ((i+1)%delimiter == 0) DEBUGF("\n[%d]: ",i+1);
}
}
@@ -117,7 +121,7 @@ static av_cold int init_cook_vlc_tables(COOKContext *q) {
envelope_quant_index_huffbits[i], 1, 1,
envelope_quant_index_huffcodes[i], 2, 2, 0);
}
- av_log(NULL,AV_LOG_DEBUG,"sqvh VLC init\n");
+ DEBUGF("sqvh VLC init\n");
for (i=0 ; i<7 ; i++) {
result |= init_vlc (&q->sqvh[i], vhvlcsize_tab[i], vhsize_tab[i],
cvh_huffbits[i], 1, 1,
@@ -128,10 +132,10 @@ static av_cold int init_cook_vlc_tables(COOKContext *q) {
result |= init_vlc (&q->ccpl, 6, (1<<q->js_vlc_bits)-1,
ccpl_huffbits[q->js_vlc_bits-2], 1, 1,
ccpl_huffcodes[q->js_vlc_bits-2], 2, 2, 0);
- av_log(NULL,AV_LOG_DEBUG,"Joint-stereo VLC used.\n");
+ DEBUGF("Joint-stereo VLC used.\n");
}
- av_log(NULL,AV_LOG_ERROR,"VLC tables initialized. Result = %d\n",result);
+ DEBUGF("VLC tables initialized. Result = %d\n",result);
return result;
}
/*************** init functions end ***********/
@@ -188,7 +192,7 @@ av_cold int cook_decode_close(COOKContext *q)
{
int i;
//COOKContext *q = avctx->priv_data;
- av_log(NULL,AV_LOG_ERROR, "Deallocating memory.\n");
+ DEBUGF( "Deallocating memory.\n");
/* Free allocated memory buffers. */
av_free(q->decoded_bytes_buffer);
@@ -204,7 +208,7 @@ av_cold int cook_decode_close(COOKContext *q)
free_vlc(&q->ccpl);
}
- av_log(NULL,AV_LOG_ERROR,"Memory deallocated.\n");
+ DEBUGF("Memory deallocated.\n");
return 0;
}
@@ -650,9 +654,9 @@ static int decode_subpacket(COOKContext *q, const uint8_t *inbuffer,
int sub_packet_size, int16_t *outbuffer) {
/* packet dump */
// for (i=0 ; i<sub_packet_size ; i++) {
-// av_log(NULL, AV_LOG_ERROR, "%02x", inbuffer[i]);
+// DEBUGF("%02x", inbuffer[i]);
// }
-// av_log(NULL, AV_LOG_ERROR, "\n");
+// DEBUGF("\n");
decode_bytes_and_gain(q, inbuffer, &q->gains1);
@@ -710,9 +714,9 @@ int cook_decode_frame(RMContext *rmctx,COOKContext *q,
static void dump_cook_context(COOKContext *q)
{
//int i=0;
-#define PRINT(a,b) av_log(NULL,AV_LOG_ERROR," %s = %d\n", a, b);
- av_log(NULL,AV_LOG_ERROR,"COOKextradata\n");
- av_log(NULL,AV_LOG_ERROR,"cookversion=%x\n",q->cookversion);
+#define PRINT(a,b) DEBUGF(" %s = %d\n", a, b);
+ DEBUGF("COOKextradata\n");
+ DEBUGF("cookversion=%x\n",q->cookversion);
if (q->cookversion > STEREO) {
PRINT("js_subband_start",q->js_subband_start);
PRINT("js_vlc_bits",q->js_vlc_bits);
@@ -764,28 +768,28 @@ av_cold int cook_decode_init(RMContext *rmctx, COOKContext *q)
q->total_subbands = q->subbands;
/* Initialize version-dependent variables */
- av_log(NULL,AV_LOG_DEBUG,"q->cookversion=%x\n",q->cookversion);
+ DEBUGF("q->cookversion=%x\n",q->cookversion);
q->joint_stereo = 0;
switch (q->cookversion) {
case MONO:
if (q->nb_channels != 1) {
- av_log(NULL,AV_LOG_ERROR,"Container channels != 1, report sample!\n");
+ DEBUGF("Container channels != 1, report sample!\n");
return -1;
}
- av_log(NULL,AV_LOG_DEBUG,"MONO\n");
+ DEBUGF("MONO\n");
break;
case STEREO:
if (q->nb_channels != 1) {
q->bits_per_subpacket = q->bits_per_subpacket/2;
}
- av_log(NULL,AV_LOG_DEBUG,"STEREO\n");
+ DEBUGF("STEREO\n");
break;
case JOINT_STEREO:
if (q->nb_channels != 2) {
- av_log(NULL,AV_LOG_ERROR,"Container channels != 2, report sample!\n");
+ DEBUGF("Container channels != 2, report sample!\n");
return -1;
}
- av_log(NULL,AV_LOG_ERROR,"JOINT_STEREO\n");
+ DEBUGF("JOINT_STEREO\n");
if (q->extradata_size >= 16){
q->total_subbands = q->subbands + q->js_subband_start;
q->joint_stereo = 1;
@@ -798,11 +802,11 @@ av_cold int cook_decode_init(RMContext *rmctx, COOKContext *q)
}
break;
case MC_COOK:
- av_log(NULL,AV_LOG_ERROR,"MC_COOK not supported!\n");
+ DEBUGF("MC_COOK not supported!\n");
return -1;
break;
default:
- av_log(NULL,AV_LOG_ERROR,"Unknown Cook version, report sample!\n");
+ DEBUGF("Unknown Cook version, report sample!\n");
return -1;
break;
}
@@ -851,20 +855,20 @@ av_cold int cook_decode_init(RMContext *rmctx, COOKContext *q)
/* Try to catch some obviously faulty streams, othervise it might be exploitable */
if (q->total_subbands > 53) {
- av_log(NULL,AV_LOG_ERROR,"total_subbands > 53, report sample!\n");
+ DEBUGF("total_subbands > 53, report sample!\n");
return -1;
}
if (q->subbands > 50) {
- av_log(NULL,AV_LOG_ERROR,"subbands > 50, report sample!\n");
+ DEBUGF("subbands > 50, report sample!\n");
return -1;
}
if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) || (q->samples_per_channel == 1024)) {
} else {
- av_log(NULL,AV_LOG_ERROR,"unknown amount of samples_per_channel = %d, report sample!\n",q->samples_per_channel);
+ DEBUGF("unknown amount of samples_per_channel = %d, report sample!\n",q->samples_per_channel);
return -1;
}
if ((q->js_vlc_bits > 6) || (q->js_vlc_bits < 0)) {
- av_log(NULL,AV_LOG_ERROR,"q->js_vlc_bits = %d, only >= 0 and <= 6 allowed!\n",q->js_vlc_bits);
+ DEBUGF("q->js_vlc_bits = %d, only >= 0 and <= 6 allowed!\n",q->js_vlc_bits);
return -1;
}
diff --git a/apps/codecs/libcook/libavutil/avutil.h b/apps/codecs/libcook/libavutil/avutil.h
deleted file mode 100644
index c07e44d..0000000
--- a/apps/codecs/libcook/libavutil/avutil.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
- *
- * 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 AVUTIL_AVUTIL_H
-#define AVUTIL_AVUTIL_H
-
-/**
- * @file libavutil/avutil.h
- * external API header
- */
-
-
-#define AV_STRINGIFY(s) AV_TOSTRING(s)
-#define AV_TOSTRING(s) #s
-
-#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c)
-#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c
-#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
-
-#define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 0
-#define LIBAVUTIL_VERSION_MICRO 0
-
-#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
- LIBAVUTIL_VERSION_MINOR, \
- LIBAVUTIL_VERSION_MICRO)
-#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \
- LIBAVUTIL_VERSION_MINOR, \
- LIBAVUTIL_VERSION_MICRO)
-#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT
-
-#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION)
-
-/**
- * Returns the LIBAVUTIL_VERSION_INT constant.
- */
-unsigned avutil_version(void);
-
-#include "common.h"
-//#include "mathematics.h"
-//#include "rational.h"
-//#include "intfloat_readwrite.h"
-#include "log.h"
-//#include "pixfmt.h"
-
-#endif /* AVUTIL_AVUTIL_H */
diff --git a/apps/codecs/libcook/libavutil/internal.h b/apps/codecs/libcook/libavutil/internal.h
index f8f9418..c28b6f9 100644
--- a/apps/codecs/libcook/libavutil/internal.h
+++ b/apps/codecs/libcook/libavutil/internal.h
@@ -236,8 +236,8 @@ if((y)<(x)){\
#undef exit
#define exit exit_is_forbidden
#ifndef LIBAVFORMAT_BUILD
-#undef printf
-#define printf please_use_av_log_instead_of_printf
+//#undef printf
+//#define printf please_use_av_log_instead_of_printf
#undef fprintf
#define fprintf please_use_av_log_instead_of_fprintf
#undef puts
diff --git a/apps/codecs/libcook/libavutil/intreadwrite.h b/apps/codecs/libcook/libavutil/intreadwrite.h
deleted file mode 100644
index d27a500..0000000
--- a/apps/codecs/libcook/libavutil/intreadwrite.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * 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 AVUTIL_INTREADWRITE_H
-#define AVUTIL_INTREADWRITE_H
-
-#include <stdint.h>
-//#include "ffmpeg_config.h"
-#include "bswap.h"
-
-#ifdef __GNUC__
-
-struct unaligned_64 { uint64_t l; } __attribute__((packed));
-struct unaligned_32 { uint32_t l; } __attribute__((packed));
-struct unaligned_16 { uint16_t l; } __attribute__((packed));
-
-#define AV_RN16(a) (((const struct unaligned_16 *) (a))->l)
-#define AV_RN32(a) (((const struct unaligned_32 *) (a))->l)
-#define AV_RN64(a) (((const struct unaligned_64 *) (a))->l)
-
-#define AV_WN16(a, b) (((struct unaligned_16 *) (a))->l) = (b)
-#define AV_WN32(a, b) (((struct unaligned_32 *) (a))->l) = (b)
-#define AV_WN64(a, b) (((struct unaligned_64 *) (a))->l) = (b)
-
-#elif defined(__DECC)
-
-#define AV_RN16(a) (*((const __unaligned uint16_t*)(a)))
-#define AV_RN32(a) (*((const __unaligned uint32_t*)(a)))
-#define AV_RN64(a) (*((const __unaligned uint64_t*)(a)))
-
-#define AV_WN16(a, b) *((__unaligned uint16_t*)(a)) = (b)
-#define AV_WN32(a, b) *((__unaligned uint32_t*)(a)) = (b)
-#define AV_WN64(a, b) *((__unaligned uint64_t*)(a)) = (b)
-
-#else
-
-#define AV_RN16(a) (*((const uint16_t*)(a)))
-#define AV_RN32(a) (*((const uint32_t*)(a)))
-#define AV_RN64(a) (*((const uint64_t*)(a)))
-
-#define AV_WN16(a, b) *((uint16_t*)(a)) = (b)
-#define AV_WN32(a, b) *((uint32_t*)(a)) = (b)
-#define AV_WN64(a, b) *((uint64_t*)(a)) = (b)
-
-#endif /* !__GNUC__ */
-
-/* endian macros */
-#define AV_RB8(x) (((const uint8_t*)(x))[0])
-#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0)
-
-#define AV_RL8(x) AV_RB8(x)
-#define AV_WL8(p, d) AV_WB8(p, d)
-
-#if HAVE_FAST_UNALIGNED
-# ifdef WORDS_BIGENDIAN
-# define AV_RB16(x) AV_RN16(x)
-# define AV_WB16(p, d) AV_WN16(p, d)
-
-# define AV_RL16(x) bswap_16(AV_RN16(x))
-# define AV_WL16(p, d) AV_WN16(p, bswap_16(d))
-
-# define AV_RB32(x) AV_RN32(x)
-# define AV_WB32(p, d) AV_WN32(p, d)
-
-# define AV_RL32(x) bswap_32(AV_RN32(x))
-# define AV_WL32(p, d) AV_WN32(p, bswap_32(d))
-
-# define AV_RB64(x) AV_RN64(x)
-# define AV_WB64(p, d) AV_WN64(p, d)
-
-# define AV_RL64(x) bswap_64(AV_RN64(x))
-# define AV_WL64(p, d) AV_WN64(p, bswap_64(d))
-# else /* WORDS_BIGENDIAN */
-# define AV_RB16(x) bswap_16(AV_RN16(x))
-# define AV_WB16(p, d) AV_WN16(p, bswap_16(d))
-
-# define AV_RL16(x) AV_RN16(x)
-# define AV_WL16(p, d) AV_WN16(p, d)
-
-# define AV_RB32(x) bswap_32(AV_RN32(x))
-# define AV_WB32(p, d) AV_WN32(p, bswap_32(d))
-
-# define AV_RL32(x) AV_RN32(x)
-# define AV_WL32(p, d) AV_WN32(p, d)
-
-# define AV_RB64(x) bswap_64(AV_RN64(x))
-# define AV_WB64(p, d) AV_WN64(p, bswap_64(d))
-
-# define AV_RL64(x) AV_RN64(x)
-# define AV_WL64(p, d) AV_WN64(p, d)
-# endif
-#else /* HAVE_FAST_UNALIGNED */
-#define AV_RB16(x) ((((const uint8_t*)(x))[0] << 8) | ((const uint8_t*)(x))[1])
-#define AV_WB16(p, d) do { \
- ((uint8_t*)(p))[1] = (d); \
- ((uint8_t*)(p))[0] = (d)>>8; } while(0)
-
-#define AV_RL16(x) ((((const uint8_t*)(x))[1] << 8) | \
- ((const uint8_t*)(x))[0])
-#define AV_WL16(p, d) do { \
- ((uint8_t*)(p))[0] = (d); \
- ((uint8_t*)(p))[1] = (d)>>8; } while(0)
-
-#define AV_RB32(x) ((((const uint8_t*)(x))[0] << 24) | \
- (((const uint8_t*)(x))[1] << 16) | \
- (((const uint8_t*)(x))[2] << 8) | \
- ((const uint8_t*)(x))[3])
-#define AV_WB32(p, d) do { \
- ((uint8_t*)(p))[3] = (d); \
- ((uint8_t*)(p))[2] = (d)>>8; \
- ((uint8_t*)(p))[1] = (d)>>16; \
- ((uint8_t*)(p))[0] = (d)>>24; } while(0)
-
-#define AV_RL32(x) ((((const uint8_t*)(x))[3] << 24) | \
- (((const uint8_t*)(x))[2] << 16) | \
- (((const uint8_t*)(x))[1] << 8) | \
- ((const uint8_t*)(x))[0])
-#define AV_WL32(p, d) do { \
- ((uint8_t*)(p))[0] = (d); \
- ((uint8_t*)(p))[1] = (d)>>8; \
- ((uint8_t*)(p))[2] = (d)>>16; \
- ((uint8_t*)(p))[3] = (d)>>24; } while(0)
-
-#define AV_RB64(x) (((uint64_t)((const uint8_t*)(x))[0] << 56) | \
- ((uint64_t)((const uint8_t*)(x))[1] << 48) | \
- ((uint64_t)((const uint8_t*)(x))[2] << 40) | \
- ((uint64_t)((const uint8_t*)(x))[3] << 32) | \
- ((uint64_t)((const uint8_t*)(x))[4] << 24) | \
- ((uint64_t)((const uint8_t*)(x))[5] << 16) | \
- ((uint64_t)((const uint8_t*)(x))[6] << 8) | \
- (uint64_t)((const uint8_t*)(x))[7])
-#define AV_WB64(p, d) do { \
- ((uint8_t*)(p))[7] = (d); \
- ((uint8_t*)(p))[6] = (d)>>8; \
- ((uint8_t*)(p))[5] = (d)>>16; \
- ((uint8_t*)(p))[4] = (d)>>24; \
- ((uint8_t*)(p))[3] = (d)>>32; \
- ((uint8_t*)(p))[2] = (d)>>40; \
- ((uint8_t*)(p))[1] = (d)>>48; \
- ((uint8_t*)(p))[0] = (d)>>56; } while(0)
-
-#define AV_RL64(x) (((uint64_t)((const uint8_t*)(x))[7] << 56) | \
- ((uint64_t)((const uint8_t*)(x))[6] << 48) | \
- ((uint64_t)((const uint8_t*)(x))[5] << 40) | \
- ((uint64_t)((const uint8_t*)(x))[4] << 32) | \
- ((uint64_t)((const uint8_t*)(x))[3] << 24) | \
- ((uint64_t)((const uint8_t*)(x))[2] << 16) | \
- ((uint64_t)((const uint8_t*)(x))[1] << 8) | \
- (uint64_t)((const uint8_t*)(x))[0])
-#define AV_WL64(p, d) do { \
- ((uint8_t*)(p))[0] = (d); \
- ((uint8_t*)(p))[1] = (d)>>8; \
- ((uint8_t*)(p))[2] = (d)>>16; \
- ((uint8_t*)(p))[3] = (d)>>24; \
- ((uint8_t*)(p))[4] = (d)>>32; \
- ((uint8_t*)(p))[5] = (d)>>40; \
- ((uint8_t*)(p))[6] = (d)>>48; \
- ((uint8_t*)(p))[7] = (d)>>56; } while(0)
-#endif /* HAVE_FAST_UNALIGNED */
-
-#define AV_RB24(x) ((((const uint8_t*)(x))[0] << 16) | \
- (((const uint8_t*)(x))[1] << 8) | \
- ((const uint8_t*)(x))[2])
-#define AV_WB24(p, d) do { \
- ((uint8_t*)(p))[2] = (d); \
- ((uint8_t*)(p))[1] = (d)>>8; \
- ((uint8_t*)(p))[0] = (d)>>16; } while(0)
-
-#define AV_RL24(x) ((((const uint8_t*)(x))[2] << 16) | \
- (((const uint8_t*)(x))[1] << 8) | \
- ((const uint8_t*)(x))[0])
-#define AV_WL24(p, d) do { \
- ((uint8_t*)(p))[0] = (d); \
- ((uint8_t*)(p))[1] = (d)>>8; \
- ((uint8_t*)(p))[2] = (d)>>16; } while(0)
-
-#endif /* AVUTIL_INTREADWRITE_H */
diff --git a/apps/codecs/libcook/libavutil/log.c b/apps/codecs/libcook/libavutil/log.c
deleted file mode 100644
index 4bb9652..0000000
--- a/apps/codecs/libcook/libavutil/log.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * log functions
- * Copyright (c) 2003 Michel Bardiaux
- *
- * 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
- */
-
-/**
- * @file libavutil/log.c
- * logging functions
- */
-
-#include "avutil.h"
-#include "log.h"
-
-int av_log_level = AV_LOG_INFO;
-
-void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl)
-{
- static int print_prefix=1;
- static int count;
- static char line[1024], prev[1024];
- AVClass* avc= ptr ? *(AVClass**)ptr : NULL;
- if(level>av_log_level)
- return;
-#undef fprintf
- if(print_prefix && avc) {
- snprintf(line, sizeof(line), "[%s @ %p]", avc->item_name(ptr), ptr);
- }else
- line[0]=0;
-
- vsnprintf(line + strlen(line), sizeof(line) - strlen(line), fmt, vl);
-
- print_prefix= line[strlen(line)-1] == '\n';
- if(print_prefix && !strcmp(line, prev)){
- count++;
- return;
- }
- if(count>0){
- fprintf(stderr, " Last message repeated %d times\n", count);
- count=0;
- }
- fputs(line, stderr);
- strcpy(prev, line);
-}
-
-static void (*av_log_callback)(void*, int, const char*, va_list) = av_log_default_callback;
-
-void av_log(void* avcl, int level, const char *fmt, ...)
-{
- va_list vl;
- va_start(vl, fmt);
- av_vlog(avcl, level, fmt, vl);
- va_end(vl);
-}
-
-void av_vlog(void* avcl, int level, const char *fmt, va_list vl)
-{
- av_log_callback(avcl, level, fmt, vl);
-}
-
-int av_log_get_level(void)
-{
- return av_log_level;
-}
-
-void av_log_set_level(int level)
-{
- av_log_level = level;
-}
-
-void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
-{
- av_log_callback = callback;
-}
diff --git a/apps/codecs/libcook/libavutil/log.h b/apps/codecs/libcook/libavutil/log.h
deleted file mode 100644
index 1206a2f..0000000
--- a/apps/codecs/libcook/libavutil/log.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
- *
- * 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 AVUTIL_LOG_H
-#define AVUTIL_LOG_H
-
-#include <stdarg.h>
-#include "avutil.h"
-
-/**
- * Describes the class of an AVClass context structure. That is an
- * arbitrary struct of which the first field is a pointer to an
- * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.).
- */
-typedef struct AVCLASS AVClass;
-struct AVCLASS {
- /**
- * The name of the class; usually it is the same name as the
- * context structure type to which the AVClass is associated.
- */
- const char* class_name;
-
- /**
- * A pointer to a function which returns the name of a context
- * instance \p ctx associated with the class.
- */
- const char* (*item_name)(void* ctx);
-
- /**
- * a pointer to the first option specified in the class if any or NULL
- *
- * @see av_set_default_options()
- */
- const struct AVOption *option;
-};
-
-/* av_log API */
-
-#define AV_LOG_QUIET -8
-
-/**
- * Something went really wrong and we will crash now.
- */
-#define AV_LOG_PANIC 0
-
-/**
- * Something went wrong and recovery is not possible.
- * For example, no header was found for a format which depends
- * on headers or an illegal combination of parameters is used.
- */
-#define AV_LOG_FATAL 8
-
-/**
- * Something went wrong and cannot losslessly be recovered.
- * However, not all future data is affected.
- */
-#define AV_LOG_ERROR 16
-
-/**
- * Something somehow does not look correct. This may or may not
- * lead to problems. An example would be the use of '-vstrict -2'.
- */
-#define AV_LOG_WARNING 24
-
-#define AV_LOG_INFO 32
-#define AV_LOG_VERBOSE 40
-
-/**
- * Stuff which is only useful for libav* developers.
- */
-#define AV_LOG_DEBUG 48
-
-/**
- * Sends the specified message to the log if the level is less than or equal
- * to the current av_log_level. By default, all logging messages are sent to
- * stderr. This behavior can be altered by setting a different av_vlog callback
- * function.
- *
- * @param avcl A pointer to an arbitrary struct of which the first field is a
- * pointer to an AVClass struct.
- * @param level The importance level of the message, lower values signifying
- * higher importance.
- * @param fmt The format string (printf-compatible) that specifies how
- * subsequent arguments are converted to output.
- * @see av_vlog
- */
-#ifdef __GNUC__
-void av_log(void*, int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));
-#else
-void av_log(void*, int level, const char *fmt, ...);
-#endif
-
-void av_vlog(void*, int level, const char *fmt, va_list);
-int av_log_get_level(void);
-void av_log_set_level(int);
-void av_log_set_callback(void (*)(void*, int, const char*, va_list));
-void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
-
-#endif /* AVUTIL_LOG_H */
diff --git a/apps/codecs/libcook/main.c b/apps/codecs/libcook/main.c
index 2f85295..8b180b2 100644
--- a/apps/codecs/libcook/main.c
+++ b/apps/codecs/libcook/main.c
@@ -28,7 +28,14 @@
#include "cook.h"
//#define DUMP_RAW_FRAMES
-#define DEBUGF(message,args ...) av_log(NULL,AV_LOG_ERROR,message,## args)
+#ifndef DEBUGF
+# if 0
+# define DEBUGF(message,args ...) printf
+# else
+# define DEBUGF(...)
+# endif
+#endif
+
int main(int argc, char *argv[])
{
int fd, fd_dec;
@@ -74,7 +81,7 @@ int main(int argc, char *argv[])
sps= rmctx.block_align;
h = rmctx.sub_packet_h;
cook_decode_init(&rmctx,&q);
- av_log(NULL,AV_LOG_ERROR,"nb_frames = %d\n",nb_frames);
+ DEBUGF("nb_frames = %d\n",nb_frames);
x = 0;
if(packet_count % h)
{