[Sumover-dev] [svn commit] r3911 - in vic/branches/mpeg4: win32 win32/common win32/ffmpeg win32/lib

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Wed Nov 8 03:09:52 GMT 2006


Author: barz
Date: Wed Nov  8 03:07:46 2006
New Revision: 3911

Added:
   vic/branches/mpeg4/win32/common/
   vic/branches/mpeg4/win32/common/bs.h
   vic/branches/mpeg4/win32/common/cabac.h
   vic/branches/mpeg4/win32/common/clip1.h
   vic/branches/mpeg4/win32/common/common.h
   vic/branches/mpeg4/win32/common/cpu.h
   vic/branches/mpeg4/win32/common/csp.h
   vic/branches/mpeg4/win32/common/dct.h
   vic/branches/mpeg4/win32/common/display.h
   vic/branches/mpeg4/win32/common/frame.h
   vic/branches/mpeg4/win32/common/macroblock.h
   vic/branches/mpeg4/win32/common/mc.h
   vic/branches/mpeg4/win32/common/pixel.h
   vic/branches/mpeg4/win32/common/predict.h
   vic/branches/mpeg4/win32/common/set.h
   vic/branches/mpeg4/win32/common/visualize.h
   vic/branches/mpeg4/win32/common/vlc.h
   vic/branches/mpeg4/win32/ffmpeg/
   vic/branches/mpeg4/win32/ffmpeg/config.h
   vic/branches/mpeg4/win32/inttypes.h
   vic/branches/mpeg4/win32/lib/
   vic/branches/mpeg4/win32/lib/avcodec.dll   (contents, props changed)
   vic/branches/mpeg4/win32/lib/avcodec.lib   (contents, props changed)
   vic/branches/mpeg4/win32/lib/libswscale.dll   (contents, props changed)
   vic/branches/mpeg4/win32/lib/libswscale.lib   (contents, props changed)
   vic/branches/mpeg4/win32/lib/libx264.dll   (contents, props changed)
   vic/branches/mpeg4/win32/lib/libx264.lib   (contents, props changed)
   vic/branches/mpeg4/win32/x264.h
Modified:
   vic/branches/mpeg4/main.cpp
   vic/branches/mpeg4/vic.vcproj

Log:
win32 port

Modified: vic/branches/mpeg4/main.cpp
==============================================================================
--- vic/branches/mpeg4/main.cpp	(original)
+++ vic/branches/mpeg4/main.cpp	Wed Nov  8 03:07:46 2006
@@ -70,7 +70,7 @@
 #include <X11/Xutil.h>
 
 extern "C" {
-#include "postproc/cpudetect.h"
+#include "ffmpeg/postproc/cpudetect.h"
 #include <tk.h>
 #ifdef USE_SHM
 #ifdef sgi

Modified: vic/branches/mpeg4/vic.vcproj
==============================================================================
--- vic/branches/mpeg4/vic.vcproj	(original)
+++ vic/branches/mpeg4/vic.vcproj	Wed Nov  8 03:07:46 2006
@@ -481,8 +481,8 @@
 				Name="VCCLCompilerTool"
 				AdditionalOptions="/I ../common"
 				Optimization="0"
-				AdditionalIncludeDirectories=".\win32\include,.\ffmpeg,.\,render,rtp,net,win32,video,codec,codec\tmndec,codec\tmn-x,codec\jpeg,codec\p64,codec\h263,codec\mpeg,..\common\src,..\tk-8.0\win,..\tcl-8.0\win,..\tk-8.0\generic,..\tk-8.0\xlib,..\tcl-8.0\generic,..\IPv6Kit\inc,mst_wm\incls"
-				PreprocessorDefinitions="DEBUG;_DEBUG;DEBUG_MEM;WIN32;SIGRET=void;SIGARGS=int;NLAYER=8;ED_YBITS=4;VIC;USE_TIME;WINDOWS;HAVE_IPV6;NEED_INET_NTOP;NEED_INET_PTON;WINXP_IPV6"
+				AdditionalIncludeDirectories=".\,render,rtp,net,win32,video,codec,codec\tmndec,codec\tmn-x,codec\jpeg,codec\p64,codec\h263,codec\mpeg,..\common\src,..\tk-8.0\win,..\tcl-8.0\win,..\tk-8.0\generic,..\tk-8.0\xlib,..\tcl-8.0\generic,..\IPv6Kit\inc,mst_wm\incls"
+				PreprocessorDefinitions="ENABLE_SWSCALE;HAVE_AV_CONFIG_H;__X264__;DEBUG;_DEBUG;DEBUG_MEM;WIN32;SIGRET=void;SIGARGS=int;NLAYER=8;ED_YBITS=4;VIC;USE_TIME;WINDOWS;HAVE_IPV6;NEED_INET_NTOP;NEED_INET_PTON;WINXP_IPV6"
 				RuntimeLibrary="5"
 				UsePrecompiledHeader="2"
 				PrecompiledHeaderFile=".\Debug_IPv6_Win2000/vic.pch"
@@ -498,11 +498,11 @@
 				Name="VCCustomBuildTool"/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="tklib.lib tcllib.lib wsock32.lib Ws2_32.lib winmm.lib vfw32.lib uclmm.lib strmiids.lib quartz.lib"
+				AdditionalDependencies="libswscale.lib avcodec.lib libx264.lib tklib.lib tcllib.lib wsock32.lib Ws2_32.lib winmm.lib vfw32.lib uclmm.lib strmiids.lib quartz.lib"
 				OutputFile="$(ConfigurationName)/vic.exe"
 				LinkIncremental="1"
 				SuppressStartupBanner="TRUE"
-				AdditionalLibraryDirectories="..\tcl-8.0\win\Debug,..\tk-8.0\win\Debug,..\common\src\Debug,codec\tmndec,codec\tmn-x"
+				AdditionalLibraryDirectories="&quot;..\tcl-8.0\win\Debug&quot;;&quot;..\tk-8.0\win\Debug&quot;;..\common\src\Debug;codec\tmndec;&quot;codec\tmn-x&quot;;win32\lib"
 				GenerateDebugInformation="TRUE"
 				ProgramDatabaseFile=".\Debug_IPv6_Win2000/vic.pdb"
 				SubSystem="2"
@@ -4850,6 +4850,9 @@
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath=".\codec\databuffer.cpp">
+			</File>
+			<File
 				RelativePath="codec\dct.cpp">
 				<FileConfiguration
 					Name="Debug|Win32">
@@ -5364,6 +5367,9 @@
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath=".\codec\decoder-h264.cpp">
+			</File>
+			<File
 				RelativePath="codec\decoder-jpeg.cpp">
 				<FileConfiguration
 					Name="Debug|Win32">
@@ -5437,6 +5443,9 @@
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath=".\codec\decoder-mpeg4.cpp">
+			</File>
+			<File
 				RelativePath="codec\decoder-nv.cpp">
 				<FileConfiguration
 					Name="Debug|Win32">
@@ -6097,6 +6106,9 @@
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath=".\codec\encoder-h264.cpp">
+			</File>
+			<File
 				RelativePath="codec\encoder-jpeg.cpp">
 				<FileConfiguration
 					Name="Debug|Win32">
@@ -6170,6 +6182,9 @@
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath=".\codec\encoder-mpeg4.cpp">
+			</File>
+			<File
 				RelativePath="codec\encoder-nv.cpp">
 				<FileConfiguration
 					Name="Debug|Win32">
@@ -6389,6 +6404,9 @@
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath=".\codec\ffmpeg_codec.cpp">
+			</File>
+			<File
 				RelativePath="codec\framer-jpeg.cpp">
 				<FileConfiguration
 					Name="Debug|Win32">
@@ -6684,6 +6702,9 @@
 				RelativePath=".\codec\p64\p64as.cpp">
 			</File>
 			<File
+				RelativePath=".\codec\packetbuffer.cpp">
+			</File>
+			<File
 				RelativePath=".\render\ppm.cpp">
 			</File>
 			<File
@@ -6832,6 +6853,9 @@
 						BrowseInformation="1"/>
 				</FileConfiguration>
 			</File>
+			<File
+				RelativePath=".\codec\x264encoder.cpp">
+			</File>
 			<Filter
 				Name="H263 Erlangen codec"
 				Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
@@ -8388,6 +8412,9 @@
 				Name="General codec Headers"
 				Filter="">
 				<File
+					RelativePath=".\codec\databuffer.h">
+				</File>
+				<File
 					RelativePath="codec\dct.h">
 				</File>
 				<File
@@ -8406,6 +8433,12 @@
 					RelativePath="codec\encoder-h263.h">
 				</File>
 				<File
+					RelativePath=".\codec\ffmpeg_codec.h">
+				</File>
+				<File
+					RelativePath=".\codec\ffmpeg_config.h">
+				</File>
+				<File
 					RelativePath="codec\framer-h261.h">
 				</File>
 				<File
@@ -8415,6 +8448,9 @@
 					RelativePath="codec\mpeg2par.h">
 				</File>
 				<File
+					RelativePath=".\codec\packetbuffer.h">
+				</File>
+				<File
 					RelativePath="codec\parser-mpeg.h">
 				</File>
 				<File
@@ -8423,6 +8459,12 @@
 				<File
 					RelativePath="codec\pvh.h">
 				</File>
+				<File
+					RelativePath=".\codec\streambuffer.h">
+				</File>
+				<File
+					RelativePath=".\codec\x264encoder.h">
+				</File>
 			</Filter>
 			<Filter
 				Name="tmn(v2) H.263+ codec"

Added: vic/branches/mpeg4/win32/common/bs.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/bs.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,423 @@
+/*****************************************************************************
+ * bs.h :
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: bs.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifdef _BS_H
+#warning FIXME Multiple inclusion of bs.h
+#else
+#define _BS_H
+
+typedef struct bs_s
+{
+    uint8_t *p_start;
+    uint8_t *p;
+    uint8_t *p_end;
+
+    int     i_left;    /* i_count number of available bits */
+} bs_t;
+
+static inline void bs_init( bs_t *s, void *p_data, int i_data )
+{
+    s->p_start = (uint8_t*)p_data;
+    s->p       = (uint8_t*)p_data;
+    s->p_end   = s->p + i_data;
+    s->i_left  = 8;
+}
+static inline int bs_pos( bs_t *s )
+{
+    return( 8 * ( s->p - s->p_start ) + 8 - s->i_left );
+}
+static inline int bs_eof( bs_t *s )
+{
+    return( s->p >= s->p_end ? 1: 0 );
+}
+static inline uint32_t bs_read( bs_t *s, int i_count )
+{
+     static uint32_t i_mask[33] ={0x00,
+                                  0x01,      0x03,      0x07,      0x0f,
+                                  0x1f,      0x3f,      0x7f,      0xff,
+                                  0x1ff,     0x3ff,     0x7ff,     0xfff,
+                                  0x1fff,    0x3fff,    0x7fff,    0xffff,
+                                  0x1ffff,   0x3ffff,   0x7ffff,   0xfffff,
+                                  0x1fffff,  0x3fffff,  0x7fffff,  0xffffff,
+                                  0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff,
+                                  0x1fffffff,0x3fffffff,0x7fffffff,0xffffffff};
+    int      i_shr;
+    uint32_t i_result = 0;
+
+    while( i_count > 0 )
+    {
+        if( s->p >= s->p_end )
+        {
+            break;
+        }
+
+        if( ( i_shr = s->i_left - i_count ) >= 0 )
+        {
+            /* more in the buffer than requested */
+            i_result |= ( *s->p >> i_shr )&i_mask[i_count];
+            s->i_left -= i_count;
+            if( s->i_left == 0 )
+            {
+                s->p++;
+                s->i_left = 8;
+            }
+            return( i_result );
+        }
+        else
+        {
+            /* less in the buffer than requested */
+           i_result |= (*s->p&i_mask[s->i_left]) << -i_shr;
+           i_count  -= s->i_left;
+           s->p++;
+           s->i_left = 8;
+        }
+    }
+
+    return( i_result );
+}
+
+#if 0
+/* Only > i386 */
+static uint32_t bswap32( uint32_t x )
+{
+    asm( "bswap   %0": "=r" (x):"0" (x));
+    return x;
+}
+/* work only for i_count <= 32 - 7 */
+static inline uint32_t bs_read( bs_t *s, int i_count )
+{
+    if( s->p < s->p_end && i_count > 0 )
+    {
+#if 0
+        uint32_t i_cache = ((s->p[0] << 24)+(s->p[1] << 16)+(s->p[2] << 8)+s->p[3]) << (8-s->i_left);
+#else
+        uint32_t i_cache = bswap32( *((uint32_t*)s->p) ) << (8-s->i_left);
+#endif
+        uint32_t i_ret = i_cache >> ( 32 - i_count);
+
+        s->i_left -= i_count;
+#if 0
+        if( s->i_left <= 0 )
+        {
+            int i_skip = (8-s->i_left) >> 3;
+
+            s->p += i_skip;
+
+            s->i_left += i_skip << 3;
+        }
+#else
+        while( s->i_left <= 0 )
+        {
+            s->p++;
+            s->i_left += 8;
+        }
+#endif
+        return i_ret;
+    }
+    return 0;
+}
+
+#endif
+static inline uint32_t bs_read1( bs_t *s )
+{
+
+    if( s->p < s->p_end )
+    {
+        unsigned int i_result;
+
+        s->i_left--;
+        i_result = ( *s->p >> s->i_left )&0x01;
+        if( s->i_left == 0 )
+        {
+            s->p++;
+            s->i_left = 8;
+        }
+        return i_result;
+    }
+
+    return 0;
+}
+static inline uint32_t bs_show( bs_t *s, int i_count )
+{
+#if 0
+    bs_t     s_tmp = *s;
+    return bs_read( &s_tmp, i_count );
+#else
+    if( s->p < s->p_end && i_count > 0 )
+    {
+        uint32_t i_cache = ((s->p[0] << 24)+(s->p[1] << 16)+(s->p[2] << 8)+s->p[3]) << (8-s->i_left);
+        return( i_cache >> ( 32 - i_count) );
+    }
+    return 0;
+#endif
+}
+
+/* TODO optimize */
+static inline void bs_skip( bs_t *s, int i_count )
+{
+    s->i_left -= i_count;
+
+    while( s->i_left <= 0 )
+    {
+        s->p++;
+        s->i_left += 8;
+    }
+}
+
+
+static inline int bs_read_ue( bs_t *s )
+{
+    int i = 0;
+
+    while( bs_read1( s ) == 0 && s->p < s->p_end && i < 32 )
+    {
+        i++;
+    }
+    return( ( 1 << i) - 1 + bs_read( s, i ) );
+}
+static inline int bs_read_se( bs_t *s )
+{
+    int val = bs_read_ue( s );
+
+    return val&0x01 ? (val+1)/2 : -(val/2);
+}
+
+static inline int bs_read_te( bs_t *s, int x )
+{
+    if( x == 1 )
+    {
+        return 1 - bs_read1( s );
+    }
+    else if( x > 1 )
+    {
+        return bs_read_ue( s );
+    }
+    return 0;
+}
+
+/* TODO optimize (write x bits at once) */
+static inline void bs_write( bs_t *s, int i_count, uint32_t i_bits )
+{
+    while( i_count > 0 )
+    {
+        if( s->p >= s->p_end )
+        {
+            break;
+        }
+
+        i_count--;
+
+        if( ( i_bits >> i_count )&0x01 )
+        {
+            *s->p |= 1 << ( s->i_left - 1 );
+        }
+        else
+        {
+            *s->p &= ~( 1 << ( s->i_left - 1 ) );
+        }
+        s->i_left--;
+        if( s->i_left == 0 )
+        {
+            s->p++;
+            s->i_left = 8;
+        }
+    }
+}
+
+static inline void bs_write1( bs_t *s, uint32_t i_bits )
+{
+    if( s->p < s->p_end )
+    {
+        s->i_left--;
+
+        if( i_bits&0x01 )
+        {
+            *s->p |= 1 << s->i_left;
+        }
+        else
+        {
+            *s->p &= ~( 1 << s->i_left );
+        }
+        if( s->i_left == 0 )
+        {
+            s->p++;
+            s->i_left = 8;
+        }
+    }
+}
+
+static inline void bs_align( bs_t *s )
+{
+    if( s->i_left != 8 )
+    {
+        s->i_left = 8;
+        s->p++;
+    }
+}
+static inline void bs_align_0( bs_t *s )
+{
+    if( s->i_left != 8 )
+    {
+        bs_write( s, s->i_left, 0 );
+    }
+}
+static inline void bs_align_1( bs_t *s )
+{
+    if( s->i_left != 8 )
+    {
+        bs_write( s, s->i_left, ~0 );
+    }
+}
+
+
+
+/* golomb functions */
+
+static inline void bs_write_ue( bs_t *s, unsigned int val )
+{
+    int i_size = 0;
+    static const int i_size0_255[256] =
+    {
+        1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
+        6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
+        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+        7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
+        8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+        8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+        8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
+        8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
+    };
+
+    if( val == 0 )
+    {
+        bs_write( s, 1, 1 );
+    }
+    else
+    {
+        unsigned int tmp = ++val;
+
+        if( tmp >= 0x00010000 )
+        {
+            i_size += 16;
+            tmp >>= 16;
+        }
+        if( tmp >= 0x100 )
+        {
+            i_size += 8;
+            tmp >>= 8;
+        }
+        i_size += i_size0_255[tmp];
+
+        bs_write( s, 2 * i_size - 1, val );
+    }
+}
+
+static inline void bs_write_se( bs_t *s, int val )
+{
+    bs_write_ue( s, val <= 0 ? -val * 2 : val * 2 - 1);
+}
+
+static inline void bs_write_te( bs_t *s, int x, int val )
+{
+    if( x == 1 )
+    {
+        bs_write( s, 1, ~val );
+    }
+    else if( x > 1 )
+    {
+        bs_write_ue( s, val );
+    }
+}
+
+static inline void bs_rbsp_trailing( bs_t *s )
+{
+    bs_write( s, 1, 1 );
+    if( s->i_left != 8 )
+    {
+        bs_write( s, s->i_left, 0x00 );
+    }
+}
+
+static inline int bs_size_ue( unsigned int val )
+{
+    static const int i_size0_254[255] =
+    {
+        1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7,
+        9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+        11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
+        11,11,11,11,11,11,11,11,11,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+        13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+        13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,
+        13,13,13,13,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+        15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+        15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+        15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+        15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+        15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15
+    };
+
+    if( val < 255 )
+    {
+        return i_size0_254[val];
+    }
+    else
+    {
+        int i_size = 0;
+
+        val++;
+
+        if( val >= 0x10000 )
+        {
+            i_size += 32;
+            val = (val >> 16) - 1;
+        }
+        if( val >= 0x100 )
+        {
+            i_size += 16;
+            val = (val >> 8) - 1;
+        }
+        return i_size0_254[val] + i_size;
+    }
+}
+
+static inline int bs_size_se( int val )
+{
+    return bs_size_ue( val <= 0 ? -val * 2 : val * 2 - 1);
+}
+
+static inline int bs_size_te( int x, int val )
+{
+    if( x == 1 )
+    {
+        return 1;
+    }
+    else if( x > 1 )
+    {
+        return bs_size_ue( val );
+    }
+    return 0;
+}
+
+
+
+#endif

