# HG changeset patch # User glantau # Date 997739285 0 # Node ID 5aa6292a1660a8a4cd54ed049552d6e03990efac # Parent 8e2d8dbf89a5a7f232f74098dea56f83a66656f4 win32 fixes diff -r 8e2d8dbf89a5 -r 5aa6292a1660 ac3dec.c --- a/ac3dec.c Mon Aug 13 21:46:21 2001 +0000 +++ b/ac3dec.c Mon Aug 13 21:48:05 2001 +0000 @@ -16,12 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include #include "avcodec.h" - -#include #include "libac3/ac3.h" /* currently, I use libac3 which is Copyright (C) Aaron Holtzman and diff -r 8e2d8dbf89a5 -r 5aa6292a1660 ac3enc.c --- a/ac3enc.c Mon Aug 13 21:46:21 2001 +0000 +++ b/ac3enc.c Mon Aug 13 21:48:05 2001 +0000 @@ -16,19 +16,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +//#define DEBUG +//#define DEBUG_BITALLOC +#include "avcodec.h" #include -#include "avcodec.h" #include "ac3enc.h" #include "ac3tab.h" -//#define DEBUG -//#define DEBUG_BITALLOC -#define NDEBUG -#include #define MDCT_NBITS 9 #define N (1 << MDCT_NBITS) diff -r 8e2d8dbf89a5 -r 5aa6292a1660 common.c --- a/common.c Mon Aug 13 21:46:21 2001 +0000 +++ b/common.c Mon Aug 13 21:48:05 2001 +0000 @@ -16,20 +16,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#ifdef __FreeBSD__ -#include -#endif -#include +#include "common.h" #include -#include "common.h" - -#define NDEBUG -#include - -#include "../bswap.h" void init_put_bits(PutBitContext *s, UINT8 *buffer, int buffer_size, @@ -79,7 +67,7 @@ bit_cnt+=n; } else { bit_buf |= value >> (n + bit_cnt - 32); - *(UINT32 *)s->buf_ptr = htonl(bit_buf); + *(UINT32 *)s->buf_ptr = be2me_32(bit_buf); //printf("bitbuf = %08x\n", bit_buf); s->buf_ptr+=4; if (s->buf_ptr >= s->buf_end) @@ -97,9 +85,9 @@ } /* return the number of bits output */ -long long get_bit_count(PutBitContext *s) +INT64 get_bit_count(PutBitContext *s) { - return (s->buf_ptr - s->buf + s->data_out_size) * 8 + (long long)s->bit_cnt; + return (s->buf_ptr - s->buf + s->data_out_size) * 8 + (INT64)s->bit_cnt; } void align_put_bits(PutBitContext *s) diff -r 8e2d8dbf89a5 -r 5aa6292a1660 common.h --- a/common.h Mon Aug 13 21:46:21 2001 +0000 +++ b/common.h Mon Aug 13 21:48:05 2001 +0000 @@ -1,10 +1,86 @@ #ifndef COMMON_H #define COMMON_H +#define FFMPEG_VERSION "0.4.5" + +#ifdef WIN32 +#define CONFIG_WIN32 +#endif + #ifdef HAVE_AV_CONFIG_H +/* only include the following when compiling package */ #include "../config.h" + +#include +#include +#include +#include + +#ifndef ENODATA +#define ENODATA 61 #endif +#endif + +#ifdef CONFIG_WIN32 + +/* windows */ + +typedef unsigned short UINT16; +typedef signed short INT16; +typedef unsigned char UINT8; +typedef unsigned int UINT32; +typedef unsigned __int64 UINT64; +typedef signed char INT8; +typedef signed int INT32; +typedef signed __int64 INT64; + +typedef UINT8 uint8_t; +typedef INT8 int8_t; +typedef UINT16 uint16_t; +typedef INT16 int16_t; +typedef UINT32 uint32_t; +typedef INT32 int32_t; + +#define INT64_C(c) (c ## i64) +#define UINT64_C(c) (c ## i64) + +#define inline __inline + +/* + Disable warning messages: + warning C4244: '=' : conversion from 'double' to 'float', possible loss of data + warning C4305: 'argument' : truncation from 'const double' to 'float' +*/ +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) + +#define M_PI 3.14159265358979323846 +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ + +#ifdef _DEBUG +#define DEBUG +#endif + +// code from bits/byteswap.h (C) 1997, 1998 Free Software Foundation, Inc. +#define bswap_32(x) \ + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) +#define be2me_32(x) bswap_32(x) + +#define snprintf _snprintf + +#define CONFIG_ENCODERS 1 +#define CONFIG_DECODERS 1 +#define CONFIG_AC3 1 +#define CONFIG_MPGLIB 1 + +#else + +/* unix */ + +#include + #ifndef __WINE_WINDEF16_H /* workaround for typedef conflict in MPlayer (wine typedefs) */ typedef unsigned short UINT16; @@ -18,6 +94,32 @@ typedef signed int INT32; typedef signed long long INT64; +#ifdef HAVE_AV_CONFIG_H + +#ifdef __FreeBSD__ +#include +#endif + +#ifndef INT64_C +#define INT64_C(c) (c ## LL) +#define UINT64_C(c) (c ## ULL) +#endif + +#include "../bswap.h" + +#ifdef USE_FASTMEMCPY +#include "fastmemcpy.h" +#endif + +#ifndef DEBUG +#define NDEBUG +#endif +#include + +#endif /* HAVE_AV_CONFIG_H */ + +#endif /* !CONFIG_WIN32 */ + /* bit output */ struct PutBitContext; @@ -28,7 +130,7 @@ UINT32 bit_buf; int bit_cnt; UINT8 *buf, *buf_ptr, *buf_end; - long long data_out_size; /* in bytes */ + INT64 data_out_size; /* in bytes */ void *opaque; WriteDataFunc write_data; } PutBitContext; @@ -38,7 +140,7 @@ void *opaque, void (*write_data)(void *, UINT8 *, int)); void put_bits(PutBitContext *s, int n, unsigned int value); -long long get_bit_count(PutBitContext *s); +INT64 get_bit_count(PutBitContext *s); void align_put_bits(PutBitContext *s); void flush_put_bits(PutBitContext *s); diff -r 8e2d8dbf89a5 -r 5aa6292a1660 imgconvert.c --- a/imgconvert.c Mon Aug 13 21:46:21 2001 +0000 +++ b/imgconvert.c Mon Aug 13 21:48:05 2001 +0000 @@ -16,10 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include - #include "avcodec.h" #include "dsputil.h" @@ -481,7 +477,9 @@ { UINT8 *src, *ptr; int y, y1, i; - UINT8 buf[5 * width]; + UINT8 *buf; + + buf= (UINT8*) malloc(5 * width); src = src1; for(y=0;y -#include -#include +#include "../common.h" #include "ac3.h" #include "ac3_internal.h" diff -r 8e2d8dbf89a5 -r 5aa6292a1660 libac3/bitstream.c --- a/libac3/bitstream.c Mon Aug 13 21:46:21 2001 +0000 +++ b/libac3/bitstream.c Mon Aug 13 21:48:05 2001 +0000 @@ -21,10 +21,7 @@ * */ -#include -#include -#include - +#include "../common.h" #include "ac3.h" #include "ac3_internal.h" #include "bitstream.h" diff -r 8e2d8dbf89a5 -r 5aa6292a1660 libac3/downmix.c --- a/libac3/downmix.c Mon Aug 13 21:46:21 2001 +0000 +++ b/libac3/downmix.c Mon Aug 13 21:48:05 2001 +0000 @@ -25,11 +25,8 @@ * */ -#include -#include -#include +#include "../common.h" #include -#include #include "ac3.h" #include "ac3_internal.h" diff -r 8e2d8dbf89a5 -r 5aa6292a1660 libac3/imdct.c --- a/libac3/imdct.c Mon Aug 13 21:46:21 2001 +0000 +++ b/libac3/imdct.c Mon Aug 13 21:48:05 2001 +0000 @@ -22,11 +22,7 @@ * */ -//#include "config.h" - -#include -#include -#include +#include "../common.h" #include #include "ac3.h" #include "ac3_internal.h" diff -r 8e2d8dbf89a5 -r 5aa6292a1660 libac3/parse.c --- a/libac3/parse.c Mon Aug 13 21:46:21 2001 +0000 +++ b/libac3/parse.c Mon Aug 13 21:48:05 2001 +0000 @@ -22,9 +22,7 @@ * */ -#include -#include - +#include "../common.h" #include "ac3.h" #include "ac3_internal.h" diff -r 8e2d8dbf89a5 -r 5aa6292a1660 libavcodec.dsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libavcodec.dsp Mon Aug 13 21:48:05 2001 +0000 @@ -0,0 +1,304 @@ +# Microsoft Developer Studio Project File - Name="libavcodec" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libavcodec - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libavcodec.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libavcodec.mak" CFG="libavcodec - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libavcodec - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libavcodec - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libavcodec - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../Release/libavcodec" +# PROP Intermediate_Dir "../Release/libavcodec" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /c +# ADD BASE RSC /l 0x40c /d "NDEBUG" +# ADD RSC /l 0x40c /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "libavcodec - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../Debug/libavcodec" +# PROP Intermediate_Dir "../Debug/libavcodec" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c +# ADD BASE RSC /l 0x40c /d "_DEBUG" +# ADD RSC /l 0x40c /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "libavcodec - Win32 Release" +# Name "libavcodec - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Group "libac3" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\libac3\ac3.h +# End Source File +# Begin Source File + +SOURCE=.\libac3\ac3_internal.h +# End Source File +# Begin Source File + +SOURCE=.\libac3\bit_allocate.c +# End Source File +# Begin Source File + +SOURCE=.\libac3\bitstream.c +# End Source File +# Begin Source File + +SOURCE=.\libac3\bitstream.h +# End Source File +# Begin Source File + +SOURCE=.\libac3\downmix.c +# End Source File +# Begin Source File + +SOURCE=.\libac3\imdct.c +# End Source File +# Begin Source File + +SOURCE=.\libac3\parse.c +# End Source File +# Begin Source File + +SOURCE=.\libac3\tables.h +# End Source File +# End Group +# Begin Group "mpglib" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\mpglib\dct64_i386.c +# End Source File +# Begin Source File + +SOURCE=.\mpglib\decode_i386.c +# End Source File +# Begin Source File + +SOURCE=.\mpglib\huffman.h +# End Source File +# Begin Source File + +SOURCE=.\mpglib\l2tables.h +# End Source File +# Begin Source File + +SOURCE=.\mpglib\layer1.c +# End Source File +# Begin Source File + +SOURCE=.\mpglib\layer2.c +# End Source File +# Begin Source File + +SOURCE=.\mpglib\layer3.c +# End Source File +# Begin Source File + +SOURCE=.\mpglib\mpg123.h +# End Source File +# Begin Source File + +SOURCE=.\mpglib\tabinit.c +# End Source File +# End Group +# Begin Source File + +SOURCE=.\ac3dec.c +# End Source File +# Begin Source File + +SOURCE=.\ac3enc.c +# End Source File +# Begin Source File + +SOURCE=.\ac3enc.h +# End Source File +# Begin Source File + +SOURCE=.\ac3tab.h +# End Source File +# Begin Source File + +SOURCE=.\avcodec.h +# End Source File +# Begin Source File + +SOURCE=.\common.c +# End Source File +# Begin Source File + +SOURCE=.\common.h +# End Source File +# Begin Source File + +SOURCE=.\dsputil.c +# End Source File +# Begin Source File + +SOURCE=.\dsputil.h +# End Source File +# Begin Source File + +SOURCE=.\fastmemcpy.h +# End Source File +# Begin Source File + +SOURCE=.\h263.c +# End Source File +# Begin Source File + +SOURCE=.\h263data.h +# End Source File +# Begin Source File + +SOURCE=.\h263dec.c +# End Source File +# Begin Source File + +SOURCE=.\imgconvert.c +# End Source File +# Begin Source File + +SOURCE=.\imgresample.c +# End Source File +# Begin Source File + +SOURCE=.\jfdctfst.c +# End Source File +# Begin Source File + +SOURCE=.\jrevdct.c +# End Source File +# Begin Source File + +SOURCE=.\mjpeg.c +# End Source File +# Begin Source File + +SOURCE=.\motion_est.c +# End Source File +# Begin Source File + +SOURCE=.\mpeg12.c +# End Source File +# Begin Source File + +SOURCE=.\mpeg12data.h +# End Source File +# Begin Source File + +SOURCE=.\mpeg4data.h +# End Source File +# Begin Source File + +SOURCE=.\mpegaudio.c +# End Source File +# Begin Source File + +SOURCE=.\mpegaudio.h +# End Source File +# Begin Source File + +SOURCE=.\mpegaudiodec.c +# End Source File +# Begin Source File + +SOURCE=.\mpegaudiotab.h +# End Source File +# Begin Source File + +SOURCE=.\mpegvideo.c +# End Source File +# Begin Source File + +SOURCE=.\mpegvideo.h +# End Source File +# Begin Source File + +SOURCE=.\msmpeg4.c +# End Source File +# Begin Source File + +SOURCE=.\msmpeg4data.h +# End Source File +# Begin Source File + +SOURCE=.\resample.c +# End Source File +# Begin Source File + +SOURCE=.\rv10.c +# End Source File +# Begin Source File + +SOURCE=.\utils.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# End Target +# End Project diff -r 8e2d8dbf89a5 -r 5aa6292a1660 mjpeg.c --- a/mjpeg.c Mon Aug 13 21:46:21 2001 +0000 +++ b/mjpeg.c Mon Aug 13 21:48:05 2001 +0000 @@ -16,8 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" @@ -423,12 +421,20 @@ //#define DEBUG +#ifndef CONFIG_WIN32 + #ifdef DEBUG #define dprintf(fmt,args...) printf(fmt, ## args) #else #define dprintf(fmt,args...) #endif +#else + +inline void dprintf(const char* fmt,...) {} + +#endif + /* compressed picture size */ #define PICTURE_BUFFER_SIZE 100000 diff -r 8e2d8dbf89a5 -r 5aa6292a1660 mpeg12.c --- a/mpeg12.c Mon Aug 13 21:46:21 2001 +0000 +++ b/mpeg12.c Mon Aug 13 21:48:05 2001 +0000 @@ -16,26 +16,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" #include "mpeg12data.h" -#ifdef USE_FASTMEMCPY -#include "fastmemcpy.h" -#endif //#define DEBUG +#ifndef CONFIG_WIN32 + #ifdef DEBUG #define dprintf(fmt,args...) printf(fmt, ## args) #else #define dprintf(fmt,args...) #endif +#else + +inline void dprintf(const char* fmt,...) {} + +#endif + /* Start codes. */ #define SEQ_END_CODE 0x000001b7 #define SEQ_START_CODE 0x000001b3 @@ -118,11 +120,11 @@ fps = frame_rate_tab[s->frame_rate_index]; time_code = s->fake_picture_number * FRAME_RATE_BASE; s->gop_picture_number = s->fake_picture_number; - put_bits(&s->pb, 5, (time_code / (fps * 3600)) % 24); - put_bits(&s->pb, 6, (time_code / (fps * 60)) % 60); + put_bits(&s->pb, 5, (UINT32)((time_code / (fps * 3600)) % 24)); + put_bits(&s->pb, 6, (UINT32)((time_code / (fps * 60)) % 60)); put_bits(&s->pb, 1, 1); - put_bits(&s->pb, 6, (time_code / fps) % 60); - put_bits(&s->pb, 6, (time_code % fps) / FRAME_RATE_BASE); + put_bits(&s->pb, 6, (UINT32)((time_code / fps) % 60)); + put_bits(&s->pb, 6, (UINT32)((time_code % fps) / FRAME_RATE_BASE)); put_bits(&s->pb, 1, 1); /* closed gop */ put_bits(&s->pb, 1, 0); /* broken link */ } diff -r 8e2d8dbf89a5 -r 5aa6292a1660 mpeg12data.h --- a/mpeg12data.h Mon Aug 13 21:46:21 2001 +0000 +++ b/mpeg12data.h Mon Aug 13 21:48:05 2001 +0000 @@ -288,27 +288,73 @@ #define MB_QUANT 0x10 static const UINT8 table_mb_ptype[32][2] = { - [ MB_FOR|MB_PAT ] { 1, 1 }, - [ MB_PAT ] { 1, 2 }, - [ MB_FOR ] { 1, 3 }, - [ MB_INTRA ] { 3, 5 }, - [ MB_QUANT|MB_FOR|MB_PAT ] { 2, 5 }, - [ MB_QUANT|MB_PAT ] { 1, 5 }, - [ MB_QUANT|MB_INTRA ] { 1, 6 }, + { 0, 0 }, // 0x00 + { 3, 5 }, // 0x01 MB_INTRA + { 1, 2 }, // 0x02 MB_PAT + { 0, 0 }, // 0x03 + { 0, 0 }, // 0x04 + { 0, 0 }, // 0x05 + { 0, 0 }, // 0x06 + { 0, 0 }, // 0x07 + { 1, 3 }, // 0x08 MB_FOR + { 0, 0 }, // 0x09 + { 1, 1 }, // 0x0A MB_FOR|MB_PAT + { 0, 0 }, // 0x0B + { 0, 0 }, // 0x0C + { 0, 0 }, // 0x0D + { 0, 0 }, // 0x0E + { 0, 0 }, // 0x0F + { 0, 0 }, // 0x10 + { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA + { 1, 5 }, // 0x12 MB_QUANT|MB_PAT + { 0, 0 }, // 0x13 + { 0, 0 }, // 0x14 + { 0, 0 }, // 0x15 + { 0, 0 }, // 0x16 + { 0, 0 }, // 0x17 + { 0, 0 }, // 0x18 + { 0, 0 }, // 0x19 + { 2, 5 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT + { 0, 0 }, // 0x1B + { 0, 0 }, // 0x1C + { 0, 0 }, // 0x1D + { 0, 0 }, // 0x1E + { 0, 0 }, // 0x1F }; static const UINT8 table_mb_btype[32][2] = { - [ MB_FOR|MB_BACK ] { 2, 2 }, - [ MB_FOR|MB_BACK|MB_PAT ] { 3, 2 }, - [ MB_BACK ] { 2, 3 }, - [ MB_BACK|MB_PAT ] { 3, 3 }, - [ MB_FOR ] { 2, 4 }, - [ MB_FOR|MB_PAT ] { 3, 4 }, - [ MB_INTRA ] { 3, 5 }, - [ MB_QUANT|MB_FOR|MB_BACK|MB_PAT ] { 2, 5 }, - [ MB_QUANT|MB_FOR|MB_PAT ] { 3, 6 }, - [ MB_QUANT|MB_BACK|MB_PAT ] { 2, 6 }, - [ MB_QUANT|MB_INTRA ] { 1, 6 }, + { 0, 0 }, // 0x00 + { 3, 5 }, // 0x01 MB_INTRA + { 0, 0 }, // 0x02 + { 0, 0 }, // 0x03 + { 2, 3 }, // 0x04 MB_BACK + { 0, 0 }, // 0x05 + { 3, 3 }, // 0x06 MB_BACK|MB_PAT + { 0, 0 }, // 0x07 + { 2, 4 }, // 0x08 MB_FOR + { 0, 0 }, // 0x09 + { 3, 4 }, // 0x0A MB_FOR|MB_PAT + { 0, 0 }, // 0x0B + { 2, 2 }, // 0x0C MB_FOR|MB_BACK + { 0, 0 }, // 0x0D + { 3, 2 }, // 0x0E MB_FOR|MB_BACK|MB_PAT + { 0, 0 }, // 0x0F + { 0, 0 }, // 0x10 + { 1, 6 }, // 0x11 MB_QUANT|MB_INTRA + { 0, 0 }, // 0x12 + { 0, 0 }, // 0x13 + { 0, 0 }, // 0x14 + { 0, 0 }, // 0x15 + { 2, 6 }, // 0x16 MB_QUANT|MB_BACK|MB_PAT + { 0, 0 }, // 0x17 + { 0, 0 }, // 0x18 + { 0, 0 }, // 0x19 + { 3, 6 }, // 0x1A MB_QUANT|MB_FOR|MB_PAT + { 0, 0 }, // 0x1B + { 0, 0 }, // 0x1C + { 0, 0 }, // 0x1D + { 2, 5 }, // 0x1E MB_QUANT|MB_FOR|MB_BACK|MB_PAT + { 0, 0 }, // 0x1F }; static const UINT8 mbMotionVectorTable[17][2] = { diff -r 8e2d8dbf89a5 -r 5aa6292a1660 mpegaudio.c --- a/mpegaudio.c Mon Aug 13 21:46:21 2001 +0000 +++ b/mpegaudio.c Mon Aug 13 21:48:05 2001 +0000 @@ -16,16 +16,10 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +#include "avcodec.h" #include -#include "avcodec.h" #include "mpegaudio.h" -#define NDEBUG -#include - /* define it to use floats in quantization (I don't like floats !) */ //#define USE_FLOATS diff -r 8e2d8dbf89a5 -r 5aa6292a1660 mpegaudio.h --- a/mpegaudio.h Mon Aug 13 21:46:21 2001 +0000 +++ b/mpegaudio.h Mon Aug 13 21:48:05 2001 +0000 @@ -19,7 +19,7 @@ int bitrate_index; /* bit rate */ int freq_index; int frame_size; /* frame size, in bits, without padding */ - long long nb_samples; /* total number of samples encoded */ + INT64 nb_samples; /* total number of samples encoded */ /* padding computation */ int frame_frac, frame_frac_incr, do_padding; short samples_buf[MPA_MAX_CHANNELS][SAMPLES_BUF_SIZE]; /* buffer for filter */ diff -r 8e2d8dbf89a5 -r 5aa6292a1660 mpegvideo.c --- a/mpegvideo.c Mon Aug 13 21:46:21 2001 +0000 +++ b/mpegvideo.c Mon Aug 13 21:48:05 2001 +0000 @@ -81,7 +81,8 @@ /* 16 <= qscale * quant_matrix[i] <= 7905 */ /* 19952 <= aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ - qmat[i] = (int)((1ULL << (QMAT_SHIFT + 11)) / (aanscales[i] * qscale * quant_matrix[i])); + qmat[i] = (int)((UINT64_C(1) << (QMAT_SHIFT + 11)) / + (aanscales[i] * qscale * quant_matrix[i])); } } else { for(i=0;i<64;i++) { @@ -983,6 +984,10 @@ av_fdct (block); + /* we need this permutation so that we correct the IDCT + permutation. will be moved into DCT code */ + block_permute(block); + if (s->mb_intra) { if (n < 4) q = s->y_dc_scale; @@ -1251,7 +1256,7 @@ */ static int rate_estimate_qscale(MpegEncContext *s) { - long long total_bits = s->total_bits; + INT64 total_bits = s->total_bits; float q; int qscale, diff, qmin; @@ -1276,9 +1281,9 @@ q = 31; qscale = (int)(q + 0.5); #if defined(DEBUG) - printf("%d: total=%Ld br=%0.1f diff=%d qest=%0.1f\n", + printf("%d: total=%0.0f br=%0.1f diff=%d qest=%0.1f\n", s->picture_number, - total_bits, + (double)total_bits, (float)s->frame_rate / FRAME_RATE_BASE * total_bits / s->picture_number, diff, q); diff -r 8e2d8dbf89a5 -r 5aa6292a1660 mpegvideo.h --- a/mpegvideo.h Mon Aug 13 21:46:21 2001 +0000 +++ b/mpegvideo.h Mon Aug 13 21:48:05 2001 +0000 @@ -125,11 +125,14 @@ /* bit rate control */ int I_frame_bits; /* wanted number of bits per I frame */ int P_frame_bits; /* same for P frame */ - long long wanted_bits; - long long total_bits; + INT64 wanted_bits; + INT64 total_bits; /* mpeg4 specific */ int time_increment_bits; + int shape; + int vol_sprite_usage; + int quant_precision; /* RV10 specific */ int rv10_version; /* RV10 version: 0 or 3 */ diff -r 8e2d8dbf89a5 -r 5aa6292a1660 resample.c --- a/resample.c Mon Aug 13 21:46:21 2001 +0000 +++ b/resample.c Mon Aug 13 21:48:05 2001 +0000 @@ -16,14 +16,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +#include "avcodec.h" #include -#include "avcodec.h" - -#define NDEBUG -#include typedef struct { /* fractional resampling */ @@ -196,9 +190,11 @@ static int mono_resample(ReSampleChannelContext *s, short *output, short *input, int nb_samples) { - short buf1[nb_samples]; + short *buf1; short *buftmp; + buf1= (short*) malloc( nb_samples * sizeof(short) ); + /* first downsample by an integer factor with averaging filter */ if (s->iratio > 1) { buftmp = buf1; @@ -213,6 +209,7 @@ } else { memcpy(output, buftmp, nb_samples * sizeof(short)); } + free(buf1); return nb_samples; } @@ -251,9 +248,10 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples) { int i, nb_samples1; - short bufin[2][nb_samples]; - short bufout[2][(int)(nb_samples * s->ratio) + 16]; /* make some zoom to avoid round pb */ + short *bufin[2]; + short *bufout[2]; short *buftmp2[2], *buftmp3[2]; + int lenout; if (s->input_channels == s->output_channels && s->ratio == 1.0) { /* nothing to do */ @@ -261,6 +259,15 @@ return nb_samples; } + /* XXX: move those malloc to resample init code */ + bufin[0]= (short*) malloc( nb_samples * sizeof(short) ); + bufin[1]= (short*) malloc( nb_samples * sizeof(short) ); + + /* make some zoom to avoid round pb */ + lenout= (int)(nb_samples * s->ratio) + 16; + bufout[0]= (short*) malloc( lenout * sizeof(short) ); + bufout[1]= (short*) malloc( lenout * sizeof(short) ); + if (s->input_channels == 2 && s->output_channels == 1) { buftmp2[0] = bufin[0]; @@ -292,6 +299,11 @@ stereo_mux(output, buftmp3[0], buftmp3[1], nb_samples1); } + free(bufin[0]); + free(bufin[1]); + + free(bufout[0]); + free(bufout[1]); return nb_samples1; }