Added: vic/branches/mpeg4/win32/common/cabac.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/cabac.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * cabac.h: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: cabac.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _CABAC_H
+#define _CABAC_H 1
+
+typedef struct
+{
+    /* model */
+    struct
+    {
+        int i_model;
+        int i_cost;
+    } slice[3];
+
+    /* context */
+    /* states 436-459 are for interlacing, so are omitted for now */
+    struct
+    {
+        int i_state;
+        int i_mps;
+        int i_count;
+    } ctxstate[436];
+
+    /* state */
+    int i_low;
+    int i_range;
+
+    int i_sym_cnt;
+
+    /* bit stream */
+    int b_first_bit;
+    int i_bits_outstanding;
+    bs_t *s;
+
+} x264_cabac_t;
+
+/* encoder/decoder: init the contexts given i_slice_type, the quantif and the model */
+void x264_cabac_context_init( x264_cabac_t *cb, int i_slice_type, int i_qp, int i_model );
+
+/* decoder only: */
+void x264_cabac_decode_init    ( x264_cabac_t *cb, bs_t *s );
+int  x264_cabac_decode_decision( x264_cabac_t *cb, int i_ctx_idx );
+int  x264_cabac_decode_bypass  ( x264_cabac_t *cb );
+int  x264_cabac_decode_terminal( x264_cabac_t *cb );
+
+/* encoder only: adaptive model init */
+void x264_cabac_model_init( x264_cabac_t *cb );
+int  x264_cabac_model_get ( x264_cabac_t *cb, int i_slice_type );
+void x264_cabac_model_update( x264_cabac_t *cb, int i_slice_type, int i_qp );
+/* encoder only: */
+void x264_cabac_encode_init ( x264_cabac_t *cb, bs_t *s );
+void x264_cabac_encode_decision( x264_cabac_t *cb, int i_ctx_idx, int b );
+void x264_cabac_encode_bypass( x264_cabac_t *cb, int b );
+void x264_cabac_encode_terminal( x264_cabac_t *cb, int b );
+void x264_cabac_encode_flush( x264_cabac_t *cb );
+
+static inline int x264_cabac_pos( x264_cabac_t *cb )
+{
+    return bs_pos( cb->s ) + cb->i_bits_outstanding;
+}
+
+#endif

Added: vic/branches/mpeg4/win32/common/clip1.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/clip1.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * clip1.h: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: clip1.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _CLIP1_H
+#define _CLIP1_H 1
+
+/* Clip1 table
+ * XXX : only for tap filter.
+ *
+ * With tap filter (( 1, -5, 20, 20, -5, 1 ) + 16 )/ 32
+ * -> (-2*5 * 255+16)/32 <= out <= (2*1*255 + 2*20*255+16)/32
+ * -> -80 <= out <= 335
+ * So we need a table of 80+335+1 = 416 entries
+ */
+
+static const uint8_t x264_mc_clip1_table[80+1+335] =
+{
+    /* -80 -> -1 */
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,
+    /* 0 -> 255 */
+    0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16, 17,
+    18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+    36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+    54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
+    72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
+    90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,101,102,103,104,105,106,107,
+    108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,
+    126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
+    144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,
+    162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,
+    180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,
+    198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
+    216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,
+    234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,
+    252,253,254,255,
+    /* 256 -> 340 */
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+    255,255,255,255,255,255,255,255,
+};
+
+static inline uint8_t x264_mc_clip1( int x )
+{
+    return x264_mc_clip1_table[x+80];
+}
+
+static inline uint8_t x264_clip_uint8( int x )
+{
+    return x&(~255) ? (-x)>>31 : x;
+}
+
+#endif

Added: vic/branches/mpeg4/win32/common/common.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/common.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,503 @@
+/*****************************************************************************
+ * common.h: h264 encoder
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: common.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _COMMON_H
+#define _COMMON_H 1
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#else
+#include <inttypes.h>
+#endif
+#include <stdarg.h>
+
+#ifdef _MSC_VER
+#define snprintf _snprintf
+#define X264_VERSION "" // no configure script for msvc
+#endif
+
+#include "x264.h"
+#include "bs.h"
+#include "set.h"
+#include "predict.h"
+#include "pixel.h"
+#include "mc.h"
+#include "frame.h"
+#include "dct.h"
+#include "cabac.h"
+#include "csp.h"
+
+/****************************************************************************
+ * Macros
+ ****************************************************************************/
+#define X264_MIN(a,b) ( (a)<(b) ? (a) : (b) )
+#define X264_MAX(a,b) ( (a)>(b) ? (a) : (b) )
+#define X264_ABS(a)   ( (a)< 0 ? -(a) : (a) )
+#define X264_MIN3(a,b,c) X264_MIN((a),X264_MIN((b),(c)))
+#define X264_MIN4(a,b,c,d) X264_MIN((a),X264_MIN3((b),(c),(d)))
+
+/****************************************************************************
+ * Generals functions
+ ****************************************************************************/
+/* x264_malloc : will do or emulate a memalign
+ * XXX you HAVE TO use x264_free for buffer allocated
+ * with x264_malloc
+ */
+void *x264_malloc( int );
+void *x264_realloc( void *p, int i_size );
+void  x264_free( void * );
+
+/* x264_slurp_file: malloc space for the whole file and read it */
+char *x264_slurp_file( const char *filename );
+
+/* mdate: return the current date in microsecond */
+int64_t x264_mdate( void );
+
+/* log */
+void x264_log( x264_t *h, int i_level, const char *psz_fmt, ... );
+
+static inline int x264_clip3( int v, int i_min, int i_max )
+{
+    return ( (v < i_min) ? i_min : (v > i_max) ? i_max : v );
+}
+
+static inline float x264_clip3f( float v, float f_min, float f_max )
+{
+    return ( (v < f_min) ? f_min : (v > f_max) ? f_max : v );
+}
+
+static inline int x264_median( int a, int b, int c )
+{
+    int min = a, max =a;
+    if( b < min )
+        min = b;
+    else
+        max = b;    /* no need to do 'b > max' (more consuming than always doing affectation) */
+
+    if( c < min )
+        min = c;
+    else if( c > max )
+        max = c;
+
+    return a + b + c - min - max;
+}
+
+
+/****************************************************************************
+ *
+ ****************************************************************************/
+enum slice_type_e
+{
+    SLICE_TYPE_P  = 0,
+    SLICE_TYPE_B  = 1,
+    SLICE_TYPE_I  = 2,
+    SLICE_TYPE_SP = 3,
+    SLICE_TYPE_SI = 4
+};
+
+static const char slice_type_to_char[] = { 'P', 'B', 'I', 'S', 'S' };
+
+typedef struct
+{
+    x264_sps_t *sps;
+    x264_pps_t *pps;
+
+    int i_type;
+    int i_first_mb;
+    int i_last_mb;
+
+    int i_pps_id;
+
+    int i_frame_num;
+
+    int b_field_pic;
+    int b_bottom_field;
+
+    int i_idr_pic_id;   /* -1 if nal_type != 5 */
+
+    int i_poc_lsb;
+    int i_delta_poc_bottom;
+
+    int i_delta_poc[2];
+    int i_redundant_pic_cnt;
+
+    int b_direct_spatial_mv_pred;
+
+    int b_num_ref_idx_override;
+    int i_num_ref_idx_l0_active;
+    int i_num_ref_idx_l1_active;
+
+    int b_ref_pic_list_reordering_l0;
+    int b_ref_pic_list_reordering_l1;
+    struct {
+        int idc;
+        int arg;
+    } ref_pic_list_order[2][16];
+
+    int i_cabac_init_idc;
+
+    int i_qp_delta;
+    int b_sp_for_swidth;
+    int i_qs_delta;
+
+    /* deblocking filter */
+    int i_disable_deblocking_filter_idc;
+    int i_alpha_c0_offset;
+    int i_beta_offset;
+
+} x264_slice_header_t;
+
+/* From ffmpeg
+ */
+#define X264_SCAN8_SIZE (6*8)
+#define X264_SCAN8_0 (4+1*8)
+
+static const int x264_scan8[16+2*4] =
+{
+    /* Luma */
+    4+1*8, 5+1*8, 4+2*8, 5+2*8,
+    6+1*8, 7+1*8, 6+2*8, 7+2*8,
+    4+3*8, 5+3*8, 4+4*8, 5+4*8,
+    6+3*8, 7+3*8, 6+4*8, 7+4*8,
+
+    /* Cb */
+    1+1*8, 2+1*8,
+    1+2*8, 2+2*8,
+
+    /* Cr */
+    1+4*8, 2+4*8,
+    1+5*8, 2+5*8,
+};
+/*
+   0 1 2 3 4 5 6 7
+ 0
+ 1   B B   L L L L
+ 2   B B   L L L L
+ 3         L L L L
+ 4   R R   L L L L
+ 5   R R
+*/
+
+#define X264_BFRAME_MAX 16
+#define X264_SLICE_MAX 4
+#define X264_NAL_MAX (4 + X264_SLICE_MAX)
+
+typedef struct x264_ratecontrol_t   x264_ratecontrol_t;
+typedef struct x264_vlc_table_t     x264_vlc_table_t;
+
+struct x264_t
+{
+    /* encoder parameters */
+    x264_param_t    param;
+
+    x264_t *thread[X264_SLICE_MAX];
+
+    /* bitstream output */
+    struct
+    {
+        int         i_nal;
+        x264_nal_t  nal[X264_NAL_MAX];
+        int         i_bitstream;    /* size of p_bitstream */
+        uint8_t     *p_bitstream;   /* will hold data for all nal */
+        bs_t        bs;
+    } out;
+
+    /* frame number/poc */
+    int             i_frame;
+
+    int             i_frame_offset; /* decoding only */
+    int             i_frame_num;    /* decoding only */
+    int             i_poc_msb;      /* decoding only */
+    int             i_poc_lsb;      /* decoding only */
+    int             i_poc;          /* decoding only */
+
+    int             i_thread_num;   /* threads only */
+    int             i_nal_type;     /* threads only */
+    int             i_nal_ref_idc;  /* threads only */
+
+    /* We use only one SPS and one PPS */
+    x264_sps_t      sps_array[1];
+    x264_sps_t      *sps;
+    x264_pps_t      pps_array[1];
+    x264_pps_t      *pps;
+    int             i_idr_pic_id;
+
+    int             dequant4_mf[4][6][4][4];
+    int             dequant8_mf[2][6][8][8];
+    int             quant4_mf[4][6][4][4];
+    int             quant8_mf[2][6][8][8];
+
+    /* Slice header */
+    x264_slice_header_t sh;
+
+    /* cabac context */
+    x264_cabac_t    cabac;
+
+    struct
+    {
+        /* Frames to be encoded (whose types have been decided) */
+        x264_frame_t *current[X264_BFRAME_MAX+3];
+        /* Temporary buffer (frames types not yet decided) */
+        x264_frame_t *next[X264_BFRAME_MAX+3];
+        /* Unused frames */
+        x264_frame_t *unused[X264_BFRAME_MAX+3];
+        /* For adaptive B decision */
+        x264_frame_t *last_nonb;
+
+        /* frames used for reference +1 for decoding + sentinels */
+        x264_frame_t *reference[16+2+1+2];
+
+        int i_last_idr; /* Frame number of the last IDR */
+
+        int i_input;    /* Number of input frames already accepted */
+
+        int i_max_dpb;  /* Number of frames allocated in the decoded picture buffer */
+        int i_max_ref0;
+        int i_max_ref1;
+        int i_delay;    /* Number of frames buffered for B reordering */
+    } frames;
+
+    /* current frame being encoded */
+    x264_frame_t    *fenc;
+
+    /* frame being reconstructed */
+    x264_frame_t    *fdec;
+
+    /* references lists */
+    int             i_ref0;
+    x264_frame_t    *fref0[16+3];     /* ref list 0 */
+    int             i_ref1;
+    x264_frame_t    *fref1[16+3];     /* ref list 1 */
+    int             b_ref_reorder[2];
+
+
+
+    /* Current MB DCT coeffs */
+    struct
+    {
+        DECLARE_ALIGNED( int, luma16x16_dc[16], 16 );
+        DECLARE_ALIGNED( int, chroma_dc[2][4], 16 );
+        // FIXME merge with union
+        DECLARE_ALIGNED( int, luma8x8[4][64], 16 );
+        union
+        {
+            DECLARE_ALIGNED( int, residual_ac[15], 16 );
+            DECLARE_ALIGNED( int, luma4x4[16], 16 );
+        } block[16+8];
+    } dct;
+
+    /* MB table and cache for current frame/mb */
+    struct
+    {
+        int     i_mb_count;                 /* number of mbs in a frame */
+
+        /* Strides */
+        int     i_mb_stride;
+        int     i_b8_stride;
+        int     i_b4_stride;
+
+        /* Current index */
+        int     i_mb_x;
+        int     i_mb_y;
+        int     i_mb_xy;
+        int     i_b8_xy;
+        int     i_b4_xy;
+        
+        /* Search parameters */
+        int     i_me_method;
+        int     i_subpel_refine;
+        int     b_chroma_me;
+        /* Allowed qpel MV range to stay within the picture + emulated edge pixels */
+        int     mv_min[2];
+        int     mv_max[2];
+        /* Fullpel MV range for motion search */
+        int     mv_min_fpel[2];
+        int     mv_max_fpel[2];
+
+        /* neighboring MBs */
+        unsigned int i_neighbour;
+        unsigned int i_neighbour8[4];       /* neighbours of each 8x8 or 4x4 block that are available */
+        unsigned int i_neighbour4[16];      /* at the time the block is coded */
+        int     i_mb_type_top; 
+        int     i_mb_type_left; 
+        int     i_mb_type_topleft; 
+        int     i_mb_type_topright; 
+
+        /* mb table */
+        int8_t  *type;                      /* mb type */
+        int8_t  *qp;                        /* mb qp */
+        int16_t *cbp;                       /* mb cbp: 0x0?: luma, 0x?0: chroma, 0x100: luma dc, 0x0200 and 0x0400: chroma dc  (all set for PCM)*/
+        int8_t  (*intra4x4_pred_mode)[7];   /* intra4x4 pred mode. for non I4x4 set to I_PRED_4x4_DC(2) */
+        uint8_t (*non_zero_count)[16+4+4];  /* nzc. for I_PCM set to 16 */
+        int8_t  *chroma_pred_mode;          /* chroma_pred_mode. cabac only. for non intra I_PRED_CHROMA_DC(0) */
+        int16_t (*mv[2])[2];                /* mb mv. set to 0 for intra mb */
+        int16_t (*mvd[2])[2];               /* mb mv difference with predict. set to 0 if intra. cabac only */
+        int8_t   *ref[2];                   /* mb ref. set to -1 if non used (intra or Lx only) */
+        int16_t (*mvr[2][16])[2];           /* 16x16 mv for each possible ref */
+        int8_t  *skipbp;                    /* block pattern for SKIP or DIRECT (sub)mbs. B-frames + cabac only */
+        int8_t  *mb_transform_size;         /* transform_size_8x8_flag of each mb */
+
+        /* current value */
+        int     i_type;
+        int     i_partition;
+        int     i_sub_partition[4];
+        int     b_transform_8x8;
+
+        int     i_cbp_luma;
+        int     i_cbp_chroma;
+
+        int     i_intra16x16_pred_mode;
+        int     i_chroma_pred_mode;
+
+        struct
+        {
+            /* pointer over mb of the frame to be compressed */
+            uint8_t *p_fenc[3];
+
+            /* pointer over mb of the frame to be reconstrucated  */
+            uint8_t *p_fdec[3];
+
+            /* pointer over mb of the references */
+            uint8_t *p_fref[2][16][4+2]; /* last: lN, lH, lV, lHV, cU, cV */
+
+            /* common stride */
+            int     i_stride[3];
+        } pic;
+
+        /* cache */
+        struct
+        {
+            /* real intra4x4_pred_mode if I_4X4 or I_8X8, I_PRED_4x4_DC if mb available, -1 if not */
+            int     intra4x4_pred_mode[X264_SCAN8_SIZE];
+
+            /* i_non_zero_count if availble else 0x80 */
+            int     non_zero_count[X264_SCAN8_SIZE];
+
+            /* -1 if unused, -2 if unavaible */
+            int8_t  ref[2][X264_SCAN8_SIZE];
+
+            /* 0 if non avaible */
+            int16_t mv[2][X264_SCAN8_SIZE][2];
+            int16_t mvd[2][X264_SCAN8_SIZE][2];
+
+            /* 1 if SKIP or DIRECT. set only for B-frames + CABAC */
+            int8_t  skip[X264_SCAN8_SIZE];
+
+            int16_t direct_mv[2][X264_SCAN8_SIZE][2];
+            int8_t  direct_ref[2][X264_SCAN8_SIZE];
+
+            /* number of neighbors (top and left) that used 8x8 dct */
+            int     i_neighbour_transform_size;
+            int     b_transform_8x8_allowed;
+        } cache;
+
+        /* */
+        int     i_qp;       /* current qp */
+        int     i_last_qp;  /* last qp */
+        int     i_last_dqp; /* last delta qp */
+        int     b_variable_qp; /* whether qp is allowed to vary per macroblock */
+        int     b_lossless;
+
+        /* B_direct and weighted prediction */
+        int     dist_scale_factor[16][16];
+        int     bipred_weight[16][16];
+        /* maps fref1[0]'s ref indices into the current list0 */
+        int     map_col_to_list0_buf[2]; // for negative indices
+        int     map_col_to_list0[16];
+    } mb;
+
+    /* rate control encoding only */
+    x264_ratecontrol_t *rc;
+
+    int i_last_inter_size;
+    int i_last_intra_size;
+    int i_last_intra_qp;
+
+    /* stats */
+    struct
+    {
+        /* Current frame stats */
+        struct
+        {
+            /* Headers bits (MV+Ref+MB Block Type */
+            int i_hdr_bits;
+            /* Texture bits (Intra/Predicted) */
+            int i_itex_bits;
+            int i_ptex_bits;
+            /* ? */
+            int i_misc_bits;
+            /* MB type counts */
+            int i_mb_count[19];
+            int i_mb_count_i;
+            int i_mb_count_p;
+            int i_mb_count_skip;
+            int i_mb_count_8x8dct[2];
+            /* Estimated (SATD) cost as Intra/Predicted frame */
+            /* XXX: both omit the cost of MBs coded as P_SKIP */
+            int i_intra_cost;
+            int i_inter_cost;
+        } frame;
+
+        /* Cummulated stats */
+
+        /* per slice info */
+        int   i_slice_count[5];
+        int64_t i_slice_size[5];
+        int     i_slice_qp[5];
+        /* */
+        int64_t i_sqe_global[5];
+        float   f_psnr_average[5];
+        float   f_psnr_mean_y[5];
+        float   f_psnr_mean_u[5];
+        float   f_psnr_mean_v[5];
+        /* */
+        int64_t i_mb_count[5][19];
+        int64_t i_mb_count_8x8dct[2];
+
+    } stat;
+
+    /* CPU functions dependants */
+    x264_predict_t      predict_16x16[4+3];
+    x264_predict_t      predict_8x8c[4+3];
+    x264_predict8x8_t   predict_8x8[9+3];
+    x264_predict_t      predict_4x4[9+3];
+
+    x264_pixel_function_t pixf;
+    x264_mc_functions_t   mc;
+    x264_dct_function_t   dctf;
+    x264_csp_function_t   csp;
+
+    /* vlc table for decoding purpose only */
+    x264_vlc_table_t *x264_coeff_token_lookup[5];
+    x264_vlc_table_t *x264_level_prefix_lookup;
+    x264_vlc_table_t *x264_total_zeros_lookup[15];
+    x264_vlc_table_t *x264_total_zeros_dc_lookup[3];
+    x264_vlc_table_t *x264_run_before_lookup[7];
+
+#if VISUALIZE
+    struct visualize_t *visualize;
+#endif
+};
+
+#endif
+

Added: vic/branches/mpeg4/win32/common/cpu.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/cpu.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * cpu.h: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: cpu.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _CPU_H
+#define _CPU_H 1
+
+uint32_t x264_cpu_detect( void );
+
+/* probably MMX(EXT) centric but .... */
+void     x264_cpu_restore( uint32_t cpu );
+
+#endif

Added: vic/branches/mpeg4/win32/common/csp.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/csp.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * csp.h: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2004 Laurent Aimar
+ * $Id: csp.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _CSP_H
+#define _CSP_H 1
+
+typedef struct
+{
+    void (*i420)( x264_frame_t *, x264_image_t *, int i_width, int i_height );
+    void (*i422)( x264_frame_t *, x264_image_t *, int i_width, int i_height );
+    void (*i444)( x264_frame_t *, x264_image_t *, int i_width, int i_height );
+    void (*yv12)( x264_frame_t *, x264_image_t *, int i_width, int i_height );
+    void (*yuyv)( x264_frame_t *, x264_image_t *, int i_width, int i_height );
+    void (*rgb )( x264_frame_t *, x264_image_t *, int i_width, int i_height );
+    void (*bgr )( x264_frame_t *, x264_image_t *, int i_width, int i_height );
+    void (*bgra)( x264_frame_t *, x264_image_t *, int i_width, int i_height );
+} x264_csp_function_t;
+
+
+void x264_csp_init( int cpu, int i_csp, x264_csp_function_t *pf );
+
+#endif
+

Added: vic/branches/mpeg4/win32/common/dct.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/dct.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * dct.h: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: dct.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _DCT_H
+#define _DCT_H 1
+
+typedef struct
+{
+    void (*sub4x4_dct)   ( int16_t dct[4][4],  uint8_t *pix1, int i_pix1, uint8_t *pix2, int i_pix2 );
+    void (*add4x4_idct)  ( uint8_t *p_dst, int i_dst, int16_t dct[4][4] );
+
+    void (*sub8x8_dct)   ( int16_t dct[4][4][4],  uint8_t *pix1, int i_pix1, uint8_t *pix2, int i_pix2 );
+    void (*add8x8_idct)  ( uint8_t *p_dst, int i_dst, int16_t dct[4][4][4] );
+
+    void (*sub16x16_dct)   ( int16_t dct[16][4][4],  uint8_t *pix1, int i_pix1, uint8_t *pix2, int i_pix2 );
+    void (*add16x16_idct)  ( uint8_t *p_dst, int i_dst, int16_t dct[16][4][4] );
+
+    void (*sub8x8_dct8)   ( int16_t dct[8][8],  uint8_t *pix1, int i_pix1, uint8_t *pix2, int i_pix2 );
+    void (*add8x8_idct8)  ( uint8_t *p_dst, int i_dst, int16_t dct[8][8] );
+
+    void (*sub16x16_dct8)   ( int16_t dct[4][8][8],  uint8_t *pix1, int i_pix1, uint8_t *pix2, int i_pix2 );
+    void (*add16x16_idct8)  ( uint8_t *p_dst, int i_dst, int16_t dct[4][8][8] );
+
+    void (*dct4x4dc) ( int16_t d[4][4] );
+    void (*idct4x4dc)( int16_t d[4][4] );
+
+    void (*dct2x2dc) ( int16_t d[2][2] );
+    void (*idct2x2dc)( int16_t d[2][2] );
+
+} x264_dct_function_t;
+
+void x264_dct_init( int cpu, x264_dct_function_t *dctf );
+
+#endif

Added: vic/branches/mpeg4/win32/common/display.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/display.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * x264: h264 encoder
+ *****************************************************************************
+ * Copyright (C) 2005 x264 project
+ *
+ * Author: Tuukka Toivonen <tuukkat at ee.oulu.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _DISPLAY_H
+#define _DISPLAY_H 1
+
+void disp_sync(void);
+void disp_setcolor(unsigned char *name);
+/* Display a region of byte wide memory as a grayscale image.
+ * num is the window to use for displaying. */
+void disp_gray(int num, char *data, int width, int height,
+               int stride, const unsigned char *title);
+void disp_gray_zoom(int num, char *data, int width, int height,
+               int stride, const unsigned char *title, int zoom);
+void disp_point(int num, int x1, int y1);
+void disp_line(int num, int x1, int y1, int x2, int y2);
+void disp_rect(int num, int x1, int y1, int x2, int y2);
+
+#endif

Added: vic/branches/mpeg4/win32/common/frame.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/frame.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * frame.h: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: frame.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _FRAME_H
+#define _FRAME_H 1
+
+typedef struct
+{
+    /* */
+    int     i_poc;
+    int     i_type;
+    int     i_qpplus1;
+    int64_t i_pts;
+    int     i_frame;    /* Presentation frame number */
+    int     i_frame_num; /* Coded frame number */
+    int     b_kept_as_ref;
+
+    /* YUV buffer */
+    int     i_plane;
+    int     i_stride[4];
+    int     i_lines[4];
+    int     i_stride_lowres;
+    int     i_lines_lowres;
+    uint8_t *plane[4];
+    uint8_t *filtered[4]; /* plane[0], H, V, HV */
+    uint8_t *lowres[4]; /* half-size copy of input frame: Orig, H, V, HV */
+
+    /* for unrestricted mv we allocate more data than needed
+     * allocated data are stored in buffer */
+    void    *buffer[11];
+
+    /* motion data */
+    int8_t  *mb_type;
+    int16_t (*mv[2])[2];
+    int8_t  *ref[2];
+    int     i_ref[2];
+    int     ref_poc[2][16];
+
+    /* for adaptive B-frame decision.
+     * contains the SATD cost of the lowres frame encoded in various modes
+     * FIXME: how big an array do we need? */
+    int     i_cost_est[16][16];
+    int     i_intra_mbs[16];
+
+} x264_frame_t;
+
+x264_frame_t *x264_frame_new( x264_t *h );
+void          x264_frame_delete( x264_frame_t *frame );
+
+void          x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src );
+
+void          x264_frame_expand_border( x264_frame_t *frame );
+void          x264_frame_expand_border_filtered( x264_frame_t *frame );
+void          x264_frame_expand_border_lowres( x264_frame_t *frame );
+
+void          x264_frame_deblocking_filter( x264_t *h, int i_slice_type );
+
+void          x264_frame_filter( int cpu, x264_frame_t *frame );
+void          x264_frame_init_lowres( int cpu, x264_frame_t *frame );
+
+#endif

Added: vic/branches/mpeg4/win32/common/macroblock.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/macroblock.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,283 @@
+/*****************************************************************************
+ * macroblock.h: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: macroblock.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _MACROBLOCK_H
+#define _MACROBLOCK_H 1
+
+enum macroblock_position_e
+{
+    MB_LEFT     = 0x01,
+    MB_TOP      = 0x02,
+    MB_TOPRIGHT = 0x04,
+    MB_TOPLEFT  = 0x08,
+
+    MB_PRIVATE  = 0x10,
+};
+
+
+/* XXX mb_type isn't the one written in the bitstream -> only internal usage */
+#define IS_INTRA(type) ( (type) == I_4x4 || (type) == I_8x8 || (type) == I_16x16 )
+#define IS_SKIP(type)  ( (type) == P_SKIP || (type) == B_SKIP )
+#define IS_DIRECT(type)  ( (type) == B_DIRECT )
+enum mb_class_e
+{
+    I_4x4           = 0,
+    I_8x8           = 1,
+    I_16x16         = 2,
+    I_PCM           = 3,
+
+    P_L0            = 4,
+    P_8x8           = 5,
+    P_SKIP          = 6,
+
+    B_DIRECT        = 7,
+    B_L0_L0         = 8,
+    B_L0_L1         = 9,
+    B_L0_BI         = 10,
+    B_L1_L0         = 11,
+    B_L1_L1         = 12,
+    B_L1_BI         = 13,
+    B_BI_L0         = 14,
+    B_BI_L1         = 15,
+    B_BI_BI         = 16,
+    B_8x8           = 17,
+    B_SKIP          = 18,
+};
+static const int x264_mb_type_fix[19] =
+{
+    I_4x4, I_4x4, I_16x16, I_PCM,
+    P_L0, P_8x8, P_SKIP,
+    B_DIRECT, B_L0_L0, B_L0_L1, B_L0_BI, B_L1_L0, B_L1_L1,
+    B_L1_BI, B_BI_L0, B_BI_L1, B_BI_BI, B_8x8, B_SKIP
+};
+static const int x264_mb_type_list0_table[19][2] =
+{
+    {0,0}, {0,0}, {0,0}, {0,0}, /* INTRA */
+    {1,1},                  /* P_L0 */
+    {0,0},                  /* P_8x8 */
+    {1,1},                  /* P_SKIP */
+    {0,0},                  /* B_DIRECT */
+    {1,1}, {1,0}, {1,1},    /* B_L0_* */
+    {0,1}, {0,0}, {0,1},    /* B_L1_* */
+    {1,1}, {1,0}, {1,1},    /* B_BI_* */
+    {0,0},                  /* B_8x8 */
+    {0,0}                   /* B_SKIP */
+};
+static const int x264_mb_type_list1_table[19][2] =
+{
+    {0,0}, {0,0}, {0,0}, {0,0}, /* INTRA */
+    {0,0},                  /* P_L0 */
+    {0,0},                  /* P_8x8 */
+    {0,0},                  /* P_SKIP */
+    {0,0},                  /* B_DIRECT */
+    {0,0}, {0,1}, {0,1},    /* B_L0_* */
+    {1,0}, {1,1}, {1,1},    /* B_L1_* */
+    {1,0}, {1,1}, {1,1},    /* B_BI_* */
+    {0,0},                  /* B_8x8 */
+    {0,0}                   /* B_SKIP */
+};
+
+#define IS_SUB4x4(type) ( (type ==D_L0_4x4)||(type ==D_L1_4x4)||(type ==D_BI_4x4))
+#define IS_SUB4x8(type) ( (type ==D_L0_4x8)||(type ==D_L1_4x8)||(type ==D_BI_4x8))
+#define IS_SUB8x4(type) ( (type ==D_L0_8x4)||(type ==D_L1_8x4)||(type ==D_BI_8x4))
+#define IS_SUB8x8(type) ( (type ==D_L0_8x8)||(type ==D_L1_8x8)||(type ==D_BI_8x8)||(type ==D_DIRECT_8x8))
+enum mb_partition_e
+{
+    /* sub partition type for P_8x8 and B_8x8 */
+    D_L0_4x4        = 0,
+    D_L0_8x4        = 1,
+    D_L0_4x8        = 2,
+    D_L0_8x8        = 3,
+
+    /* sub partition type for B_8x8 only */
+    D_L1_4x4        = 4,
+    D_L1_8x4        = 5,
+    D_L1_4x8        = 6,
+    D_L1_8x8        = 7,
+
+    D_BI_4x4        = 8,
+    D_BI_8x4        = 9,
+    D_BI_4x8        = 10,
+    D_BI_8x8        = 11,
+    D_DIRECT_8x8    = 12,
+
+    /* partition */
+    D_8x8           = 13,
+    D_16x8          = 14,
+    D_8x16          = 15,
+    D_16x16         = 16,
+};
+
+static const int x264_mb_partition_listX_table[2][17] =
+{{
+    1, 1, 1, 1, /* D_L0_* */
+    0, 0, 0, 0, /* D_L1_* */
+    1, 1, 1, 1, /* D_BI_* */
+    0,          /* D_DIRECT_8x8 */
+    0, 0, 0, 0  /* 8x8 .. 16x16 */
+},
+{
+    0, 0, 0, 0, /* D_L0_* */
+    1, 1, 1, 1, /* D_L1_* */
+    1, 1, 1, 1, /* D_BI_* */
+    0,          /* D_DIRECT_8x8 */
+    0, 0, 0, 0  /* 8x8 .. 16x16 */
+}};
+static const int x264_mb_partition_count_table[17] =
+{
+    /* sub L0 */
+    4, 2, 2, 1,
+    /* sub L1 */
+    4, 2, 2, 1,
+    /* sub BI */
+    4, 2, 2, 1,
+    /* Direct */
+    1,
+    /* Partition */
+    4, 2, 2, 1
+};
+
+static const int x264_zigzag_scan4[16] =
+{
+    0,  1,  4,  8,  5,  2,  3,  6,  9, 12, 13, 10,  7, 11, 14, 15
+};
+static const int x264_zigzag_scan8[64] =
+{
+    0,  1,  8, 16,  9,  2,  3, 10, 17, 24, 32, 25, 18, 11,  4,  5,
+   12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13,  6,  7, 14, 21, 28,
+   35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
+   58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63
+};  
+
+
+void x264_macroblock_cache_init( x264_t *h );
+void x264_macroblock_slice_init( x264_t *h );
+void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y );
+void x264_macroblock_cache_save( x264_t *h );
+void x264_macroblock_cache_end( x264_t *h );
+
+void x264_macroblock_bipred_init( x264_t *h );
+
+void x264_mb_dequant_4x4_dc( int16_t dct[4][4], int dequant_mf[6][4][4], int i_qscale );
+void x264_mb_dequant_2x2_dc( int16_t dct[2][2], int dequant_mf[6][4][4], int i_qscale );
+void x264_mb_dequant_4x4( int16_t dct[4][4], int dequant_mf[6][4][4], int i_qscale );
+void x264_mb_dequant_8x8( int16_t dct[8][8], int dequant_mf[6][8][8], int i_qscale );
+
+/* x264_mb_predict_mv_16x16:
+ *      set mvp with predicted mv for D_16x16 block
+ *      h->mb. need only valid values from other blocks */
+void x264_mb_predict_mv_16x16( x264_t *h, int i_list, int i_ref, int mvp[2] );
+/* x264_mb_predict_mv_pskip:
+ *      set mvp with predicted mv for P_SKIP
+ *      h->mb. need only valid values from other blocks */
+void x264_mb_predict_mv_pskip( x264_t *h, int mv[2] );
+/* x264_mb_predict_mv:
+ *      set mvp with predicted mv for all blocks except SKIP and DIRECT
+ *      h->mb. need valid ref/partition/sub of current block to be valid
+ *      and valid mv/ref from other blocks . */
+void x264_mb_predict_mv( x264_t *h, int i_list, int idx, int i_width, int mvp[2] );
+/* x264_mb_predict_mv_direct16x16:
+ *      set h->mb.cache.mv and h->mb.cache.ref for B_SKIP or B_DIRECT
+ *      h->mb. need only valid values from other blocks
+ *      return 1 on success, 0 on failure */
+int x264_mb_predict_mv_direct16x16( x264_t *h );
+/* x264_mb_load_mv_direct8x8:
+ *      set h->mb.cache.mv and h->mb.cache.ref for B_DIRECT
+ *      must be called only after x264_mb_predict_mv_direct16x16 */
+void x264_mb_load_mv_direct8x8( x264_t *h, int idx );
+/* x264_mb_predict_mv_ref16x16:
+ *      set mvc with D_16x16 prediction.
+ *      uses all neighbors, even those that didn't end up using this ref.
+ *      h->mb. need only valid values from other blocks */
+void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int mvc[5][2], int *i_mvc );
+
+
+int  x264_mb_predict_intra4x4_mode( x264_t *h, int idx );
+int  x264_mb_predict_non_zero_code( x264_t *h, int idx );
+
+/* x264_mb_transform_8x8_allowed:
+ *      check whether any partition is smaller than 8x8 (or at least
+ *      might be, according to just partition type.)
+ *      doesn't check for intra or cbp */
+int  x264_mb_transform_8x8_allowed( x264_t *h );
+
+void x264_mb_encode_i4x4( x264_t *h, int idx, int i_qscale );
+void x264_mb_encode_i8x8( x264_t *h, int idx, int i_qscale );
+
+void x264_mb_mc( x264_t *h );
+
+
+static inline void x264_macroblock_cache_ref( x264_t *h, int x, int y, int width, int height, int i_list, int ref )
+{
+    int dy, dx;
+    for( dy = 0; dy < height; dy++ )
+    {
+        for( dx = 0; dx < width; dx++ )
+        {
+            h->mb.cache.ref[i_list][X264_SCAN8_0+x+dx+8*(y+dy)] = ref;
+        }
+    }
+}
+static inline void x264_macroblock_cache_mv( x264_t *h, int x, int y, int width, int height, int i_list, int mvx, int mvy )
+{
+    int dy, dx;
+    for( dy = 0; dy < height; dy++ )
+    {
+        for( dx = 0; dx < width; dx++ )
+        {
+            h->mb.cache.mv[i_list][X264_SCAN8_0+x+dx+8*(y+dy)][0] = mvx;
+            h->mb.cache.mv[i_list][X264_SCAN8_0+x+dx+8*(y+dy)][1] = mvy;
+        }
+    }
+}
+static inline void x264_macroblock_cache_mvd( x264_t *h, int x, int y, int width, int height, int i_list, int mdx, int mdy )
+{
+    int dy, dx;
+    for( dy = 0; dy < height; dy++ )
+    {
+        for( dx = 0; dx < width; dx++ )
+        {
+            h->mb.cache.mvd[i_list][X264_SCAN8_0+x+dx+8*(y+dy)][0] = mdx;
+            h->mb.cache.mvd[i_list][X264_SCAN8_0+x+dx+8*(y+dy)][1] = mdy;
+        }
+    }
+}
+static inline void x264_macroblock_cache_skip( x264_t *h, int x, int y, int width, int height, int b_skip )
+{
+    int dy, dx;
+    for( dy = 0; dy < height; dy++ )
+    {
+        for( dx = 0; dx < width; dx++ )
+        {
+            h->mb.cache.skip[X264_SCAN8_0+x+dx+8*(y+dy)] = b_skip;
+        }
+    }
+}
+static inline void x264_macroblock_cache_intra8x8_pred( x264_t *h, int x, int y, int i_mode )
+{
+    int *cache = &h->mb.cache.intra4x4_pred_mode[X264_SCAN8_0+x+8*y];
+    cache[0] = cache[1] = cache[8] = cache[9] = i_mode;
+}
+
+#endif
+

Added: vic/branches/mpeg4/win32/common/mc.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/mc.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * mc.h: h264 encoder library (Motion Compensation)
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: mc.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _MC_H
+#define _MC_H 1
+
+/* Do the MC
+ * XXX: Only width = 4, 8 or 16 are valid
+ * width == 4 -> height == 4 or 8
+ * width == 8 -> height == 4 or 8 or 16
+ * width == 16-> height == 8 or 16
+ * */
+
+typedef struct
+{
+    void (*mc_luma)(uint8_t **, int, uint8_t *, int,
+                    int mvx, int mvy,
+                    int i_width, int i_height );
+
+    uint8_t* (*get_ref)(uint8_t **, int, uint8_t *, int *,
+                        int mvx, int mvy,
+                        int i_width, int i_height );
+
+    void (*mc_chroma)(uint8_t *, int, uint8_t *, int,
+                      int mvx, int mvy,
+                      int i_width, int i_height );
+} x264_mc_functions_t;
+
+void x264_mc_init( int cpu, x264_mc_functions_t *pf );
+
+#endif

Added: vic/branches/mpeg4/win32/common/pixel.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/pixel.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * pixel.h: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: pixel.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _PIXEL_H
+#define _PIXEL_H 1
+
+typedef int  (*x264_pixel_cmp_t) ( uint8_t *, int, uint8_t *, int );
+typedef void (*x264_pixel_avg_t) ( uint8_t *, int, uint8_t *, int );
+typedef void (*x264_pixel_avg_weight_t) ( uint8_t *, int, uint8_t *, int, int );
+
+enum
+{
+    PIXEL_16x16 = 0,
+    PIXEL_16x8  = 1,
+    PIXEL_8x16  = 2,
+    PIXEL_8x8   = 3,
+    PIXEL_8x4   = 4,
+    PIXEL_4x8   = 5,
+    PIXEL_4x4   = 6,
+    PIXEL_4x2   = 7,
+    PIXEL_2x4   = 8,
+    PIXEL_2x2   = 9,
+};
+
+static const struct {
+    int w;
+    int h;
+} x264_pixel_size[7] = {
+    { 16, 16 },
+    { 16,  8 }, {  8, 16 },
+    {  8,  8 },
+    {  8,  4 }, {  4,  8 },
+    {  4,  4 }
+};
+
+static const int x264_size2pixel[5][5] = {
+    { 0, },
+    { 0, PIXEL_4x4, PIXEL_8x4, 0, 0 },
+    { 0, PIXEL_4x8, PIXEL_8x8, 0, PIXEL_16x8 },
+    { 0, },
+    { 0, 0,        PIXEL_8x16, 0, PIXEL_16x16 }
+};
+
+typedef struct
+{
+    x264_pixel_cmp_t  sad[7];
+    x264_pixel_cmp_t  ssd[7];
+    x264_pixel_cmp_t satd[7];
+    x264_pixel_cmp_t sa8d[4];
+    x264_pixel_cmp_t mbcmp[7]; /* either satd or sad for subpel refine and mode decision */
+    x264_pixel_avg_t  avg[10];
+    x264_pixel_avg_weight_t avg_weight[10];
+} x264_pixel_function_t;
+
+void x264_pixel_init( int cpu, x264_pixel_function_t *pixf );
+
+#endif

Added: vic/branches/mpeg4/win32/common/predict.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/predict.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,114 @@
+/*****************************************************************************
+ * predict.h: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: predict.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _PREDICT_H
+#define _PREDICT_H 1
+
+typedef void (*x264_predict_t)( uint8_t *src, int i_stride );
+typedef void (*x264_predict8x8_t)( uint8_t *src, int i_stride, int i_neighbor );
+
+enum intra_chroma_pred_e
+{
+    I_PRED_CHROMA_DC = 0,
+    I_PRED_CHROMA_H  = 1,
+    I_PRED_CHROMA_V  = 2,
+    I_PRED_CHROMA_P  = 3,
+
+    I_PRED_CHROMA_DC_LEFT = 4,
+    I_PRED_CHROMA_DC_TOP  = 5,
+    I_PRED_CHROMA_DC_128  = 6
+};
+static const int x264_mb_pred_mode8x8c_fix[7] =
+{
+    I_PRED_CHROMA_DC, I_PRED_CHROMA_H, I_PRED_CHROMA_V, I_PRED_CHROMA_P,
+    I_PRED_CHROMA_DC, I_PRED_CHROMA_DC,I_PRED_CHROMA_DC
+};
+
+enum intra16x16_pred_e
+{
+    I_PRED_16x16_V  = 0,
+    I_PRED_16x16_H  = 1,
+    I_PRED_16x16_DC = 2,
+    I_PRED_16x16_P  = 3,
+
+    I_PRED_16x16_DC_LEFT = 4,
+    I_PRED_16x16_DC_TOP  = 5,
+    I_PRED_16x16_DC_128  = 6,
+};
+static const int x264_mb_pred_mode16x16_fix[7] =
+{
+    I_PRED_16x16_V, I_PRED_16x16_H, I_PRED_16x16_DC, I_PRED_16x16_P,
+    I_PRED_16x16_DC,I_PRED_16x16_DC,I_PRED_16x16_DC
+};
+
+enum intra4x4_pred_e
+{
+    I_PRED_4x4_V  = 0,
+    I_PRED_4x4_H  = 1,
+    I_PRED_4x4_DC = 2,
+    I_PRED_4x4_DDL= 3,
+    I_PRED_4x4_DDR= 4,
+    I_PRED_4x4_VR = 5,
+    I_PRED_4x4_HD = 6,
+    I_PRED_4x4_VL = 7,
+    I_PRED_4x4_HU = 8,
+
+    I_PRED_4x4_DC_LEFT = 9,
+    I_PRED_4x4_DC_TOP  = 10,
+    I_PRED_4x4_DC_128  = 11,
+};
+static const int x264_mb_pred_mode4x4_fix[13] =
+{
+    -1,
+    I_PRED_4x4_V,   I_PRED_4x4_H,   I_PRED_4x4_DC,
+    I_PRED_4x4_DDL, I_PRED_4x4_DDR, I_PRED_4x4_VR,
+    I_PRED_4x4_HD,  I_PRED_4x4_VL,  I_PRED_4x4_HU,
+    I_PRED_4x4_DC,  I_PRED_4x4_DC,  I_PRED_4x4_DC
+};
+#define x264_mb_pred_mode4x4_fix(t) x264_mb_pred_mode4x4_fix[(t)+1]
+
+/* must use the same numbering as intra4x4_pred_e */
+enum intra8x8_pred_e
+{
+    I_PRED_8x8_V  = 0,
+    I_PRED_8x8_H  = 1,
+    I_PRED_8x8_DC = 2,
+    I_PRED_8x8_DDL= 3,
+    I_PRED_8x8_DDR= 4,
+    I_PRED_8x8_VR = 5,
+    I_PRED_8x8_HD = 6,
+    I_PRED_8x8_VL = 7,
+    I_PRED_8x8_HU = 8,
+
+    I_PRED_8x8_DC_LEFT = 9,
+    I_PRED_8x8_DC_TOP  = 10,
+    I_PRED_8x8_DC_128  = 11,
+};
+
+void x264_predict_16x16_init ( int cpu, x264_predict_t pf[7] );
+void x264_predict_8x8c_init  ( int cpu, x264_predict_t pf[7] );
+void x264_predict_4x4_init   ( int cpu, x264_predict_t pf[12] );
+void x264_predict_8x8_init   ( int cpu, x264_predict8x8_t pf[12] );
+
+
+#endif

Added: vic/branches/mpeg4/win32/common/set.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/set.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,220 @@
+/*****************************************************************************
+ * set.h: h264 encoder
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: set.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _SET_H
+#define _SET_H 1
+
+enum profile_e
+{
+    PROFILE_BASELINE = 66,
+    PROFILE_MAIN     = 77,
+    PROFILE_EXTENTED = 88,
+    PROFILE_HIGH    = 100,
+    PROFILE_HIGH10  = 110,
+    PROFILE_HIGH422 = 122,
+    PROFILE_HIGH444 = 144
+};
+
+enum cqm4_e
+{
+    CQM_4IY = 0,
+    CQM_4PY = 1,
+    CQM_4IC = 2,
+    CQM_4PC = 3
+};
+enum cqm8_e
+{
+    CQM_8IY = 0,
+    CQM_8PY = 1
+};
+
+typedef struct
+{
+    int i_id;
+
+    int i_profile_idc;
+    int i_level_idc;
+
+    int b_constraint_set0;
+    int b_constraint_set1;
+    int b_constraint_set2;
+
+    int i_log2_max_frame_num;
+
+    int i_poc_type;
+    /* poc 0 */
+    int i_log2_max_poc_lsb;
+    /* poc 1 */
+    int b_delta_pic_order_always_zero;
+    int i_offset_for_non_ref_pic;
+    int i_offset_for_top_to_bottom_field;
+    int i_num_ref_frames_in_poc_cycle;
+    int i_offset_for_ref_frame[256];
+
+    int i_num_ref_frames;
+    int b_gaps_in_frame_num_value_allowed;
+    int i_mb_width;
+    int i_mb_height;
+    int b_frame_mbs_only;
+    int b_mb_adaptive_frame_field;
+    int b_direct8x8_inference;
+
+    int b_crop;
+    struct
+    {
+        int i_left;
+        int i_right;
+        int i_top;
+        int i_bottom;
+    } crop;
+
+    int b_vui;
+    struct
+    {
+        int b_aspect_ratio_info_present;
+        int i_sar_width;
+        int i_sar_height;
+
+        int b_timing_info_present;
+        int i_num_units_in_tick;
+        int i_time_scale;
+        int b_fixed_frame_rate;
+
+        int b_bitstream_restriction;
+        int b_motion_vectors_over_pic_boundaries;
+        int i_max_bytes_per_pic_denom;
+        int i_max_bits_per_mb_denom;
+        int i_log2_max_mv_length_horizontal;
+        int i_log2_max_mv_length_vertical;
+        int i_num_reorder_frames;
+        int i_max_dec_frame_buffering;
+
+        /* FIXME to complete */
+    } vui;
+
+    int b_qpprime_y_zero_transform_bypass;
+
+} x264_sps_t;
+
+typedef struct
+{
+    int i_id;
+    int i_sps_id;
+
+    int b_cabac;
+
+    int b_pic_order;
+    int i_num_slice_groups;
+
+#if 0
+    /* FIXME: if this stuff is ever needed, move SPS/PPS from x264_t
+     * to the heap, to avoid excessive memcpy'ing with threads. */
+    int i_slice_group_map_type;
+    /* i_slice_group_map_type == 0 */
+    int i_run_length[256];      /* FIXME */
+    /* i_slice_group_map_type == 2 */
+    int i_top_left[256];        /* FIXME */
+    int i_bottom_right[256];    /* FIXME */
+    /* i_slice_group_map_type == 3, 4, 5 */
+    int b_slice_group_change_direction;
+    int i_slice_group_change_rate;
+    /* i_slice_group_map_type == 6 */
+    int i_pic_size_in_map_units;
+    int i_slice_group_id[256];  /* FIXME */
+#endif
+
+    int i_num_ref_idx_l0_active;
+    int i_num_ref_idx_l1_active;
+
+    int b_weighted_pred;
+    int b_weighted_bipred;
+
+    int i_pic_init_qp;
+    int i_pic_init_qs;
+
+    int i_chroma_qp_index_offset;
+
+    int b_deblocking_filter_control;
+    int b_constrained_intra_pred;
+    int b_redundant_pic_cnt;
+
+    int b_transform_8x8_mode;
+
+    int i_cqm_preset;
+    const uint8_t *scaling_list[6]; /* could be 8, but we don't allow separate Cb/Cr lists */
+
+} x264_pps_t;
+
+/* default quant matrices */
+static const uint8_t x264_cqm_jvt4i[16] =
+{
+      6,13,20,28,
+     13,20,28,32,
+     20,28,32,37,
+     28,32,37,42
+};
+static const uint8_t x264_cqm_jvt4p[16] =
+{
+    10,14,20,24,
+    14,20,24,27,
+    20,24,27,30,
+    24,27,30,34
+};
+static const uint8_t x264_cqm_jvt8i[64] =
+{
+     6,10,13,16,18,23,25,27,
+    10,11,16,18,23,25,27,29,
+    13,16,18,23,25,27,29,31,
+    16,18,23,25,27,29,31,33,
+    18,23,25,27,29,31,33,36,
+    23,25,27,29,31,33,36,38,
+    25,27,29,31,33,36,38,40,
+    27,29,31,33,36,38,40,42
+};
+static const uint8_t x264_cqm_jvt8p[64] =
+{
+     9,13,15,17,19,21,22,24,
+    13,13,17,19,21,22,24,25,
+    15,17,19,21,22,24,25,27,
+    17,19,21,22,24,25,27,28,
+    19,21,22,24,25,27,28,30,
+    21,22,24,25,27,28,30,32,
+    22,24,25,27,28,30,32,33,
+    24,25,27,28,30,32,33,35
+};
+static const uint8_t x264_cqm_flat16[64] =
+{
+    16,16,16,16,16,16,16,16,
+    16,16,16,16,16,16,16,16,
+    16,16,16,16,16,16,16,16,
+    16,16,16,16,16,16,16,16,
+    16,16,16,16,16,16,16,16,
+    16,16,16,16,16,16,16,16,
+    16,16,16,16,16,16,16,16,
+    16,16,16,16,16,16,16,16
+};
+
+void x264_cqm_init( x264_t *h );
+int  x264_cqm_parse_file( x264_t *h, const char *filename );
+
+#endif

Added: vic/branches/mpeg4/win32/common/visualize.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/visualize.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * x264: h264 encoder
+ *****************************************************************************
+ * Copyright (C) 2005 x264 project
+ *
+ * Author: Tuukka Toivonen <tuukkat at ee.oulu.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _VISUALIZE_H
+#define _VISUALIZE_H 1
+
+#include "common/common.h"
+
+void x264_visualize_init( x264_t *h );
+void x264_visualize_mb( x264_t *h );
+void x264_visualize_show( x264_t *h );
+void x264_visualize_close( x264_t *h );
+
+#endif

Added: vic/branches/mpeg4/win32/common/vlc.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/common/vlc.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,914 @@
+/*****************************************************************************
+ * vlc.h : vlc table
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: vlc.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+typedef struct
+{
+    int i_bits;
+    int i_size;
+} vlc_t;
+
+/* XXX: don't forget to change it if you change vlc_t */
+#define MKVLC( a, b ) { a, b }
+static const vlc_t x264_coeff_token[5][17*4] =
+{
+    /* table 0 */
+    {
+        MKVLC( 0x1, 1 ), /* str=1 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x5, 6 ), /* str=000101 */
+        MKVLC( 0x1, 2 ), /* str=01 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x7, 8 ), /* str=00000111 */
+        MKVLC( 0x4, 6 ), /* str=000100 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x7, 9 ), /* str=000000111 */
+        MKVLC( 0x6, 8 ), /* str=00000110 */
+        MKVLC( 0x5, 7 ), /* str=0000101 */
+        MKVLC( 0x3, 5 ), /* str=00011 */
+
+        MKVLC( 0x7, 10 ), /* str=0000000111 */
+        MKVLC( 0x6, 9 ), /* str=000000110 */
+        MKVLC( 0x5, 8 ), /* str=00000101 */
+        MKVLC( 0x3, 6 ), /* str=000011 */
+
+        MKVLC( 0x7, 11 ), /* str=00000000111 */
+        MKVLC( 0x6, 10 ), /* str=0000000110 */
+        MKVLC( 0x5, 9 ), /* str=000000101 */
+        MKVLC( 0x4, 7 ), /* str=0000100 */
+
+        MKVLC( 0xf, 13 ), /* str=0000000001111 */
+        MKVLC( 0x6, 11 ), /* str=00000000110 */
+        MKVLC( 0x5, 10 ), /* str=0000000101 */
+        MKVLC( 0x4, 8 ), /* str=00000100 */
+
+        MKVLC( 0xb, 13 ), /* str=0000000001011 */
+        MKVLC( 0xe, 13 ), /* str=0000000001110 */
+        MKVLC( 0x5, 11 ), /* str=00000000101 */
+        MKVLC( 0x4, 9 ), /* str=000000100 */
+
+        MKVLC( 0x8, 13 ), /* str=0000000001000 */
+        MKVLC( 0xa, 13 ), /* str=0000000001010 */
+        MKVLC( 0xd, 13 ), /* str=0000000001101 */
+        MKVLC( 0x4, 10 ), /* str=0000000100 */
+
+        MKVLC( 0xf, 14 ), /* str=00000000001111 */
+        MKVLC( 0xe, 14 ), /* str=00000000001110 */
+        MKVLC( 0x9, 13 ), /* str=0000000001001 */
+        MKVLC( 0x4, 11 ), /* str=00000000100 */
+
+        MKVLC( 0xb, 14 ), /* str=00000000001011 */
+        MKVLC( 0xa, 14 ), /* str=00000000001010 */
+        MKVLC( 0xd, 14 ), /* str=00000000001101 */
+        MKVLC( 0xc, 13 ), /* str=0000000001100 */
+
+        MKVLC( 0xf, 15 ), /* str=000000000001111 */
+        MKVLC( 0xe, 15 ), /* str=000000000001110 */
+        MKVLC( 0x9, 14 ), /* str=00000000001001 */
+        MKVLC( 0xc, 14 ), /* str=00000000001100 */
+
+        MKVLC( 0xb, 15 ), /* str=000000000001011 */
+        MKVLC( 0xa, 15 ), /* str=000000000001010 */
+        MKVLC( 0xd, 15 ), /* str=000000000001101 */
+        MKVLC( 0x8, 14 ), /* str=00000000001000 */
+
+        MKVLC( 0xf, 16 ), /* str=0000000000001111 */
+        MKVLC( 0x1, 15 ), /* str=000000000000001 */
+        MKVLC( 0x9, 15 ), /* str=000000000001001 */
+        MKVLC( 0xc, 15 ), /* str=000000000001100 */
+
+        MKVLC( 0xb, 16 ), /* str=0000000000001011 */
+        MKVLC( 0xe, 16 ), /* str=0000000000001110 */
+        MKVLC( 0xd, 16 ), /* str=0000000000001101 */
+        MKVLC( 0x8, 15 ), /* str=000000000001000 */
+
+        MKVLC( 0x7, 16 ), /* str=0000000000000111 */
+        MKVLC( 0xa, 16 ), /* str=0000000000001010 */
+        MKVLC( 0x9, 16 ), /* str=0000000000001001 */
+        MKVLC( 0xc, 16 ), /* str=0000000000001100 */
+
+        MKVLC( 0x4, 16 ), /* str=0000000000000100 */
+        MKVLC( 0x6, 16 ), /* str=0000000000000110 */
+        MKVLC( 0x5, 16 ), /* str=0000000000000101 */
+        MKVLC( 0x8, 16 ), /* str=0000000000001000 */
+    },
+
+    /* table 1 */
+    {
+        MKVLC( 0x3, 2 ), /* str=11 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0xb, 6 ), /* str=001011 */
+        MKVLC( 0x2, 2 ), /* str=10 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x7, 6 ), /* str=000111 */
+        MKVLC( 0x7, 5 ), /* str=00111 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x7, 7 ), /* str=0000111 */
+        MKVLC( 0xa, 6 ), /* str=001010 */
+        MKVLC( 0x9, 6 ), /* str=001001 */
+        MKVLC( 0x5, 4 ), /* str=0101 */
+
+        MKVLC( 0x7, 8 ), /* str=00000111 */
+        MKVLC( 0x6, 6 ), /* str=000110 */
+        MKVLC( 0x5, 6 ), /* str=000101 */
+        MKVLC( 0x4, 4 ), /* str=0100 */
+
+        MKVLC( 0x4, 8 ), /* str=00000100 */
+        MKVLC( 0x6, 7 ), /* str=0000110 */
+        MKVLC( 0x5, 7 ), /* str=0000101 */
+        MKVLC( 0x6, 5 ), /* str=00110 */
+
+        MKVLC( 0x7, 9 ), /* str=000000111 */
+        MKVLC( 0x6, 8 ), /* str=00000110 */
+        MKVLC( 0x5, 8 ), /* str=00000101 */
+        MKVLC( 0x8, 6 ), /* str=001000 */
+
+        MKVLC( 0xf, 11 ), /* str=00000001111 */
+        MKVLC( 0x6, 9 ), /* str=000000110 */
+        MKVLC( 0x5, 9 ), /* str=000000101 */
+        MKVLC( 0x4, 6 ), /* str=000100 */
+
+        MKVLC( 0xb, 11 ), /* str=00000001011 */
+        MKVLC( 0xe, 11 ), /* str=00000001110 */
+        MKVLC( 0xd, 11 ), /* str=00000001101 */
+        MKVLC( 0x4, 7 ), /* str=0000100 */
+
+        MKVLC( 0xf, 12 ), /* str=000000001111 */
+        MKVLC( 0xa, 11 ), /* str=00000001010 */
+        MKVLC( 0x9, 11 ), /* str=00000001001 */
+        MKVLC( 0x4, 9 ), /* str=000000100 */
+
+        MKVLC( 0xb, 12 ), /* str=000000001011 */
+        MKVLC( 0xe, 12 ), /* str=000000001110 */
+        MKVLC( 0xd, 12 ), /* str=000000001101 */
+        MKVLC( 0xc, 11 ), /* str=00000001100 */
+
+        MKVLC( 0x8, 12 ), /* str=000000001000 */
+        MKVLC( 0xa, 12 ), /* str=000000001010 */
+        MKVLC( 0x9, 12 ), /* str=000000001001 */
+        MKVLC( 0x8, 11 ), /* str=00000001000 */
+
+        MKVLC( 0xf, 13 ), /* str=0000000001111 */
+        MKVLC( 0xe, 13 ), /* str=0000000001110 */
+        MKVLC( 0xd, 13 ), /* str=0000000001101 */
+        MKVLC( 0xc, 12 ), /* str=000000001100 */
+
+        MKVLC( 0xb, 13 ), /* str=0000000001011 */
+        MKVLC( 0xa, 13 ), /* str=0000000001010 */
+        MKVLC( 0x9, 13 ), /* str=0000000001001 */
+        MKVLC( 0xc, 13 ), /* str=0000000001100 */
+
+        MKVLC( 0x7, 13 ), /* str=0000000000111 */
+        MKVLC( 0xb, 14 ), /* str=00000000001011 */
+        MKVLC( 0x6, 13 ), /* str=0000000000110 */
+        MKVLC( 0x8, 13 ), /* str=0000000001000 */
+
+        MKVLC( 0x9, 14 ), /* str=00000000001001 */
+        MKVLC( 0x8, 14 ), /* str=00000000001000 */
+        MKVLC( 0xa, 14 ), /* str=00000000001010 */
+        MKVLC( 0x1, 13 ), /* str=0000000000001 */
+
+        MKVLC( 0x7, 14 ), /* str=00000000000111 */
+        MKVLC( 0x6, 14 ), /* str=00000000000110 */
+        MKVLC( 0x5, 14 ), /* str=00000000000101 */
+        MKVLC( 0x4, 14 ), /* str=00000000000100 */
+    },
+    /* table 2 */
+    {
+        MKVLC( 0xf, 4 ), /* str=1111 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0xf, 6 ), /* str=001111 */
+        MKVLC( 0xe, 4 ), /* str=1110 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0xb, 6 ), /* str=001011 */
+        MKVLC( 0xf, 5 ), /* str=01111 */
+        MKVLC( 0xd, 4 ), /* str=1101 */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x8, 6 ), /* str=001000 */
+        MKVLC( 0xc, 5 ), /* str=01100 */
+        MKVLC( 0xe, 5 ), /* str=01110 */
+        MKVLC( 0xc, 4 ), /* str=1100 */
+
+        MKVLC( 0xf, 7 ), /* str=0001111 */
+        MKVLC( 0xa, 5 ), /* str=01010 */
+        MKVLC( 0xb, 5 ), /* str=01011 */
+        MKVLC( 0xb, 4 ), /* str=1011 */
+
+        MKVLC( 0xb, 7 ), /* str=0001011 */
+        MKVLC( 0x8, 5 ), /* str=01000 */
+        MKVLC( 0x9, 5 ), /* str=01001 */
+        MKVLC( 0xa, 4 ), /* str=1010 */
+
+        MKVLC( 0x9, 7 ), /* str=0001001 */
+        MKVLC( 0xe, 6 ), /* str=001110 */
+        MKVLC( 0xd, 6 ), /* str=001101 */
+        MKVLC( 0x9, 4 ), /* str=1001 */
+
+        MKVLC( 0x8, 7 ), /* str=0001000 */
+        MKVLC( 0xa, 6 ), /* str=001010 */
+        MKVLC( 0x9, 6 ), /* str=001001 */
+        MKVLC( 0x8, 4 ), /* str=1000 */
+
+        MKVLC( 0xf, 8 ), /* str=00001111 */
+        MKVLC( 0xe, 7 ), /* str=0001110 */
+        MKVLC( 0xd, 7 ), /* str=0001101 */
+        MKVLC( 0xd, 5 ), /* str=01101 */
+
+        MKVLC( 0xb, 8 ), /* str=00001011 */
+        MKVLC( 0xe, 8 ), /* str=00001110 */
+        MKVLC( 0xa, 7 ), /* str=0001010 */
+        MKVLC( 0xc, 6 ), /* str=001100 */
+
+        MKVLC( 0xf, 9 ), /* str=000001111 */
+        MKVLC( 0xa, 8 ), /* str=00001010 */
+        MKVLC( 0xd, 8 ), /* str=00001101 */
+        MKVLC( 0xc, 7 ), /* str=0001100 */
+
+        MKVLC( 0xb, 9 ), /* str=000001011 */
+        MKVLC( 0xe, 9 ), /* str=000001110 */
+        MKVLC( 0x9, 8 ), /* str=00001001 */
+        MKVLC( 0xc, 8 ), /* str=00001100 */
+
+        MKVLC( 0x8, 9 ), /* str=000001000 */
+        MKVLC( 0xa, 9 ), /* str=000001010 */
+        MKVLC( 0xd, 9 ), /* str=000001101 */
+        MKVLC( 0x8, 8 ), /* str=00001000 */
+
+        MKVLC( 0xd, 10 ), /* str=0000001101 */
+        MKVLC( 0x7, 9 ), /* str=000000111 */
+        MKVLC( 0x9, 9 ), /* str=000001001 */
+        MKVLC( 0xc, 9 ), /* str=000001100 */
+
+        MKVLC( 0x9, 10 ), /* str=0000001001 */
+        MKVLC( 0xc, 10 ), /* str=0000001100 */
+        MKVLC( 0xb, 10 ), /* str=0000001011 */
+        MKVLC( 0xa, 10 ), /* str=0000001010 */
+
+        MKVLC( 0x5, 10 ), /* str=0000000101 */
+        MKVLC( 0x8, 10 ), /* str=0000001000 */
+        MKVLC( 0x7, 10 ), /* str=0000000111 */
+        MKVLC( 0x6, 10 ), /* str=0000000110 */
+
+        MKVLC( 0x1, 10 ), /* str=0000000001 */
+        MKVLC( 0x4, 10 ), /* str=0000000100 */
+        MKVLC( 0x3, 10 ), /* str=0000000011 */
+        MKVLC( 0x2, 10 ), /* str=0000000010 */
+    },
+
+    /* table 3 */
+    {
+        MKVLC( 0x3, 6 ), /* str=000011 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 6 ), /* str=000000 */
+        MKVLC( 0x1, 6 ), /* str=000001 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x4, 6 ), /* str=000100 */
+        MKVLC( 0x5, 6 ), /* str=000101 */
+        MKVLC( 0x6, 6 ), /* str=000110 */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x8, 6 ), /* str=001000 */
+        MKVLC( 0x9, 6 ), /* str=001001 */
+        MKVLC( 0xa, 6 ), /* str=001010 */
+        MKVLC( 0xb, 6 ), /* str=001011 */
+
+        MKVLC( 0xc, 6 ), /* str=001100 */
+        MKVLC( 0xd, 6 ), /* str=001101 */
+        MKVLC( 0xe, 6 ), /* str=001110 */
+        MKVLC( 0xf, 6 ), /* str=001111 */
+
+        MKVLC( 0x10, 6 ), /* str=010000 */
+        MKVLC( 0x11, 6 ), /* str=010001 */
+        MKVLC( 0x12, 6 ), /* str=010010 */
+        MKVLC( 0x13, 6 ), /* str=010011 */
+
+        MKVLC( 0x14, 6 ), /* str=010100 */
+        MKVLC( 0x15, 6 ), /* str=010101 */
+        MKVLC( 0x16, 6 ), /* str=010110 */
+        MKVLC( 0x17, 6 ), /* str=010111 */
+
+        MKVLC( 0x18, 6 ), /* str=011000 */
+        MKVLC( 0x19, 6 ), /* str=011001 */
+        MKVLC( 0x1a, 6 ), /* str=011010 */
+        MKVLC( 0x1b, 6 ), /* str=011011 */
+
+        MKVLC( 0x1c, 6 ), /* str=011100 */
+        MKVLC( 0x1d, 6 ), /* str=011101 */
+        MKVLC( 0x1e, 6 ), /* str=011110 */
+        MKVLC( 0x1f, 6 ), /* str=011111 */
+
+        MKVLC( 0x20, 6 ), /* str=100000 */
+        MKVLC( 0x21, 6 ), /* str=100001 */
+        MKVLC( 0x22, 6 ), /* str=100010 */
+        MKVLC( 0x23, 6 ), /* str=100011 */
+
+        MKVLC( 0x24, 6 ), /* str=100100 */
+        MKVLC( 0x25, 6 ), /* str=100101 */
+        MKVLC( 0x26, 6 ), /* str=100110 */
+        MKVLC( 0x27, 6 ), /* str=100111 */
+
+        MKVLC( 0x28, 6 ), /* str=101000 */
+        MKVLC( 0x29, 6 ), /* str=101001 */
+        MKVLC( 0x2a, 6 ), /* str=101010 */
+        MKVLC( 0x2b, 6 ), /* str=101011 */
+
+        MKVLC( 0x2c, 6 ), /* str=101100 */
+        MKVLC( 0x2d, 6 ), /* str=101101 */
+        MKVLC( 0x2e, 6 ), /* str=101110 */
+        MKVLC( 0x2f, 6 ), /* str=101111 */
+
+        MKVLC( 0x30, 6 ), /* str=110000 */
+        MKVLC( 0x31, 6 ), /* str=110001 */
+        MKVLC( 0x32, 6 ), /* str=110010 */
+        MKVLC( 0x33, 6 ), /* str=110011 */
+
+        MKVLC( 0x34, 6 ), /* str=110100 */
+        MKVLC( 0x35, 6 ), /* str=110101 */
+        MKVLC( 0x36, 6 ), /* str=110110 */
+        MKVLC( 0x37, 6 ), /* str=110111 */
+
+        MKVLC( 0x38, 6 ), /* str=111000 */
+        MKVLC( 0x39, 6 ), /* str=111001 */
+        MKVLC( 0x3a, 6 ), /* str=111010 */
+        MKVLC( 0x3b, 6 ), /* str=111011 */
+
+        MKVLC( 0x3c, 6 ), /* str=111100 */
+        MKVLC( 0x3d, 6 ), /* str=111101 */
+        MKVLC( 0x3e, 6 ), /* str=111110 */
+        MKVLC( 0x3f, 6 ), /* str=111111 */
+    },
+
+    /* table 4 */
+    {
+        MKVLC( 0x1, 2 ), /* str=01 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x7, 6 ), /* str=000111 */
+        MKVLC( 0x1, 1 ), /* str=1 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x4, 6 ), /* str=000100 */
+        MKVLC( 0x6, 6 ), /* str=000110 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x3, 6 ), /* str=000011 */
+        MKVLC( 0x3, 7 ), /* str=0000011 */
+        MKVLC( 0x2, 7 ), /* str=0000010 */
+        MKVLC( 0x5, 6 ), /* str=000101 */
+
+        MKVLC( 0x2, 6 ), /* str=000010 */
+        MKVLC( 0x3, 8 ), /* str=00000011 */
+        MKVLC( 0x2, 8 ), /* str=00000010 */
+        MKVLC( 0x0, 7 ), /* str=0000000 */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    }
+};
+
+static const vlc_t x264_level_prefix[16] =
+{
+    MKVLC( 0x01,  1 ),
+    MKVLC( 0x01,  2 ),
+    MKVLC( 0x01,  3 ),
+    MKVLC( 0x01,  4 ),
+    MKVLC( 0x01,  5 ),
+    MKVLC( 0x01,  6 ),
+    MKVLC( 0x01,  7 ),
+    MKVLC( 0x01,  8 ),
+    MKVLC( 0x01,  9 ),
+    MKVLC( 0x01, 10 ),
+    MKVLC( 0x01, 11 ),
+    MKVLC( 0x01, 12 ),
+    MKVLC( 0x01, 13 ),
+    MKVLC( 0x01, 14 ),
+    MKVLC( 0x01, 15 ),
+    MKVLC( 0x01, 16 )
+};
+
+/* [i_total_coeff-1][i_total_zeros] */
+static const vlc_t x264_total_zeros[15][16] =
+{
+    { /* i_total 1 */
+        MKVLC( 0x1, 1 ), /* str=1 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x2, 3 ), /* str=010 */
+        MKVLC( 0x3, 4 ), /* str=0011 */
+        MKVLC( 0x2, 4 ), /* str=0010 */
+        MKVLC( 0x3, 5 ), /* str=00011 */
+        MKVLC( 0x2, 5 ), /* str=00010 */
+        MKVLC( 0x3, 6 ), /* str=000011 */
+        MKVLC( 0x2, 6 ), /* str=000010 */
+        MKVLC( 0x3, 7 ), /* str=0000011 */
+        MKVLC( 0x2, 7 ), /* str=0000010 */
+        MKVLC( 0x3, 8 ), /* str=00000011 */
+        MKVLC( 0x2, 8 ), /* str=00000010 */
+        MKVLC( 0x3, 9 ), /* str=000000011 */
+        MKVLC( 0x2, 9 ), /* str=000000010 */
+        MKVLC( 0x1, 9 ), /* str=000000001 */
+    },
+    { /* i_total 2 */
+        MKVLC( 0x7, 3 ), /* str=111 */
+        MKVLC( 0x6, 3 ), /* str=110 */
+        MKVLC( 0x5, 3 ), /* str=101 */
+        MKVLC( 0x4, 3 ), /* str=100 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x5, 4 ), /* str=0101 */
+        MKVLC( 0x4, 4 ), /* str=0100 */
+        MKVLC( 0x3, 4 ), /* str=0011 */
+        MKVLC( 0x2, 4 ), /* str=0010 */
+        MKVLC( 0x3, 5 ), /* str=00011 */
+        MKVLC( 0x2, 5 ), /* str=00010 */
+        MKVLC( 0x3, 6 ), /* str=000011 */
+        MKVLC( 0x2, 6 ), /* str=000010 */
+        MKVLC( 0x1, 6 ), /* str=000001 */
+        MKVLC( 0x0, 6 ), /* str=000000 */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 3 */
+        MKVLC( 0x5, 4 ), /* str=0101 */
+        MKVLC( 0x7, 3 ), /* str=111 */
+        MKVLC( 0x6, 3 ), /* str=110 */
+        MKVLC( 0x5, 3 ), /* str=101 */
+        MKVLC( 0x4, 4 ), /* str=0100 */
+        MKVLC( 0x3, 4 ), /* str=0011 */
+        MKVLC( 0x4, 3 ), /* str=100 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x2, 4 ), /* str=0010 */
+        MKVLC( 0x3, 5 ), /* str=00011 */
+        MKVLC( 0x2, 5 ), /* str=00010 */
+        MKVLC( 0x1, 6 ), /* str=000001 */
+        MKVLC( 0x1, 5 ), /* str=00001 */
+        MKVLC( 0x0, 6 ), /* str=000000 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 4 */
+        MKVLC( 0x3, 5 ), /* str=00011 */
+        MKVLC( 0x7, 3 ), /* str=111 */
+        MKVLC( 0x5, 4 ), /* str=0101 */
+        MKVLC( 0x4, 4 ), /* str=0100 */
+        MKVLC( 0x6, 3 ), /* str=110 */
+        MKVLC( 0x5, 3 ), /* str=101 */
+        MKVLC( 0x4, 3 ), /* str=100 */
+        MKVLC( 0x3, 4 ), /* str=0011 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x2, 4 ), /* str=0010 */
+        MKVLC( 0x2, 5 ), /* str=00010 */
+        MKVLC( 0x1, 5 ), /* str=00001 */
+        MKVLC( 0x0, 5 ), /* str=00000 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 5 */
+        MKVLC( 0x5, 4 ), /* str=0101 */
+        MKVLC( 0x4, 4 ), /* str=0100 */
+        MKVLC( 0x3, 4 ), /* str=0011 */
+        MKVLC( 0x7, 3 ), /* str=111 */
+        MKVLC( 0x6, 3 ), /* str=110 */
+        MKVLC( 0x5, 3 ), /* str=101 */
+        MKVLC( 0x4, 3 ), /* str=100 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x2, 4 ), /* str=0010 */
+        MKVLC( 0x1, 5 ), /* str=00001 */
+        MKVLC( 0x1, 4 ), /* str=0001 */
+        MKVLC( 0x0, 5 ), /* str=00000 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 6 */
+        MKVLC( 0x1, 6 ), /* str=000001 */
+        MKVLC( 0x1, 5 ), /* str=00001 */
+        MKVLC( 0x7, 3 ), /* str=111 */
+        MKVLC( 0x6, 3 ), /* str=110 */
+        MKVLC( 0x5, 3 ), /* str=101 */
+        MKVLC( 0x4, 3 ), /* str=100 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x2, 3 ), /* str=010 */
+        MKVLC( 0x1, 4 ), /* str=0001 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x0, 6 ), /* str=000000 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 7 */
+        MKVLC( 0x1, 6 ), /* str=000001 */
+        MKVLC( 0x1, 5 ), /* str=00001 */
+        MKVLC( 0x5, 3 ), /* str=101 */
+        MKVLC( 0x4, 3 ), /* str=100 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x3, 2 ), /* str=11 */
+        MKVLC( 0x2, 3 ), /* str=010 */
+        MKVLC( 0x1, 4 ), /* str=0001 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x0, 6 ), /* str=000000 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 8 */
+        MKVLC( 0x1, 6 ), /* str=000001 */
+        MKVLC( 0x1, 4 ), /* str=0001 */
+        MKVLC( 0x1, 5 ), /* str=00001 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x3, 2 ), /* str=11 */
+        MKVLC( 0x2, 2 ), /* str=10 */
+        MKVLC( 0x2, 3 ), /* str=010 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x0, 6 ), /* str=000000 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 9 */
+        MKVLC( 0x1, 6 ), /* str=000001 */
+        MKVLC( 0x0, 6 ), /* str=000000 */
+        MKVLC( 0x1, 4 ), /* str=0001 */
+        MKVLC( 0x3, 2 ), /* str=11 */
+        MKVLC( 0x2, 2 ), /* str=10 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x1, 2 ), /* str=01 */
+        MKVLC( 0x1, 5 ), /* str=00001 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 10 */
+        MKVLC( 0x1, 5 ), /* str=00001 */
+        MKVLC( 0x0, 5 ), /* str=00000 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x3, 2 ), /* str=11 */
+        MKVLC( 0x2, 2 ), /* str=10 */
+        MKVLC( 0x1, 2 ), /* str=01 */
+        MKVLC( 0x1, 4 ), /* str=0001 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 11 */
+        MKVLC( 0x0, 4 ), /* str=0000 */
+        MKVLC( 0x1, 4 ), /* str=0001 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x2, 3 ), /* str=010 */
+        MKVLC( 0x1, 1 ), /* str=1 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 12 */
+        MKVLC( 0x0, 4 ), /* str=0000 */
+        MKVLC( 0x1, 4 ), /* str=0001 */
+        MKVLC( 0x1, 2 ), /* str=01 */
+        MKVLC( 0x1, 1 ), /* str=1 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 13 */
+        MKVLC( 0x0, 3 ), /* str=000 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x1, 1 ), /* str=1 */
+        MKVLC( 0x1, 2 ), /* str=01 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 14 */
+        MKVLC( 0x0, 2 ), /* str=00 */
+        MKVLC( 0x1, 2 ), /* str=01 */
+        MKVLC( 0x1, 1 ), /* str=1 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_total 15 */
+        MKVLC( 0x0, 1 ), /* str=0 */
+        MKVLC( 0x1, 1 ), /* str=1 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+};
+
+/* [i_total_coeff-1][i_total_zeros] */
+static const vlc_t x264_total_zeros_dc[3][4] =
+{
+    {
+        MKVLC( 0x01, 1 ), /* 1  */
+        MKVLC( 0x01, 2 ), /* 01 */
+        MKVLC( 0x01, 3 ), /* 001*/
+        MKVLC( 0x00, 3 )  /* 000*/
+    },
+    {
+        MKVLC( 0x01, 1 ), /* 1  */
+        MKVLC( 0x01, 2 ), /* 01 */
+        MKVLC( 0x00, 2 ), /* 00 */
+        MKVLC( 0x00, 0 )  /*    */
+    },
+    {
+        MKVLC( 0x01, 1 ), /* 1  */
+        MKVLC( 0x00, 1 ), /* 0  */
+        MKVLC( 0x00, 0 ), /*    */
+        MKVLC( 0x00, 0 )  /*    */
+    }
+};
+
+/* x264_run_before[__MIN( i_zero_left -1, 6 )][run_before] */
+static const vlc_t x264_run_before[7][15] =
+{
+    { /* i_zero_left 1 */
+        MKVLC( 0x1, 1 ), /* str=1 */
+        MKVLC( 0x0, 1 ), /* str=0 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_zero_left 2 */
+        MKVLC( 0x1, 1 ), /* str=1 */
+        MKVLC( 0x1, 2 ), /* str=01 */
+        MKVLC( 0x0, 2 ), /* str=00 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_zero_left 3 */
+        MKVLC( 0x3, 2 ), /* str=11 */
+        MKVLC( 0x2, 2 ), /* str=10 */
+        MKVLC( 0x1, 2 ), /* str=01 */
+        MKVLC( 0x0, 2 ), /* str=00 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_zero_left 4 */
+        MKVLC( 0x3, 2 ), /* str=11 */
+        MKVLC( 0x2, 2 ), /* str=10 */
+        MKVLC( 0x1, 2 ), /* str=01 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x0, 3 ), /* str=000 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_zero_left 5 */
+        MKVLC( 0x3, 2 ), /* str=11 */
+        MKVLC( 0x2, 2 ), /* str=10 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x2, 3 ), /* str=010 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x0, 3 ), /* str=000 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_zero_left 6 */
+        MKVLC( 0x3, 2 ), /* str=11 */
+        MKVLC( 0x0, 3 ), /* str=000 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x2, 3 ), /* str=010 */
+        MKVLC( 0x5, 3 ), /* str=101 */
+        MKVLC( 0x4, 3 ), /* str=100 */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+        MKVLC( 0x0, 0 ), /* str= */
+    },
+    { /* i_zero_left 7 */
+        MKVLC( 0x7, 3 ), /* str=111 */
+        MKVLC( 0x6, 3 ), /* str=110 */
+        MKVLC( 0x5, 3 ), /* str=101 */
+        MKVLC( 0x4, 3 ), /* str=100 */
+        MKVLC( 0x3, 3 ), /* str=011 */
+        MKVLC( 0x2, 3 ), /* str=010 */
+        MKVLC( 0x1, 3 ), /* str=001 */
+        MKVLC( 0x1, 4 ), /* str=0001 */
+        MKVLC( 0x1, 5 ), /* str=00001 */
+        MKVLC( 0x1, 6 ), /* str=000001 */
+        MKVLC( 0x1, 7 ), /* str=0000001 */
+        MKVLC( 0x1, 8 ), /* str=00000001 */
+        MKVLC( 0x1, 9 ), /* str=000000001 */
+        MKVLC( 0x1, 10 ), /* str=0000000001 */
+        MKVLC( 0x1, 11 ), /* str=00000000001 */
+    },
+};

Added: vic/branches/mpeg4/win32/ffmpeg/config.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/ffmpeg/config.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,161 @@
+/* Automatically generated by configure - do not modify */
+#define FFMPEG_CONFIGURATION " --cpu=pentium3 --enable-shared"
+#define TUNECPU generic
+#define HAVE_BUILTIN_VECTOR 1
+//#define HAVE_LRINTF 1
+#define CONFIG_ENCODERS 1
+#define CONFIG_DECODERS 1
+#define CONFIG_MPEGAUDIO_HP 1
+//#define CONFIG_WIN32 1
+#define HAVE_W32THREADS 1
+//#define HAVE_THREADS 0
+#define HAVE_MALLOC_H 1
+//#undef  HAVE_MEMALIGN
+#define SIMPLE_IDCT 1
+#define restrict __restrict__
+#define CONFIG_AC3_ENCODER 1
+#define CONFIG_MP2_ENCODER 1
+#define CONFIG_MP3LAME_ENCODER 1
+#define CONFIG_OGGVORBIS_ENCODER 1
+#define CONFIG_OGGVORBIS_DECODER 1
+#define CONFIG_OGGTHEORA_ENCODER 1
+#define CONFIG_OGGTHEORA_DECODER 1
+#define CONFIG_FAAC_ENCODER 1
+#define CONFIG_XVID_ENCODER 1
+#define CONFIG_MPEG1VIDEO_ENCODER 1
+#define CONFIG_H264_ENCODER 1
+#define CONFIG_MPEG2VIDEO_ENCODER 1
+#define CONFIG_H261_ENCODER 1
+#define CONFIG_H263_ENCODER 1
+#define CONFIG_H263P_ENCODER 1
+#define CONFIG_FLV_ENCODER 1
+#define CONFIG_RV10_ENCODER 1
+#define CONFIG_RV20_ENCODER 1
+#define CONFIG_MPEG4_ENCODER 1
+#define CONFIG_MSMPEG4V1_ENCODER 1
+#define CONFIG_MSMPEG4V2_ENCODER 1
+#define CONFIG_MSMPEG4V3_ENCODER 1
+#define CONFIG_WMV1_ENCODER 1
+#define CONFIG_WMV2_ENCODER 1
+#define CONFIG_SVQ1_ENCODER 1
+#define CONFIG_MJPEG_ENCODER 1
+#define CONFIG_LJPEG_ENCODER 1
+#define CONFIG_PNG_ENCODER 1
+#define CONFIG_PPM_ENCODER 1
+#define CONFIG_PGM_ENCODER 1
+#define CONFIG_PGMYUV_ENCODER 1
+#define CONFIG_PBM_ENCODER 1
+#define CONFIG_PAM_ENCODER 1
+#define CONFIG_HUFFYUV_ENCODER 1
+#define CONFIG_FFVHUFF_ENCODER 1
+#define CONFIG_ASV1_ENCODER 1
+#define CONFIG_ASV2_ENCODER 1
+#define CONFIG_FFV1_ENCODER 1
+#define CONFIG_SNOW_ENCODER 1
+#define CONFIG_ZLIB_ENCODER 1
+#define CONFIG_DVVIDEO_ENCODER 1
+#define CONFIG_SONIC_ENCODER 1
+#define CONFIG_SONIC_LS_ENCODER 1
+#define CONFIG_X264_ENCODER 1
+#define CONFIG_LIBGSM_ENCODER 1
+#define CONFIG_RAWVIDEO_ENCODER 1
+#define CONFIG_RAWVIDEO_DECODER 1
+#define CONFIG_H263_DECODER 1
+#define CONFIG_H261_DECODER 1
+#define CONFIG_MPEG4_DECODER 1
+#define CONFIG_MSMPEG4V1_DECODER 1
+#define CONFIG_MSMPEG4V2_DECODER 1
+#define CONFIG_MSMPEG4V3_DECODER 1
+#define CONFIG_WMV1_DECODER 1
+#define CONFIG_WMV2_DECODER 1
+#define CONFIG_VC9_DECODER 1
+#define CONFIG_WMV3_DECODER 1
+#define CONFIG_H263I_DECODER 1
+#define CONFIG_FLV_DECODER 1
+#define CONFIG_RV10_DECODER 1
+#define CONFIG_RV20_DECODER 1
+#define CONFIG_SVQ1_DECODER 1
+#define CONFIG_SVQ3_DECODER 1
+#define CONFIG_WMAV1_DECODER 1
+#define CONFIG_WMAV2_DECODER 1
+#define CONFIG_INDEO2_DECODER 1
+#define CONFIG_INDEO3_DECODER 1
+#define CONFIG_TSCC_DECODER 1
+#define CONFIG_ULTI_DECODER 1
+#define CONFIG_QDRAW_DECODER 1
+#define CONFIG_XL_DECODER 1
+#define CONFIG_QPEG_DECODER 1
+#define CONFIG_LOCO_DECODER 1
+#define CONFIG_WNV1_DECODER 1
+#define CONFIG_AASC_DECODER 1
+#define CONFIG_FRAPS_DECODER 1
+#define CONFIG_AAC_DECODER 1
+#define CONFIG_MPEG4AAC_DECODER 1
+#define CONFIG_MPEG1VIDEO_DECODER 1
+#define CONFIG_MPEG2VIDEO_DECODER 1
+#define CONFIG_MPEGVIDEO_DECODER 1
+#define CONFIG_MPEG_XVMC_DECODER 1
+#define CONFIG_DVVIDEO_DECODER 1
+#define CONFIG_MJPEG_DECODER 1
+#define CONFIG_MJPEGB_DECODER 1
+#define CONFIG_SP5X_DECODER 1
+#define CONFIG_PNG_DECODER 1
+#define CONFIG_MP2_DECODER 1
+#define CONFIG_MP3_DECODER 1
+#define CONFIG_MP3ADU_DECODER 1
+#define CONFIG_MP3ON4_DECODER 1
+#define CONFIG_MACE3_DECODER 1
+#define CONFIG_MACE6_DECODER 1
+#define CONFIG_HUFFYUV_DECODER 1
+#define CONFIG_FFVHUFF_DECODER 1
+#define CONFIG_FFV1_DECODER 1
+#define CONFIG_SNOW_DECODER 1
+#define CONFIG_CYUV_DECODER 1
+#define CONFIG_H264_DECODER 1
+#define CONFIG_VP3_DECODER 1
+#define CONFIG_THEORA_DECODER 1
+#define CONFIG_ASV1_DECODER 1
+#define CONFIG_ASV2_DECODER 1
+#define CONFIG_VCR1_DECODER 1
+#define CONFIG_CLJR_DECODER 1
+#define CONFIG_FOURXM_DECODER 1
+#define CONFIG_MDEC_DECODER 1
+#define CONFIG_ROQ_DECODER 1
+#define CONFIG_INTERPLAY_VIDEO_DECODER 1
+#define CONFIG_XAN_WC3_DECODER 1
+#define CONFIG_RPZA_DECODER 1
+#define CONFIG_CINEPAK_DECODER 1
+#define CONFIG_MSRLE_DECODER 1
+#define CONFIG_MSVIDEO1_DECODER 1
+#define CONFIG_VQA_DECODER 1
+#define CONFIG_IDCIN_DECODER 1
+#define CONFIG_EIGHTBPS_DECODER 1
+#define CONFIG_SMC_DECODER 1
+#define CONFIG_FLIC_DECODER 1
+#define CONFIG_TRUEMOTION1_DECODER 1
+#define CONFIG_VMDVIDEO_DECODER 1
+#define CONFIG_VMDAUDIO_DECODER 1
+#define CONFIG_MSZH_DECODER 1
+#define CONFIG_ZLIB_DECODER 1
+#define CONFIG_SONIC_DECODER 1
+#define CONFIG_AC3_DECODER 1
+#define CONFIG_DTS_DECODER 1
+#define CONFIG_RA_144_DECODER 1
+#define CONFIG_RA_288_DECODER 1
+#define CONFIG_ROQ_DPCM_DECODER 1
+#define CONFIG_INTERPLAY_DPCM_DECODER 1
+#define CONFIG_XAN_DPCM_DECODER 1
+#define CONFIG_SOL_DPCM_DECODER 1
+#define CONFIG_QTRLE_DECODER 1
+#define CONFIG_FLAC_DECODER 1
+#define CONFIG_SHORTEN_DECODER 1
+#define CONFIG_ALAC_DECODER 1
+#define CONFIG_WS_SND1_DECODER 1
+#define CONFIG_VORBIS_DECODER 1
+#define CONFIG_LIBGSM_DECODER 1
+#define CONFIG_AMR_NB_DECODER 1
+#define CONFIG_AMR_NB_ENCODER 1
+#define CONFIG_AMR_WB_DECODER 1
+#define CONFIG_AMR_WB_ENCODER 1
+#define CONFIG_DVDSUB_DECODER 1
+#define CONFIG_DVBSUB_ENCODER 1

Added: vic/branches/mpeg4/win32/inttypes.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/inttypes.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,135 @@
+                                      /* include/Inventor/system/inttypes.h.  Generated automatically by configure.  */
+/**************************************************************************\
+ *
+ *  This file is part of the Coin 3D visualization library.
+ *  Copyright (C) 1998-2001 by Systems in Motion. All rights reserved.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  version 2.1 as published by the Free Software Foundation. See the
+ *  file LICENSE.LGPL at the root directory of the distribution for
+ *  more details.
+ *
+ *  If you want to use Coin for applications not compatible with the
+ *  LGPL, please contact SIM to acquire a Professional Edition license.
+ *
+ *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
+ *  http://www.sim.no support at sim.no Voice: +47 22114160 Fax: +47 22207097
+ *
+\**************************************************************************/
+
+#ifndef COIN_INTTYPES_H
+#define COIN_INTTYPES_H
+
+/*
+  This file defines the following types:
+
+    int8_t uint8_t
+    int16_t uint16_t
+    int32_t uint32_t
+    int64_t uint64_t
+
+  (The 64-bit types are not guaranteed to be present, check for
+  HAVE_INT64_T and HAVE_UINT64_T.)
+*/
+
+/***************************************************************************/
+
+/* Block of defines set up by the configure script. Protected with the
+   #ifndef wrapper in case config.h was already included -- so we
+   don't confuse the compiler to think we redefine already #define'd
+   constants. */
+#ifndef COIN_CONFIGURE_BUILD /* (start wrapper) */
+
+/*
+  This file was autogenerated by our configuration process
+  specifically for this build configuration:
+*/
+#define COIN_CONFIGURE_BUILD I686_PC_CYGWIN
+#define COIN_CONFIGURE_HOST I686_PC_CYGWIN
+#define COIN_CONFIGURE_TARGET I686_PC_CYGWIN
+/*
+  The bit-type definitions may also be dependent on the compiler,
+  compiler version and C library.
+
+  So note that the bit-type definitions below might not match on other
+  systems. Be extremely careful if you for whatever reason are
+  installing this as a cross-platform header file (i.e.: you
+  shouldn't).
+*/
+
+/* The <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* If the system defines any of the types "on it's own", the
+   respective #define will be set below. */
+/* #undef HAVE_INT8_T */
+/* #undef HAVE_UINT8_T */
+/* #undef HAVE_INT16_T */
+/* #undef HAVE_UINT16_T */
+/* #undef HAVE_INT32_T */
+/* #undef HAVE_UINT32_T */
+/* #undef HAVE_INT64_T */
+/* #undef HAVE_UINT64_T */
+
+/* The type which the configure script found to match the given
+   bitwidth. */
+#define COIN_INT8_T char
+#define COIN_UINT8_T unsigned char
+#define COIN_INT16_T short
+#define COIN_UINT16_T unsigned short
+#define COIN_INT32_T int
+#define COIN_UINT32_T unsigned int
+#define COIN_INT64_T __int64
+#define COIN_UINT64_T unsigned __int64
+
+#endif /* (end wrapper) ! COIN_CONFIGURE_BUILD */
+
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+
+
+#if !defined(HAVE_INT8_T) && defined(COIN_INT8_T)
+typedef COIN_INT8_T int8_t;
+#define HAVE_INT8_T 1
+#endif /* !HAVE_INT8_T && COIN_INT8_T */
+
+#if !defined(HAVE_UINT8_T) && defined(COIN_UINT8_T)
+typedef COIN_UINT8_T uint8_t;
+#define HAVE_UINT8_T 1
+#endif /* !HAVE_UINT8_T && COIN_UINT8_T */
+
+#if !defined(HAVE_INT16_T) && defined(COIN_INT16_T)
+typedef COIN_INT16_T int16_t;
+#define HAVE_INT16_T 1
+#endif /* !HAVE_INT16_T && COIN_INT16_T */
+
+#if !defined(HAVE_UINT16_T) && defined(COIN_UINT16_T)
+typedef COIN_UINT16_T uint16_t;
+#define HAVE_UINT16_T 1
+#endif /* !HAVE_UINT16_T && COIN_UINT16_T */
+
+#if !defined(HAVE_INT32_T) && defined(COIN_INT32_T)
+typedef COIN_INT32_T int32_t;
+#define HAVE_INT32_T 1
+#endif /* !HAVE_INT32_T && COIN_INT32_T */
+
+#if !defined(HAVE_UINT32_T) && defined(COIN_UINT32_T)
+typedef COIN_UINT32_T uint32_t;
+#define HAVE_UINT32_T 1
+#endif /* !HAVE_UINT32_T && COIN_UINT32_T */
+
+#if !defined(HAVE_INT64_T) && defined(COIN_INT64_T)
+typedef COIN_INT64_T int64_t;
+#define HAVE_INT64_T 1
+#endif /* !HAVE_INT64_T && COIN_INT64_T */
+
+#if !defined(HAVE_UINT64_T) && defined(COIN_UINT64_T)
+typedef COIN_UINT64_T uint64_t;
+#define HAVE_UINT64_T 1
+#endif /* !HAVE_UINT64_T && COIN_UINT64_T */
+
+
+#endif /* ! COIN_INTTYPES_H */

Added: vic/branches/mpeg4/win32/lib/avcodec.dll
==============================================================================
Binary file. No diff available.

Added: vic/branches/mpeg4/win32/lib/avcodec.lib
==============================================================================
Binary file. No diff available.

Added: vic/branches/mpeg4/win32/lib/libswscale.dll
==============================================================================
Binary file. No diff available.

Added: vic/branches/mpeg4/win32/lib/libswscale.lib
==============================================================================
Binary file. No diff available.

Added: vic/branches/mpeg4/win32/lib/libx264.dll
==============================================================================
Binary file. No diff available.

Added: vic/branches/mpeg4/win32/lib/libx264.lib
==============================================================================
Binary file. No diff available.

Added: vic/branches/mpeg4/win32/x264.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/win32/x264.h	Wed Nov  8 03:07:46 2006
@@ -0,0 +1,357 @@
+/*****************************************************************************
+ * x264.h: h264 encoder library
+ *****************************************************************************
+ * Copyright (C) 2003 Laurent Aimar
+ * $Id: x264.h,v 1.1.1.1 2005/08/11 15:28:33 barz Exp $
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#ifndef _X264_H
+#define _X264_H 1
+
+#include <stdarg.h>
+
+#define X264_BUILD 33
+
+/* x264_t:
+ *      opaque handler for decoder and encoder */
+typedef struct x264_t x264_t;
+
+/****************************************************************************
+ * Initialisation structure and function.
+ ****************************************************************************/
+/* CPU flags
+ */
+#define X264_CPU_MMX        0x000001    /* mmx */
+#define X264_CPU_MMXEXT     0x000002    /* mmx-ext*/
+#define X264_CPU_SSE        0x000004    /* sse */
+#define X264_CPU_SSE2       0x000008    /* sse 2 */
+#define X264_CPU_3DNOW      0x000010    /* 3dnow! */
+#define X264_CPU_3DNOWEXT   0x000020    /* 3dnow! ext */
+#define X264_CPU_ALTIVEC    0x000040    /* altivec */
+
+/* Analyse flags
+ */
+#define X264_ANALYSE_I4x4       0x0001  /* Analyse i4x4 */
+#define X264_ANALYSE_I8x8       0x0002  /* Analyse i8x8 (requires 8x8 transform) */
+#define X264_ANALYSE_PSUB16x16  0x0010  /* Analyse p16x8, p8x16 and p8x8 */
+#define X264_ANALYSE_PSUB8x8    0x0020  /* Analyse p8x4, p4x8, p4x4 */
+#define X264_ANALYSE_BSUB16x16  0x0100  /* Analyse b16x8, b8x16 and b8x8 */
+#define X264_DIRECT_PRED_NONE        0
+#define X264_DIRECT_PRED_SPATIAL     1
+#define X264_DIRECT_PRED_TEMPORAL    2
+#define X264_ME_DIA                  0
+#define X264_ME_HEX                  1
+#define X264_ME_UMH                  2
+#define X264_ME_ESA                  3
+#define X264_CQM_FLAT                0
+#define X264_CQM_JVT                 1
+#define X264_CQM_CUSTOM              2
+
+/* Colorspace type
+ */
+#define X264_CSP_MASK           0x00ff  /* */
+#define X264_CSP_NONE           0x0000  /* Invalid mode     */
+#define X264_CSP_I420           0x0001  /* yuv 4:2:0 planar */
+#define X264_CSP_I422           0x0002  /* yuv 4:2:2 planar */
+#define X264_CSP_I444           0x0003  /* yuv 4:4:4 planar */
+#define X264_CSP_YV12           0x0004  /* yuv 4:2:0 planar */
+#define X264_CSP_YUYV           0x0005  /* yuv 4:2:2 packed */
+#define X264_CSP_RGB            0x0006  /* rgb 24bits       */
+#define X264_CSP_BGR            0x0007  /* bgr 24bits       */
+#define X264_CSP_BGRA           0x0008  /* bgr 32bits       */
+#define X264_CSP_VFLIP          0x1000  /* */
+
+/* Slice type
+ */
+#define X264_TYPE_AUTO          0x0000  /* Let x264 choose the right type */
+#define X264_TYPE_IDR           0x0001
+#define X264_TYPE_I             0x0002
+#define X264_TYPE_P             0x0003
+#define X264_TYPE_BREF          0x0004  /* Non-disposable B-frame */
+#define X264_TYPE_B             0x0005
+#define IS_X264_TYPE_I(x) ((x)==X264_TYPE_I || (x)==X264_TYPE_IDR)
+#define IS_X264_TYPE_B(x) ((x)==X264_TYPE_B || (x)==X264_TYPE_BREF)
+
+/* Log level
+ */
+#define X264_LOG_NONE          (-1)
+#define X264_LOG_ERROR          0
+#define X264_LOG_WARNING        1
+#define X264_LOG_INFO           2
+#define X264_LOG_DEBUG          3
+
+typedef struct
+{
+    int i_start, i_end;
+    int b_force_qp;
+    int i_qp;
+    float f_bitrate_factor;
+} x264_zone_t;
+
+typedef struct
+{
+    /* CPU flags */
+    unsigned int cpu;
+    int         i_threads;  /* divide each frame into multiple slices, encode in parallel */
+
+    /* Video Properties */
+    int         i_width;
+    int         i_height;
+    int         i_csp;  /* CSP of encoded bitstream, only i420 supported */
+    int         i_level_idc; 
+
+    struct
+    {
+        /* they will be reduced to be 0 < x <= 65535 and prime */
+        int         i_sar_height;
+        int         i_sar_width;
+    } vui;
+
+    int         i_fps_num;
+    int         i_fps_den;
+
+    /* Bitstream parameters */
+    int         i_frame_reference;  /* Maximum number of reference frames */
+    int         i_keyint_max;       /* Force an IDR keyframe at this interval */
+    int         i_keyint_min;       /* Scenecuts closer together than this are coded as I, not IDR. */
+    int         i_scenecut_threshold; /* how aggressively to insert extra I frames */
+    int         i_bframe;   /* how many b-frame between 2 references pictures */
+    int         b_bframe_adaptive;
+    int         i_bframe_bias;
+    int         b_bframe_pyramid;   /* Keep some B-frames as references */
+
+    int         b_deblocking_filter;
+    int         i_deblocking_filter_alphac0;    /* [-6, 6] -6 light filter, 6 strong */
+    int         i_deblocking_filter_beta;       /* [-6, 6]  idem */
+
+    int         b_cabac;
+    int         i_cabac_init_idc;
+
+    int         i_cqm_preset;
+    char        *psz_cqm_file;      /* JM format */
+    int8_t      cqm_4iy[16];        /* used only if i_cqm_preset == X264_CQM_CUSTOM */
+    int8_t      cqm_4ic[16];
+    int8_t      cqm_4py[16];
+    int8_t      cqm_4pc[16];
+    int8_t      cqm_8iy[64];
+    int8_t      cqm_8py[64];
+
+    /* Log */
+    void        (*pf_log)( void *, int i_level, const char *psz, va_list );
+    void        *p_log_private;
+    int         i_log_level;
+    int         b_visualize;
+
+    /* Encoder analyser parameters */
+    struct
+    {
+        unsigned int intra;     /* intra partitions */
+        unsigned int inter;     /* inter partitions */
+
+        int          b_transform_8x8;
+
+        int          i_direct_mv_pred; /* spatial vs temporal mv prediction */
+        int          i_me_method; /* motion estimation algorithm to use (X264_ME_*) */
+        int          i_me_range; /* integer pixel motion estimation search range (from predicted mv) */
+        int          i_subpel_refine; /* subpixel motion estimation quality */
+        int          b_chroma_me; /* chroma ME for subpel and mode decision in P-frames */
+        int          i_mv_range; /* maximum length of a mv (in pixels) */
+
+        int          b_weighted_bipred; /* implicit weighting for B-frames */
+
+        int          i_chroma_qp_offset;
+
+        int          b_psnr;    /* Do we compute PSNR stats (save a few % of cpu) */
+    } analyse;
+
+    /* Rate control parameters */
+    struct
+    {
+        int         i_qp_constant;  /* 1-51 */
+        int         i_qp_min;       /* min allowed QP value */
+        int         i_qp_max;       /* max allowed QP value */
+        int         i_qp_step;      /* max QP step between frames */
+
+        int         b_cbr;          /* use bitrate instead of CQP */
+        int         i_bitrate;
+        float       f_rate_tolerance;
+        int         i_vbv_max_bitrate;
+        int         i_vbv_buffer_size;
+        float       f_vbv_buffer_init;
+        float       f_ip_factor;
+        float       f_pb_factor;
+
+        /* 2pass */
+        int         b_stat_write;   /* Enable stat writing in psz_stat_out */
+        char        *psz_stat_out;
+        int         b_stat_read;    /* Read stat from psz_stat_in and use it */
+        char        *psz_stat_in;
+
+        /* 2pass params (same as ffmpeg ones) */
+        char        *psz_rc_eq;     /* 2 pass rate control equation */
+        float       f_qcompress;    /* 0.0 => cbr, 1.0 => constant qp */
+        float       f_qblur;        /* temporally blur quants */
+        float       f_complexity_blur; /* temporally blur complexity */
+        x264_zone_t *zones;         /* ratecontrol overrides */
+        int         i_zones;        /* sumber of zone_t's */
+        char        *psz_zones;     /* alternate method of specifying zones */
+    } rc;
+
+    int b_aud;                  /* generate access unit delimiters */
+} x264_param_t;
+
+/* x264_param_default:
+ *      fill x264_param_t with default values and do CPU detection */
+void    x264_param_default( x264_param_t * );
+
+/****************************************************************************
+ * Picture structures and functions.
+ ****************************************************************************/
+typedef struct
+{
+    int     i_csp;
+
+    int     i_plane;
+    int     i_stride[4];
+    uint8_t *plane[4];
+} x264_image_t;
+
+typedef struct
+{
+    /* In: force picture type (if not auto) XXX: ignored for now
+     * Out: type of the picture encoded */
+    int     i_type;
+    /* In: force quantizer for > 0 */
+    int     i_qpplus1;
+    /* In: user pts, Out: pts of encoded picture (user)*/
+    int64_t i_pts;
+
+    /* In: raw data */
+    x264_image_t img;
+} x264_picture_t;
+
+/* x264_picture_alloc:
+ *  alloc data for a picture. You must call x264_picture_clean on it. */
+void x264_picture_alloc( x264_picture_t *pic, int i_csp, int i_width, int i_height );
+
+/* x264_picture_clean:
+ *  free associated resource for a x264_picture_t allocated with
+ *  x264_picture_alloc ONLY */
+void x264_picture_clean( x264_picture_t *pic );
+
+/****************************************************************************
+ * NAL structure and functions:
+ ****************************************************************************/
+/* nal */
+enum nal_unit_type_e
+{
+    NAL_UNKNOWN = 0,
+    NAL_SLICE   = 1,
+    NAL_SLICE_DPA   = 2,
+    NAL_SLICE_DPB   = 3,
+    NAL_SLICE_DPC   = 4,
+    NAL_SLICE_IDR   = 5,    /* ref_idc != 0 */
+    NAL_SEI         = 6,    /* ref_idc == 0 */
+    NAL_SPS         = 7,
+    NAL_PPS         = 8,
+    NAL_AUD         = 9,
+    /* ref_idc == 0 for 6,9,10,11,12 */
+};
+enum nal_priority_e
+{
+    NAL_PRIORITY_DISPOSABLE = 0,
+    NAL_PRIORITY_LOW        = 1,
+    NAL_PRIORITY_HIGH       = 2,
+    NAL_PRIORITY_HIGHEST    = 3,
+};
+
+typedef struct
+{
+    int i_ref_idc;  /* nal_priority_e */
+    int i_type;     /* nal_unit_type_e */
+
+    /* This data are raw payload */
+    int     i_payload;
+    uint8_t *p_payload;
+} x264_nal_t;
+
+/* x264_nal_encode:
+ *      encode a nal into a buffer, setting the size.
+ *      if b_annexeb then a long synch work is added
+ *      XXX: it currently doesn't check for overflow */
+int x264_nal_encode( void *, int *, int b_annexeb, x264_nal_t *nal );
+
+/* x264_nal_decode:
+ *      decode a buffer nal into a x264_nal_t */
+int x264_nal_decode( x264_nal_t *nal, void *, int );
+
+/****************************************************************************
+ * Encoder functions:
+ ****************************************************************************/
+
+/* x264_encoder_open:
+ *      create a new encoder handler, all parameters from x264_param_t are copied */
+x264_t *x264_encoder_open   ( x264_param_t * );
+/* x264_encoder_reconfig:
+ *      change encoder options while encoding,
+ *      analysis-related parameters from x264_param_t are copied */
+int     x264_encoder_reconfig( x264_t *, x264_param_t * );
+/* x264_encoder_headers:
+ *      return the SPS and PPS that will be used for the whole stream */
+int     x264_encoder_headers( x264_t *, x264_nal_t **, int * );
+/* x264_encoder_encode:
+ *      encode one picture */
+int     x264_encoder_encode ( x264_t *, x264_nal_t **, int *, x264_picture_t *, x264_picture_t * );
+/* x264_encoder_close:
+ *      close an encoder handler */
+void    x264_encoder_close  ( x264_t * );
+
+/* XXX: decoder isn't working so no need to export it */
+#if 0
+/****************************************************************************
+ * Decoder functions:
+ ****************************************************************************
+ * XXX: Not yet working so do not try ...
+ ****************************************************************************/
+/* x264_decoder_open:
+ */
+x264_t *x264_decoder_open   ( x264_param_t * );
+/* x264_decoder_decode:
+ */
+int     x264_decoder_decode ( x264_t *, x264_picture_t **, x264_nal_t * );
+/* x264_decoder_close:
+ */
+void    x264_decoder_close  ( x264_t * );
+#endif
+
+/****************************************************************************
+ * Private stuff for internal usage:
+ ****************************************************************************/
+
+#ifdef __X264__
+#   ifdef _MSC_VER
+#       define inline __inline
+#       define DECLARE_ALIGNED( type, var, n ) /*__declspec(align(n))*/ type var
+#   else
+#       define DECLARE_ALIGNED( type, var, n ) type var __attribute__((aligned(n)))
+#   endif
+#endif
+
+
+#endif



More information about the Sumover-dev mailing list