changeset 814:2eaaa3aa182b trunk

[svn] - make the whole thing compile. runtime linking is another story.
author nenolod
date Mon, 12 Mar 2007 13:00:06 -0700
parents 1d03ded97d44
children 23a5aa2c545c
files ChangeLog src/ffmpeg/Makefile src/ffmpeg/ffmpeg.c src/ffmpeg/libavcodec/Makefile src/ffmpeg/libavcodec/mpegvideo.c src/ffmpeg/libavcodec/qpeg.c src/ffmpeg/libavcodec/svq1.c src/ffmpeg/libavcodec/svq1_cb.h src/ffmpeg/libavcodec/svq1_vlc.h src/ffmpeg/libavcodec/svq3.c src/ffmpeg/libavcodec/tiertexseqv.c src/ffmpeg/libavcodec/truemotion1.c src/ffmpeg/libavcodec/truemotion1data.h src/ffmpeg/libavcodec/truemotion2.c src/ffmpeg/libavcodec/ulti.c src/ffmpeg/libavcodec/ulti_cb.h src/ffmpeg/libavcodec/vc1dsp.c src/ffmpeg/libavcodec/zmbv.c src/ffmpeg/libavformat/Makefile src/ffmpeg/libavformat/avformat.h src/ffmpeg/libavformat/avisynth.c src/ffmpeg/libavformat/dc1394.c src/ffmpeg/libavformat/dv1394.c src/ffmpeg/libavformat/dv1394.h src/ffmpeg/libavformat/file.c src/ffmpeg/libavformat/grab_bktr.c src/ffmpeg/libavformat/rtp.c src/ffmpeg/libavformat/rtp.h src/ffmpeg/libavformat/tcp.c src/ffmpeg/libavformat/udp.c src/ffmpeg/wma.c
diffstat 31 files changed, 514 insertions(+), 23665 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Mar 12 11:47:10 2007 -0700
+++ b/ChangeLog	Mon Mar 12 13:00:06 2007 -0700
@@ -1,3 +1,18 @@
+2007-03-12 18:47:10 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [1726]
+  - remove more video stuff
+  
+  trunk/src/ffmpeg/libavcodec/Makefile   |   14 
+  trunk/src/ffmpeg/libavcodec/mmvideo.c  |  206 -
+  trunk/src/ffmpeg/libavcodec/roqvideo.c |  474 ---
+  trunk/src/ffmpeg/libavcodec/smacker.c  |  723 -----
+  trunk/src/ffmpeg/libavcodec/vc1.c      | 4315 ---------------------------------
+  trunk/src/ffmpeg/libavcodec/vcr1.c     |  190 -
+  trunk/src/ffmpeg/libavcodec/vmdav.c    |  583 ----
+  trunk/src/ffmpeg/libavcodec/vmnc.c     |  525 ----
+  8 files changed, 7 insertions(+), 7023 deletions(-)
+
+
 2007-03-12 18:44:33 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [1724]
   - remove a lot of video codecs
--- a/src/ffmpeg/Makefile	Mon Mar 12 11:47:10 2007 -0700
+++ b/src/ffmpeg/Makefile	Mon Mar 12 13:00:06 2007 -0700
@@ -1,15 +1,15 @@
 include ../../mk/rules.mk
 include ../../mk/init.mk
 
-OBJECTIVE_LIBS = libwma$(SHARED_SUFFIX)
+OBJECTIVE_LIBS = libffmpeg$(SHARED_SUFFIX)
 
-SUBDIRS = libffwma
+SUBDIRS = libavcodec libavformat libavutil
 
 LIBDIR = $(plugindir)/$(INPUT_PLUGIN_DIR)
 
-LIBADD = ./libffwma/libffwma.a $(GTK_LIBS) $(GLIB_LIBS) $(PANGO_LIBS)
+LIBADD = ./libavcodec/libavcodec.a ./libavutil/libavutil.a ./libavformat/libavformat.a $(GTK_LIBS) $(GLIB_LIBS) $(PANGO_LIBS)
 
-SOURCES = wma.c
+SOURCES = ffmpeg.c
 
 OBJECTS = ${SOURCES:.c=.o}
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ffmpeg/ffmpeg.c	Mon Mar 12 13:00:06 2007 -0700
@@ -0,0 +1,478 @@
+/*
+ *  Audacious WMA input plugin
+ *  (C) 2005 Audacious development team
+ *
+ *  Based on:
+ *  xmms-wma - WMA player for BMP
+ *  Copyright (C) 2004,2005 McMCC <mcmcc@mail.ru>
+ *  bmp-wma - WMA player for BMP
+ *  Copyright (C) 2004 Roman Bogorodskiy <bogorodskiy@inbox.ru>
+ *
+ *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#define _XOPEN_SOURCE 600
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+#include <glib.h>
+
+#include <audacious/plugin.h>
+#include <audacious/output.h>
+#include <audacious/util.h>
+#include <audacious/titlestring.h>
+#include <audacious/vfs.h>
+#include <audacious/strings.h>
+#include <audacious/i18n.h>
+
+#include "avcodec.h"
+#include "avformat.h"
+
+#define ABOUT_TXT "Adapted for use in audacious by Tony Vroon (chainsaw@gentoo.org) from\n \
+the BEEP-WMA plugin which is Copyright (C) 2004,2005 Mokrushin I.V. aka McMCC (mcmcc@mail.ru)\n \
+and the BMP-WMA plugin which is Copyright (C) 2004 Roman Bogorodskiy <bogorodskiy@inbox.ru>.\n \
+This plugin based on source code " LIBAVCODEC_IDENT "\nby Fabrice Bellard from \
+http://ffmpeg.sourceforge.net.\n\n \
+This program is free software; you can redistribute it and/or modify \n \
+it under the terms of the GNU General Public License as published by \n \
+the Free Software Foundation; either version 2 of the License, or \n \
+(at your option) any later version. \n\n \
+This program is distributed in the hope that it will be useful, \n \
+but WITHOUT ANY WARRANTY; without even the implied warranty of \n \
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n \
+See the GNU General Public License for more details.\n"
+#define PLUGIN_NAME "Audacious-WMA"
+#define PLUGIN_VERSION "v.1.0.5"
+#define ST_BUFF 1024
+
+static int wma_decode = 0;
+static gboolean wma_pause = 0;
+static int wma_seekpos = -1;
+static int wma_st_buff, wma_idx, wma_idx2;
+static GThread *wma_decode_thread;
+GStaticMutex wma_mutex = G_STATIC_MUTEX_INIT;
+static AVCodecContext *c = NULL;
+static AVFormatContext *ic = NULL;
+static AVCodecContext *c2 = NULL;
+static AVFormatContext *ic2 = NULL;
+static uint8_t *wma_outbuf, *wma_s_outbuf;
+
+char description[64];
+static void wma_about(void);
+static void wma_init(void);
+static int wma_is_our_file(char *filename);
+static int wma_is_our_fd(char *filename, VFSFile *fd);
+static void wma_play_file(InputPlayback *data);
+static void wma_stop(InputPlayback *data);
+static void wma_seek(InputPlayback *data, int time);
+static void wma_do_pause(InputPlayback *data, short p);
+static int wma_get_time(InputPlayback *data);
+static void wma_get_song_info(char *filename, char **title, int *length);
+static TitleInput *wma_get_song_tuple(char *filename);
+static char *wsong_title;
+static int wsong_time;
+
+static GtkWidget *dialog1, *button1, *label1;
+
+InputPlugin *get_iplugin_info(void);
+
+gchar *wma_fmts[] = { "wma", NULL };
+
+InputPlugin wma_ip =
+{
+    NULL,           	// Filled in by xmms
+    NULL,           	// Filled in by xmms
+    description,    	// The description that is shown in the preferences box
+    wma_init,           // Called when the plugin is loaded
+    wma_about,          // Show the about box
+    NULL,  	    	// Show the configure box
+    wma_is_our_file,    // Return 1 if the plugin can handle the file
+    NULL,           	// Scan dir
+    wma_play_file,      // Play file
+    wma_stop,           // Stop
+    wma_do_pause,       // Pause
+    wma_seek,           // Seek
+    NULL,               // Set the equalizer, most plugins won't be able to do this
+    wma_get_time,       // Get the time, usually returns the output plugins output time
+    NULL,           	// Get volume
+    NULL,           	// Set volume
+    NULL,           	// OBSOLETE!
+    NULL,           	// OBSOLETE!
+    NULL,           	// Send data to the visualization plugins
+    NULL,           	// Fill in the stuff that is shown in the player window
+    NULL,           	// Show some text in the song title box. Filled in by xmms
+    wma_get_song_info,  // Function to grab the title string
+    NULL,               // Bring up an info window for the filename passed in
+    NULL,           	// Handle to the current output plugin. Filled in by xmms
+    wma_get_song_tuple, // Tuple builder
+    NULL,
+    NULL,
+    wma_is_our_fd,	// vfs
+    wma_fmts
+};
+
+InputPlugin *get_iplugin_info(void)
+{
+    memset(description, 0, 64);
+    wma_ip.description = g_strdup_printf(_("WMA Player %s"), PACKAGE_VERSION);
+    return &wma_ip;
+}
+
+static gchar *str_twenty_to_space(gchar * str)
+{
+    gchar *match, *match_end;
+
+    g_return_val_if_fail(str != NULL, NULL);
+
+    while ((match = strstr(str, "%20"))) {
+        match_end = match + 3;
+        *match++ = ' ';
+        while (*match_end)
+            *match++ = *match_end++;
+        *match = 0;
+    }
+
+    return str;
+}
+
+static void wma_about(void) 
+{
+    char *title;
+    char *message;
+
+    if (dialog1) return;
+    
+    title = (char *)g_malloc(80);
+    message = (char *)g_malloc(1000);
+    memset(title, 0, 80);
+    memset(message, 0, 1000);
+
+    sprintf(title, _("About %s"), PLUGIN_NAME);
+    sprintf(message, "%s %s\n\n%s", PLUGIN_NAME, PLUGIN_VERSION, ABOUT_TXT);
+
+    dialog1 = gtk_dialog_new();
+    g_signal_connect(G_OBJECT(dialog1), "destroy",
+                        G_CALLBACK(gtk_widget_destroyed), &dialog1);
+    gtk_window_set_title(GTK_WINDOW(dialog1), title);
+    gtk_window_set_policy(GTK_WINDOW(dialog1), FALSE, FALSE, FALSE);
+    gtk_container_border_width(GTK_CONTAINER(dialog1), 5);
+    label1 = gtk_label_new(message);
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog1)->vbox), label1, TRUE, TRUE, 0);
+    gtk_widget_show(label1);
+
+    button1 = gtk_button_new_with_label(_(" Close "));
+    g_signal_connect_swapped(G_OBJECT(button1), "clicked",
+	                        G_CALLBACK(gtk_widget_destroy),
+    	                        GTK_OBJECT(dialog1));
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog1)->action_area), button1,
+                     FALSE, FALSE, 0);
+
+    gtk_widget_show(button1);
+    gtk_widget_show(dialog1);
+    gtk_widget_grab_focus(button1);
+    g_free(title);
+    g_free(message);
+}
+
+static void wma_init(void)
+{
+    avcodec_init();
+    avcodec_register_all();
+    av_register_all();
+}
+
+static int wma_is_our_file(char *filename)
+{
+    AVCodec *codec2;
+
+    if(av_open_input_file(&ic2, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return 0;
+
+    for(wma_idx2 = 0; wma_idx2 < ic2->nb_streams; wma_idx2++) {
+        c2 = &ic2->streams[wma_idx2]->codec;
+        if(c2->codec_type == CODEC_TYPE_AUDIO) break;
+    }
+
+    av_find_stream_info(ic2);
+
+    codec2 = avcodec_find_decoder(c2->codec_id);
+
+    if(!codec2) {
+        av_close_input_file(ic2);
+	return 0;
+    }
+	
+    av_close_input_file(ic2);
+    return 1;
+}
+
+static int wma_is_our_fd(char *filename, VFSFile *fd)
+{
+    AVCodec *codec2;
+
+    if(av_open_input_vfsfile(&ic2, filename, fd, NULL, 0, NULL) < 0) return 0;
+
+    for(wma_idx2 = 0; wma_idx2 < ic2->nb_streams; wma_idx2++) {
+        c2 = &ic2->streams[wma_idx2]->codec;
+        if(c2->codec_type == CODEC_TYPE_AUDIO) break;
+    }
+
+    av_find_stream_info(ic2);
+
+    codec2 = avcodec_find_decoder(c2->codec_id);
+
+    return 1;
+}
+
+static void wma_do_pause(InputPlayback *playback, short p)
+{
+    wma_pause = p;
+    playback->output->pause(wma_pause);
+}
+
+static void wma_seek(InputPlayback *playback, int time) 
+{
+    wma_seekpos = time;
+    if(wma_pause) playback->output->pause(0);
+    while(wma_decode && wma_seekpos!=-1) xmms_usleep(10000);
+    if(wma_pause) playback->output->pause(1);
+}
+
+static int wma_get_time(InputPlayback *playback)
+{
+    playback->output->buffer_free();
+    if(wma_decode) return playback->output->output_time();
+    return -1;
+}
+
+static gchar *extname(const char *filename)
+{
+    gchar *ext = strrchr(filename, '.');
+    if(ext != NULL) ++ext;
+    return ext;
+}
+
+static char* w_getstr(char* str)
+{
+    if(str && strlen(str) > 0) return g_strdup(str);
+    return NULL;
+}
+
+static TitleInput *wma_get_song_tuple(gchar * filename)
+{
+    TitleInput *tuple = NULL;
+    AVFormatContext *in = NULL;
+    gchar *filename_proxy = g_strdup(filename);
+
+    if (av_open_input_file(&in, str_twenty_to_space(filename), NULL, 0, NULL) < 0)
+	return NULL;
+
+    tuple = bmp_title_input_new();
+
+    tuple->file_name = g_path_get_basename(filename_proxy);
+    tuple->file_path = g_path_get_dirname(filename_proxy);
+    tuple->file_ext = extname(filename_proxy);
+	
+    av_find_stream_info(in);
+
+    if((in->title[0] != '\0') || (in->author[0] != '\0') || (in->album[0] != '\0') ||
+       (in->comment[0] != '\0') || (in->genre[0] != '\0') || (in->year != 0) || (in->track != 0))
+    {	
+	tuple->performer = str_to_utf8(w_getstr(in->author));
+	tuple->album_name = str_to_utf8(w_getstr(in->album));
+	tuple->track_name = str_to_utf8(w_getstr(in->title));
+	tuple->year = in->year;
+	tuple->track_number = in->track;
+	tuple->genre = str_to_utf8(w_getstr(in->genre));
+	tuple->comment = str_to_utf8(w_getstr(in->comment));
+    }
+
+    if (in->duration)
+        tuple->length = in->duration / 1000;
+
+    av_close_input_file(in);
+
+    return tuple;
+}
+
+static gchar *get_song_title(AVFormatContext *in, gchar * filename)
+{
+    gchar *ret = NULL;
+    TitleInput *input;
+
+    input = bmp_title_input_new();
+    
+    if((in->title[0] != '\0') || (in->author[0] != '\0') || (in->album[0] != '\0') ||
+       (in->comment[0] != '\0') || (in->genre[0] != '\0') || (in->year != 0) || (in->track != 0))
+    {	
+	input->performer = w_getstr(in->author);
+	input->album_name = w_getstr(in->album);
+	input->track_name = w_getstr(in->title);
+	input->year = in->year;
+	input->track_number = in->track;
+	input->genre = w_getstr(in->genre);
+	input->comment = w_getstr(in->comment);
+    }
+    input->file_name = g_path_get_basename(filename);
+    input->file_path = g_path_get_dirname(filename);
+    input->file_ext = extname(filename);
+    ret = xmms_get_titlestring(xmms_get_gentitle_format(), input);
+    if(input) g_free(input);
+
+    if(!ret)
+    {
+	    ret = g_strdup(input->file_name);
+            if (extname(ret) != NULL)
+                    *(extname(ret) - 1) = '\0';
+    }
+    return ret;
+}
+
+static guint get_song_time(AVFormatContext *in)
+{
+    if(in->duration)
+	return in->duration/1000;
+    else
+	return 0;
+}
+
+static void wma_get_song_info(char *filename, char **title_real, int *len_real)
+{
+    TitleInput *tuple = wma_get_song_tuple(filename);
+
+    if (tuple == NULL)
+        return;
+
+    (*len_real) = tuple->length;
+    (*title_real) = xmms_get_titlestring(xmms_get_gentitle_format(), tuple);
+}
+
+static void wma_playbuff(InputPlayback *playback, int out_size)
+{
+    FifoBuffer f;
+    int sst_buff;
+    
+    fifo_init(&f, out_size*2);
+    fifo_write(&f, wma_outbuf, out_size, &f.wptr);
+    while(!fifo_read(&f, wma_s_outbuf, wma_st_buff, &f.rptr) && wma_decode)
+    {
+        sst_buff = wma_st_buff;
+	if(wma_pause) memset(wma_s_outbuf, 0, sst_buff);	
+    	while(playback->output->buffer_free() < wma_st_buff) xmms_usleep(20000);
+	produce_audio(playback->output->written_time(), FMT_S16_NE,
+    			    c->channels, sst_buff, (short *)wma_s_outbuf, NULL);
+	memset(wma_s_outbuf, 0, sst_buff);
+    }
+    fifo_free(&f);
+    return;
+}
+
+static void *wma_play_loop(void *arg)
+{
+    InputPlayback *playback = arg;
+    uint8_t *inbuf_ptr;
+    int out_size, size, len;
+    AVPacket pkt;
+    
+    g_static_mutex_lock(&wma_mutex);
+    while(wma_decode){
+
+	if(wma_seekpos != -1)
+	{
+	    av_seek_frame(ic, wma_idx, wma_seekpos * 1000000LL);
+	    playback->output->flush(wma_seekpos * 1000);
+	    wma_seekpos = -1;
+	}
+
+        if(av_read_frame(ic, &pkt) < 0) break;
+
+        size = pkt.size;
+        inbuf_ptr = pkt.data;
+	
+        if(size == 0) break;
+	
+        while(size > 0){
+            len = avcodec_decode_audio(c, (short *)wma_outbuf, &out_size,
+                                       inbuf_ptr, size);
+	    if(len < 0) break;
+	    
+            if(out_size <= 0) continue;
+
+	    wma_playbuff(playback, out_size);
+
+            size -= len;
+            inbuf_ptr += len;
+            if(pkt.data) av_free_packet(&pkt);
+        }
+    }
+    while(wma_decode && playback->output->buffer_playing()) xmms_usleep(30000);
+    wma_decode = 0;
+    if(wma_s_outbuf) g_free(wma_s_outbuf);
+    if(wma_outbuf) g_free(wma_outbuf);
+    if(pkt.data) av_free_packet(&pkt);
+    if(c) avcodec_close(c);
+    if(ic) av_close_input_file(ic);
+    g_static_mutex_unlock(&wma_mutex);
+    g_thread_exit(NULL);
+    return(NULL);
+}
+
+static void wma_play_file(InputPlayback *playback)
+{
+    char *filename = playback->filename;
+    AVCodec *codec;
+    
+    if(av_open_input_file(&ic, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return;
+
+    for(wma_idx = 0; wma_idx < ic->nb_streams; wma_idx++) {
+        c = &ic->streams[wma_idx]->codec;
+        if(c->codec_type == CODEC_TYPE_AUDIO) break;
+    }
+
+    av_find_stream_info(ic);
+
+    codec = avcodec_find_decoder(c->codec_id);
+
+    if(!codec) return;
+	
+    if(avcodec_open(c, codec) < 0) return;
+	    	    
+    wsong_title = get_song_title(ic, filename);
+    wsong_time = get_song_time(ic);
+
+    if(playback->output->open_audio(FMT_S16_NE, c->sample_rate, c->channels) <= 0) return;
+
+    wma_st_buff  = ST_BUFF;
+	
+    wma_ip.set_info(wsong_title, wsong_time, c->bit_rate, c->sample_rate, c->channels);
+
+    /* av_malloc() will wrap posix_memalign() if necessary -nenolod */
+    wma_s_outbuf = av_malloc(wma_st_buff);
+    wma_outbuf = av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
+
+    wma_seekpos = -1;
+    wma_decode = 1;
+    wma_decode_thread = g_thread_create((GThreadFunc)wma_play_loop, playback, TRUE, NULL);
+}
+
+static void wma_stop(InputPlayback *playback) 
+{
+    wma_decode = 0;
+    if(wma_pause) wma_do_pause(playback, 0);
+    g_thread_join(wma_decode_thread);
+    playback->output->close_audio();
+}	
--- a/src/ffmpeg/libavcodec/Makefile	Mon Mar 12 11:47:10 2007 -0700
+++ b/src/ffmpeg/libavcodec/Makefile	Mon Mar 12 13:00:06 2007 -0700
@@ -17,17 +17,17 @@
 smc.c	\
 apiexample.c              \
 asv1.c                    jfdctfst.c                sonic.c	\
-audioconvert.c            jfdctint.c                svq1.c	\
+audioconvert.c            jfdctint.c                \
 avs.c                     \
 jrevdct.c                 targa.c	\
-bitstream.c               kmvc.c                    tiertexseqv.c \
+bitstream.c               kmvc.c                    \
 bitstream_filter.c        lcl.c                     tiff.c	\
-bmp.c                     truemotion1.c	\
-cabac.c                   loco.c                    truemotion2.c	\
+bmp.c                     \
+cabac.c                   loco.c                    \
 cavs.c                    lzo.c                     truespeech.c	\
 cavsdsp.c                 mace.c                    tscc.c	\
 mdct.c                    tta.c	\
-cljr.c                    ulti.c	\
+cljr.c                    \
 cook.c                    utils.c	\
 cscd.c                    \
 cyuv.c                    \
@@ -37,7 +37,7 @@
 dsputil.c                 vorbis.c	\
 mpegaudio.c               vorbis_data.c \
 dv.c                      mpegaudiodec.c            vorbis_enc.c \
-dvbsub.c                  mpegvideo.c   \
+dvbsub.c                  \
 dvbsubdec.c	\
 dvdsub.c                  msrle.c                   \
 dvdsubenc.c               msvideo1.c                \
@@ -51,11 +51,11 @@
 ffv1.c                    pthread.c                 ws-snd1.c	\
 flac.c                    qdm2.c                    \
 flacenc.c                 qdrw.c                    \
-flashsv.c                 qpeg.c                    \
+flashsv.c                 \
 flicvideo.c               qtrle.c                   \
 fraps.c                   ra144.c                   \
 g726.c                    ra288.c                   \
-gifdec.c                  rangecoder.c              zmbv.c	\
+gifdec.c                  rangecoder.c              \
 golomb.c                  ratecontrol.c
 
 CFLAGS+=	$(PICFLAGS) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -I../../.. -I../libavformat -I../libavutil -I.. -DHAVE_AV_CONFIG_H
--- a/src/ffmpeg/libavcodec/mpegvideo.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6881 +0,0 @@
-/*
- * The simplest mpeg encoder (well, it was the simplest!)
- * Copyright (c) 2000,2001 Fabrice Bellard.
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * 4MV & hq & b-frame encoding stuff by Michael Niedermayer <michaelni@gmx.at>
- */
-
-/**
- * @file mpegvideo.c
- * The simplest mpeg encoder (well, it was the simplest!).
- */
-
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "faandct.h"
-#include <limits.h>
-
-#ifdef USE_FASTMEMCPY
-#include "libvo/fastmemcpy.h"
-#endif
-
-//#undef NDEBUG
-//#include <assert.h>
-
-#ifdef CONFIG_ENCODERS
-static int encode_picture(MpegEncContext *s, int picture_number);
-#endif //CONFIG_ENCODERS
-static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale);
-static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale);
-static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale);
-static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale);
-static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale);
-static void dct_unquantize_h263_intra_c(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale);
-static void dct_unquantize_h263_inter_c(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale);
-static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w);
-#ifdef CONFIG_ENCODERS
-static int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
-static int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
-static int dct_quantize_refine(MpegEncContext *s, DCTELEM *block, int16_t *weight, DCTELEM *orig, int n, int qscale);
-static int sse_mb(MpegEncContext *s);
-static void  denoise_dct_c(MpegEncContext *s, DCTELEM *block);
-#endif //CONFIG_ENCODERS
-
-#ifdef HAVE_XVMC
-extern int  XVMC_field_start(MpegEncContext*s, AVCodecContext *avctx);
-extern void XVMC_field_end(MpegEncContext *s);
-extern void XVMC_decode_mb(MpegEncContext *s);
-#endif
-
-void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w)= draw_edges_c;
-
-
-/* enable all paranoid tests for rounding, overflows, etc... */
-//#define PARANOID
-
-//#define DEBUG
-
-
-/* for jpeg fast DCT */
-#define CONST_BITS 14
-
-static const uint16_t aanscales[64] = {
-    /* precomputed values scaled up by 14 bits */
-    16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
-    22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,
-    21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,
-    19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,
-    16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
-    12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,
-    8867 , 12299, 11585, 10426,  8867,  6967,  4799,  2446,
-    4520 ,  6270,  5906,  5315,  4520,  3552,  2446,  1247
-};
-
-static const uint8_t h263_chroma_roundtab[16] = {
-//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-    0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2,
-};
-
-static const uint8_t ff_default_chroma_qscale_table[32]={
-//  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
-    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
-};
-
-#ifdef CONFIG_ENCODERS
-static uint8_t (*default_mv_penalty)[MAX_MV*2+1]=NULL;
-static uint8_t default_fcode_tab[MAX_MV*2+1];
-
-enum PixelFormat ff_yuv420p_list[2]= {PIX_FMT_YUV420P, -1};
-
-static void convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64],
-                           const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra)
-{
-    int qscale;
-    int shift=0;
-
-    for(qscale=qmin; qscale<=qmax; qscale++){
-        int i;
-        if (dsp->fdct == ff_jpeg_fdct_islow
-#ifdef FAAN_POSTSCALE
-            || dsp->fdct == ff_faandct
-#endif
-            ) {
-            for(i=0;i<64;i++) {
-                const int j= dsp->idct_permutation[i];
-                /* 16 <= qscale * quant_matrix[i] <= 7905 */
-                /* 19952         <= aanscales[i] * qscale * quant_matrix[i]           <= 249205026 */
-                /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */
-                /* 3444240       >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */
-
-                qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) /
-                                (qscale * quant_matrix[j]));
-            }
-        } else if (dsp->fdct == fdct_ifast
-#ifndef FAAN_POSTSCALE
-                   || dsp->fdct == ff_faandct
-#endif
-                   ) {
-            for(i=0;i<64;i++) {
-                const int j= dsp->idct_permutation[i];
-                /* 16 <= qscale * quant_matrix[i] <= 7905 */
-                /* 19952         <= aanscales[i] * qscale * quant_matrix[i]           <= 249205026 */
-                /* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */
-                /* 3444240       >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= 275 */
-
-                qmat[qscale][i] = (int)((uint64_t_C(1) << (QMAT_SHIFT + 14)) /
-                                (aanscales[i] * qscale * quant_matrix[j]));
-            }
-        } else {
-            for(i=0;i<64;i++) {
-                const int j= dsp->idct_permutation[i];
-                /* We can safely suppose that 16 <= quant_matrix[i] <= 255
-                   So 16           <= qscale * quant_matrix[i]             <= 7905
-                   so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905
-                   so 32768        >= (1<<19) / (qscale * quant_matrix[i]) >= 67
-                */
-                qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) / (qscale * quant_matrix[j]));
-//                qmat  [qscale][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[i]);
-                qmat16[qscale][0][i] = (1 << QMAT_SHIFT_MMX) / (qscale * quant_matrix[j]);
-
-                if(qmat16[qscale][0][i]==0 || qmat16[qscale][0][i]==128*256) qmat16[qscale][0][i]=128*256-1;
-                qmat16[qscale][1][i]= ROUNDED_DIV(bias<<(16-QUANT_BIAS_SHIFT), qmat16[qscale][0][i]);
-            }
-        }
-
-        for(i=intra; i<64; i++){
-            int64_t max= 8191;
-            if (dsp->fdct == fdct_ifast
-#ifndef FAAN_POSTSCALE
-                   || dsp->fdct == ff_faandct
-#endif
-                   ) {
-                max= (8191LL*aanscales[i]) >> 14;
-            }
-            while(((max * qmat[qscale][i]) >> shift) > INT_MAX){
-                shift++;
-            }
-        }
-    }
-    if(shift){
-        av_log(NULL, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger then %d, overflows possible\n", QMAT_SHIFT - shift);
-    }
-}
-
-static inline void update_qscale(MpegEncContext *s){
-    s->qscale= (s->lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
-    s->qscale= clip(s->qscale, s->avctx->qmin, s->avctx->qmax);
-
-    s->lambda2= (s->lambda*s->lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT;
-}
-#endif //CONFIG_ENCODERS
-
-void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable){
-    int i;
-    int end;
-
-    st->scantable= src_scantable;
-
-    for(i=0; i<64; i++){
-        int j;
-        j = src_scantable[i];
-        st->permutated[i] = permutation[j];
-#ifdef ARCH_POWERPC
-        st->inverse[j] = i;
-#endif
-    }
-
-    end=-1;
-    for(i=0; i<64; i++){
-        int j;
-        j = st->permutated[i];
-        if(j>end) end=j;
-        st->raster_end[i]= end;
-    }
-}
-
-#ifdef CONFIG_ENCODERS
-void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix){
-    int i;
-
-    if(matrix){
-        put_bits(pb, 1, 1);
-        for(i=0;i<64;i++) {
-            put_bits(pb, 8, matrix[ ff_zigzag_direct[i] ]);
-        }
-    }else
-        put_bits(pb, 1, 0);
-}
-#endif //CONFIG_ENCODERS
-
-const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){
-    int i;
-
-    assert(p<=end);
-    if(p>=end)
-        return end;
-
-    for(i=0; i<3; i++){
-        uint32_t tmp= *state << 8;
-        *state= tmp + *(p++);
-        if(tmp == 0x100 || p==end)
-            return p;
-    }
-
-    while(p<end){
-        if     (p[-1] > 1      ) p+= 3;
-        else if(p[-2]          ) p+= 2;
-        else if(p[-3]|(p[-1]-1)) p++;
-        else{
-            p++;
-            break;
-        }
-    }
-
-    p= FFMIN(p, end)-4;
-    *state=  be2me_32(unaligned32(p));
-
-    return p+4;
-}
-
-/* init common dct for both encoder and decoder */
-int DCT_common_init(MpegEncContext *s)
-{
-    s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c;
-    s->dct_unquantize_h263_inter = dct_unquantize_h263_inter_c;
-    s->dct_unquantize_mpeg1_intra = dct_unquantize_mpeg1_intra_c;
-    s->dct_unquantize_mpeg1_inter = dct_unquantize_mpeg1_inter_c;
-    s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_c;
-    if(s->flags & CODEC_FLAG_BITEXACT)
-        s->dct_unquantize_mpeg2_intra = dct_unquantize_mpeg2_intra_bitexact;
-    s->dct_unquantize_mpeg2_inter = dct_unquantize_mpeg2_inter_c;
-
-#ifdef CONFIG_ENCODERS
-    s->dct_quantize= dct_quantize_c;
-    s->denoise_dct= denoise_dct_c;
-#endif //CONFIG_ENCODERS
-
-#ifdef HAVE_MMX
-    MPV_common_init_mmx(s);
-#endif
-#ifdef ARCH_ALPHA
-    MPV_common_init_axp(s);
-#endif
-#ifdef HAVE_MLIB
-    MPV_common_init_mlib(s);
-#endif
-#ifdef HAVE_MMI
-    MPV_common_init_mmi(s);
-#endif
-#ifdef ARCH_ARMV4L
-    MPV_common_init_armv4l(s);
-#endif
-#ifdef ARCH_POWERPC
-    MPV_common_init_ppc(s);
-#endif
-
-#ifdef CONFIG_ENCODERS
-    s->fast_dct_quantize= s->dct_quantize;
-
-    if(s->flags&CODEC_FLAG_TRELLIS_QUANT){
-        s->dct_quantize= dct_quantize_trellis_c; //move before MPV_common_init_*
-    }
-
-#endif //CONFIG_ENCODERS
-
-    /* load & permutate scantables
-       note: only wmv uses different ones
-    */
-    if(s->alternate_scan){
-        ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable  , ff_alternate_vertical_scan);
-        ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable  , ff_alternate_vertical_scan);
-    }else{
-        ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable  , ff_zigzag_direct);
-        ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable  , ff_zigzag_direct);
-    }
-    ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan);
-    ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan);
-
-    return 0;
-}
-
-static void copy_picture(Picture *dst, Picture *src){
-    *dst = *src;
-    dst->type= FF_BUFFER_TYPE_COPY;
-}
-
-#ifdef CONFIG_ENCODERS
-static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *src){
-    int i;
-
-    dst->pict_type              = src->pict_type;
-    dst->quality                = src->quality;
-    dst->coded_picture_number   = src->coded_picture_number;
-    dst->display_picture_number = src->display_picture_number;
-//    dst->reference              = src->reference;
-    dst->pts                    = src->pts;
-    dst->interlaced_frame       = src->interlaced_frame;
-    dst->top_field_first        = src->top_field_first;
-
-    if(s->avctx->me_threshold){
-        if(!src->motion_val[0])
-            av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_val not set!\n");
-        if(!src->mb_type)
-            av_log(s->avctx, AV_LOG_ERROR, "AVFrame.mb_type not set!\n");
-        if(!src->ref_index[0])
-            av_log(s->avctx, AV_LOG_ERROR, "AVFrame.ref_index not set!\n");
-        if(src->motion_subsample_log2 != dst->motion_subsample_log2)
-            av_log(s->avctx, AV_LOG_ERROR, "AVFrame.motion_subsample_log2 doesn't match! (%d!=%d)\n",
-            src->motion_subsample_log2, dst->motion_subsample_log2);
-
-        memcpy(dst->mb_type, src->mb_type, s->mb_stride * s->mb_height * sizeof(dst->mb_type[0]));
-
-        for(i=0; i<2; i++){
-            int stride= ((16*s->mb_width )>>src->motion_subsample_log2) + 1;
-            int height= ((16*s->mb_height)>>src->motion_subsample_log2);
-
-            if(src->motion_val[i] && src->motion_val[i] != dst->motion_val[i]){
-                memcpy(dst->motion_val[i], src->motion_val[i], 2*stride*height*sizeof(int16_t));
-            }
-            if(src->ref_index[i] && src->ref_index[i] != dst->ref_index[i]){
-                memcpy(dst->ref_index[i], src->ref_index[i], s->b8_stride*2*s->mb_height*sizeof(int8_t));
-            }
-        }
-    }
-}
-#endif
-
-/**
- * allocates a Picture
- * The pixels are allocated/set by calling get_buffer() if shared=0
- */
-static int alloc_picture(MpegEncContext *s, Picture *pic, int shared){
-    const int big_mb_num= s->mb_stride*(s->mb_height+1) + 1; //the +1 is needed so memset(,,stride*height) doesnt sig11
-    const int mb_array_size= s->mb_stride*s->mb_height;
-    const int b8_array_size= s->b8_stride*s->mb_height*2;
-    const int b4_array_size= s->b4_stride*s->mb_height*4;
-    int i;
-
-    if(shared){
-        assert(pic->data[0]);
-        assert(pic->type == 0 || pic->type == FF_BUFFER_TYPE_SHARED);
-        pic->type= FF_BUFFER_TYPE_SHARED;
-    }else{
-        int r;
-
-        assert(!pic->data[0]);
-
-        r= s->avctx->get_buffer(s->avctx, (AVFrame*)pic);
-
-        if(r<0 || !pic->age || !pic->type || !pic->data[0]){
-            av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %d %d %p)\n", r, pic->age, pic->type, pic->data[0]);
-            return -1;
-        }
-
-        if(s->linesize && (s->linesize != pic->linesize[0] || s->uvlinesize != pic->linesize[1])){
-            av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (stride changed)\n");
-            return -1;
-        }
-
-        if(pic->linesize[1] != pic->linesize[2]){
-            av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (uv stride mismatch)\n");
-            return -1;
-        }
-
-        s->linesize  = pic->linesize[0];
-        s->uvlinesize= pic->linesize[1];
-    }
-
-    if(pic->qscale_table==NULL){
-        if (s->encoding) {
-            CHECKED_ALLOCZ(pic->mb_var   , mb_array_size * sizeof(int16_t))
-            CHECKED_ALLOCZ(pic->mc_mb_var, mb_array_size * sizeof(int16_t))
-            CHECKED_ALLOCZ(pic->mb_mean  , mb_array_size * sizeof(int8_t))
-        }
-
-        CHECKED_ALLOCZ(pic->mbskip_table , mb_array_size * sizeof(uint8_t)+2) //the +2 is for the slice end check
-        CHECKED_ALLOCZ(pic->qscale_table , mb_array_size * sizeof(uint8_t))
-        CHECKED_ALLOCZ(pic->mb_type_base , big_mb_num    * sizeof(uint32_t))
-        pic->mb_type= pic->mb_type_base + s->mb_stride+1;
-        if(s->out_format == FMT_H264){
-            for(i=0; i<2; i++){
-                CHECKED_ALLOCZ(pic->motion_val_base[i], 2 * (b4_array_size+4)  * sizeof(int16_t))
-                pic->motion_val[i]= pic->motion_val_base[i]+4;
-                CHECKED_ALLOCZ(pic->ref_index[i], b8_array_size * sizeof(uint8_t))
-            }
-            pic->motion_subsample_log2= 2;
-        }else if(s->out_format == FMT_H263 || s->encoding || (s->avctx->debug&FF_DEBUG_MV) || (s->avctx->debug_mv)){
-            for(i=0; i<2; i++){
-                CHECKED_ALLOCZ(pic->motion_val_base[i], 2 * (b8_array_size+4) * sizeof(int16_t))
-                pic->motion_val[i]= pic->motion_val_base[i]+4;
-                CHECKED_ALLOCZ(pic->ref_index[i], b8_array_size * sizeof(uint8_t))
-            }
-            pic->motion_subsample_log2= 3;
-        }
-        if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
-            CHECKED_ALLOCZ(pic->dct_coeff, 64 * mb_array_size * sizeof(DCTELEM)*6)
-        }
-        pic->qstride= s->mb_stride;
-        CHECKED_ALLOCZ(pic->pan_scan , 1 * sizeof(AVPanScan))
-    }
-
-    //it might be nicer if the application would keep track of these but it would require a API change
-    memmove(s->prev_pict_types+1, s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE-1);
-    s->prev_pict_types[0]= s->pict_type;
-    if(pic->age < PREV_PICT_TYPES_BUFFER_SIZE && s->prev_pict_types[pic->age] == B_TYPE)
-        pic->age= INT_MAX; // skipped MBs in b frames are quite rare in mpeg1/2 and its a bit tricky to skip them anyway
-
-    return 0;
-fail: //for the CHECKED_ALLOCZ macro
-    return -1;
-}
-
-/**
- * deallocates a picture
- */
-static void free_picture(MpegEncContext *s, Picture *pic){
-    int i;
-
-    if(pic->data[0] && pic->type!=FF_BUFFER_TYPE_SHARED){
-        s->avctx->release_buffer(s->avctx, (AVFrame*)pic);
-    }
-
-    av_freep(&pic->mb_var);
-    av_freep(&pic->mc_mb_var);
-    av_freep(&pic->mb_mean);
-    av_freep(&pic->mbskip_table);
-    av_freep(&pic->qscale_table);
-    av_freep(&pic->mb_type_base);
-    av_freep(&pic->dct_coeff);
-    av_freep(&pic->pan_scan);
-    pic->mb_type= NULL;
-    for(i=0; i<2; i++){
-        av_freep(&pic->motion_val_base[i]);
-        av_freep(&pic->ref_index[i]);
-    }
-
-    if(pic->type == FF_BUFFER_TYPE_SHARED){
-        for(i=0; i<4; i++){
-            pic->base[i]=
-            pic->data[i]= NULL;
-        }
-        pic->type= 0;
-    }
-}
-
-static int init_duplicate_context(MpegEncContext *s, MpegEncContext *base){
-    int i;
-
-    // edge emu needs blocksize + filter length - 1 (=17x17 for halfpel / 21x21 for h264)
-    CHECKED_ALLOCZ(s->allocated_edge_emu_buffer, (s->width+64)*2*21*2); //(width + edge + align)*interlaced*MBsize*tolerance
-    s->edge_emu_buffer= s->allocated_edge_emu_buffer + (s->width+64)*2*21;
-
-     //FIXME should be linesize instead of s->width*2 but that isnt known before get_buffer()
-    CHECKED_ALLOCZ(s->me.scratchpad,  (s->width+64)*4*16*2*sizeof(uint8_t))
-    s->rd_scratchpad=   s->me.scratchpad;
-    s->b_scratchpad=    s->me.scratchpad;
-    s->obmc_scratchpad= s->me.scratchpad + 16;
-    if (s->encoding) {
-        CHECKED_ALLOCZ(s->me.map      , ME_MAP_SIZE*sizeof(uint32_t))
-        CHECKED_ALLOCZ(s->me.score_map, ME_MAP_SIZE*sizeof(uint32_t))
-        if(s->avctx->noise_reduction){
-            CHECKED_ALLOCZ(s->dct_error_sum, 2 * 64 * sizeof(int))
-        }
-    }
-    CHECKED_ALLOCZ(s->blocks, 64*12*2 * sizeof(DCTELEM))
-    s->block= s->blocks[0];
-
-    for(i=0;i<12;i++){
-        s->pblocks[i] = (short *)(&s->block[i]);
-    }
-    return 0;
-fail:
-    return -1; //free() through MPV_common_end()
-}
-
-static void free_duplicate_context(MpegEncContext *s){
-    if(s==NULL) return;
-
-    av_freep(&s->allocated_edge_emu_buffer); s->edge_emu_buffer= NULL;
-    av_freep(&s->me.scratchpad);
-    s->rd_scratchpad=
-    s->b_scratchpad=
-    s->obmc_scratchpad= NULL;
-
-    av_freep(&s->dct_error_sum);
-    av_freep(&s->me.map);
-    av_freep(&s->me.score_map);
-    av_freep(&s->blocks);
-    s->block= NULL;
-}
-
-static void backup_duplicate_context(MpegEncContext *bak, MpegEncContext *src){
-#define COPY(a) bak->a= src->a
-    COPY(allocated_edge_emu_buffer);
-    COPY(edge_emu_buffer);
-    COPY(me.scratchpad);
-    COPY(rd_scratchpad);
-    COPY(b_scratchpad);
-    COPY(obmc_scratchpad);
-    COPY(me.map);
-    COPY(me.score_map);
-    COPY(blocks);
-    COPY(block);
-    COPY(start_mb_y);
-    COPY(end_mb_y);
-    COPY(me.map_generation);
-    COPY(pb);
-    COPY(dct_error_sum);
-    COPY(dct_count[0]);
-    COPY(dct_count[1]);
-#undef COPY
-}
-
-void ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src){
-    MpegEncContext bak;
-    int i;
-    //FIXME copy only needed parts
-//START_TIMER
-    backup_duplicate_context(&bak, dst);
-    memcpy(dst, src, sizeof(MpegEncContext));
-    backup_duplicate_context(dst, &bak);
-    for(i=0;i<12;i++){
-        dst->pblocks[i] = (short *)(&dst->block[i]);
-    }
-//STOP_TIMER("update_duplicate_context") //about 10k cycles / 0.01 sec for 1000frames on 1ghz with 2 threads
-}
-
-#ifdef CONFIG_ENCODERS
-static void update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContext *src){
-#define COPY(a) dst->a= src->a
-    COPY(pict_type);
-    COPY(current_picture);
-    COPY(f_code);
-    COPY(b_code);
-    COPY(qscale);
-    COPY(lambda);
-    COPY(lambda2);
-    COPY(picture_in_gop_number);
-    COPY(gop_picture_number);
-    COPY(frame_pred_frame_dct); //FIXME don't set in encode_header
-    COPY(progressive_frame); //FIXME don't set in encode_header
-    COPY(partitioned_frame); //FIXME don't set in encode_header
-#undef COPY
-}
-#endif
-
-/**
- * sets the given MpegEncContext to common defaults (same for encoding and decoding).
- * the changed fields will not depend upon the prior state of the MpegEncContext.
- */
-static void MPV_common_defaults(MpegEncContext *s){
-    s->y_dc_scale_table=
-    s->c_dc_scale_table= ff_mpeg1_dc_scale_table;
-    s->chroma_qscale_table= ff_default_chroma_qscale_table;
-    s->progressive_frame= 1;
-    s->progressive_sequence= 1;
-    s->picture_structure= PICT_FRAME;
-
-    s->coded_picture_number = 0;
-    s->picture_number = 0;
-    s->input_picture_number = 0;
-
-    s->picture_in_gop_number = 0;
-
-    s->f_code = 1;
-    s->b_code = 1;
-}
-
-/**
- * sets the given MpegEncContext to defaults for decoding.
- * the changed fields will not depend upon the prior state of the MpegEncContext.
- */
-void MPV_decode_defaults(MpegEncContext *s){
-    MPV_common_defaults(s);
-}
-
-/**
- * sets the given MpegEncContext to defaults for encoding.
- * the changed fields will not depend upon the prior state of the MpegEncContext.
- */
-
-#ifdef CONFIG_ENCODERS
-static void MPV_encode_defaults(MpegEncContext *s){
-    static int done=0;
-
-    MPV_common_defaults(s);
-
-    if(!done){
-        int i;
-        done=1;
-
-        default_mv_penalty= av_mallocz( sizeof(uint8_t)*(MAX_FCODE+1)*(2*MAX_MV+1) );
-        memset(default_fcode_tab , 0, sizeof(uint8_t)*(2*MAX_MV+1));
-
-        for(i=-16; i<16; i++){
-            default_fcode_tab[i + MAX_MV]= 1;
-        }
-    }
-    s->me.mv_penalty= default_mv_penalty;
-    s->fcode_tab= default_fcode_tab;
-}
-#endif //CONFIG_ENCODERS
-
-/**
- * init common structure for both encoder and decoder.
- * this assumes that some variables like width/height are already set
- */
-int MPV_common_init(MpegEncContext *s)
-{
-    int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
-
-    s->mb_height = (s->height + 15) / 16;
-
-    if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){
-        av_log(s->avctx, AV_LOG_ERROR, "too many threads\n");
-        return -1;
-    }
-
-    if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height))
-        return -1;
-
-    dsputil_init(&s->dsp, s->avctx);
-    DCT_common_init(s);
-
-    s->flags= s->avctx->flags;
-    s->flags2= s->avctx->flags2;
-
-    s->mb_width  = (s->width  + 15) / 16;
-    s->mb_stride = s->mb_width + 1;
-    s->b8_stride = s->mb_width*2 + 1;
-    s->b4_stride = s->mb_width*4 + 1;
-    mb_array_size= s->mb_height * s->mb_stride;
-    mv_table_size= (s->mb_height+2) * s->mb_stride + 1;
-
-    /* set chroma shifts */
-    avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift),
-                                                    &(s->chroma_y_shift) );
-
-    /* set default edge pos, will be overriden in decode_header if needed */
-    s->h_edge_pos= s->mb_width*16;
-    s->v_edge_pos= s->mb_height*16;
-
-    s->mb_num = s->mb_width * s->mb_height;
-
-    s->block_wrap[0]=
-    s->block_wrap[1]=
-    s->block_wrap[2]=
-    s->block_wrap[3]= s->b8_stride;
-    s->block_wrap[4]=
-    s->block_wrap[5]= s->mb_stride;
-
-    y_size = s->b8_stride * (2 * s->mb_height + 1);
-    c_size = s->mb_stride * (s->mb_height + 1);
-    yc_size = y_size + 2 * c_size;
-
-    /* convert fourcc to upper case */
-    s->avctx->codec_tag=   toupper( s->avctx->codec_tag     &0xFF)
-                        + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 )
-                        + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16)
-                        + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24);
-
-    s->avctx->stream_codec_tag=   toupper( s->avctx->stream_codec_tag     &0xFF)
-                               + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 )
-                               + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16)
-                               + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24);
-
-    s->avctx->coded_frame= (AVFrame*)&s->current_picture;
-
-    CHECKED_ALLOCZ(s->mb_index2xy, (s->mb_num+1)*sizeof(int)) //error ressilience code looks cleaner with this
-    for(y=0; y<s->mb_height; y++){
-        for(x=0; x<s->mb_width; x++){
-            s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride;
-        }
-    }
-    s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width; //FIXME really needed?
-
-    if (s->encoding) {
-        /* Allocate MV tables */
-        CHECKED_ALLOCZ(s->p_mv_table_base            , mv_table_size * 2 * sizeof(int16_t))
-        CHECKED_ALLOCZ(s->b_forw_mv_table_base       , mv_table_size * 2 * sizeof(int16_t))
-        CHECKED_ALLOCZ(s->b_back_mv_table_base       , mv_table_size * 2 * sizeof(int16_t))
-        CHECKED_ALLOCZ(s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t))
-        CHECKED_ALLOCZ(s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t))
-        CHECKED_ALLOCZ(s->b_direct_mv_table_base     , mv_table_size * 2 * sizeof(int16_t))
-        s->p_mv_table           = s->p_mv_table_base            + s->mb_stride + 1;
-        s->b_forw_mv_table      = s->b_forw_mv_table_base       + s->mb_stride + 1;
-        s->b_back_mv_table      = s->b_back_mv_table_base       + s->mb_stride + 1;
-        s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1;
-        s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1;
-        s->b_direct_mv_table    = s->b_direct_mv_table_base     + s->mb_stride + 1;
-
-        if(s->msmpeg4_version){
-            CHECKED_ALLOCZ(s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int));
-        }
-        CHECKED_ALLOCZ(s->avctx->stats_out, 256);
-
-        /* Allocate MB type table */
-        CHECKED_ALLOCZ(s->mb_type  , mb_array_size * sizeof(uint16_t)) //needed for encoding
-
-        CHECKED_ALLOCZ(s->lambda_table, mb_array_size * sizeof(int))
-
-        CHECKED_ALLOCZ(s->q_intra_matrix, 64*32 * sizeof(int))
-        CHECKED_ALLOCZ(s->q_inter_matrix, 64*32 * sizeof(int))
-        CHECKED_ALLOCZ(s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t))
-        CHECKED_ALLOCZ(s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t))
-        CHECKED_ALLOCZ(s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*))
-        CHECKED_ALLOCZ(s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*))
-
-        if(s->avctx->noise_reduction){
-            CHECKED_ALLOCZ(s->dct_offset, 2 * 64 * sizeof(uint16_t))
-        }
-    }
-    CHECKED_ALLOCZ(s->picture, MAX_PICTURE_COUNT * sizeof(Picture))
-
-    CHECKED_ALLOCZ(s->error_status_table, mb_array_size*sizeof(uint8_t))
-
-    if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){
-        /* interlaced direct mode decoding tables */
-            for(i=0; i<2; i++){
-                int j, k;
-                for(j=0; j<2; j++){
-                    for(k=0; k<2; k++){
-                        CHECKED_ALLOCZ(s->b_field_mv_table_base[i][j][k]     , mv_table_size * 2 * sizeof(int16_t))
-                        s->b_field_mv_table[i][j][k]    = s->b_field_mv_table_base[i][j][k]     + s->mb_stride + 1;
-                    }
-                    CHECKED_ALLOCZ(s->b_field_select_table[i][j]     , mb_array_size * 2 * sizeof(uint8_t))
-                    CHECKED_ALLOCZ(s->p_field_mv_table_base[i][j]     , mv_table_size * 2 * sizeof(int16_t))
-                    s->p_field_mv_table[i][j]    = s->p_field_mv_table_base[i][j]     + s->mb_stride + 1;
-                }
-                CHECKED_ALLOCZ(s->p_field_select_table[i]      , mb_array_size * 2 * sizeof(uint8_t))
-            }
-    }
-    if (s->out_format == FMT_H263) {
-        /* ac values */
-        CHECKED_ALLOCZ(s->ac_val_base, yc_size * sizeof(int16_t) * 16);
-        s->ac_val[0] = s->ac_val_base + s->b8_stride + 1;
-        s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1;
-        s->ac_val[2] = s->ac_val[1] + c_size;
-
-        /* cbp values */
-        CHECKED_ALLOCZ(s->coded_block_base, y_size);
-        s->coded_block= s->coded_block_base + s->b8_stride + 1;
-
-        /* cbp, ac_pred, pred_dir */
-        CHECKED_ALLOCZ(s->cbp_table  , mb_array_size * sizeof(uint8_t))
-        CHECKED_ALLOCZ(s->pred_dir_table, mb_array_size * sizeof(uint8_t))
-    }
-
-    if (s->h263_pred || s->h263_plus || !s->encoding) {
-        /* dc values */
-        //MN: we need these for error resilience of intra-frames
-        CHECKED_ALLOCZ(s->dc_val_base, yc_size * sizeof(int16_t));
-        s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
-        s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;
-        s->dc_val[2] = s->dc_val[1] + c_size;
-        for(i=0;i<yc_size;i++)
-            s->dc_val_base[i] = 1024;
-    }
-
-    /* which mb is a intra block */
-    CHECKED_ALLOCZ(s->mbintra_table, mb_array_size);
-    memset(s->mbintra_table, 1, mb_array_size);
-
-    /* init macroblock skip table */
-    CHECKED_ALLOCZ(s->mbskip_table, mb_array_size+2);
-    //Note the +1 is for a quicker mpeg4 slice_end detection
-    CHECKED_ALLOCZ(s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE);
-
-    s->parse_context.state= -1;
-    if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){
-       s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);
-       s->visualization_buffer[1] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH);
-       s->visualization_buffer[2] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH);
-    }
-
-    s->context_initialized = 1;
-
-    s->thread_context[0]= s;
-    for(i=1; i<s->avctx->thread_count; i++){
-        s->thread_context[i]= av_malloc(sizeof(MpegEncContext));
-        memcpy(s->thread_context[i], s, sizeof(MpegEncContext));
-    }
-
-    for(i=0; i<s->avctx->thread_count; i++){
-        if(init_duplicate_context(s->thread_context[i], s) < 0)
-           goto fail;
-        s->thread_context[i]->start_mb_y= (s->mb_height*(i  ) + s->avctx->thread_count/2) / s->avctx->thread_count;
-        s->thread_context[i]->end_mb_y  = (s->mb_height*(i+1) + s->avctx->thread_count/2) / s->avctx->thread_count;
-    }
-
-    return 0;
- fail:
-    MPV_common_end(s);
-    return -1;
-}
-
-/* init common structure for both encoder and decoder */
-void MPV_common_end(MpegEncContext *s)
-{
-    int i, j, k;
-
-    for(i=0; i<s->avctx->thread_count; i++){
-        free_duplicate_context(s->thread_context[i]);
-    }
-    for(i=1; i<s->avctx->thread_count; i++){
-        av_freep(&s->thread_context[i]);
-    }
-
-    av_freep(&s->parse_context.buffer);
-    s->parse_context.buffer_size=0;
-
-    av_freep(&s->mb_type);
-    av_freep(&s->p_mv_table_base);
-    av_freep(&s->b_forw_mv_table_base);
-    av_freep(&s->b_back_mv_table_base);
-    av_freep(&s->b_bidir_forw_mv_table_base);
-    av_freep(&s->b_bidir_back_mv_table_base);
-    av_freep(&s->b_direct_mv_table_base);
-    s->p_mv_table= NULL;
-    s->b_forw_mv_table= NULL;
-    s->b_back_mv_table= NULL;
-    s->b_bidir_forw_mv_table= NULL;
-    s->b_bidir_back_mv_table= NULL;
-    s->b_direct_mv_table= NULL;
-    for(i=0; i<2; i++){
-        for(j=0; j<2; j++){
-            for(k=0; k<2; k++){
-                av_freep(&s->b_field_mv_table_base[i][j][k]);
-                s->b_field_mv_table[i][j][k]=NULL;
-            }
-            av_freep(&s->b_field_select_table[i][j]);
-            av_freep(&s->p_field_mv_table_base[i][j]);
-            s->p_field_mv_table[i][j]=NULL;
-        }
-        av_freep(&s->p_field_select_table[i]);
-    }
-
-    av_freep(&s->dc_val_base);
-    av_freep(&s->ac_val_base);
-    av_freep(&s->coded_block_base);
-    av_freep(&s->mbintra_table);
-    av_freep(&s->cbp_table);
-    av_freep(&s->pred_dir_table);
-
-    av_freep(&s->mbskip_table);
-    av_freep(&s->prev_pict_types);
-    av_freep(&s->bitstream_buffer);
-    s->allocated_bitstream_buffer_size=0;
-
-    av_freep(&s->avctx->stats_out);
-    av_freep(&s->ac_stats);
-    av_freep(&s->error_status_table);
-    av_freep(&s->mb_index2xy);
-    av_freep(&s->lambda_table);
-    av_freep(&s->q_intra_matrix);
-    av_freep(&s->q_inter_matrix);
-    av_freep(&s->q_intra_matrix16);
-    av_freep(&s->q_inter_matrix16);
-    av_freep(&s->input_picture);
-    av_freep(&s->reordered_input_picture);
-    av_freep(&s->dct_offset);
-
-    if(s->picture){
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            free_picture(s, &s->picture[i]);
-        }
-    }
-    av_freep(&s->picture);
-    s->context_initialized = 0;
-    s->last_picture_ptr=
-    s->next_picture_ptr=
-    s->current_picture_ptr= NULL;
-    s->linesize= s->uvlinesize= 0;
-
-    for(i=0; i<3; i++)
-        av_freep(&s->visualization_buffer[i]);
-
-    avcodec_default_free_buffers(s->avctx);
-}
-
-#ifdef CONFIG_ENCODERS
-
-/* init video encoder */
-int MPV_encode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-    int i;
-    int chroma_h_shift, chroma_v_shift;
-
-    MPV_encode_defaults(s);
-
-    switch (avctx->codec_id) {
-    case CODEC_ID_MPEG2VIDEO:
-        if(avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P){
-            av_log(avctx, AV_LOG_ERROR, "only YUV420 and YUV422 are supported\n");
-            return -1;
-        }
-        break;
-    case CODEC_ID_LJPEG:
-    case CODEC_ID_MJPEG:
-        if(avctx->pix_fmt != PIX_FMT_YUVJ420P && avctx->pix_fmt != PIX_FMT_YUVJ422P &&
-           ((avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P) || avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL)){
-            av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n");
-            return -1;
-        }
-        break;
-    default:
-        if(avctx->pix_fmt != PIX_FMT_YUV420P){
-            av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n");
-            return -1;
-        }
-    }
-
-    switch (avctx->pix_fmt) {
-    case PIX_FMT_YUVJ422P:
-    case PIX_FMT_YUV422P:
-        s->chroma_format = CHROMA_422;
-        break;
-    case PIX_FMT_YUVJ420P:
-    case PIX_FMT_YUV420P:
-    default:
-        s->chroma_format = CHROMA_420;
-        break;
-    }
-
-    s->bit_rate = avctx->bit_rate;
-    s->width = avctx->width;
-    s->height = avctx->height;
-    if(avctx->gop_size > 600 && avctx->strict_std_compliance>FF_COMPLIANCE_EXPERIMENTAL){
-        av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! reducing it ...\n");
-        avctx->gop_size=600;
-    }
-    s->gop_size = avctx->gop_size;
-    s->avctx = avctx;
-    s->flags= avctx->flags;
-    s->flags2= avctx->flags2;
-    s->max_b_frames= avctx->max_b_frames;
-    s->codec_id= avctx->codec->id;
-    s->luma_elim_threshold  = avctx->luma_elim_threshold;
-    s->chroma_elim_threshold= avctx->chroma_elim_threshold;
-    s->strict_std_compliance= avctx->strict_std_compliance;
-    s->data_partitioning= avctx->flags & CODEC_FLAG_PART;
-    s->quarter_sample= (avctx->flags & CODEC_FLAG_QPEL)!=0;
-    s->mpeg_quant= avctx->mpeg_quant;
-    s->rtp_mode= !!avctx->rtp_payload_size;
-    s->intra_dc_precision= avctx->intra_dc_precision;
-    s->user_specified_pts = AV_NOPTS_VALUE;
-
-    if (s->gop_size <= 1) {
-        s->intra_only = 1;
-        s->gop_size = 12;
-    } else {
-        s->intra_only = 0;
-    }
-
-    s->me_method = avctx->me_method;
-
-    /* Fixed QSCALE */
-    s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE);
-
-    s->adaptive_quant= (   s->avctx->lumi_masking
-                        || s->avctx->dark_masking
-                        || s->avctx->temporal_cplx_masking
-                        || s->avctx->spatial_cplx_masking
-                        || s->avctx->p_masking
-                        || s->avctx->border_masking
-                        || (s->flags&CODEC_FLAG_QP_RD))
-                       && !s->fixed_qscale;
-
-    s->obmc= !!(s->flags & CODEC_FLAG_OBMC);
-    s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER);
-    s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN);
-    s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC);
-
-    if(avctx->rc_max_rate && !avctx->rc_buffer_size){
-        av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n");
-        return -1;
-    }
-
-    if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){
-        av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isn't recommended!\n");
-    }
-
-    if(avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate){
-        av_log(avctx, AV_LOG_INFO, "bitrate below min bitrate\n");
-        return -1;
-    }
-
-    if(avctx->rc_max_rate && avctx->rc_max_rate < avctx->bit_rate){
-        av_log(avctx, AV_LOG_INFO, "bitrate above max bitrate\n");
-        return -1;
-    }
-
-    if(   s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate
-       && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO)
-       && 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){
-
-        av_log(avctx, AV_LOG_INFO, "Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!\n");
-    }
-
-    if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4
-       && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){
-        av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n");
-        return -1;
-    }
-
-    if(s->obmc && s->avctx->mb_decision != FF_MB_DECISION_SIMPLE){
-        av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with simple mb decision\n");
-        return -1;
-    }
-
-    if(s->obmc && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P){
-        av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with H263(+)\n");
-        return -1;
-    }
-
-    if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){
-        av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n");
-        return -1;
-    }
-
-    if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){
-        av_log(avctx, AV_LOG_ERROR, "data partitioning not supported by codec\n");
-        return -1;
-    }
-
-    if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){
-        av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n");
-        return -1;
-    }
-
-    if((s->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN))
-       && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO){
-        av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n");
-        return -1;
-    }
-
-    if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ //FIXME mpeg2 uses that too
-        av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supported by codec\n");
-        return -1;
-    }
-
-    if((s->flags & CODEC_FLAG_CBP_RD) && !(s->flags & CODEC_FLAG_TRELLIS_QUANT)){
-        av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n");
-        return -1;
-    }
-
-    if((s->flags & CODEC_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD){
-        av_log(avctx, AV_LOG_ERROR, "QP RD needs mbd=2\n");
-        return -1;
-    }
-
-    if(s->avctx->scenechange_threshold < 1000000000 && (s->flags & CODEC_FLAG_CLOSED_GOP)){
-        av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection arent supported yet\n");
-        return -1;
-    }
-
-    if((s->flags2 & CODEC_FLAG2_INTRA_VLC) && s->codec_id != CODEC_ID_MPEG2VIDEO){
-        av_log(avctx, AV_LOG_ERROR, "intra vlc table not supported by codec\n");
-        return -1;
-    }
-
-    if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4
-       && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO
-       && (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){
-        av_log(avctx, AV_LOG_ERROR, "multi threaded encoding not supported by codec\n");
-        return -1;
-    }
-
-    if(s->avctx->thread_count > 1)
-        s->rtp_mode= 1;
-
-    if(!avctx->time_base.den || !avctx->time_base.num){
-        av_log(avctx, AV_LOG_ERROR, "framerate not set\n");
-        return -1;
-    }
-
-    i= (INT_MAX/2+128)>>8;
-    if(avctx->me_threshold >= i){
-        av_log(avctx, AV_LOG_ERROR, "me_threshold too large, max is %d\n", i - 1);
-        return -1;
-    }
-    if(avctx->mb_threshold >= i){
-        av_log(avctx, AV_LOG_ERROR, "mb_threshold too large, max is %d\n", i - 1);
-        return -1;
-    }
-
-    if(avctx->b_frame_strategy && (avctx->flags&CODEC_FLAG_PASS2)){
-        av_log(avctx, AV_LOG_INFO, "notice: b_frame_strategy only affects the first pass\n");
-        avctx->b_frame_strategy = 0;
-    }
-
-    i= ff_gcd(avctx->time_base.den, avctx->time_base.num);
-    if(i > 1){
-        av_log(avctx, AV_LOG_INFO, "removing common factors from framerate\n");
-        avctx->time_base.den /= i;
-        avctx->time_base.num /= i;
-//        return -1;
-    }
-
-    if(s->codec_id==CODEC_ID_MJPEG){
-        s->intra_quant_bias= 1<<(QUANT_BIAS_SHIFT-1); //(a + x/2)/x
-        s->inter_quant_bias= 0;
-    }else if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO){
-        s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); //(a + x*3/8)/x
-        s->inter_quant_bias= 0;
-    }else{
-        s->intra_quant_bias=0;
-        s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); //(a - x/4)/x
-    }
-
-    if(avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS)
-        s->intra_quant_bias= avctx->intra_quant_bias;
-    if(avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS)
-        s->inter_quant_bias= avctx->inter_quant_bias;
-
-    avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift);
-
-    if(avctx->codec_id == CODEC_ID_MPEG4 && s->avctx->time_base.den > (1<<16)-1){
-        av_log(avctx, AV_LOG_ERROR, "timebase not supported by mpeg 4 standard\n");
-        return -1;
-    }
-    s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1;
-
-    switch(avctx->codec->id) {
-    case CODEC_ID_MPEG1VIDEO:
-        s->out_format = FMT_MPEG1;
-        s->low_delay= 0; //s->max_b_frames ? 0 : 1;
-        avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);
-        break;
-    case CODEC_ID_MPEG2VIDEO:
-        s->out_format = FMT_MPEG1;
-        s->low_delay= 0; //s->max_b_frames ? 0 : 1;
-        avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);
-        s->rtp_mode= 1;
-        break;
-    case CODEC_ID_LJPEG:
-    case CODEC_ID_JPEGLS:
-    case CODEC_ID_MJPEG:
-        s->out_format = FMT_MJPEG;
-        s->intra_only = 1; /* force intra only for jpeg */
-        s->mjpeg_write_tables = avctx->codec->id != CODEC_ID_JPEGLS;
-        s->mjpeg_data_only_frames = 0; /* write all the needed headers */
-        s->mjpeg_vsample[0] = 2;
-        s->mjpeg_vsample[1] = 2>>chroma_v_shift;
-        s->mjpeg_vsample[2] = 2>>chroma_v_shift;
-        s->mjpeg_hsample[0] = 2;
-        s->mjpeg_hsample[1] = 2>>chroma_h_shift;
-        s->mjpeg_hsample[2] = 2>>chroma_h_shift;
-        if (mjpeg_init(s) < 0)
-            return -1;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_H261:
-        s->out_format = FMT_H261;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_H263:
-        if (h263_get_picture_format(s->width, s->height) == 7) {
-            av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height);
-            return -1;
-        }
-        s->out_format = FMT_H263;
-        s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_H263P:
-        s->out_format = FMT_H263;
-        s->h263_plus = 1;
-        /* Fx */
-        s->umvplus = (avctx->flags & CODEC_FLAG_H263P_UMV) ? 1:0;
-        s->h263_aic= (avctx->flags & CODEC_FLAG_H263P_AIC) ? 1:0;
-        s->modified_quant= s->h263_aic;
-        s->alt_inter_vlc= (avctx->flags & CODEC_FLAG_H263P_AIV) ? 1:0;
-        s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0;
-        s->loop_filter= (avctx->flags & CODEC_FLAG_LOOP_FILTER) ? 1:0;
-        s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus;
-        s->h263_slice_structured= (s->flags & CODEC_FLAG_H263P_SLICE_STRUCT) ? 1:0;
-
-        /* /Fx */
-        /* These are just to be sure */
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_FLV1:
-        s->out_format = FMT_H263;
-        s->h263_flv = 2; /* format = 1; 11-bit codes */
-        s->unrestricted_mv = 1;
-        s->rtp_mode=0; /* don't allow GOB */
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_RV10:
-        s->out_format = FMT_H263;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_RV20:
-        s->out_format = FMT_H263;
-        avctx->delay=0;
-        s->low_delay=1;
-        s->modified_quant=1;
-        s->h263_aic=1;
-        s->h263_plus=1;
-        s->loop_filter=1;
-        s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus;
-        break;
-    case CODEC_ID_MPEG4:
-        s->out_format = FMT_H263;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->low_delay= s->max_b_frames ? 0 : 1;
-        avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);
-        break;
-    case CODEC_ID_MSMPEG4V1:
-        s->out_format = FMT_H263;
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->msmpeg4_version= 1;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_MSMPEG4V2:
-        s->out_format = FMT_H263;
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->msmpeg4_version= 2;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_MSMPEG4V3:
-        s->out_format = FMT_H263;
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->msmpeg4_version= 3;
-        s->flipflop_rounding=1;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_WMV1:
-        s->out_format = FMT_H263;
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->msmpeg4_version= 4;
-        s->flipflop_rounding=1;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    case CODEC_ID_WMV2:
-        s->out_format = FMT_H263;
-        s->h263_msmpeg4 = 1;
-        s->h263_pred = 1;
-        s->unrestricted_mv = 1;
-        s->msmpeg4_version= 5;
-        s->flipflop_rounding=1;
-        avctx->delay=0;
-        s->low_delay=1;
-        break;
-    default:
-        return -1;
-    }
-
-    avctx->has_b_frames= !s->low_delay;
-
-    s->encoding = 1;
-
-    /* init */
-    if (MPV_common_init(s) < 0)
-        return -1;
-
-    if(s->modified_quant)
-        s->chroma_qscale_table= ff_h263_chroma_qscale_table;
-    s->progressive_frame=
-    s->progressive_sequence= !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME));
-    s->quant_precision=5;
-
-    ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp);
-    ff_set_cmp(&s->dsp, s->dsp.frame_skip_cmp, s->avctx->frame_skip_cmp);
-
-#ifdef CONFIG_H261_ENCODER
-    if (s->out_format == FMT_H261)
-        ff_h261_encode_init(s);
-#endif
-    if (s->out_format == FMT_H263)
-        h263_encode_init(s);
-    if(s->msmpeg4_version)
-        ff_msmpeg4_encode_init(s);
-    if (s->out_format == FMT_MPEG1)
-        ff_mpeg1_encode_init(s);
-
-    /* init q matrix */
-    for(i=0;i<64;i++) {
-        int j= s->dsp.idct_permutation[i];
-        if(s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){
-            s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i];
-            s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i];
-        }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){
-            s->intra_matrix[j] =
-            s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i];
-        }else
-        { /* mpeg1/2 */
-            s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i];
-            s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i];
-        }
-        if(s->avctx->intra_matrix)
-            s->intra_matrix[j] = s->avctx->intra_matrix[i];
-        if(s->avctx->inter_matrix)
-            s->inter_matrix[j] = s->avctx->inter_matrix[i];
-    }
-
-    /* precompute matrix */
-    /* for mjpeg, we do include qscale in the matrix */
-    if (s->out_format != FMT_MJPEG) {
-        convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16,
-                       s->intra_matrix, s->intra_quant_bias, avctx->qmin, 31, 1);
-        convert_matrix(&s->dsp, s->q_inter_matrix, s->q_inter_matrix16,
-                       s->inter_matrix, s->inter_quant_bias, avctx->qmin, 31, 0);
-    }
-
-    if(ff_rate_control_init(s) < 0)
-        return -1;
-
-    return 0;
-}
-
-int MPV_encode_end(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-
-    ff_rate_control_uninit(s);
-
-    MPV_common_end(s);
-    if (s->out_format == FMT_MJPEG)
-        mjpeg_close(s);
-
-    av_freep(&avctx->extradata);
-
-    return 0;
-}
-
-#endif //CONFIG_ENCODERS
-
-void init_rl(RLTable *rl, int use_static)
-{
-    int8_t max_level[MAX_RUN+1], max_run[MAX_LEVEL+1];
-    uint8_t index_run[MAX_RUN+1];
-    int last, run, level, start, end, i;
-
-    /* If table is static, we can quit if rl->max_level[0] is not NULL */
-    if(use_static && rl->max_level[0])
-        return;
-
-    /* compute max_level[], max_run[] and index_run[] */
-    for(last=0;last<2;last++) {
-        if (last == 0) {
-            start = 0;
-            end = rl->last;
-        } else {
-            start = rl->last;
-            end = rl->n;
-        }
-
-        memset(max_level, 0, MAX_RUN + 1);
-        memset(max_run, 0, MAX_LEVEL + 1);
-        memset(index_run, rl->n, MAX_RUN + 1);
-        for(i=start;i<end;i++) {
-            run = rl->table_run[i];
-            level = rl->table_level[i];
-            if (index_run[run] == rl->n)
-                index_run[run] = i;
-            if (level > max_level[run])
-                max_level[run] = level;
-            if (run > max_run[level])
-                max_run[level] = run;
-        }
-        if(use_static)
-            rl->max_level[last] = av_mallocz_static(MAX_RUN + 1);
-        else
-            rl->max_level[last] = av_malloc(MAX_RUN + 1);
-        memcpy(rl->max_level[last], max_level, MAX_RUN + 1);
-        if(use_static)
-            rl->max_run[last] = av_mallocz_static(MAX_LEVEL + 1);
-        else
-            rl->max_run[last] = av_malloc(MAX_LEVEL + 1);
-        memcpy(rl->max_run[last], max_run, MAX_LEVEL + 1);
-        if(use_static)
-            rl->index_run[last] = av_mallocz_static(MAX_RUN + 1);
-        else
-            rl->index_run[last] = av_malloc(MAX_RUN + 1);
-        memcpy(rl->index_run[last], index_run, MAX_RUN + 1);
-    }
-}
-
-/* draw the edges of width 'w' of an image of size width, height */
-//FIXME check that this is ok for mpeg4 interlaced
-static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)
-{
-    uint8_t *ptr, *last_line;
-    int i;
-
-    last_line = buf + (height - 1) * wrap;
-    for(i=0;i<w;i++) {
-        /* top and bottom */
-        memcpy(buf - (i + 1) * wrap, buf, width);
-        memcpy(last_line + (i + 1) * wrap, last_line, width);
-    }
-    /* left and right */
-    ptr = buf;
-    for(i=0;i<height;i++) {
-        memset(ptr - w, ptr[0], w);
-        memset(ptr + width, ptr[width-1], w);
-        ptr += wrap;
-    }
-    /* corners */
-    for(i=0;i<w;i++) {
-        memset(buf - (i + 1) * wrap - w, buf[0], w); /* top left */
-        memset(buf - (i + 1) * wrap + width, buf[width-1], w); /* top right */
-        memset(last_line + (i + 1) * wrap - w, last_line[0], w); /* top left */
-        memset(last_line + (i + 1) * wrap + width, last_line[width-1], w); /* top right */
-    }
-}
-
-int ff_find_unused_picture(MpegEncContext *s, int shared){
-    int i;
-
-    if(shared){
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            if(s->picture[i].data[0]==NULL && s->picture[i].type==0) return i;
-        }
-    }else{
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            if(s->picture[i].data[0]==NULL && s->picture[i].type!=0) return i; //FIXME
-        }
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            if(s->picture[i].data[0]==NULL) return i;
-        }
-    }
-
-    assert(0);
-    return -1;
-}
-
-static void update_noise_reduction(MpegEncContext *s){
-    int intra, i;
-
-    for(intra=0; intra<2; intra++){
-        if(s->dct_count[intra] > (1<<16)){
-            for(i=0; i<64; i++){
-                s->dct_error_sum[intra][i] >>=1;
-            }
-            s->dct_count[intra] >>= 1;
-        }
-
-        for(i=0; i<64; i++){
-            s->dct_offset[intra][i]= (s->avctx->noise_reduction * s->dct_count[intra] + s->dct_error_sum[intra][i]/2) / (s->dct_error_sum[intra][i]+1);
-        }
-    }
-}
-
-/**
- * generic function for encode/decode called after coding/decoding the header and before a frame is coded/decoded
- */
-int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
-{
-    int i;
-    AVFrame *pic;
-    s->mb_skipped = 0;
-
-    assert(s->last_picture_ptr==NULL || s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3);
-
-    /* mark&release old frames */
-    if (s->pict_type != B_TYPE && s->last_picture_ptr && s->last_picture_ptr != s->next_picture_ptr && s->last_picture_ptr->data[0]) {
-        avctx->release_buffer(avctx, (AVFrame*)s->last_picture_ptr);
-
-        /* release forgotten pictures */
-        /* if(mpeg124/h263) */
-        if(!s->encoding){
-            for(i=0; i<MAX_PICTURE_COUNT; i++){
-                if(s->picture[i].data[0] && &s->picture[i] != s->next_picture_ptr && s->picture[i].reference){
-                    av_log(avctx, AV_LOG_ERROR, "releasing zombie picture\n");
-                    avctx->release_buffer(avctx, (AVFrame*)&s->picture[i]);
-                }
-            }
-        }
-    }
-alloc:
-    if(!s->encoding){
-        /* release non reference frames */
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
-                s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[i]);
-            }
-        }
-
-        if(s->current_picture_ptr && s->current_picture_ptr->data[0]==NULL)
-            pic= (AVFrame*)s->current_picture_ptr; //we allready have a unused image (maybe it was set before reading the header)
-        else{
-            i= ff_find_unused_picture(s, 0);
-            pic= (AVFrame*)&s->picture[i];
-        }
-
-        pic->reference= (s->pict_type != B_TYPE || s->codec_id == CODEC_ID_H264)
-                        && !s->dropable ? 3 : 0;
-
-        pic->coded_picture_number= s->coded_picture_number++;
-
-        if( alloc_picture(s, (Picture*)pic, 0) < 0)
-            return -1;
-
-        s->current_picture_ptr= (Picture*)pic;
-        s->current_picture_ptr->top_field_first= s->top_field_first; //FIXME use only the vars from current_pic
-        s->current_picture_ptr->interlaced_frame= !s->progressive_frame && !s->progressive_sequence;
-    }
-
-    s->current_picture_ptr->pict_type= s->pict_type;
-//    if(s->flags && CODEC_FLAG_QSCALE)
-  //      s->current_picture_ptr->quality= s->new_picture_ptr->quality;
-    s->current_picture_ptr->key_frame= s->pict_type == I_TYPE;
-
-    copy_picture(&s->current_picture, s->current_picture_ptr);
-
-  if(s->out_format != FMT_H264 || s->codec_id == CODEC_ID_SVQ3){
-    if (s->pict_type != B_TYPE) {
-        s->last_picture_ptr= s->next_picture_ptr;
-        if(!s->dropable)
-            s->next_picture_ptr= s->current_picture_ptr;
-    }
-/*    av_log(s->avctx, AV_LOG_DEBUG, "L%p N%p C%p L%p N%p C%p type:%d drop:%d\n", s->last_picture_ptr, s->next_picture_ptr,s->current_picture_ptr,
-        s->last_picture_ptr    ? s->last_picture_ptr->data[0] : NULL,
-        s->next_picture_ptr    ? s->next_picture_ptr->data[0] : NULL,
-        s->current_picture_ptr ? s->current_picture_ptr->data[0] : NULL,
-        s->pict_type, s->dropable);*/
-
-    if(s->last_picture_ptr) copy_picture(&s->last_picture, s->last_picture_ptr);
-    if(s->next_picture_ptr) copy_picture(&s->next_picture, s->next_picture_ptr);
-
-    if(s->pict_type != I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL)){
-        av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
-        assert(s->pict_type != B_TYPE); //these should have been dropped if we don't have a reference
-        goto alloc;
-    }
-
-    assert(s->pict_type == I_TYPE || (s->last_picture_ptr && s->last_picture_ptr->data[0]));
-
-    if(s->picture_structure!=PICT_FRAME){
-        int i;
-        for(i=0; i<4; i++){
-            if(s->picture_structure == PICT_BOTTOM_FIELD){
-                 s->current_picture.data[i] += s->current_picture.linesize[i];
-            }
-            s->current_picture.linesize[i] *= 2;
-            s->last_picture.linesize[i] *=2;
-            s->next_picture.linesize[i] *=2;
-        }
-    }
-  }
-
-    s->hurry_up= s->avctx->hurry_up;
-    s->error_resilience= avctx->error_resilience;
-
-    /* set dequantizer, we can't do it during init as it might change for mpeg4
-       and we can't do it in the header decode as init isnt called for mpeg4 there yet */
-    if(s->mpeg_quant || s->codec_id == CODEC_ID_MPEG2VIDEO){
-        s->dct_unquantize_intra = s->dct_unquantize_mpeg2_intra;
-        s->dct_unquantize_inter = s->dct_unquantize_mpeg2_inter;
-    }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){
-        s->dct_unquantize_intra = s->dct_unquantize_h263_intra;
-        s->dct_unquantize_inter = s->dct_unquantize_h263_inter;
-    }else{
-        s->dct_unquantize_intra = s->dct_unquantize_mpeg1_intra;
-        s->dct_unquantize_inter = s->dct_unquantize_mpeg1_inter;
-    }
-
-    if(s->dct_error_sum){
-        assert(s->avctx->noise_reduction && s->encoding);
-
-        update_noise_reduction(s);
-    }
-
-#ifdef HAVE_XVMC
-    if(s->avctx->xvmc_acceleration)
-        return XVMC_field_start(s, avctx);
-#endif
-    return 0;
-}
-
-/* generic function for encode/decode called after a frame has been coded/decoded */
-void MPV_frame_end(MpegEncContext *s)
-{
-    int i;
-    /* draw edge for correct motion prediction if outside */
-#ifdef HAVE_XVMC
-//just to make sure that all data is rendered.
-    if(s->avctx->xvmc_acceleration){
-        XVMC_field_end(s);
-    }else
-#endif
-    if(s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) {
-            draw_edges(s->current_picture.data[0], s->linesize  , s->h_edge_pos   , s->v_edge_pos   , EDGE_WIDTH  );
-            draw_edges(s->current_picture.data[1], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2);
-            draw_edges(s->current_picture.data[2], s->uvlinesize, s->h_edge_pos>>1, s->v_edge_pos>>1, EDGE_WIDTH/2);
-    }
-    emms_c();
-
-    s->last_pict_type    = s->pict_type;
-    s->last_lambda_for[s->pict_type]= s->current_picture_ptr->quality;
-    if(s->pict_type!=B_TYPE){
-        s->last_non_b_pict_type= s->pict_type;
-    }
-#if 0
-        /* copy back current_picture variables */
-    for(i=0; i<MAX_PICTURE_COUNT; i++){
-        if(s->picture[i].data[0] == s->current_picture.data[0]){
-            s->picture[i]= s->current_picture;
-            break;
-        }
-    }
-    assert(i<MAX_PICTURE_COUNT);
-#endif
-
-    if(s->encoding){
-        /* release non-reference frames */
-        for(i=0; i<MAX_PICTURE_COUNT; i++){
-            if(s->picture[i].data[0] && !s->picture[i].reference /*&& s->picture[i].type!=FF_BUFFER_TYPE_SHARED*/){
-                s->avctx->release_buffer(s->avctx, (AVFrame*)&s->picture[i]);
-            }
-        }
-    }
-    // clear copies, to avoid confusion
-#if 0
-    memset(&s->last_picture, 0, sizeof(Picture));
-    memset(&s->next_picture, 0, sizeof(Picture));
-    memset(&s->current_picture, 0, sizeof(Picture));
-#endif
-    s->avctx->coded_frame= (AVFrame*)s->current_picture_ptr;
-}
-
-/**
- * draws an line from (ex, ey) -> (sx, sy).
- * @param w width of the image
- * @param h height of the image
- * @param stride stride/linesize of the image
- * @param color color of the arrow
- */
-static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){
-    int x, y, fr, f;
-
-    sx= clip(sx, 0, w-1);
-    sy= clip(sy, 0, h-1);
-    ex= clip(ex, 0, w-1);
-    ey= clip(ey, 0, h-1);
-
-    buf[sy*stride + sx]+= color;
-
-    if(FFABS(ex - sx) > FFABS(ey - sy)){
-        if(sx > ex){
-            SWAP(int, sx, ex);
-            SWAP(int, sy, ey);
-        }
-        buf+= sx + sy*stride;
-        ex-= sx;
-        f= ((ey-sy)<<16)/ex;
-        for(x= 0; x <= ex; x++){
-            y = (x*f)>>16;
-            fr= (x*f)&0xFFFF;
-            buf[ y   *stride + x]+= (color*(0x10000-fr))>>16;
-            buf[(y+1)*stride + x]+= (color*         fr )>>16;
-        }
-    }else{
-        if(sy > ey){
-            SWAP(int, sx, ex);
-            SWAP(int, sy, ey);
-        }
-        buf+= sx + sy*stride;
-        ey-= sy;
-        if(ey) f= ((ex-sx)<<16)/ey;
-        else   f= 0;
-        for(y= 0; y <= ey; y++){
-            x = (y*f)>>16;
-            fr= (y*f)&0xFFFF;
-            buf[y*stride + x  ]+= (color*(0x10000-fr))>>16;;
-            buf[y*stride + x+1]+= (color*         fr )>>16;;
-        }
-    }
-}
-
-/**
- * draws an arrow from (ex, ey) -> (sx, sy).
- * @param w width of the image
- * @param h height of the image
- * @param stride stride/linesize of the image
- * @param color color of the arrow
- */
-static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int ey, int w, int h, int stride, int color){
-    int dx,dy;
-
-    sx= clip(sx, -100, w+100);
-    sy= clip(sy, -100, h+100);
-    ex= clip(ex, -100, w+100);
-    ey= clip(ey, -100, h+100);
-
-    dx= ex - sx;
-    dy= ey - sy;
-
-    if(dx*dx + dy*dy > 3*3){
-        int rx=  dx + dy;
-        int ry= -dx + dy;
-        int length= ff_sqrt((rx*rx + ry*ry)<<8);
-
-        //FIXME subpixel accuracy
-        rx= ROUNDED_DIV(rx*3<<4, length);
-        ry= ROUNDED_DIV(ry*3<<4, length);
-
-        draw_line(buf, sx, sy, sx + rx, sy + ry, w, h, stride, color);
-        draw_line(buf, sx, sy, sx - ry, sy + rx, w, h, stride, color);
-    }
-    draw_line(buf, sx, sy, ex, ey, w, h, stride, color);
-}
-
-/**
- * prints debuging info for the given picture.
- */
-void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){
-
-    if(!pict || !pict->mb_type) return;
-
-    if(s->avctx->debug&(FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE)){
-        int x,y;
-
-        av_log(s->avctx,AV_LOG_DEBUG,"New frame, type: ");
-        switch (pict->pict_type) {
-            case FF_I_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"I\n"); break;
-            case FF_P_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"P\n"); break;
-            case FF_B_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"B\n"); break;
-            case FF_S_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"S\n"); break;
-            case FF_SI_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"SI\n"); break;
-            case FF_SP_TYPE: av_log(s->avctx,AV_LOG_DEBUG,"SP\n"); break;
-        }
-        for(y=0; y<s->mb_height; y++){
-            for(x=0; x<s->mb_width; x++){
-                if(s->avctx->debug&FF_DEBUG_SKIP){
-                    int count= s->mbskip_table[x + y*s->mb_stride];
-                    if(count>9) count=9;
-                    av_log(s->avctx, AV_LOG_DEBUG, "%1d", count);
-                }
-                if(s->avctx->debug&FF_DEBUG_QP){
-                    av_log(s->avctx, AV_LOG_DEBUG, "%2d", pict->qscale_table[x + y*s->mb_stride]);
-                }
-                if(s->avctx->debug&FF_DEBUG_MB_TYPE){
-                    int mb_type= pict->mb_type[x + y*s->mb_stride];
-                    //Type & MV direction
-                    if(IS_PCM(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "P");
-                    else if(IS_INTRA(mb_type) && IS_ACPRED(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "A");
-                    else if(IS_INTRA4x4(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "i");
-                    else if(IS_INTRA16x16(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "I");
-                    else if(IS_DIRECT(mb_type) && IS_SKIP(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "d");
-                    else if(IS_DIRECT(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "D");
-                    else if(IS_GMC(mb_type) && IS_SKIP(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "g");
-                    else if(IS_GMC(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "G");
-                    else if(IS_SKIP(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "S");
-                    else if(!USES_LIST(mb_type, 1))
-                        av_log(s->avctx, AV_LOG_DEBUG, ">");
-                    else if(!USES_LIST(mb_type, 0))
-                        av_log(s->avctx, AV_LOG_DEBUG, "<");
-                    else{
-                        assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
-                        av_log(s->avctx, AV_LOG_DEBUG, "X");
-                    }
-
-                    //segmentation
-                    if(IS_8X8(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "+");
-                    else if(IS_16X8(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "-");
-                    else if(IS_8X16(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, "|");
-                    else if(IS_INTRA(mb_type) || IS_16X16(mb_type))
-                        av_log(s->avctx, AV_LOG_DEBUG, " ");
-                    else
-                        av_log(s->avctx, AV_LOG_DEBUG, "?");
-
-
-                    if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264)
-                        av_log(s->avctx, AV_LOG_DEBUG, "=");
-                    else
-                        av_log(s->avctx, AV_LOG_DEBUG, " ");
-                }
-//                av_log(s->avctx, AV_LOG_DEBUG, " ");
-            }
-            av_log(s->avctx, AV_LOG_DEBUG, "\n");
-        }
-    }
-
-    if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){
-        const int shift= 1 + s->quarter_sample;
-        int mb_y;
-        uint8_t *ptr;
-        int i;
-        int h_chroma_shift, v_chroma_shift;
-        const int width = s->avctx->width;
-        const int height= s->avctx->height;
-        const int mv_sample_log2= 4 - pict->motion_subsample_log2;
-        const int mv_stride= (s->mb_width << mv_sample_log2) + (s->codec_id == CODEC_ID_H264 ? 0 : 1);
-        s->low_delay=0; //needed to see the vectors without trashing the buffers
-
-        avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
-        for(i=0; i<3; i++){
-            memcpy(s->visualization_buffer[i], pict->data[i], (i==0) ? pict->linesize[i]*height:pict->linesize[i]*height >> v_chroma_shift);
-            pict->data[i]= s->visualization_buffer[i];
-        }
-        pict->type= FF_BUFFER_TYPE_COPY;
-        ptr= pict->data[0];
-
-        for(mb_y=0; mb_y<s->mb_height; mb_y++){
-            int mb_x;
-            for(mb_x=0; mb_x<s->mb_width; mb_x++){
-                const int mb_index= mb_x + mb_y*s->mb_stride;
-                if((s->avctx->debug_mv) && pict->motion_val){
-                  int type;
-                  for(type=0; type<3; type++){
-                    int direction = 0;
-                    switch (type) {
-                      case 0: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_P_FOR)) || (pict->pict_type!=FF_P_TYPE))
-                                continue;
-                              direction = 0;
-                              break;
-                      case 1: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_B_FOR)) || (pict->pict_type!=FF_B_TYPE))
-                                continue;
-                              direction = 0;
-                              break;
-                      case 2: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_B_BACK)) || (pict->pict_type!=FF_B_TYPE))
-                                continue;
-                              direction = 1;
-                              break;
-                    }
-                    if(!USES_LIST(pict->mb_type[mb_index], direction))
-                        continue;
-
-                    if(IS_8X8(pict->mb_type[mb_index])){
-                      int i;
-                      for(i=0; i<4; i++){
-                        int sx= mb_x*16 + 4 + 8*(i&1);
-                        int sy= mb_y*16 + 4 + 8*(i>>1);
-                        int xy= (mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*mv_stride) << (mv_sample_log2-1);
-                        int mx= (pict->motion_val[direction][xy][0]>>shift) + sx;
-                        int my= (pict->motion_val[direction][xy][1]>>shift) + sy;
-                        draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100);
-                      }
-                    }else if(IS_16X8(pict->mb_type[mb_index])){
-                      int i;
-                      for(i=0; i<2; i++){
-                        int sx=mb_x*16 + 8;
-                        int sy=mb_y*16 + 4 + 8*i;
-                        int xy= (mb_x*2 + (mb_y*2 + i)*mv_stride) << (mv_sample_log2-1);
-                        int mx=(pict->motion_val[direction][xy][0]>>shift);
-                        int my=(pict->motion_val[direction][xy][1]>>shift);
-
-                        if(IS_INTERLACED(pict->mb_type[mb_index]))
-                            my*=2;
-
-                        draw_arrow(ptr, sx, sy, mx+sx, my+sy, width, height, s->linesize, 100);
-                      }
-                    }else if(IS_8X16(pict->mb_type[mb_index])){
-                      int i;
-                      for(i=0; i<2; i++){
-                        int sx=mb_x*16 + 4 + 8*i;
-                        int sy=mb_y*16 + 8;
-                        int xy= (mb_x*2 + i + mb_y*2*mv_stride) << (mv_sample_log2-1);
-                        int mx=(pict->motion_val[direction][xy][0]>>shift);
-                        int my=(pict->motion_val[direction][xy][1]>>shift);
-
-                        if(IS_INTERLACED(pict->mb_type[mb_index]))
-                            my*=2;
-
-                        draw_arrow(ptr, sx, sy, mx+sx, my+sy, width, height, s->linesize, 100);
-                      }
-                    }else{
-                      int sx= mb_x*16 + 8;
-                      int sy= mb_y*16 + 8;
-                      int xy= (mb_x + mb_y*mv_stride) << mv_sample_log2;
-                      int mx= (pict->motion_val[direction][xy][0]>>shift) + sx;
-                      int my= (pict->motion_val[direction][xy][1]>>shift) + sy;
-                      draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100);
-                    }
-                  }
-                }
-                if((s->avctx->debug&FF_DEBUG_VIS_QP) && pict->motion_val){
-                    uint64_t c= (pict->qscale_table[mb_index]*128/31) * 0x0101010101010101ULL;
-                    int y;
-                    for(y=0; y<8; y++){
-                        *(uint64_t*)(pict->data[1] + 8*mb_x + (8*mb_y + y)*pict->linesize[1])= c;
-                        *(uint64_t*)(pict->data[2] + 8*mb_x + (8*mb_y + y)*pict->linesize[2])= c;
-                    }
-                }
-                if((s->avctx->debug&FF_DEBUG_VIS_MB_TYPE) && pict->motion_val){
-                    int mb_type= pict->mb_type[mb_index];
-                    uint64_t u,v;
-                    int y;
-#define COLOR(theta, r)\
-u= (int)(128 + r*cos(theta*3.141592/180));\
-v= (int)(128 + r*sin(theta*3.141592/180));
-
-
-                    u=v=128;
-                    if(IS_PCM(mb_type)){
-                        COLOR(120,48)
-                    }else if((IS_INTRA(mb_type) && IS_ACPRED(mb_type)) || IS_INTRA16x16(mb_type)){
-                        COLOR(30,48)
-                    }else if(IS_INTRA4x4(mb_type)){
-                        COLOR(90,48)
-                    }else if(IS_DIRECT(mb_type) && IS_SKIP(mb_type)){
-//                        COLOR(120,48)
-                    }else if(IS_DIRECT(mb_type)){
-                        COLOR(150,48)
-                    }else if(IS_GMC(mb_type) && IS_SKIP(mb_type)){
-                        COLOR(170,48)
-                    }else if(IS_GMC(mb_type)){
-                        COLOR(190,48)
-                    }else if(IS_SKIP(mb_type)){
-//                        COLOR(180,48)
-                    }else if(!USES_LIST(mb_type, 1)){
-                        COLOR(240,48)
-                    }else if(!USES_LIST(mb_type, 0)){
-                        COLOR(0,48)
-                    }else{
-                        assert(USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1));
-                        COLOR(300,48)
-                    }
-
-                    u*= 0x0101010101010101ULL;
-                    v*= 0x0101010101010101ULL;
-                    for(y=0; y<8; y++){
-                        *(uint64_t*)(pict->data[1] + 8*mb_x + (8*mb_y + y)*pict->linesize[1])= u;
-                        *(uint64_t*)(pict->data[2] + 8*mb_x + (8*mb_y + y)*pict->linesize[2])= v;
-                    }
-
-                    //segmentation
-                    if(IS_8X8(mb_type) || IS_16X8(mb_type)){
-                        *(uint64_t*)(pict->data[0] + 16*mb_x + 0 + (16*mb_y + 8)*pict->linesize[0])^= 0x8080808080808080ULL;
-                        *(uint64_t*)(pict->data[0] + 16*mb_x + 8 + (16*mb_y + 8)*pict->linesize[0])^= 0x8080808080808080ULL;
-                    }
-                    if(IS_8X8(mb_type) || IS_8X16(mb_type)){
-                        for(y=0; y<16; y++)
-                            pict->data[0][16*mb_x + 8 + (16*mb_y + y)*pict->linesize[0]]^= 0x80;
-                    }
-                    if(IS_8X8(mb_type) && mv_sample_log2 >= 2){
-                        int dm= 1 << (mv_sample_log2-2);
-                        for(i=0; i<4; i++){
-                            int sx= mb_x*16 + 8*(i&1);
-                            int sy= mb_y*16 + 8*(i>>1);
-                            int xy= (mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*mv_stride) << (mv_sample_log2-1);
-                            //FIXME bidir
-                            int32_t *mv = (int32_t*)&pict->motion_val[0][xy];
-                            if(mv[0] != mv[dm] || mv[dm*mv_stride] != mv[dm*(mv_stride+1)])
-                                for(y=0; y<8; y++)
-                                    pict->data[0][sx + 4 + (sy + y)*pict->linesize[0]]^= 0x80;
-                            if(mv[0] != mv[dm*mv_stride] || mv[dm] != mv[dm*(mv_stride+1)])
-                                *(uint64_t*)(pict->data[0] + sx + (sy + 4)*pict->linesize[0])^= 0x8080808080808080ULL;
-                        }
-                    }
-
-                    if(IS_INTERLACED(mb_type) && s->codec_id == CODEC_ID_H264){
-                        // hmm
-                    }
-                }
-                s->mbskip_table[mb_index]=0;
-            }
-        }
-    }
-}
-
-#ifdef CONFIG_ENCODERS
-
-static int get_sae(uint8_t *src, int ref, int stride){
-    int x,y;
-    int acc=0;
-
-    for(y=0; y<16; y++){
-        for(x=0; x<16; x++){
-            acc+= FFABS(src[x+y*stride] - ref);
-        }
-    }
-
-    return acc;
-}
-
-static int get_intra_count(MpegEncContext *s, uint8_t *src, uint8_t *ref, int stride){
-    int x, y, w, h;
-    int acc=0;
-
-    w= s->width &~15;
-    h= s->height&~15;
-
-    for(y=0; y<h; y+=16){
-        for(x=0; x<w; x+=16){
-            int offset= x + y*stride;
-            int sad = s->dsp.sad[0](NULL, src + offset, ref + offset, stride, 16);
-            int mean= (s->dsp.pix_sum(src + offset, stride) + 128)>>8;
-            int sae = get_sae(src + offset, mean, stride);
-
-            acc+= sae + 500 < sad;
-        }
-    }
-    return acc;
-}
-
-
-static int load_input_picture(MpegEncContext *s, AVFrame *pic_arg){
-    AVFrame *pic=NULL;
-    int64_t pts;
-    int i;
-    const int encoding_delay= s->max_b_frames;
-    int direct=1;
-
-    if(pic_arg){
-        pts= pic_arg->pts;
-        pic_arg->display_picture_number= s->input_picture_number++;
-
-        if(pts != AV_NOPTS_VALUE){
-            if(s->user_specified_pts != AV_NOPTS_VALUE){
-                int64_t time= pts;
-                int64_t last= s->user_specified_pts;
-
-                if(time <= last){
-                    av_log(s->avctx, AV_LOG_ERROR, "Error, Invalid timestamp=%"PRId64", last=%"PRId64"\n", pts, s->user_specified_pts);
-                    return -1;
-                }
-            }
-            s->user_specified_pts= pts;
-        }else{
-            if(s->user_specified_pts != AV_NOPTS_VALUE){
-                s->user_specified_pts=
-                pts= s->user_specified_pts + 1;
-                av_log(s->avctx, AV_LOG_INFO, "Warning: AVFrame.pts=? trying to guess (%"PRId64")\n", pts);
-            }else{
-                pts= pic_arg->display_picture_number;
-            }
-        }
-    }
-
-  if(pic_arg){
-    if(encoding_delay && !(s->flags&CODEC_FLAG_INPUT_PRESERVED)) direct=0;
-    if(pic_arg->linesize[0] != s->linesize) direct=0;
-    if(pic_arg->linesize[1] != s->uvlinesize) direct=0;
-    if(pic_arg->linesize[2] != s->uvlinesize) direct=0;
-
-//    av_log(AV_LOG_DEBUG, "%d %d %d %d\n",pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize);
-
-    if(direct){
-        i= ff_find_unused_picture(s, 1);
-
-        pic= (AVFrame*)&s->picture[i];
-        pic->reference= 3;
-
-        for(i=0; i<4; i++){
-            pic->data[i]= pic_arg->data[i];
-            pic->linesize[i]= pic_arg->linesize[i];
-        }
-        alloc_picture(s, (Picture*)pic, 1);
-    }else{
-        i= ff_find_unused_picture(s, 0);
-
-        pic= (AVFrame*)&s->picture[i];
-        pic->reference= 3;
-
-        alloc_picture(s, (Picture*)pic, 0);
-
-        if(   pic->data[0] + INPLACE_OFFSET == pic_arg->data[0]
-           && pic->data[1] + INPLACE_OFFSET == pic_arg->data[1]
-           && pic->data[2] + INPLACE_OFFSET == pic_arg->data[2]){
-       // empty
-        }else{
-            int h_chroma_shift, v_chroma_shift;
-            avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
-
-            for(i=0; i<3; i++){
-                int src_stride= pic_arg->linesize[i];
-                int dst_stride= i ? s->uvlinesize : s->linesize;
-                int h_shift= i ? h_chroma_shift : 0;
-                int v_shift= i ? v_chroma_shift : 0;
-                int w= s->width >>h_shift;
-                int h= s->height>>v_shift;
-                uint8_t *src= pic_arg->data[i];
-                uint8_t *dst= pic->data[i];
-
-                if(!s->avctx->rc_buffer_size)
-                    dst +=INPLACE_OFFSET;
-
-                if(src_stride==dst_stride)
-                    memcpy(dst, src, src_stride*h);
-                else{
-                    while(h--){
-                        memcpy(dst, src, w);
-                        dst += dst_stride;
-                        src += src_stride;
-                    }
-                }
-            }
-        }
-    }
-    copy_picture_attributes(s, pic, pic_arg);
-    pic->pts= pts; //we set this here to avoid modifiying pic_arg
-  }
-
-    /* shift buffer entries */
-    for(i=1; i<MAX_PICTURE_COUNT /*s->encoding_delay+1*/; i++)
-        s->input_picture[i-1]= s->input_picture[i];
-
-    s->input_picture[encoding_delay]= (Picture*)pic;
-
-    return 0;
-}
-
-static int skip_check(MpegEncContext *s, Picture *p, Picture *ref){
-    int x, y, plane;
-    int score=0;
-    int64_t score64=0;
-
-    for(plane=0; plane<3; plane++){
-        const int stride= p->linesize[plane];
-        const int bw= plane ? 1 : 2;
-        for(y=0; y<s->mb_height*bw; y++){
-            for(x=0; x<s->mb_width*bw; x++){
-                int off= p->type == FF_BUFFER_TYPE_SHARED ? 0: 16;
-                int v= s->dsp.frame_skip_cmp[1](s, p->data[plane] + 8*(x + y*stride)+off, ref->data[plane] + 8*(x + y*stride), stride, 8);
-
-                switch(s->avctx->frame_skip_exp){
-                    case 0: score= FFMAX(score, v); break;
-                    case 1: score+= FFABS(v);break;
-                    case 2: score+= v*v;break;
-                    case 3: score64+= FFABS(v*v*(int64_t)v);break;
-                    case 4: score64+= v*v*(int64_t)(v*v);break;
-                }
-            }
-        }
-    }
-
-    if(score) score64= score;
-
-    if(score64 < s->avctx->frame_skip_threshold)
-        return 1;
-    if(score64 < ((s->avctx->frame_skip_factor * (int64_t)s->lambda)>>8))
-        return 1;
-    return 0;
-}
-
-static int estimate_best_b_count(MpegEncContext *s){
-    AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
-    AVCodecContext *c= avcodec_alloc_context();
-    AVFrame input[FF_MAX_B_FRAMES+2];
-    const int scale= s->avctx->brd_scale;
-    int i, j, out_size, p_lambda, b_lambda, lambda2;
-    int outbuf_size= s->width * s->height; //FIXME
-    uint8_t *outbuf= av_malloc(outbuf_size);
-    int64_t best_rd= INT64_MAX;
-    int best_b_count= -1;
-
-    assert(scale>=0 && scale <=3);
-
-//    emms_c();
-    p_lambda= s->last_lambda_for[P_TYPE]; //s->next_picture_ptr->quality;
-    b_lambda= s->last_lambda_for[B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
-    if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else
-    lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
-
-    c->width = s->width >> scale;
-    c->height= s->height>> scale;
-    c->flags= CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED /*| CODEC_FLAG_EMU_EDGE*/;
-    c->flags|= s->avctx->flags & CODEC_FLAG_QPEL;
-    c->mb_decision= s->avctx->mb_decision;
-    c->me_cmp= s->avctx->me_cmp;
-    c->mb_cmp= s->avctx->mb_cmp;
-    c->me_sub_cmp= s->avctx->me_sub_cmp;
-    c->pix_fmt = PIX_FMT_YUV420P;
-    c->time_base= s->avctx->time_base;
-    c->max_b_frames= s->max_b_frames;
-
-    if (avcodec_open(c, codec) < 0)
-        return -1;
-
-    for(i=0; i<s->max_b_frames+2; i++){
-        int ysize= c->width*c->height;
-        int csize= (c->width/2)*(c->height/2);
-        Picture pre_input, *pre_input_ptr= i ? s->input_picture[i-1] : s->next_picture_ptr;
-
-        if(pre_input_ptr)
-            pre_input= *pre_input_ptr;
-
-        if(pre_input.type != FF_BUFFER_TYPE_SHARED && i){
-            pre_input.data[0]+=INPLACE_OFFSET;
-            pre_input.data[1]+=INPLACE_OFFSET;
-            pre_input.data[2]+=INPLACE_OFFSET;
-        }
-
-        avcodec_get_frame_defaults(&input[i]);
-        input[i].data[0]= av_malloc(ysize + 2*csize);
-        input[i].data[1]= input[i].data[0] + ysize;
-        input[i].data[2]= input[i].data[1] + csize;
-        input[i].linesize[0]= c->width;
-        input[i].linesize[1]=
-        input[i].linesize[2]= c->width/2;
-
-        if(!i || s->input_picture[i-1]){
-            s->dsp.shrink[scale](input[i].data[0], input[i].linesize[0], pre_input.data[0], pre_input.linesize[0], c->width, c->height);
-            s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.data[1], pre_input.linesize[1], c->width>>1, c->height>>1);
-            s->dsp.shrink[scale](input[i].data[2], input[i].linesize[2], pre_input.data[2], pre_input.linesize[2], c->width>>1, c->height>>1);
-        }
-    }
-
-    for(j=0; j<s->max_b_frames+1; j++){
-        int64_t rd=0;
-
-        if(!s->input_picture[j])
-            break;
-
-        c->error[0]= c->error[1]= c->error[2]= 0;
-
-        input[0].pict_type= I_TYPE;
-        input[0].quality= 1 * FF_QP2LAMBDA;
-        out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[0]);
-//        rd += (out_size * lambda2) >> FF_LAMBDA_SHIFT;
-
-        for(i=0; i<s->max_b_frames+1; i++){
-            int is_p= i % (j+1) == j || i==s->max_b_frames;
-
-            input[i+1].pict_type= is_p ? P_TYPE : B_TYPE;
-            input[i+1].quality= is_p ? p_lambda : b_lambda;
-            out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i+1]);
-            rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
-        }
-
-        /* get the delayed frames */
-        while(out_size){
-            out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
-            rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
-        }
-
-        rd += c->error[0] + c->error[1] + c->error[2];
-
-        if(rd < best_rd){
-            best_rd= rd;
-            best_b_count= j;
-        }
-    }
-
-    av_freep(&outbuf);
-    avcodec_close(c);
-    av_freep(&c);
-
-    for(i=0; i<s->max_b_frames+2; i++){
-        av_freep(&input[i].data[0]);
-    }
-
-    return best_b_count;
-}
-
-static void select_input_picture(MpegEncContext *s){
-    int i;
-
-    for(i=1; i<MAX_PICTURE_COUNT; i++)
-        s->reordered_input_picture[i-1]= s->reordered_input_picture[i];
-    s->reordered_input_picture[MAX_PICTURE_COUNT-1]= NULL;
-
-    /* set next picture type & ordering */
-    if(s->reordered_input_picture[0]==NULL && s->input_picture[0]){
-        if(/*s->picture_in_gop_number >= s->gop_size ||*/ s->next_picture_ptr==NULL || s->intra_only){
-            s->reordered_input_picture[0]= s->input_picture[0];
-            s->reordered_input_picture[0]->pict_type= I_TYPE;
-            s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++;
-        }else{
-            int b_frames;
-
-            if(s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor){
-                if(s->picture_in_gop_number < s->gop_size && skip_check(s, s->input_picture[0], s->next_picture_ptr)){
-                //FIXME check that te gop check above is +-1 correct
-//av_log(NULL, AV_LOG_DEBUG, "skip %p %Ld\n", s->input_picture[0]->data[0], s->input_picture[0]->pts);
-
-                    if(s->input_picture[0]->type == FF_BUFFER_TYPE_SHARED){
-                        for(i=0; i<4; i++)
-                            s->input_picture[0]->data[i]= NULL;
-                        s->input_picture[0]->type= 0;
-                    }else{
-                        assert(   s->input_picture[0]->type==FF_BUFFER_TYPE_USER
-                               || s->input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL);
-
-                        s->avctx->release_buffer(s->avctx, (AVFrame*)s->input_picture[0]);
-                    }
-
-                    emms_c();
-                    ff_vbv_update(s, 0);
-
-                    goto no_output_pic;
-                }
-            }
-
-            if(s->flags&CODEC_FLAG_PASS2){
-                for(i=0; i<s->max_b_frames+1; i++){
-                    int pict_num= s->input_picture[0]->display_picture_number + i;
-
-                    if(pict_num >= s->rc_context.num_entries)
-                        break;
-                    if(!s->input_picture[i]){
-                        s->rc_context.entry[pict_num-1].new_pict_type = P_TYPE;
-                        break;
-                    }
-
-                    s->input_picture[i]->pict_type=
-                        s->rc_context.entry[pict_num].new_pict_type;
-                }
-            }
-
-            if(s->avctx->b_frame_strategy==0){
-                b_frames= s->max_b_frames;
-                while(b_frames && !s->input_picture[b_frames]) b_frames--;
-            }else if(s->avctx->b_frame_strategy==1){
-                for(i=1; i<s->max_b_frames+1; i++){
-                    if(s->input_picture[i] && s->input_picture[i]->b_frame_score==0){
-                        s->input_picture[i]->b_frame_score=
-                            get_intra_count(s, s->input_picture[i  ]->data[0],
-                                               s->input_picture[i-1]->data[0], s->linesize) + 1;
-                    }
-                }
-                for(i=0; i<s->max_b_frames+1; i++){
-                    if(s->input_picture[i]==NULL || s->input_picture[i]->b_frame_score - 1 > s->mb_num/s->avctx->b_sensitivity) break;
-                }
-
-                b_frames= FFMAX(0, i-1);
-
-                /* reset scores */
-                for(i=0; i<b_frames+1; i++){
-                    s->input_picture[i]->b_frame_score=0;
-                }
-            }else if(s->avctx->b_frame_strategy==2){
-                b_frames= estimate_best_b_count(s);
-            }else{
-                av_log(s->avctx, AV_LOG_ERROR, "illegal b frame strategy\n");
-                b_frames=0;
-            }
-
-            emms_c();
-//static int b_count=0;
-//b_count+= b_frames;
-//av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count);
-
-            for(i= b_frames - 1; i>=0; i--){
-                int type= s->input_picture[i]->pict_type;
-                if(type && type != B_TYPE)
-                    b_frames= i;
-            }
-            if(s->input_picture[b_frames]->pict_type == B_TYPE && b_frames == s->max_b_frames){
-                av_log(s->avctx, AV_LOG_ERROR, "warning, too many b frames in a row\n");
-            }
-
-            if(s->picture_in_gop_number + b_frames >= s->gop_size){
-              if((s->flags2 & CODEC_FLAG2_STRICT_GOP) && s->gop_size > s->picture_in_gop_number){
-                    b_frames= s->gop_size - s->picture_in_gop_number - 1;
-              }else{
-                if(s->flags & CODEC_FLAG_CLOSED_GOP)
-                    b_frames=0;
-                s->input_picture[b_frames]->pict_type= I_TYPE;
-              }
-            }
-
-            if(   (s->flags & CODEC_FLAG_CLOSED_GOP)
-               && b_frames
-               && s->input_picture[b_frames]->pict_type== I_TYPE)
-                b_frames--;
-
-            s->reordered_input_picture[0]= s->input_picture[b_frames];
-            if(s->reordered_input_picture[0]->pict_type != I_TYPE)
-                s->reordered_input_picture[0]->pict_type= P_TYPE;
-            s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++;
-            for(i=0; i<b_frames; i++){
-                s->reordered_input_picture[i+1]= s->input_picture[i];
-                s->reordered_input_picture[i+1]->pict_type= B_TYPE;
-                s->reordered_input_picture[i+1]->coded_picture_number= s->coded_picture_number++;
-            }
-        }
-    }
-no_output_pic:
-    if(s->reordered_input_picture[0]){
-        s->reordered_input_picture[0]->reference= s->reordered_input_picture[0]->pict_type!=B_TYPE ? 3 : 0;
-
-        copy_picture(&s->new_picture, s->reordered_input_picture[0]);
-
-        if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_SHARED || s->avctx->rc_buffer_size){
-            // input is a shared pix, so we can't modifiy it -> alloc a new one & ensure that the shared one is reuseable
-
-            int i= ff_find_unused_picture(s, 0);
-            Picture *pic= &s->picture[i];
-
-            pic->reference              = s->reordered_input_picture[0]->reference;
-            alloc_picture(s, pic, 0);
-
-            /* mark us unused / free shared pic */
-            if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_INTERNAL)
-                s->avctx->release_buffer(s->avctx, (AVFrame*)s->reordered_input_picture[0]);
-            for(i=0; i<4; i++)
-                s->reordered_input_picture[0]->data[i]= NULL;
-            s->reordered_input_picture[0]->type= 0;
-
-            copy_picture_attributes(s, (AVFrame*)pic, (AVFrame*)s->reordered_input_picture[0]);
-
-            s->current_picture_ptr= pic;
-        }else{
-            // input is not a shared pix -> reuse buffer for current_pix
-
-            assert(   s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_USER
-                   || s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL);
-
-            s->current_picture_ptr= s->reordered_input_picture[0];
-            for(i=0; i<4; i++){
-                s->new_picture.data[i]+= INPLACE_OFFSET;
-            }
-        }
-        copy_picture(&s->current_picture, s->current_picture_ptr);
-
-        s->picture_number= s->new_picture.display_picture_number;
-//printf("dpn:%d\n", s->picture_number);
-    }else{
-       memset(&s->new_picture, 0, sizeof(Picture));
-    }
-}
-
-int MPV_encode_picture(AVCodecContext *avctx,
-                       unsigned char *buf, int buf_size, void *data)
-{
-    MpegEncContext *s = avctx->priv_data;
-    AVFrame *pic_arg = data;
-    int i, stuffing_count;
-
-    for(i=0; i<avctx->thread_count; i++){
-        int start_y= s->thread_context[i]->start_mb_y;
-        int   end_y= s->thread_context[i]->  end_mb_y;
-        int h= s->mb_height;
-        uint8_t *start= buf + (size_t)(((int64_t) buf_size)*start_y/h);
-        uint8_t *end  = buf + (size_t)(((int64_t) buf_size)*  end_y/h);
-
-        init_put_bits(&s->thread_context[i]->pb, start, end - start);
-    }
-
-    s->picture_in_gop_number++;
-
-    if(load_input_picture(s, pic_arg) < 0)
-        return -1;
-
-    select_input_picture(s);
-
-    /* output? */
-    if(s->new_picture.data[0]){
-        s->pict_type= s->new_picture.pict_type;
-//emms_c();
-//printf("qs:%f %f %d\n", s->new_picture.quality, s->current_picture.quality, s->qscale);
-        MPV_frame_start(s, avctx);
-vbv_retry:
-        if (encode_picture(s, s->picture_number) < 0)
-            return -1;
-
-        avctx->real_pict_num  = s->picture_number;
-        avctx->header_bits = s->header_bits;
-        avctx->mv_bits     = s->mv_bits;
-        avctx->misc_bits   = s->misc_bits;
-        avctx->i_tex_bits  = s->i_tex_bits;
-        avctx->p_tex_bits  = s->p_tex_bits;
-        avctx->i_count     = s->i_count;
-        avctx->p_count     = s->mb_num - s->i_count - s->skip_count; //FIXME f/b_count in avctx
-        avctx->skip_count  = s->skip_count;
-
-        MPV_frame_end(s);
-
-        if (s->out_format == FMT_MJPEG)
-            mjpeg_picture_trailer(s);
-
-        if(avctx->rc_buffer_size){
-            RateControlContext *rcc= &s->rc_context;
-            int max_size= rcc->buffer_index/3;
-
-            if(put_bits_count(&s->pb) > max_size && s->qscale < s->avctx->qmax){
-                s->next_lambda= FFMAX(s->lambda+1, s->lambda*(s->qscale+1) / s->qscale);
-                s->mb_skipped = 0;        //done in MPV_frame_start()
-                if(s->pict_type==P_TYPE){ //done in encode_picture() so we must undo it
-                    if(s->flipflop_rounding || s->codec_id == CODEC_ID_H263P || s->codec_id == CODEC_ID_MPEG4)
-                        s->no_rounding ^= 1;
-                }
-//                av_log(NULL, AV_LOG_ERROR, "R:%d ", s->next_lambda);
-                for(i=0; i<avctx->thread_count; i++){
-                    PutBitContext *pb= &s->thread_context[i]->pb;
-                    init_put_bits(pb, pb->buf, pb->buf_end - pb->buf);
-                }
-                goto vbv_retry;
-            }
-
-            assert(s->avctx->rc_max_rate);
-        }
-
-        if(s->flags&CODEC_FLAG_PASS1)
-            ff_write_pass1_stats(s);
-
-        for(i=0; i<4; i++){
-            s->current_picture_ptr->error[i]= s->current_picture.error[i];
-            avctx->error[i] += s->current_picture_ptr->error[i];
-        }
-
-        if(s->flags&CODEC_FLAG_PASS1)
-            assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits + avctx->i_tex_bits + avctx->p_tex_bits == put_bits_count(&s->pb));
-        flush_put_bits(&s->pb);
-        s->frame_bits  = put_bits_count(&s->pb);
-
-        stuffing_count= ff_vbv_update(s, s->frame_bits);
-        if(stuffing_count){
-            if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < stuffing_count + 50){
-                av_log(s->avctx, AV_LOG_ERROR, "stuffing too large\n");
-                return -1;
-            }
-
-            switch(s->codec_id){
-            case CODEC_ID_MPEG1VIDEO:
-            case CODEC_ID_MPEG2VIDEO:
-                while(stuffing_count--){
-                    put_bits(&s->pb, 8, 0);
-                }
-            break;
-            case CODEC_ID_MPEG4:
-                put_bits(&s->pb, 16, 0);
-                put_bits(&s->pb, 16, 0x1C3);
-                stuffing_count -= 4;
-                while(stuffing_count--){
-                    put_bits(&s->pb, 8, 0xFF);
-                }
-            break;
-            default:
-                av_log(s->avctx, AV_LOG_ERROR, "vbv buffer overflow\n");
-            }
-            flush_put_bits(&s->pb);
-            s->frame_bits  = put_bits_count(&s->pb);
-        }
-
-        /* update mpeg1/2 vbv_delay for CBR */
-        if(s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && s->out_format == FMT_MPEG1
-           && 90000LL * (avctx->rc_buffer_size-1) <= s->avctx->rc_max_rate*0xFFFFLL){
-            int vbv_delay;
-
-            assert(s->repeat_first_field==0);
-
-            vbv_delay= lrintf(90000 * s->rc_context.buffer_index / s->avctx->rc_max_rate);
-            assert(vbv_delay < 0xFFFF);
-
-            s->vbv_delay_ptr[0] &= 0xF8;
-            s->vbv_delay_ptr[0] |= vbv_delay>>13;
-            s->vbv_delay_ptr[1]  = vbv_delay>>5;
-            s->vbv_delay_ptr[2] &= 0x07;
-            s->vbv_delay_ptr[2] |= vbv_delay<<3;
-        }
-        s->total_bits += s->frame_bits;
-        avctx->frame_bits  = s->frame_bits;
-    }else{
-        assert((pbBufPtr(&s->pb) == s->pb.buf));
-        s->frame_bits=0;
-    }
-    assert((s->frame_bits&7)==0);
-
-    return s->frame_bits/8;
-}
-
-#endif //CONFIG_ENCODERS
-
-static inline void gmc1_motion(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               uint8_t **ref_picture)
-{
-    uint8_t *ptr;
-    int offset, src_x, src_y, linesize, uvlinesize;
-    int motion_x, motion_y;
-    int emu=0;
-
-    motion_x= s->sprite_offset[0][0];
-    motion_y= s->sprite_offset[0][1];
-    src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy+1));
-    src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy+1));
-    motion_x<<=(3-s->sprite_warping_accuracy);
-    motion_y<<=(3-s->sprite_warping_accuracy);
-    src_x = clip(src_x, -16, s->width);
-    if (src_x == s->width)
-        motion_x =0;
-    src_y = clip(src_y, -16, s->height);
-    if (src_y == s->height)
-        motion_y =0;
-
-    linesize = s->linesize;
-    uvlinesize = s->uvlinesize;
-
-    ptr = ref_picture[0] + (src_y * linesize) + src_x;
-
-    if(s->flags&CODEC_FLAG_EMU_EDGE){
-        if(   (unsigned)src_x >= s->h_edge_pos - 17
-           || (unsigned)src_y >= s->v_edge_pos - 17){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos);
-            ptr= s->edge_emu_buffer;
-        }
-    }
-
-    if((motion_x|motion_y)&7){
-        s->dsp.gmc1(dest_y  , ptr  , linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding);
-        s->dsp.gmc1(dest_y+8, ptr+8, linesize, 16, motion_x&15, motion_y&15, 128 - s->no_rounding);
-    }else{
-        int dxy;
-
-        dxy= ((motion_x>>3)&1) | ((motion_y>>2)&2);
-        if (s->no_rounding){
-            s->dsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16);
-        }else{
-            s->dsp.put_pixels_tab       [0][dxy](dest_y, ptr, linesize, 16);
-        }
-    }
-
-    if(s->flags&CODEC_FLAG_GRAY) return;
-
-    motion_x= s->sprite_offset[1][0];
-    motion_y= s->sprite_offset[1][1];
-    src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy+1));
-    src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy+1));
-    motion_x<<=(3-s->sprite_warping_accuracy);
-    motion_y<<=(3-s->sprite_warping_accuracy);
-    src_x = clip(src_x, -8, s->width>>1);
-    if (src_x == s->width>>1)
-        motion_x =0;
-    src_y = clip(src_y, -8, s->height>>1);
-    if (src_y == s->height>>1)
-        motion_y =0;
-
-    offset = (src_y * uvlinesize) + src_x;
-    ptr = ref_picture[1] + offset;
-    if(s->flags&CODEC_FLAG_EMU_EDGE){
-        if(   (unsigned)src_x >= (s->h_edge_pos>>1) - 9
-           || (unsigned)src_y >= (s->v_edge_pos>>1) - 9){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
-            ptr= s->edge_emu_buffer;
-            emu=1;
-        }
-    }
-    s->dsp.gmc1(dest_cb, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding);
-
-    ptr = ref_picture[2] + offset;
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
-        ptr= s->edge_emu_buffer;
-    }
-    s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding);
-
-    return;
-}
-
-static inline void gmc_motion(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               uint8_t **ref_picture)
-{
-    uint8_t *ptr;
-    int linesize, uvlinesize;
-    const int a= s->sprite_warping_accuracy;
-    int ox, oy;
-
-    linesize = s->linesize;
-    uvlinesize = s->uvlinesize;
-
-    ptr = ref_picture[0];
-
-    ox= s->sprite_offset[0][0] + s->sprite_delta[0][0]*s->mb_x*16 + s->sprite_delta[0][1]*s->mb_y*16;
-    oy= s->sprite_offset[0][1] + s->sprite_delta[1][0]*s->mb_x*16 + s->sprite_delta[1][1]*s->mb_y*16;
-
-    s->dsp.gmc(dest_y, ptr, linesize, 16,
-           ox,
-           oy,
-           s->sprite_delta[0][0], s->sprite_delta[0][1],
-           s->sprite_delta[1][0], s->sprite_delta[1][1],
-           a+1, (1<<(2*a+1)) - s->no_rounding,
-           s->h_edge_pos, s->v_edge_pos);
-    s->dsp.gmc(dest_y+8, ptr, linesize, 16,
-           ox + s->sprite_delta[0][0]*8,
-           oy + s->sprite_delta[1][0]*8,
-           s->sprite_delta[0][0], s->sprite_delta[0][1],
-           s->sprite_delta[1][0], s->sprite_delta[1][1],
-           a+1, (1<<(2*a+1)) - s->no_rounding,
-           s->h_edge_pos, s->v_edge_pos);
-
-    if(s->flags&CODEC_FLAG_GRAY) return;
-
-    ox= s->sprite_offset[1][0] + s->sprite_delta[0][0]*s->mb_x*8 + s->sprite_delta[0][1]*s->mb_y*8;
-    oy= s->sprite_offset[1][1] + s->sprite_delta[1][0]*s->mb_x*8 + s->sprite_delta[1][1]*s->mb_y*8;
-
-    ptr = ref_picture[1];
-    s->dsp.gmc(dest_cb, ptr, uvlinesize, 8,
-           ox,
-           oy,
-           s->sprite_delta[0][0], s->sprite_delta[0][1],
-           s->sprite_delta[1][0], s->sprite_delta[1][1],
-           a+1, (1<<(2*a+1)) - s->no_rounding,
-           s->h_edge_pos>>1, s->v_edge_pos>>1);
-
-    ptr = ref_picture[2];
-    s->dsp.gmc(dest_cr, ptr, uvlinesize, 8,
-           ox,
-           oy,
-           s->sprite_delta[0][0], s->sprite_delta[0][1],
-           s->sprite_delta[1][0], s->sprite_delta[1][1],
-           a+1, (1<<(2*a+1)) - s->no_rounding,
-           s->h_edge_pos>>1, s->v_edge_pos>>1);
-}
-
-/**
- * Copies a rectangular area of samples to a temporary buffer and replicates the boarder samples.
- * @param buf destination buffer
- * @param src source buffer
- * @param linesize number of bytes between 2 vertically adjacent samples in both the source and destination buffers
- * @param block_w width of block
- * @param block_h height of block
- * @param src_x x coordinate of the top left sample of the block in the source buffer
- * @param src_y y coordinate of the top left sample of the block in the source buffer
- * @param w width of the source buffer
- * @param h height of the source buffer
- */
-void ff_emulated_edge_mc(uint8_t *buf, uint8_t *src, int linesize, int block_w, int block_h,
-                                    int src_x, int src_y, int w, int h){
-    int x, y;
-    int start_y, start_x, end_y, end_x;
-
-    if(src_y>= h){
-        src+= (h-1-src_y)*linesize;
-        src_y=h-1;
-    }else if(src_y<=-block_h){
-        src+= (1-block_h-src_y)*linesize;
-        src_y=1-block_h;
-    }
-    if(src_x>= w){
-        src+= (w-1-src_x);
-        src_x=w-1;
-    }else if(src_x<=-block_w){
-        src+= (1-block_w-src_x);
-        src_x=1-block_w;
-    }
-
-    start_y= FFMAX(0, -src_y);
-    start_x= FFMAX(0, -src_x);
-    end_y= FFMIN(block_h, h-src_y);
-    end_x= FFMIN(block_w, w-src_x);
-
-    // copy existing part
-    for(y=start_y; y<end_y; y++){
-        for(x=start_x; x<end_x; x++){
-            buf[x + y*linesize]= src[x + y*linesize];
-        }
-    }
-
-    //top
-    for(y=0; y<start_y; y++){
-        for(x=start_x; x<end_x; x++){
-            buf[x + y*linesize]= buf[x + start_y*linesize];
-        }
-    }
-
-    //bottom
-    for(y=end_y; y<block_h; y++){
-        for(x=start_x; x<end_x; x++){
-            buf[x + y*linesize]= buf[x + (end_y-1)*linesize];
-        }
-    }
-
-    for(y=0; y<block_h; y++){
-       //left
-        for(x=0; x<start_x; x++){
-            buf[x + y*linesize]= buf[start_x + y*linesize];
-        }
-
-       //right
-        for(x=end_x; x<block_w; x++){
-            buf[x + y*linesize]= buf[end_x - 1 + y*linesize];
-        }
-    }
-}
-
-static inline int hpel_motion(MpegEncContext *s,
-                                  uint8_t *dest, uint8_t *src,
-                                  int field_based, int field_select,
-                                  int src_x, int src_y,
-                                  int width, int height, int stride,
-                                  int h_edge_pos, int v_edge_pos,
-                                  int w, int h, op_pixels_func *pix_op,
-                                  int motion_x, int motion_y)
-{
-    int dxy;
-    int emu=0;
-
-    dxy = ((motion_y & 1) << 1) | (motion_x & 1);
-    src_x += motion_x >> 1;
-    src_y += motion_y >> 1;
-
-    /* WARNING: do no forget half pels */
-    src_x = clip(src_x, -16, width); //FIXME unneeded for emu?
-    if (src_x == width)
-        dxy &= ~1;
-    src_y = clip(src_y, -16, height);
-    if (src_y == height)
-        dxy &= ~2;
-    src += src_y * stride + src_x;
-
-    if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
-        if(   (unsigned)src_x > h_edge_pos - (motion_x&1) - w
-           || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){
-            ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
-                             src_x, src_y<<field_based, h_edge_pos, s->v_edge_pos);
-            src= s->edge_emu_buffer;
-            emu=1;
-        }
-    }
-    if(field_select)
-        src += s->linesize;
-    pix_op[dxy](dest, src, stride, h);
-    return emu;
-}
-
-static inline int hpel_motion_lowres(MpegEncContext *s,
-                                  uint8_t *dest, uint8_t *src,
-                                  int field_based, int field_select,
-                                  int src_x, int src_y,
-                                  int width, int height, int stride,
-                                  int h_edge_pos, int v_edge_pos,
-                                  int w, int h, h264_chroma_mc_func *pix_op,
-                                  int motion_x, int motion_y)
-{
-    const int lowres= s->avctx->lowres;
-    const int s_mask= (2<<lowres)-1;
-    int emu=0;
-    int sx, sy;
-
-    if(s->quarter_sample){
-        motion_x/=2;
-        motion_y/=2;
-    }
-
-    sx= motion_x & s_mask;
-    sy= motion_y & s_mask;
-    src_x += motion_x >> (lowres+1);
-    src_y += motion_y >> (lowres+1);
-
-    src += src_y * stride + src_x;
-
-    if(   (unsigned)src_x > h_edge_pos                 - (!!sx) - w
-       || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){
-        ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
-                            src_x, src_y<<field_based, h_edge_pos, v_edge_pos);
-        src= s->edge_emu_buffer;
-        emu=1;
-    }
-
-    sx <<= 2 - lowres;
-    sy <<= 2 - lowres;
-    if(field_select)
-        src += s->linesize;
-    pix_op[lowres](dest, src, stride, h, sx, sy);
-    return emu;
-}
-
-/* apply one mpeg motion vector to the three components */
-static always_inline void mpeg_motion(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               int field_based, int bottom_field, int field_select,
-                               uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
-                               int motion_x, int motion_y, int h)
-{
-    uint8_t *ptr_y, *ptr_cb, *ptr_cr;
-    int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos, uvlinesize, linesize;
-
-#if 0
-if(s->quarter_sample)
-{
-    motion_x>>=1;
-    motion_y>>=1;
-}
-#endif
-
-    v_edge_pos = s->v_edge_pos >> field_based;
-    linesize   = s->current_picture.linesize[0] << field_based;
-    uvlinesize = s->current_picture.linesize[1] << field_based;
-
-    dxy = ((motion_y & 1) << 1) | (motion_x & 1);
-    src_x = s->mb_x* 16               + (motion_x >> 1);
-    src_y =(s->mb_y<<(4-field_based)) + (motion_y >> 1);
-
-    if (s->out_format == FMT_H263) {
-        if((s->workaround_bugs & FF_BUG_HPEL_CHROMA) && field_based){
-            mx = (motion_x>>1)|(motion_x&1);
-            my = motion_y >>1;
-            uvdxy = ((my & 1) << 1) | (mx & 1);
-            uvsrc_x = s->mb_x* 8               + (mx >> 1);
-            uvsrc_y = (s->mb_y<<(3-field_based)) + (my >> 1);
-        }else{
-            uvdxy = dxy | (motion_y & 2) | ((motion_x & 2) >> 1);
-            uvsrc_x = src_x>>1;
-            uvsrc_y = src_y>>1;
-        }
-    }else if(s->out_format == FMT_H261){//even chroma mv's are full pel in H261
-        mx = motion_x / 4;
-        my = motion_y / 4;
-        uvdxy = 0;
-        uvsrc_x = s->mb_x*8 + mx;
-        uvsrc_y = s->mb_y*8 + my;
-    } else {
-        if(s->chroma_y_shift){
-            mx = motion_x / 2;
-            my = motion_y / 2;
-            uvdxy = ((my & 1) << 1) | (mx & 1);
-            uvsrc_x = s->mb_x* 8               + (mx >> 1);
-            uvsrc_y = (s->mb_y<<(3-field_based)) + (my >> 1);
-        } else {
-            if(s->chroma_x_shift){
-            //Chroma422
-                mx = motion_x / 2;
-                uvdxy = ((motion_y & 1) << 1) | (mx & 1);
-                uvsrc_x = s->mb_x* 8           + (mx >> 1);
-                uvsrc_y = src_y;
-            } else {
-            //Chroma444
-                uvdxy = dxy;
-                uvsrc_x = src_x;
-                uvsrc_y = src_y;
-            }
-        }
-    }
-
-    ptr_y  = ref_picture[0] + src_y * linesize + src_x;
-    ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
-    ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
-
-    if(   (unsigned)src_x > s->h_edge_pos - (motion_x&1) - 16
-       || (unsigned)src_y >    v_edge_pos - (motion_y&1) - h){
-            if(s->codec_id == CODEC_ID_MPEG2VIDEO ||
-               s->codec_id == CODEC_ID_MPEG1VIDEO){
-                av_log(s->avctx,AV_LOG_DEBUG,"MPEG motion vector out of boundary\n");
-                return ;
-            }
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
-                             src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos);
-            ptr_y = s->edge_emu_buffer;
-            if(!(s->flags&CODEC_FLAG_GRAY)){
-                uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
-                ff_emulated_edge_mc(uvbuf  , ptr_cb, s->uvlinesize, 9, 9+field_based,
-                                 uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
-                ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based,
-                                 uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
-                ptr_cb= uvbuf;
-                ptr_cr= uvbuf+16;
-            }
-    }
-
-    if(bottom_field){ //FIXME use this for field pix too instead of the obnoxious hack which changes picture.data
-        dest_y += s->linesize;
-        dest_cb+= s->uvlinesize;
-        dest_cr+= s->uvlinesize;
-    }
-
-    if(field_select){
-        ptr_y += s->linesize;
-        ptr_cb+= s->uvlinesize;
-        ptr_cr+= s->uvlinesize;
-    }
-
-    pix_op[0][dxy](dest_y, ptr_y, linesize, h);
-
-    if(!(s->flags&CODEC_FLAG_GRAY)){
-        pix_op[s->chroma_x_shift][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift);
-        pix_op[s->chroma_x_shift][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift);
-    }
-#if defined(CONFIG_H261_ENCODER) || defined(CONFIG_H261_DECODER)
-    if(s->out_format == FMT_H261){
-        ff_h261_loop_filter(s);
-    }
-#endif
-}
-
-/* apply one mpeg motion vector to the three components */
-static always_inline void mpeg_motion_lowres(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               int field_based, int bottom_field, int field_select,
-                               uint8_t **ref_picture, h264_chroma_mc_func *pix_op,
-                               int motion_x, int motion_y, int h)
-{
-    uint8_t *ptr_y, *ptr_cb, *ptr_cr;
-    int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy, uvsx, uvsy;
-    const int lowres= s->avctx->lowres;
-    const int block_s= 8>>lowres;
-    const int s_mask= (2<<lowres)-1;
-    const int h_edge_pos = s->h_edge_pos >> lowres;
-    const int v_edge_pos = s->v_edge_pos >> lowres;
-    linesize   = s->current_picture.linesize[0] << field_based;
-    uvlinesize = s->current_picture.linesize[1] << field_based;
-
-    if(s->quarter_sample){ //FIXME obviously not perfect but qpel wont work in lowres anyway
-        motion_x/=2;
-        motion_y/=2;
-    }
-
-    if(field_based){
-        motion_y += (bottom_field - field_select)*((1<<lowres)-1);
-    }
-
-    sx= motion_x & s_mask;
-    sy= motion_y & s_mask;
-    src_x = s->mb_x*2*block_s               + (motion_x >> (lowres+1));
-    src_y =(s->mb_y*2*block_s>>field_based) + (motion_y >> (lowres+1));
-
-    if (s->out_format == FMT_H263) {
-        uvsx = ((motion_x>>1) & s_mask) | (sx&1);
-        uvsy = ((motion_y>>1) & s_mask) | (sy&1);
-        uvsrc_x = src_x>>1;
-        uvsrc_y = src_y>>1;
-    }else if(s->out_format == FMT_H261){//even chroma mv's are full pel in H261
-        mx = motion_x / 4;
-        my = motion_y / 4;
-        uvsx = (2*mx) & s_mask;
-        uvsy = (2*my) & s_mask;
-        uvsrc_x = s->mb_x*block_s               + (mx >> lowres);
-        uvsrc_y = s->mb_y*block_s               + (my >> lowres);
-    } else {
-        mx = motion_x / 2;
-        my = motion_y / 2;
-        uvsx = mx & s_mask;
-        uvsy = my & s_mask;
-        uvsrc_x = s->mb_x*block_s               + (mx >> (lowres+1));
-        uvsrc_y =(s->mb_y*block_s>>field_based) + (my >> (lowres+1));
-    }
-
-    ptr_y  = ref_picture[0] + src_y * linesize + src_x;
-    ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
-    ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
-
-    if(   (unsigned)src_x > h_edge_pos                 - (!!sx) - 2*block_s
-       || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
-                             src_x, src_y<<field_based, h_edge_pos, v_edge_pos);
-            ptr_y = s->edge_emu_buffer;
-            if(!(s->flags&CODEC_FLAG_GRAY)){
-                uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
-                ff_emulated_edge_mc(uvbuf  , ptr_cb, s->uvlinesize, 9, 9+field_based,
-                                 uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1);
-                ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based,
-                                 uvsrc_x, uvsrc_y<<field_based, h_edge_pos>>1, v_edge_pos>>1);
-                ptr_cb= uvbuf;
-                ptr_cr= uvbuf+16;
-            }
-    }
-
-    if(bottom_field){ //FIXME use this for field pix too instead of the obnoxious hack which changes picture.data
-        dest_y += s->linesize;
-        dest_cb+= s->uvlinesize;
-        dest_cr+= s->uvlinesize;
-    }
-
-    if(field_select){
-        ptr_y += s->linesize;
-        ptr_cb+= s->uvlinesize;
-        ptr_cr+= s->uvlinesize;
-    }
-
-    sx <<= 2 - lowres;
-    sy <<= 2 - lowres;
-    pix_op[lowres-1](dest_y, ptr_y, linesize, h, sx, sy);
-
-    if(!(s->flags&CODEC_FLAG_GRAY)){
-        uvsx <<= 2 - lowres;
-        uvsy <<= 2 - lowres;
-        pix_op[lowres](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
-        pix_op[lowres](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift, uvsx, uvsy);
-    }
-    //FIXME h261 lowres loop filter
-}
-
-//FIXME move to dsputil, avg variant, 16x16 version
-static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride){
-    int x;
-    uint8_t * const top   = src[1];
-    uint8_t * const left  = src[2];
-    uint8_t * const mid   = src[0];
-    uint8_t * const right = src[3];
-    uint8_t * const bottom= src[4];
-#define OBMC_FILTER(x, t, l, m, r, b)\
-    dst[x]= (t*top[x] + l*left[x] + m*mid[x] + r*right[x] + b*bottom[x] + 4)>>3
-#define OBMC_FILTER4(x, t, l, m, r, b)\
-    OBMC_FILTER(x         , t, l, m, r, b);\
-    OBMC_FILTER(x+1       , t, l, m, r, b);\
-    OBMC_FILTER(x  +stride, t, l, m, r, b);\
-    OBMC_FILTER(x+1+stride, t, l, m, r, b);
-
-    x=0;
-    OBMC_FILTER (x  , 2, 2, 4, 0, 0);
-    OBMC_FILTER (x+1, 2, 1, 5, 0, 0);
-    OBMC_FILTER4(x+2, 2, 1, 5, 0, 0);
-    OBMC_FILTER4(x+4, 2, 0, 5, 1, 0);
-    OBMC_FILTER (x+6, 2, 0, 5, 1, 0);
-    OBMC_FILTER (x+7, 2, 0, 4, 2, 0);
-    x+= stride;
-    OBMC_FILTER (x  , 1, 2, 5, 0, 0);
-    OBMC_FILTER (x+1, 1, 2, 5, 0, 0);
-    OBMC_FILTER (x+6, 1, 0, 5, 2, 0);
-    OBMC_FILTER (x+7, 1, 0, 5, 2, 0);
-    x+= stride;
-    OBMC_FILTER4(x  , 1, 2, 5, 0, 0);
-    OBMC_FILTER4(x+2, 1, 1, 6, 0, 0);
-    OBMC_FILTER4(x+4, 1, 0, 6, 1, 0);
-    OBMC_FILTER4(x+6, 1, 0, 5, 2, 0);
-    x+= 2*stride;
-    OBMC_FILTER4(x  , 0, 2, 5, 0, 1);
-    OBMC_FILTER4(x+2, 0, 1, 6, 0, 1);
-    OBMC_FILTER4(x+4, 0, 0, 6, 1, 1);
-    OBMC_FILTER4(x+6, 0, 0, 5, 2, 1);
-    x+= 2*stride;
-    OBMC_FILTER (x  , 0, 2, 5, 0, 1);
-    OBMC_FILTER (x+1, 0, 2, 5, 0, 1);
-    OBMC_FILTER4(x+2, 0, 1, 5, 0, 2);
-    OBMC_FILTER4(x+4, 0, 0, 5, 1, 2);
-    OBMC_FILTER (x+6, 0, 0, 5, 2, 1);
-    OBMC_FILTER (x+7, 0, 0, 5, 2, 1);
-    x+= stride;
-    OBMC_FILTER (x  , 0, 2, 4, 0, 2);
-    OBMC_FILTER (x+1, 0, 1, 5, 0, 2);
-    OBMC_FILTER (x+6, 0, 0, 5, 1, 2);
-    OBMC_FILTER (x+7, 0, 0, 4, 2, 2);
-}
-
-/* obmc for 1 8x8 luma block */
-static inline void obmc_motion(MpegEncContext *s,
-                               uint8_t *dest, uint8_t *src,
-                               int src_x, int src_y,
-                               op_pixels_func *pix_op,
-                               int16_t mv[5][2]/* mid top left right bottom*/)
-#define MID    0
-{
-    int i;
-    uint8_t *ptr[5];
-
-    assert(s->quarter_sample==0);
-
-    for(i=0; i<5; i++){
-        if(i && mv[i][0]==mv[MID][0] && mv[i][1]==mv[MID][1]){
-            ptr[i]= ptr[MID];
-        }else{
-            ptr[i]= s->obmc_scratchpad + 8*(i&1) + s->linesize*8*(i>>1);
-            hpel_motion(s, ptr[i], src, 0, 0,
-                        src_x, src_y,
-                        s->width, s->height, s->linesize,
-                        s->h_edge_pos, s->v_edge_pos,
-                        8, 8, pix_op,
-                        mv[i][0], mv[i][1]);
-        }
-    }
-
-    put_obmc(dest, ptr, s->linesize);
-}
-
-static inline void qpel_motion(MpegEncContext *s,
-                               uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                               int field_based, int bottom_field, int field_select,
-                               uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
-                               qpel_mc_func (*qpix_op)[16],
-                               int motion_x, int motion_y, int h)
-{
-    uint8_t *ptr_y, *ptr_cb, *ptr_cr;
-    int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos, linesize, uvlinesize;
-
-    dxy = ((motion_y & 3) << 2) | (motion_x & 3);
-    src_x = s->mb_x *  16                 + (motion_x >> 2);
-    src_y = s->mb_y * (16 >> field_based) + (motion_y >> 2);
-
-    v_edge_pos = s->v_edge_pos >> field_based;
-    linesize = s->linesize << field_based;
-    uvlinesize = s->uvlinesize << field_based;
-
-    if(field_based){
-        mx= motion_x/2;
-        my= motion_y>>1;
-    }else if(s->workaround_bugs&FF_BUG_QPEL_CHROMA2){
-        static const int rtab[8]= {0,0,1,1,0,0,0,1};
-        mx= (motion_x>>1) + rtab[motion_x&7];
-        my= (motion_y>>1) + rtab[motion_y&7];
-    }else if(s->workaround_bugs&FF_BUG_QPEL_CHROMA){
-        mx= (motion_x>>1)|(motion_x&1);
-        my= (motion_y>>1)|(motion_y&1);
-    }else{
-        mx= motion_x/2;
-        my= motion_y/2;
-    }
-    mx= (mx>>1)|(mx&1);
-    my= (my>>1)|(my&1);
-
-    uvdxy= (mx&1) | ((my&1)<<1);
-    mx>>=1;
-    my>>=1;
-
-    uvsrc_x = s->mb_x *  8                 + mx;
-    uvsrc_y = s->mb_y * (8 >> field_based) + my;
-
-    ptr_y  = ref_picture[0] +   src_y *   linesize +   src_x;
-    ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
-    ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
-
-    if(   (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 16
-       || (unsigned)src_y >    v_edge_pos - (motion_y&3) - h  ){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based,
-                         src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos);
-        ptr_y= s->edge_emu_buffer;
-        if(!(s->flags&CODEC_FLAG_GRAY)){
-            uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize;
-            ff_emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize, 9, 9 + field_based,
-                             uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
-            ff_emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize, 9, 9 + field_based,
-                             uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
-            ptr_cb= uvbuf;
-            ptr_cr= uvbuf + 16;
-        }
-    }
-
-    if(!field_based)
-        qpix_op[0][dxy](dest_y, ptr_y, linesize);
-    else{
-        if(bottom_field){
-            dest_y += s->linesize;
-            dest_cb+= s->uvlinesize;
-            dest_cr+= s->uvlinesize;
-        }
-
-        if(field_select){
-            ptr_y  += s->linesize;
-            ptr_cb += s->uvlinesize;
-            ptr_cr += s->uvlinesize;
-        }
-        //damn interlaced mode
-        //FIXME boundary mirroring is not exactly correct here
-        qpix_op[1][dxy](dest_y  , ptr_y  , linesize);
-        qpix_op[1][dxy](dest_y+8, ptr_y+8, linesize);
-    }
-    if(!(s->flags&CODEC_FLAG_GRAY)){
-        pix_op[1][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> 1);
-        pix_op[1][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> 1);
-    }
-}
-
-inline int ff_h263_round_chroma(int x){
-    if (x >= 0)
-        return  (h263_chroma_roundtab[x & 0xf] + ((x >> 3) & ~1));
-    else {
-        x = -x;
-        return -(h263_chroma_roundtab[x & 0xf] + ((x >> 3) & ~1));
-    }
-}
-
-/**
- * h263 chorma 4mv motion compensation.
- */
-static inline void chroma_4mv_motion(MpegEncContext *s,
-                                     uint8_t *dest_cb, uint8_t *dest_cr,
-                                     uint8_t **ref_picture,
-                                     op_pixels_func *pix_op,
-                                     int mx, int my){
-    int dxy, emu=0, src_x, src_y, offset;
-    uint8_t *ptr;
-
-    /* In case of 8X8, we construct a single chroma motion vector
-       with a special rounding */
-    mx= ff_h263_round_chroma(mx);
-    my= ff_h263_round_chroma(my);
-
-    dxy = ((my & 1) << 1) | (mx & 1);
-    mx >>= 1;
-    my >>= 1;
-
-    src_x = s->mb_x * 8 + mx;
-    src_y = s->mb_y * 8 + my;
-    src_x = clip(src_x, -8, s->width/2);
-    if (src_x == s->width/2)
-        dxy &= ~1;
-    src_y = clip(src_y, -8, s->height/2);
-    if (src_y == s->height/2)
-        dxy &= ~2;
-
-    offset = (src_y * (s->uvlinesize)) + src_x;
-    ptr = ref_picture[1] + offset;
-    if(s->flags&CODEC_FLAG_EMU_EDGE){
-        if(   (unsigned)src_x > (s->h_edge_pos>>1) - (dxy &1) - 8
-           || (unsigned)src_y > (s->v_edge_pos>>1) - (dxy>>1) - 8){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
-            ptr= s->edge_emu_buffer;
-            emu=1;
-        }
-    }
-    pix_op[dxy](dest_cb, ptr, s->uvlinesize, 8);
-
-    ptr = ref_picture[2] + offset;
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
-        ptr= s->edge_emu_buffer;
-    }
-    pix_op[dxy](dest_cr, ptr, s->uvlinesize, 8);
-}
-
-static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
-                                     uint8_t *dest_cb, uint8_t *dest_cr,
-                                     uint8_t **ref_picture,
-                                     h264_chroma_mc_func *pix_op,
-                                     int mx, int my){
-    const int lowres= s->avctx->lowres;
-    const int block_s= 8>>lowres;
-    const int s_mask= (2<<lowres)-1;
-    const int h_edge_pos = s->h_edge_pos >> (lowres+1);
-    const int v_edge_pos = s->v_edge_pos >> (lowres+1);
-    int emu=0, src_x, src_y, offset, sx, sy;
-    uint8_t *ptr;
-
-    if(s->quarter_sample){
-        mx/=2;
-        my/=2;
-    }
-
-    /* In case of 8X8, we construct a single chroma motion vector
-       with a special rounding */
-    mx= ff_h263_round_chroma(mx);
-    my= ff_h263_round_chroma(my);
-
-    sx= mx & s_mask;
-    sy= my & s_mask;
-    src_x = s->mb_x*block_s + (mx >> (lowres+1));
-    src_y = s->mb_y*block_s + (my >> (lowres+1));
-
-    offset = src_y * s->uvlinesize + src_x;
-    ptr = ref_picture[1] + offset;
-    if(s->flags&CODEC_FLAG_EMU_EDGE){
-        if(   (unsigned)src_x > h_edge_pos - (!!sx) - block_s
-           || (unsigned)src_y > v_edge_pos - (!!sy) - block_s){
-            ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
-            ptr= s->edge_emu_buffer;
-            emu=1;
-        }
-    }
-    sx <<= 2 - lowres;
-    sy <<= 2 - lowres;
-    pix_op[lowres](dest_cb, ptr, s->uvlinesize, block_s, sx, sy);
-
-    ptr = ref_picture[2] + offset;
-    if(emu){
-        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
-        ptr= s->edge_emu_buffer;
-    }
-    pix_op[lowres](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);
-}
-
-static inline void prefetch_motion(MpegEncContext *s, uint8_t **pix, int dir){
-    /* fetch pixels for estimated mv 4 macroblocks ahead
-     * optimized for 64byte cache lines */
-    const int shift = s->quarter_sample ? 2 : 1;
-    const int mx= (s->mv[dir][0][0]>>shift) + 16*s->mb_x + 8;
-    const int my= (s->mv[dir][0][1]>>shift) + 16*s->mb_y;
-    int off= mx + (my + (s->mb_x&3)*4)*s->linesize + 64;
-    s->dsp.prefetch(pix[0]+off, s->linesize, 4);
-    off= (mx>>1) + ((my>>1) + (s->mb_x&7))*s->uvlinesize + 64;
-    s->dsp.prefetch(pix[1]+off, pix[2]-pix[1], 2);
-}
-
-/**
- * motion compensation of a single macroblock
- * @param s context
- * @param dest_y luma destination pointer
- * @param dest_cb chroma cb/u destination pointer
- * @param dest_cr chroma cr/v destination pointer
- * @param dir direction (0->forward, 1->backward)
- * @param ref_picture array[3] of pointers to the 3 planes of the reference picture
- * @param pic_op halfpel motion compensation function (average or put normally)
- * @param pic_op qpel motion compensation function (average or put normally)
- * the motion vectors are taken from s->mv and the MV type from s->mv_type
- */
-static inline void MPV_motion(MpegEncContext *s,
-                              uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                              int dir, uint8_t **ref_picture,
-                              op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16])
-{
-    int dxy, mx, my, src_x, src_y, motion_x, motion_y;
-    int mb_x, mb_y, i;
-    uint8_t *ptr, *dest;
-
-    mb_x = s->mb_x;
-    mb_y = s->mb_y;
-
-    prefetch_motion(s, ref_picture, dir);
-
-    if(s->obmc && s->pict_type != B_TYPE){
-        int16_t mv_cache[4][4][2];
-        const int xy= s->mb_x + s->mb_y*s->mb_stride;
-        const int mot_stride= s->b8_stride;
-        const int mot_xy= mb_x*2 + mb_y*2*mot_stride;
-
-        assert(!s->mb_skipped);
-
-        memcpy(mv_cache[1][1], s->current_picture.motion_val[0][mot_xy           ], sizeof(int16_t)*4);
-        memcpy(mv_cache[2][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4);
-        memcpy(mv_cache[3][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4);
-
-        if(mb_y==0 || IS_INTRA(s->current_picture.mb_type[xy-s->mb_stride])){
-            memcpy(mv_cache[0][1], mv_cache[1][1], sizeof(int16_t)*4);
-        }else{
-            memcpy(mv_cache[0][1], s->current_picture.motion_val[0][mot_xy-mot_stride], sizeof(int16_t)*4);
-        }
-
-        if(mb_x==0 || IS_INTRA(s->current_picture.mb_type[xy-1])){
-            *(int32_t*)mv_cache[1][0]= *(int32_t*)mv_cache[1][1];
-            *(int32_t*)mv_cache[2][0]= *(int32_t*)mv_cache[2][1];
-        }else{
-            *(int32_t*)mv_cache[1][0]= *(int32_t*)s->current_picture.motion_val[0][mot_xy-1];
-            *(int32_t*)mv_cache[2][0]= *(int32_t*)s->current_picture.motion_val[0][mot_xy-1+mot_stride];
-        }
-
-        if(mb_x+1>=s->mb_width || IS_INTRA(s->current_picture.mb_type[xy+1])){
-            *(int32_t*)mv_cache[1][3]= *(int32_t*)mv_cache[1][2];
-            *(int32_t*)mv_cache[2][3]= *(int32_t*)mv_cache[2][2];
-        }else{
-            *(int32_t*)mv_cache[1][3]= *(int32_t*)s->current_picture.motion_val[0][mot_xy+2];
-            *(int32_t*)mv_cache[2][3]= *(int32_t*)s->current_picture.motion_val[0][mot_xy+2+mot_stride];
-        }
-
-        mx = 0;
-        my = 0;
-        for(i=0;i<4;i++) {
-            const int x= (i&1)+1;
-            const int y= (i>>1)+1;
-            int16_t mv[5][2]= {
-                {mv_cache[y][x  ][0], mv_cache[y][x  ][1]},
-                {mv_cache[y-1][x][0], mv_cache[y-1][x][1]},
-                {mv_cache[y][x-1][0], mv_cache[y][x-1][1]},
-                {mv_cache[y][x+1][0], mv_cache[y][x+1][1]},
-                {mv_cache[y+1][x][0], mv_cache[y+1][x][1]}};
-            //FIXME cleanup
-            obmc_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize,
-                        ref_picture[0],
-                        mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8,
-                        pix_op[1],
-                        mv);
-
-            mx += mv[0][0];
-            my += mv[0][1];
-        }
-        if(!(s->flags&CODEC_FLAG_GRAY))
-            chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my);
-
-        return;
-    }
-
-    switch(s->mv_type) {
-    case MV_TYPE_16X16:
-        if(s->mcsel){
-            if(s->real_sprite_warping_points==1){
-                gmc1_motion(s, dest_y, dest_cb, dest_cr,
-                            ref_picture);
-            }else{
-                gmc_motion(s, dest_y, dest_cb, dest_cr,
-                            ref_picture);
-            }
-        }else if(s->quarter_sample){
-            qpel_motion(s, dest_y, dest_cb, dest_cr,
-                        0, 0, 0,
-                        ref_picture, pix_op, qpix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], 16);
-        }else if(s->mspel){
-            ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
-                        ref_picture, pix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], 16);
-        }else
-        {
-            mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                        0, 0, 0,
-                        ref_picture, pix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], 16);
-        }
-        break;
-    case MV_TYPE_8X8:
-        mx = 0;
-        my = 0;
-        if(s->quarter_sample){
-            for(i=0;i<4;i++) {
-                motion_x = s->mv[dir][i][0];
-                motion_y = s->mv[dir][i][1];
-
-                dxy = ((motion_y & 3) << 2) | (motion_x & 3);
-                src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8;
-                src_y = mb_y * 16 + (motion_y >> 2) + (i >>1) * 8;
-
-                /* WARNING: do no forget half pels */
-                src_x = clip(src_x, -16, s->width);
-                if (src_x == s->width)
-                    dxy &= ~3;
-                src_y = clip(src_y, -16, s->height);
-                if (src_y == s->height)
-                    dxy &= ~12;
-
-                ptr = ref_picture[0] + (src_y * s->linesize) + (src_x);
-                if(s->flags&CODEC_FLAG_EMU_EDGE){
-                    if(   (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 8
-                       || (unsigned)src_y > s->v_edge_pos - (motion_y&3) - 8 ){
-                        ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->linesize, 9, 9, src_x, src_y, s->h_edge_pos, s->v_edge_pos);
-                        ptr= s->edge_emu_buffer;
-                    }
-                }
-                dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize;
-                qpix_op[1][dxy](dest, ptr, s->linesize);
-
-                mx += s->mv[dir][i][0]/2;
-                my += s->mv[dir][i][1]/2;
-            }
-        }else{
-            for(i=0;i<4;i++) {
-                hpel_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize,
-                            ref_picture[0], 0, 0,
-                            mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8,
-                            s->width, s->height, s->linesize,
-                            s->h_edge_pos, s->v_edge_pos,
-                            8, 8, pix_op[1],
-                            s->mv[dir][i][0], s->mv[dir][i][1]);
-
-                mx += s->mv[dir][i][0];
-                my += s->mv[dir][i][1];
-            }
-        }
-
-        if(!(s->flags&CODEC_FLAG_GRAY))
-            chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my);
-        break;
-    case MV_TYPE_FIELD:
-        if (s->picture_structure == PICT_FRAME) {
-            if(s->quarter_sample){
-                for(i=0; i<2; i++){
-                    qpel_motion(s, dest_y, dest_cb, dest_cr,
-                                1, i, s->field_select[dir][i],
-                                ref_picture, pix_op, qpix_op,
-                                s->mv[dir][i][0], s->mv[dir][i][1], 8);
-                }
-            }else{
-                /* top field */
-                mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                            1, 0, s->field_select[dir][0],
-                            ref_picture, pix_op,
-                            s->mv[dir][0][0], s->mv[dir][0][1], 8);
-                /* bottom field */
-                mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                            1, 1, s->field_select[dir][1],
-                            ref_picture, pix_op,
-                            s->mv[dir][1][0], s->mv[dir][1][1], 8);
-            }
-        } else {
-            if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != B_TYPE && !s->first_field){
-                ref_picture= s->current_picture_ptr->data;
-            }
-
-            mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                        0, 0, s->field_select[dir][0],
-                        ref_picture, pix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], 16);
-        }
-        break;
-    case MV_TYPE_16X8:
-        for(i=0; i<2; i++){
-            uint8_t ** ref2picture;
-
-            if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == B_TYPE || s->first_field){
-                ref2picture= ref_picture;
-            }else{
-                ref2picture= s->current_picture_ptr->data;
-            }
-
-            mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                        0, 0, s->field_select[dir][i],
-                        ref2picture, pix_op,
-                        s->mv[dir][i][0], s->mv[dir][i][1] + 16*i, 8);
-
-            dest_y += 16*s->linesize;
-            dest_cb+= (16>>s->chroma_y_shift)*s->uvlinesize;
-            dest_cr+= (16>>s->chroma_y_shift)*s->uvlinesize;
-        }
-        break;
-    case MV_TYPE_DMV:
-        if(s->picture_structure == PICT_FRAME){
-            for(i=0; i<2; i++){
-                int j;
-                for(j=0; j<2; j++){
-                    mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                                1, j, j^i,
-                                ref_picture, pix_op,
-                                s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], 8);
-                }
-                pix_op = s->dsp.avg_pixels_tab;
-            }
-        }else{
-            for(i=0; i<2; i++){
-                mpeg_motion(s, dest_y, dest_cb, dest_cr,
-                            0, 0, s->picture_structure != i+1,
-                            ref_picture, pix_op,
-                            s->mv[dir][2*i][0],s->mv[dir][2*i][1],16);
-
-                // after put we make avg of the same block
-                pix_op=s->dsp.avg_pixels_tab;
-
-                //opposite parity is always in the same frame if this is second field
-                if(!s->first_field){
-                    ref_picture = s->current_picture_ptr->data;
-                }
-            }
-        }
-    break;
-    default: assert(0);
-    }
-}
-
-/**
- * motion compensation of a single macroblock
- * @param s context
- * @param dest_y luma destination pointer
- * @param dest_cb chroma cb/u destination pointer
- * @param dest_cr chroma cr/v destination pointer
- * @param dir direction (0->forward, 1->backward)
- * @param ref_picture array[3] of pointers to the 3 planes of the reference picture
- * @param pic_op halfpel motion compensation function (average or put normally)
- * the motion vectors are taken from s->mv and the MV type from s->mv_type
- */
-static inline void MPV_motion_lowres(MpegEncContext *s,
-                              uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
-                              int dir, uint8_t **ref_picture,
-                              h264_chroma_mc_func *pix_op)
-{
-    int mx, my;
-    int mb_x, mb_y, i;
-    const int lowres= s->avctx->lowres;
-    const int block_s= 8>>lowres;
-
-    mb_x = s->mb_x;
-    mb_y = s->mb_y;
-
-    switch(s->mv_type) {
-    case MV_TYPE_16X16:
-        mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                    0, 0, 0,
-                    ref_picture, pix_op,
-                    s->mv[dir][0][0], s->mv[dir][0][1], 2*block_s);
-        break;
-    case MV_TYPE_8X8:
-        mx = 0;
-        my = 0;
-            for(i=0;i<4;i++) {
-                hpel_motion_lowres(s, dest_y + ((i & 1) + (i >> 1) * s->linesize)*block_s,
-                            ref_picture[0], 0, 0,
-                            (2*mb_x + (i & 1))*block_s, (2*mb_y + (i >>1))*block_s,
-                            s->width, s->height, s->linesize,
-                            s->h_edge_pos >> lowres, s->v_edge_pos >> lowres,
-                            block_s, block_s, pix_op,
-                            s->mv[dir][i][0], s->mv[dir][i][1]);
-
-                mx += s->mv[dir][i][0];
-                my += s->mv[dir][i][1];
-            }
-
-        if(!(s->flags&CODEC_FLAG_GRAY))
-            chroma_4mv_motion_lowres(s, dest_cb, dest_cr, ref_picture, pix_op, mx, my);
-        break;
-    case MV_TYPE_FIELD:
-        if (s->picture_structure == PICT_FRAME) {
-            /* top field */
-            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                        1, 0, s->field_select[dir][0],
-                        ref_picture, pix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], block_s);
-            /* bottom field */
-            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                        1, 1, s->field_select[dir][1],
-                        ref_picture, pix_op,
-                        s->mv[dir][1][0], s->mv[dir][1][1], block_s);
-        } else {
-            if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != B_TYPE && !s->first_field){
-                ref_picture= s->current_picture_ptr->data;
-            }
-
-            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                        0, 0, s->field_select[dir][0],
-                        ref_picture, pix_op,
-                        s->mv[dir][0][0], s->mv[dir][0][1], 2*block_s);
-        }
-        break;
-    case MV_TYPE_16X8:
-        for(i=0; i<2; i++){
-            uint8_t ** ref2picture;
-
-            if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == B_TYPE || s->first_field){
-                ref2picture= ref_picture;
-            }else{
-                ref2picture= s->current_picture_ptr->data;
-            }
-
-            mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                        0, 0, s->field_select[dir][i],
-                        ref2picture, pix_op,
-                        s->mv[dir][i][0], s->mv[dir][i][1] + 2*block_s*i, block_s);
-
-            dest_y += 2*block_s*s->linesize;
-            dest_cb+= (2*block_s>>s->chroma_y_shift)*s->uvlinesize;
-            dest_cr+= (2*block_s>>s->chroma_y_shift)*s->uvlinesize;
-        }
-        break;
-    case MV_TYPE_DMV:
-        if(s->picture_structure == PICT_FRAME){
-            for(i=0; i<2; i++){
-                int j;
-                for(j=0; j<2; j++){
-                    mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                                1, j, j^i,
-                                ref_picture, pix_op,
-                                s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], block_s);
-                }
-                pix_op = s->dsp.avg_h264_chroma_pixels_tab;
-            }
-        }else{
-            for(i=0; i<2; i++){
-                mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
-                            0, 0, s->picture_structure != i+1,
-                            ref_picture, pix_op,
-                            s->mv[dir][2*i][0],s->mv[dir][2*i][1],2*block_s);
-
-                // after put we make avg of the same block
-                pix_op = s->dsp.avg_h264_chroma_pixels_tab;
-
-                //opposite parity is always in the same frame if this is second field
-                if(!s->first_field){
-                    ref_picture = s->current_picture_ptr->data;
-                }
-            }
-        }
-    break;
-    default: assert(0);
-    }
-}
-
-/* put block[] to dest[] */
-static inline void put_dct(MpegEncContext *s,
-                           DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
-{
-    s->dct_unquantize_intra(s, block, i, qscale);
-    s->dsp.idct_put (dest, line_size, block);
-}
-
-/* add block[] to dest[] */
-static inline void add_dct(MpegEncContext *s,
-                           DCTELEM *block, int i, uint8_t *dest, int line_size)
-{
-    if (s->block_last_index[i] >= 0) {
-        s->dsp.idct_add (dest, line_size, block);
-    }
-}
-
-static inline void add_dequant_dct(MpegEncContext *s,
-                           DCTELEM *block, int i, uint8_t *dest, int line_size, int qscale)
-{
-    if (s->block_last_index[i] >= 0) {
-        s->dct_unquantize_inter(s, block, i, qscale);
-
-        s->dsp.idct_add (dest, line_size, block);
-    }
-}
-
-/**
- * cleans dc, ac, coded_block for the current non intra MB
- */
-void ff_clean_intra_table_entries(MpegEncContext *s)
-{
-    int wrap = s->b8_stride;
-    int xy = s->block_index[0];
-
-    s->dc_val[0][xy           ] =
-    s->dc_val[0][xy + 1       ] =
-    s->dc_val[0][xy     + wrap] =
-    s->dc_val[0][xy + 1 + wrap] = 1024;
-    /* ac pred */
-    memset(s->ac_val[0][xy       ], 0, 32 * sizeof(int16_t));
-    memset(s->ac_val[0][xy + wrap], 0, 32 * sizeof(int16_t));
-    if (s->msmpeg4_version>=3) {
-        s->coded_block[xy           ] =
-        s->coded_block[xy + 1       ] =
-        s->coded_block[xy     + wrap] =
-        s->coded_block[xy + 1 + wrap] = 0;
-    }
-    /* chroma */
-    wrap = s->mb_stride;
-    xy = s->mb_x + s->mb_y * wrap;
-    s->dc_val[1][xy] =
-    s->dc_val[2][xy] = 1024;
-    /* ac pred */
-    memset(s->ac_val[1][xy], 0, 16 * sizeof(int16_t));
-    memset(s->ac_val[2][xy], 0, 16 * sizeof(int16_t));
-
-    s->mbintra_table[xy]= 0;
-}
-
-/* generic function called after a macroblock has been parsed by the
-   decoder or after it has been encoded by the encoder.
-
-   Important variables used:
-   s->mb_intra : true if intra macroblock
-   s->mv_dir   : motion vector direction
-   s->mv_type  : motion vector type
-   s->mv       : motion vector
-   s->interlaced_dct : true if interlaced dct used (mpeg2)
- */
-static always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], int lowres_flag)
-{
-    int mb_x, mb_y;
-    const int mb_xy = s->mb_y * s->mb_stride + s->mb_x;
-#ifdef HAVE_XVMC
-    if(s->avctx->xvmc_acceleration){
-        XVMC_decode_mb(s);//xvmc uses pblocks
-        return;
-    }
-#endif
-
-    mb_x = s->mb_x;
-    mb_y = s->mb_y;
-
-    if(s->avctx->debug&FF_DEBUG_DCT_COEFF) {
-       /* save DCT coefficients */
-       int i,j;
-       DCTELEM *dct = &s->current_picture.dct_coeff[mb_xy*64*6];
-       for(i=0; i<6; i++)
-           for(j=0; j<64; j++)
-               *dct++ = block[i][s->dsp.idct_permutation[j]];
-    }
-
-    s->current_picture.qscale_table[mb_xy]= s->qscale;
-
-    /* update DC predictors for P macroblocks */
-    if (!s->mb_intra) {
-        if (s->h263_pred || s->h263_aic) {
-            if(s->mbintra_table[mb_xy])
-                ff_clean_intra_table_entries(s);
-        } else {
-            s->last_dc[0] =
-            s->last_dc[1] =
-            s->last_dc[2] = 128 << s->intra_dc_precision;
-        }
-    }
-    else if (s->h263_pred || s->h263_aic)
-        s->mbintra_table[mb_xy]=1;
-
-    if ((s->flags&CODEC_FLAG_PSNR) || !(s->encoding && (s->intra_only || s->pict_type==B_TYPE))) { //FIXME precalc
-        uint8_t *dest_y, *dest_cb, *dest_cr;
-        int dct_linesize, dct_offset;
-        op_pixels_func (*op_pix)[4];
-        qpel_mc_func (*op_qpix)[16];
-        const int linesize= s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics
-        const int uvlinesize= s->current_picture.linesize[1];
-        const int readable= s->pict_type != B_TYPE || s->encoding || s->avctx->draw_horiz_band || lowres_flag;
-        const int block_size= lowres_flag ? 8>>s->avctx->lowres : 8;
-
-        /* avoid copy if macroblock skipped in last frame too */
-        /* skip only during decoding as we might trash the buffers during encoding a bit */
-        if(!s->encoding){
-            uint8_t *mbskip_ptr = &s->mbskip_table[mb_xy];
-            const int age= s->current_picture.age;
-
-            assert(age);
-
-            if (s->mb_skipped) {
-                s->mb_skipped= 0;
-                assert(s->pict_type!=I_TYPE);
-
-                (*mbskip_ptr) ++; /* indicate that this time we skipped it */
-                if(*mbskip_ptr >99) *mbskip_ptr= 99;
-
-                /* if previous was skipped too, then nothing to do !  */
-                if (*mbskip_ptr >= age && s->current_picture.reference){
-                    return;
-                }
-            } else if(!s->current_picture.reference){
-                (*mbskip_ptr) ++; /* increase counter so the age can be compared cleanly */
-                if(*mbskip_ptr >99) *mbskip_ptr= 99;
-            } else{
-                *mbskip_ptr = 0; /* not skipped */
-            }
-        }
-
-        dct_linesize = linesize << s->interlaced_dct;
-        dct_offset =(s->interlaced_dct)? linesize : linesize*block_size;
-
-        if(readable){
-            dest_y=  s->dest[0];
-            dest_cb= s->dest[1];
-            dest_cr= s->dest[2];
-        }else{
-            dest_y = s->b_scratchpad;
-            dest_cb= s->b_scratchpad+16*linesize;
-            dest_cr= s->b_scratchpad+32*linesize;
-        }
-
-        if (!s->mb_intra) {
-            /* motion handling */
-            /* decoding or more than one mb_type (MC was already done otherwise) */
-            if(!s->encoding){
-                if(lowres_flag){
-                    h264_chroma_mc_func *op_pix = s->dsp.put_h264_chroma_pixels_tab;
-
-                    if (s->mv_dir & MV_DIR_FORWARD) {
-                        MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix);
-                        op_pix = s->dsp.avg_h264_chroma_pixels_tab;
-                    }
-                    if (s->mv_dir & MV_DIR_BACKWARD) {
-                        MPV_motion_lowres(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix);
-                    }
-                }else{
-                    op_qpix= s->me.qpel_put;
-                    if ((!s->no_rounding) || s->pict_type==B_TYPE){
-                        op_pix = s->dsp.put_pixels_tab;
-                    }else{
-                        op_pix = s->dsp.put_no_rnd_pixels_tab;
-                    }
-                    if (s->mv_dir & MV_DIR_FORWARD) {
-                        MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);
-                        op_pix = s->dsp.avg_pixels_tab;
-                        op_qpix= s->me.qpel_avg;
-                    }
-                    if (s->mv_dir & MV_DIR_BACKWARD) {
-                        MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);
-                    }
-                }
-            }
-
-            /* skip dequant / idct if we are really late ;) */
-            if(s->hurry_up>1) goto skip_idct;
-            if(s->avctx->skip_idct){
-                if(  (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == B_TYPE)
-                   ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != I_TYPE)
-                   || s->avctx->skip_idct >= AVDISCARD_ALL)
-                    goto skip_idct;
-            }
-
-            /* add dct residue */
-            if(s->encoding || !(   s->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO
-                                || (s->codec_id==CODEC_ID_MPEG4 && !s->mpeg_quant))){
-                add_dequant_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
-                add_dequant_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
-                add_dequant_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
-                add_dequant_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
-
-                if(!(s->flags&CODEC_FLAG_GRAY)){
-                    if (s->chroma_y_shift){
-                        add_dequant_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
-                    }else{
-                        dct_linesize >>= 1;
-                        dct_offset >>=1;
-                        add_dequant_dct(s, block[4], 4, dest_cb,              dct_linesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[5], 5, dest_cr,              dct_linesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
-                        add_dequant_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
-                    }
-                }
-            } else if(s->codec_id != CODEC_ID_WMV2){
-                add_dct(s, block[0], 0, dest_y                          , dct_linesize);
-                add_dct(s, block[1], 1, dest_y              + block_size, dct_linesize);
-                add_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize);
-                add_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize);
-
-                if(!(s->flags&CODEC_FLAG_GRAY)){
-                    if(s->chroma_y_shift){//Chroma420
-                        add_dct(s, block[4], 4, dest_cb, uvlinesize);
-                        add_dct(s, block[5], 5, dest_cr, uvlinesize);
-                    }else{
-                        //chroma422
-                        dct_linesize = uvlinesize << s->interlaced_dct;
-                        dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*8;
-
-                        add_dct(s, block[4], 4, dest_cb, dct_linesize);
-                        add_dct(s, block[5], 5, dest_cr, dct_linesize);
-                        add_dct(s, block[6], 6, dest_cb+dct_offset, dct_linesize);
-                        add_dct(s, block[7], 7, dest_cr+dct_offset, dct_linesize);
-                        if(!s->chroma_x_shift){//Chroma444
-                            add_dct(s, block[8], 8, dest_cb+8, dct_linesize);
-                            add_dct(s, block[9], 9, dest_cr+8, dct_linesize);
-                            add_dct(s, block[10], 10, dest_cb+8+dct_offset, dct_linesize);
-                            add_dct(s, block[11], 11, dest_cr+8+dct_offset, dct_linesize);
-                        }
-                    }
-                }//fi gray
-            }
-            else{
-                ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);
-            }
-        } else {
-            /* dct only in intra block */
-            if(s->encoding || !(s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO)){
-                put_dct(s, block[0], 0, dest_y                          , dct_linesize, s->qscale);
-                put_dct(s, block[1], 1, dest_y              + block_size, dct_linesize, s->qscale);
-                put_dct(s, block[2], 2, dest_y + dct_offset             , dct_linesize, s->qscale);
-                put_dct(s, block[3], 3, dest_y + dct_offset + block_size, dct_linesize, s->qscale);
-
-                if(!(s->flags&CODEC_FLAG_GRAY)){
-                    if(s->chroma_y_shift){
-                        put_dct(s, block[4], 4, dest_cb, uvlinesize, s->chroma_qscale);
-                        put_dct(s, block[5], 5, dest_cr, uvlinesize, s->chroma_qscale);
-                    }else{
-                        dct_offset >>=1;
-                        dct_linesize >>=1;
-                        put_dct(s, block[4], 4, dest_cb,              dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[5], 5, dest_cr,              dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[6], 6, dest_cb + dct_offset, dct_linesize, s->chroma_qscale);
-                        put_dct(s, block[7], 7, dest_cr + dct_offset, dct_linesize, s->chroma_qscale);
-                    }
-                }
-            }else{
-                s->dsp.idct_put(dest_y                          , dct_linesize, block[0]);
-                s->dsp.idct_put(dest_y              + block_size, dct_linesize, block[1]);
-                s->dsp.idct_put(dest_y + dct_offset             , dct_linesize, block[2]);
-                s->dsp.idct_put(dest_y + dct_offset + block_size, dct_linesize, block[3]);
-
-                if(!(s->flags&CODEC_FLAG_GRAY)){
-                    if(s->chroma_y_shift){
-                        s->dsp.idct_put(dest_cb, uvlinesize, block[4]);
-                        s->dsp.idct_put(dest_cr, uvlinesize, block[5]);
-                    }else{
-
-                        dct_linesize = uvlinesize << s->interlaced_dct;
-                        dct_offset =(s->interlaced_dct)? uvlinesize : uvlinesize*8;
-
-                        s->dsp.idct_put(dest_cb,              dct_linesize, block[4]);
-                        s->dsp.idct_put(dest_cr,              dct_linesize, block[5]);
-                        s->dsp.idct_put(dest_cb + dct_offset, dct_linesize, block[6]);
-                        s->dsp.idct_put(dest_cr + dct_offset, dct_linesize, block[7]);
-                        if(!s->chroma_x_shift){//Chroma444
-                            s->dsp.idct_put(dest_cb + 8,              dct_linesize, block[8]);
-                            s->dsp.idct_put(dest_cr + 8,              dct_linesize, block[9]);
-                            s->dsp.idct_put(dest_cb + 8 + dct_offset, dct_linesize, block[10]);
-                            s->dsp.idct_put(dest_cr + 8 + dct_offset, dct_linesize, block[11]);
-                        }
-                    }
-                }//gray
-            }
-        }
-skip_idct:
-        if(!readable){
-            s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y ,   linesize,16);
-            s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift);
-            s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift);
-        }
-    }
-}
-
-void MPV_decode_mb(MpegEncContext *s, DCTELEM block[12][64]){
-    if(s->avctx->lowres) MPV_decode_mb_internal(s, block, 1);
-    else                  MPV_decode_mb_internal(s, block, 0);
-}
-
-#ifdef CONFIG_ENCODERS
-
-static inline void dct_single_coeff_elimination(MpegEncContext *s, int n, int threshold)
-{
-    static const char tab[64]=
-        {3,2,2,1,1,1,1,1,
-         1,1,1,1,1,1,1,1,
-         1,1,1,1,1,1,1,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};
-    int score=0;
-    int run=0;
-    int i;
-    DCTELEM *block= s->block[n];
-    const int last_index= s->block_last_index[n];
-    int skip_dc;
-
-    if(threshold<0){
-        skip_dc=0;
-        threshold= -threshold;
-    }else
-        skip_dc=1;
-
-    /* are all which we could set to zero are allready zero? */
-    if(last_index<=skip_dc - 1) return;
-
-    for(i=0; i<=last_index; i++){
-        const int j = s->intra_scantable.permutated[i];
-        const int level = FFABS(block[j]);
-        if(level==1){
-            if(skip_dc && i==0) continue;
-            score+= tab[run];
-            run=0;
-        }else if(level>1){
-            return;
-        }else{
-            run++;
-        }
-    }
-    if(score >= threshold) return;
-    for(i=skip_dc; i<=last_index; i++){
-        const int j = s->intra_scantable.permutated[i];
-        block[j]=0;
-    }
-    if(block[0]) s->block_last_index[n]= 0;
-    else         s->block_last_index[n]= -1;
-}
-
-static inline void clip_coeffs(MpegEncContext *s, DCTELEM *block, int last_index)
-{
-    int i;
-    const int maxlevel= s->max_qcoeff;
-    const int minlevel= s->min_qcoeff;
-    int overflow=0;
-
-    if(s->mb_intra){
-        i=1; //skip clipping of intra dc
-    }else
-        i=0;
-
-    for(;i<=last_index; i++){
-        const int j= s->intra_scantable.permutated[i];
-        int level = block[j];
-
-        if     (level>maxlevel){
-            level=maxlevel;
-            overflow++;
-        }else if(level<minlevel){
-            level=minlevel;
-            overflow++;
-        }
-
-        block[j]= level;
-    }
-
-    if(overflow && s->avctx->mb_decision == FF_MB_DECISION_SIMPLE)
-        av_log(s->avctx, AV_LOG_INFO, "warning, clipping %d dct coefficients to %d..%d\n", overflow, minlevel, maxlevel);
-}
-
-#endif //CONFIG_ENCODERS
-
-/**
- *
- * @param h is the normal height, this will be reduced automatically if needed for the last row
- */
-void ff_draw_horiz_band(MpegEncContext *s, int y, int h){
-    if (s->avctx->draw_horiz_band) {
-        AVFrame *src;
-        int offset[4];
-
-        if(s->picture_structure != PICT_FRAME){
-            h <<= 1;
-            y <<= 1;
-            if(s->first_field  && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return;
-        }
-
-        h= FFMIN(h, s->avctx->height - y);
-
-        if(s->pict_type==B_TYPE || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER))
-            src= (AVFrame*)s->current_picture_ptr;
-        else if(s->last_picture_ptr)
-            src= (AVFrame*)s->last_picture_ptr;
-        else
-            return;
-
-        if(s->pict_type==B_TYPE && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264){
-            offset[0]=
-            offset[1]=
-            offset[2]=
-            offset[3]= 0;
-        }else{
-            offset[0]= y * s->linesize;;
-            offset[1]=
-            offset[2]= (y >> s->chroma_y_shift) * s->uvlinesize;
-            offset[3]= 0;
-        }
-
-        emms_c();
-
-        s->avctx->draw_horiz_band(s->avctx, src, offset,
-                                  y, s->picture_structure, h);
-    }
-}
-
-void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
-    const int linesize= s->current_picture.linesize[0]; //not s->linesize as this would be wrong for field pics
-    const int uvlinesize= s->current_picture.linesize[1];
-    const int mb_size= 4 - s->avctx->lowres;
-
-    s->block_index[0]= s->b8_stride*(s->mb_y*2    ) - 2 + s->mb_x*2;
-    s->block_index[1]= s->b8_stride*(s->mb_y*2    ) - 1 + s->mb_x*2;
-    s->block_index[2]= s->b8_stride*(s->mb_y*2 + 1) - 2 + s->mb_x*2;
-    s->block_index[3]= s->b8_stride*(s->mb_y*2 + 1) - 1 + s->mb_x*2;
-    s->block_index[4]= s->mb_stride*(s->mb_y + 1)                + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
-    s->block_index[5]= s->mb_stride*(s->mb_y + s->mb_height + 2) + s->b8_stride*s->mb_height*2 + s->mb_x - 1;
-    //block_index is not used by mpeg2, so it is not affected by chroma_format
-
-    s->dest[0] = s->current_picture.data[0] + ((s->mb_x - 1) << mb_size);
-    s->dest[1] = s->current_picture.data[1] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift));
-    s->dest[2] = s->current_picture.data[2] + ((s->mb_x - 1) << (mb_size - s->chroma_x_shift));
-
-    if(!(s->pict_type==B_TYPE && s->avctx->draw_horiz_band && s->picture_structure==PICT_FRAME))
-    {
-        s->dest[0] += s->mb_y *   linesize << mb_size;
-        s->dest[1] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);
-        s->dest[2] += s->mb_y * uvlinesize << (mb_size - s->chroma_y_shift);
-    }
-}
-
-#ifdef CONFIG_ENCODERS
-
-static void get_vissual_weight(int16_t *weight, uint8_t *ptr, int stride){
-    int x, y;
-//FIXME optimize
-    for(y=0; y<8; y++){
-        for(x=0; x<8; x++){
-            int x2, y2;
-            int sum=0;
-            int sqr=0;
-            int count=0;
-
-            for(y2= FFMAX(y-1, 0); y2 < FFMIN(8, y+2); y2++){
-                for(x2= FFMAX(x-1, 0); x2 < FFMIN(8, x+2); x2++){
-                    int v= ptr[x2 + y2*stride];
-                    sum += v;
-                    sqr += v*v;
-                    count++;
-                }
-            }
-            weight[x + 8*y]= (36*ff_sqrt(count*sqr - sum*sum)) / count;
-        }
-    }
-}
-
-static always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count)
-{
-    int16_t weight[8][64];
-    DCTELEM orig[8][64];
-    const int mb_x= s->mb_x;
-    const int mb_y= s->mb_y;
-    int i;
-    int skip_dct[8];
-    int dct_offset   = s->linesize*8; //default for progressive frames
-    uint8_t *ptr_y, *ptr_cb, *ptr_cr;
-    int wrap_y, wrap_c;
-
-    for(i=0; i<mb_block_count; i++) skip_dct[i]=0;
-
-    if(s->adaptive_quant){
-        const int last_qp= s->qscale;
-        const int mb_xy= mb_x + mb_y*s->mb_stride;
-
-        s->lambda= s->lambda_table[mb_xy];
-        update_qscale(s);
-
-        if(!(s->flags&CODEC_FLAG_QP_RD)){
-            s->dquant= s->qscale - last_qp;
-
-            if(s->out_format==FMT_H263){
-                s->dquant= clip(s->dquant, -2, 2); //FIXME RD
-
-                if(s->codec_id==CODEC_ID_MPEG4){
-                    if(!s->mb_intra){
-                        if(s->pict_type == B_TYPE){
-                            if(s->dquant&1)
-                                s->dquant= (s->dquant/2)*2;
-                            if(s->mv_dir&MV_DIRECT)
-                                s->dquant= 0;
-                        }
-                        if(s->mv_type==MV_TYPE_8X8)
-                            s->dquant=0;
-                    }
-                }
-            }
-        }
-        ff_set_qscale(s, last_qp + s->dquant);
-    }else if(s->flags&CODEC_FLAG_QP_RD)
-        ff_set_qscale(s, s->qscale + s->dquant);
-
-    wrap_y = s->linesize;
-    wrap_c = s->uvlinesize;
-    ptr_y = s->new_picture.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16;
-    ptr_cb = s->new_picture.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
-    ptr_cr = s->new_picture.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
-
-    if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){
-        uint8_t *ebuf= s->edge_emu_buffer + 32;
-        ff_emulated_edge_mc(ebuf            , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width   , s->height);
-        ptr_y= ebuf;
-        ff_emulated_edge_mc(ebuf+18*wrap_y  , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
-        ptr_cb= ebuf+18*wrap_y;
-        ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
-        ptr_cr= ebuf+18*wrap_y+8;
-    }
-
-    if (s->mb_intra) {
-        if(s->flags&CODEC_FLAG_INTERLACED_DCT){
-            int progressive_score, interlaced_score;
-
-            s->interlaced_dct=0;
-            progressive_score= s->dsp.ildct_cmp[4](s, ptr_y           , NULL, wrap_y, 8)
-                              +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y*8, NULL, wrap_y, 8) - 400;
-
-            if(progressive_score > 0){
-                interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y           , NULL, wrap_y*2, 8)
-                                  +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y  , NULL, wrap_y*2, 8);
-                if(progressive_score > interlaced_score){
-                    s->interlaced_dct=1;
-
-                    dct_offset= wrap_y;
-                    wrap_y<<=1;
-                    if (s->chroma_format == CHROMA_422)
-                        wrap_c<<=1;
-                }
-            }
-        }
-
-        s->dsp.get_pixels(s->block[0], ptr_y                 , wrap_y);
-        s->dsp.get_pixels(s->block[1], ptr_y              + 8, wrap_y);
-        s->dsp.get_pixels(s->block[2], ptr_y + dct_offset    , wrap_y);
-        s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y);
-
-        if(s->flags&CODEC_FLAG_GRAY){
-            skip_dct[4]= 1;
-            skip_dct[5]= 1;
-        }else{
-            s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c);
-            s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c);
-            if(!s->chroma_y_shift){ /* 422 */
-                s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c);
-                s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c);
-            }
-        }
-    }else{
-        op_pixels_func (*op_pix)[4];
-        qpel_mc_func (*op_qpix)[16];
-        uint8_t *dest_y, *dest_cb, *dest_cr;
-
-        dest_y  = s->dest[0];
-        dest_cb = s->dest[1];
-        dest_cr = s->dest[2];
-
-        if ((!s->no_rounding) || s->pict_type==B_TYPE){
-            op_pix = s->dsp.put_pixels_tab;
-            op_qpix= s->dsp.put_qpel_pixels_tab;
-        }else{
-            op_pix = s->dsp.put_no_rnd_pixels_tab;
-            op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab;
-        }
-
-        if (s->mv_dir & MV_DIR_FORWARD) {
-            MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);
-            op_pix = s->dsp.avg_pixels_tab;
-            op_qpix= s->dsp.avg_qpel_pixels_tab;
-        }
-        if (s->mv_dir & MV_DIR_BACKWARD) {
-            MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);
-        }
-
-        if(s->flags&CODEC_FLAG_INTERLACED_DCT){
-            int progressive_score, interlaced_score;
-
-            s->interlaced_dct=0;
-            progressive_score= s->dsp.ildct_cmp[0](s, dest_y           , ptr_y           , wrap_y, 8)
-                              +s->dsp.ildct_cmp[0](s, dest_y + wrap_y*8, ptr_y + wrap_y*8, wrap_y, 8) - 400;
-
-            if(s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400;
-
-            if(progressive_score>0){
-                interlaced_score = s->dsp.ildct_cmp[0](s, dest_y           , ptr_y           , wrap_y*2, 8)
-                                  +s->dsp.ildct_cmp[0](s, dest_y + wrap_y  , ptr_y + wrap_y  , wrap_y*2, 8);
-
-                if(progressive_score > interlaced_score){
-                    s->interlaced_dct=1;
-
-                    dct_offset= wrap_y;
-                    wrap_y<<=1;
-                    if (s->chroma_format == CHROMA_422)
-                        wrap_c<<=1;
-                }
-            }
-        }
-
-        s->dsp.diff_pixels(s->block[0], ptr_y                 , dest_y                 , wrap_y);
-        s->dsp.diff_pixels(s->block[1], ptr_y              + 8, dest_y              + 8, wrap_y);
-        s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset    , dest_y + dct_offset    , wrap_y);
-        s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y);
-
-        if(s->flags&CODEC_FLAG_GRAY){
-            skip_dct[4]= 1;
-            skip_dct[5]= 1;
-        }else{
-            s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c);
-            s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c);
-            if(!s->chroma_y_shift){ /* 422 */
-                s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c);
-                s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c);
-            }
-        }
-        /* pre quantization */
-        if(s->current_picture.mc_mb_var[s->mb_stride*mb_y+ mb_x]<2*s->qscale*s->qscale){
-            //FIXME optimize
-            if(s->dsp.sad[1](NULL, ptr_y               , dest_y               , wrap_y, 8) < 20*s->qscale) skip_dct[0]= 1;
-            if(s->dsp.sad[1](NULL, ptr_y            + 8, dest_y            + 8, wrap_y, 8) < 20*s->qscale) skip_dct[1]= 1;
-            if(s->dsp.sad[1](NULL, ptr_y +dct_offset   , dest_y +dct_offset   , wrap_y, 8) < 20*s->qscale) skip_dct[2]= 1;
-            if(s->dsp.sad[1](NULL, ptr_y +dct_offset+ 8, dest_y +dct_offset+ 8, wrap_y, 8) < 20*s->qscale) skip_dct[3]= 1;
-            if(s->dsp.sad[1](NULL, ptr_cb              , dest_cb              , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1;
-            if(s->dsp.sad[1](NULL, ptr_cr              , dest_cr              , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1;
-            if(!s->chroma_y_shift){ /* 422 */
-                if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1;
-                if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1;
-            }
-        }
-    }
-
-    if(s->avctx->quantizer_noise_shaping){
-        if(!skip_dct[0]) get_vissual_weight(weight[0], ptr_y                 , wrap_y);
-        if(!skip_dct[1]) get_vissual_weight(weight[1], ptr_y              + 8, wrap_y);
-        if(!skip_dct[2]) get_vissual_weight(weight[2], ptr_y + dct_offset    , wrap_y);
-        if(!skip_dct[3]) get_vissual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y);
-        if(!skip_dct[4]) get_vissual_weight(weight[4], ptr_cb                , wrap_c);
-        if(!skip_dct[5]) get_vissual_weight(weight[5], ptr_cr                , wrap_c);
-        if(!s->chroma_y_shift){ /* 422 */
-            if(!skip_dct[6]) get_vissual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c);
-            if(!skip_dct[7]) get_vissual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c);
-        }
-        memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count);
-    }
-
-    /* DCT & quantize */
-    assert(s->out_format!=FMT_MJPEG || s->qscale==8);
-    {
-        for(i=0;i<mb_block_count;i++) {
-            if(!skip_dct[i]){
-                int overflow;
-                s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow);
-            // FIXME we could decide to change to quantizer instead of clipping
-            // JS: I don't think that would be a good idea it could lower quality instead
-            //     of improve it. Just INTRADC clipping deserves changes in quantizer
-                if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]);
-            }else
-                s->block_last_index[i]= -1;
-        }
-        if(s->avctx->quantizer_noise_shaping){
-            for(i=0;i<mb_block_count;i++) {
-                if(!skip_dct[i]){
-                    s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale);
-                }
-            }
-        }
-
-        if(s->luma_elim_threshold && !s->mb_intra)
-            for(i=0; i<4; i++)
-                dct_single_coeff_elimination(s, i, s->luma_elim_threshold);
-        if(s->chroma_elim_threshold && !s->mb_intra)
-            for(i=4; i<mb_block_count; i++)
-                dct_single_coeff_elimination(s, i, s->chroma_elim_threshold);
-
-        if(s->flags & CODEC_FLAG_CBP_RD){
-            for(i=0;i<mb_block_count;i++) {
-                if(s->block_last_index[i] == -1)
-                    s->coded_score[i]= INT_MAX/256;
-            }
-        }
-    }
-
-    if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){
-        s->block_last_index[4]=
-        s->block_last_index[5]= 0;
-        s->block[4][0]=
-        s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale;
-    }
-
-    //non c quantize code returns incorrect block_last_index FIXME
-    if(s->alternate_scan && s->dct_quantize != dct_quantize_c){
-        for(i=0; i<mb_block_count; i++){
-            int j;
-            if(s->block_last_index[i]>0){
-                for(j=63; j>0; j--){
-                    if(s->block[i][ s->intra_scantable.permutated[j] ]) break;
-                }
-                s->block_last_index[i]= j;
-            }
-        }
-    }
-
-    /* huffman encode */
-    switch(s->codec_id){ //FIXME funct ptr could be slightly faster
-    case CODEC_ID_MPEG1VIDEO:
-    case CODEC_ID_MPEG2VIDEO:
-        mpeg1_encode_mb(s, s->block, motion_x, motion_y); break;
-    case CODEC_ID_MPEG4:
-        mpeg4_encode_mb(s, s->block, motion_x, motion_y); break;
-    case CODEC_ID_MSMPEG4V2:
-    case CODEC_ID_MSMPEG4V3:
-    case CODEC_ID_WMV1:
-        msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break;
-    case CODEC_ID_WMV2:
-         ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break;
-#ifdef CONFIG_H261_ENCODER
-    case CODEC_ID_H261:
-        ff_h261_encode_mb(s, s->block, motion_x, motion_y); break;
-#endif
-    case CODEC_ID_H263:
-    case CODEC_ID_H263P:
-    case CODEC_ID_FLV1:
-    case CODEC_ID_RV10:
-    case CODEC_ID_RV20:
-        h263_encode_mb(s, s->block, motion_x, motion_y); break;
-    case CODEC_ID_MJPEG:
-        mjpeg_encode_mb(s, s->block); break;
-    default:
-        assert(0);
-    }
-}
-
-static always_inline void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
-{
-    if (s->chroma_format == CHROMA_420) encode_mb_internal(s, motion_x, motion_y,  8, 6);
-    else                                encode_mb_internal(s, motion_x, motion_y, 16, 8);
-}
-
-#endif //CONFIG_ENCODERS
-
-void ff_mpeg_flush(AVCodecContext *avctx){
-    int i;
-    MpegEncContext *s = avctx->priv_data;
-
-    if(s==NULL || s->picture==NULL)
-        return;
-
-    for(i=0; i<MAX_PICTURE_COUNT; i++){
-       if(s->picture[i].data[0] && (   s->picture[i].type == FF_BUFFER_TYPE_INTERNAL
-                                    || s->picture[i].type == FF_BUFFER_TYPE_USER))
-        avctx->release_buffer(avctx, (AVFrame*)&s->picture[i]);
-    }
-    s->current_picture_ptr = s->last_picture_ptr = s->next_picture_ptr = NULL;
-
-    s->mb_x= s->mb_y= 0;
-
-    s->parse_context.state= -1;
-    s->parse_context.frame_start_found= 0;
-    s->parse_context.overread= 0;
-    s->parse_context.overread_index= 0;
-    s->parse_context.index= 0;
-    s->parse_context.last_index= 0;
-    s->bitstream_buffer_size=0;
-}
-
-#ifdef CONFIG_ENCODERS
-void ff_copy_bits(PutBitContext *pb, uint8_t *src, int length)
-{
-    const uint16_t *srcw= (uint16_t*)src;
-    int words= length>>4;
-    int bits= length&15;
-    int i;
-
-    if(length==0) return;
-
-    if(words < 16){
-        for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i]));
-    }else if(put_bits_count(pb)&7){
-        for(i=0; i<words; i++) put_bits(pb, 16, be2me_16(srcw[i]));
-    }else{
-        for(i=0; put_bits_count(pb)&31; i++)
-            put_bits(pb, 8, src[i]);
-        flush_put_bits(pb);
-        memcpy(pbBufPtr(pb), src+i, 2*words-i);
-        skip_put_bytes(pb, 2*words-i);
-    }
-
-    put_bits(pb, bits, be2me_16(srcw[words])>>(16-bits));
-}
-
-static inline void copy_context_before_encode(MpegEncContext *d, MpegEncContext *s, int type){
-    int i;
-
-    memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop?
-
-    /* mpeg1 */
-    d->mb_skip_run= s->mb_skip_run;
-    for(i=0; i<3; i++)
-        d->last_dc[i]= s->last_dc[i];
-
-    /* statistics */
-    d->mv_bits= s->mv_bits;
-    d->i_tex_bits= s->i_tex_bits;
-    d->p_tex_bits= s->p_tex_bits;
-    d->i_count= s->i_count;
-    d->f_count= s->f_count;
-    d->b_count= s->b_count;
-    d->skip_count= s->skip_count;
-    d->misc_bits= s->misc_bits;
-    d->last_bits= 0;
-
-    d->mb_skipped= 0;
-    d->qscale= s->qscale;
-    d->dquant= s->dquant;
-}
-
-static inline void copy_context_after_encode(MpegEncContext *d, MpegEncContext *s, int type){
-    int i;
-
-    memcpy(d->mv, s->mv, 2*4*2*sizeof(int));
-    memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop?
-
-    /* mpeg1 */
-    d->mb_skip_run= s->mb_skip_run;
-    for(i=0; i<3; i++)
-        d->last_dc[i]= s->last_dc[i];
-
-    /* statistics */
-    d->mv_bits= s->mv_bits;
-    d->i_tex_bits= s->i_tex_bits;
-    d->p_tex_bits= s->p_tex_bits;
-    d->i_count= s->i_count;
-    d->f_count= s->f_count;
-    d->b_count= s->b_count;
-    d->skip_count= s->skip_count;
-    d->misc_bits= s->misc_bits;
-
-    d->mb_intra= s->mb_intra;
-    d->mb_skipped= s->mb_skipped;
-    d->mv_type= s->mv_type;
-    d->mv_dir= s->mv_dir;
-    d->pb= s->pb;
-    if(s->data_partitioning){
-        d->pb2= s->pb2;
-        d->tex_pb= s->tex_pb;
-    }
-    d->block= s->block;
-    for(i=0; i<8; i++)
-        d->block_last_index[i]= s->block_last_index[i];
-    d->interlaced_dct= s->interlaced_dct;
-    d->qscale= s->qscale;
-}
-
-static inline void encode_mb_hq(MpegEncContext *s, MpegEncContext *backup, MpegEncContext *best, int type,
-                           PutBitContext pb[2], PutBitContext pb2[2], PutBitContext tex_pb[2],
-                           int *dmin, int *next_block, int motion_x, int motion_y)
-{
-    int score;
-    uint8_t *dest_backup[3];
-
-    copy_context_before_encode(s, backup, type);
-
-    s->block= s->blocks[*next_block];
-    s->pb= pb[*next_block];
-    if(s->data_partitioning){
-        s->pb2   = pb2   [*next_block];
-        s->tex_pb= tex_pb[*next_block];
-    }
-
-    if(*next_block){
-        memcpy(dest_backup, s->dest, sizeof(s->dest));
-        s->dest[0] = s->rd_scratchpad;
-        s->dest[1] = s->rd_scratchpad + 16*s->linesize;
-        s->dest[2] = s->rd_scratchpad + 16*s->linesize + 8;
-        assert(s->linesize >= 32); //FIXME
-    }
-
-    encode_mb(s, motion_x, motion_y);
-
-    score= put_bits_count(&s->pb);
-    if(s->data_partitioning){
-        score+= put_bits_count(&s->pb2);
-        score+= put_bits_count(&s->tex_pb);
-    }
-
-    if(s->avctx->mb_decision == FF_MB_DECISION_RD){
-        MPV_decode_mb(s, s->block);
-
-        score *= s->lambda2;
-        score += sse_mb(s) << FF_LAMBDA_SHIFT;
-    }
-
-    if(*next_block){
-        memcpy(s->dest, dest_backup, sizeof(s->dest));
-    }
-
-    if(score<*dmin){
-        *dmin= score;
-        *next_block^=1;
-
-        copy_context_after_encode(best, s, type);
-    }
-}
-
-static int sse(MpegEncContext *s, uint8_t *src1, uint8_t *src2, int w, int h, int stride){
-    uint32_t *sq = squareTbl + 256;
-    int acc=0;
-    int x,y;
-
-    if(w==16 && h==16)
-        return s->dsp.sse[0](NULL, src1, src2, stride, 16);
-    else if(w==8 && h==8)
-        return s->dsp.sse[1](NULL, src1, src2, stride, 8);
-
-    for(y=0; y<h; y++){
-        for(x=0; x<w; x++){
-            acc+= sq[src1[x + y*stride] - src2[x + y*stride]];
-        }
-    }
-
-    assert(acc>=0);
-
-    return acc;
-}
-
-static int sse_mb(MpegEncContext *s){
-    int w= 16;
-    int h= 16;
-
-    if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16;
-    if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16;
-
-    if(w==16 && h==16)
-      if(s->avctx->mb_cmp == FF_CMP_NSSE){
-        return  s->dsp.nsse[0](s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16)
-               +s->dsp.nsse[1](s, s->new_picture.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8)
-               +s->dsp.nsse[1](s, s->new_picture.data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8);
-      }else{
-        return  s->dsp.sse[0](NULL, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], s->linesize, 16)
-               +s->dsp.sse[1](NULL, s->new_picture.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[1], s->uvlinesize, 8)
-               +s->dsp.sse[1](NULL, s->new_picture.data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[2], s->uvlinesize, 8);
-      }
-    else
-        return  sse(s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], w, h, s->linesize)
-               +sse(s, s->new_picture.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[1], w>>1, h>>1, s->uvlinesize)
-               +sse(s, s->new_picture.data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,s->dest[2], w>>1, h>>1, s->uvlinesize);
-}
-
-static int pre_estimate_motion_thread(AVCodecContext *c, void *arg){
-    MpegEncContext *s= arg;
-
-
-    s->me.pre_pass=1;
-    s->me.dia_size= s->avctx->pre_dia_size;
-    s->first_slice_line=1;
-    for(s->mb_y= s->end_mb_y-1; s->mb_y >= s->start_mb_y; s->mb_y--) {
-        for(s->mb_x=s->mb_width-1; s->mb_x >=0 ;s->mb_x--) {
-            ff_pre_estimate_p_frame_motion(s, s->mb_x, s->mb_y);
-        }
-        s->first_slice_line=0;
-    }
-
-    s->me.pre_pass=0;
-
-    return 0;
-}
-
-static int estimate_motion_thread(AVCodecContext *c, void *arg){
-    MpegEncContext *s= arg;
-
-    s->me.dia_size= s->avctx->dia_size;
-    s->first_slice_line=1;
-    for(s->mb_y= s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) {
-        s->mb_x=0; //for block init below
-        ff_init_block_index(s);
-        for(s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {
-            s->block_index[0]+=2;
-            s->block_index[1]+=2;
-            s->block_index[2]+=2;
-            s->block_index[3]+=2;
-
-            /* compute motion vector & mb_type and store in context */
-            if(s->pict_type==B_TYPE)
-                ff_estimate_b_frame_motion(s, s->mb_x, s->mb_y);
-            else
-                ff_estimate_p_frame_motion(s, s->mb_x, s->mb_y);
-        }
-        s->first_slice_line=0;
-    }
-    return 0;
-}
-
-static int mb_var_thread(AVCodecContext *c, void *arg){
-    MpegEncContext *s= arg;
-    int mb_x, mb_y;
-
-    for(mb_y=s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {
-        for(mb_x=0; mb_x < s->mb_width; mb_x++) {
-            int xx = mb_x * 16;
-            int yy = mb_y * 16;
-            uint8_t *pix = s->new_picture.data[0] + (yy * s->linesize) + xx;
-            int varc;
-            int sum = s->dsp.pix_sum(pix, s->linesize);
-
-            varc = (s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500 + 128)>>8;
-
-            s->current_picture.mb_var [s->mb_stride * mb_y + mb_x] = varc;
-            s->current_picture.mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8;
-            s->me.mb_var_sum_temp    += varc;
-        }
-    }
-    return 0;
-}
-
-static void write_slice_end(MpegEncContext *s){
-    if(s->codec_id==CODEC_ID_MPEG4){
-        if(s->partitioned_frame){
-            ff_mpeg4_merge_partitions(s);
-        }
-
-        ff_mpeg4_stuffing(&s->pb);
-    }else if(s->out_format == FMT_MJPEG){
-        ff_mjpeg_stuffing(&s->pb);
-    }
-
-    align_put_bits(&s->pb);
-    flush_put_bits(&s->pb);
-
-    if((s->flags&CODEC_FLAG_PASS1) && !s->partitioned_frame)
-        s->misc_bits+= get_bits_diff(s);
-}
-
-static int encode_thread(AVCodecContext *c, void *arg){
-    MpegEncContext *s= arg;
-    int mb_x, mb_y, pdif = 0;
-    int i, j;
-    MpegEncContext best_s, backup_s;
-    uint8_t bit_buf[2][MAX_MB_BYTES];
-    uint8_t bit_buf2[2][MAX_MB_BYTES];
-    uint8_t bit_buf_tex[2][MAX_MB_BYTES];
-    PutBitContext pb[2], pb2[2], tex_pb[2];
-//printf("%d->%d\n", s->resync_mb_y, s->end_mb_y);
-
-    for(i=0; i<2; i++){
-        init_put_bits(&pb    [i], bit_buf    [i], MAX_MB_BYTES);
-        init_put_bits(&pb2   [i], bit_buf2   [i], MAX_MB_BYTES);
-        init_put_bits(&tex_pb[i], bit_buf_tex[i], MAX_MB_BYTES);
-    }
-
-    s->last_bits= put_bits_count(&s->pb);
-    s->mv_bits=0;
-    s->misc_bits=0;
-    s->i_tex_bits=0;
-    s->p_tex_bits=0;
-    s->i_count=0;
-    s->f_count=0;
-    s->b_count=0;
-    s->skip_count=0;
-
-    for(i=0; i<3; i++){
-        /* init last dc values */
-        /* note: quant matrix value (8) is implied here */
-        s->last_dc[i] = 128 << s->intra_dc_precision;
-
-        s->current_picture.error[i] = 0;
-    }
-    s->mb_skip_run = 0;
-    memset(s->last_mv, 0, sizeof(s->last_mv));
-
-    s->last_mv_dir = 0;
-
-    switch(s->codec_id){
-    case CODEC_ID_H263:
-    case CODEC_ID_H263P:
-    case CODEC_ID_FLV1:
-        s->gob_index = ff_h263_get_gob_height(s);
-        break;
-    case CODEC_ID_MPEG4:
-        if(s->partitioned_frame)
-            ff_mpeg4_init_partitions(s);
-        break;
-    }
-
-    s->resync_mb_x=0;
-    s->resync_mb_y=0;
-    s->first_slice_line = 1;
-    s->ptr_lastgob = s->pb.buf;
-    for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {
-//    printf("row %d at %X\n", s->mb_y, (int)s);
-        s->mb_x=0;
-        s->mb_y= mb_y;
-
-        ff_set_qscale(s, s->qscale);
-        ff_init_block_index(s);
-
-        for(mb_x=0; mb_x < s->mb_width; mb_x++) {
-            int xy= mb_y*s->mb_stride + mb_x; // removed const, H261 needs to adjust this
-            int mb_type= s->mb_type[xy];
-//            int d;
-            int dmin= INT_MAX;
-            int dir;
-
-            if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){
-                av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-                return -1;
-            }
-            if(s->data_partitioning){
-                if(   s->pb2   .buf_end - s->pb2   .buf - (put_bits_count(&s->    pb2)>>3) < MAX_MB_BYTES
-                   || s->tex_pb.buf_end - s->tex_pb.buf - (put_bits_count(&s->tex_pb )>>3) < MAX_MB_BYTES){
-                    av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-                    return -1;
-                }
-            }
-
-            s->mb_x = mb_x;
-            s->mb_y = mb_y;  // moved into loop, can get changed by H.261
-            ff_update_block_index(s);
-
-#ifdef CONFIG_H261_ENCODER
-            if(s->codec_id == CODEC_ID_H261){
-                ff_h261_reorder_mb_index(s);
-                xy= s->mb_y*s->mb_stride + s->mb_x;
-                mb_type= s->mb_type[xy];
-            }
-#endif
-
-            /* write gob / video packet header  */
-            if(s->rtp_mode){
-                int current_packet_size, is_gob_start;
-
-                current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf);
-
-                is_gob_start= s->avctx->rtp_payload_size && current_packet_size >= s->avctx->rtp_payload_size && mb_y + mb_x>0;
-
-                if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1;
-
-                switch(s->codec_id){
-                case CODEC_ID_H263:
-                case CODEC_ID_H263P:
-                    if(!s->h263_slice_structured)
-                        if(s->mb_x || s->mb_y%s->gob_index) is_gob_start=0;
-                    break;
-                case CODEC_ID_MPEG2VIDEO:
-                    if(s->mb_x==0 && s->mb_y!=0) is_gob_start=1;
-                case CODEC_ID_MPEG1VIDEO:
-                    if(s->mb_skip_run) is_gob_start=0;
-                    break;
-                }
-
-                if(is_gob_start){
-                    if(s->start_mb_y != mb_y || mb_x!=0){
-                        write_slice_end(s);
-
-                        if(s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame){
-                            ff_mpeg4_init_partitions(s);
-                        }
-                    }
-
-                    assert((put_bits_count(&s->pb)&7) == 0);
-                    current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob;
-
-                    if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){
-                        int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y;
-                        int d= 100 / s->avctx->error_rate;
-                        if(r % d == 0){
-                            current_packet_size=0;
-#ifndef ALT_BITSTREAM_WRITER
-                            s->pb.buf_ptr= s->ptr_lastgob;
-#endif
-                            assert(pbBufPtr(&s->pb) == s->ptr_lastgob);
-                        }
-                    }
-
-                    if (s->avctx->rtp_callback){
-                        int number_mb = (mb_y - s->resync_mb_y)*s->mb_width + mb_x - s->resync_mb_x;
-                        s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, number_mb);
-                    }
-
-                    switch(s->codec_id){
-                    case CODEC_ID_MPEG4:
-                        ff_mpeg4_encode_video_packet_header(s);
-                        ff_mpeg4_clean_buffers(s);
-                    break;
-                    case CODEC_ID_MPEG1VIDEO:
-                    case CODEC_ID_MPEG2VIDEO:
-                        ff_mpeg1_encode_slice_header(s);
-                        ff_mpeg1_clean_buffers(s);
-                    break;
-                    case CODEC_ID_H263:
-                    case CODEC_ID_H263P:
-                        h263_encode_gob_header(s, mb_y);
-                    break;
-                    }
-
-                    if(s->flags&CODEC_FLAG_PASS1){
-                        int bits= put_bits_count(&s->pb);
-                        s->misc_bits+= bits - s->last_bits;
-                        s->last_bits= bits;
-                    }
-
-                    s->ptr_lastgob += current_packet_size;
-                    s->first_slice_line=1;
-                    s->resync_mb_x=mb_x;
-                    s->resync_mb_y=mb_y;
-                }
-            }
-
-            if(  (s->resync_mb_x   == s->mb_x)
-               && s->resync_mb_y+1 == s->mb_y){
-                s->first_slice_line=0;
-            }
-
-            s->mb_skipped=0;
-            s->dquant=0; //only for QP_RD
-
-            if(mb_type & (mb_type-1) || (s->flags & CODEC_FLAG_QP_RD)){ // more than 1 MB type possible or CODEC_FLAG_QP_RD
-                int next_block=0;
-                int pb_bits_count, pb2_bits_count, tex_pb_bits_count;
-
-                copy_context_before_encode(&backup_s, s, -1);
-                backup_s.pb= s->pb;
-                best_s.data_partitioning= s->data_partitioning;
-                best_s.partitioned_frame= s->partitioned_frame;
-                if(s->data_partitioning){
-                    backup_s.pb2= s->pb2;
-                    backup_s.tex_pb= s->tex_pb;
-                }
-
-                if(mb_type&CANDIDATE_MB_TYPE_INTER){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 0;
-                    s->mv[0][0][0] = s->p_mv_table[xy][0];
-                    s->mv[0][0][1] = s->p_mv_table[xy][1];
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER, pb, pb2, tex_pb,
-                                 &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_INTER_I){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[0][i] = s->p_field_select_table[i][xy];
-                        s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0];
-                        s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1];
-                    }
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER_I, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_SKIPPED){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 0;
-                    s->mv[0][0][0] = 0;
-                    s->mv[0][0][1] = 0;
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_SKIPPED, pb, pb2, tex_pb,
-                                 &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_INTER4V){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_8X8;
-                    s->mb_intra= 0;
-                    for(i=0; i<4; i++){
-                        s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0];
-                        s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1];
-                    }
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER4V, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_FORWARD){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 0;
-                    s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
-                    s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD, pb, pb2, tex_pb,
-                                 &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_BACKWARD){
-                    s->mv_dir = MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 0;
-                    s->mv[1][0][0] = s->b_back_mv_table[xy][0];
-                    s->mv[1][0][1] = s->b_back_mv_table[xy][1];
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD, pb, pb2, tex_pb,
-                                 &dmin, &next_block, s->mv[1][0][0], s->mv[1][0][1]);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_BIDIR){
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 0;
-                    s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0];
-                    s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1];
-                    s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0];
-                    s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1];
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_DIRECT){
-                    int mx= s->b_direct_mv_table[xy][0];
-                    int my= s->b_direct_mv_table[xy][1];
-
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
-                    s->mb_intra= 0;
-                    ff_mpeg4_set_direct_mv(s, mx, my);
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb,
-                                 &dmin, &next_block, mx, my);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_FORWARD_I){
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[0][i] = s->b_field_select_table[0][i][xy];
-                        s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0];
-                        s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1];
-                    }
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD_I, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_BACKWARD_I){
-                    s->mv_dir = MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[1][i] = s->b_field_select_table[1][i][xy];
-                        s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0];
-                        s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1];
-                    }
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD_I, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_BIDIR_I){
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(dir=0; dir<2; dir++){
-                        for(i=0; i<2; i++){
-                            j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy];
-                            s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0];
-                            s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1];
-                        }
-                    }
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR_I, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                }
-                if(mb_type&CANDIDATE_MB_TYPE_INTRA){
-                    s->mv_dir = 0;
-                    s->mv_type = MV_TYPE_16X16;
-                    s->mb_intra= 1;
-                    s->mv[0][0][0] = 0;
-                    s->mv[0][0][1] = 0;
-                    encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTRA, pb, pb2, tex_pb,
-                                 &dmin, &next_block, 0, 0);
-                    if(s->h263_pred || s->h263_aic){
-                        if(best_s.mb_intra)
-                            s->mbintra_table[mb_x + mb_y*s->mb_stride]=1;
-                        else
-                            ff_clean_intra_table_entries(s); //old mode?
-                    }
-                }
-
-                if(s->flags & CODEC_FLAG_QP_RD){
-                    if(best_s.mv_type==MV_TYPE_16X16 && !(best_s.mv_dir&MV_DIRECT)){
-                        const int last_qp= backup_s.qscale;
-                        int dquant, dir, qp, dc[6];
-                        DCTELEM ac[6][16];
-                        const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0;
-
-                        assert(backup_s.dquant == 0);
-
-                        //FIXME intra
-                        s->mv_dir= best_s.mv_dir;
-                        s->mv_type = MV_TYPE_16X16;
-                        s->mb_intra= best_s.mb_intra;
-                        s->mv[0][0][0] = best_s.mv[0][0][0];
-                        s->mv[0][0][1] = best_s.mv[0][0][1];
-                        s->mv[1][0][0] = best_s.mv[1][0][0];
-                        s->mv[1][0][1] = best_s.mv[1][0][1];
-
-                        dir= s->pict_type == B_TYPE ? 2 : 1;
-                        if(last_qp + dir > s->avctx->qmax) dir= -dir;
-                        for(dquant= dir; dquant<=2 && dquant>=-2; dquant += dir){
-                            qp= last_qp + dquant;
-                            if(qp < s->avctx->qmin || qp > s->avctx->qmax)
-                                break;
-                            backup_s.dquant= dquant;
-                            if(s->mb_intra && s->dc_val[0]){
-                                for(i=0; i<6; i++){
-                                    dc[i]= s->dc_val[0][ s->block_index[i] ];
-                                    memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(DCTELEM)*16);
-                                }
-                            }
-
-                            encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER /* wrong but unused */, pb, pb2, tex_pb,
-                                         &dmin, &next_block, s->mv[mvdir][0][0], s->mv[mvdir][0][1]);
-                            if(best_s.qscale != qp){
-                                if(s->mb_intra && s->dc_val[0]){
-                                    for(i=0; i<6; i++){
-                                        s->dc_val[0][ s->block_index[i] ]= dc[i];
-                                        memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16);
-                                    }
-                                }
-                                if(dir > 0 && dquant==dir){
-                                    dquant= 0;
-                                    dir= -dir;
-                                }else
-                                    break;
-                            }
-                        }
-                        qp= best_s.qscale;
-                        s->current_picture.qscale_table[xy]= qp;
-                    }
-                }
-
-                copy_context_after_encode(s, &best_s, -1);
-
-                pb_bits_count= put_bits_count(&s->pb);
-                flush_put_bits(&s->pb);
-                ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count);
-                s->pb= backup_s.pb;
-
-                if(s->data_partitioning){
-                    pb2_bits_count= put_bits_count(&s->pb2);
-                    flush_put_bits(&s->pb2);
-                    ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count);
-                    s->pb2= backup_s.pb2;
-
-                    tex_pb_bits_count= put_bits_count(&s->tex_pb);
-                    flush_put_bits(&s->tex_pb);
-                    ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count);
-                    s->tex_pb= backup_s.tex_pb;
-                }
-                s->last_bits= put_bits_count(&s->pb);
-
-                if (s->out_format == FMT_H263 && s->pict_type!=B_TYPE)
-                    ff_h263_update_motion_val(s);
-
-                if(next_block==0){ //FIXME 16 vs linesize16
-                    s->dsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad                     , s->linesize  ,16);
-                    s->dsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize    , s->uvlinesize, 8);
-                    s->dsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8);
-                }
-
-                if(s->avctx->mb_decision == FF_MB_DECISION_BITS)
-                    MPV_decode_mb(s, s->block);
-            } else {
-                int motion_x, motion_y;
-                s->mv_type=MV_TYPE_16X16;
-                // only one MB-Type possible
-
-                switch(mb_type){
-                case CANDIDATE_MB_TYPE_INTRA:
-                    s->mv_dir = 0;
-                    s->mb_intra= 1;
-                    motion_x= s->mv[0][0][0] = 0;
-                    motion_y= s->mv[0][0][1] = 0;
-                    break;
-                case CANDIDATE_MB_TYPE_INTER:
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mb_intra= 0;
-                    motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0];
-                    motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1];
-                    break;
-                case CANDIDATE_MB_TYPE_INTER_I:
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[0][i] = s->p_field_select_table[i][xy];
-                        s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0];
-                        s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1];
-                    }
-                    motion_x = motion_y = 0;
-                    break;
-                case CANDIDATE_MB_TYPE_INTER4V:
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_8X8;
-                    s->mb_intra= 0;
-                    for(i=0; i<4; i++){
-                        s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0];
-                        s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1];
-                    }
-                    motion_x= motion_y= 0;
-                    break;
-                case CANDIDATE_MB_TYPE_DIRECT:
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
-                    s->mb_intra= 0;
-                    motion_x=s->b_direct_mv_table[xy][0];
-                    motion_y=s->b_direct_mv_table[xy][1];
-                    ff_mpeg4_set_direct_mv(s, motion_x, motion_y);
-                    break;
-                case CANDIDATE_MB_TYPE_BIDIR:
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
-                    s->mb_intra= 0;
-                    motion_x=0;
-                    motion_y=0;
-                    s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0];
-                    s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1];
-                    s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0];
-                    s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1];
-                    break;
-                case CANDIDATE_MB_TYPE_BACKWARD:
-                    s->mv_dir = MV_DIR_BACKWARD;
-                    s->mb_intra= 0;
-                    motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0];
-                    motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1];
-                    break;
-                case CANDIDATE_MB_TYPE_FORWARD:
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mb_intra= 0;
-                    motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
-                    motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
-//                    printf(" %d %d ", motion_x, motion_y);
-                    break;
-                case CANDIDATE_MB_TYPE_FORWARD_I:
-                    s->mv_dir = MV_DIR_FORWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[0][i] = s->b_field_select_table[0][i][xy];
-                        s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0];
-                        s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1];
-                    }
-                    motion_x=motion_y=0;
-                    break;
-                case CANDIDATE_MB_TYPE_BACKWARD_I:
-                    s->mv_dir = MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(i=0; i<2; i++){
-                        j= s->field_select[1][i] = s->b_field_select_table[1][i][xy];
-                        s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0];
-                        s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1];
-                    }
-                    motion_x=motion_y=0;
-                    break;
-                case CANDIDATE_MB_TYPE_BIDIR_I:
-                    s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
-                    s->mv_type = MV_TYPE_FIELD;
-                    s->mb_intra= 0;
-                    for(dir=0; dir<2; dir++){
-                        for(i=0; i<2; i++){
-                            j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy];
-                            s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0];
-                            s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1];
-                        }
-                    }
-                    motion_x=motion_y=0;
-                    break;
-                default:
-                    motion_x=motion_y=0; //gcc warning fix
-                    av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n");
-                }
-
-                encode_mb(s, motion_x, motion_y);
-
-                // RAL: Update last macroblock type
-                s->last_mv_dir = s->mv_dir;
-
-                if (s->out_format == FMT_H263 && s->pict_type!=B_TYPE)
-                    ff_h263_update_motion_val(s);
-
-                MPV_decode_mb(s, s->block);
-            }
-
-            /* clean the MV table in IPS frames for direct mode in B frames */
-            if(s->mb_intra /* && I,P,S_TYPE */){
-                s->p_mv_table[xy][0]=0;
-                s->p_mv_table[xy][1]=0;
-            }
-
-            if(s->flags&CODEC_FLAG_PSNR){
-                int w= 16;
-                int h= 16;
-
-                if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16;
-                if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16;
-
-                s->current_picture.error[0] += sse(
-                    s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16,
-                    s->dest[0], w, h, s->linesize);
-                s->current_picture.error[1] += sse(
-                    s, s->new_picture.data[1] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,
-                    s->dest[1], w>>1, h>>1, s->uvlinesize);
-                s->current_picture.error[2] += sse(
-                    s, s->new_picture    .data[2] + s->mb_x*8  + s->mb_y*s->uvlinesize*8,
-                    s->dest[2], w>>1, h>>1, s->uvlinesize);
-            }
-            if(s->loop_filter){
-                if(s->out_format == FMT_H263)
-                    ff_h263_loop_filter(s);
-            }
-//printf("MB %d %d bits\n", s->mb_x+s->mb_y*s->mb_stride, put_bits_count(&s->pb));
-        }
-    }
-
-    //not beautiful here but we must write it before flushing so it has to be here
-    if (s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == I_TYPE)
-        msmpeg4_encode_ext_header(s);
-
-    write_slice_end(s);
-
-    /* Send the last GOB if RTP */
-    if (s->avctx->rtp_callback) {
-        int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x;
-        pdif = pbBufPtr(&s->pb) - s->ptr_lastgob;
-        /* Call the RTP callback to send the last GOB */
-        emms_c();
-        s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb);
-    }
-
-    return 0;
-}
-
-#define MERGE(field) dst->field += src->field; src->field=0
-static void merge_context_after_me(MpegEncContext *dst, MpegEncContext *src){
-    MERGE(me.scene_change_score);
-    MERGE(me.mc_mb_var_sum_temp);
-    MERGE(me.mb_var_sum_temp);
-}
-
-static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src){
-    int i;
-
-    MERGE(dct_count[0]); //note, the other dct vars are not part of the context
-    MERGE(dct_count[1]);
-    MERGE(mv_bits);
-    MERGE(i_tex_bits);
-    MERGE(p_tex_bits);
-    MERGE(i_count);
-    MERGE(f_count);
-    MERGE(b_count);
-    MERGE(skip_count);
-    MERGE(misc_bits);
-    MERGE(error_count);
-    MERGE(padding_bug_score);
-    MERGE(current_picture.error[0]);
-    MERGE(current_picture.error[1]);
-    MERGE(current_picture.error[2]);
-
-    if(dst->avctx->noise_reduction){
-        for(i=0; i<64; i++){
-            MERGE(dct_error_sum[0][i]);
-            MERGE(dct_error_sum[1][i]);
-        }
-    }
-
-    assert(put_bits_count(&src->pb) % 8 ==0);
-    assert(put_bits_count(&dst->pb) % 8 ==0);
-    ff_copy_bits(&dst->pb, src->pb.buf, put_bits_count(&src->pb));
-    flush_put_bits(&dst->pb);
-}
-
-static int estimate_qp(MpegEncContext *s, int dry_run){
-    if (s->next_lambda){
-        s->current_picture_ptr->quality=
-        s->current_picture.quality = s->next_lambda;
-        if(!dry_run) s->next_lambda= 0;
-    } else if (!s->fixed_qscale) {
-        s->current_picture_ptr->quality=
-        s->current_picture.quality = ff_rate_estimate_qscale(s, dry_run);
-        if (s->current_picture.quality < 0)
-            return -1;
-    }
-
-    if(s->adaptive_quant){
-        switch(s->codec_id){
-        case CODEC_ID_MPEG4:
-            ff_clean_mpeg4_qscales(s);
-            break;
-        case CODEC_ID_H263:
-        case CODEC_ID_H263P:
-        case CODEC_ID_FLV1:
-            ff_clean_h263_qscales(s);
-            break;
-        }
-
-        s->lambda= s->lambda_table[0];
-        //FIXME broken
-    }else
-        s->lambda= s->current_picture.quality;
-//printf("%d %d\n", s->avctx->global_quality, s->current_picture.quality);
-    update_qscale(s);
-    return 0;
-}
-
-static int encode_picture(MpegEncContext *s, int picture_number)
-{
-    int i;
-    int bits;
-
-    s->picture_number = picture_number;
-
-    /* Reset the average MB variance */
-    s->me.mb_var_sum_temp    =
-    s->me.mc_mb_var_sum_temp = 0;
-
-    /* we need to initialize some time vars before we can encode b-frames */
-    // RAL: Condition added for MPEG1VIDEO
-    if (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO || (s->h263_pred && !s->h263_msmpeg4))
-        ff_set_mpeg4_time(s, s->picture_number);  //FIXME rename and use has_b_frames or similar
-
-    s->me.scene_change_score=0;
-
-//    s->lambda= s->current_picture_ptr->quality; //FIXME qscale / ... stuff for ME ratedistoration
-
-    if(s->pict_type==I_TYPE){
-        if(s->msmpeg4_version >= 3) s->no_rounding=1;
-        else                        s->no_rounding=0;
-    }else if(s->pict_type!=B_TYPE){
-        if(s->flipflop_rounding || s->codec_id == CODEC_ID_H263P || s->codec_id == CODEC_ID_MPEG4)
-            s->no_rounding ^= 1;
-    }
-
-    if(s->flags & CODEC_FLAG_PASS2){
-        if (estimate_qp(s,1) < 0)
-            return -1;
-        ff_get_2pass_fcode(s);
-    }else if(!(s->flags & CODEC_FLAG_QSCALE)){
-        if(s->pict_type==B_TYPE)
-            s->lambda= s->last_lambda_for[s->pict_type];
-        else
-            s->lambda= s->last_lambda_for[s->last_non_b_pict_type];
-        update_qscale(s);
-    }
-
-    s->mb_intra=0; //for the rate distortion & bit compare functions
-    for(i=1; i<s->avctx->thread_count; i++){
-        ff_update_duplicate_context(s->thread_context[i], s);
-    }
-
-    ff_init_me(s);
-
-    /* Estimate motion for every MB */
-    if(s->pict_type != I_TYPE){
-        s->lambda = (s->lambda * s->avctx->me_penalty_compensation + 128)>>8;
-        s->lambda2= (s->lambda2* s->avctx->me_penalty_compensation + 128)>>8;
-        if(s->pict_type != B_TYPE && s->avctx->me_threshold==0){
-            if((s->avctx->pre_me && s->last_non_b_pict_type==I_TYPE) || s->avctx->pre_me==2){
-                s->avctx->execute(s->avctx, pre_estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count);
-            }
-        }
-
-        s->avctx->execute(s->avctx, estimate_motion_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count);
-    }else /* if(s->pict_type == I_TYPE) */{
-        /* I-Frame */
-        for(i=0; i<s->mb_stride*s->mb_height; i++)
-            s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
-
-        if(!s->fixed_qscale){
-            /* finding spatial complexity for I-frame rate control */
-            s->avctx->execute(s->avctx, mb_var_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count);
-        }
-    }
-    for(i=1; i<s->avctx->thread_count; i++){
-        merge_context_after_me(s, s->thread_context[i]);
-    }
-    s->current_picture.mc_mb_var_sum= s->current_picture_ptr->mc_mb_var_sum= s->me.mc_mb_var_sum_temp;
-    s->current_picture.   mb_var_sum= s->current_picture_ptr->   mb_var_sum= s->me.   mb_var_sum_temp;
-    emms_c();
-
-    if(s->me.scene_change_score > s->avctx->scenechange_threshold && s->pict_type == P_TYPE){
-        s->pict_type= I_TYPE;
-        for(i=0; i<s->mb_stride*s->mb_height; i++)
-            s->mb_type[i]= CANDIDATE_MB_TYPE_INTRA;
-//printf("Scene change detected, encoding as I Frame %d %d\n", s->current_picture.mb_var_sum, s->current_picture.mc_mb_var_sum);
-    }
-
-    if(!s->umvplus){
-        if(s->pict_type==P_TYPE || s->pict_type==S_TYPE) {
-            s->f_code= ff_get_best_fcode(s, s->p_mv_table, CANDIDATE_MB_TYPE_INTER);
-
-            if(s->flags & CODEC_FLAG_INTERLACED_ME){
-                int a,b;
-                a= ff_get_best_fcode(s, s->p_field_mv_table[0][0], CANDIDATE_MB_TYPE_INTER_I); //FIXME field_select
-                b= ff_get_best_fcode(s, s->p_field_mv_table[1][1], CANDIDATE_MB_TYPE_INTER_I);
-                s->f_code= FFMAX(s->f_code, FFMAX(a,b));
-            }
-
-            ff_fix_long_p_mvs(s);
-            ff_fix_long_mvs(s, NULL, 0, s->p_mv_table, s->f_code, CANDIDATE_MB_TYPE_INTER, 0);
-            if(s->flags & CODEC_FLAG_INTERLACED_ME){
-                int j;
-                for(i=0; i<2; i++){
-                    for(j=0; j<2; j++)
-                        ff_fix_long_mvs(s, s->p_field_select_table[i], j,
-                                        s->p_field_mv_table[i][j], s->f_code, CANDIDATE_MB_TYPE_INTER_I, 0);
-                }
-            }
-        }
-
-        if(s->pict_type==B_TYPE){
-            int a, b;
-
-            a = ff_get_best_fcode(s, s->b_forw_mv_table, CANDIDATE_MB_TYPE_FORWARD);
-            b = ff_get_best_fcode(s, s->b_bidir_forw_mv_table, CANDIDATE_MB_TYPE_BIDIR);
-            s->f_code = FFMAX(a, b);
-
-            a = ff_get_best_fcode(s, s->b_back_mv_table, CANDIDATE_MB_TYPE_BACKWARD);
-            b = ff_get_best_fcode(s, s->b_bidir_back_mv_table, CANDIDATE_MB_TYPE_BIDIR);
-            s->b_code = FFMAX(a, b);
-
-            ff_fix_long_mvs(s, NULL, 0, s->b_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_FORWARD, 1);
-            ff_fix_long_mvs(s, NULL, 0, s->b_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BACKWARD, 1);
-            ff_fix_long_mvs(s, NULL, 0, s->b_bidir_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_BIDIR, 1);
-            ff_fix_long_mvs(s, NULL, 0, s->b_bidir_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BIDIR, 1);
-            if(s->flags & CODEC_FLAG_INTERLACED_ME){
-                int dir, j;
-                for(dir=0; dir<2; dir++){
-                    for(i=0; i<2; i++){
-                        for(j=0; j<2; j++){
-                            int type= dir ? (CANDIDATE_MB_TYPE_BACKWARD_I|CANDIDATE_MB_TYPE_BIDIR_I)
-                                          : (CANDIDATE_MB_TYPE_FORWARD_I |CANDIDATE_MB_TYPE_BIDIR_I);
-                            ff_fix_long_mvs(s, s->b_field_select_table[dir][i], j,
-                                            s->b_field_mv_table[dir][i][j], dir ? s->b_code : s->f_code, type, 1);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    if (estimate_qp(s, 0) < 0)
-        return -1;
-
-    if(s->qscale < 3 && s->max_qcoeff<=128 && s->pict_type==I_TYPE && !(s->flags & CODEC_FLAG_QSCALE))
-        s->qscale= 3; //reduce clipping problems
-
-    if (s->out_format == FMT_MJPEG) {
-        /* for mjpeg, we do include qscale in the matrix */
-        s->intra_matrix[0] = ff_mpeg1_default_intra_matrix[0];
-        for(i=1;i<64;i++){
-            int j= s->dsp.idct_permutation[i];
-
-            s->intra_matrix[j] = clip_uint8((ff_mpeg1_default_intra_matrix[i] * s->qscale) >> 3);
-        }
-        convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16,
-                       s->intra_matrix, s->intra_quant_bias, 8, 8, 1);
-        s->qscale= 8;
-    }
-
-    //FIXME var duplication
-    s->current_picture_ptr->key_frame=
-    s->current_picture.key_frame= s->pict_type == I_TYPE; //FIXME pic_ptr
-    s->current_picture_ptr->pict_type=
-    s->current_picture.pict_type= s->pict_type;
-
-    if(s->current_picture.key_frame)
-        s->picture_in_gop_number=0;
-
-    s->last_bits= put_bits_count(&s->pb);
-    switch(s->out_format) {
-    case FMT_MJPEG:
-        mjpeg_picture_header(s);
-        break;
-#ifdef CONFIG_H261_ENCODER
-    case FMT_H261:
-        ff_h261_encode_picture_header(s, picture_number);
-        break;
-#endif
-    case FMT_H263:
-        if (s->codec_id == CODEC_ID_WMV2)
-            ff_wmv2_encode_picture_header(s, picture_number);
-        else if (s->h263_msmpeg4)
-            msmpeg4_encode_picture_header(s, picture_number);
-        else if (s->h263_pred)
-            mpeg4_encode_picture_header(s, picture_number);
-#ifdef CONFIG_RV10_ENCODER
-        else if (s->codec_id == CODEC_ID_RV10)
-            rv10_encode_picture_header(s, picture_number);
-#endif
-#ifdef CONFIG_RV20_ENCODER
-        else if (s->codec_id == CODEC_ID_RV20)
-            rv20_encode_picture_header(s, picture_number);
-#endif
-        else if (s->codec_id == CODEC_ID_FLV1)
-            ff_flv_encode_picture_header(s, picture_number);
-        else
-            h263_encode_picture_header(s, picture_number);
-        break;
-    case FMT_MPEG1:
-        mpeg1_encode_picture_header(s, picture_number);
-        break;
-    case FMT_H264:
-        break;
-    default:
-        assert(0);
-    }
-    bits= put_bits_count(&s->pb);
-    s->header_bits= bits - s->last_bits;
-
-    for(i=1; i<s->avctx->thread_count; i++){
-        update_duplicate_context_after_me(s->thread_context[i], s);
-    }
-    s->avctx->execute(s->avctx, encode_thread, (void**)&(s->thread_context[0]), NULL, s->avctx->thread_count);
-    for(i=1; i<s->avctx->thread_count; i++){
-        merge_context_after_encode(s, s->thread_context[i]);
-    }
-    emms_c();
-    return 0;
-}
-
-static void  denoise_dct_c(MpegEncContext *s, DCTELEM *block){
-    const int intra= s->mb_intra;
-    int i;
-
-    s->dct_count[intra]++;
-
-    for(i=0; i<64; i++){
-        int level= block[i];
-
-        if(level){
-            if(level>0){
-                s->dct_error_sum[intra][i] += level;
-                level -= s->dct_offset[intra][i];
-                if(level<0) level=0;
-            }else{
-                s->dct_error_sum[intra][i] -= level;
-                level += s->dct_offset[intra][i];
-                if(level>0) level=0;
-            }
-            block[i]= level;
-        }
-    }
-}
-
-static int dct_quantize_trellis_c(MpegEncContext *s,
-                        DCTELEM *block, int n,
-                        int qscale, int *overflow){
-    const int *qmat;
-    const uint8_t *scantable= s->intra_scantable.scantable;
-    const uint8_t *perm_scantable= s->intra_scantable.permutated;
-    int max=0;
-    unsigned int threshold1, threshold2;
-    int bias=0;
-    int run_tab[65];
-    int level_tab[65];
-    int score_tab[65];
-    int survivor[65];
-    int survivor_count;
-    int last_run=0;
-    int last_level=0;
-    int last_score= 0;
-    int last_i;
-    int coeff[2][64];
-    int coeff_count[64];
-    int qmul, qadd, start_i, last_non_zero, i, dc;
-    const int esc_length= s->ac_esc_length;
-    uint8_t * length;
-    uint8_t * last_length;
-    const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
-
-    s->dsp.fdct (block);
-
-    if(s->dct_error_sum)
-        s->denoise_dct(s, block);
-    qmul= qscale*16;
-    qadd= ((qscale-1)|1)*8;
-
-    if (s->mb_intra) {
-        int q;
-        if (!s->h263_aic) {
-            if (n < 4)
-                q = s->y_dc_scale;
-            else
-                q = s->c_dc_scale;
-            q = q << 3;
-        } else{
-            /* For AIC we skip quant/dequant of INTRADC */
-            q = 1 << 3;
-            qadd=0;
-        }
-
-        /* note: block[0] is assumed to be positive */
-        block[0] = (block[0] + (q >> 1)) / q;
-        start_i = 1;
-        last_non_zero = 0;
-        qmat = s->q_intra_matrix[qscale];
-        if(s->mpeg_quant || s->out_format == FMT_MPEG1)
-            bias= 1<<(QMAT_SHIFT-1);
-        length     = s->intra_ac_vlc_length;
-        last_length= s->intra_ac_vlc_last_length;
-    } else {
-        start_i = 0;
-        last_non_zero = -1;
-        qmat = s->q_inter_matrix[qscale];
-        length     = s->inter_ac_vlc_length;
-        last_length= s->inter_ac_vlc_last_length;
-    }
-    last_i= start_i;
-
-    threshold1= (1<<QMAT_SHIFT) - bias - 1;
-    threshold2= (threshold1<<1);
-
-    for(i=63; i>=start_i; i--) {
-        const int j = scantable[i];
-        int level = block[j] * qmat[j];
-
-        if(((unsigned)(level+threshold1))>threshold2){
-            last_non_zero = i;
-            break;
-        }
-    }
-
-    for(i=start_i; i<=last_non_zero; i++) {
-        const int j = scantable[i];
-        int level = block[j] * qmat[j];
-
-//        if(   bias+level >= (1<<(QMAT_SHIFT - 3))
-//           || bias-level >= (1<<(QMAT_SHIFT - 3))){
-        if(((unsigned)(level+threshold1))>threshold2){
-            if(level>0){
-                level= (bias + level)>>QMAT_SHIFT;
-                coeff[0][i]= level;
-                coeff[1][i]= level-1;
-//                coeff[2][k]= level-2;
-            }else{
-                level= (bias - level)>>QMAT_SHIFT;
-                coeff[0][i]= -level;
-                coeff[1][i]= -level+1;
-//                coeff[2][k]= -level+2;
-            }
-            coeff_count[i]= FFMIN(level, 2);
-            assert(coeff_count[i]);
-            max |=level;
-        }else{
-            coeff[0][i]= (level>>31)|1;
-            coeff_count[i]= 1;
-        }
-    }
-
-    *overflow= s->max_qcoeff < max; //overflow might have happened
-
-    if(last_non_zero < start_i){
-        memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM));
-        return last_non_zero;
-    }
-
-    score_tab[start_i]= 0;
-    survivor[0]= start_i;
-    survivor_count= 1;
-
-    for(i=start_i; i<=last_non_zero; i++){
-        int level_index, j;
-        const int dct_coeff= FFABS(block[ scantable[i] ]);
-        const int zero_distoration= dct_coeff*dct_coeff;
-        int best_score=256*256*256*120;
-        for(level_index=0; level_index < coeff_count[i]; level_index++){
-            int distoration;
-            int level= coeff[level_index][i];
-            const int alevel= FFABS(level);
-            int unquant_coeff;
-
-            assert(level);
-
-            if(s->out_format == FMT_H263){
-                unquant_coeff= alevel*qmul + qadd;
-            }else{ //MPEG1
-                j= s->dsp.idct_permutation[ scantable[i] ]; //FIXME optimize
-                if(s->mb_intra){
-                        unquant_coeff = (int)(  alevel  * qscale * s->intra_matrix[j]) >> 3;
-                        unquant_coeff =   (unquant_coeff - 1) | 1;
-                }else{
-                        unquant_coeff = (((  alevel  << 1) + 1) * qscale * ((int) s->inter_matrix[j])) >> 4;
-                        unquant_coeff =   (unquant_coeff - 1) | 1;
-                }
-                unquant_coeff<<= 3;
-            }
-
-            distoration= (unquant_coeff - dct_coeff) * (unquant_coeff - dct_coeff) - zero_distoration;
-            level+=64;
-            if((level&(~127)) == 0){
-                for(j=survivor_count-1; j>=0; j--){
-                    int run= i - survivor[j];
-                    int score= distoration + length[UNI_AC_ENC_INDEX(run, level)]*lambda;
-                    score += score_tab[i-run];
-
-                    if(score < best_score){
-                        best_score= score;
-                        run_tab[i+1]= run;
-                        level_tab[i+1]= level-64;
-                    }
-                }
-
-                if(s->out_format == FMT_H263){
-                    for(j=survivor_count-1; j>=0; j--){
-                        int run= i - survivor[j];
-                        int score= distoration + last_length[UNI_AC_ENC_INDEX(run, level)]*lambda;
-                        score += score_tab[i-run];
-                        if(score < last_score){
-                            last_score= score;
-                            last_run= run;
-                            last_level= level-64;
-                            last_i= i+1;
-                        }
-                    }
-                }
-            }else{
-                distoration += esc_length*lambda;
-                for(j=survivor_count-1; j>=0; j--){
-                    int run= i - survivor[j];
-                    int score= distoration + score_tab[i-run];
-
-                    if(score < best_score){
-                        best_score= score;
-                        run_tab[i+1]= run;
-                        level_tab[i+1]= level-64;
-                    }
-                }
-
-                if(s->out_format == FMT_H263){
-                  for(j=survivor_count-1; j>=0; j--){
-                        int run= i - survivor[j];
-                        int score= distoration + score_tab[i-run];
-                        if(score < last_score){
-                            last_score= score;
-                            last_run= run;
-                            last_level= level-64;
-                            last_i= i+1;
-                        }
-                    }
-                }
-            }
-        }
-
-        score_tab[i+1]= best_score;
-
-        //Note: there is a vlc code in mpeg4 which is 1 bit shorter then another one with a shorter run and the same level
-        if(last_non_zero <= 27){
-            for(; survivor_count; survivor_count--){
-                if(score_tab[ survivor[survivor_count-1] ] <= best_score)
-                    break;
-            }
-        }else{
-            for(; survivor_count; survivor_count--){
-                if(score_tab[ survivor[survivor_count-1] ] <= best_score + lambda)
-                    break;
-            }
-        }
-
-        survivor[ survivor_count++ ]= i+1;
-    }
-
-    if(s->out_format != FMT_H263){
-        last_score= 256*256*256*120;
-        for(i= survivor[0]; i<=last_non_zero + 1; i++){
-            int score= score_tab[i];
-            if(i) score += lambda*2; //FIXME exacter?
-
-            if(score < last_score){
-                last_score= score;
-                last_i= i;
-                last_level= level_tab[i];
-                last_run= run_tab[i];
-            }
-        }
-    }
-
-    s->coded_score[n] = last_score;
-
-    dc= FFABS(block[0]);
-    last_non_zero= last_i - 1;
-    memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM));
-
-    if(last_non_zero < start_i)
-        return last_non_zero;
-
-    if(last_non_zero == 0 && start_i == 0){
-        int best_level= 0;
-        int best_score= dc * dc;
-
-        for(i=0; i<coeff_count[0]; i++){
-            int level= coeff[i][0];
-            int alevel= FFABS(level);
-            int unquant_coeff, score, distortion;
-
-            if(s->out_format == FMT_H263){
-                    unquant_coeff= (alevel*qmul + qadd)>>3;
-            }else{ //MPEG1
-                    unquant_coeff = (((  alevel  << 1) + 1) * qscale * ((int) s->inter_matrix[0])) >> 4;
-                    unquant_coeff =   (unquant_coeff - 1) | 1;
-            }
-            unquant_coeff = (unquant_coeff + 4) >> 3;
-            unquant_coeff<<= 3 + 3;
-
-            distortion= (unquant_coeff - dc) * (unquant_coeff - dc);
-            level+=64;
-            if((level&(~127)) == 0) score= distortion + last_length[UNI_AC_ENC_INDEX(0, level)]*lambda;
-            else                    score= distortion + esc_length*lambda;
-
-            if(score < best_score){
-                best_score= score;
-                best_level= level - 64;
-            }
-        }
-        block[0]= best_level;
-        s->coded_score[n] = best_score - dc*dc;
-        if(best_level == 0) return -1;
-        else                return last_non_zero;
-    }
-
-    i= last_i;
-    assert(last_level);
-
-    block[ perm_scantable[last_non_zero] ]= last_level;
-    i -= last_run + 1;
-
-    for(; i>start_i; i -= run_tab[i] + 1){
-        block[ perm_scantable[i-1] ]= level_tab[i];
-    }
-
-    return last_non_zero;
-}
-
-//#define REFINE_STATS 1
-static int16_t basis[64][64];
-
-static void build_basis(uint8_t *perm){
-    int i, j, x, y;
-    emms_c();
-    for(i=0; i<8; i++){
-        for(j=0; j<8; j++){
-            for(y=0; y<8; y++){
-                for(x=0; x<8; x++){
-                    double s= 0.25*(1<<BASIS_SHIFT);
-                    int index= 8*i + j;
-                    int perm_index= perm[index];
-                    if(i==0) s*= sqrt(0.5);
-                    if(j==0) s*= sqrt(0.5);
-                    basis[perm_index][8*x + y]= lrintf(s * cos((M_PI/8.0)*i*(x+0.5)) * cos((M_PI/8.0)*j*(y+0.5)));
-                }
-            }
-        }
-    }
-}
-
-static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise?
-                        DCTELEM *block, int16_t *weight, DCTELEM *orig,
-                        int n, int qscale){
-    int16_t rem[64];
-    DECLARE_ALIGNED_16(DCTELEM, d1[64]);
-    const int *qmat;
-    const uint8_t *scantable= s->intra_scantable.scantable;
-    const uint8_t *perm_scantable= s->intra_scantable.permutated;
-//    unsigned int threshold1, threshold2;
-//    int bias=0;
-    int run_tab[65];
-    int prev_run=0;
-    int prev_level=0;
-    int qmul, qadd, start_i, last_non_zero, i, dc;
-    uint8_t * length;
-    uint8_t * last_length;
-    int lambda;
-    int rle_index, run, q, sum;
-#ifdef REFINE_STATS
-static int count=0;
-static int after_last=0;
-static int to_zero=0;
-static int from_zero=0;
-static int raise=0;
-static int lower=0;
-static int messed_sign=0;
-#endif
-
-    if(basis[0][0] == 0)
-        build_basis(s->dsp.idct_permutation);
-
-    qmul= qscale*2;
-    qadd= (qscale-1)|1;
-    if (s->mb_intra) {
-        if (!s->h263_aic) {
-            if (n < 4)
-                q = s->y_dc_scale;
-            else
-                q = s->c_dc_scale;
-        } else{
-            /* For AIC we skip quant/dequant of INTRADC */
-            q = 1;
-            qadd=0;
-        }
-        q <<= RECON_SHIFT-3;
-        /* note: block[0] is assumed to be positive */
-        dc= block[0]*q;
-//        block[0] = (block[0] + (q >> 1)) / q;
-        start_i = 1;
-        qmat = s->q_intra_matrix[qscale];
-//        if(s->mpeg_quant || s->out_format == FMT_MPEG1)
-//            bias= 1<<(QMAT_SHIFT-1);
-        length     = s->intra_ac_vlc_length;
-        last_length= s->intra_ac_vlc_last_length;
-    } else {
-        dc= 0;
-        start_i = 0;
-        qmat = s->q_inter_matrix[qscale];
-        length     = s->inter_ac_vlc_length;
-        last_length= s->inter_ac_vlc_last_length;
-    }
-    last_non_zero = s->block_last_index[n];
-
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
-    dc += (1<<(RECON_SHIFT-1));
-    for(i=0; i<64; i++){
-        rem[i]= dc - (orig[i]<<RECON_SHIFT); //FIXME  use orig dirrectly instead of copying to rem[]
-    }
-#ifdef REFINE_STATS
-STOP_TIMER("memset rem[]")}
-#endif
-    sum=0;
-    for(i=0; i<64; i++){
-        int one= 36;
-        int qns=4;
-        int w;
-
-        w= FFABS(weight[i]) + qns*one;
-        w= 15 + (48*qns*one + w/2)/w; // 16 .. 63
-
-        weight[i] = w;
-//        w=weight[i] = (63*qns + (w/2)) / w;
-
-        assert(w>0);
-        assert(w<(1<<6));
-        sum += w*w;
-    }
-    lambda= sum*(uint64_t)s->lambda2 >> (FF_LAMBDA_SHIFT - 6 + 6 + 6 + 6);
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
-    run=0;
-    rle_index=0;
-    for(i=start_i; i<=last_non_zero; i++){
-        int j= perm_scantable[i];
-        const int level= block[j];
-        int coeff;
-
-        if(level){
-            if(level<0) coeff= qmul*level - qadd;
-            else        coeff= qmul*level + qadd;
-            run_tab[rle_index++]=run;
-            run=0;
-
-            s->dsp.add_8x8basis(rem, basis[j], coeff);
-        }else{
-            run++;
-        }
-    }
-#ifdef REFINE_STATS
-if(last_non_zero>0){
-STOP_TIMER("init rem[]")
-}
-}
-
-{START_TIMER
-#endif
-    for(;;){
-        int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0);
-        int best_coeff=0;
-        int best_change=0;
-        int run2, best_unquant_change=0, analyze_gradient;
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
-        analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3;
-
-        if(analyze_gradient){
-#ifdef REFINE_STATS
-{START_TIMER
-#endif
-            for(i=0; i<64; i++){
-                int w= weight[i];
-
-                d1[i] = (rem[i]*w*w + (1<<(RECON_SHIFT+12-1)))>>(RECON_SHIFT+12);
-            }
-#ifdef REFINE_STATS
-STOP_TIMER("rem*w*w")}
-{START_TIMER
-#endif
-            s->dsp.fdct(d1);
-#ifdef REFINE_STATS
-STOP_TIMER("dct")}
-#endif
-        }
-
-        if(start_i){
-            const int level= block[0];
-            int change, old_coeff;
-
-            assert(s->mb_intra);
-
-            old_coeff= q*level;
-
-            for(change=-1; change<=1; change+=2){
-                int new_level= level + change;
-                int score, new_coeff;
-
-                new_coeff= q*new_level;
-                if(new_coeff >= 2048 || new_coeff < 0)
-                    continue;
-
-                score= s->dsp.try_8x8basis(rem, weight, basis[0], new_coeff - old_coeff);
-                if(score<best_score){
-                    best_score= score;
-                    best_coeff= 0;
-                    best_change= change;
-                    best_unquant_change= new_coeff - old_coeff;
-                }
-            }
-        }
-
-        run=0;
-        rle_index=0;
-        run2= run_tab[rle_index++];
-        prev_level=0;
-        prev_run=0;
-
-        for(i=start_i; i<64; i++){
-            int j= perm_scantable[i];
-            const int level= block[j];
-            int change, old_coeff;
-
-            if(s->avctx->quantizer_noise_shaping < 3 && i > last_non_zero + 1)
-                break;
-
-            if(level){
-                if(level<0) old_coeff= qmul*level - qadd;
-                else        old_coeff= qmul*level + qadd;
-                run2= run_tab[rle_index++]; //FIXME ! maybe after last
-            }else{
-                old_coeff=0;
-                run2--;
-                assert(run2>=0 || i >= last_non_zero );
-            }
-
-            for(change=-1; change<=1; change+=2){
-                int new_level= level + change;
-                int score, new_coeff, unquant_change;
-
-                score=0;
-                if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level))
-                   continue;
-
-                if(new_level){
-                    if(new_level<0) new_coeff= qmul*new_level - qadd;
-                    else            new_coeff= qmul*new_level + qadd;
-                    if(new_coeff >= 2048 || new_coeff <= -2048)
-                        continue;
-                    //FIXME check for overflow
-
-                    if(level){
-                        if(level < 63 && level > -63){
-                            if(i < last_non_zero)
-                                score +=   length[UNI_AC_ENC_INDEX(run, new_level+64)]
-                                         - length[UNI_AC_ENC_INDEX(run, level+64)];
-                            else
-                                score +=   last_length[UNI_AC_ENC_INDEX(run, new_level+64)]
-                                         - last_length[UNI_AC_ENC_INDEX(run, level+64)];
-                        }
-                    }else{
-                        assert(FFABS(new_level)==1);
-
-                        if(analyze_gradient){
-                            int g= d1[ scantable[i] ];
-                            if(g && (g^new_level) >= 0)
-                                continue;
-                        }
-
-                        if(i < last_non_zero){
-                            int next_i= i + run2 + 1;
-                            int next_level= block[ perm_scantable[next_i] ] + 64;
-
-                            if(next_level&(~127))
-                                next_level= 0;
-
-                            if(next_i < last_non_zero)
-                                score +=   length[UNI_AC_ENC_INDEX(run, 65)]
-                                         + length[UNI_AC_ENC_INDEX(run2, next_level)]
-                                         - length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)];
-                            else
-                                score +=  length[UNI_AC_ENC_INDEX(run, 65)]
-                                        + last_length[UNI_AC_ENC_INDEX(run2, next_level)]
-                                        - last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)];
-                        }else{
-                            score += last_length[UNI_AC_ENC_INDEX(run, 65)];
-                            if(prev_level){
-                                score +=  length[UNI_AC_ENC_INDEX(prev_run, prev_level)]
-                                        - last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)];
-                            }
-                        }
-                    }
-                }else{
-                    new_coeff=0;
-                    assert(FFABS(level)==1);
-
-                    if(i < last_non_zero){
-                        int next_i= i + run2 + 1;
-                        int next_level= block[ perm_scantable[next_i] ] + 64;
-
-                        if(next_level&(~127))
-                            next_level= 0;
-
-                        if(next_i < last_non_zero)
-                            score +=   length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]
-                                     - length[UNI_AC_ENC_INDEX(run2, next_level)]
-                                     - length[UNI_AC_ENC_INDEX(run, 65)];
-                        else
-                            score +=   last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]
-                                     - last_length[UNI_AC_ENC_INDEX(run2, next_level)]
-                                     - length[UNI_AC_ENC_INDEX(run, 65)];
-                    }else{
-                        score += -last_length[UNI_AC_ENC_INDEX(run, 65)];
-                        if(prev_level){
-                            score +=  last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)]
-                                    - length[UNI_AC_ENC_INDEX(prev_run, prev_level)];
-                        }
-                    }
-                }
-
-                score *= lambda;
-
-                unquant_change= new_coeff - old_coeff;
-                assert((score < 100*lambda && score > -100*lambda) || lambda==0);
-
-                score+= s->dsp.try_8x8basis(rem, weight, basis[j], unquant_change);
-                if(score<best_score){
-                    best_score= score;
-                    best_coeff= i;
-                    best_change= change;
-                    best_unquant_change= unquant_change;
-                }
-            }
-            if(level){
-                prev_level= level + 64;
-                if(prev_level&(~127))
-                    prev_level= 0;
-                prev_run= run;
-                run=0;
-            }else{
-                run++;
-            }
-        }
-#ifdef REFINE_STATS
-STOP_TIMER("iterative step")}
-#endif
-
-        if(best_change){
-            int j= perm_scantable[ best_coeff ];
-
-            block[j] += best_change;
-
-            if(best_coeff > last_non_zero){
-                last_non_zero= best_coeff;
-                assert(block[j]);
-#ifdef REFINE_STATS
-after_last++;
-#endif
-            }else{
-#ifdef REFINE_STATS
-if(block[j]){
-    if(block[j] - best_change){
-        if(FFABS(block[j]) > FFABS(block[j] - best_change)){
-            raise++;
-        }else{
-            lower++;
-        }
-    }else{
-        from_zero++;
-    }
-}else{
-    to_zero++;
-}
-#endif
-                for(; last_non_zero>=start_i; last_non_zero--){
-                    if(block[perm_scantable[last_non_zero]])
-                        break;
-                }
-            }
-#ifdef REFINE_STATS
-count++;
-if(256*256*256*64 % count == 0){
-    printf("after_last:%d to_zero:%d from_zero:%d raise:%d lower:%d sign:%d xyp:%d/%d/%d\n", after_last, to_zero, from_zero, raise, lower, messed_sign, s->mb_x, s->mb_y, s->picture_number);
-}
-#endif
-            run=0;
-            rle_index=0;
-            for(i=start_i; i<=last_non_zero; i++){
-                int j= perm_scantable[i];
-                const int level= block[j];
-
-                 if(level){
-                     run_tab[rle_index++]=run;
-                     run=0;
-                 }else{
-                     run++;
-                 }
-            }
-
-            s->dsp.add_8x8basis(rem, basis[j], best_unquant_change);
-        }else{
-            break;
-        }
-    }
-#ifdef REFINE_STATS
-if(last_non_zero>0){
-STOP_TIMER("iterative search")
-}
-}
-#endif
-
-    return last_non_zero;
-}
-
-static int dct_quantize_c(MpegEncContext *s,
-                        DCTELEM *block, int n,
-                        int qscale, int *overflow)
-{
-    int i, j, level, last_non_zero, q, start_i;
-    const int *qmat;
-    const uint8_t *scantable= s->intra_scantable.scantable;
-    int bias;
-    int max=0;
-    unsigned int threshold1, threshold2;
-
-    s->dsp.fdct (block);
-
-    if(s->dct_error_sum)
-        s->denoise_dct(s, block);
-
-    if (s->mb_intra) {
-        if (!s->h263_aic) {
-            if (n < 4)
-                q = s->y_dc_scale;
-            else
-                q = s->c_dc_scale;
-            q = q << 3;
-        } else
-            /* For AIC we skip quant/dequant of INTRADC */
-            q = 1 << 3;
-
-        /* note: block[0] is assumed to be positive */
-        block[0] = (block[0] + (q >> 1)) / q;
-        start_i = 1;
-        last_non_zero = 0;
-        qmat = s->q_intra_matrix[qscale];
-        bias= s->intra_quant_bias<<(QMAT_SHIFT - QUANT_BIAS_SHIFT);
-    } else {
-        start_i = 0;
-        last_non_zero = -1;
-        qmat = s->q_inter_matrix[qscale];
-        bias= s->inter_quant_bias<<(QMAT_SHIFT - QUANT_BIAS_SHIFT);
-    }
-    threshold1= (1<<QMAT_SHIFT) - bias - 1;
-    threshold2= (threshold1<<1);
-    for(i=63;i>=start_i;i--) {
-        j = scantable[i];
-        level = block[j] * qmat[j];
-
-        if(((unsigned)(level+threshold1))>threshold2){
-            last_non_zero = i;
-            break;
-        }else{
-            block[j]=0;
-        }
-    }
-    for(i=start_i; i<=last_non_zero; i++) {
-        j = scantable[i];
-        level = block[j] * qmat[j];
-
-//        if(   bias+level >= (1<<QMAT_SHIFT)
-//           || bias-level >= (1<<QMAT_SHIFT)){
-        if(((unsigned)(level+threshold1))>threshold2){
-            if(level>0){
-                level= (bias + level)>>QMAT_SHIFT;
-                block[j]= level;
-            }else{
-                level= (bias - level)>>QMAT_SHIFT;
-                block[j]= -level;
-            }
-            max |=level;
-        }else{
-            block[j]=0;
-        }
-    }
-    *overflow= s->max_qcoeff < max; //overflow might have happened
-
-    /* we need this permutation so that we correct the IDCT, we only permute the !=0 elements */
-    if (s->dsp.idct_permutation_type != FF_NO_IDCT_PERM)
-        ff_block_permute(block, s->dsp.idct_permutation, scantable, last_non_zero);
-
-    return last_non_zero;
-}
-
-#endif //CONFIG_ENCODERS
-
-static void dct_unquantize_mpeg1_intra_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale)
-{
-    int i, level, nCoeffs;
-    const uint16_t *quant_matrix;
-
-    nCoeffs= s->block_last_index[n];
-
-    if (n < 4)
-        block[0] = block[0] * s->y_dc_scale;
-    else
-        block[0] = block[0] * s->c_dc_scale;
-    /* XXX: only mpeg1 */
-    quant_matrix = s->intra_matrix;
-    for(i=1;i<=nCoeffs;i++) {
-        int j= s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = -level;
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-                level = (level - 1) | 1;
-                level = -level;
-            } else {
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-                level = (level - 1) | 1;
-            }
-            block[j] = level;
-        }
-    }
-}
-
-static void dct_unquantize_mpeg1_inter_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale)
-{
-    int i, level, nCoeffs;
-    const uint16_t *quant_matrix;
-
-    nCoeffs= s->block_last_index[n];
-
-    quant_matrix = s->inter_matrix;
-    for(i=0; i<=nCoeffs; i++) {
-        int j= s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = -level;
-                level = (((level << 1) + 1) * qscale *
-                         ((int) (quant_matrix[j]))) >> 4;
-                level = (level - 1) | 1;
-                level = -level;
-            } else {
-                level = (((level << 1) + 1) * qscale *
-                         ((int) (quant_matrix[j]))) >> 4;
-                level = (level - 1) | 1;
-            }
-            block[j] = level;
-        }
-    }
-}
-
-static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale)
-{
-    int i, level, nCoeffs;
-    const uint16_t *quant_matrix;
-
-    if(s->alternate_scan) nCoeffs= 63;
-    else nCoeffs= s->block_last_index[n];
-
-    if (n < 4)
-        block[0] = block[0] * s->y_dc_scale;
-    else
-        block[0] = block[0] * s->c_dc_scale;
-    quant_matrix = s->intra_matrix;
-    for(i=1;i<=nCoeffs;i++) {
-        int j= s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = -level;
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-                level = -level;
-            } else {
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-            }
-            block[j] = level;
-        }
-    }
-}
-
-static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale)
-{
-    int i, level, nCoeffs;
-    const uint16_t *quant_matrix;
-    int sum=-1;
-
-    if(s->alternate_scan) nCoeffs= 63;
-    else nCoeffs= s->block_last_index[n];
-
-    if (n < 4)
-        block[0] = block[0] * s->y_dc_scale;
-    else
-        block[0] = block[0] * s->c_dc_scale;
-    quant_matrix = s->intra_matrix;
-    for(i=1;i<=nCoeffs;i++) {
-        int j= s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = -level;
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-                level = -level;
-            } else {
-                level = (int)(level * qscale * quant_matrix[j]) >> 3;
-            }
-            block[j] = level;
-            sum+=level;
-        }
-    }
-    block[63]^=sum&1;
-}
-
-static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
-                                   DCTELEM *block, int n, int qscale)
-{
-    int i, level, nCoeffs;
-    const uint16_t *quant_matrix;
-    int sum=-1;
-
-    if(s->alternate_scan) nCoeffs= 63;
-    else nCoeffs= s->block_last_index[n];
-
-    quant_matrix = s->inter_matrix;
-    for(i=0; i<=nCoeffs; i++) {
-        int j= s->intra_scantable.permutated[i];
-        level = block[j];
-        if (level) {
-            if (level < 0) {
-                level = -level;
-                level = (((level << 1) + 1) * qscale *
-                         ((int) (quant_matrix[j]))) >> 4;
-                level = -level;
-            } else {
-                level = (((level << 1) + 1) * qscale *
-                         ((int) (quant_matrix[j]))) >> 4;
-            }
-            block[j] = level;
-            sum+=level;
-        }
-    }
-    block[63]^=sum&1;
-}
-
-static void dct_unquantize_h263_intra_c(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale)
-{
-    int i, level, qmul, qadd;
-    int nCoeffs;
-
-    assert(s->block_last_index[n]>=0);
-
-    qmul = qscale << 1;
-
-    if (!s->h263_aic) {
-        if (n < 4)
-            block[0] = block[0] * s->y_dc_scale;
-        else
-            block[0] = block[0] * s->c_dc_scale;
-        qadd = (qscale - 1) | 1;
-    }else{
-        qadd = 0;
-    }
-    if(s->ac_pred)
-        nCoeffs=63;
-    else
-        nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-
-    for(i=1; i<=nCoeffs; i++) {
-        level = block[i];
-        if (level) {
-            if (level < 0) {
-                level = level * qmul - qadd;
-            } else {
-                level = level * qmul + qadd;
-            }
-            block[i] = level;
-        }
-    }
-}
-
-static void dct_unquantize_h263_inter_c(MpegEncContext *s,
-                                  DCTELEM *block, int n, int qscale)
-{
-    int i, level, qmul, qadd;
-    int nCoeffs;
-
-    assert(s->block_last_index[n]>=0);
-
-    qadd = (qscale - 1) | 1;
-    qmul = qscale << 1;
-
-    nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ];
-
-    for(i=0; i<=nCoeffs; i++) {
-        level = block[i];
-        if (level) {
-            if (level < 0) {
-                level = level * qmul - qadd;
-            } else {
-                level = level * qmul + qadd;
-            }
-            block[i] = level;
-        }
-    }
-}
-
-#ifdef CONFIG_ENCODERS
-AVCodec h263_encoder = {
-    "h263",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_H263,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
-};
-
-AVCodec h263p_encoder = {
-    "h263p",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_H263P,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
-};
-
-AVCodec flv_encoder = {
-    "flv",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_FLV1,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
-};
-
-AVCodec rv10_encoder = {
-    "rv10",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_RV10,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
-};
-
-AVCodec rv20_encoder = {
-    "rv20",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_RV20,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
-};
-
-AVCodec mpeg4_encoder = {
-    "mpeg4",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_MPEG4,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
-    .capabilities= CODEC_CAP_DELAY,
-};
-
-AVCodec msmpeg4v1_encoder = {
-    "msmpeg4v1",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_MSMPEG4V1,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
-};
-
-AVCodec msmpeg4v2_encoder = {
-    "msmpeg4v2",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_MSMPEG4V2,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
-};
-
-AVCodec msmpeg4v3_encoder = {
-    "msmpeg4",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_MSMPEG4V3,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
-};
-
-AVCodec wmv1_encoder = {
-    "wmv1",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_WMV1,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
-};
-
-AVCodec mjpeg_encoder = {
-    "mjpeg",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_MJPEG,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    MPV_encode_picture,
-    MPV_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, -1},
-};
-
-#endif //CONFIG_ENCODERS
--- a/src/ffmpeg/libavcodec/qpeg.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,324 +0,0 @@
-/*
- * QPEG codec
- * Copyright (c) 2004 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-/**
- * @file qpeg.c
- * QPEG codec.
- */
-
-#include "avcodec.h"
-#include "mpegvideo.h"
-
-typedef struct QpegContext{
-    AVCodecContext *avctx;
-    AVFrame pic;
-    uint8_t *refdata;
-} QpegContext;
-
-static void qpeg_decode_intra(uint8_t *src, uint8_t *dst, int size,
-                            int stride, int width, int height)
-{
-    int i;
-    int code;
-    int c0, c1;
-    int run, copy;
-    int filled = 0;
-    int rows_to_go;
-
-    rows_to_go = height;
-    height--;
-    dst = dst + height * stride;
-
-    while((size > 0) && (rows_to_go > 0)) {
-        code = *src++;
-        size--;
-        run = copy = 0;
-        if(code == 0xFC) /* end-of-picture code */
-            break;
-        if(code >= 0xF8) { /* very long run */
-            c0 = *src++;
-            c1 = *src++;
-            size -= 2;
-            run = ((code & 0x7) << 16) + (c0 << 8) + c1 + 2;
-        } else if (code >= 0xF0) { /* long run */
-            c0 = *src++;
-            size--;
-            run = ((code & 0xF) << 8) + c0 + 2;
-        } else if (code >= 0xE0) { /* short run */
-            run = (code & 0x1F) + 2;
-        } else if (code >= 0xC0) { /* very long copy */
-            c0 = *src++;
-            c1 = *src++;
-            size -= 2;
-            copy = ((code & 0x3F) << 16) + (c0 << 8) + c1 + 1;
-        } else if (code >= 0x80) { /* long copy */
-            c0 = *src++;
-            size--;
-            copy = ((code & 0x7F) << 8) + c0 + 1;
-        } else { /* short copy */
-            copy = code + 1;
-        }
-
-        /* perform actual run or copy */
-        if(run) {
-            int p;
-
-            p = *src++;
-            size--;
-            for(i = 0; i < run; i++) {
-                dst[filled++] = p;
-                if (filled >= width) {
-                    filled = 0;
-                    dst -= stride;
-                    rows_to_go--;
-                    if(rows_to_go <= 0)
-                        break;
-                }
-            }
-        } else {
-            size -= copy;
-            for(i = 0; i < copy; i++) {
-                dst[filled++] = *src++;
-                if (filled >= width) {
-                    filled = 0;
-                    dst -= stride;
-                    rows_to_go--;
-                    if(rows_to_go <= 0)
-                        break;
-                }
-            }
-        }
-    }
-}
-
-static int qpeg_table_h[16] =
- { 0x00, 0x20, 0x20, 0x20, 0x18, 0x10, 0x10, 0x20, 0x10, 0x08, 0x18, 0x08, 0x08, 0x18, 0x10, 0x04};
-static int qpeg_table_w[16] =
- { 0x00, 0x20, 0x18, 0x08, 0x18, 0x10, 0x20, 0x10, 0x08, 0x10, 0x20, 0x20, 0x08, 0x10, 0x18, 0x04};
-
-/* Decodes delta frames */
-static void qpeg_decode_inter(uint8_t *src, uint8_t *dst, int size,
-                            int stride, int width, int height,
-                            int delta, uint8_t *ctable, uint8_t *refdata)
-{
-    int i, j;
-    int code;
-    int filled = 0;
-    int orig_height;
-    uint8_t *blkdata;
-
-    /* copy prev frame */
-    for(i = 0; i < height; i++)
-        memcpy(refdata + (i * width), dst + (i * stride), width);
-
-    orig_height = height;
-    blkdata = src - 0x86;
-    height--;
-    dst = dst + height * stride;
-
-    while((size > 0) && (height >= 0)) {
-        code = *src++;
-        size--;
-
-        if(delta) {
-            /* motion compensation */
-            while((code & 0xF0) == 0xF0) {
-                if(delta == 1) {
-                    int me_idx;
-                    int me_w, me_h, me_x, me_y;
-                    uint8_t *me_plane;
-                    int corr, val;
-
-                    /* get block size by index */
-                    me_idx = code & 0xF;
-                    me_w = qpeg_table_w[me_idx];
-                    me_h = qpeg_table_h[me_idx];
-
-                    /* extract motion vector */
-                    corr = *src++;
-                    size--;
-
-                    val = corr >> 4;
-                    if(val > 7)
-                        val -= 16;
-                    me_x = val;
-
-                    val = corr & 0xF;
-                    if(val > 7)
-                        val -= 16;
-                    me_y = val;
-
-                    /* check motion vector */
-                    if ((me_x + filled < 0) || (me_x + me_w + filled > width) ||
-                       (height - me_y - me_h < 0) || (height - me_y > orig_height) ||
-                       (filled + me_w > width) || (height - me_h < 0))
-                        av_log(NULL, AV_LOG_ERROR, "Bogus motion vector (%i,%i), block size %ix%i at %i,%i\n",
-                               me_x, me_y, me_w, me_h, filled, height);
-                    else {
-                        /* do motion compensation */
-                        me_plane = refdata + (filled + me_x) + (height - me_y) * width;
-                        for(j = 0; j < me_h; j++) {
-                            for(i = 0; i < me_w; i++)
-                                dst[filled + i - (j * stride)] = me_plane[i - (j * width)];
-                        }
-                    }
-                }
-                code = *src++;
-                size--;
-            }
-        }
-
-        if(code == 0xE0) /* end-of-picture code */
-            break;
-        if(code > 0xE0) { /* run code: 0xE1..0xFF */
-            int p;
-
-            code &= 0x1F;
-            p = *src++;
-            size--;
-            for(i = 0; i <= code; i++) {
-                dst[filled++] = p;
-                if(filled >= width) {
-                    filled = 0;
-                    dst -= stride;
-                    height--;
-                }
-            }
-        } else if(code >= 0xC0) { /* copy code: 0xC0..0xDF */
-            code &= 0x1F;
-
-            for(i = 0; i <= code; i++) {
-                dst[filled++] = *src++;
-                if(filled >= width) {
-                    filled = 0;
-                    dst -= stride;
-                    height--;
-                }
-            }
-            size -= code + 1;
-        } else if(code >= 0x80) { /* skip code: 0x80..0xBF */
-            int skip;
-
-            code &= 0x3F;
-            /* codes 0x80 and 0x81 are actually escape codes,
-               skip value minus constant is in the next byte */
-            if(!code)
-                skip = (*src++) + 64;
-            else if(code == 1)
-                skip = (*src++) + 320;
-            else
-                skip = code;
-            filled += skip;
-            while( filled >= width) {
-                filled -= width;
-                dst -= stride;
-                height--;
-                if(height < 0)
-                    break;
-            }
-        } else {
-            /* zero code treated as one-pixel skip */
-            if(code)
-                dst[filled++] = ctable[code & 0x7F];
-            else
-                filled++;
-            if(filled >= width) {
-                filled = 0;
-                dst -= stride;
-                height--;
-            }
-        }
-    }
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        uint8_t *buf, int buf_size)
-{
-    QpegContext * const a = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&a->pic;
-    uint8_t* outdata;
-    int delta;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    p->reference= 0;
-    if(avctx->get_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-    outdata = a->pic.data[0];
-    if(buf[0x85] == 0x10) {
-        qpeg_decode_intra(buf+0x86, outdata, buf_size - 0x86, a->pic.linesize[0], avctx->width, avctx->height);
-    } else {
-        delta = buf[0x85];
-        qpeg_decode_inter(buf+0x86, outdata, buf_size - 0x86, a->pic.linesize[0], avctx->width, avctx->height, delta, buf + 4, a->refdata);
-    }
-
-    /* make the palette available on the way out */
-    memcpy(a->pic.data[1], a->avctx->palctrl->palette, AVPALETTE_SIZE);
-    if (a->avctx->palctrl->palette_changed) {
-        a->pic.palette_has_changed = 1;
-        a->avctx->palctrl->palette_changed = 0;
-    }
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = a->pic;
-
-    return buf_size;
-}
-
-static int decode_init(AVCodecContext *avctx){
-    QpegContext * const a = avctx->priv_data;
-
-    a->avctx = avctx;
-    avctx->pix_fmt= PIX_FMT_PAL8;
-    avctx->has_b_frames = 0;
-    a->pic.data[0] = NULL;
-    a->refdata = av_malloc(avctx->width * avctx->height);
-
-    return 0;
-}
-
-static int decode_end(AVCodecContext *avctx){
-    QpegContext * const a = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&a->pic;
-
-    if(p->data[0])
-        avctx->release_buffer(avctx, p);
-
-    av_free(a->refdata);
-    return 0;
-}
-
-AVCodec qpeg_decoder = {
-    "qpeg",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_QPEG,
-    sizeof(QpegContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-};
--- a/src/ffmpeg/libavcodec/svq1.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1431 +0,0 @@
-/*
- *
- * Copyright (C) 2002 the xine project
- * Copyright (C) 2002 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * (SVQ1 Decoder)
- * Ported to mplayer by Arpi <arpi@thot.banki.hu>
- * Ported to libavcodec by Nick Kurshev <nickols_k@mail.ru>
- *
- * SVQ1 Encoder (c) 2004 Mike Melanson <melanson@pcisys.net>
- */
-
-/**
- * @file svq1.c
- * Sorenson Vector Quantizer #1 (SVQ1) video codec.
- * For more information of the SVQ1 algorithm, visit:
- *   http://www.pcisys.net/~melanson/codecs/
- */
-
-
-//#define DEBUG_SVQ1
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <limits.h>
-
-#include "common.h"
-#include "avcodec.h"
-#include "dsputil.h"
-#include "mpegvideo.h"
-#include "bswap.h"
-
-#undef NDEBUG
-#include <assert.h>
-
-extern const uint8_t mvtab[33][2];
-
-static VLC svq1_block_type;
-static VLC svq1_motion_component;
-static VLC svq1_intra_multistage[6];
-static VLC svq1_inter_multistage[6];
-static VLC svq1_intra_mean;
-static VLC svq1_inter_mean;
-
-#define SVQ1_BLOCK_SKIP         0
-#define SVQ1_BLOCK_INTER        1
-#define SVQ1_BLOCK_INTER_4V     2
-#define SVQ1_BLOCK_INTRA        3
-
-typedef struct SVQ1Context {
-    MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to make the motion estimation eventually independant of MpegEncContext, so this will be removed then (FIXME/XXX)
-    AVCodecContext *avctx;
-    DSPContext dsp;
-    AVFrame picture;
-    AVFrame current_picture;
-    AVFrame last_picture;
-    PutBitContext pb;
-    GetBitContext gb;
-
-    PutBitContext reorder_pb[6]; //why ooh why this sick breadth first order, everything is slower and more complex
-
-    int frame_width;
-    int frame_height;
-
-    /* Y plane block dimensions */
-    int y_block_width;
-    int y_block_height;
-
-    /* U & V plane (C planes) block dimensions */
-    int c_block_width;
-    int c_block_height;
-
-    uint16_t *mb_type;
-    uint32_t *dummy;
-    int16_t (*motion_val8[3])[2];
-    int16_t (*motion_val16[3])[2];
-
-    int64_t rd_total;
-} SVQ1Context;
-
-/* motion vector (prediction) */
-typedef struct svq1_pmv_s {
-  int           x;
-  int           y;
-} svq1_pmv_t;
-
-#include "svq1_cb.h"
-#include "svq1_vlc.h"
-
-static const uint16_t checksum_table[256] = {
-  0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
-  0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
-  0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
-  0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
-  0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
-  0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
-  0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
-  0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
-  0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
-  0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
-  0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
-  0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
-  0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
-  0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
-  0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
-  0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
-  0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
-  0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
-  0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
-  0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
-  0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
-  0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
-  0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
-  0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
-  0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
-  0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
-  0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
-  0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
-  0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
-  0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
-  0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
-  0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
-};
-
-static const uint8_t string_table[256] = {
-  0x00, 0xD5, 0x7F, 0xAA, 0xFE, 0x2B, 0x81, 0x54,
-  0x29, 0xFC, 0x56, 0x83, 0xD7, 0x02, 0xA8, 0x7D,
-  0x52, 0x87, 0x2D, 0xF8, 0xAC, 0x79, 0xD3, 0x06,
-  0x7B, 0xAE, 0x04, 0xD1, 0x85, 0x50, 0xFA, 0x2F,
-  0xA4, 0x71, 0xDB, 0x0E, 0x5A, 0x8F, 0x25, 0xF0,
-  0x8D, 0x58, 0xF2, 0x27, 0x73, 0xA6, 0x0C, 0xD9,
-  0xF6, 0x23, 0x89, 0x5C, 0x08, 0xDD, 0x77, 0xA2,
-  0xDF, 0x0A, 0xA0, 0x75, 0x21, 0xF4, 0x5E, 0x8B,
-  0x9D, 0x48, 0xE2, 0x37, 0x63, 0xB6, 0x1C, 0xC9,
-  0xB4, 0x61, 0xCB, 0x1E, 0x4A, 0x9F, 0x35, 0xE0,
-  0xCF, 0x1A, 0xB0, 0x65, 0x31, 0xE4, 0x4E, 0x9B,
-  0xE6, 0x33, 0x99, 0x4C, 0x18, 0xCD, 0x67, 0xB2,
-  0x39, 0xEC, 0x46, 0x93, 0xC7, 0x12, 0xB8, 0x6D,
-  0x10, 0xC5, 0x6F, 0xBA, 0xEE, 0x3B, 0x91, 0x44,
-  0x6B, 0xBE, 0x14, 0xC1, 0x95, 0x40, 0xEA, 0x3F,
-  0x42, 0x97, 0x3D, 0xE8, 0xBC, 0x69, 0xC3, 0x16,
-  0xEF, 0x3A, 0x90, 0x45, 0x11, 0xC4, 0x6E, 0xBB,
-  0xC6, 0x13, 0xB9, 0x6C, 0x38, 0xED, 0x47, 0x92,
-  0xBD, 0x68, 0xC2, 0x17, 0x43, 0x96, 0x3C, 0xE9,
-  0x94, 0x41, 0xEB, 0x3E, 0x6A, 0xBF, 0x15, 0xC0,
-  0x4B, 0x9E, 0x34, 0xE1, 0xB5, 0x60, 0xCA, 0x1F,
-  0x62, 0xB7, 0x1D, 0xC8, 0x9C, 0x49, 0xE3, 0x36,
-  0x19, 0xCC, 0x66, 0xB3, 0xE7, 0x32, 0x98, 0x4D,
-  0x30, 0xE5, 0x4F, 0x9A, 0xCE, 0x1B, 0xB1, 0x64,
-  0x72, 0xA7, 0x0D, 0xD8, 0x8C, 0x59, 0xF3, 0x26,
-  0x5B, 0x8E, 0x24, 0xF1, 0xA5, 0x70, 0xDA, 0x0F,
-  0x20, 0xF5, 0x5F, 0x8A, 0xDE, 0x0B, 0xA1, 0x74,
-  0x09, 0xDC, 0x76, 0xA3, 0xF7, 0x22, 0x88, 0x5D,
-  0xD6, 0x03, 0xA9, 0x7C, 0x28, 0xFD, 0x57, 0x82,
-  0xFF, 0x2A, 0x80, 0x55, 0x01, 0xD4, 0x7E, 0xAB,
-  0x84, 0x51, 0xFB, 0x2E, 0x7A, 0xAF, 0x05, 0xD0,
-  0xAD, 0x78, 0xD2, 0x07, 0x53, 0x86, 0x2C, 0xF9
-};
-
-#define SVQ1_PROCESS_VECTOR()\
-    for (; level > 0; i++) {\
-      /* process next depth */\
-      if (i == m) {\
-        m = n;\
-        if (--level == 0)\
-          break;\
-      }\
-      /* divide block if next bit set */\
-      if (get_bits (bitbuf, 1) == 0)\
-        break;\
-      /* add child nodes */\
-      list[n++] = list[i];\
-      list[n++] = list[i] + (((level & 1) ? pitch : 1) << ((level / 2) + 1));\
-    }
-
-#define SVQ1_ADD_CODEBOOK()\
-          /* add codebook entries to vector */\
-          for (j=0; j < stages; j++) {\
-            n3  = codebook[entries[j]] ^ 0x80808080;\
-            n1 += ((n3 & 0xFF00FF00) >> 8);\
-            n2 +=  (n3 & 0x00FF00FF);\
-          }\
-\
-          /* clip to [0..255] */\
-          if (n1 & 0xFF00FF00) {\
-            n3  = ((( n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
-            n1 += 0x7F007F00;\
-            n1 |= (((~n1 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
-            n1 &= (n3 & 0x00FF00FF);\
-          }\
-\
-          if (n2 & 0xFF00FF00) {\
-            n3  = ((( n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
-            n2 += 0x7F007F00;\
-            n2 |= (((~n2 >> 15) & 0x00010001) | 0x01000100) - 0x00010001;\
-            n2 &= (n3 & 0x00FF00FF);\
-          }
-
-#define SVQ1_DO_CODEBOOK_INTRA()\
-      for (y=0; y < height; y++) {\
-        for (x=0; x < (width / 4); x++, codebook++) {\
-        n1 = n4;\
-        n2 = n4;\
-        SVQ1_ADD_CODEBOOK()\
-        /* store result */\
-        dst[x] = (n1 << 8) | n2;\
-        }\
-        dst += (pitch / 4);\
-      }
-
-#define SVQ1_DO_CODEBOOK_NONINTRA()\
-      for (y=0; y < height; y++) {\
-        for (x=0; x < (width / 4); x++, codebook++) {\
-        n3 = dst[x];\
-        /* add mean value to vector */\
-        n1 = ((n3 & 0xFF00FF00) >> 8) + n4;\
-        n2 =  (n3 & 0x00FF00FF)          + n4;\
-        SVQ1_ADD_CODEBOOK()\
-        /* store result */\
-        dst[x] = (n1 << 8) | n2;\
-        }\
-        dst += (pitch / 4);\
-      }
-
-#define SVQ1_CALC_CODEBOOK_ENTRIES(cbook)\
-      codebook = (const uint32_t *) cbook[level];\
-      bit_cache = get_bits (bitbuf, 4*stages);\
-      /* calculate codebook entries for this vector */\
-      for (j=0; j < stages; j++) {\
-        entries[j] = (((bit_cache >> (4*(stages - j - 1))) & 0xF) + 16*j) << (level + 1);\
-      }\
-      mean -= (stages * 128);\
-      n4    = ((mean + (mean >> 31)) << 16) | (mean & 0xFFFF);
-
-static int svq1_decode_block_intra (GetBitContext *bitbuf, uint8_t *pixels, int pitch ) {
-  uint32_t    bit_cache;
-  uint8_t    *list[63];
-  uint32_t   *dst;
-  const uint32_t *codebook;
-  int         entries[6];
-  int         i, j, m, n;
-  int         mean, stages;
-  unsigned    x, y, width, height, level;
-  uint32_t    n1, n2, n3, n4;
-
-  /* initialize list for breadth first processing of vectors */
-  list[0] = pixels;
-
-  /* recursively process vector */
-  for (i=0, m=1, n=1, level=5; i < n; i++) {
-    SVQ1_PROCESS_VECTOR();
-
-    /* destination address and vector size */
-    dst = (uint32_t *) list[i];
-    width = 1 << ((4 + level) /2);
-    height = 1 << ((3 + level) /2);
-
-    /* get number of stages (-1 skips vector, 0 for mean only) */
-    stages = get_vlc2(bitbuf, svq1_intra_multistage[level].table, 3, 3) - 1;
-
-    if (stages == -1) {
-        for (y=0; y < height; y++) {
-          memset (&dst[y*(pitch / 4)], 0, width);
-        }
-      continue;                 /* skip vector */
-    }
-
-    if ((stages > 0) && (level >= 4)) {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_intra): invalid vector: stages=%i level=%i\n",stages,level);
-#endif
-      return -1;        /* invalid vector */
-    }
-
-    mean = get_vlc2(bitbuf, svq1_intra_mean.table, 8, 3);
-
-    if (stages == 0) {
-      for (y=0; y < height; y++) {
-        memset (&dst[y*(pitch / 4)], mean, width);
-      }
-    } else {
-      SVQ1_CALC_CODEBOOK_ENTRIES(svq1_intra_codebooks);
-      SVQ1_DO_CODEBOOK_INTRA()
-    }
-  }
-
-  return 0;
-}
-
-static int svq1_decode_block_non_intra (GetBitContext *bitbuf, uint8_t *pixels, int pitch ) {
-  uint32_t    bit_cache;
-  uint8_t    *list[63];
-  uint32_t   *dst;
-  const uint32_t *codebook;
-  int         entries[6];
-  int         i, j, m, n;
-  int         mean, stages;
-  int         x, y, width, height, level;
-  uint32_t    n1, n2, n3, n4;
-
-  /* initialize list for breadth first processing of vectors */
-  list[0] = pixels;
-
-  /* recursively process vector */
-  for (i=0, m=1, n=1, level=5; i < n; i++) {
-    SVQ1_PROCESS_VECTOR();
-
-    /* destination address and vector size */
-    dst = (uint32_t *) list[i];
-    width = 1 << ((4 + level) /2);
-    height = 1 << ((3 + level) /2);
-
-    /* get number of stages (-1 skips vector, 0 for mean only) */
-    stages = get_vlc2(bitbuf, svq1_inter_multistage[level].table, 3, 2) - 1;
-
-    if (stages == -1) continue; /* skip vector */
-
-    if ((stages > 0) && (level >= 4)) {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error (svq1_decode_block_non_intra): invalid vector: stages=%i level=%i\n",stages,level);
-#endif
-      return -1;        /* invalid vector */
-    }
-
-    mean = get_vlc2(bitbuf, svq1_inter_mean.table, 9, 3) - 256;
-
-    SVQ1_CALC_CODEBOOK_ENTRIES(svq1_inter_codebooks);
-    SVQ1_DO_CODEBOOK_NONINTRA()
-  }
-  return 0;
-}
-
-static int svq1_decode_motion_vector (GetBitContext *bitbuf, svq1_pmv_t *mv, svq1_pmv_t **pmv) {
-  int        diff;
-  int        i;
-
-  for (i=0; i < 2; i++) {
-
-    /* get motion code */
-    diff = get_vlc2(bitbuf, svq1_motion_component.table, 7, 2);
-    if(diff<0)
-        return -1;
-    else if(diff){
-        if(get_bits1(bitbuf)) diff= -diff;
-    }
-
-    /* add median of motion vector predictors and clip result */
-    if (i == 1)
-      mv->y = ((diff + mid_pred(pmv[0]->y, pmv[1]->y, pmv[2]->y)) << 26) >> 26;
-    else
-      mv->x = ((diff + mid_pred(pmv[0]->x, pmv[1]->x, pmv[2]->x)) << 26) >> 26;
-  }
-
-  return 0;
-}
-
-static void svq1_skip_block (uint8_t *current, uint8_t *previous, int pitch, int x, int y) {
-  uint8_t *src;
-  uint8_t *dst;
-  int      i;
-
-  src = &previous[x + y*pitch];
-  dst = current;
-
-  for (i=0; i < 16; i++) {
-    memcpy (dst, src, 16);
-    src += pitch;
-    dst += pitch;
-  }
-}
-
-static int svq1_motion_inter_block (MpegEncContext *s, GetBitContext *bitbuf,
-                               uint8_t *current, uint8_t *previous, int pitch,
-                               svq1_pmv_t *motion, int x, int y) {
-  uint8_t    *src;
-  uint8_t    *dst;
-  svq1_pmv_t  mv;
-  svq1_pmv_t *pmv[3];
-  int         result;
-
-  /* predict and decode motion vector */
-  pmv[0] = &motion[0];
-  if (y == 0) {
-    pmv[1] =
-    pmv[2] = pmv[0];
-  }
-  else {
-    pmv[1] = &motion[(x / 8) + 2];
-    pmv[2] = &motion[(x / 8) + 4];
-  }
-
-  result = svq1_decode_motion_vector (bitbuf, &mv, pmv);
-
-  if (result != 0)
-    return result;
-
-  motion[0].x                =
-  motion[(x / 8) + 2].x      =
-  motion[(x / 8) + 3].x      = mv.x;
-  motion[0].y                =
-  motion[(x / 8) + 2].y      =
-  motion[(x / 8) + 3].y      = mv.y;
-
-  if(y + (mv.y >> 1)<0)
-     mv.y= 0;
-  if(x + (mv.x >> 1)<0)
-     mv.x= 0;
-
-#if 0
-  int w= (s->width+15)&~15;
-  int h= (s->height+15)&~15;
-  if(x + (mv.x >> 1)<0 || y + (mv.y >> 1)<0 || x + (mv.x >> 1) + 16 > w || y + (mv.y >> 1) + 16> h)
-      av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mv.x >> 1), y + (mv.y >> 1));
-#endif
-
-  src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch];
-  dst = current;
-
-  s->dsp.put_pixels_tab[0][((mv.y & 1) << 1) | (mv.x & 1)](dst,src,pitch,16);
-
-  return 0;
-}
-
-static int svq1_motion_inter_4v_block (MpegEncContext *s, GetBitContext *bitbuf,
-                                  uint8_t *current, uint8_t *previous, int pitch,
-                                  svq1_pmv_t *motion,int x, int y) {
-  uint8_t    *src;
-  uint8_t    *dst;
-  svq1_pmv_t  mv;
-  svq1_pmv_t *pmv[4];
-  int         i, result;
-
-  /* predict and decode motion vector (0) */
-  pmv[0] = &motion[0];
-  if (y == 0) {
-    pmv[1] =
-    pmv[2] = pmv[0];
-  }
-  else {
-    pmv[1] = &motion[(x / 8) + 2];
-    pmv[2] = &motion[(x / 8) + 4];
-  }
-
-  result = svq1_decode_motion_vector (bitbuf, &mv, pmv);
-
-  if (result != 0)
-    return result;
-
-  /* predict and decode motion vector (1) */
-  pmv[0] = &mv;
-  if (y == 0) {
-    pmv[1] =
-    pmv[2] = pmv[0];
-  }
-  else {
-    pmv[1] = &motion[(x / 8) + 3];
-  }
-  result = svq1_decode_motion_vector (bitbuf, &motion[0], pmv);
-
-  if (result != 0)
-    return result;
-
-  /* predict and decode motion vector (2) */
-  pmv[1] = &motion[0];
-  pmv[2] = &motion[(x / 8) + 1];
-
-  result = svq1_decode_motion_vector (bitbuf, &motion[(x / 8) + 2], pmv);
-
-  if (result != 0)
-    return result;
-
-  /* predict and decode motion vector (3) */
-  pmv[2] = &motion[(x / 8) + 2];
-  pmv[3] = &motion[(x / 8) + 3];
-
-  result = svq1_decode_motion_vector (bitbuf, pmv[3], pmv);
-
-  if (result != 0)
-    return result;
-
-  /* form predictions */
-  for (i=0; i < 4; i++) {
-    int mvx= pmv[i]->x + (i&1)*16;
-    int mvy= pmv[i]->y + (i>>1)*16;
-
-    ///XXX /FIXME cliping or padding?
-    if(y + (mvy >> 1)<0)
-       mvy= 0;
-    if(x + (mvx >> 1)<0)
-       mvx= 0;
-
-#if 0
-  int w= (s->width+15)&~15;
-  int h= (s->height+15)&~15;
-  if(x + (mvx >> 1)<0 || y + (mvy >> 1)<0 || x + (mvx >> 1) + 8 > w || y + (mvy >> 1) + 8> h)
-      av_log(s->avctx, AV_LOG_INFO, "%d %d %d %d\n", x, y, x + (mvx >> 1), y + (mvy >> 1));
-#endif
-    src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1))*pitch];
-    dst = current;
-
-    s->dsp.put_pixels_tab[1][((mvy & 1) << 1) | (mvx & 1)](dst,src,pitch,8);
-
-    /* select next block */
-    if (i & 1) {
-      current  += 8*(pitch - 1);
-    } else {
-      current  += 8;
-    }
-  }
-
-  return 0;
-}
-
-static int svq1_decode_delta_block (MpegEncContext *s, GetBitContext *bitbuf,
-                        uint8_t *current, uint8_t *previous, int pitch,
-                        svq1_pmv_t *motion, int x, int y) {
-  uint32_t block_type;
-  int      result = 0;
-
-  /* get block type */
-  block_type = get_vlc2(bitbuf, svq1_block_type.table, 2, 2);
-
-  /* reset motion vectors */
-  if (block_type == SVQ1_BLOCK_SKIP || block_type == SVQ1_BLOCK_INTRA) {
-    motion[0].x                 =
-    motion[0].y                 =
-    motion[(x / 8) + 2].x =
-    motion[(x / 8) + 2].y =
-    motion[(x / 8) + 3].x =
-    motion[(x / 8) + 3].y = 0;
-  }
-
-  switch (block_type) {
-  case SVQ1_BLOCK_SKIP:
-    svq1_skip_block (current, previous, pitch, x, y);
-    break;
-
-  case SVQ1_BLOCK_INTER:
-    result = svq1_motion_inter_block (s, bitbuf, current, previous, pitch, motion, x, y);
-
-    if (result != 0)
-    {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_motion_inter_block %i\n",result);
-#endif
-      break;
-    }
-    result = svq1_decode_block_non_intra (bitbuf, current, pitch);
-    break;
-
-  case SVQ1_BLOCK_INTER_4V:
-    result = svq1_motion_inter_4v_block (s, bitbuf, current, previous, pitch, motion, x, y);
-
-    if (result != 0)
-    {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_motion_inter_4v_block %i\n",result);
-#endif
-      break;
-    }
-    result = svq1_decode_block_non_intra (bitbuf, current, pitch);
-    break;
-
-  case SVQ1_BLOCK_INTRA:
-    result = svq1_decode_block_intra (bitbuf, current, pitch);
-    break;
-  }
-
-  return result;
-}
-
-/* standard video sizes */
-static struct { int width; int height; } svq1_frame_size_table[8] = {
-  { 160, 120 }, { 128,  96 }, { 176, 144 }, { 352, 288 },
-  { 704, 576 }, { 240, 180 }, { 320, 240 }, {  -1,  -1 }
-};
-
-static uint16_t svq1_packet_checksum (uint8_t *data, int length, int value) {
-  int i;
-
-  for (i=0; i < length; i++) {
-    value = checksum_table[data[i] ^ (value >> 8)] ^ ((value & 0xFF) << 8);
-  }
-
-  return value;
-}
-
-#if 0 /* unused, remove? */
-static uint16_t svq1_component_checksum (uint16_t *pixels, int pitch,
-                                         int width, int height, int value) {
-  int x, y;
-
-  for (y=0; y < height; y++) {
-    for (x=0; x < width; x++) {
-      value = checksum_table[pixels[x] ^ (value >> 8)] ^ ((value & 0xFF) << 8);
-    }
-
-    pixels += pitch;
-  }
-
-  return value;
-}
-#endif
-
-#ifdef CONFIG_DECODERS
-static void svq1_parse_string (GetBitContext *bitbuf, uint8_t *out) {
-  uint8_t seed;
-  int     i;
-
-  out[0] = get_bits (bitbuf, 8);
-
-  seed = string_table[out[0]];
-
-  for (i=1; i <= out[0]; i++) {
-    out[i] = get_bits (bitbuf, 8) ^ seed;
-    seed   = string_table[out[i] ^ seed];
-  }
-}
-
-static int svq1_decode_frame_header (GetBitContext *bitbuf,MpegEncContext *s) {
-  int frame_size_code;
-  int temporal_reference;
-
-  temporal_reference = get_bits (bitbuf, 8);
-
-  /* frame type */
-  s->pict_type= get_bits (bitbuf, 2)+1;
-  if(s->pict_type==4)
-      return -1;
-
-  if (s->pict_type == I_TYPE) {
-
-    /* unknown fields */
-    if (s->f_code == 0x50 || s->f_code == 0x60) {
-      int csum = get_bits (bitbuf, 16);
-
-      csum = svq1_packet_checksum ((uint8_t *)bitbuf->buffer, bitbuf->size_in_bits>>3, csum);
-
-//      av_log(s->avctx, AV_LOG_INFO, "%s checksum (%02x) for packet data\n",
-//              (csum == 0) ? "correct" : "incorrect", csum);
-    }
-
-    if ((s->f_code ^ 0x10) >= 0x50) {
-      uint8_t msg[256];
-
-      svq1_parse_string (bitbuf, msg);
-
-      av_log(s->avctx, AV_LOG_INFO, "embedded message: \"%s\"\n", (char *) msg);
-    }
-
-    skip_bits (bitbuf, 2);
-    skip_bits (bitbuf, 2);
-    skip_bits1 (bitbuf);
-
-    /* load frame size */
-    frame_size_code = get_bits (bitbuf, 3);
-
-    if (frame_size_code == 7) {
-      /* load width, height (12 bits each) */
-      s->width = get_bits (bitbuf, 12);
-      s->height = get_bits (bitbuf, 12);
-
-      if (!s->width || !s->height)
-        return -1;
-    } else {
-      /* get width, height from table */
-      s->width = svq1_frame_size_table[frame_size_code].width;
-      s->height = svq1_frame_size_table[frame_size_code].height;
-    }
-  }
-
-  /* unknown fields */
-  if (get_bits (bitbuf, 1) == 1) {
-    skip_bits1 (bitbuf);       /* use packet checksum if (1) */
-    skip_bits1 (bitbuf);       /* component checksums after image data if (1) */
-
-    if (get_bits (bitbuf, 2) != 0)
-      return -1;
-  }
-
-  if (get_bits (bitbuf, 1) == 1) {
-    skip_bits1 (bitbuf);
-    skip_bits (bitbuf, 4);
-    skip_bits1 (bitbuf);
-    skip_bits (bitbuf, 2);
-
-    while (get_bits (bitbuf, 1) == 1) {
-      skip_bits (bitbuf, 8);
-    }
-  }
-
-  return 0;
-}
-
-static int svq1_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             uint8_t *buf, int buf_size)
-{
-  MpegEncContext *s=avctx->priv_data;
-  uint8_t        *current, *previous;
-  int             result, i, x, y, width, height;
-  AVFrame *pict = data;
-
-  /* initialize bit buffer */
-  init_get_bits(&s->gb,buf,buf_size*8);
-
-  /* decode frame header */
-  s->f_code = get_bits (&s->gb, 22);
-
-  if ((s->f_code & ~0x70) || !(s->f_code & 0x60))
-    return -1;
-
-  /* swap some header bytes (why?) */
-  if (s->f_code != 0x20) {
-    uint32_t *src = (uint32_t *) (buf + 4);
-
-    for (i=0; i < 4; i++) {
-      src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i];
-    }
-  }
-
-  result = svq1_decode_frame_header (&s->gb, s);
-
-  if (result != 0)
-  {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_frame_header %i\n",result);
-#endif
-    return result;
-  }
-
-  //FIXME this avoids some confusion for "B frames" without 2 references
-  //this should be removed after libavcodec can handle more flexible picture types & ordering
-  if(s->pict_type==B_TYPE && s->last_picture_ptr==NULL) return buf_size;
-
-  if(avctx->hurry_up && s->pict_type==B_TYPE) return buf_size;
-  if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
-     ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
-     || avctx->skip_frame >= AVDISCARD_ALL)
-      return buf_size;
-
-  if(MPV_frame_start(s, avctx) < 0)
-      return -1;
-
-  /* decode y, u and v components */
-  for (i=0; i < 3; i++) {
-    int linesize;
-    if (i == 0) {
-      width  = (s->width+15)&~15;
-      height = (s->height+15)&~15;
-      linesize= s->linesize;
-    } else {
-      if(s->flags&CODEC_FLAG_GRAY) break;
-      width  = (s->width/4+15)&~15;
-      height = (s->height/4+15)&~15;
-      linesize= s->uvlinesize;
-    }
-
-    current  = s->current_picture.data[i];
-
-    if(s->pict_type==B_TYPE){
-        previous = s->next_picture.data[i];
-    }else{
-        previous = s->last_picture.data[i];
-    }
-
-    if (s->pict_type == I_TYPE) {
-      /* keyframe */
-      for (y=0; y < height; y+=16) {
-        for (x=0; x < width; x+=16) {
-          result = svq1_decode_block_intra (&s->gb, &current[x], linesize);
-          if (result != 0)
-          {
-//#ifdef DEBUG_SVQ1
-            av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n",result);
-//#endif
-            return result;
-          }
-        }
-        current += 16*linesize;
-      }
-    } else {
-      svq1_pmv_t pmv[width/8+3];
-      /* delta frame */
-      memset (pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv_t));
-
-      for (y=0; y < height; y+=16) {
-        for (x=0; x < width; x+=16) {
-          result = svq1_decode_delta_block (s, &s->gb, &current[x], previous,
-                                            linesize, pmv, x, y);
-          if (result != 0)
-          {
-#ifdef DEBUG_SVQ1
-    av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_delta_block %i\n",result);
-#endif
-            return result;
-          }
-        }
-
-        pmv[0].x =
-        pmv[0].y = 0;
-
-        current += 16*linesize;
-      }
-    }
-  }
-
-  *pict = *(AVFrame*)&s->current_picture;
-
-
-  MPV_frame_end(s);
-
-  *data_size=sizeof(AVFrame);
-  return buf_size;
-}
-
-static int svq1_decode_init(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-    int i;
-
-    MPV_decode_defaults(s);
-
-    s->avctx = avctx;
-    s->width = (avctx->width+3)&~3;
-    s->height = (avctx->height+3)&~3;
-    s->codec_id= avctx->codec->id;
-    avctx->pix_fmt = PIX_FMT_YUV410P;
-    avctx->has_b_frames= 1; // not true, but DP frames and these behave like unidirectional b frames
-    s->flags= avctx->flags;
-    if (MPV_common_init(s) < 0) return -1;
-
-    init_vlc(&svq1_block_type, 2, 4,
-        &svq1_block_type_vlc[0][1], 2, 1,
-        &svq1_block_type_vlc[0][0], 2, 1, 1);
-
-    init_vlc(&svq1_motion_component, 7, 33,
-        &mvtab[0][1], 2, 1,
-        &mvtab[0][0], 2, 1, 1);
-
-    for (i = 0; i < 6; i++) {
-        init_vlc(&svq1_intra_multistage[i], 3, 8,
-            &svq1_intra_multistage_vlc[i][0][1], 2, 1,
-            &svq1_intra_multistage_vlc[i][0][0], 2, 1, 1);
-        init_vlc(&svq1_inter_multistage[i], 3, 8,
-            &svq1_inter_multistage_vlc[i][0][1], 2, 1,
-            &svq1_inter_multistage_vlc[i][0][0], 2, 1, 1);
-    }
-
-    init_vlc(&svq1_intra_mean, 8, 256,
-        &svq1_intra_mean_vlc[0][1], 4, 2,
-        &svq1_intra_mean_vlc[0][0], 4, 2, 1);
-
-    init_vlc(&svq1_inter_mean, 9, 512,
-        &svq1_inter_mean_vlc[0][1], 4, 2,
-        &svq1_inter_mean_vlc[0][0], 4, 2, 1);
-
-    return 0;
-}
-
-static int svq1_decode_end(AVCodecContext *avctx)
-{
-    MpegEncContext *s = avctx->priv_data;
-
-    MPV_common_end(s);
-    return 0;
-}
-#endif /* CONFIG_DECODERS */
-
-#ifdef CONFIG_ENCODERS
-static void svq1_write_header(SVQ1Context *s, int frame_type)
-{
-    int i;
-
-    /* frame code */
-    put_bits(&s->pb, 22, 0x20);
-
-    /* temporal reference (sure hope this is a "don't care") */
-    put_bits(&s->pb, 8, 0x00);
-
-    /* frame type */
-    put_bits(&s->pb, 2, frame_type - 1);
-
-    if (frame_type == I_TYPE) {
-
-        /* no checksum since frame code is 0x20 */
-
-        /* no embedded string either */
-
-        /* output 5 unknown bits (2 + 2 + 1) */
-        put_bits(&s->pb, 5, 0);
-
-        for (i = 0; i < 7; i++)
-        {
-            if ((svq1_frame_size_table[i].width == s->frame_width) &&
-                (svq1_frame_size_table[i].height == s->frame_height))
-            {
-                put_bits(&s->pb, 3, i);
-                break;
-            }
-        }
-
-        if (i == 7)
-        {
-            put_bits(&s->pb, 3, 7);
-                put_bits(&s->pb, 12, s->frame_width);
-                put_bits(&s->pb, 12, s->frame_height);
-        }
-    }
-
-    /* no checksum or extra data (next 2 bits get 0) */
-    put_bits(&s->pb, 2, 0);
-}
-
-
-#define QUALITY_THRESHOLD 100
-#define THRESHOLD_MULTIPLIER 0.6
-
-#if defined(HAVE_ALTIVEC)
-#undef vector
-#endif
-
-static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){
-    int count, y, x, i, j, split, best_mean, best_score, best_count;
-    int best_vector[6];
-    int block_sum[7]= {0, 0, 0, 0, 0, 0};
-    int w= 2<<((level+2)>>1);
-    int h= 2<<((level+1)>>1);
-    int size=w*h;
-    int16_t block[7][256];
-    const int8_t *codebook_sum, *codebook;
-    const uint16_t (*mean_vlc)[2];
-    const uint8_t (*multistage_vlc)[2];
-
-    best_score=0;
-    //FIXME optimize, this doenst need to be done multiple times
-    if(intra){
-        codebook_sum= svq1_intra_codebook_sum[level];
-        codebook= svq1_intra_codebooks[level];
-        mean_vlc= svq1_intra_mean_vlc;
-        multistage_vlc= svq1_intra_multistage_vlc[level];
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                int v= src[x + y*stride];
-                block[0][x + w*y]= v;
-                best_score += v*v;
-                block_sum[0] += v;
-            }
-        }
-    }else{
-        codebook_sum= svq1_inter_codebook_sum[level];
-        codebook= svq1_inter_codebooks[level];
-        mean_vlc= svq1_inter_mean_vlc + 256;
-        multistage_vlc= svq1_inter_multistage_vlc[level];
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                int v= src[x + y*stride] - ref[x + y*stride];
-                block[0][x + w*y]= v;
-                best_score += v*v;
-                block_sum[0] += v;
-            }
-        }
-    }
-
-    best_count=0;
-    best_score -= ((block_sum[0]*block_sum[0])>>(level+3));
-    best_mean= (block_sum[0] + (size>>1)) >> (level+3);
-
-    if(level<4){
-        for(count=1; count<7; count++){
-            int best_vector_score= INT_MAX;
-            int best_vector_sum=-999, best_vector_mean=-999;
-            const int stage= count-1;
-            const int8_t *vector;
-
-            for(i=0; i<16; i++){
-                int sum= codebook_sum[stage*16 + i];
-                int sqr=0;
-                int diff, mean, score;
-
-                vector = codebook + stage*size*16 + i*size;
-
-                for(j=0; j<size; j++){
-                    int v= vector[j];
-                    sqr += (v - block[stage][j])*(v - block[stage][j]);
-                }
-                diff= block_sum[stage] - sum;
-                mean= (diff + (size>>1)) >> (level+3);
-                assert(mean >-300 && mean<300);
-                if(intra) mean= clip(mean, 0, 255);
-                else      mean= clip(mean, -256, 255);
-                score= sqr - ((diff*(int64_t)diff)>>(level+3)); //FIXME 64bit slooow
-                if(score < best_vector_score){
-                    best_vector_score= score;
-                    best_vector[stage]= i;
-                    best_vector_sum= sum;
-                    best_vector_mean= mean;
-                }
-            }
-            assert(best_vector_mean != -999);
-            vector= codebook + stage*size*16 + best_vector[stage]*size;
-            for(j=0; j<size; j++){
-                block[stage+1][j] = block[stage][j] - vector[j];
-            }
-            block_sum[stage+1]= block_sum[stage] - best_vector_sum;
-            best_vector_score +=
-                lambda*(+ 1 + 4*count
-                        + multistage_vlc[1+count][1]
-                        + mean_vlc[best_vector_mean][1]);
-
-            if(best_vector_score < best_score){
-                best_score= best_vector_score;
-                best_count= count;
-                best_mean= best_vector_mean;
-            }
-        }
-    }
-
-    split=0;
-    if(best_score > threshold && level){
-        int score=0;
-        int offset= (level&1) ? stride*h/2 : w/2;
-        PutBitContext backup[6];
-
-        for(i=level-1; i>=0; i--){
-            backup[i]= s->reorder_pb[i];
-        }
-        score += encode_block(s, src         , ref         , decoded         , stride, level-1, threshold>>1, lambda, intra);
-        score += encode_block(s, src + offset, ref + offset, decoded + offset, stride, level-1, threshold>>1, lambda, intra);
-        score += lambda;
-
-        if(score < best_score){
-            best_score= score;
-            split=1;
-        }else{
-            for(i=level-1; i>=0; i--){
-                s->reorder_pb[i]= backup[i];
-            }
-        }
-    }
-    if (level > 0)
-        put_bits(&s->reorder_pb[level], 1, split);
-
-    if(!split){
-        assert((best_mean >= 0 && best_mean<256) || !intra);
-        assert(best_mean >= -256 && best_mean<256);
-        assert(best_count >=0 && best_count<7);
-        assert(level<4 || best_count==0);
-
-        /* output the encoding */
-        put_bits(&s->reorder_pb[level],
-            multistage_vlc[1 + best_count][1],
-            multistage_vlc[1 + best_count][0]);
-        put_bits(&s->reorder_pb[level], mean_vlc[best_mean][1],
-            mean_vlc[best_mean][0]);
-
-        for (i = 0; i < best_count; i++){
-            assert(best_vector[i]>=0 && best_vector[i]<16);
-            put_bits(&s->reorder_pb[level], 4, best_vector[i]);
-        }
-
-        for(y=0; y<h; y++){
-            for(x=0; x<w; x++){
-                decoded[x + y*stride]= src[x + y*stride] - block[best_count][x + w*y] + best_mean;
-            }
-        }
-    }
-
-    return best_score;
-}
-
-
-static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane, unsigned char *ref_plane, unsigned char *decoded_plane,
-    int width, int height, int src_stride, int stride)
-{
-    int x, y;
-    int i;
-    int block_width, block_height;
-    int level;
-    int threshold[6];
-    const int lambda= (s->picture.quality*s->picture.quality) >> (2*FF_LAMBDA_SHIFT);
-
-    /* figure out the acceptable level thresholds in advance */
-    threshold[5] = QUALITY_THRESHOLD;
-    for (level = 4; level >= 0; level--)
-        threshold[level] = threshold[level + 1] * THRESHOLD_MULTIPLIER;
-
-    block_width = (width + 15) / 16;
-    block_height = (height + 15) / 16;
-
-    if(s->picture.pict_type == P_TYPE){
-        s->m.avctx= s->avctx;
-        s->m.current_picture_ptr= &s->m.current_picture;
-        s->m.last_picture_ptr   = &s->m.last_picture;
-        s->m.last_picture.data[0]= ref_plane;
-        s->m.linesize=
-        s->m.last_picture.linesize[0]=
-        s->m.new_picture.linesize[0]=
-        s->m.current_picture.linesize[0]= stride;
-        s->m.width= width;
-        s->m.height= height;
-        s->m.mb_width= block_width;
-        s->m.mb_height= block_height;
-        s->m.mb_stride= s->m.mb_width+1;
-        s->m.b8_stride= 2*s->m.mb_width+1;
-        s->m.f_code=1;
-        s->m.pict_type= s->picture.pict_type;
-        s->m.me_method= s->avctx->me_method;
-        s->m.me.scene_change_score=0;
-        s->m.flags= s->avctx->flags;
-//        s->m.out_format = FMT_H263;
-//        s->m.unrestricted_mv= 1;
-
-        s->m.lambda= s->picture.quality;
-        s->m.qscale= (s->m.lambda*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
-        s->m.lambda2= (s->m.lambda*s->m.lambda + FF_LAMBDA_SCALE/2) >> FF_LAMBDA_SHIFT;
-
-        if(!s->motion_val8[plane]){
-            s->motion_val8 [plane]= av_mallocz((s->m.b8_stride*block_height*2 + 2)*2*sizeof(int16_t));
-            s->motion_val16[plane]= av_mallocz((s->m.mb_stride*(block_height + 2) + 1)*2*sizeof(int16_t));
-        }
-
-        s->m.mb_type= s->mb_type;
-
-        //dummies, to avoid segfaults
-        s->m.current_picture.mb_mean=   (uint8_t *)s->dummy;
-        s->m.current_picture.mb_var=    (uint16_t*)s->dummy;
-        s->m.current_picture.mc_mb_var= (uint16_t*)s->dummy;
-        s->m.current_picture.mb_type= s->dummy;
-
-        s->m.current_picture.motion_val[0]= s->motion_val8[plane] + 2;
-        s->m.p_mv_table= s->motion_val16[plane] + s->m.mb_stride + 1;
-        s->m.dsp= s->dsp; //move
-        ff_init_me(&s->m);
-
-        s->m.me.dia_size= s->avctx->dia_size;
-        s->m.first_slice_line=1;
-        for (y = 0; y < block_height; y++) {
-            uint8_t src[stride*16];
-
-            s->m.new_picture.data[0]= src - y*16*stride; //ugly
-            s->m.mb_y= y;
-
-            for(i=0; i<16 && i + 16*y<height; i++){
-                memcpy(&src[i*stride], &src_plane[(i+16*y)*src_stride], width);
-                for(x=width; x<16*block_width; x++)
-                    src[i*stride+x]= src[i*stride+x-1];
-            }
-            for(; i<16 && i + 16*y<16*block_height; i++)
-                memcpy(&src[i*stride], &src[(i-1)*stride], 16*block_width);
-
-            for (x = 0; x < block_width; x++) {
-                s->m.mb_x= x;
-                ff_init_block_index(&s->m);
-                ff_update_block_index(&s->m);
-
-                ff_estimate_p_frame_motion(&s->m, x, y);
-            }
-            s->m.first_slice_line=0;
-        }
-
-        ff_fix_long_p_mvs(&s->m);
-        ff_fix_long_mvs(&s->m, NULL, 0, s->m.p_mv_table, s->m.f_code, CANDIDATE_MB_TYPE_INTER, 0);
-    }
-
-    s->m.first_slice_line=1;
-    for (y = 0; y < block_height; y++) {
-        uint8_t src[stride*16];
-
-        for(i=0; i<16 && i + 16*y<height; i++){
-            memcpy(&src[i*stride], &src_plane[(i+16*y)*src_stride], width);
-            for(x=width; x<16*block_width; x++)
-                src[i*stride+x]= src[i*stride+x-1];
-        }
-        for(; i<16 && i + 16*y<16*block_height; i++)
-            memcpy(&src[i*stride], &src[(i-1)*stride], 16*block_width);
-
-        s->m.mb_y= y;
-        for (x = 0; x < block_width; x++) {
-            uint8_t reorder_buffer[3][6][7*32];
-            int count[3][6];
-            int offset = y * 16 * stride + x * 16;
-            uint8_t *decoded= decoded_plane + offset;
-            uint8_t *ref= ref_plane + offset;
-            int score[4]={0,0,0,0}, best;
-            uint8_t temp[16*stride];
-
-            if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < 3000){ //FIXME check size
-                av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
-                return -1;
-            }
-
-            s->m.mb_x= x;
-            ff_init_block_index(&s->m);
-            ff_update_block_index(&s->m);
-
-            if(s->picture.pict_type == I_TYPE || (s->m.mb_type[x + y*s->m.mb_stride]&CANDIDATE_MB_TYPE_INTRA)){
-                for(i=0; i<6; i++){
-                    init_put_bits(&s->reorder_pb[i], reorder_buffer[0][i], 7*32);
-                }
-                if(s->picture.pict_type == P_TYPE){
-                    const uint8_t *vlc= svq1_block_type_vlc[SVQ1_BLOCK_INTRA];
-                    put_bits(&s->reorder_pb[5], vlc[1], vlc[0]);
-                    score[0]= vlc[1]*lambda;
-                }
-                score[0]+= encode_block(s, src+16*x, NULL, temp, stride, 5, 64, lambda, 1);
-                for(i=0; i<6; i++){
-                    count[0][i]= put_bits_count(&s->reorder_pb[i]);
-                    flush_put_bits(&s->reorder_pb[i]);
-                }
-            }else
-                score[0]= INT_MAX;
-
-            best=0;
-
-            if(s->picture.pict_type == P_TYPE){
-                const uint8_t *vlc= svq1_block_type_vlc[SVQ1_BLOCK_INTER];
-                int mx, my, pred_x, pred_y, dxy;
-                int16_t *motion_ptr;
-
-                motion_ptr= h263_pred_motion(&s->m, 0, 0, &pred_x, &pred_y);
-                if(s->m.mb_type[x + y*s->m.mb_stride]&CANDIDATE_MB_TYPE_INTER){
-                    for(i=0; i<6; i++)
-                        init_put_bits(&s->reorder_pb[i], reorder_buffer[1][i], 7*32);
-
-                    put_bits(&s->reorder_pb[5], vlc[1], vlc[0]);
-
-                    s->m.pb= s->reorder_pb[5];
-                    mx= motion_ptr[0];
-                    my= motion_ptr[1];
-                    assert(mx>=-32 && mx<=31);
-                    assert(my>=-32 && my<=31);
-                    assert(pred_x>=-32 && pred_x<=31);
-                    assert(pred_y>=-32 && pred_y<=31);
-                    ff_h263_encode_motion(&s->m, mx - pred_x, 1);
-                    ff_h263_encode_motion(&s->m, my - pred_y, 1);
-                    s->reorder_pb[5]= s->m.pb;
-                    score[1] += lambda*put_bits_count(&s->reorder_pb[5]);
-
-                    dxy= (mx&1) + 2*(my&1);
-
-                    s->dsp.put_pixels_tab[0][dxy](temp+16, ref + (mx>>1) + stride*(my>>1), stride, 16);
-
-                    score[1]+= encode_block(s, src+16*x, temp+16, decoded, stride, 5, 64, lambda, 0);
-                    best= score[1] <= score[0];
-
-                    vlc= svq1_block_type_vlc[SVQ1_BLOCK_SKIP];
-                    score[2]= s->dsp.sse[0](NULL, src+16*x, ref, stride, 16);
-                    score[2]+= vlc[1]*lambda;
-                    if(score[2] < score[best] && mx==0 && my==0){
-                        best=2;
-                        s->dsp.put_pixels_tab[0][0](decoded, ref, stride, 16);
-                        for(i=0; i<6; i++){
-                            count[2][i]=0;
-                        }
-                        put_bits(&s->pb, vlc[1], vlc[0]);
-                    }
-                }
-
-                if(best==1){
-                    for(i=0; i<6; i++){
-                        count[1][i]= put_bits_count(&s->reorder_pb[i]);
-                        flush_put_bits(&s->reorder_pb[i]);
-                    }
-                }else{
-                    motion_ptr[0                 ] = motion_ptr[1                 ]=
-                    motion_ptr[2                 ] = motion_ptr[3                 ]=
-                    motion_ptr[0+2*s->m.b8_stride] = motion_ptr[1+2*s->m.b8_stride]=
-                    motion_ptr[2+2*s->m.b8_stride] = motion_ptr[3+2*s->m.b8_stride]=0;
-                }
-            }
-
-            s->rd_total += score[best];
-
-            for(i=5; i>=0; i--){
-                ff_copy_bits(&s->pb, reorder_buffer[best][i], count[best][i]);
-            }
-            if(best==0){
-                s->dsp.put_pixels_tab[0][0](decoded, temp, stride, 16);
-            }
-        }
-        s->m.first_slice_line=0;
-    }
-    return 0;
-}
-
-static int svq1_encode_init(AVCodecContext *avctx)
-{
-    SVQ1Context * const s = avctx->priv_data;
-
-    dsputil_init(&s->dsp, avctx);
-    avctx->coded_frame= (AVFrame*)&s->picture;
-
-    s->frame_width = avctx->width;
-    s->frame_height = avctx->height;
-
-    s->y_block_width = (s->frame_width + 15) / 16;
-    s->y_block_height = (s->frame_height + 15) / 16;
-
-    s->c_block_width = (s->frame_width / 4 + 15) / 16;
-    s->c_block_height = (s->frame_height / 4 + 15) / 16;
-
-    s->avctx= avctx;
-    s->m.avctx= avctx;
-    s->m.me.scratchpad= av_mallocz((avctx->width+64)*2*16*2*sizeof(uint8_t));
-    s->m.me.map       = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t));
-    s->m.me.score_map = av_mallocz(ME_MAP_SIZE*sizeof(uint32_t));
-    s->mb_type        = av_mallocz((s->y_block_width+1)*s->y_block_height*sizeof(int16_t));
-    s->dummy          = av_mallocz((s->y_block_width+1)*s->y_block_height*sizeof(int32_t));
-    h263_encode_init(&s->m); //mv_penalty
-
-    return 0;
-}
-
-static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf,
-    int buf_size, void *data)
-{
-    SVQ1Context * const s = avctx->priv_data;
-    AVFrame *pict = data;
-    AVFrame * const p= (AVFrame*)&s->picture;
-    AVFrame temp;
-    int i;
-
-    if(avctx->pix_fmt != PIX_FMT_YUV410P){
-        av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n");
-        return -1;
-    }
-
-    if(!s->current_picture.data[0]){
-        avctx->get_buffer(avctx, &s->current_picture);
-        avctx->get_buffer(avctx, &s->last_picture);
-    }
-
-    temp= s->current_picture;
-    s->current_picture= s->last_picture;
-    s->last_picture= temp;
-
-    init_put_bits(&s->pb, buf, buf_size);
-
-    *p = *pict;
-    p->pict_type = avctx->frame_number % avctx->gop_size ? P_TYPE : I_TYPE;
-    p->key_frame = p->pict_type == I_TYPE;
-
-    svq1_write_header(s, p->pict_type);
-    for(i=0; i<3; i++){
-        if(svq1_encode_plane(s, i,
-            s->picture.data[i], s->last_picture.data[i], s->current_picture.data[i],
-            s->frame_width / (i?4:1), s->frame_height / (i?4:1),
-            s->picture.linesize[i], s->current_picture.linesize[i]) < 0)
-                return -1;
-    }
-
-//    align_put_bits(&s->pb);
-    while(put_bits_count(&s->pb) & 31)
-        put_bits(&s->pb, 1, 0);
-
-    flush_put_bits(&s->pb);
-
-    return (put_bits_count(&s->pb) / 8);
-}
-
-static int svq1_encode_end(AVCodecContext *avctx)
-{
-    SVQ1Context * const s = avctx->priv_data;
-    int i;
-
-    av_log(avctx, AV_LOG_DEBUG, "RD: %f\n", s->rd_total/(double)(avctx->width*avctx->height*avctx->frame_number));
-
-    av_freep(&s->m.me.scratchpad);
-    av_freep(&s->m.me.map);
-    av_freep(&s->m.me.score_map);
-    av_freep(&s->mb_type);
-    av_freep(&s->dummy);
-
-    for(i=0; i<3; i++){
-        av_freep(&s->motion_val8[i]);
-        av_freep(&s->motion_val16[i]);
-    }
-
-    return 0;
-}
-
-#endif //CONFIG_ENCODERS
-
-#ifdef CONFIG_DECODERS
-AVCodec svq1_decoder = {
-    "svq1",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_SVQ1,
-    sizeof(MpegEncContext),
-    svq1_decode_init,
-    NULL,
-    svq1_decode_end,
-    svq1_decode_frame,
-    CODEC_CAP_DR1,
-    .flush= ff_mpeg_flush,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV410P, -1},
-};
-#endif
-
-#ifdef CONFIG_ENCODERS
-
-AVCodec svq1_encoder = {
-    "svq1",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_SVQ1,
-    sizeof(SVQ1Context),
-    svq1_encode_init,
-    svq1_encode_frame,
-    svq1_encode_end,
-    .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV410P, -1},
-};
-
-#endif //CONFIG_ENCODERS
--- a/src/ffmpeg/libavcodec/svq1_cb.h	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1580 +0,0 @@
-/*
- *
- * Copyright (C) 2002 the xine project
- * Copyright (C) 2002 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Ported to mplayer by Arpi <arpi@thot.banki.hu>
- * Ported to libavcodec by Nick Kurshev <nickols_k@mail.ru>
- *
- */
-
-/**
- * @file svq1_cb.h
- * svq1 code books.
- */
-
-/* 6x16-entry codebook for inter-coded 4x2 vectors */
-static const int8_t svq1_inter_codebook_4x2[768] = {
-    7,  2, -6, -7,  7,  3, -3, -4, -7, -2,  7,  8, -8, -4,  3,  4,
-   19, 17,  9,  3,-14,-16,-12, -8,-18,-16, -8, -3, 11, 14, 12,  8,
-    7,-16,-10, 20,  7,-17,-10, 20, -6, 18,  8,-21, -7, 18,  9,-20,
-   25,  3,-20,-14, 29,  7,-18,-13,-29, -4, 21, 14,-31, -6, 20, 14,
-  -19,-26,-28,-24, 31, 32, 22, 10, 15, 24, 31, 28,-32,-32,-22,-13,
-    2, -8,-23,-26, -9,  3, 27, 35,  3, 11, 21, 21,  8, -4,-27,-34,
-  -30,-31, 12, 47,-29,-30, 13, 47, 38, 30,-17,-46, 34, 26,-19,-46,
-  -42,-50,-51,-43, 34, 48, 55, 48, 48, 54, 51, 42,-44,-52,-53,-47,
-    4,  5,  0, -6, -2, -2,  0,  1,-11, -6, -1, -2,  1,  8,  9,  1,
-    0,  1, -6,  5,  8,  1,-12,  2,  7,-14, -7,  8,  5, -8,  0,  8,
-    1,  4, 11,  8,-12, -8,  0, -5, -1,  1,  0,  4,-15, -8,  3, 16,
-   17,  8, -4, -6,  9, -4,-13, -8,  2,  6,  1,-18, -1, 11, 11,-12,
-    6,  0,  2,  0, 14,  6, -7,-21,  1, -1,-13,-20,  1,  1, 10, 21,
-  -22, -5,  7, 13,-11, -1,  4, 12, -7,  0, 14, 19, -4,  3, -5,-19,
-  -26,-14, 10, 15, 18,  4, -6, -2, 25, 19, -5,-18,-20, -7,  4,  2,
-  -13, -6, -1, -4, 25, 37, -2,-35,  5,  4,  1,  1,-21,-36,  2, 43,
-    2, -2, -1,  3,  8, -2, -6, -1, -2, -3,  2, 12, -5, -2, -2, -1,
-   -3, -1, -1, -5, -1,  7,  8, -2,  2,  7,  5, -3,  1,  1, -3, -8,
-   -3, -1, -3, -2, -2, -3,  2, 13, 15,  0,-11, -6,  3,  0,  0,  0,
-   -6, -9, -5, -4, 18,  4,  1,  3, 12,  3,  0,  4,-16, -3,  3, -3,
-  -17,  3, 18,  2, -1, -3, -1, -1, -6, 16, -8,  0, -9, 14, -7,  0,
-    3,-13, 14, -5,  3,-13, 14, -4, -7, 20, 14,-23,  8, -7, -8,  4,
-    8,-15,-19, 16,-10, 13, 11, -3,  9, -1,  1, 26,  5,-15,-27,  2,
-  -20,  7, 16, -4,-40,  9, 31,  1, 26,-12,-30, -7, 40, -2,-19,  4,
-    6,  0,  0,  0, -6, -2,  1,  2,  0, -1,  0, -6,  9,  0, -2, -1,
-   -7,  8,  2, -3, -1,  2, -3,  2,  7, -4, -2,  4,  2,  0,  0, -6,
-   -3, -2,  9,  2, -2, -1,  0, -4, -3, -3,  0, -3, -6,  2, 10,  4,
-    3,  0,-10,  8,  0,  0, -4,  4, -1,  1,  4,  2,  3, -7, -9,  7,
-    2,  1, -9, -4, -1, 12,  0,  0,  3, -1,  7, -4,  3,-14,  4,  2,
-  -12, -9,  1, 11,  2,  5,  1,  0,  3,  1,  0,  2,  0,  8,  6,-19,
-   -6,-10, -7, -4,  9,  7,  5,  7,  6, 21,  3, -3,-11, -9, -5, -2,
-   -4, -9,-16, -1, -2, -5,  1, 36,  8, 11, 19,  0,  2,  5, -4,-41,
-   -1, -1, -2, -1, -2, -2,  1,  6,  0,  4,  1, -8,  1,  1,  1,  0,
-   -2, -3,  4,  0,  2, -1,  3, -3,  1,  3, -4,  1, -1,  3,  0, -5,
-    3,  4,  2,  3, -2, -3, -6, -1, -2, -3, -2,  2, -4,  8,  1,  0,
-   -7,  4,  2,  6, -7, -1,  1,  0, -2,  2, -4,  1,  8, -6,  2, -1,
-   -6,  2,  0,  2,  5,  4, -8, -1, -1,-11,  0,  9,  0, -2,  2,  2,
-   17, -5, -4, -1, -1, -4, -2, -2,  0,-13,  9, -3, -1, 12, -7,  2,
-    0, -2, -5,  2, -7, -5, 20, -3,  7,  7, -1,-30,  3,  5,  8,  1,
-   -6,  3, -1, -4,  2, -2,-11, 18,  0, -7,  3, 14, 20, -3,-18, -9,
-    7, -2,  0, -1, -2,  0,  0, -1, -4, -1,  1,  0, -2,  2,  0,  4,
-    1, -3,  2,  1,  3,  1, -5,  1, -3,  0, -1, -2,  7,  1,  0, -3,
-    2,  5,  0, -2,  2, -5, -1,  1, -1, -2,  4, -1,  0, -3,  5,  0,
-    0,  3, -1, -2, -4,  1,  5, -1, -1,  0, -1,  9, -1, -2, -1, -1,
-   -2,  5,  5, -1, -2,  2, -3, -2,  1,  2,-11,  1,  2,  1,  3,  2,
-    2,-10, -1, -2,  4,  2,  4,  1,  4,  5, -5,  1,  0,  6,-11,  1,
-    1,  0,  6,  6,  0,  2,  1,-15,  7,  3,  5,  9,-30,  2,  2,  2,
-  -34,  1,  9,  2,  5,  8,  8,  2,  7,  2,  6,  6,  2,-27,  1,  4
-};
-
-/* 6x16-entry codebook for inter-coded 4x4 vectors */
-static const int8_t svq1_inter_codebook_4x4[1536] = {
-    4,  0, -6, -7, -4, -8,-13, -9, -8, -8, -1,  6, -2,  5, 22, 27,
-  -16, -7, 11, 10,-18, -7, 13, 10,-15, -4, 12,  8, -9, -1,  9,  5,
-   -2,  2, 15,-16, -3,  2, 19,-19, -3,  2, 19,-19, -2,  3, 15,-14,
-   17, 22, 22, 16, -6, -7, -5, -2,-12,-16,-16,-12,  1,  1, -1, -3,
-   11,-17,  0,  8, 14,-21, -1,  9, 14,-21, -2,  8, 11,-16, -2,  6,
-    7, -2,-16, 11,  9, -2,-21, 14, 10, -1,-22, 14,  8, -1,-18, 10,
-  -10, 16,  3, -9,-13, 20,  4,-11,-14, 21,  4,-10,-11, 16,  3, -8,
-   11,  4, -9, -9, 15,  6,-12,-14, 17,  8,-12,-14, 16, 10, -7,-11,
-    4, 10, 14, 13, -1,  7, 15, 16,-12, -7,  3,  8,-20,-23,-18,-10,
-  -10,-18,-26,-25,  4,  1, -6,-11, 13, 15, 11,  3, 12, 15, 13,  8,
-  -16,-19,-16,-11,  7, 12, 15, 11, 11, 16, 16, 11, -6, -9,-11,-10,
-   18, 19, 12,  5, 18, 16,  5, -4,  6,  0,-10,-15, -9,-17,-23,-22,
-  -10,-14, -1, 21,-11,-17,  0, 29,-11,-16,  1, 30,-10,-14,  0, 23,
-  -16,-17,-12, -6,-19,-19,-14, -7, -3, -1,  1,  2, 27, 35, 29, 19,
-  -37, -8, 23, 23,-42, -9, 28, 29,-43,-10, 26, 28,-38,-11, 19, 22,
-   32, 16,-16,-33, 39, 20,-18,-37, 38, 19,-19,-38, 32, 15,-17,-34,
-   24,  9, -6, -4, -1,-10, -6,  3, -8, -9, -1,  3,  3,  7,  2, -6,
-   -1, -3, -1,  0, -1,  4,  2, -7, -3, 11,  3,-16,  1, 20,  9,-18,
-   -3, -8,  6, 12, -5,-10,  7, 13, -6, -9,  5,  7, -5, -5,  2, -1,
-   -8, 12, -3, -1,-10, 15, -3,  1,-11, 13, -4,  1,-11,  8, -3,  2,
-    9,  6, -5,-12,  3,  0, -8,-13, -4, -4, -1, -1, -4,  1, 15, 18,
-    9, 13, 14, 12,  4,  3, -1, -2, -2, -5, -8, -5, -7,-11, -9, -4,
-    7, -5, -7, -4, 14, -2, -7, -4, 17,  0, -8, -5, 15,  1, -7, -5,
-  -10, -1,  6,  4,-15, -9,  2,  4,  2, -1, -3,  0, 25, 13, -8,-10,
-    7, 11, -3,-16,  7, 11, -3,-15,  6,  7, -2, -9,  4,  2, -3, -5,
-   -7, -1, -1,  0, -9, -2,  2,  6,-12, -4,  6, 14,-13, -6,  8, 19,
-  -18,-18,-11, -5, -3,  0,  3,  4,  6,  8,  6,  6,  6,  6,  6,  6,
-   -5,  3, 13,-10, -6,  1, 15, -9, -6, -3, 15, -6, -6, -6, 10, -3,
-    9,  1, -9, -9, 11,  9,  6,  5,  0,  3,  8,  7,-15,-14, -6, -5,
-  -11, -6, 11, 19, -2, -5, -9, -8,  6,  2, -9,-10,  6,  5,  4,  5,
-   -7, -3,  8, 15, -1,  3, 10, 15,  5,  5, -1, -2,  4, -2,-21,-25,
-    6, -6, -6,  5,  8, -9, -7,  9,  8,-12, -7, 13,  4,-14, -7, 14,
-   -4, -3,  1,  1, -3, -5, -2, -3,  7,  0, -2, -4, 20,  7, -4, -4,
-   -3,-20, -6, 10,  6,  0,  0,  1,  5,  8,  5, -1, -3,  0,  0, -2,
-   13,  6, -1,  2,  5,  3,  2,  3, -3,  0,  3,  0,-16, -8, -2, -5,
-   -2, -7, -6,  0, -3, -6, -3,  1, -5, -1,  2, -1, -1, 12, 16,  5,
-   -7,  1,  9,  8,-10, -2,  5,  3, -6,  2,  7,  3, -4,  0, -1, -7,
-    3,  4, -9,-24,  0,  2,  6,  3, -1, -1,  4,  7,  5,  3, -1, -2,
-    3,  6, -9,  2,  1,  6,-13,  1,  1,  8,-10,  2,  1,  8, -7,  1,
-   -3, -3,  2, 22, -2, -3, -5, 12, -2, -3,-10,  2, -3, -1, -4,  2,
-   11, 12,  8,  2, -5, -5, -5, -8, -6, -4,  0, -3, -2, -1,  3,  3,
-   12, -6, -2, -1, 12, -8, -2, -2,  9, -7,  0, -3,  4, -6,  2, -2,
-  -19,  1, 12, -3, -4,  4,  5, -4,  6,  1, -2, -1,  4, -4, -2,  7,
-   -3, -4, -7, -8, -4, -4, -2,  0, -1,  2, 14, 16, -4, -2,  4,  4,
-   -1,  7,  2, -5, -2,  0, -1,  1,  4, -3, -1, 13,  6,-12,-14,  8,
-   -1,  5,  4, -5, -2,  5,  3, -9, -2,  7,  4,-12, -1,  7,  4, -9,
-   -6, -3,  1,  1, 11, 11,  0, -6,  6,  4, -2, -7,-12,-10,  3, 10,
-   -2, -3, -3, -2,  6, 11, 14, 10, -9,-11,-10,-10,  2,  2,  3,  2,
-   -7, -5, -7, -1, -1,  2,  0,  7, -1,  1,  0,  9,  3,  4, -5, -1,
-   10, -1,-15, -1,  4,  1, -5,  2, -3,  1, -1,  1, -3,  1,  4,  4,
-    2, -1,  4, 10,  6,  2, -1,  0,  2,  2, -7,-12, -4,  2,  0, -3,
-   -1, -4, -1, -8,  3, -1,  2, -9,  4,  0,  5, -5,  2,  0,  8,  3,
-    3,  2,  1,  1,  4, -2,  0,  3,  2, -1,  4,  1,  0,  6, -1,-25,
-   -1, -2, -2, -4, -3,  0, -1, -4, -1, -1, -4,  2,  0, -6,  2, 25,
-  -11, -1,  5,  0,  7,  0, -2,  2, 10, -1, -3,  4, -5, -5, -2, -1,
-    0,  6,  3, -1, -2, -1, -1,  1, -1, -7,-12, -5,  8,  6,  2,  4,
-    2,  6, -1, -6,  9, 10, -1, -4,  1,  0, -4,  0,  3, -2, -9, -5,
-   -4,  3,  4,  0, -4,  3,  3,  0,-11,  0,  3,  2,-11,  3,  7,  2,
-    2, -4,  7,  3,  1, -8,  7,  1, -1,-12,  4,  1,  3, -9,  2,  2,
-    2, -2, -2,  9,-17, -3,  3,  1, -4,  7,  1, -6,  5,  4, -1,  3,
-   -1,  2,  0, -4, -7,  8, 12, -1, -2,  5,  4, -5,  3, -5, -8, -2,
-    0,  0, -5, -2, -2, -8,  3, 27, -1, -4, -3,  6, -3,  1, -2, -7,
-    4,  4,  1, -1, -7,-10, -7, -3, 10, 10,  5,  3, -2, -2, -4, -3,
-    0,  1,  5,  7,  4, -2,-16,-20,  0,  4,  7,  8,  2,  0, -2, -1,
-   -2,  1,  3, 17, -3,  1, -2, -1, -1, -2, -1, -2, -1, -5, -1,  0,
-    5, -3,  1,  0,  6, -2,  0,  0, -1, -2,  0, -3,-11,  1,  8, -1,
-    3,  0,  0,  0,  0,  2,  4,  1,  2,  0,  6,  1, -2,-18, -3,  2,
-  -14,  0,  6,  1, -5, -2, -1,  1, -1,  1,  0,  1,  1,  7,  4,  0,
-   -1,  0,  1, -4,  1,  8,  3, -4, -3,  4,  1,  3, -6,  1, -4,  1,
-    1,-12,  3,  3, -1,-10,  0, -1,  2,  0,  2,  1,  3,  2,  2,  4,
-    3,  0,  0,  3,  2,  0, -2,  1,  5,  2, -5,  0,  6, -1,-14, -1,
-   -2, -6, -3, -3,  2, -1,  4,  5,  6, -1, -2,  0,  4,  4, -1, -5,
-   -4,  1,-11,  0, -1,  2, -4,  1,  2, -3,  3, -1,  1, -2, 15,  0,
-    1, -1,  0, -2,  1, -4, -7,  1, -2, -6, -1, 21, -2,  2, -1,  1,
-   21, -1, -2,  0, -1, -3,  1, -2, -9, -2,  2, -1,  2,  1, -4, -1,
-    1,  8,  2, -6,-10, -1,  4,  0, -4, -3,  3,  3,  5,  0, -1, -1,
-    3,  2,  1, -2, -2, -2,  4,  3,  5,  2, -4,-17,  0, -2,  4,  3,
-   -7, -4,  0,  3,  9,  9,  2, -1,-11, -6,  0, -1,  5,  1,  0,  1,
-    0, 17,  5,-11,  3, -2, -6,  0,  2, -2, -4,  1, -4,  1,  2, -1,
-   -5, -1, -5, -3, -3,  5, -3, -2,  4, 16,  2, -5, -2,  5, -1, -1,
-    0,  0, -4,  1, -1,  2,  5, 11, -1, -1, -2,  1, -4, -2, -3, -1,
-   -5, -1, 10,  0,  6,  1,  0, -3,  0, -4,  1,  0, -2, -4,  3, -1,
-    6,  9,  3,  0, -2,  1, -2,  0, -2, -3, -2, -2,  1,  0,  1, -6,
-    1,  0,  2,  1, -1,  3, -2,  1,  0, -1,-15,  0, -1,  5,  2,  6,
-    2,  0,  2,  2,  0,-12, -4,  6,  0,  1,  4, -1,  1,  2,  1, -4,
-    1, -2, -7,  0,  0,  0,  0, -1, -5,  2, 11,  3,  1,  3,  0, -6,
-    0, -3, -9, -4,  1,  3, -1,  0,  4,  1, -2,  0,  7, -3, -1,  6,
-    1, -2,  6,  2,  0, -1,  3, -2, -2,  4,  0,  2, -1,  2,-14,  2,
-    2,  2,  0, -1, -2,  3, -3,-14,  0,  2,  3, -3,  5,  1,  3,  2,
-    1, -3,  4,-14,  1, -2, 11, -1,  0, -1,  3,  0, -1,  1,  0,  2,
-   -2,  3, -3,  2, -4, -1, -4,  3, -1,  2,  1,  3, -6, -2,  2,  7,
-   -2,  1,  2,  0, -2,  0,  0, -1, 12,  5, -1,  2, -8, -1,  1, -7,
-    2, -2, -4,  2, 11,  0,-11, -2,  3,  1, -3, -1,  0,  3,  1, -1,
-    0,  3,  0, -2,  0, -6, -1, -3, 12, -7, -2,  0,  7, -2,  1,  1,
-    1,  2,  2,  2, -1,  2,  0,  2,-23,  0,  4,  0,  3,  2,  1,  3,
-   -4, -5, -1,  5, -3,  5, 10, -1,  0,  0,  3, -4,  1, -1,  2, -5
-};
-
-/* 6x16-entry codebook for inter-coded 8x4 vectors */
-static const int8_t svq1_inter_codebook_8x4[3072] = {
-    9,  8,  4,  0, -3, -4, -4, -3,  9,  8,  4, -1, -4, -5, -5, -3,
-    8,  7,  3, -2, -5, -5, -5, -4,  6,  4,  1, -2, -4, -5, -4, -3,
-  -12,-14,-11, -4,  1,  5,  6,  6, -8,-10, -7, -5, -2,  1,  1,  1,
-    5,  4,  3,  1,  0,  0, -1, -1, 13, 13,  9,  6,  3,  0, -1, -2,
-   -4, -4, -3, -1,  1,  4,  8, 11, -5, -6, -4, -2,  0,  3,  8, 12,
-   -7, -7, -6, -4, -2,  2,  7, 10, -7, -7, -5, -4, -2,  1,  5,  8,
-   -3, -2, -1,  1,  3,  6,  7,  6,  2,  3,  5,  7,  8,  8,  6,  4,
-    4,  5,  4,  3,  1, -2, -6, -7,  1,  0, -2, -7,-10,-14,-17,-16,
-   -5, -4,  1,  8,  9,  3, -3, -7, -7, -6,  1, 11, 12,  5, -3, -8,
-   -8, -7,  0,  9, 11,  5, -3, -7, -8, -6, -1,  5,  8,  4, -2, -6,
-   -4, -5, -7, -8, -9, -9, -8, -6, -4, -5, -6, -7, -7, -6, -4, -2,
-    0,  1,  2,  3,  5,  8, 10,  9,  1,  2,  3,  6,  9, 12, 14, 13,
-    5,  6,  6,  5,  4,  3,  2,  1,  5,  6,  7,  7,  6,  6,  6,  4,
-   -1,  0,  1,  1,  3,  5,  5,  5,-13,-16,-17,-17,-14,-10, -6, -4,
-    9, 11, 13, 16, 15, 13, 12, 10, -4, -5, -6, -7, -7, -7, -6, -5,
-   -6, -6, -7, -7, -7, -7, -6, -5, -2, -1,  0,  0,  0,  0,  0, -1,
-  -11,-13,-15,-16,-16,-14,-12,-10,  2,  3,  4,  5,  4,  3,  3,  3,
-    6,  7,  8,  8,  8,  7,  6,  5,  3,  4,  3,  3,  3,  3,  3,  3,
-    3,  4,  4,  1, -2, -7,-13,-17,  5,  7,  7,  5,  1, -5,-13,-19,
-    6,  8,  9,  8,  5, -1, -9,-16,  6,  8, 10, 10,  7,  2, -4,-11,
-   18,  9, -1,-10,-13, -9, -4,  0, 22, 12, -1,-12,-15,-10, -4,  2,
-   23, 13,  0,-10,-13, -9, -3,  2, 20, 12,  2, -6, -9, -6, -2,  2,
-   -6, -6, -6, -7, -7, -7, -7, -6, -6, -7, -8, -8, -9, -9, -9, -8,
-   -3, -3, -3, -3, -3, -3, -3, -3, 12, 15, 18, 21, 21, 19, 17, 14,
-   14, 16, 18, 18, 18, 16, 15, 13,  5,  6,  6,  5,  5,  4,  4,  3,
-   -6, -7, -9,-10,-10,-10, -9, -7,-10,-11,-13,-14,-14,-13,-12,-10,
-  -27,-17, -4,  5,  9, 10, 10,  7,-32,-19, -3,  7, 11, 12, 11,  8,
-  -30,-16, -2,  8, 12, 12, 10,  7,-23,-12,  0,  7, 10, 11,  9,  6,
-   16, 17, 16, 12,  6, -1, -8,-12, 17, 18, 15, 10,  1, -8,-15,-18,
-   15, 14, 10,  4, -5,-14,-20,-23, 10,  8,  4, -1, -9,-16,-21,-22,
-  -10,-12,-12,-11, -5,  4, 14, 20,-11,-13,-15,-12, -4,  7, 19, 27,
-  -11,-13,-14,-11, -3,  8, 21, 28,-10,-11,-12, -9, -2,  8, 18, 25,
-   -1, -1, -1,  1,  4,  6,  6,  5,  0,  0,  0,  2,  4,  3,  1, -2,
-    0,  0,  2,  4,  4, -1, -7,-10,  0,  0,  3,  5,  3, -3,-11,-15,
-  -14,-13, -8, -1,  3,  3, -1, -4, -5, -4, -1,  4,  8,  8,  3,  0,
-    3,  2,  2,  3,  4,  5,  3,  1,  5,  3,  0, -2, -2, -1, -1, -1,
-    9,  1, -6, -6, -5, -3, -2, -1, 12,  1, -6, -6, -4, -2, -1,  0,
-   14,  4, -4, -4, -2, -2, -1, -1, 14,  6, -1, -1, -1, -1, -1, -1,
-    4,  6,  8, 10, 11,  9,  7,  5, -1, -1, -1,  0,  0, -1, -1, -2,
-   -2, -4, -4, -5, -5, -5, -5, -4, -2, -3, -3, -4, -4, -3, -2, -1,
-    2,  3,  4,  4,  3,  1,  0,  0, -1,  1,  4,  5,  6,  5,  4,  3,
-   -8, -6, -2,  2,  3,  4,  4,  3,-14,-13, -9, -5, -2, -1,  0,  0,
-   -3, -4, -5, -4,  0,  7, 12, 13, -3, -4, -5, -5, -2,  4,  9, 10,
-   -2, -3, -4, -5, -4, -1,  3,  4, -1, -1, -2, -3, -3, -2,  0,  1,
-    9,  5, -2, -8,-11,-10, -7, -4, 12, 10,  6,  2,  0, -1,  0,  0,
-    2,  2,  3,  4,  3,  1,  1,  1, -9, -8, -4,  0,  1,  2,  1,  0,
-    6,  8,  8,  5,  1, -5,-11,-13,  0,  1,  2,  2, -1, -4, -8,-11,
-   -3, -2,  1,  3,  3,  1, -1, -4, -2, -1,  2,  5,  6,  6,  4,  1,
-    3,  4,  5,  5,  4,  1, -3, -6,  5,  6,  4,  2,  2,  2,  0, -3,
-    6,  5,  0, -5, -5, -2, -1, -2,  7,  4, -3,-11,-12, -7, -3, -2,
-    1,  0, -1, -1, -1,  0,  0,  0,  2,  3,  4,  4,  5,  5,  4,  3,
-   -7, -9, -9,-10,-10, -9, -7, -6,  3,  4,  5,  6,  5,  5,  5,  5,
-   -7, -7, -7, -7, -6, -6, -5, -4, -5, -4, -3, -1, -1, -1,  0,  0,
-   -3, -2,  1,  4,  5,  5,  5,  5, -2, -1,  3,  6,  9, 10, 10,  9,
-  -14,  1, 10,  3, -2,  0,  1,  1,-16,  2, 13,  3, -3, -1,  1,  0,
-  -15,  2, 12,  3, -4, -2,  1,  1,-10,  3, 10,  2, -3, -1,  1,  1,
-    0,  1,  4,  2, -5,-10, -3, 11, -1,  1,  4,  2, -6,-13, -2, 15,
-   -1,  0,  3,  1, -6,-12, -1, 15, -1,  1,  2,  1, -4, -8,  0, 11,
-   10,  5, -2, -2,  2,  5,  1, -4,  7,  0, -8, -6,  1,  5,  2, -4,
-    2, -5,-12, -7,  2,  7,  4, -1, -1, -7,-10, -4,  4,  9,  7,  2,
-   -5, -5, -4, -6, -6, -5, -5, -3, -1, -2, -2, -4, -5, -6, -5, -4,
-    6,  7,  7,  4,  0, -2, -3, -3, 13, 14, 13, 10,  5,  1, -1, -2,
-    1,  1,  2,  2,  2,  2,  2,  2, -5, -6, -8, -9, -9, -8, -7, -6,
-    7,  9, 10, 11, 11,  9,  7,  5, -1, -2, -3, -3, -4, -4, -4, -3,
-   -1, -1,  0,  0,  0,  0, -1, -1, -3, -3, -4, -5, -4, -3, -3, -2,
-    2,  1, -1, -3, -3, -2, -1,  0, 12, 12,  8,  3,  1,  0,  0,  1,
-   -6, -8, -8, -6, -2,  2,  6,  8,  1,  1, -1, -2,  0,  3,  5,  7,
-    3,  3,  1, -1, -1,  0,  0,  2,  0,  1,  0, -1, -1, -1, -2, -1,
-    1,  0,  0,  0,  0,  0,  2,  4,  2,  1,  3,  4,  3,  1,  0,  2,
-    2,  1,  0,  0, -1, -1,  0,  3,  5,  1, -6,-12,-13, -8, -1,  4,
-   -2,  0, -1, -2, -1,  0,  2,  3, -6, -3, -2,  0,  1,  1,  1,  1,
-   -9, -5,  0,  4,  5,  3,  1,  0, -8, -3,  3,  7,  8,  4,  1,  0,
-    1,  2,  2,  3,  3,  1, -1, -3,  4,  5,  5,  6,  6,  5,  2,  0,
-    0,  0,  0,  0,  1,  0, -2, -4, -3, -3, -4, -3, -3, -4, -7, -8,
-   14, 12,  6, -1, -3, -3,  0,  0,  7,  5,  1, -3, -5, -4, -2, -1,
-   -2, -2, -2, -2, -2, -2, -1, -1, -6, -4, -1,  1,  1,  1,  0, -1,
-    2,  2,  1, -3, -6, -7, -6, -3,  1,  0, -1, -3, -2,  1,  4,  6,
-    0,  0,  1,  2,  4,  7,  8,  7,  0,  0,  0,  0, -1, -4, -7, -8,
-    0,  2,  1, -2, -3, -3, -2, -1, -1,  1,  0, -3, -5, -2,  0,  2,
-   -2, -1, -2, -5, -4,  1,  6,  9, -3, -2, -3, -4, -2,  5, 11, 13,
-   -4, -2,  2,  6,  4, -3,-10,-14, -2, -1,  1,  4,  4,  1, -1, -2,
-    0,  0, -1, -2, -2,  0,  4,  6,  2,  2,  0, -3, -3,  0,  5,  9,
-   -4, -4, -2,  1,  6,  9,  3, -7, -2, -2, -2, -1,  4,  8,  0,-11,
-    1,  1,  0,  0,  2,  6, -1,-10,  2,  2,  1,  0,  2,  4,  0, -7,
-   -1, -2, -3, -6, -7, -8, -8, -8,  2,  3,  3,  1, -1, -2, -3, -4,
-    5,  5,  5,  4,  3,  2,  0, -1,  3,  3,  3,  3,  2,  2,  1,  1,
-    3,  3,  2, -2, -3,  0,  7, 10,  1,  2,  2, -2, -5, -4,  0,  3,
-    0,  3,  4,  2, -3, -5, -6, -4,  0,  2,  4,  4,  1, -4, -7, -7,
-    2,  4,  5,  5,  5,  5,  6,  6, -4, -4, -3, -5, -5, -3, -3, -2,
-   -3, -4, -4, -5, -4, -2, -2, -2,  1,  1,  0,  0,  2,  4,  5,  4,
-   -2,  0,  3,  4,  4,  3,  2,  2, -9, -7, -4,  0,  3,  6,  6,  6,
-   -5, -5, -3, -2,  0,  1,  3,  4,  5,  5,  2, -2, -4, -6, -5, -3,
-    1, -6, -4,  7,  5, -2, -2,  1,  5, -5, -4,  6,  4, -5, -4,  1,
-    5, -5, -4,  6,  4, -5, -3,  1,  1, -7, -3,  8,  7, -1, -3,  1,
-   -8, -7, -4,  0,  2,  4,  5,  5,  5,  6,  5,  2, -1, -5, -7, -7,
-    5,  6,  4,  1, -3, -5, -6, -5, -7, -7, -5, -2,  1,  6,  9, 10,
-    6,  3,  0,  1,  3,  0, -8,-14,  3,  0, -1,  1,  4,  3,  0, -4,
-    1,  0,  0,  1,  2,  1,  1,  1, -1, -1,  1,  2,  1, -1, -1,  0,
-    1,  1,  1,  1,  0, -2, -3,  0,  1,  2,  1,  0, -2, -8, -9, -4,
-    1,  3,  3,  2,  1, -3, -3,  1,  0,  1,  1,  1,  1,  1,  4,  8,
-    2,  5,  9,  7,  2, -1, -1,  1, -4, -1,  1,  0, -3, -4, -1,  2,
-   -3,  0,  3,  3,  0, -1,  0,  2, -4, -1,  1,  1, -2, -4, -5, -4,
-    1, -1, -2, -2, -1,  2,  4,  5,  2,  1,  1,  0, -1, -1,  0,  0,
-    2,  3,  4,  5,  4,  2,  1,  0, -9, -9, -6, -3, -1, -1, -1, -1,
-   -6, -6,  4,  7,  0, -2, -1, -2, -1, -2,  5,  6, -1, -2,  0, -1,
-    4, -1,  1,  0, -4, -2,  0, -2,  7,  1, -1, -2, -3,  1,  3,  1,
-    4,  2,  1,  3,  3,  1,  1,  2,  2, -2, -4,  0,  3,  1,  0,  0,
-    1, -4, -8, -4,  1,  2,  1,  0,  2, -3, -9, -6,  0,  3,  3,  2,
-   -1, -1,  0, -1, -1,  0,  1,  2,  3,  1, -4, -8, -7, -3,  1,  2,
-    2, -1, -3, -2, -1,  0,  1,  0, -1,  0,  5, 11,  9,  3, -1, -3,
-   -1, -2, -2, -1,  1,  1,  1,  1,  0, -1,  0,  3,  6,  6,  5,  5,
-    2,  1, -1, -1, -2, -5, -6, -4,  2,  2,  2,  1, -1, -4, -5, -5,
-   -1, -3, -6, -7, -6, -4, -1,  1,  5,  5,  3,  4,  4,  3,  4,  5,
-   -1, -2, -3, -2, -2, -2,  0,  1,  0,  0,  0,  0,  0,  1,  2,  3,
-   -6, -6, -4, -1,  2,  2,  2,  2, -6, -7, -5, -2,  0, -1, -1,  0,
-    2,  2,  2,  4,  4,  3,  3,  4,  2,  1,  0, -1,  0,  0,  2,  4,
-   12,  5, -5, -8, -5,  0,  2,  2,  2, -3, -6, -3,  0,  0, -1, -2,
-   -2, -3, -1,  3,  4,  1, -2, -3,  2,  2,  3,  4,  3,  1, -1, -1,
-    3,  2,  1,  0,  1,  4,  3,  0,  4,  3,  0, -5, -6,  0,  3,  3,
-    2,  3,  1, -7,-12, -6,  1,  3,  1,  3,  4, -1, -6, -4,  0,  1,
-   -9, -4,  2,  6,  7,  4,  1,  0, -7, -1,  4,  6,  4,  0, -3, -3,
-   -6,  0,  4,  4,  1, -2, -3, -2, -4,  1,  3,  2,  0, -2, -1,  0,
-    0,  5,  2, -5, -3,  3,  1, -4, -2,  4,  2, -6, -3,  6,  4, -3,
-   -1,  5,  3, -5, -1,  7,  3, -4, -1,  2,  0, -6, -3,  5,  3, -3,
-   -8, -3,  3,  5,  3,  1, -2, -2,  2,  4,  4, -2, -4, -3,  1,  3,
-    2,  1, -3, -5, -3,  3,  4,  3, -5, -6, -5,  3, 10,  8, -1, -5,
-    0,  3,  2, -4, -9, -7,  0,  6, -5, -1,  5,  7,  4, -1, -3, -3,
-   -5, -5, -2,  3,  6,  5, -1, -4,  9,  6,  0, -4, -2,  1,  1, -1,
-   -1, -1, -1,  1,  1,  0, -1,  0, -1,  0,  0,  0,  0, -1, -1,  0,
-    2,  1, -2, -1,  1,  1,  0,  0, 12,  8,  2, -1, -1, -4, -7, -7,
-    2,  1,  3,  6,  7,  4,  2,  0,  1,  0, -1,  0, -1, -4, -7, -8,
-    0,  0, -1,  0,  0,  0, -1, -3,  0,  0,  0,  0,  1,  1,  0, -2,
-   -1,  0,  1,  1,  0,  0, -1, -2,  0,  0, -1, -3, -4, -3, -1,  1,
-   -1,  0,  0,  0,  1,  4, 10, 12, -1,  0, -2, -2, -3, -3, -1,  1,
-   -3, -1, -2, -4,  2,  9,  9,  7, -3,  0, -1, -3,  0,  2, -1,  1,
-   -1,  1, -2, -3,  0, -1, -3,  0,  0,  0, -3, -2,  0, -1, -1,  1,
-   -1, -2, -1, -1, -2, -1, -1, -2,  2, -1, -2, -1,  0,  1,  0, -2,
-    3, -1, -2,  2,  5,  3, -1, -3,  1, -5, -5,  1,  6,  6,  2,  0,
-    1,  2,  0, -1,  0,  1,  0, -2, -5, -3, -1,  0,  1,  2,  1, -2,
-   -7, -5, -2, -2, -2, -2,  0,  1, -1,  0,  1,  1,  0,  3,  9, 12,
-    0,  6,  5,  1, -2, -3,  0,  3,  0,  6,  5,  1,  1,  1,  2,  3,
-   -5, -2, -2, -3,  0,  0,  0,  0, -6, -3, -3, -2,  0,  0, -1, -2,
-    4,  4,  2,  1,  0, -1, -1,  0, -2, -2,  0,  1,  2,  1,  1,  0,
-    2,  2,  1, -1, -3, -5, -9,-10,  2,  1, -1, -1,  1,  4,  4,  1,
-    4,  0, -2, -2, -2, -2, -1,  0,  7,  1, -4, -3, -2,  0,  1,  1,
-   10,  5, -1, -2,  0,  1,  1,  0,  5,  1, -3, -4, -3, -1, -1, -2,
-    2,  1, -1, -3, -3,  1,  1, -1, -2, -1,  3,  0, -1,  1,  1,  0,
-   -3,  1,  7,  2, -3, -2, -1,  0, -2,  4,  8, -1, -8, -5,  0,  2,
-   -4, -1,  1,  2,  1, -3, -4, -2, -5, -3, -2,  1,  4,  4,  4,  6,
-   -3, -2, -4, -3,  0,  1,  1,  2,  2,  2,  2,  1,  2,  1, -1, -1,
-   -4, -1,  0, -1, -3, -3, -1, -1,  1,  4,  4,  2,  0, -1, -2, -3,
-    4,  6,  5,  3,  2,  1, -2, -4,  0,  1,  1,  1,  1, -1, -4, -6,
-    1,  2,  2, -1, -6, -5, -1,  2, -3, -2,  1,  1, -4, -3,  2,  5,
-   -2, -1,  2,  2, -3, -4,  0,  3, -2, -2,  2,  6,  5,  2,  1,  2,
-    2, -3, -3,  0,  0,  2,  3,  1,  3, -1,  1,  3,  1,  2, -1, -5,
-   -5, -7, -4, -2,  1,  8,  8,  1, -1,  0,  2,  0, -3,  0,  1, -3,
-   -2, -5, -5, -2, -3, -1,  0, -2, -1, -4,  0,  4,  0,  2,  4,  0,
-    0,  0,  8, 10,  2,  1,  3, -1, -4, -3,  2,  3, -3, -3,  1, -1,
-    1, -2, -4,  2,  7,  3, -2, -1,  6,  4, -2, -1,  2,  0, -1,  3,
-    1,  1, -2, -2, -2, -5, -3,  4, -6, -2,  1,  1, -1, -4, -2,  4,
-   -2, -1, -2, -2,  0,  1,  0, -2, -1,  1,  0, -1,  0,  0, -1, -3,
-    0,  1, -2, -4, -3, -1,  0,  0,  6,  8,  5,  0,  0,  1,  2,  3,
-   -2, -2,  2,  5,  2,  0,  0,  1,  2, -2, -2, -1, -1,  1,  2,  4,
-    2, -1,  0,  1,  0,  0,  0,  1, -8, -7, -1,  1, -1, -1,  1,  3,
-    0,  3,  6,  2, -2,  1,  2,  0,-10, -7, -1,  0, -3, -1,  2,  1,
-    0,  0,  2,  2,  1,  1,  1, -1,  3,  0, -2, -2,  0,  2,  1,  0,
-    8,  1,  0,  0, -2, -3, -1,  0,  2, -2,  2,  5,  1, -2, -1,  1,
-   -3, -6, -3, -1, -3, -3, -1,  2,  2,  0,  1,  2,  2,  1,  0,  0,
-    1, -1, -1, -2, -1,  0,  1,  0, 15,  9,  2, -1, -2, -3, -3, -3,
-    0, -3, -2,  0,  0, -1, -1, -1,  1,  0,  1,  0,  0, -1, -1, -1,
-    0,  2,  2, -2, -3, -3, -7, -8,  0,  2,  2,  0,  1,  2,  1,  1,
-    1,  2,  2,  2,  3,  1,  0,  3,  1,  0, -1, -2, -1, -2,  0,  5,
-  -11, -6, -1,  1,  2,  3,  1, -3,  1,  4,  3, -1, -2,  1,  2, -1,
-    2,  2,  1, -1, -2,  0,  1, -1,  0,  0, -1, -1,  0,  2,  3,  2,
-    1,  1,  2,  1, -1,  1,  0, -4,  0,  0,  0, -2, -2,  2,  4, -2,
-   -2, -3,  0,  0, -1,  2,  1, -6,  0,  2,  5,  5,  3,  2, -1, -7,
-    4,  2,  0,  0,  3,  3,  1, -1,  0, -1, -1,  3,  6,  4,  1, -1,
-   -2, -2,  0,  2,  2,  0, -2, -2, -1,  0, -1, -5, -7, -5, -1,  1,
-    5, -1, -2,  0,  2,  4,  2, -5,  0, -5, -2,  2,  1,  2,  0, -6,
-    6,  1,  0,  1, -2, -1,  4,  2,  2, -3, -3,  0, -1, -2,  0,  0,
-    1, -1,  0,  2,  0,  0,  6, 11,  2, -1, -1,  0, -3, -2,  3,  5,
-    0, -2, -1,  0, -1,  0,  0, -3,  1, -1, -1, -1, -2, -1, -3, -7,
-    1,  1, -2, -2,  1,  3,  1, -2, -1,  2,  0, -1, -1,  1,  0,  0,
-   -4,  2,  3, -1, -2, -2,  0,  1,-11, -2,  4,  5,  6,  2, -1, -2,
-   -6, -2,  1, -1, -3, -4,  1,  9, -3,  0,  3,  3,  2, -3, -3,  3,
-    1,  1,  0,  0,  1, -1, -2,  3,  2,  0, -3, -3,  0, -1, -1,  3,
-    1, -1, -3,  1,  2, -6, -4,  6,  0, -2, -5, -2,  0, -3, -2,  3,
-    2,  2,  1, -2, -2,  1,  2, -1, -1,  1,  1, -2, -1,  6,  7, -1,
-    1,  0, -4, -2,  1, -2, -3,  1, -4,  0, -3, -2,  2,  0, -3,  0,
-   -3,  4,  3,  1,  8,  7,  0, -1, -3,  4,  1, -4,  2,  3, -2, -3,
-   -3,  6,  1, -4,  1,  1, -1, -1, -2,  4, -3, -3,  3,  0, -1, -1,
-    1,  2, -4,  2,  4, -3, -1,  2,  3, -1, -4,  5,  4, -6, -3,  2
-};
-
-/* 6x16-entry codebook for inter-coded 8x8 vectors */
-static const int8_t svq1_inter_codebook_8x8[6144] = {
-   -4, -3,  4,  5,  2,  1,  1,  0, -5, -3,  5,  5,  2,  1,  0,  0,
-   -6, -4,  5,  5,  2,  1,  0,  0, -7, -4,  4,  5,  2,  1,  0,  0,
-   -8, -5,  3,  4,  2,  1,  0,  0, -8, -6,  3,  4,  1,  1,  1,  0,
-   -8, -6,  2,  4,  2,  1,  1,  0, -8, -6,  2,  4,  1,  1,  1,  1,
-   -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -2, -2,
-   -2, -3, -3, -3, -3, -3, -3, -3, -2, -3, -3, -3, -3, -3, -4, -3,
-   -2, -2, -2, -2, -2, -3, -3, -2,  1,  1,  1,  1,  1,  0, -1, -1,
-    4,  5,  5,  5,  4,  3,  3,  2,  7,  7,  8,  8,  8,  7,  6,  5,
-    2,  1,  2,  4,  4,  0, -4, -6,  1,  1,  2,  5,  5,  1, -5, -7,
-    1,  2,  1,  4,  5,  1, -5, -8,  1,  1,  1,  5,  5,  0, -6, -8,
-    0,  1,  1,  5,  6,  1, -6, -9,  0,  0,  1,  4,  5,  0, -5, -8,
-    0,  0,  1,  4,  5,  0, -5, -7,  0,  0,  1,  4,  4,  1, -4, -7,
-    1,  2,  3,  0, -3, -4, -3, -1,  1,  3,  4,  0, -3, -4, -3, -1,
-    2,  4,  5,  1, -3, -4, -3, -2,  2,  5,  6,  1, -3, -5, -4, -2,
-    3,  6,  6,  1, -3, -5, -4, -2,  3,  6,  6,  1, -3, -5, -4, -2,
-    3,  6,  6,  1, -3, -5, -4, -2,  3,  5,  5,  1, -3, -4, -4, -2,
-    2,  2,  2,  2,  1,  0,  0, -1,  4,  4,  4,  3,  2,  1,  1,  0,
-    4,  5,  4,  4,  3,  3,  2,  1,  4,  4,  4,  4,  4,  3,  2,  2,
-    2,  3,  3,  3,  3,  3,  2,  1, -1, -1, -1, -1,  0,  0,  0,  0,
-   -5, -6, -6, -5, -5, -4, -3, -3, -7, -9, -9, -8, -7, -6, -6, -5,
-    6,  6,  6,  6,  6,  5,  5,  4,  4,  4,  4,  3,  3,  3,  3,  2,
-    0, -1, -1, -1, -2, -2, -1, -1, -3, -5, -6, -6, -6, -6, -5, -4,
-   -3, -5, -6, -7, -6, -6, -5, -4, -1, -2, -2, -2, -2, -2, -1, -1,
-    0,  1,  1,  1,  1,  1,  1,  1,  3,  3,  3,  3,  3,  3,  3,  3,
-    2,  1, -2, -5, -4,  0,  2,  5,  2,  1, -2, -6, -5,  0,  3,  5,
-    2,  1, -2, -6, -6, -1,  3,  6,  3,  2, -2, -7, -6,  0,  4,  7,
-    2,  1, -2, -7, -5,  0,  5,  7,  2,  1, -2, -6, -5,  0,  4,  7,
-    2,  1, -2, -6, -4,  0,  4,  6,  1,  1, -2, -5, -4,  0,  3,  6,
-  -10, -9, -6, -4, -1,  2,  3,  2,-10, -9, -5, -3,  0,  4,  4,  3,
-   -9, -7, -3, -1,  2,  5,  5,  3, -7, -5, -2,  0,  3,  5,  5,  3,
-   -6, -3,  0,  1,  4,  6,  5,  3, -4, -2,  1,  2,  3,  5,  4,  2,
-   -2,  0,  1,  2,  2,  4,  3,  1, -1,  1,  2,  2,  2,  3,  3,  1,
-   -4, -5, -5, -6, -6, -6, -6, -5, -3, -3, -4, -4, -4, -4, -4, -4,
-    0,  0,  0,  0, -1, -1, -1, -1,  5,  5,  6,  5,  5,  4,  3,  2,
-    5,  6,  7,  7,  7,  6,  5,  4,  3,  3,  4,  4,  4,  4,  3,  2,
-    0, -1,  0,  0, -1, -1,  0, -1, -3, -3, -4, -4, -4, -4, -3, -3,
-    1, -2, -5,  1,  5,  4,  2,  0,  1, -3, -6,  1,  6,  5,  2,  0,
-    0, -4, -7,  0,  6,  6,  2,  1, -1, -5, -9, -1,  6,  6,  3,  1,
-   -1, -6,-10, -2,  6,  6,  3,  1, -1, -6, -9, -2,  5,  6,  3,  1,
-   -2, -6, -9, -2,  5,  5,  3,  1, -2, -6, -7, -2,  4,  4,  2,  1,
-   -5, -7, -8, -9, -9, -8, -7, -6, -5, -6, -6, -7, -7, -6, -6, -5,
-   -3, -3, -3, -4, -5, -5, -4, -4, -1,  0,  0, -1, -1, -1, -1, -1,
-    0,  1,  2,  2,  2,  2,  2,  1,  2,  3,  4,  5,  5,  5,  5,  4,
-    3,  4,  5,  6,  8,  8,  8,  7,  3,  4,  5,  6,  7,  7,  7,  6,
-    5,  6,  7,  8,  9, 10, 10,  9,  3,  4,  6,  7,  8,  9,  9,  8,
-    0,  1,  2,  3,  4,  5,  5,  5, -1, -2, -1, -1,  0,  1,  2,  2,
-   -2, -3, -3, -3, -3, -2, -1,  0, -3, -4, -5, -5, -5, -5, -5, -4,
-   -4, -5, -5, -6, -7, -7, -6, -5, -3, -4, -5, -6, -7, -7, -6, -6,
-   13,  7,  0, -3, -3, -4, -4, -5, 14,  7,  0, -3, -3, -4, -4, -4,
-   15,  8, -1, -4, -4, -4, -5, -4, 15,  8, -1, -4, -4, -5, -4, -3,
-   15,  7, -1, -4, -5, -5, -5, -4, 14,  7, -1, -4, -4, -4, -4, -3,
-   12,  6, -1, -4, -4, -4, -4, -3, 11,  5, -1, -4, -4, -4, -4, -3,
-  -17, -4,  5,  4,  4,  4,  3,  3,-18, -5,  5,  4,  4,  4,  3,  3,
-  -19, -5,  6,  4,  4,  4,  3,  2,-20, -5,  6,  4,  4,  4,  3,  3,
-  -20, -4,  6,  4,  4,  5,  3,  3,-19, -5,  6,  4,  4,  5,  3,  3,
-  -18, -4,  5,  4,  4,  4,  3,  2,-17, -5,  4,  3,  4,  4,  3,  3,
-   -6, -6, -6, -4, -2,  1,  6, 11, -6, -7, -7, -4, -2,  2,  8, 13,
-   -8, -8, -7, -4, -2,  3,  9, 14, -8, -8, -7, -5, -1,  4, 10, 16,
-   -8, -8, -7, -5, -1,  4, 10, 17, -8, -8, -7, -4,  0,  5, 10, 16,
-   -8, -8, -6, -3,  0,  4,  9, 15, -7, -7, -5, -3,  0,  4,  8, 12,
-    8,  7,  7,  5,  2, -2, -8,-14,  8,  8,  7,  5,  2, -2, -8,-15,
-    8,  8,  7,  5,  1, -3, -9,-16,  8,  8,  7,  5,  1, -3,-10,-17,
-    8,  9,  8,  5,  1, -3,-10,-17,  8,  8,  7,  4,  1, -4,-10,-16,
-    7,  7,  7,  4,  1, -3, -9,-14,  6,  7,  6,  3,  0, -3, -9,-13,
-    5,  1, -4, -4, -3, -1,  0,  0,  7,  2, -3, -3, -2, -1,  1,  0,
-    7,  1, -3, -3, -1,  0,  1,  1,  6,  1, -3, -2, -1,  1,  1,  0,
-    6,  0, -4, -2, -1,  0,  1,  0,  5,  0, -4, -3, -1,  0,  0, -1,
-    5,  0, -3, -1,  0,  0,  0, -2,  4,  1, -2, -1,  0,  1,  0, -1,
-    2,  2,  1,  1, -2, -6, -8, -8,  1,  1,  1,  1, -2, -5, -8, -8,
-    1,  1,  1,  0, -1, -3, -5, -5,  0,  0,  0,  0, -1, -1, -1, -2,
-    0, -1,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  1,  2,  3,  2,
-    2,  1,  1,  1,  2,  3,  4,  3,  3,  3,  3,  3,  4,  4,  5,  4,
-   -4, -4, -3, -2,  0,  0,  1,  1, -4, -4, -3, -2, -1,  0,  0,  1,
-   -2, -2, -2, -1, -1, -1,  0,  0,  0,  1,  0,  0,  0,  0,  0, -1,
-    2,  2,  2,  2,  2,  2,  1,  1,  3,  4,  4,  4,  4,  4,  4,  3,
-    1,  1,  1,  3,  3,  4,  3,  3, -5, -6, -5, -4, -3, -3, -2, -2,
-   -4, -2, -1, -1, -1, -1,  0,  1, -4, -2, -1, -1, -1, -1,  0,  1,
-   -3, -2, -1, -1, -1,  0,  1,  2, -4, -3, -2, -1, -1,  1,  3,  3,
-   -4, -3, -3, -1, -1,  1,  4,  5, -4, -3, -2, -2, -1,  1,  4,  7,
-   -2, -2, -1, -1,  0,  2,  6,  8, -1,  0,  0,  1,  1,  4,  7,  8,
-   -3, -3, -3, -2, -2, -1, -1,  0, -1, -1,  0,  1,  2,  2,  3,  3,
-    0,  1,  2,  4,  5,  6,  6,  5, -1,  0,  2,  3,  5,  6,  5,  3,
-   -1, -1,  0,  2,  3,  3,  2,  1, -2, -2, -1,  0, -1, -3, -4, -4,
-    0,  0, -1, -1, -2, -4, -8, -7,  1,  2,  1,  0, -1, -4, -6, -7,
-   -2,  4,  1, -6,  0,  3,  0,  0, -2,  5,  1, -7,  0,  3,  0,  0,
-   -3,  5,  1, -8,  0,  3, -1, -1, -2,  6,  1, -9,  0,  3,  0, -1,
-   -2,  6,  2, -8,  0,  4,  0, -1, -3,  5,  1, -7,  1,  4,  0,  0,
-   -2,  4,  1, -7,  0,  4,  1,  0, -1,  4,  1, -6,  0,  3,  1,  0,
-    0,  0,  0,  3,  4,  5,  4,  1,  1,  1,  1,  2,  3,  3,  2,  0,
-    2,  2,  1,  2,  2,  1, -1, -2,  4,  3,  1,  1,  0, -1, -3, -5,
-    5,  3,  1, -1, -2, -3, -4, -6,  5,  3,  0, -2, -3, -5, -6, -7,
-    4,  3,  0, -2, -3, -4, -5, -5,  4,  3,  0, -1, -2, -2, -3, -3,
-    0,  0,  0,  0, -1, -5, -2,  6,  0,  0,  0,  1, -1, -6, -2,  8,
-    0,  0,  0,  2,  0, -6, -3,  9,  0, -1,  0,  2,  0, -7, -2, 10,
-    0, -1,  0,  2, -1, -8, -3, 10,  0, -1, -1,  2, -1, -7, -3,  9,
-    0, -1,  0,  1, -1, -6, -3,  8,  0,  0,  0,  1,  0, -5, -2,  7,
-    2,  3,  3,  2,  1,  0, -1, -1,  3,  4,  3,  2,  1,  0, -1, -2,
-    3,  4,  4,  2,  1, -1, -2, -3,  2,  3,  3,  2,  0, -1, -2, -3,
-   -1,  0,  1,  1,  0, -1, -2, -2, -5, -4, -3, -1,  0,  1,  1,  1,
-   -8, -8, -5, -1,  1,  3,  4,  3,-10, -9, -5,  0,  3,  5,  6,  5,
-   -5, -1,  4,  5,  3,  1,  0,  0, -6, -1,  4,  5,  2,  0, -1, -2,
-   -6, -1,  5,  4,  2, -1, -2, -2, -7, -1,  4,  4,  1, -2, -3, -3,
-   -6, -1,  5,  4,  1, -2, -3, -3, -5,  0,  4,  4,  1, -1, -2, -2,
-   -4,  0,  5,  4,  1, -1, -1, -2, -3,  1,  4,  3,  1, -1, -1, -2,
-   -2, -3, -2,  1,  4,  6,  5,  3, -3, -4, -4,  0,  3,  5,  4,  2,
-   -3, -5, -5, -1,  2,  4,  3,  1, -4, -6, -4, -1,  2,  4,  2, -1,
-   -2, -4, -3,  1,  2,  4,  2, -1, -2, -4, -2,  1,  3,  3,  1, -2,
-   -2, -3, -2,  1,  3,  3,  1, -2, -2, -2, -1,  1,  3,  3,  0, -2,
-   -4, -4, -3, -2, -1,  2,  5,  7, -4, -4, -3, -3, -2,  1,  5,  7,
-   -2, -3, -2, -3, -3, -1,  3,  5, -1, -1,  0, -2, -3, -2,  2,  4,
-    1,  1,  1, -1, -4, -3,  1,  3,  4,  3,  2, -1, -4, -3, -1,  1,
-    6,  4,  3,  0, -3, -3, -2,  0,  6,  5,  3,  1, -2, -3, -2, -1,
-   12, 11,  8,  4,  0, -2, -2, -1, 10,  9,  6,  2, -1, -2, -1,  0,
-    4,  3,  2,  0, -1, -1,  0,  1, -1, -1, -1, -1, -2,  0,  1,  2,
-   -3, -5, -4, -2, -2,  0,  2,  3, -5, -5, -4, -2, -1,  0,  1,  2,
-   -5, -5, -4, -2, -1,  0,  1,  1, -4, -4, -3, -2, -2, -1,  0,  0,
-    3,  3,  2, -1, -3, -4, -3, -2,  3,  2,  0, -2, -4, -4, -3, -2,
-    2,  2,  1, -1, -3, -5, -4, -3,  3,  3,  3,  1, -2, -3, -3, -3,
-    4,  4,  4,  3,  0, -2, -2, -2,  5,  5,  5,  3,  0, -1, -2, -2,
-    5,  5,  4,  2, -1, -2, -3, -2,  3,  3,  3,  0, -2, -4, -4, -4,
-   -1, -1,  4, -2, -2,  6,  2, -5, -1,  0,  4, -2, -3,  6,  2, -6,
-   -1,  0,  4, -2, -3,  7,  3, -7, -1, -1,  4, -3, -4,  8,  3, -7,
-    0, -1,  4, -3, -4,  7,  3, -6, -1, -1,  4, -3, -4,  7,  3, -6,
-   -1, -1,  3, -3, -4,  6,  3, -6, -1,  0,  3, -2, -3,  6,  3, -5,
-    1, -2, -7,  2,  5, -2, -1,  1,  1, -2, -8,  3,  6, -3, -1,  2,
-    2, -2, -9,  4,  7, -4, -2,  2,  3, -1, -9,  5,  7, -4, -1,  3,
-    3, -1, -9,  4,  7, -4, -2,  2,  3, -1, -7,  4,  6, -4, -2,  1,
-    2,  0, -6,  4,  6, -4, -1,  1,  2,  0, -5,  3,  4, -3, -1,  1,
-   -2,  2,  2,  0,  0, -1, -3, -4, -2,  2,  2,  1,  1,  0, -2, -4,
-   -2,  2,  2,  2,  2,  1, -1, -2, -3,  2,  3,  3,  4,  2,  0, -2,
-   -3,  2,  3,  2,  4,  2,  0, -3, -4,  1,  2,  1,  2,  1, -1, -3,
-   -5,  0,  1,  0,  1,  1, -2, -3, -4,  0,  0,  0,  1,  0, -2, -3,
-    0,  0, -1, -2, -2,  2,  7,  8,  0,  0, -1, -3, -2,  1,  6,  7,
-    0,  1, -1, -3, -3,  0,  4,  5,  0,  1,  0, -1, -1,  0,  1,  3,
-    0,  2,  1,  1,  0, -1,  0,  1, -2,  0,  1,  2,  1,  0, -1, -1,
-   -5, -2,  0,  1,  1,  0, -3, -3, -6, -4, -1,  1,  1, -1, -3, -4,
-   -4, -2,  2,  5,  6,  4,  3,  2, -5, -3,  1,  4,  4,  2,  0,  0,
-   -4, -2,  0,  2,  1, -1, -2, -2, -2, -1,  0,  1,  0, -2, -3, -2,
-   -2,  0,  0,  0, -1, -1, -2, -1, -2, -1, -1,  0,  0,  0,  1,  2,
-   -2, -2, -1, -1,  0,  1,  3,  4, -2, -3, -2, -1,  0,  2,  4,  5,
-    2,  1, -2, -2, -1,  0,  1,  0,  1,  0, -3, -3, -1,  0,  1,  0,
-    0, -1, -3, -3, -1,  1,  1,  1,  0,  0, -3, -1,  1,  2,  3,  3,
-    0, -1, -3, -1,  1,  3,  3,  3, -2, -2, -4, -2,  1,  3,  4,  4,
-   -3, -3, -4, -2,  1,  3,  3,  4, -2, -3, -5, -2,  1,  2,  3,  3,
-    4,  5,  3,  4,  4,  4,  4,  5,  3,  3,  1,  0,  0,  0,  0,  1,
-    1,  1, -1, -2, -3, -4, -3, -2,  2,  2,  0, -2, -2, -4, -3, -2,
-    2,  3,  1, -1, -1, -3, -3, -2,  1,  2,  0,  0, -1, -2, -2, -1,
-    0,  1,  0, -1, -1, -3, -2, -1,  1,  1,  0, -1, -1, -2, -2, -2,
-   -2, -1, -1,  0,  1,  2,  1,  0,  1,  2,  3,  5,  6,  5,  5,  3,
-    1,  2,  3,  4,  5,  5,  4,  3, -2, -2, -3, -3, -2, -1,  0,  0,
-   -3, -3, -4, -5, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1,  0,  0,
-    0,  1,  0, -1, -1,  0,  0,  1, -1,  0, -1, -2, -3, -2, -2, -1,
-    7,  7,  6,  5,  4,  2, -1, -2,  3,  3,  2,  2,  1,  0, -2, -3,
-    0, -1, -1, -1,  0, -1, -2, -2, -1, -3, -2, -1,  0,  0,  0,  1,
-    0, -2, -2, -1, -1,  1,  2,  2,  3,  1, -1, -1, -1,  1,  2,  2,
-    3,  1, -2, -3, -2, -1,  1,  2,  1, -2, -5, -6, -5, -3, -2,  0,
-    0, -1, -2, -3, -1,  0, -2, -2,  0,  0, -1, -1,  0,  1, -1, -2,
-    0,  0, -2, -1,  0,  0,  0, -2, -1, -2, -3, -3, -2, -1, -3, -3,
-   -1, -2, -3, -3, -2, -2, -3, -4,  2,  2,  0,  0,  0,  0, -1, -2,
-    5,  5,  3,  2,  2,  2,  0, -1,  8,  8,  6,  5,  4,  4,  2,  1,
-   -7, -8, -6, -3, -1, -1, -2, -1, -5, -5, -3,  0,  2,  1,  0,  0,
-   -1, -1,  0,  3,  4,  3,  1,  1,  2,  1,  1,  3,  4,  3,  2,  2,
-    3,  2,  0,  2,  3,  2,  1,  2,  4,  2, -1, -1,  0,  1,  1,  1,
-    3,  2, -2, -3, -2, -1,  0,  1,  3,  1, -3, -4, -3, -2,  0,  1,
-   -4, -2, -1,  2,  3,  3,  1,  0, -7, -5, -4, -2,  0,  0, -1, -2,
-   -6, -5, -5, -4, -2, -2, -2, -3, -1,  0, -1, -1,  0,  0,  0, -1,
-    2,  3,  2,  2,  2,  2,  1,  0,  3,  5,  4,  3,  1,  0,  1,  0,
-    3,  4,  3,  2,  0, -1, -1, -1,  5,  5,  3,  1,  0, -1, -1, -1,
-    1,  1,  0, -1, -3, -5, -6, -4,  1,  1,  0,  0,  0, -3, -3, -1,
-    0, -1, -1,  0,  1,  0,  1,  3, -2, -2, -3, -1,  2,  2,  4,  7,
-   -2, -2, -2,  0,  2,  2,  3,  6, -1,  0,  0,  1,  1,  0,  0,  3,
-    0,  3,  3,  3,  1, -2, -3, -1,  1,  3,  4,  3,  0, -3, -5, -4,
-    0,  2,  0, -1, -3, -4, -2, -2,  1,  4,  2,  0, -2, -3, -2, -1,
-    3,  6,  3,  1, -2, -2,  0, -1,  4,  7,  4,  1, -2, -3, -1,  0,
-    3,  6,  3,  0, -3, -3, -1,  0,  1,  3,  0, -1, -3, -2,  1,  1,
-    0,  1, -1, -2, -3, -1,  2,  2, -2, -1, -3, -3, -3, -1,  1,  2,
-    3,  1, -1,  0,  1,  0,  0,  0,  2, -1, -2, -1,  1,  0, -1, -1,
-    1, -1, -2,  0,  1,  0, -2, -3,  0, -2, -1,  1,  3,  1, -3, -5,
-    0, -2, -1,  2,  5,  2, -3, -5,  0, -2, -1,  4,  6,  3, -2, -5,
-    0, -2,  0,  4,  7,  4, -2, -4,  0, -2,  0,  4,  6,  4, -2, -4,
-   -2, -2, -3, -4, -3, -2, -1,  0,  1,  1,  0, -1, -1, -1,  0,  1,
-    3,  3,  2,  2,  1,  1,  1,  1,  2,  2,  2,  2,  1,  0,  0,  1,
-    0,  0,  0,  0, -1, -1, -1, -1, -4, -4, -4, -4, -4, -4, -4, -3,
-   -3, -3, -2, -3, -2, -1, -1,  0,  3,  4,  4,  5,  5,  6,  6,  7,
-   -1, -2,  7, -2, -4, -1, -1,  0, -1, -2,  9, -1, -4, -1, -1,  0,
-   -1, -3, 10, -1, -4, -1, -1,  1, -1, -3, 10, -2, -3, -1, -1,  2,
-   -1, -2, 10, -2, -4, -1, -1,  2, -1, -2,  9, -2, -4, -1, -1,  2,
-   -1, -2,  8, -2, -4,  0, -1,  1,  0, -2,  7, -2, -3, -1,  0,  2,
-    3, -4,  1,  3, -3, -2,  1,  0,  3, -5,  1,  4, -3, -2,  1,  0,
-    3, -6,  2,  5, -3, -1,  3,  0,  3, -6,  2,  5, -3, -1,  2,  0,
-    3, -6,  1,  5, -4, -2,  3,  0,  3, -6,  1,  5, -3, -2,  2,  0,
-    2, -6,  1,  4, -3, -1,  1,  0,  2, -6,  1,  4, -2, -1,  1,  0,
-    0,  0,  1,  1,  1,  0,  0,  2,  0, -1,  1,  1,  1,  0,  0,  2,
-    0, -1,  0,  0,  0,  0,  0,  2,  0, -1,  0,  0,  0,  0, -1,  0,
-    1,  0,  1,  0,  0, -1, -2, -1,  3,  1,  1,  0,  0, -2, -4, -3,
-    5,  3,  2,  1,  0, -3, -5, -4,  5,  4,  2,  0, -1, -4, -5, -5,
-    1,  0, -1, -2, -2, -3, -6, -9,  2,  0, -1, -1,  0,  0, -3, -6,
-    1,  0,  0, -1,  0,  0, -2, -5,  2,  1,  1,  1,  1,  2, -1, -3,
-    1,  1,  2,  1,  2,  2,  1, -1,  1,  1,  2,  1,  1,  1,  1,  1,
-    0,  0,  2,  1,  0,  0,  2,  2,  0,  1,  2,  2,  0,  0,  2,  2,
-   -4, -3,  0,  1,  4,  6,  4,  3, -3, -2,  0,  0,  2,  4,  1,  0,
-   -1, -1,  0,  0,  1,  1, -2, -3,  1,  1,  1,  0,  1,  1, -3, -5,
-    1,  1,  1,  0,  1,  1, -3, -5, -1,  0,  0, -1,  1,  1, -2, -4,
-   -1,  0,  0, -1,  1,  2,  0, -2, -1,  0,  0,  0,  2,  3,  1,  0,
-   -1,  0,  3,  4,  0, -4, -5, -5,  0,  0,  4,  5,  2, -2, -3, -2,
-    0, -1,  2,  4,  2, -1, -1,  0,  0, -2, -1,  1,  0, -2,  0,  1,
-    1, -2, -2,  0,  0, -1, -1,  1,  1, -2, -3,  0,  1,  0, -1,  0,
-    1, -2, -2,  1,  3,  1,  0,  0,  1, -2, -1,  2,  4,  2,  0,  0,
-    1,  2,  3,  2,  0,  2,  2,  1, -1,  0,  1,  0, -3,  1,  1,  1,
-   -1,  0,  0, -2, -4,  0,  2,  1, -1,  2,  2, -1, -5,  0,  2,  1,
-   -1,  3,  4, -1, -5,  0,  2,  1, -2,  2,  4,  0, -4, -1,  0,  0,
-   -4,  0,  2,  0, -4, -2,  0,  0, -5, -1,  2,  1, -2,  1,  3,  2,
-    1,  0,  1,  0,  1,  2, -1, -2,  2,  0, -1, -2,  1,  3,  0, -1,
-    3,  0, -2, -4,  0,  3,  1,  0,  5,  1, -3, -5, -2,  2,  1,  1,
-    6,  1, -2, -5, -2,  1,  0,  1,  5,  1, -1, -5, -2,  0, -1,  0,
-    3,  0, -2, -4, -2,  0, -1,  0,  1, -1,  0, -2,  0,  1,  0,  1,
-    1,  1,  2,  3,  2,  1,  1,  2, -1, -1,  0,  1,  1,  0,  1,  1,
-   -4, -3,  0,  0,  1,  1,  1,  2, -4, -3,  0,  2,  2,  2,  3,  2,
-   -5, -4,  0,  1,  1,  1,  1,  2, -5, -4, -1, -1, -2, -2, -1,  0,
-   -3, -2,  0,  0, -2, -3, -2, -1,  2,  3,  4,  4,  2,  0,  0,  0,
-   -4, -2,  0,  1,  0,  0,  0,  0, -3, -1,  1,  1,  0,  0,  0,  0,
-   -2,  0,  2,  2,  0,  0,  0,  2, -1,  1,  2,  1, -1,  0,  3,  5,
-    0,  2,  1, -1, -2,  0,  5,  6,  0,  1,  0, -3, -3,  0,  4,  6,
-    1,  1, -2, -4, -4, -3,  1,  2,  1,  0, -2, -4, -5, -4, -2,  0,
-   -1, -3, -3, -3, -3, -2, -1, -1,  3,  2,  1,  0,  0,  1,  1,  1,
-    5,  4,  3,  2,  1,  1,  2,  2,  2,  1,  0, -2, -2, -2, -1, -1,
-    0,  0,  0, -1, -2, -2, -2, -2,  0,  1,  3,  3,  2,  1, -1, -1,
-    0,  1,  3,  4,  3,  2,  1, -1, -4, -3, -1,  1,  0, -2, -3, -3,
-   -3, -4, -7, -8, -7, -4, -1,  2,  0, -1, -3, -4, -4, -2,  0,  2,
-    1,  0,  0, -1, -3, -2,  0,  2,  2,  1,  1,  0, -1, -1,  0,  2,
-    1,  1,  1,  1,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  1,
-    0,  0,  1,  2,  3,  3,  2,  2,  0,  0,  1,  3,  4,  4,  3,  2,
-    3,  3,  3,  0, -1,  0,  1,  2,  1,  1,  1, -1, -2, -1, -1,  1,
-   -2, -2, -1, -3, -3, -2, -2,  0, -4, -4, -2, -2, -2, -2, -3,  0,
-   -4, -4, -1,  1,  1,  0, -1,  2, -3, -1,  2,  3,  4,  3,  3,  5,
-   -2,  0,  2,  3,  3,  3,  3,  3, -2, -2,  0,  0,  0,  0,  0,  1,
-    0,  2,  1, -1, -3, -1,  3, -2, -1,  0, -1, -1, -3,  0,  4, -2,
-   -2, -2, -2, -2, -2,  1,  5, -2, -3, -2, -3, -1, -2,  1,  4, -3,
-   -2,  0, -1,  0, -1,  0,  3, -5,  1,  2,  1,  2,  0,  0,  2, -5,
-    2,  4,  2,  3,  1,  1,  3, -3,  1,  2,  1,  1,  0,  1,  4, -2,
-    4, -3, -4, -1,  3,  3,  1,  3,  4, -4, -4, -1,  3,  2,  0,  2,
-    4, -3, -4,  0,  2,  2, -1,  1,  4, -3, -2,  1,  2,  1, -2,  0,
-    2, -4, -2,  1,  2,  0, -3,  0,  2, -3, -2,  0,  1,  0, -2,  2,
-    3, -1, -1,  0,  0,  0,  0,  3,  2, -2, -2, -2, -1, -1, -1,  2,
-    2,  2,  3,  4,  3,  1,  0, -1,  1,  0,  1,  2,  1, -1, -2, -2,
-    2,  1,  2,  1,  1,  0, -1, -1,  4,  3,  4,  3,  2,  1,  1,  1,
-    3,  2,  2,  2,  1,  1,  1,  1, -1, -2, -1,  0, -1, -1, -1, -1,
-   -3, -3, -2, -1, -2, -2, -2, -2, -4, -4, -3, -3, -4, -4, -3, -3,
-    2,  1, -1, -3, -4, -2,  3,  4,  2,  2,  1, -1, -3, -2,  1,  2,
-    1,  2,  3,  3,  0, -2, -1, -2, -1,  0,  2,  4,  2,  0, -1, -3,
-   -2, -2,  0,  3,  3,  2,  0, -3,  0, -2, -3, -1,  1,  2,  2, -1,
-    3, -1, -4, -5, -3,  0,  2,  0,  6,  3, -2, -6, -5,  0,  3,  1,
-   -2,  3, -2,  0,  3, -2, -2,  1, -3,  4, -3,  0,  3, -2, -1,  2,
-   -3,  5, -3,  0,  4, -2, -1,  2, -2,  4, -4, -1,  3, -3, -2,  2,
-   -3,  4, -3,  0,  3, -3, -1,  2, -2,  5, -2,  0,  3, -3, -1,  2,
-   -2,  4, -3,  1,  3, -2, -1,  2, -2,  3, -2,  1,  3, -2,  0,  2,
-    1,  0,  0, -1,  1,  2, -4, -1,  2,  0,  0, -1,  1,  2, -4, -2,
-    1,  1,  1, -1,  2,  4, -2,  0,  0, -1,  1, -1,  2,  5, -1,  1,
-    0, -1,  0, -2,  1,  5, -1,  1,  0, -1, -1, -2,  0,  3, -3, -1,
-    1,  1,  0, -2,  0,  3, -3, -1,  1,  1,  0, -3,  0,  3, -2,  0,
-    1,  0, -1,  1,  1,  2,  4,  5,  1,  0, -1,  1,  1,  1,  5,  7,
-    0,  0, -2, -1, -1,  0,  3,  5,  0, -1, -2, -1, -1, -1,  2,  3,
-    0, -1, -3, -1, -1, -1,  1,  2, -1, -2, -4, -2, -2, -2,  0,  0,
-   -1, -2, -2, -1, -2, -2,  0,  0,  0, -1, -1,  0, -1, -1,  0,  0,
-    3,  3,  0, -1, -1,  1,  4,  4,  2,  3,  0, -2, -2,  0,  1,  1,
-    2,  3,  1, -1, -1,  0,  1,  0,  1,  2,  0, -1, -1, -1,  0, -2,
-    0,  1,  0, -1, -2, -1,  0, -2,  0,  1,  0, -1, -2, -1,  1,  0,
-    1,  1, -1, -3, -4, -3,  1,  3,  1,  2, -1, -3, -5, -4,  1,  3,
-   -3, -2,  0,  1,  1,  1,  0, -2,  0,  1,  1,  1,  0,  0, -1, -3,
-    1,  2,  1,  1,  0, -1, -1, -2,  0, -1, -3, -1, -1, -1,  0, -1,
-    0, -3, -6, -3, -2, -1,  1,  1,  2, -1, -4, -3, -2,  0,  2,  2,
-    5,  4,  1,  1,  0,  1,  3,  2,  5,  4,  2,  1,  0, -1,  0,  1,
-   -2,  0, -2, -5, -6, -3,  0,  0, -2,  0,  1,  0, -1,  1,  2,  2,
-   -2,  0,  1,  3,  2,  2,  2,  1, -2,  0,  2,  4,  3,  2,  1,  1,
-   -2,  0,  2,  3,  2,  0, -1,  0, -3, -1,  1,  1,  0, -1, -1,  1,
-   -4, -1,  1,  0, -1, -2,  0,  2, -4, -1,  0, -1, -1, -2,  1,  4,
-   -3,  0,  0, -1,  1,  1,  1,  0, -3,  1,  0, -1,  0,  0, -1, -1,
-   -1,  3,  3,  0,  1,  0,  0,  1, -3,  2,  2, -2, -1,  0,  0,  1,
-   -5,  0,  0, -2, -1,  1,  0,  2, -7, -2,  1,  0,  1,  2,  2,  2,
-   -5,  0,  3,  2,  3,  3,  2,  2, -3,  2,  4,  1,  0,  0, -2, -3,
-    5,  2, -2, -2,  0, -1, -1, -1,  2, -1, -4, -3, -1, -2, -1, -1,
-    0, -2, -2,  1,  2, -1,  0,  1, -1, -2, -1,  3,  3, -1,  0,  2,
-    1,  0,  0,  3,  3, -2, -1,  2,  2,  1,  1,  3,  2, -2, -2,  0,
-    1,  0, -1,  1,  1, -3, -3, -2,  1,  0,  1,  2,  3,  0,  0,  0,
-   -4, -5, -3,  0,  1, -1, -2, -1, -2, -3, -1,  1,  2,  0,  0,  0,
-    1,  1,  2,  1,  2,  1,  1,  1,  3,  4,  3,  1,  0, -2, -1, -1,
-    3,  3,  2,  0, -2, -3, -3, -2,  1,  1,  0, -1, -2, -4, -2, -2,
-    2,  1,  0,  0,  0, -1,  0,  1,  2,  1,  1,  1,  1,  1,  1,  3,
-    0,  0,  0, -1, -2, -1,  1,  0, -2, -1, -1, -2, -3, -2,  0,  0,
-   -1,  0,  0, -1, -2,  0,  1,  1,  1,  1,  0, -1, -1,  1,  3,  1,
-    2,  2,  0, -2, -1,  2,  3,  0,  3,  1, -1, -1,  1,  4,  2, -2,
-    2,  0, -3, -1,  3,  5,  0, -5,  1, -1, -2,  0,  3,  3, -1, -6,
-   -1,  0,  3,  4,  2,  0,  1,  2, -2, -1,  0,  1, -1, -2,  0,  1,
-   -2, -3, -2, -3, -6, -7, -6, -3,  2,  2,  3,  1, -1, -2, -3, -2,
-    2,  2,  3,  1,  0,  0,  0,  0,  2,  1,  1,  0,  1,  1,  0,  1,
-    1,  0,  0,  0,  0,  1,  1,  2,  1,  0, -1,  0,  0,  2,  2,  1,
-    1,  1,  3,  1, -1, -1, -1,  1, -2, -1,  0,  0, -2, -2, -1,  2,
-   -2, -2,  1,  1,  1,  0,  1,  3, -2, -2,  0, -1,  0, -1,  0,  2,
-    0,  0,  1,  0, -1, -1, -2,  1,  3,  2,  2,  1,  0, -2, -2,  1,
-    5,  3,  3,  2,  1,  1,  1,  4,  0, -3, -4, -5, -4, -3, -1,  1,
-   -6, -4, -1,  2,  2,  0,  0, -1, -4, -2,  1,  3,  3,  2,  2,  0,
-   -3, -2, -1,  2,  3,  3,  2,  0, -3, -2, -2,  1,  2,  1,  1, -1,
-   -2, -2, -2,  0,  2,  2,  1, -1, -1, -1, -1,  1,  2,  3,  2,  0,
-   -1, -1, -2,  1,  2,  2,  2, -1,  0, -1, -2,  0,  2,  1,  0, -1,
-    6,  4,  2,  1,  0,  0,  0,  1,  4,  2, -1, -2, -2, -2, -1, -1,
-    2,  1, -1, -2, -2, -2, -2, -1,  2,  2,  0, -2, -2, -2, -1,  0,
-    0,  0, -1, -2, -2, -1,  0,  1, -3, -3, -2, -1, -1, -2, -1,  0,
-   -3, -2,  2,  3,  2,  0, -1, -2, -2,  0,  4,  5,  5,  2,  0, -1,
-    5,  4,  2,  0, -1, -2, -1, -1,  4,  3,  2,  1,  0, -1,  0, -1,
-    1,  1,  0,  1,  1,  0,  1, -1, -2, -1, -1,  0,  0, -2, -2, -3,
-   -1,  0,  0,  0, -1, -3, -3, -5,  0,  1,  1, -1, -1, -2, -2, -3,
-   -1, -1, -1, -2, -1,  1,  3,  1, -1, -2, -2, -1,  2,  5,  6,  5,
-   -3, -3, -2,  1,  1, -2, -1, -1,  1,  2,  3,  4,  1, -3, -1, -3,
-    3,  2,  0,  1, -1, -3, -1, -3,  1,  0, -1,  0, -1, -1,  1,  0,
-    1,  1,  0,  1,  2,  2,  5,  3,  1,  1,  1,  2,  2,  2,  3,  0,
-   -3, -1, -2, -2, -3, -3, -1, -3, -1,  1,  1,  0, -1, -1,  0, -2,
-    2,  0, -2, -2,  2,  4,  1, -2,  1,  0, -2, -1,  3,  5,  2, -1,
-   -1, -2, -3, -2,  1,  3,  1, -2, -1, -2, -1, -1,  0,  2,  1, -1,
-    0,  0,  1,  1,  1,  2,  2,  0,  0,  1,  4,  4,  2,  2,  3,  1,
-   -2, -1,  2,  1, -2, -3, -2, -3, -1,  0,  1,  0, -3, -4, -4, -5,
-    4,  0, -3, -4, -4, -4, -2, -1,  5,  0, -1,  0, -1, -3, -2, -1,
-    4,  0,  0,  1,  1,  0,  0,  0,  0, -3, -2, -1,  0,  0,  1,  0,
-    0, -2,  0,  0,  1,  1,  2,  1,  2,  0,  0,  0,  1,  1,  1,  0,
-    2,  0, -1, -1,  1,  1,  1,  0,  1, -1, -2, -2,  0,  2,  2,  2,
-   -3, -5, -2,  0, -1, -3, -3,  0,  0, -2,  0,  2,  2,  0,  0,  3,
-    2, -1, -2,  0,  0, -1, -1,  2,  5,  2, -1, -1, -1, -1, -1,  2,
-    5,  2,  0, -1, -1,  0, -1,  2,  2,  1,  0,  0,  0,  1,  0,  2,
-   -1, -1,  1,  1,  2,  2,  1,  2, -3, -2,  0,  0,  0,  0, -2, -1,
-    0,  3,  2,  0, -2, -3, -3, -3,  0,  3,  3,  1,  0,  0,  1,  2,
-   -1,  0, -1, -2, -1, -1,  1,  3, -1,  0, -1, -2, -1, -1,  0,  2,
-   -1,  0, -1, -2,  0,  0, -1,  2, -1,  0, -1, -2, -1, -1, -2,  1,
-    0,  1,  0, -3, -1, -1, -1,  2,  5,  5,  2, -1, -1, -1,  1,  3,
-    0,  0,  1, -1, -3, -2,  0,  2,  1,  1,  3,  0, -2, -2,  0,  1,
-    1,  1,  3,  1,  0,  0, -1, -1,  0, -1,  2,  1,  1,  0, -1, -3,
-   -1, -2,  1,  1,  1,  0, -2, -4, -1,  0,  2,  1,  1,  0, -1, -3,
-    1,  1,  3,  2,  1,  0, -2, -3,  2,  2,  4,  2,  1, -1, -2, -4,
-    1,  2,  2,  2,  0, -2,  0,  2, -1, -1, -2, -3, -4, -5, -3,  1,
-    0,  1,  1,  0, -1, -1, -1,  1,  0,  1,  1,  1,  0,  0,  0,  2,
-    0,  1,  1,  2,  1,  1,  1,  2, -1, -1,  0,  2,  2,  2,  2,  3,
-   -2, -4, -4, -1, -2, -2, -2,  0,  1,  0,  0,  1,  0,  0,  0,  1,
-    0, -1, -3, -2,  0,  2,  2,  1,  0, -1, -2, -3,  0,  1,  1,  2,
-    1,  0, -2, -3, -1,  0,  0,  1, -1,  0, -1, -2,  0,  0, -1,  0,
-   -1,  1,  1,  0,  2,  2,  0,  0,  0,  2,  3,  1,  3,  5,  3,  2,
-   -1,  1,  1, -2,  0,  3,  1,  1, -1,  0,  0, -4, -4, -1, -1, -1,
-   -1,  1,  1,  0,  1,  2,  1,  2, -3,  0,  1,  0,  1,  1,  0,  2,
-   -5, -3, -1, -1,  0,  1,  0,  1, -4, -3, -2, -3, -2, -1, -1,  0,
-    0,  0, -1, -2, -2, -2, -2,  0,  3,  4,  2,  0,  0,  0,  0,  1,
-    2,  1,  0,  0,  0,  0, -1,  0,  0,  1,  2,  3,  4,  4,  3,  2,
-   -1,  4,  7,  4,  0,  0,  0,  0, -1,  4,  6,  3,  0,  1,  1,  1,
-    0,  3,  4,  0, -1,  0,  0,  1,  0,  1,  1, -2, -1,  0, -1, -1,
-   -1,  0, -1, -1, -1,  0,  0,  0, -1, -1, -1,  0,  0,  0,  0,  0,
-   -1, -3, -3,  0,  1, -1, -2, -1, -3, -4, -4, -2, -1, -2, -2, -1,
-    2,  2,  1,  0,  1,  1,  0, -3, -2, -1,  0,  0,  1,  1,  0, -3,
-   -2, -1,  0,  1,  2,  1,  1, -2,  1,  2,  2,  2,  3,  3,  2, -1,
-    1,  2,  1,  0,  1,  1,  2, -1,  0,  1, -2, -4, -2,  0,  1, -1,
-    1,  1, -1, -3, -2,  0, -1, -3,  1,  2,  0, -1,  0,  1, -1, -4,
-   -1, -1, -2, -2,  0,  3,  4,  3,  1,  1, -1, -3, -2,  0,  0,  0,
-    2,  2,  2,  2,  2,  1, -1, -1,  1,  1,  1,  3,  3,  0, -2, -2,
-    0, -1, -1, -1,  0, -2, -1, -1, -1, -3, -4, -3, -2, -2,  0,  2,
-   -1, -1,  0,  1,  2,  2,  3,  5, -2, -1, -1,  0,  0,  0,  0,  1,
-   -2, -3,  2,  0,  0,  1,  1, -1, -1, -4,  1, -2, -1,  2,  2,  0,
-    1, -4,  0, -2, -2,  1,  1, -1,  2, -3,  1, -1, -1,  1,  1, -1,
-    3, -2,  3,  1,  0,  1,  1, -1,  1, -3,  2,  1,  0,  1,  0, -1,
-   -1, -5,  1,  0, -1,  0,  1,  1,  0, -3,  3,  3,  1,  2,  3,  3,
-    0, -1, -2,  1,  5,  5,  2, -1,  1, -1, -2, -1,  1,  1, -2, -5,
-    1,  1, -1, -2, -1, -1, -1, -3,  1,  1, -1, -1, -1,  2,  4,  3,
-   -1, -1, -1, -1, -1,  0,  4,  3, -1, -1,  0,  1, -1, -3, -1, -1,
-    0,  0,  0,  2,  2,  0,  0, -1,  0, -2, -3,  0,  1,  1,  3,  2,
-    2,  3,  2,  1,  0,  0, -2, -2,  2,  3,  0,  1,  1,  3,  3,  2,
-    0,  0, -3, -1, -1,  2,  2,  3, -2, -2, -3,  1,  1,  2,  1,  1,
-   -2, -1, -2,  2,  1,  1, -1, -2,  0,  1,  0,  2,  0,  0, -2, -2,
-    0,  1,  0,  2,  0,  0, -2, -2, -3, -2, -2,  0, -1, -2, -2, -3,
-    0,  1, -1,  3, -1,  1,  3, -1,  0,  1, -1,  3, -1, -1,  2, -3,
-    1,  1, -2,  3, -1, -3,  0, -3,  2,  2, -2,  3,  0, -2,  1, -2,
-    1,  1, -3,  3, -1, -2,  1, -3,  1,  1, -3,  3,  0, -1,  1, -2,
-    1,  2, -1,  4,  0, -1,  1, -2,  0,  1, -1,  3, -1, -3,  0, -3,
-   -3, -3, -1,  1,  2,  1, -1, -2, -2, -2,  0,  2,  1,  0, -2, -2,
-   -3, -2,  1,  2,  1, -1, -2, -1, -3, -2,  2,  4,  0, -2, -2,  1,
-   -3, -1,  2,  4,  0, -2, -2,  2, -1,  1,  4,  3, -1, -3, -2,  2,
-    0,  2,  4,  2, -1, -2, -1,  2,  0,  1,  2,  0, -1,  0,  1,  3,
-    3,  0, -5,  1,  4,  0,  0,  1,  1, -2, -5,  2,  5, -1, -2,  1,
-   -1,  0,  0,  3,  3,  1,  0, -1, -2,  3,  4, -2, -3, -1,  0, -2,
-   -3,  3,  5, -3, -3,  0,  0, -2, -1,  3,  2, -2, -2,  2,  2, -1,
-    2,  0,  0, -1,  0,  0,  0,  0,  0, -3, -2,  1,  3,  0, -2, -2
-};
-
-/* list of codebooks for inter-coded vectors */
-static const int8_t* const svq1_inter_codebooks[6] = {
-    svq1_inter_codebook_4x2, svq1_inter_codebook_4x4,
-    svq1_inter_codebook_8x4, svq1_inter_codebook_8x8,
-    NULL, NULL,
-};
-
-static const int8_t svq1_inter_codebook_sum[4][16*6] = {
- {
- -1,  1, -2,  0,  1, -1, -1, -1, -2, -1,  1, -1, -1,  0, -1, -1,
-  0, -1, -1, -1, -1,  0, -1,  0,  0,  0, -3,  1, -1,  0,  1, -1,
-  1, -1,  2,  2,  1,  1,  2,  0,  0,  0, -1,  1,  1,  0,  0,  0,
-  1, -1,  0,  1, -1,  1,  1,  0,  1,  0, -1,  1,  1,  0,  0,  0,
- -2,  0,  0, -2,  0,  0, -2,  0, -2, -1, -2, -1,  0,  0, -1,  0,
-  1,  0,  1, -1,  2,  2,  1,  2,  2,  1,  0,  1,  1,  0,  1,  1,
- },{
- -2,  1, -1, -1,  1,  0,  1, -1, -1, -1,  1, -1,  0, -1,  0, -1,
-  0,  0,  0, -2,  0,  1,  0, -1, -1,  0,  2, -3,  1, -2,  3, -1,
-  2,  0,  2,  1,  1, -1,  1,  1,  0,  0,  1,  1,  2, -2,  1,  0,
- -2, -1,  2, -2, -2,  0, -3,  0, -1,  0, -1,  0, -1,  0, -2, -3,
-  1, -2, -2, -1,  1, -1, -1,  1, -1,  1,  1,  0, -2,  0,  1,  1,
-  1,  1,  2,  1,  0,  0, -1,  0,  0,  1,  0,  1, -1,  1,  0,  2,
- },{
-  0,  0,  0, -3,  1,  1,  1, -3,  0, -1,  0, -3,  1, -3,  0, -2,
-  1,  2, -1, -3,  0, -3,  1, -1,  0, -1,  0,  0,  1,  2,  1,  1,
- -1,  2, -3,  3,  1,  0, -5,  1,  0, -1, -3,  1,  0,  2,  0, -3,
-  4,  2,  0, -2,  1, -2,  3, -2,  1,  1,  0, -1,  2,  5,  3,  1,
- -1,  0,  2, -3, -2,  0,  0, -2,  2, -3, -1, -1,  2,  1,  0, -2,
-  3, -1,  1, -1,  2,  4,  0,  1,  0,  1,  0, -1, -3, -2, -1,  0,
- },{
-  0,  2, -1, -1,  2, -4, -2,  3,  0, -1, -5,  1,  0,  1,  0,  6,
- -2,  2,  0,  1,  1, -1, -1, -2,  1, -2, -1,  0,  2, -2, -2, -1,
- -4,  2, -1, -3, -1, -2,  2, -1,  2, -1,  2,  0,  3, -3, -3,  0,
- -3,  0,  0, -2,  4, -4,  0, -1,  4,  0, -2, -2,  3, -2,  0,  4,
-  5,  0,  1,  0, -3,  3,  3,  2,  0,  0,  1,  2, -5, -2, -3,  0,
- -3,  2, -2,  2, -2,  4,  7, -3,  4,  2,  3,  2, -1,  0, -3,  1,
- }
-};
-
-/* 6x16-entry codebook for intra-coded 4x2 vectors */
-static const int8_t svq1_intra_codebook_4x2[768] = {
-   12, 13, 13, 11, -7,-10,-15,-17,-16,-15,-12,-10, 11, 15, 15, 12,
-    2, 17, 20, 15,-45,-24,  2, 13, 21, 20, -6,-36, 12, 16, -1,-27,
-  -18,-21, 10, 45,-11,-20, -7, 21, 43, -8,-28,  0, 33,-16,-28,  3,
-  -12,-18,-18, -6,-20,-10, 28, 55, -5,-18,-21,-18, 56, 30, -6,-20,
-  -34, 27, 29,-22,-30, 29, 26,-25, 30, 34, 33, 26,-25,-31,-35,-33,
-  -31,-35,-36,-32, 29, 36, 37, 31,-71,-12, 38, 34,-63, -1, 42, 33,
-   58, 37,-31,-60, 55, 34,-33,-61,-57,-57, 22, 93,-57,-58, 21, 93,
-   59, 69, 70, 62,-63,-68,-68,-60,-64,-71,-71,-64, 63, 73, 72, 62,
-   -2,  0,  7, 15,-11,-10, -3,  5, -5, -8,-10,-10,  1,  9, 14,  9,
-   15,  8, -4,-11, 12,  2,-11,-12, -8,  0, 19, 28,  4, -1,-15,-26,
-  -15, 27,  2,-14,-14, 22,  1, -9, -4, -6,-13,-10, -6,-14,  6, 47,
-  -35,-20,  6, 23,  6,  9,  6,  4, -6,  2, 23,-22, -7,  4, 28,-21,
-   20,-22, -2,  6, 22,-28, -5,  8,-10,-18,-16,-12, 36, 19,  2, -1,
-   -3,  0,  4,  8,-45,-10, 23, 23, 40, 15,-20,-35, -4, -1,  4,  1,
-    9, -5,-33, 24,  8,  3,-26, 19, -1,  4,  6, -3, 32, 25,-13,-49,
-   24, 24, 15,  7,-17,-27,-19, -7,-47,  0, 39, 24,-21, -6,  7,  4,
-   -1,  0,-10,-13,  1,  1,  5, 16, 20,  5, -3, -9, -1, -4, -2, -6,
-  -17, -7,  1,  4, 12,  7,  0,  0,  3,  0, 12, 11, -3,  1,  0,-23,
-    4, 17, -6,  0,  6,  3,-25,  0,-17, 10,  8,  5,-14,  4,  1,  4,
-   13, 10,  4,  2,-23, -9,  1,  2,  3, -3,  1,  7,  1,-23, -7, 20,
-   -7,-18,  2, 12, -5, -4, 10,  9,  4, 10,  7,-24,  6,  3,  4,-10,
-   22,-14,-22,  6,  0,  5,  5, -1, -4,  3,-11, -4, -7, 31,  7,-14,
-   -5,-16, -1, 42, -4, -2, -9, -5,  5, -8, -6, -3, 42, -4,-21, -5,
-  -18, 12, 20,-12, 13,-13,-10,  7, -8, -9, -2,-18,-16,  6, 40,  8,
-   10, -1,  0,  4, -3,  4, -1,-13, -2,  6,  1,-15,  5,  3,  1,  2,
-   -4, -2,  1,  3, 15,  0, -9, -4, -3, -4, -4, -4, -3,  5, 16, -3,
-    2, 13,  3,  4, -3, -8,-10,  0, -6, -2, -4, -1, -2, -3, -6, 23,
-    6, -6,  7,  1,  4,-18,  5,  1, -1,  1,-15, 14, -5,  6, -4,  4,
-    2,  2,  2,  6,-24,  2,  7,  3,-26,  0,  3,  3,  5,  7,  1,  6,
-   14, -2,-18, -3,  7,  5, -4,  2, -6,  3, 32,  1, -6, -6, -6,-12,
-    5,-36,  7,  6,  9, -1, 11,  0,  4,  4,  5,  3,  4, 15,  3,-38,
-   10, 23, -5,-42,  0,  4,  4,  4, 23, 17, -6,-13,-13,-37,  1, 29,
-    5,-14, -1,  1,  5,  0,  3,  1,  0,  4, -5,  2,  8,  0,  0,-10,
-    4,  7, -2, -3,-10,  3,  1,  1,-12, -1, 13,  3,  0, -1,  1, -3,
-    0, -1,  3,  1, -6, -9,  3,  9, -6,  1, -4, -6,  8, -1,  0,  8,
-   -3, -3,  0, 18, -5, -1, -4, -1, -8, -2,  3, -4,  0, 17, -1, -5,
-    5, -2,  9,-10,  1, -5,  6, -5,  4,  2,  2,  3, 10,-14, -8,  1,
-   -1, -2,-18, -1, -1, 20,  1,  2, -1,  1, -9,  1, -1, -9, 22, -4,
-    6, -4,  8, -3, -1,  7,-19,  5, -7, 31, -4, -4, -6,  0, -5, -5,
-   -7, -8,-19, -4,  1,  1,  4, 32, 38, -1, -8,  4, -7, -8, -6,-12,
-   -1,  0, -7,  1, -1,  9, -1,  0,  9, -1, -1,  0,  2, -6,  1, -3,
-  -12,  0,  2,  1,  1,  1,  8,  0,  9,  1,  0,  2, -2,  1,-11,  0,
-    0,  8,  2,-10, -1,  2, -1,  0, -2, -4,  0, -5, -2, -1, -1, 14,
-   -3,  7, -1,  5,  0,-10,  1,  1, -1, -5, 14, -1, -2,  1, -3, -2,
-   -6,  0,  0,  6,  2,  3, -9,  4,  4, -5, -1, -1, -7,  3,  8, -1,
-    2, -4, -1,-11, 11,  2,  1,  0, -1,  2,  3,  9,  0,  2,  0,-15,
-    3,  5,-20,  3,  3, -1,  3,  3,  1, -1, 16,  1,  2,-29,  9,  2,
-  -13, -6, -1, -3, 36, -1, -8, -3,  2,  5,  4,  2,-37,  9, 11,  3
-};
-
-/* 6x16-entry codebook for intra-coded 4x4 vectors */
-static const int8_t svq1_intra_codebook_4x4[1536] = {
-  -11, -3,  3,  6,-10, -1,  5,  7, -9, -1,  6,  7, -9, -1,  4,  6,
-    5,  7,  0,-14,  6,  9,  2,-15,  6,  9,  2,-15,  4,  6,  0,-14,
-   16,  3, -5, -6, 16,  1, -8, -8, 14, -1, -9, -9, 12,  0, -8, -8,
-    8, 12, 16, 17, -2,  2,  6,  9,-10, -8, -4,  0,-15,-14,-11, -7,
-   -7,-10, -2, 16, -7,-11, -3, 18, -7,-11, -1, 20, -6, -8,  1, 19,
-   -9,-13,-16,-17,  2, -2, -7, -9, 11,  8,  4, -1, 16, 15, 11,  7,
-  -22, -2, 13, 15,-24, -2, 14, 16,-25, -4, 13, 15,-25, -6, 10, 13,
-   26, 26, 22, 16, 17, 15,  9,  3, -2, -6,-11,-14,-20,-25,-28,-28,
-  -27,-27,-25,-21,-16,-15,-11, -7,  3,  8, 12, 13, 23, 28, 31, 30,
-   20, 16, -7,-33, 22, 19, -6,-35, 22, 19, -6,-34, 20, 17, -6,-32,
-  -20,-20,  2, 38,-21,-22,  2, 40,-21,-22,  2, 40,-20,-20,  3, 38,
-  -47, -4, 24, 26,-50, -3, 26, 27,-50, -3, 26, 27,-47, -4, 24, 26,
-   45,  6,-23,-27, 48,  5,-25,-28, 48,  5,-26,-28, 44,  6,-24,-27,
-  -30,-36,-10, 76,-31,-37,-11, 78,-31,-37,-11, 78,-31,-36,-10, 77,
-  -53,-32, 35, 52,-54,-34, 36, 52,-54,-34, 36, 52,-53,-33, 34, 51,
-  -93,-34, 62, 65,-93,-34, 62, 66,-93,-34, 62, 65,-93,-34, 60, 64,
-   -7,  0,  2,  2, -8, -1,  3,  3, -8,  0,  4,  5, -6,  1,  5,  5,
-    3,  7, 11, 11,  2,  2,  3,  3,  1, -2, -6, -7,  1, -5,-11,-13,
-    3, -2, -4, -3,  7,  0, -5, -5, 12,  4, -5, -7, 14,  6, -4, -7,
-   18, 14,  3, -2,  6,  4,  0, -3, -8, -5, -2,  0,-16,-11, -2,  2,
-   -8, -6,  7, 18, -7, -8,  2, 13, -4, -6, -2,  6,  0, -4, -3,  1,
-    1, -3,-13,-18,  0, -1, -5, -7, -1,  1,  6,  7, -2,  4, 15, 17,
-  -15,-14, -7, -2, -6, -5, -1,  0,  6,  6,  3,  1, 15, 13,  6,  1,
-    2, -2,-11, 10,  2, -1,-12, 11,  3, -1,-12, 11,  2, -2,-11, 11,
-   -9, 14, -1, -5, -9, 15, -2, -5, -8, 16, -2, -5, -7, 15, -1, -4,
-    2,  6,  8,  8, -2,  3,  9, 12,-11, -5,  4, 10,-19,-16, -8,  0,
-   14,  8, -7,-15, 12,  7, -7,-14,  8,  5, -4, -9,  5,  3, -1, -4,
-   12,-14, -2,  2, 13,-15, -1,  3, 14,-15, -1,  3, 13,-14, -1,  3,
-    0,  6, 10,-13,  0,  6, 10,-15,  0,  7,  9,-17,  1,  6,  8,-16,
-   -8, -5, 15, -2, -8, -6, 17, -2, -8, -6, 16, -3, -8, -5, 15, -2,
-   -9,-11,-11,-10,  9, 10,  9,  8,  8, 10, 10,  9, -8, -9, -8, -7,
-    9, 10,  9,  7, -8,-10,-10,-10, -7,-10,-11,-11, 11, 12, 11,  8,
-    0, 10,  7,  0,  0,  7,  0, -6,  0,  2, -5, -6, -2, -1, -4, -1,
-    5,  0, -6, -9,  2,  2,  2,  1, -2,  0,  5,  7, -6, -5,  1,  4,
-    3, -8,  2, -1,  4, -9,  3,  0,  5, -7,  3,  0,  7, -5,  3,  0,
-   -5, -3,  2,  9, -6, -3,  1,  8, -6, -3,  1,  7, -5, -2,  0,  4,
-   13,  8,  3,  1, -3, -5, -4, -1, -8, -7, -3,  0, -1,  1,  3,  2,
-    3,  2, -5,-12,  4,  3, -2, -9,  3,  4,  1, -4,  3,  5,  4, -1,
-   -9, -8, -4,  0,  8,  6,  2,  0, 10,  8,  3,  0, -6, -5, -3, -1,
-   -3, -9,-12, -5,  0, -3, -5,  0,  2,  3,  2,  4,  5,  8,  7,  6,
-   -1, -2,  5, 12, -1, -1,  5,  9,  2,  1, -1, -2,  2, -1,-11,-17,
-   -7,  3,  3, -1, -9,  3,  4, -1,-10,  4,  6, -1, -9,  5,  7,  0,
-  -18, -7,  2,  2, -8,  1,  5,  3,  3,  4,  1,  0,  9,  5, -2, -3,
-   -2,  0,  6,  8, -4, -5, -5, -3,  1, -2, -6, -8, 10,  9,  3, -1,
-    0, -2, -2,  0,  0, -4, -5,  0, -2, -8, -4,  8, -5, -7,  6, 24,
-    9,  1, -7,  1,  9,  1, -8,  1,  8,  0,-10,  1,  8, -1,-11, -1,
-    8,  8,  6,  3,  5,  4,  3,  2, -2, -3, -1,  0,-10,-13, -8, -4,
-    0,  4,  2, -3,  0,  6,  3, -5,  3, 10,  2,-12,  5, 10, -4,-22,
-    0, -4, -1,  3,  1, -4, -1,  5,  1, -5,  0,  8, -1, -6, -2,  7,
-   -1, -1, -2, -4, -1, -2, -4, -6, -1, -1, -1, -2,  1,  5, 10,  9,
-   10,  3,  0, -2,  6, -1, -2, -5,  3, -1, -2, -6,  2,  0,  0, -5,
-    6,  3,  0,  0,  6,  3,  1,  1,  4, -2, -2,  1,  0, -9, -9, -2,
-  -11, -3,  1,  2, -6,  2,  4,  5, -3,  2,  3,  4, -2,  1,  1,  2,
-   -6, -4, -1, -2,  2, -1, -1, -2, 10,  2, -2, -2, 11,  2, -4, -1,
-    6,  0, -2,  2,  3,  3,  0,  0, -6,  3,  3,  0,-17, -1,  5,  0,
-   -1,  4, 10, 11, -3, -2,  0,  1, -3, -4, -5, -3, -1, -2, -2, -1,
-    2, -3, -9,-12,  3,  3,  3,  2,  2,  2,  4,  4,  2,  1, -1, -2,
-   -2,  9,  5,-10, -3,  5,  5, -5, -2,  1,  2,  0, -1, -2, -2,  1,
-   -2, -3,  7, -2, -1, -3,  7, -3, -1, -2,  8, -4, -2, -2,  7, -3,
-    1, -8, -3, 12,  2, -2, -2,  4,  1,  3,  0, -5, -1,  5,  2, -7,
-   -1,  3,  1, -5, -7, -2,  3,  1, -2, -7, -2,  2, 20,  3, -5, -1,
-    5,  0, -3, -2, -7, -7,  0,  6, -6,  0,  7,  6,  2,  6,  0, -7,
-   -2,  6, -7,  1, -2,  7, -8,  3, -2,  7, -7,  3, -1,  7, -6,  2,
-   -5, -2,  5,  7,  4,  1, -4, -8,  6,  3, -2, -5, -7, -5,  3,  7,
-   -1, -1,  6,  5,  0, -1,  1, -4,  2,  1,  0, -7,  1,  0,  0, -4,
-   -8,  0,  3,  1, -2,  1, -1, -1,  1, -1, -3,  1,  1, -2,  1,  9,
-    5,  2, -3, -4, -1,  0, -1, -3, -3,  1,  3,  1, -4,  0,  4,  2,
-    2, -2, -2, 12,  0, -2, -5,  3, -1,  0, -3,  1, -3, -1, -2,  1,
-    1,  5,  3,  0, -6, -4, -2,  1,  0, -2, -2,  2,  6,  1, -4, -1,
-   -3, -5, -5, -1,  3,  5,  5,  4,  0,  3,  1, -1, -2,  1, -2, -3,
-    2, -4, -5, -3,  4, -2, -3, -2,  6,  0, -1, -1,  7,  1,  0,  0,
-   -3, -2, -2,  0, -2, -3, -5, -1, -2,  2,  0, -1, -1, 11,  9, -1,
-    0,  1, -1,-10, -1,  1,  0, -6,  1,  0,  1,  4,  2, -5, -1, 13,
-   -2,  4,  5,  0, -5,  1,  6,  3, -6, -2,  3,  2, -5, -2,  0, -2,
-   -1,  1,  1, -2, -1, -2,  0,  2,  5,  5,  5,  7,  0, -4, -8, -7,
-    0,  2, -1, -5, -1,  2,  2, -3,  0,  5,  3, -5,  3,  8,  2,-12,
-    8,  4,  0, -2, 10, -1, -4, -1,  3, -6, -3,  0, -4, -5,  0,  0,
-    0,-10, -4,  2, -1, -6,  3,  5, -1, -3,  6,  4,  0, -2,  4,  2,
-    0,  8,  1, -1,  0, 11,  1, -3, -1,  6, -2, -4, -3, -2, -7, -4,
-    0, -1, -1, -1,  4,  5,  6,  5, -5, -9, -8, -5,  2,  2,  3,  2,
-    0,  2,  6,  1,  2,  0,  3,  0,  1, -2, -1, -2,  0, -1, -3, -6,
-    0,  0,  2,  0,  4,  0,  2,  1,  5, -2,  0,  0, -2, -9, -1,  2,
-    0,  1,  0,-10, -1,  1,  8,  0, -1, -2,  4,  0,  1, -1,  2, -1,
-   -3, -2,  2, -1, -3, -1,  2, -3,  0, -1,  1,  0,  8,  1, -1,  3,
-    0,  1,  1,  2,  0, -4, -2,  0, -1, -5,  1, -1, -2, -1, 11,  2,
-    1,  5, -2, -2,  0,  2, -4,  0, -2,  1, -5,  1,  0,  5,  0,  1,
-   -5, -3,  0,  6, -4,  2,  0,  0, -3,  5,  1,  0, -3,  3,  0,  0,
-    3, -2, -3,  1,  1, -4,  0,  8, -2, -3, -2,  3,  1,  2, -1, -1,
-    1,  1,  0,  2,  2,  0,  1,  6,  1, -1,  2,  1,  0,  3,  0,-19,
-    1, -3, -2,  2,  6,  5, -2, -7, -3,  1,  3,  1, -1, -1,  0,  2,
-   -8, -1, -1, -4,  1,  1, -1,  2,  4,  3,  2,  3, -5,  1,  3,  0,
-    0,  2, -1,  1, -3,  0,  0,  5, -5, -2,  0,  8, -4, -4, -4,  6,
-    1,  2,  1,  2,  2,  2, -3,  2,  4,  0, -9,  0,  7,  0,-11,  1,
-    0,  0,  0, -2,  3,  3, -1, -6,  4,  3, -3,-10, -1,  2,  6,  2,
-    7, -2, -3,  5, -4,  0,  3, -1, -4,  2,  1, -7,  2, -1, -1,  3,
-    3,  2,  2,  2, -5, -7, -7, -5,  5,  6,  4,  2, -2, -1,  0,  1
-};
-
-/* 6x16-entry codebook for intra-coded 8x4 vectors */
-static const int8_t svq1_intra_codebook_8x4[3072] = {
-    5,  6,  6,  6,  7,  7,  8,  8,  0,  0,  0,  0,  0,  1,  2,  3,
-   -3, -4, -4, -5, -5, -4, -3, -2, -4, -4, -4, -5, -4, -4, -3, -3,
-    1,  2,  2,  2,  2,  3,  3,  3,  2,  3,  3,  4,  4,  5,  5,  5,
-   -1,  0,  1,  1,  2,  3,  4,  4, -9,-10, -9, -9, -8, -7, -6, -5,
-   -4, -4, -5, -6, -6, -7, -7, -7,  0, -1, -2, -2, -3, -3, -4, -4,
-    4,  4,  3,  3,  2,  1,  1,  0,  7,  7,  7,  6,  6,  5,  4,  4,
-    2,  4,  5,  6,  4,  1, -3, -6,  3,  4,  5,  5,  4,  0, -5, -8,
-    2,  3,  4,  4,  2, -2, -7,-10,  2,  2,  2,  1,  0, -4, -9,-12,
-   -9, -7, -3,  1,  4,  4,  3,  3,-10, -7, -2,  3,  5,  5,  3,  3,
-   -9, -6, -2,  3,  6,  5,  4,  3, -8, -6, -1,  3,  4,  4,  3,  2,
-   -5, -5, -5, -5, -3,  1,  4,  7, -5, -5, -5, -4, -2,  1,  6,  8,
-   -4, -5, -4, -3, -1,  3,  8, 10, -3, -4, -3, -2,  1,  5,  9, 11,
-   -2, -2, -2, -2, -2, -2, -2, -2, -4, -5, -5, -5, -5, -5, -5, -4,
-   -3, -4, -4, -4, -4, -4, -4, -3,  9, 10, 10, 11, 11, 11, 10, 10,
-    7,  4,  1, -2, -4, -6, -9,-10,  9,  7,  3,  0, -2, -4, -8, -9,
-   11,  8,  4,  2,  0, -3, -6, -8, 11,  9,  5,  3,  1, -2, -5, -7,
-  -13,-13,-13,-12,-11,-10, -8, -8,  0,  1,  2,  3,  4,  4,  4,  3,
-    3,  4,  5,  6,  6,  6,  5,  4,  3,  4,  4,  4,  3,  3,  3,  2,
-   10, 10, 11, 10,  9,  9,  8,  7,  6,  6,  6,  6,  5,  4,  3,  2,
-    0,  0,  0, -1, -2, -3, -4, -4,-10,-10,-11,-12,-13,-14,-14,-14,
-   16, 16, 17, 16, 15, 13, 12, 11, -1, -2, -3, -4, -4, -4, -4, -3,
-   -4, -5, -6, -6, -6, -6, -6, -6, -5, -6, -6, -6, -6, -6, -5, -5,
-  -13,-13,-13,-12,-11,-10, -8, -6, -9, -8, -7, -6, -4, -2,  0,  1,
-   -2, -1,  1,  3,  5,  7,  8,  9,  5,  7,  9, 11, 13, 14, 15, 15,
-   16, 14, 11,  7,  2, -3, -7, -9, 14, 12,  8,  3, -1, -6, -9,-11,
-   11,  9,  4,  0, -4, -8,-11,-13,  8,  5,  1, -3, -6,-10,-12,-14,
-  -18,-15, -9, -3,  1,  6,  9, 11,-17,-13, -7, -1,  3,  7, 11, 12,
-  -15,-11, -5,  1,  5,  9, 12, 13,-13, -9, -3,  2,  5,  9, 11, 13,
-   22, 21, 19, 15, 10,  3, -4, -9, 20, 18, 15,  9,  2, -5,-12,-17,
-   16, 13,  8,  1, -7,-14,-20,-24, 10,  6, -1, -8,-15,-21,-25,-27,
-  -25,-23,-20,-14, -7,  1,  9, 14,-23,-21,-16, -9,  0,  9, 16, 21,
-  -20,-16,-10, -1,  8, 16, 22, 25,-15,-11, -3,  6, 14, 20, 25, 27,
-   -4, -2,  0,  1,  2,  2,  2,  2, -5, -2,  0,  2,  3,  3,  3,  3,
-   -6, -4, -1,  1,  2,  3,  3,  3, -7, -5, -2,  0,  1,  1,  2,  2,
-    2,  1,  1,  1,  1,  0, -2, -3,  3,  3,  2,  1,  0, -1, -3, -4,
-    4,  3,  2,  1,  0, -2, -4, -6,  5,  4,  3,  1, -1, -3, -5, -6,
-    5,  6,  6,  4,  2,  0, -2, -3,  3,  4,  4,  4,  3,  1,  0, -1,
-   -2, -2, -1, -1, -1, -1, -2, -2, -5, -4, -3, -2, -2, -2, -3, -3,
-   -1, -1, -1, -1, -1, -1, -1, -1, -3, -4, -4, -4, -3, -3, -3, -3,
-   -1, -1, -1, -1, -1, -1, -1, -2,  5,  6,  6,  6,  6,  5,  4,  3,
-    4,  4,  4,  4,  4,  5,  6,  7,  0, -1, -1, -1, -1,  0,  1,  2,
-   -2, -3, -3, -3, -3, -2, -1,  0, -3, -3, -4, -4, -4, -3, -2, -1,
-    0, -2, -4, -4, -2,  0,  2,  3,  0, -2, -3, -3, -1,  2,  4,  5,
-   -1, -2, -4, -3,  0,  3,  5,  6, -2, -3, -4, -3, -1,  2,  4,  5,
-    9,  4,  0, -3, -3, -1,  0,  1,  8,  4, -1, -4, -3, -1,  1,  2,
-    6,  2, -3, -5, -4, -2,  0,  1,  5,  1, -3, -4, -4, -2,  0,  1,
-    5,  3,  1, -1, -4, -8,-10,-10,  3,  3,  2,  1,  0, -2, -3, -4,
-    1,  1,  1,  2,  3,  2,  1,  0, -1,  0,  1,  2,  3,  4,  3,  2,
-    0,  1,  2,  2,  1, -1, -3, -3,  0,  1,  1,  1, -1, -2, -4, -3,
-   -3, -3, -3, -3, -3, -3, -1,  2, -4, -4, -3,  0,  3,  7, 12, 14,
-   -5, -5, -6, -6, -6, -6, -6, -5,  2,  2,  2,  1,  0,  0,  0,  0,
-    4,  4,  3,  2,  1,  0,  0,  0,  6,  6,  5,  4,  2,  2,  1,  1,
-   -7, -7, -6, -3,  0,  4,  7,  8, -1, -2, -3, -3, -2, -1,  1,  2,
-    3,  3,  1, -1, -2, -2, -2, -1,  6,  6,  4,  2,  0, -2, -2, -2,
-   -6, -5, -2,  2,  5,  9, 11, 12, -4, -4, -2,  0,  2,  4,  5,  6,
-   -3, -2, -2, -2, -2, -1,  0,  1, -2, -2, -2, -3, -3, -3, -3, -2,
-   -7, -3,  1,  3,  3,  0, -3, -5, -6, -2,  3,  5,  4,  1, -3, -5,
-   -5, -1,  4,  6,  5,  2, -3, -4, -4,  0,  5,  7,  6,  3, -1, -3,
-    0,  0,  0,  0,  0,  0,  0,  0, -2, -2, -3, -3, -3, -3, -2, -1,
-    6,  7,  8,  9,  9,  8,  7,  6, -4, -4, -5, -5, -6, -6, -5, -4,
-   -9, -8, -6, -4,  0,  3,  6,  6, -5, -4, -1,  3,  5,  6,  5,  3,
-    1,  3,  6,  6,  4,  1, -2, -5,  6,  7,  5,  1, -3, -7,-10,-11,
-   10,  9,  5,  1, -3, -6, -6, -4,  5,  3, -1, -5, -6, -5, -2,  2,
-   -2, -4, -6, -6, -4,  1,  6, 10, -6, -7, -7, -4,  1,  7, 11, 12,
-    6,  5,  3,  2,  0,  0,  0,  0,  2,  1, -1, -2, -3, -2, -1, -1,
-    0, -1, -2, -4, -4, -2, -1,  1,  0,  0, -1, -2, -1,  0,  2,  3,
-    0, -1, -2, -2, -2, -2, -1, -1,  5,  4,  2,  1,  0,  0,  0,  0,
-    6,  5,  3,  1,  0,  0,  0,  0,  2,  0, -2, -4, -4, -3, -2, -2,
-   -7, -4,  0,  2,  2,  2,  2,  1, -7, -3,  0,  0,  0,  0,  0,  0,
-   -4, -1,  1,  1,  0,  0,  0,  1, -1,  1,  2,  2,  2,  2,  3,  3,
-   -2,  0,  2,  2,  1,  1,  1,  1, -1,  1,  2,  2,  1,  0,  0, -1,
-    0,  2,  4,  2,  0, -1, -2, -3,  1,  2,  3,  1, -2, -4, -6, -6,
-    1,  2,  2,  4,  5,  6,  4,  1,  0, -1, -1, -1,  0,  0, -2, -4,
-    0,  0, -1, -2, -2, -2, -4, -6,  2,  1,  0,  0,  1,  1, -1, -3,
-    1,  1,  1,  1,  1,  2,  3,  3,  0,  0,  1,  0,  1,  2,  4,  4,
-   -1, -1, -1, -1,  0,  1,  2,  3, -4, -4, -5, -5, -5, -3, -1,  0,
-   -6, -5, -5, -4, -3, -2, -1, -1, -1,  0,  0,  1,  1,  2,  3,  3,
-    0,  1,  1,  1,  2,  2,  3,  4,  0,  0, -1, -1,  0,  1,  2,  3,
-    0,  1,  1,  1,  0,  0, -1, -1,  1,  3,  3,  2,  1, -1, -2, -2,
-   -2,  0,  2,  2,  2,  2,  1,  1, -9, -8, -4, -2,  1,  3,  3,  3,
-   -1, -1, -1, -2, -3, -3, -3, -4,  0,  0,  0, -1, -2, -2, -3, -3,
-    2,  2,  2,  0, -1, -1, -1, -1,  5,  5,  4,  3,  2,  2,  2,  2,
-    6,  3, -1, -4, -3, -1,  1,  1,  2, -1, -3, -4, -1,  2,  2,  0,
-   -1, -2, -2,  1,  4,  4,  1, -3, -2, -1,  1,  4,  6,  3, -3, -8,
-    3,  3,  2,  1, -1, -2, -2, -2, -4, -4, -2, -1,  1,  3,  4,  4,
-   -4, -5, -5, -4, -2,  0,  2,  2,  7,  7,  4,  1, -1, -2, -3, -2,
-   -1,  1,  3,  0, -4, -6,  0,  6, -2,  1,  4,  1, -4, -6, -1,  7,
-   -3,  1,  4,  2, -3, -6, -1,  6, -2,  0,  3,  2, -2, -5, -1,  4,
-    1, -1, -2,  1,  4,  4, -1, -7,  1, -1, -4, -1,  5,  6,  0, -6,
-    3,  0, -4, -3,  3,  6,  2, -4,  3,  0, -5, -4,  1,  4,  1, -3,
-    2,  2,  3,  3,  3,  3,  2,  2, -4, -5, -6, -7, -7, -7, -7, -6,
-    1,  2,  3,  3,  3,  3,  2,  2,  0,  0,  1,  1,  1,  2,  2,  1,
-    3, -3, -3,  3,  4, -2, -2,  2,  3, -4, -4,  4,  4, -4, -4,  2,
-    4, -4, -4,  4,  4, -4, -3,  3,  3, -3, -4,  3,  3, -3, -3,  3,
-   -2, -2, -2, -2, -2, -2, -1, -1,  6,  7,  8,  8,  8,  7,  6,  5,
-   -5, -6, -7, -7, -8, -7, -6, -5,  1,  1,  2,  2,  2,  2,  1,  1,
-    0,  0,  0,  0,  0, -1,  0,  0, -1,  0,  0,  0,  0, -1,  0,  0,
-   -2, -3, -2, -2, -2, -3, -3, -3,  2,  3,  5,  6,  4,  2,  1,  0,
-    8,  6,  2,  0,  0,  0,  0,  0,  4,  1,  0,  0,  0, -1, -1, -1,
-    1, -1,  0,  0,  0, -1, -2, -3, -2, -2, -1,  0,  0, -2, -4, -5,
-    3,  1, -1, -2, -3, -4, -5, -5,  2,  1,  0,  0,  1,  1,  0,  0,
-    0, -1, -1,  0,  2,  2,  2,  2, -1, -2, -1,  1,  2,  2,  2,  2,
-    0, -1, -2, -1, -1, -1, -1,  0, -1, -2, -2, -1, -1,  0,  0,  1,
-    2,  1,  1,  2,  2,  1,  1,  0,  6,  5,  3,  1,  0, -2, -4, -4,
-   -3, -2, -1,  0,  1,  1,  0, -1,  0,  1,  3,  4,  5,  5,  3,  1,
-   -1, -1, -1,  0,  1,  0, -1, -2, -2, -2, -2, -1,  0, -1, -2, -3,
-    0, -1, -2, -2, -1, -1,  0,  2,  1, -1, -2, -1, -1, -1,  0,  2,
-    1,  0, -2, -2, -2, -2,  1,  5,  1, -1, -2, -2, -2,  0,  5, 10,
-    0,  0,  0,  0,  0, -1, -1, -1, -1, -1, -1,  0,  0,  0,  1,  2,
-    1,  2,  2,  3,  4,  4,  6,  5, -3, -3, -3, -2, -2, -3, -3, -3,
-    1, -1, -2, -2,  0,  3,  5,  7,  2,  0, -2, -3, -2,  0,  2,  3,
-    3,  1, -2, -3, -3, -2, -1, -1,  3,  1,  0, -1, -1, -1, -1, -1,
-    1,  3,  5,  4,  2, -1, -3, -4, -3, -2,  1,  2,  1,  0, -1, -2,
-   -5, -3,  0,  2,  2,  1,  0,  0, -3, -1,  1,  2,  2,  1,  0,  0,
-    0, -1, -1, -1,  1,  2,  3,  4, -3, -4, -4, -3, -1,  0,  0,  1,
-   -2, -3, -2, -1,  1,  1,  1,  1, -2, -2,  0,  3,  4,  4,  3,  2,
-   -4, -4, -3, -2, -1,  1,  2,  3,  0,  1,  1,  1, -1, -2, -3, -3,
-    3,  4,  5,  4,  2, -1, -3, -3, -2, -2,  0,  2,  2,  2,  1,  0,
-   -4,  0,  5,  7,  4, -1, -4, -4, -1,  2,  4,  3,  0, -3, -3, -2,
-    2,  1,  0, -1, -2, -2,  0,  1,  0,  0, -1, -2, -2, -1,  1,  2,
-   -4, -3, -2, -1,  0,  1,  2,  2, 10,  9,  5,  0, -3, -4, -3, -2,
-    1, -1, -2, -2, -1,  0,  0,  0, -2, -2, -1,  1,  1,  1,  0, -1,
-   -5, -3,  0,  3,  4,  2,  0, -2, -2, -1,  0,  1,  1,  0, -1, -1,
-    3,  2, -1, -2, -2, -1,  1,  1,  7,  5, -1, -5, -6, -2,  2,  4,
-   -2,  3,  3, -3, -4,  1,  2, -2, -3,  3,  4, -3, -4,  2,  3, -2,
-   -3,  3,  4, -3, -4,  2,  3, -2, -4,  2,  4, -2, -3,  1,  2, -1,
-    4,  3, -1, -3, -3, -1,  1,  2, -4, -6, -4,  0,  4,  5,  4,  1,
-    0,  2,  5,  6,  2, -3, -5, -4,  1,  1, -1, -3, -5, -2,  2,  4,
-   -1,  0,  1,  2,  2,  3,  3,  4, -1,  0,  1,  1,  0, -1, -1, -1,
-   -1,  0,  1,  2,  2,  1, -1, -2, -3, -2, -1,  0,  0, -1, -2, -3,
-    1,  1,  1,  1,  0,  0,  1,  2,  1,  0, -1,  0,  0,  1,  1,  0,
-    1, -2, -4, -1,  1,  2,  1,  0,  1, -4, -7, -3,  1,  3,  2,  1,
-    1,  1,  1,  1,  1,  1,  0, -1,  1,  1,  1,  0,  1,  2,  2,  0,
-    1,  1,  0,  0,  0,  2,  0, -3,  3,  2,  0, -1, -1, -2, -6, -9,
-    0,  0,  0,  1,  0,  0,  1,  2,  1,  0,  0,  0, -1, -1,  0,  2,
-    0,  1,  1,  1, -1, -3, -2,  0, -7, -5,  1,  6,  6,  2, -1, -1,
-    3,  1, -1, -3, -4, -2,  1,  4,  2,  0, -2, -3, -4, -3, -1,  2,
-    2,  2,  1,  1,  1,  0,  0,  1,  1,  1,  0,  0,  0,  0,  0,  1,
-   -1,  1,  1, -2, -5, -6, -4, -1, -1,  1,  4,  3,  2,  0,  1,  2,
-   -1,  0,  2,  3,  1,  0,  0,  1, -1,  0,  1,  0,  0, -1, -1,  0,
-    0,  1,  2,  2,  0, -2, -1,  1, -2, -1, -1, -2, -1,  2,  6,  8,
-   -1, -1, -2, -3, -2,  0,  1,  2, -1,  0,  0, -1, -1,  0, -1, -1,
-    2,  1,  1,  1,  1,  0,  0,  0,  0,  0,  1,  1,  1, -1, -1,  1,
-   -1,  0,  2,  2, -1, -3, -2,  3,  0,  2,  3,  0, -5, -7, -2,  4,
-   -1,  0,  0,  0, -1, -2, -3, -3, -1,  0, -1, -2, -2, -2, -2, -2,
-    1,  1,  0,  0,  1,  2,  0, -1,  1,  2,  1,  2,  5,  6,  2,  0,
-   -2, -4, -3,  0,  2,  2,  0, -3,  3,  1,  0,  1,  2,  1, -2, -3,
-    3,  1,  0,  0,  0,  0,  0, -1,  1, -1, -2, -2, -1,  1,  3,  3,
-    3,  2,  1,  2,  4,  3,  1, -2, -2, -4, -4, -3, -1,  0, -2, -3,
-    1,  0, -1, -1,  0,  1,  0, -1,  3,  2,  0,  0,  0,  1,  1,  0,
-    1,  1,  0,  0,  0,  0,  0,  0,  2,  3,  3,  2,  2,  2,  1,  1,
-    0, -1, -2, -3, -5, -5, -5, -4,  1,  1,  0, -1,  0,  1,  3,  3,
-   -9, -6, -2,  0,  1,  1,  2,  2, -6, -2,  1,  2,  1,  1,  0,  1,
-   -2,  1,  2,  2,  1,  1,  1,  1,  0,  2,  2,  1,  0,  1,  1,  1,
-    1,  0,  0,  0,  0,  0, -1,  0,  0,  0,  0,  0, -1, -3, -2,  0,
-   -3, -3, -3, -2, -1,  3,  7,  9,  1,  2,  2,  2,  0, -2, -4, -3,
-    2,  0, -2, -1,  3,  4, -1, -6,  1,  0, -2, -3, -1,  3,  3,  0,
-    0,  3,  3,  0, -2, -1,  1,  1, -6, -1,  3,  2, -1, -2,  0,  1,
-    5,  3,  0, -2, -3,  0,  2,  1,  1,  1,  2,  2,  0, -2, -4, -7,
-   -3, -2,  1,  2,  2,  1, -1, -4,  2,  2,  0, -2, -2,  0,  2,  2,
-    0,  0, -2, -3, -2, -1,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,
-   -2, -1,  0,  1,  0,  1,  2,  3, -4, -2,  0,  0, -1,  0,  2,  3,
-   -2, -2, -2, -1, -1,  0,  2,  4,  0,  0,  0,  0, -1, -1,  0,  1,
-    0, -1, -1, -1, -1, -1,  0,  0,  6,  4,  2,  0, -1, -2, -1, -1,
-    0,  1,  1,  1,  1, -1, -5,-10,  1,  1,  1,  1,  1,  1,  0, -4,
-    1,  0,  1,  1,  1,  1,  1, -1,  2,  1,  1,  1,  0,  0,  0,  0,
-   -3,  1,  4,  3,  3,  1, -1,  0, -4,  0,  1,  0, -1,  0,  0,  0,
-   -5,  0,  2,  1,  1,  1,  0, -1, -1,  2,  1, -2, -2, -1,  0, -1,
-    2,  4,  5,  3,  0, -1,  1,  2,  0,  0,  1,  0, -2, -2, -1, -1,
-   -2, -2, -2, -2, -3, -2, -1,  0,  0,  0,  1,  0,  0,  0,  1,  2,
-    0, -2, -2, -3, -1,  2,  2, -1,  1,  0,  0,  0,  1,  5,  3, -2,
-   -1, -1,  0, -1,  0,  2,  0, -5, -1,  0,  1,  0,  0,  2,  2, -2,
-    3,  1, -1, -1,  0,  1,  1,  2,  1,  0,  0,  1,  1,  1,  1,  1,
-  -10, -8, -2,  1,  2,  1,  1,  1, -1,  1,  2,  1,  0,  0,  0,  0,
-   -1, -1,  0,  1,  2,  2,  2,  1, -1, -1, -1,  0, -1, -3, -5, -4,
-    1,  1,  2,  1,  1,  0,  0,  2, -1, -2, -1, -1, -1,  0,  2,  4,
-   -3, -7, -5,  0,  2,  0,  0,  0,  3, -1, -2,  1,  2,  1,  1,  2,
-    1, -2, -1,  1,  2,  1,  0,  1,  0, -1,  0,  3,  2, -1, -1, -1,
-    2,  1,  1,  0,  0,  0,  0,  0, -9, -7, -2,  3,  3,  2,  1,  1,
-    3,  2,  0, -2, -2, -1,  1,  1,  0, -1,  0,  0,  1,  1,  0,  0,
-   -2, -1,  1,  1,  1,  0,  0,  0,  1,  2,  1, -2, -4, -3,  1,  2,
-    1,  2,  1, -2, -3,  0,  3,  1, -1, -1,  0,  0,  1,  3,  0, -4,
-    2,  0, -1,  1,  2, -2, -2,  3,  2,  0, -1,  2,  3, -2, -4,  1,
-    0,  1,  1,  1,  2, -2, -6, -2, -1,  0,  0,  0,  2,  0, -2, -1,
-   -1, -1,  1,  2,  1, -2, -3, -2,  3, -1, -2, -1, -1,  0,  1,  2,
-   10,  4,  0,  0, -1, -2, -2, -1,  3, -1, -2, -1,  0, -1, -1,  0,
-   -5,  2,  7,  1, -4, -2,  1,  0, -2,  2,  3, -1, -3,  0,  2,  0,
-    2,  1,  0,  0,  1,  1, -1, -2,  1, -2, -2, -1, -1, -2,  0,  0,
-    0,  3, -2, -7, -1,  3,  0,  0,  1,  3, -3, -5,  2,  3, -1,  0,
-    0,  2, -2, -2,  4,  2, -2,  0, -1,  1, -1,  0,  2, -1, -2,  1,
-    4,  0, -3, -4, -2,  1,  2,  1,  0,  0,  3,  5,  3,  1, -1, -2,
-    1,  1,  1, -1, -3, -1,  1,  1,  1, -1, -2, -2,  0,  0, -1, -2
-};
-
-/* 6x16-entry codebook for intra-coded 8x8 vectors */
-static const int8_t svq1_intra_codebook_8x8[6144] = {
-    4,  4,  3,  2,  2,  1,  0, -1,  4,  3,  3,  2,  1,  0, -1, -1,
-    3,  3,  2,  2,  1,  0, -1, -2,  3,  2,  2,  1,  0, -1, -2, -3,
-    2,  2,  1,  0, -1, -1, -2, -3,  2,  1,  0,  0, -1, -2, -3, -4,
-    1,  0,  0, -1, -2, -3, -4, -4,  0,  0, -1, -2, -2, -3, -4, -4,
-    2,  3,  3,  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  2,  3,  3,
-    1,  2,  2,  2,  2,  2,  2,  2,  0,  1,  1,  1,  1,  1,  1,  1,
-   -1,  0,  0,  0,  0,  0,  1,  1, -2, -2, -1, -1, -1, -1, -1, -1,
-   -3, -3, -3, -3, -3, -3, -2, -2, -5, -4, -4, -4, -4, -4, -4, -3,
-   -4, -2, -1,  0,  1,  2,  2,  3, -4, -2, -1,  0,  1,  2,  3,  3,
-   -4, -3, -1,  0,  1,  2,  3,  3, -4, -3, -1,  0,  1,  2,  3,  3,
-   -5, -3, -1,  0,  1,  2,  3,  3, -5, -3, -1,  0,  1,  2,  3,  3,
-   -5, -3, -1,  0,  1,  1,  2,  3, -5, -3, -2, -1,  0,  1,  2,  3,
-    4,  4,  5,  5,  6,  6,  7,  7,  2,  2,  2,  3,  3,  4,  4,  4,
-    0,  0,  0,  0,  1,  1,  1,  2, -2, -2, -2, -2, -1, -1, -1,  0,
-   -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-   -1, -2, -2, -2, -2, -2, -2, -2, -1, -1, -1, -1, -2, -2, -2, -2,
-    5,  3,  1, -1, -2, -3, -3, -3,  5,  3,  1, -1, -2, -3, -3, -3,
-    5,  3,  1, -1, -2, -3, -3, -3,  5,  3,  1, -1, -2, -3, -3, -3,
-    5,  4,  1,  0, -2, -3, -3, -3,  6,  4,  2,  0, -2, -2, -3, -3,
-    6,  4,  2,  0, -1, -2, -2, -3,  6,  4,  2,  1, -1, -2, -2, -2,
-   -1,  1,  3,  3,  2,  0, -3, -6, -1,  1,  3,  4,  3,  0, -3, -6,
-   -1,  1,  4,  4,  3,  1, -3, -6, -1,  1,  3,  4,  3,  1, -3, -6,
-   -2,  1,  3,  4,  3,  1, -3, -6, -2,  1,  3,  4,  3,  1, -3, -7,
-   -2,  1,  3,  3,  2,  0, -3, -7, -2,  0,  2,  3,  2,  0, -3, -6,
-   10,  9,  8,  6,  6,  5,  4,  4,  6,  5,  4,  3,  2,  2,  2,  1,
-    2,  1,  0, -1, -2, -2, -2, -1, -1, -2, -3, -4, -4, -4, -4, -3,
-   -2, -3, -4, -4, -5, -4, -4, -3, -2, -2, -3, -3, -3, -3, -2, -2,
-   -1, -1, -1, -1, -1, -1, -1,  0,  1,  1,  1,  1,  1,  1,  1,  2,
-   -2, -1,  1,  2,  4,  5,  7,  8, -3, -2,  0,  1,  3,  5,  7,  8,
-   -4, -3, -1,  0,  2,  4,  6,  7, -5, -4, -2, -1,  1,  3,  5,  7,
-   -6, -5, -3, -2,  0,  2,  4,  6, -6, -5, -4, -2, -1,  1,  3,  5,
-   -7, -6, -5, -3, -2,  0,  2,  3, -8, -7, -5, -4, -3, -1,  1,  2,
-   11,  9,  7,  5,  3,  1, -1, -1, 10,  8,  6,  3,  1,  0, -2, -2,
-    9,  7,  5,  2,  0, -2, -3, -4,  8,  6,  3,  1, -1, -3, -4, -4,
-    6,  4,  2, -1, -3, -4, -5, -5,  5,  3,  0, -2, -4, -5, -6, -6,
-    3,  1, -1, -3, -5, -6, -7, -7,  2,  0, -2, -4, -6, -6, -7, -7,
-    5,  6,  7,  7,  7,  8,  8,  8,  3,  4,  5,  5,  6,  6,  6,  6,
-    0,  2,  2,  3,  4,  4,  4,  5, -2, -1,  0,  1,  2,  2,  3,  3,
-   -4, -3, -2, -1,  0,  1,  1,  2, -6, -5, -4, -3, -2, -2, -1,  0,
-   -8, -7, -6, -6, -5, -4, -3, -3,-10, -9, -8, -8, -7, -6, -6, -5,
-    6,  5,  3,  1, -1, -3, -6, -8,  6,  5,  4,  2, -1, -3, -6, -8,
-    6,  5,  4,  2,  0, -3, -6, -8,  6,  5,  4,  2,  0, -3, -6, -8,
-    6,  6,  4,  2,  0, -3, -6, -8,  6,  5,  4,  2,  0, -3, -6, -8,
-    6,  5,  4,  2,  0, -3, -6, -8,  6,  5,  4,  2, -1, -3, -5, -8,
-   11, 10,  9,  8,  7,  6,  5,  4,  8,  8,  7,  6,  5,  4,  3,  2,
-    6,  5,  4,  4,  2,  2,  1,  0,  3,  3,  2,  1,  0,  0, -1, -2,
-    1,  1,  0, -1, -2, -2, -3, -3, -1, -1, -2, -3, -4, -4, -5, -5,
-   -3, -4, -4, -5, -6, -6, -7, -7, -5, -5, -6, -7, -8, -8, -8, -8,
-  -14,-13,-12,-11, -9, -7, -6, -4,-12,-11,-10, -9, -7, -5, -3, -1,
-  -10, -9, -7, -6, -3, -2,  0,  2, -8, -6, -4, -2,  0,  2,  4,  5,
-   -5, -3,  0,  2,  4,  5,  7,  8, -2,  0,  2,  4,  6,  8,  9, 10,
-    0,  3,  5,  7,  8, 10, 11, 12,  3,  5,  7,  8, 10, 11, 12, 12,
-  -19,-19,-18,-18,-17,-16,-15,-14,-15,-15,-14,-13,-12,-11,-10, -9,
-  -11,-10, -9, -8, -6, -5, -4, -3, -6, -5, -3, -2, -1,  0,  1,  2,
-   -1,  0,  2,  3,  4,  5,  6,  6,  4,  6,  7,  8,  9, 10, 10, 10,
-    9, 10, 11, 12, 13, 14, 14, 14, 12, 14, 14, 15, 16, 16, 16, 16,
-   22, 21, 19, 17, 14, 11,  9,  5, 20, 19, 17, 14, 11,  8,  4,  1,
-   17, 15, 13, 10,  6,  3,  0, -4, 13, 11,  8,  5,  1, -2, -5, -9,
-    9,  6,  3, -1, -4, -7,-11,-13,  4,  0, -3, -6, -9,-12,-15,-17,
-   -2, -5, -8,-11,-14,-16,-18,-20, -8,-10,-13,-16,-17,-19,-21,-22,
-   17, 18, 18, 18, 17, 16, 16, 14, 16, 16, 15, 15, 14, 13, 12, 11,
-   12, 12, 11, 10,  9,  8,  7,  5,  7,  6,  6,  4,  3,  2,  1, -1,
-    1,  0, -1, -2, -3, -4, -5, -6, -5, -6, -7, -8, -9,-10,-11,-12,
-  -11,-12,-13,-14,-15,-16,-16,-17,-16,-17,-17,-18,-19,-20,-20,-20,
-    0,  0,  0,  0, -1, -1, -2, -3,  1,  0,  0,  0,  0, -1, -2, -3,
-    1,  1,  0,  0, -1, -1, -2, -2,  1,  1,  1,  0,  0, -1, -1, -2,
-    2,  1,  1,  1,  0, -1, -1, -2,  2,  2,  1,  1,  0,  0, -1, -2,
-    2,  2,  1,  1,  1,  0, -1, -1,  2,  2,  1,  1,  1,  0,  0, -2,
-    0, -1, -1,  0,  0,  1,  2,  3,  0, -1, -1,  0,  1,  1,  2,  2,
-   -1, -1, -1, -1,  0,  1,  2,  2, -1, -1, -2, -1,  0,  1,  1,  2,
-   -1, -2, -2, -1,  0,  0,  1,  2, -1, -2, -2, -2, -1,  0,  1,  2,
-   -1, -1, -2, -1,  0,  0,  1,  2, -1, -1, -1, -1,  0,  1,  1,  2,
-    3,  2,  2,  2,  1,  1,  0,  0,  3,  2,  2,  2,  2,  1,  0,  0,
-    2,  2,  2,  1,  1,  1,  0,  0,  2,  2,  1,  1,  1,  0,  0, -1,
-    1,  1,  1,  0,  0,  0, -1, -1,  0,  0, -1, -1, -1, -1, -1, -1,
-   -2, -2, -2, -2, -2, -2, -2, -2, -2, -3, -3, -3, -2, -2, -2, -2,
-    5,  2,  0,  0, -1,  0,  0,  0,  4,  2,  0, -1, -1, -1,  0, -1,
-    4,  1, -1, -1, -2, -1, -1, -1,  4,  1, -1, -1, -2, -1, -1, -1,
-    4,  1, -1, -2, -2, -1, -1, -1,  4,  1, -1, -2, -2, -1, -1, -1,
-    4,  1, -1, -1, -1, -1, -1, -1,  4,  2,  0, -1,  0,  0,  0, -1,
-   -2, -1,  0,  1,  1,  1,  1,  1, -3, -1,  0,  1,  1,  1,  1,  1,
-   -3, -1,  0,  1,  1,  1,  1,  1, -3, -1,  0,  1,  1,  1,  1,  1,
-   -3, -2,  0,  1,  2,  2,  1,  1, -4, -2,  0,  1,  2,  2,  2,  2,
-   -5, -3, -1,  1,  1,  2,  1,  2, -5, -3, -2,  0,  1,  1,  1,  1,
-    3,  3,  1,  0, -2, -4, -4, -5,  3,  3,  2,  0, -1, -2, -3, -4,
-    2,  2,  1,  1,  0, -1, -2, -2,  1,  1,  1,  1,  1,  0,  0,  0,
-    0,  0,  0,  1,  1,  1,  1,  1, -2, -1, -1,  0,  0,  1,  2,  2,
-   -3, -2, -2, -1,  0,  1,  2,  3, -3, -3, -2, -1,  0,  1,  2,  3,
-   -3, -3, -3, -3, -3, -2, -2, -2, -3, -3, -2, -2, -2, -1, -1, -1,
-   -2, -2, -2, -1, -1, -1, -1, -1, -1, -1, -1,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  1,  1,  1,  1,  0,  0,  1,  1,  2,  2,  2,  2,
-    1,  1,  1,  2,  2,  3,  3,  3,  2,  2,  2,  2,  3,  3,  3,  3,
-   -8, -7, -5, -3, -2, -1,  0, -1, -4, -3, -1,  0,  1,  2,  1,  1,
-   -1,  1,  2,  3,  3,  2,  2,  1,  1,  2,  3,  3,  2,  2,  1,  0,
-    2,  3,  3,  2,  1,  0,  0, -1,  1,  2,  1,  0, -1, -1, -1, -1,
-    1,  1,  0, -1, -1, -2, -2, -1,  1,  1,  0,  0, -1, -1,  0, -1,
-   -4, -3, -2,  0,  1,  2,  3,  3, -4, -3, -2,  0,  1,  2,  2,  2,
-   -3, -3, -2, -1,  0,  1,  1,  1, -2, -2, -2, -1, -1,  0,  0,  0,
-    0, -1, -1, -1, -1, -1, -1, -1,  2,  1,  1,  0,  0, -1, -1, -2,
-    3,  3,  3,  1,  0, -1, -2, -2,  5,  4,  4,  2,  1,  0, -1, -2,
-    0,  0,  0,  0,  1,  2,  3,  3,  0, -1,  0,  0,  1,  2,  3,  3,
-    0, -1,  0,  0,  1,  2,  3,  2,  0,  0,  0,  1,  1,  2,  2,  2,
-    2,  1,  1,  1,  1,  1,  1,  0,  2,  2,  2,  1,  0,  0, -1, -2,
-    2,  1,  0,  0, -2, -3, -5, -6,  0, -1, -1, -3, -5, -6, -8, -9,
-   -2,  0,  1,  2,  2,  1, -1, -4, -2,  0,  2,  2,  2,  1, -1, -4,
-   -2,  0,  2,  2,  2,  1, -1, -3, -2,  0,  2,  2,  2,  1, -1, -3,
-   -2, -1,  2,  2,  2,  1, -1, -3, -2, -1,  1,  2,  2,  1, -1, -3,
-   -3, -1,  1,  2,  2,  1, -1, -3, -2, -1,  1,  2,  2,  1, -1, -3,
-   -1,  1,  1, -1, -3, -3,  0,  4, -1,  1,  1, -1, -3, -3,  0,  4,
-   -1,  1,  1,  0, -3, -3,  0,  4, -1,  1,  2,  0, -3, -3,  0,  5,
-    0,  1,  2,  0, -3, -4,  0,  4,  0,  1,  2,  0, -3, -4,  0,  5,
-    0,  1,  2,  0, -3, -3,  0,  4,  0,  1,  2, -1, -2, -2,  0,  4,
-    6,  6,  5,  6,  5,  5,  5,  5,  2,  2,  2,  2,  2,  2,  2,  2,
-    0,  0,  0,  0,  0,  0,  0,  0, -1, -1, -1, -1, -2, -2, -2, -2,
-   -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-   -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    2,  2,  2,  2,  2,  2,  2,  2,  0,  1,  1,  0,  0,  0,  0,  0,
-   -1, -2, -2, -2, -2, -2, -2, -1, -3, -3, -3, -3, -3, -3, -3, -2,
-   -3, -4, -4, -3, -3, -3, -2, -2, -2, -2, -2, -2, -1, -1,  0,  0,
-    0,  1,  1,  1,  2,  2,  3,  3,  3,  4,  4,  5,  5,  6,  6,  6,
-    4,  1, -2, -3, -3, -1,  1,  3,  4,  1, -2, -4, -3, -1,  1,  3,
-    5,  1, -2, -4, -3, -1,  1,  4,  5,  1, -2, -3, -3, -1,  2,  4,
-    5,  1, -2, -3, -3, -1,  2,  4,  4,  0, -3, -4, -3, -1,  2,  4,
-    4,  0, -3, -3, -3, -1,  1,  3,  3,  0, -2, -3, -2, -1,  1,  3,
-   -3, -4, -4, -4, -4, -4, -4, -4, -1, -1, -1, -1, -1, -1, -2, -2,
-    2,  1,  1,  2,  2,  1,  1,  1,  3,  3,  3,  4,  4,  3,  3,  3,
-    3,  3,  3,  4,  4,  4,  3,  3,  1,  2,  1,  2,  2,  2,  2,  2,
-   -2, -2, -2, -1, -1, -1,  0,  0, -4, -4, -4, -4, -3, -3, -3, -3,
-   -1, -2, -3, -3, -2, -2, -1,  0,  0, -1, -2, -2, -2, -1,  0,  1,
-    2,  1, -1, -1, -1, -1,  0,  1,  3,  1,  0, -1, -1,  0,  0,  1,
-    3,  2,  0, -1,  0,  0,  0,  1,  3,  1,  0, -1,  0,  0,  0,  1,
-    3,  1,  0, -1,  0,  0,  0,  1,  2,  1,  0,  0,  0,  0,  0,  1,
-    0,  0,  0,  1,  1,  2,  3,  4,  0,  0, -1,  0,  0,  0,  2,  3,
-    0, -1, -1, -1, -1, -1,  0,  1,  0, -1, -1, -1, -1, -1, -1,  0,
-    0,  0, -1, -1, -1, -2, -2, -1,  1,  0,  0, -1, -1, -2, -2, -1,
-    2,  2,  1,  0, -1, -1, -1, -1,  3,  3,  2,  1,  0, -1, -1,  0,
-    1,  0,  1,  0,  0, -1, -2, -1,  0,  0,  0,  0, -1, -1, -2, -1,
-    0, -1,  0,  0, -1, -1, -1, -1, -1, -1, -1,  0,  0,  0,  0,  0,
-   -1, -1, -1,  0,  0,  0,  1,  1, -1, -1, -1,  0,  1,  1,  2,  3,
-   -2, -2, -1,  0,  1,  2,  3,  4, -2, -2, -1,  0,  1,  2,  4,  5,
-   -3, -1,  1,  0,  0, -1,  0,  1, -3,  0,  1,  0, -1, -1,  0,  2,
-   -3,  0,  1,  0, -1, -1,  0,  2, -2,  1,  2,  0, -1, -1,  0,  2,
-   -2,  1,  2,  0, -1, -1,  0,  2, -2,  1,  2,  0, -1, -1,  0,  2,
-   -1,  2,  2,  0, -1, -1,  0,  2, -1,  1,  1,  0, -1, -1, -1,  1,
-   -2, -2, -1,  1,  3,  4,  3,  1, -2, -2, -1,  0,  2,  3,  2,  0,
-   -2, -2, -1,  0,  1,  2,  1, -1, -1, -1, -1,  0,  1,  2,  1, -1,
-   -1, -1, -1,  0,  1,  1,  0, -2,  0, -1, -1,  0,  1,  1,  0, -1,
-    0, -1, -1,  0,  1,  1,  1, -1,  0, -1, -1,  0,  0,  1,  0, -1,
-   -2, -1,  0,  1,  1,  1,  1,  1, -2, -1,  0,  0,  0,  0,  0,  0,
-   -2, -1, -1,  0, -1, -1, -2, -2, -2, -1, -1, -1, -1, -2, -2, -3,
-   -1,  0,  1,  1,  0, -1, -2, -2,  1,  2,  3,  3,  2,  1,  0,  0,
-    1,  2,  3,  3,  3,  2,  1,  0,  0,  0,  1,  1,  1,  1,  0,  0,
-    0, -1, -1, -1,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  1,
-    1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  2,  2,  1,  1,  1,  1,
-    1,  1,  1,  1,  1,  1,  1,  1, -1,  0,  0,  1,  1,  0,  0,  0,
-   -3, -2, -1, -1, -1, -1,  0, -1, -5, -5, -4, -3, -2, -2, -2, -1,
-    1,  1,  1,  1,  2,  1,  0, -1,  1,  1,  1,  2,  1,  1,  0, -1,
-    1,  1,  1,  1,  1,  1,  0, -2,  2,  1,  1,  1,  1,  1,  0, -2,
-    1,  1,  0,  0,  0,  0, -1, -3,  1,  1,  0,  0,  0, -1, -2, -3,
-    1,  1,  0,  0, -1, -1, -2, -4,  1,  0,  0, -1, -2, -2, -3, -4,
-    8,  7,  5,  3,  2,  1,  1,  1,  2,  1,  0,  0, -1, -1, -2, -1,
-   -1, -1, -1, -2, -2, -2, -2, -1, -1, -1, -1, -1,  0, -1, -1,  0,
-    0,  0,  0,  1,  1,  0,  0,  0,  0,  0,  1,  1,  1,  0,  0,  0,
-   -1,  0,  0,  0,  0,  0, -1, -1, -2, -2, -1, -1, -1, -2, -2, -1,
-    9,  4,  0, -2, -2, -2, -1, -1,  7,  2, -1, -2, -2, -1,  0,  0,
-    4,  0, -2, -2, -1,  0,  1,  1,  1, -2, -2, -2, -1,  0,  1,  1,
-   -1, -2, -2, -1,  0,  1,  1,  1, -1, -2, -1,  0,  1,  1,  1,  0,
-   -1, -1,  0,  1,  1,  1,  0, -1,  0, -1,  0,  1,  0,  0, -1, -1,
-    0,  1,  1,  1,  1,  1,  0,  0,  1,  2,  2,  2,  1,  0,  0,  0,
-    2,  2,  2,  2,  1,  0, -1, -1,  1,  1,  1,  0, -1, -2, -2, -2,
-    0,  0,  0, -1, -2, -3, -2, -2, -1, -1, -1, -2, -2, -2, -1,  0,
-   -1, -1, -1, -1,  0,  0,  1,  2, -1, -1, -1,  0,  1,  2,  3,  4,
-   -1, -1,  0,  0, -1, -2, -3, -3, -1, -1,  0,  0,  0, -1, -1, -1,
-   -2, -2, -1,  0,  1,  1,  1,  1, -2, -2, -2,  0,  1,  2,  3,  3,
-   -1, -1, -1,  0,  1,  3,  3,  3,  1,  0,  0,  0,  1,  1,  2,  2,
-    2,  2,  1,  0,  0, -1, -1, -1,  3,  2,  1,  0, -1, -2, -3, -3,
-   -1, -1, -1, -2, -2, -3, -4, -5,  0,  0,  0, -1, -1, -3, -3, -4,
-    1,  1,  1,  0,  0, -1, -2, -3,  2,  2,  2,  1,  1,  0, -1, -1,
-    2,  2,  2,  2,  1,  1,  0, -1,  2,  2,  2,  2,  2,  1,  0,  0,
-    1,  1,  2,  1,  1,  1,  0,  0,  0,  0,  1,  1,  0,  0,  0, -1,
-   -2,  2,  3,  1, -1,  1,  1, -1, -3,  2,  3,  0, -1,  1,  1, -1,
-   -3,  2,  3,  0, -1,  1,  1, -1, -4,  2,  3,  0, -1,  1,  1, -2,
-   -4,  1,  3,  0, -1,  1,  1, -2, -4,  1,  3, -1, -2,  1,  1, -2,
-   -3,  1,  2,  0, -1,  1,  1, -2, -3,  1,  2,  0, -1,  1,  1, -1,
-   -1, -1, -1, -2, -2, -2, -2, -2,  1,  1,  1,  1,  0,  0,  0,  0,
-    1,  2,  2,  2,  2,  2,  2,  2,  0,  0,  1,  1,  1,  2,  2,  2,
-   -2, -2, -1, -1, -1,  0,  0,  0, -3, -3, -3, -3, -3, -3, -3, -2,
-   -1, -1, -1, -1, -2, -2, -2, -2,  4,  4,  4,  4,  4,  3,  3,  2,
-   -3, -3, -2, -1,  0,  1,  2,  5, -3, -3, -3, -2, -1,  1,  3,  6,
-   -3, -3, -2, -2,  0,  2,  3,  5, -3, -2, -2, -2,  0,  1,  3,  5,
-   -2, -2, -2, -1, -1,  1,  3,  5, -2, -2, -1, -1,  0,  1,  2,  4,
-   -1, -1, -1, -1,  0,  1,  1,  4, -1, -1, -1, -1,  0,  1,  2,  3,
-    0, -1,  0,  1,  1,  0, -1, -1,  0,  0,  0,  1,  2,  0, -1, -1,
-    1,  0, -1,  0,  1,  0,  0,  0,  1, -1, -2, -1,  0,  0,  0,  0,
-    1, -2, -3, -1,  0,  0,  0,  1,  1, -1, -3, -2,  0,  1,  1,  2,
-    1, -1, -2, -1,  0,  1,  1,  2,  2,  0, -1,  0,  1,  1,  2,  2,
-    1,  1,  1,  1,  0,  0,  1,  2, -1,  0,  0, -1,  0,  0,  0,  1,
-   -3, -2, -1, -1, -1,  0,  1,  1, -4, -2, -1,  0,  0,  1,  1,  1,
-   -3, -2,  0,  0,  1,  1,  1,  1, -3, -1,  0,  1,  1,  1,  0,  0,
-   -1,  0,  1,  1,  1,  0,  0, -1,  0,  1,  2,  2,  1,  0,  0, -1,
-   -4, -4, -4, -3, -2, -1, -1, -1, -2, -2, -2, -1,  0,  0,  0,  0,
-   -1,  0,  0,  0,  1,  1,  1,  1,  0,  0,  1,  1,  1,  1,  1,  1,
-    0,  0,  1,  1,  2,  2,  1,  0,  0,  0,  1,  1,  1,  1,  1,  0,
-    0,  0,  0,  1,  1,  1,  1,  0, -1,  0,  0,  1,  1,  1,  0,  0,
-    1,  2,  2,  2,  1, -1, -2, -4,  1,  1,  2,  2,  1,  0, -2, -4,
-    0,  1,  1,  1,  1,  0, -1, -3, -1,  0,  1,  1,  0,  0, -1, -2,
-   -1,  0,  1,  1,  1,  0,  0, -1, -2, -1,  0,  0,  0,  0,  0, -1,
-   -1, -1,  0,  1,  1,  0,  0,  0, -1,  0,  1,  1,  1,  1,  1,  0,
-    2,  2,  0, -1, -2, -1, -1, -2,  1,  1, -1, -2, -2, -1, -1, -2,
-    1,  1, -1, -2, -2,  0,  0, -1,  1,  1,  0, -2, -1,  1,  1,  0,
-    1,  1,  0, -1, -1,  1,  2,  1,  1,  1,  0, -1, -1,  1,  2,  1,
-    1,  1,  0, -1, -1,  1,  1,  1,  1,  1,  0, -1,  0,  1,  1,  1,
-    0,  0, -1, -2, -4, -4, -4, -4,  3,  3,  3,  2,  1,  0,  0,  0,
-    3,  3,  3,  3,  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  1,
-   -1, -1, -1, -1, -1, -1, -1,  0,  0, -1,  0,  0, -1,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, -1, -1,  0,
-   -1, -1,  0, -1, -1,  1,  2, -1,  1,  1,  0,  0,  0,  2,  3, -1,
-    1,  1,  0, -1, -1,  1,  3, -1,  1,  1,  0, -2, -2,  0,  1, -2,
-    1,  0,  0, -2, -2,  0,  1, -3,  0,  0,  0,  0, -1,  1,  1, -3,
-    0,  1,  1,  0,  1,  2,  1, -3, -1,  0,  1,  1,  1,  2,  1, -4,
-   -4, -3,  0,  1,  1,  1,  0,  0, -4, -2,  0,  1,  1,  1,  0, -1,
-   -3, -1,  1,  1,  1,  0, -1, -1, -1,  1,  1,  1,  1,  0, -1,  0,
-    1,  2,  2,  1,  0, -1,  0,  0,  2,  2,  1,  0, -1, -1,  0,  1,
-    2,  1,  0, -1, -2, -1,  0,  1,  2,  2,  0, -1, -2, -1,  1,  1,
-    1,  1,  0,  0, -1, -1, -1, -1,  0, -1, -1, -1, -1, -1, -1, -1,
-   -1, -1, -1, -1, -1, -1, -1, -1,  0,  0, -1, -1, -1, -1, -1, -1,
-    1,  0,  0, -1, -1, -1, -1, -1,  2,  1,  0,  0, -1, -1, -1, -1,
-    5,  3,  2,  1,  0,  0,  0,  0,  6,  5,  3,  2,  1,  0,  0,  0,
-    4,  4,  3,  1,  0,  0,  0,  1,  3,  3,  2,  1,  0,  0,  0,  1,
-    2,  2,  1,  0, -1, -1,  0,  1,  0,  0,  0, -1, -1, -1,  0,  1,
-    0,  0, -1, -1, -2, -1,  0,  2,  0, -1, -1, -2, -2, -2,  0,  1,
-    0, -1, -1, -2, -2, -2, -1,  0,  0,  0, -1, -2, -2, -2, -1,  0,
-    0,  0, -1, -1, -1,  0,  2,  3,  0, -1, -2, -2, -1, -1,  1,  2,
-    1,  0, -1, -1, -1,  0,  0,  0,  1,  1,  1,  0,  0,  0, -1, -1,
-    1,  2,  1,  0,  0, -1, -1, -1, -1,  0,  0,  0, -1, -1, -1, -1,
-   -3, -2, -1, -1,  0,  1,  1,  2, -4, -3, -1,  1,  2,  3,  5,  5,
-    0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,
-    0,  0,  0, -1,  0,  0,  0,  1, -1, -1, -2, -2, -2, -1, -1,  0,
-    0,  0,  0,  0,  0,  1,  1,  1,  2,  2,  2,  2,  2,  3,  3,  3,
-    1,  1,  1,  1,  2,  2,  1,  1, -4, -3, -4, -4, -4, -4, -3, -3,
-   -1,  0,  1,  2,  2,  3,  3,  3, -1, -1, -1, -1,  0,  0,  0,  0,
-    0,  0, -1, -2, -2, -3, -3, -2,  3,  2,  1,  0, -1, -2, -2, -2,
-    4,  3,  2,  1,  1,  0,  0,  0,  2,  2,  1,  1,  0,  1,  1,  1,
-    0, -1, -1, -1, -1,  0,  0,  1, -2, -2, -2, -2, -2, -1,  0,  0,
-    1, -1,  0,  2,  1, -2, -1,  1,  1, -1,  0,  2,  1, -2, -2,  1,
-    1, -1,  0,  3,  2, -2, -1,  1,  0, -2,  0,  3,  2, -2, -2,  1,
-    0, -2,  0,  3,  2, -2, -2,  1,  0, -2,  0,  3,  1, -2, -1,  1,
-    0, -2,  0,  2,  1, -2, -2,  1,  0, -1,  0,  2,  1, -2, -1,  1,
-    0,  1,  2,  2,  3,  3,  2,  2,  0,  1,  1,  2,  3,  3,  2,  1,
-    0,  0,  1,  2,  2,  2,  2,  1, -1,  0,  0,  1,  1,  1,  1,  1,
-   -1, -1,  0,  0,  0,  0,  0,  0, -1, -1, -1, -1, -1, -1, -1, -1,
-   -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -1,
-    0,  0, -1, -2, -1,  0,  3,  5,  0,  0, -1, -1, -1,  0,  2,  4,
-    1,  1,  0,  0, -1, -1,  1,  2,  1,  2,  1,  1,  0, -1, -1,  0,
-    0,  1,  2,  1,  0, -1, -2, -2, -1,  0,  1,  2,  1,  0, -3, -3,
-   -2, -1,  1,  2,  2,  0, -2, -4, -2, -1,  0,  2,  2,  1, -1, -3,
-    0,  0,  0,  0,  0,  0, -1, -1,  0,  0, -1,  0,  0,  0,  0,  0,
-   -1, -1, -1, -1,  0,  0,  0,  0, -1, -1, -1, -1, -1, -1, -1,  0,
-   -1, -1, -1, -1, -1, -1, -1,  0, -1,  0,  0,  0,  0, -1, -1,  0,
-    0,  0,  1,  1,  0,  0,  0,  1,  3,  3,  3,  4,  3,  3,  3,  3,
-    5,  1, -2, -2,  0,  0,  0, -1,  4, -1, -3, -1,  0,  0,  0, -1,
-    3, -1, -1,  0,  1,  1,  0, -1,  2,  0,  0,  1,  1,  1,  0, -2,
-    1,  0,  0,  1,  1,  1,  0, -2,  0, -1, -1, -1,  0,  0,  0, -1,
-    0, -1, -1, -1, -1,  0,  0, -1,  2,  1,  0,  0,  0,  1,  0,  0,
-    1,  0,  1,  1,  1,  1,  0,  0,  1,  0,  0,  1,  1,  0,  0,  0,
-    1, -1, -1,  0,  0,  0,  0,  0,  2,  0, -1, -1, -1, -1, -1,  0,
-    3,  1, -1, -1, -2, -2, -2, -1,  4,  2,  1,  0, -1, -2, -2, -1,
-    2,  1,  0,  0, -1, -1,  0,  0,  0, -1, -1, -1, -1,  0,  1,  1,
-    0,  1,  2,  2,  2,  1, -1, -3,  0,  0,  1,  1,  1,  0, -1, -2,
-    0,  0,  0,  0,  0,  0, -1, -1,  0,  0, -1,  0,  0,  1,  1,  0,
-    0,  0, -1,  0,  1,  1,  1,  1,  0,  0,  0,  0,  1,  1,  1,  0,
-    0,  0,  1,  1,  2,  1, -1, -3,  0,  0,  0,  1,  1, -1, -4, -5,
-   -2, -2, -2, -1,  0,  2,  2,  2,  0,  0,  0,  0,  1,  1,  1,  0,
-    1,  1,  1,  1,  1,  0, -2, -3,  0,  0,  1,  1,  0, -1, -3, -4,
-   -1, -1,  0,  1,  0,  0, -2, -3, -1, -1,  0,  1,  1,  1,  0, -1,
-    0,  0,  0,  1,  1,  1,  1,  0,  1,  1,  1,  1,  0,  0,  0,  0,
-    0,  1,  0,  0,  1,  1,  1,  2,  1,  2,  0,  0,  0,  0, -1,  1,
-    0,  2,  0, -1,  1,  0, -1,  0,  0,  1,  0,  0,  2,  1,  0,  1,
-    0,  1, -1,  0,  2,  2,  0,  1, -1,  0, -1, -1,  2,  1,  1,  2,
-   -2, -2, -3, -2,  0,  1,  1,  1, -2, -2, -3, -3, -1, -1, -1,  0,
-   -3, -1,  0,  1,  2,  1,  1,  0, -3, -1,  0,  1,  2,  1,  1,  1,
-   -2,  0,  0,  1,  1,  1,  1,  1, -1,  0,  0,  0,  0,  0,  0,  0,
-   -2,  0,  0,  0,  0, -1, -1,  0, -2,  0,  0,  0,  0,  0, -1, -1,
-   -3,  0,  1,  1,  1,  1,  0,  1, -5, -2,  0,  1,  2,  2,  1,  2,
-   -2, -1, -1,  0,  0,  1,  2,  3,  0,  0,  1,  1,  0,  0,  1,  2,
-    0,  0,  1,  0, -1, -1,  0,  1, -1, -1, -1, -1, -2, -2, -1,  0,
-   -2, -2, -2, -2, -2, -1,  0,  1,  0,  0,  0, -1,  0,  1,  2,  2,
-    2,  1,  0,  0,  0,  1,  2,  2,  2,  1,  0, -1, -1, -1,  0,  0,
-    0,  1,  1,  1,  1,  1, -1, -4, -1, -1,  0,  1,  1,  1,  0, -3,
-   -2, -1,  0,  0,  1,  2,  2, -2, -1,  0,  0,  0,  0,  2,  3, -1,
-   -1,  0,  0,  0,  0,  1,  2,  0,  0,  0, -1, -2, -1,  1,  1,  0,
-    0,  0, -1, -2, -2,  0,  2,  1,  0,  0, -1, -2, -1,  1,  2,  2,
-    1,  0,  0,  0, -2, -3, -2, -3,  0,  0,  1,  0, -2, -2, -1, -1,
-    0, -1,  1,  1, -1, -1,  0,  0,  0, -1,  1,  1, -1, -1,  0,  0,
-    0,  1,  2,  1, -1, -1,  0,  1,  1,  2,  3,  2,  0,  0,  1,  2,
-   -1,  0,  2,  1,  0,  0,  2,  3, -2, -1,  0,  0, -1,  0,  1,  2,
-    1,  1,  0, -1, -2, -2, -1,  1,  1,  1,  1, -1, -2, -2,  0,  2,
-    1,  1,  1, -1, -1, -1,  0,  2,  0,  0,  0,  0,  0,  0,  1,  2,
-   -1, -1, -1,  0,  0,  0,  1,  2, -1, -2, -1,  1,  1,  1,  0,  0,
-   -1, -2, -1,  1,  2,  2,  0, -1, -1, -2, -1,  2,  2,  2,  0, -1,
-   -1, -1, -1, -2, -1, -1,  0,  1,  0,  0, -1, -1, -1,  0,  1,  2,
-    1,  0,  0,  0,  0,  1,  1,  2,  1,  1,  0,  0,  1,  1,  1,  1,
-    1,  1,  0,  1,  1,  0,  1,  1,  1,  1,  1,  1,  0, -1, -1, -1,
-    1,  2,  1,  0, -1, -2, -2, -3,  2,  2,  1,  0, -2, -3, -4, -4,
-   -4, -2,  1,  1,  1,  1,  0,  0, -2,  0,  1,  0,  0,  0,  0,  0,
-    0,  1,  1, -2, -2, -1,  0,  1,  2,  2,  1, -2, -2, -1,  1,  2,
-    1,  2,  1, -2, -2, -1,  1,  2, -1,  1,  1, -1, -1, -1,  0,  1,
-   -2,  0,  1,  1,  0, -1, -1,  0, -2,  0,  2,  2,  1, -1, -1,  0,
-    1,  1,  0,  0,  0,  1,  0,  0, -2, -3, -3, -2, -2, -1,  0,  0,
-   -3, -4, -3, -2, -1,  0,  0,  0, -1, -1,  0,  1,  2,  3,  2,  1,
-    0,  1,  2,  3,  3,  3,  2,  1,  1,  1,  1,  2,  1,  0,  0, -1,
-    0,  0,  0,  0, -1, -1, -1, -1,  0, -1, -1,  0,  0,  0,  0,  0,
-    1,  1,  0,  0, -1, -1,  0,  2,  0,  0,  1,  0, -1, -1,  1,  1,
-   -2, -1,  0,  1,  1,  1,  1,  1, -3, -3,  0,  2,  2,  1,  1,  0,
-   -2, -2,  0,  1,  1,  1,  0,  0,  1,  0,  0,  0,  0,  0, -1, -1,
-    3,  1, -1, -3, -2, -1,  0,  1,  4,  2, -1, -3, -3, -1,  1,  2,
-    0,  0,  0, -1, -1, -1, -1, -1,  1,  2,  1,  0,  0,  0, -1, -1,
-    2,  3,  3,  2,  1,  0, -1, -1,  3,  4,  4,  2,  1,  0, -1, -2,
-    3,  3,  2,  1,  0, -1, -2, -2,  1,  1,  0, -1, -1, -2, -2, -3,
-    0,  0,  0, -1, -1, -2, -2, -2, -1, -1, -1, -1, -1, -2, -2, -1,
-    1,  2,  2,  2,  2,  1,  2,  2,  0,  1,  1,  1,  1,  0,  0,  0,
-    0,  0,  0,  1,  1,  0, -1, -2,  0,  0,  0,  0,  1,  0, -1, -4,
-    1,  0,  0,  0,  0,  0, -2, -5,  1,  0,  0,  0,  0,  0, -1, -4,
-    1,  0, -1,  0,  0,  0, -1, -3,  0, -1, -1,  0,  1,  1,  1, -1,
-   -2, -1,  0,  0, -1, -1, -1, -2, -1,  0,  0,  0, -1, -1, -2, -2,
-    0,  1,  1,  0, -1, -1, -1, -2,  0,  1,  1,  0,  0,  0, -1, -1,
-    0,  1,  0,  0,  1,  1,  1,  0,  1,  1,  0,  0,  1,  2,  2,  1,
-    1,  1,  0,  0,  1,  2,  2,  1,  1,  1,  0, -1,  0,  1,  1,  0,
-    4,  2,  1,  0,  0,  1,  1,  1,  4,  2,  1,  0,  0,  0,  0,  1,
-    3,  1,  0,  0, -1, -1, -1,  0,  1,  0,  0, -1, -1, -2, -1,  0,
-    0,  0,  0,  0, -1, -1, -1,  0, -1, -1,  0,  0, -1, -1,  0,  1,
-   -2, -1,  0, -1, -1,  0,  0,  1, -2, -2, -1, -2, -1,  0,  0,  1,
-    0,  1,  1,  1,  2,  1,  0, -1, -1, -1, -1,  0,  0, -1, -2, -2,
-   -1,  0, -1,  0,  0, -1, -2, -1,  0,  0,  0,  0,  0,  0,  1,  2,
-    0,  0,  0,  0,  0,  0,  2,  3, -1,  0, -1, -1, -1, -1,  0,  3,
-   -1,  0,  0, -1, -1, -2,  0,  3,  0,  0,  0,  0, -1, -1,  1,  4,
-    2,  2,  0,  0,  0,  0,  0,  1,  1,  1, -1, -2, -1, -2, -1,  1,
-   -1, -1, -2, -2, -2, -3, -2,  0, -1,  0, -1, -1, -1, -2, -1,  1,
-    1,  1,  0,  0,  1,  0,  0,  1,  2,  2,  0,  0,  1,  0,  0,  1,
-    2,  2,  0,  0,  0,  0, -1, -1,  2,  2,  0,  0,  1,  0, -1, -1,
-   -1,  0,  1,  1,  0, -1, -1, -1,  1,  2,  3,  2,  1,  0,  0,  0,
-    0,  1,  1,  1,  0, -1,  0,  0, -2, -2, -1,  0,  1,  0,  0,  0,
-   -2, -2, -1,  2,  2,  2,  1,  0, -2, -1,  0,  1,  1,  0,  0, -1,
-   -1, -1,  0,  0, -1, -2, -1, -2,  0,  1,  1,  1,  0,  0,  1,  1,
-   -3, -3, -3, -2, -1, -1, -2, -2, -1, -1,  0,  1,  2,  1,  0,  0,
-    1,  1,  1,  2,  2,  1,  0,  0,  1,  1,  1,  1,  1,  0, -1,  1,
-    1,  0, -1, -1,  0,  0, -1,  1,  0, -1, -1, -1,  0, -1, -1,  1,
-    1,  0, -1,  0,  0, -1,  0,  2,  2,  0, -1,  0,  0,  0,  0,  2,
-    1,  0, -2, -1,  0,  1,  1,  0,  2,  0, -1, -1,  0,  1,  1,  0,
-    1,  0, -2, -1,  0,  1,  0, -1,  1,  0, -1, -1,  0,  1,  0, -1,
-    0,  1,  1,  0,  1,  1,  0,  0, -2,  1,  2,  1,  0,  0,  0,  1,
-   -5,  0,  2,  1,  0, -1,  0,  1, -6, -1,  2,  1,  0, -1,  0,  0,
-    5,  3,  0, -1, -2, -1, -1, -1,  1,  1,  0, -1, -1,  0, -1, -1,
-   -1,  0,  1,  1,  2,  2,  1,  0, -2, -1,  0,  1,  2,  1,  1,  1,
-   -2, -1, -1, -1,  0, -1,  0,  1,  0,  1,  0,  0, -1, -1,  0,  0,
-    0,  1,  1,  1,  1,  0,  0,  0, -3, -2,  0,  1,  1,  0,  0, -1,
-   -1,  0,  1,  0, -1,  0,  2,  3, -1,  0,  0, -2, -4, -2, -1,  0,
-    0,  1,  1,  0, -2, -1,  0, -1,  1,  2,  3,  1,  0,  1,  1,  0,
-   -1,  0,  1,  1,  1,  1,  1,  0, -2, -3, -2,  0,  0,  0,  1,  0,
-   -1, -2, -2,  0,  1,  0,  0, -1,  3,  1,  0,  0,  1,  0, -1, -1,
-   -2, -1,  0,  0, -1, -1,  0,  0, -1,  0,  0,  0,  0,  1,  1,  1,
-   -1, -1, -1,  0,  1,  1,  1,  1,  0, -2, -3, -1,  1,  0,  0,  0,
-    1, -1, -3, -1,  1,  1,  0, -1,  3,  1, -1,  1,  2,  2,  0, -1,
-    3,  1,  0,  1,  2,  1,  1,  0,  0, -2, -2, -1, -1,  0,  0,  0,
-    1,  0, -1, -1,  1,  2,  1,  0,  0, -1, -2, -1,  1,  2,  2,  1,
-   -1, -1, -1,  0,  0,  1,  2,  0, -2,  0,  0,  0,  0,  0,  1, -1,
-   -1,  0,  1,  0, -1, -1, -1, -1,  0,  1,  1,  2,  0, -2, -1,  0,
-    1,  2,  2,  2,  1, -1, -1,  0,  0,  1,  1,  1,  0, -2, -2, -1,
-    0,  0, -1, -1, -1, -1, -2, -2,  0,  0, -1,  0,  1,  2,  2,  1,
-    0,  0, -1, -1,  0,  1,  2,  2,  1,  1, -1, -2, -1, -1, -1, -1,
-    2,  2,  1,  0,  0, -1, -2, -2,  1,  2,  2,  1,  0,  0, -2, -2,
-    0,  0,  0,  0,  1,  1,  0, -1,  0, -1, -1, -1,  2,  3,  2,  1,
-    0, -2,  1,  2, -1,  0,  0,  1, -1, -2,  2,  3, -1,  0,  0,  0,
-    0, -2,  2,  3, -1, -1,  0,  0,  0, -1,  3,  2, -2,  0,  1,  0,
-    0, -1,  3,  1, -2,  0,  1,  0,  0, -1,  2,  1, -1,  1,  0, -1,
-    0,  0,  1, -1, -2,  0,  0, -1,  1,  0,  0, -2, -2, -1, -1, -1,
-    1,  1,  1,  1,  1, -1, -1, -2,  0,  0,  0,  1,  1,  1,  1,  1,
-    0,  0,  0,  1,  1,  1,  2,  3,  1,  0,  0, -1,  0,  0,  1,  2,
-    0, -1, -1, -2, -1,  0,  1,  2, -2, -2, -2, -2, -1,  0,  1,  1,
-   -1, -1, -1, -1,  0,  0,  0, -1,  2,  2,  2,  0, -1, -1, -2, -4,
-   -1, -2, -1, -1,  0,  1,  2,  3, -1, -1, -1, -1,  0,  1,  2,  3,
-    1,  0, -1,  0, -1,  0,  1,  2,  1,  0,  0,  0, -1,  0,  2,  2,
-    1,  0, -1, -1, -2,  0,  1,  2,  0, -2, -2, -2, -3, -1,  0,  1,
-    0, -2, -2, -2, -2, -1,  1,  1,  0,  0,  0,  0,  0,  1,  2,  2
-};
-
-/* list of codebooks for intra-coded vectors */
-static const int8_t* const svq1_intra_codebooks[6] = {
-    svq1_intra_codebook_4x2, svq1_intra_codebook_4x4,
-    svq1_intra_codebook_8x4, svq1_intra_codebook_8x8,
-    NULL, NULL,
-};
-
-static const int8_t svq1_intra_codebook_sum[4][16*6] = {
- {
-  0,  0,  0, -1, -1, -1, -1, -2,  0, -1, -1,  0, -1,  0,  1,  0,
-  1,  0, -1,  1,  0,  0, -1,  1, -1,  0,  0,  0, -1,  1,  0,  0,
- -1,  0,  0,  1, -1,  1,  0, -1, -1,  0,  1,  1,  0,  0, -1,  1,
-  0,  1,  0,  0,  1, -1,  0,  0,  0, -1,  1,  0,  1,  0, -2,  1,
-  0, -1,  1,  0,  0,  0,  1,  0, -1,  0,  0,  0, -1,  0,  0,  0,
-  0,  1,  1,  0,  0, -1,  0,  1,  0,  0,  0,  0, -1,  1,  1, -1,
- },{
- -1, -2,  0, -1,  1,  0, -1,  0, -1, -4, -1, -2, -1, -2,  1, -2,
-  0,  0,  4, -2, -1,  1,  1,  0,  2,  1,  1,  0,  2,  0,  0,  0,
-  1,  1,  0, -1, -1, -1,  1,  0, -1, -3, -3,  1, -1,  1, -2, -1,
-  1, -1,  0,  1,  2,  1, -1, -1,  1,  1,  1,  2,  1,  0,  1, -2,
- -2,  0, -1, -2, -2,  0, -1, -1, -1,  0,  1,  0, -1, -1,  0, -1,
-  0,  2,  1,  2,  2,  1, -1,  1,  0,  2,  0, -1,  1,  0,  0,  0,
- },{
- -2,  0, -1, -1,  1,  1, -2,  0, -2,  0,  1, -2, -2,  1, -1, -1,
-  3, -2,  0, -3, -4, -3,  2,  1,  0,  3, -2,  2,  3,  2,  2, -1,
- -3,  1,  0,  1,  0,  0,  0,  1, -2,  1, -2, -2, -1, -2, -2,  2,
-  0, -4,  0,  2, -1,  0,  2,  2,  2,  1,  0, -1, -1,  1, -3,  2,
-  2,  1,  0,  3,  1, -1,  1,  3,  1,  0,  1,  1,  2, -1,  1, -1,
- -2, -1,  0, -1,  1, -1,  1, -2, -2, -1, -1, -3,  1, -4, -3,  1,
- },{
- -2,  0, -2,  3, -1, -1,  0,  2,  2, -1, -3,  2,  1,  0, -2, -1,
- -3, -2, -2,  1,  2, -3,  0,  1, -5, -2, -3,  0, -2, -1,  2,  0,
- -1, -1,  0, -2,  1,  3, -7, -2, -2, -1,  2, -1,  0,  3,  1,  3,
-  1,  0,  0,  1,  2,  3,  1,  2,  0, -2, -2,  1,  1,  2,  2,  3,
-  4,  1, -1,  2, -2,  4,  0,  0,  0,  4,  2,  0, -2, -2,  2, -4,
- -1,  5, -2, -2, -3,  2, -3, -1,  3, -3,  0,  4,  3,  0,  1, -2,
- }
-};
--- a/src/ffmpeg/libavcodec/svq1_vlc.h	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,281 +0,0 @@
-/*
- * copyright (C) 2003 the ffmpeg project
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef SVQ1_VLC_H
-#define SVQ1_VLC_H
-
-/* values in this table range from 0..3; adjust retrieved value by +0 */
-static const uint8_t svq1_block_type_vlc[4][2] = {
- /* { code, length } */
-    { 0x1, 1 },  { 0x1, 2 },  { 0x1, 3 },  { 0x0, 3 }
-
-};
-
-/* values in this table range from -1..6; adjust retrieved value by -1 */
-static const uint8_t svq1_intra_multistage_vlc[6][8][2] = {
- /* { code, length } */
-{
-    { 0x1, 5 },  { 0x1, 1 },  { 0x3, 3 },  { 0x2, 3 },
-    { 0x3, 4 },  { 0x2, 4 },  { 0x0, 5 },  { 0x1, 4 }
-},{
-    { 0x1, 4 },  { 0x3, 2 },  { 0x5, 3 },  { 0x4, 3 },
-    { 0x3, 3 },  { 0x2, 3 },  { 0x0, 4 },  { 0x1, 3 }
-},{
-    { 0x1, 5 },  { 0x1, 1 },  { 0x3, 3 },  { 0x0, 5 },
-    { 0x3, 4 },  { 0x2, 3 },  { 0x2, 4 },  { 0x1, 4 }
-},{
-    { 0x1, 6 },  { 0x1, 1 },  { 0x1, 2 },  { 0x0, 6 },
-    { 0x3, 4 },  { 0x2, 4 },  { 0x1, 5 },  { 0x1, 4 }
-},{
-    { 0x1, 6 },  { 0x1, 1 },  { 0x1, 2 },  { 0x3, 5 },
-    { 0x2, 5 },  { 0x0, 6 },  { 0x1, 5 },  { 0x1, 3 }
-},{
-    { 0x1, 7 },  { 0x1, 1 },  { 0x1, 2 },  { 0x1, 3 },
-    { 0x1, 4 },  { 0x1, 6 },  { 0x0, 7 },  { 0x1, 5 }
-}
-};
-
-/* values in this table range from -1..6; adjust retrieved value by -1 */
-static const uint8_t svq1_inter_multistage_vlc[6][8][2] = {
- /* { code, length } */
-{
-    { 0x3, 2 },  { 0x5, 3 },  { 0x4, 3 },  { 0x3, 3 },
-    { 0x2, 3 },  { 0x1, 3 },  { 0x1, 4 },  { 0x0, 4 }
-},{
-    { 0x3, 2 },  { 0x5, 3 },  { 0x4, 3 },  { 0x3, 3 },
-    { 0x2, 3 },  { 0x1, 3 },  { 0x1, 4 },  { 0x0, 4 }
-},{
-    { 0x1, 1 },  { 0x3, 3 },  { 0x2, 3 },  { 0x3, 4 },
-    { 0x2, 4 },  { 0x1, 4 },  { 0x1, 5 },  { 0x0, 5 }
-},{
-    { 0x1, 1 },  { 0x3, 3 },  { 0x2, 3 },  { 0x3, 4 },
-    { 0x2, 4 },  { 0x1, 4 },  { 0x1, 5 },  { 0x0, 5 }
-},{
-    { 0x1, 1 },  { 0x3, 3 },  { 0x2, 3 },  { 0x3, 4 },
-    { 0x2, 4 },  { 0x1, 4 },  { 0x1, 5 },  { 0x0, 5 }
-},{
-    { 0x1, 1 },  { 0x1, 2 },  { 0x1, 3 },  { 0x3, 5 },
-    { 0x2, 5 },  { 0x1, 5 },  { 0x1, 6 },  { 0x0, 6 }
-}
-};
-
-/* values in this table range from 0..255; adjust retrieved value by +0 */
-static const uint16_t svq1_intra_mean_vlc[256][2] = {
- /* { code, length } */
-    { 0x37, 6 },  { 0x56, 7 },  { 0x1, 17 },  { 0x1, 20 },
-    { 0x2, 20 },  { 0x3, 20 },  { 0x0, 20 },  { 0x4, 20 },
-    { 0x5, 20 },  { 0x3, 19 },  { 0x15, 11 },  { 0x42, 9 },
-    { 0x14, 11 },  { 0x3, 14 },  { 0x2, 14 },  { 0x1, 15 },
-    { 0x1, 16 },  { 0x1, 12 },  { 0x2B, 10 },  { 0x18, 11 },
-    { 0xC, 11 },  { 0x41, 9 },  { 0x78, 8 },  { 0x6C, 8 },
-    { 0x55, 7 },  { 0xF, 4 },  { 0xE, 4 },  { 0x34, 6 },
-    { 0x51, 7 },  { 0x72, 8 },  { 0x6E, 8 },  { 0x40, 9 },
-    { 0x3F, 9 },  { 0x3E, 9 },  { 0x3D, 9 },  { 0x3C, 9 },
-    { 0x3B, 9 },  { 0x3A, 9 },  { 0x39, 9 },  { 0x38, 9 },
-    { 0x37, 9 },  { 0x43, 9 },  { 0x46, 9 },  { 0x47, 9 },
-    { 0x45, 9 },  { 0x44, 9 },  { 0x49, 9 },  { 0x48, 9 },
-    { 0x4A, 8 },  { 0x79, 8 },  { 0x76, 8 },  { 0x77, 8 },
-    { 0x71, 8 },  { 0x75, 8 },  { 0x74, 8 },  { 0x73, 8 },
-    { 0x6A, 8 },  { 0x55, 8 },  { 0x70, 8 },  { 0x6F, 8 },
-    { 0x52, 8 },  { 0x6D, 8 },  { 0x4C, 8 },  { 0x6B, 8 },
-    { 0x40, 7 },  { 0x69, 8 },  { 0x68, 8 },  { 0x67, 8 },
-    { 0x66, 8 },  { 0x65, 8 },  { 0x64, 8 },  { 0x63, 8 },
-    { 0x62, 8 },  { 0x61, 8 },  { 0x60, 8 },  { 0x5F, 8 },
-    { 0x5E, 8 },  { 0x5D, 8 },  { 0x5C, 8 },  { 0x5B, 8 },
-    { 0x5A, 8 },  { 0x59, 8 },  { 0x58, 8 },  { 0x57, 8 },
-    { 0x56, 8 },  { 0x3D, 7 },  { 0x54, 8 },  { 0x53, 8 },
-    { 0x3F, 7 },  { 0x51, 8 },  { 0x50, 8 },  { 0x4F, 8 },
-    { 0x4E, 8 },  { 0x4D, 8 },  { 0x41, 7 },  { 0x4B, 8 },
-    { 0x53, 7 },  { 0x3E, 7 },  { 0x48, 8 },  { 0x4F, 7 },
-    { 0x52, 7 },  { 0x45, 8 },  { 0x50, 7 },  { 0x43, 8 },
-    { 0x42, 8 },  { 0x41, 8 },  { 0x42, 7 },  { 0x43, 7 },
-    { 0x3E, 8 },  { 0x44, 7 },  { 0x3C, 8 },  { 0x45, 7 },
-    { 0x46, 7 },  { 0x47, 7 },  { 0x48, 7 },  { 0x49, 7 },
-    { 0x4A, 7 },  { 0x4B, 7 },  { 0x4C, 7 },  { 0x4D, 7 },
-    { 0x4E, 7 },  { 0x58, 7 },  { 0x59, 7 },  { 0x5A, 7 },
-    { 0x5B, 7 },  { 0x5C, 7 },  { 0x5D, 7 },  { 0x44, 8 },
-    { 0x49, 8 },  { 0x29, 8 },  { 0x3F, 8 },  { 0x3D, 8 },
-    { 0x3B, 8 },  { 0x2C, 8 },  { 0x28, 8 },  { 0x25, 8 },
-    { 0x26, 8 },  { 0x5E, 7 },  { 0x57, 7 },  { 0x54, 7 },
-    { 0x5F, 7 },  { 0x62, 7 },  { 0x63, 7 },  { 0x64, 7 },
-    { 0x61, 7 },  { 0x65, 7 },  { 0x67, 7 },  { 0x66, 7 },
-    { 0x35, 6 },  { 0x36, 6 },  { 0x60, 7 },  { 0x39, 8 },
-    { 0x3A, 8 },  { 0x38, 8 },  { 0x37, 8 },  { 0x36, 8 },
-    { 0x35, 8 },  { 0x34, 8 },  { 0x33, 8 },  { 0x32, 8 },
-    { 0x31, 8 },  { 0x30, 8 },  { 0x2D, 8 },  { 0x2B, 8 },
-    { 0x2A, 8 },  { 0x27, 8 },  { 0x40, 8 },  { 0x46, 8 },
-    { 0x47, 8 },  { 0x26, 9 },  { 0x25, 9 },  { 0x24, 9 },
-    { 0x23, 9 },  { 0x22, 9 },  { 0x2E, 8 },  { 0x2F, 8 },
-    { 0x1F, 9 },  { 0x36, 9 },  { 0x1D, 9 },  { 0x21, 9 },
-    { 0x1B, 9 },  { 0x1C, 9 },  { 0x19, 9 },  { 0x1A, 9 },
-    { 0x18, 9 },  { 0x17, 9 },  { 0x16, 9 },  { 0x1E, 9 },
-    { 0x20, 9 },  { 0x27, 9 },  { 0x28, 9 },  { 0x29, 9 },
-    { 0x2A, 9 },  { 0x2B, 9 },  { 0x2C, 9 },  { 0x2D, 9 },
-    { 0x2E, 9 },  { 0x2F, 9 },  { 0x30, 9 },  { 0x35, 9 },
-    { 0x31, 9 },  { 0x32, 9 },  { 0x33, 9 },  { 0x34, 9 },
-    { 0x19, 10 },  { 0x2A, 10 },  { 0x17, 10 },  { 0x16, 10 },
-    { 0x15, 10 },  { 0x28, 10 },  { 0x26, 10 },  { 0x25, 10 },
-    { 0x22, 10 },  { 0x21, 10 },  { 0x18, 10 },  { 0x14, 10 },
-    { 0x29, 10 },  { 0x12, 10 },  { 0xD, 10 },  { 0xE, 10 },
-    { 0xF, 10 },  { 0x10, 10 },  { 0x11, 10 },  { 0x1A, 10 },
-    { 0x1B, 10 },  { 0x1C, 10 },  { 0x1D, 10 },  { 0x1E, 10 },
-    { 0x1F, 10 },  { 0x20, 10 },  { 0x13, 10 },  { 0x23, 10 },
-    { 0x24, 10 },  { 0x9, 11 },  { 0x8, 11 },  { 0x7, 11 },
-    { 0x27, 10 },  { 0x5, 11 },  { 0xB, 11 },  { 0x6, 11 },
-    { 0x4, 11 },  { 0x3, 11 },  { 0x2, 11 },  { 0x1, 11 },
-    { 0xA, 11 },  { 0x16, 11 },  { 0x19, 11 },  { 0x17, 11 },
-    { 0xD, 11 },  { 0xE, 11 },  { 0xF, 11 },  { 0x10, 11 },
-    { 0x11, 11 },  { 0x12, 11 },  { 0x13, 11 },  { 0x1, 14 }
-};
-
-/* values in this table range from -256..255; adjust retrieved value by -256 */
-static const uint16_t svq1_inter_mean_vlc[512][2] = {
- /* { code, length } */
-    { 0x5A, 22 },  { 0xD4, 22 },  { 0xD5, 22 },  { 0xD6, 22 },
-    { 0xD7, 22 },  { 0xD8, 22 },  { 0xD9, 22 },  { 0xDA, 22 },
-    { 0xDB, 22 },  { 0xDC, 22 },  { 0xDD, 22 },  { 0xDE, 22 },
-    { 0xDF, 22 },  { 0xE0, 22 },  { 0xE1, 22 },  { 0xE2, 22 },
-    { 0xE3, 22 },  { 0xE4, 22 },  { 0xE5, 22 },  { 0xE6, 22 },
-    { 0xE8, 22 },  { 0xCB, 22 },  { 0xE9, 22 },  { 0xEA, 22 },
-    { 0xE7, 22 },  { 0xEC, 22 },  { 0xED, 22 },  { 0xEE, 22 },
-    { 0xEF, 22 },  { 0xF0, 22 },  { 0xF1, 22 },  { 0xF2, 22 },
-    { 0xF3, 22 },  { 0xF4, 22 },  { 0xF5, 22 },  { 0xF6, 22 },
-    { 0xF7, 22 },  { 0xF8, 22 },  { 0x102, 22 },  { 0xEB, 22 },
-    { 0xF9, 22 },  { 0xFC, 22 },  { 0xFD, 22 },  { 0xFE, 22 },
-    { 0x100, 22 },  { 0x5C, 22 },  { 0x60, 22 },  { 0x101, 22 },
-    { 0x71, 22 },  { 0x104, 22 },  { 0x105, 22 },  { 0xFB, 22 },
-    { 0xFF, 22 },  { 0x86, 21 },  { 0xFA, 22 },  { 0x7C, 22 },
-    { 0x75, 22 },  { 0x103, 22 },  { 0x78, 22 },  { 0xD3, 22 },
-    { 0x7B, 22 },  { 0x82, 22 },  { 0xD2, 22 },  { 0xD1, 22 },
-    { 0xD0, 22 },  { 0xCF, 22 },  { 0xCE, 22 },  { 0xCD, 22 },
-    { 0xCC, 22 },  { 0xC3, 22 },  { 0xCA, 22 },  { 0xC9, 22 },
-    { 0xC8, 22 },  { 0xC7, 22 },  { 0xC6, 22 },  { 0xC5, 22 },
-    { 0x8B, 22 },  { 0xC4, 22 },  { 0xC2, 22 },  { 0xC1, 22 },
-    { 0xC0, 22 },  { 0xBF, 22 },  { 0xBE, 22 },  { 0xBD, 22 },
-    { 0xBC, 22 },  { 0xBB, 22 },  { 0xBA, 22 },  { 0xB9, 22 },
-    { 0x61, 22 },  { 0x84, 22 },  { 0x85, 22 },  { 0x86, 22 },
-    { 0x87, 22 },  { 0x88, 22 },  { 0x89, 22 },  { 0x8A, 22 },
-    { 0x8C, 22 },  { 0x8D, 22 },  { 0x8E, 22 },  { 0x8F, 22 },
-    { 0x90, 22 },  { 0x91, 22 },  { 0x92, 22 },  { 0x93, 22 },
-    { 0x94, 22 },  { 0x95, 22 },  { 0x96, 22 },  { 0x97, 22 },
-    { 0x98, 22 },  { 0x99, 22 },  { 0x9A, 22 },  { 0x9B, 22 },
-    { 0x9C, 22 },  { 0x9D, 22 },  { 0x9E, 22 },  { 0x9F, 22 },
-    { 0xA0, 22 },  { 0xA1, 22 },  { 0xA2, 22 },  { 0xA3, 22 },
-    { 0xA4, 22 },  { 0xA5, 22 },  { 0xA6, 22 },  { 0xA7, 22 },
-    { 0xA8, 22 },  { 0xA9, 22 },  { 0xAA, 22 },  { 0xAB, 22 },
-    { 0x7F, 22 },  { 0x8F, 21 },  { 0xAC, 22 },  { 0xAD, 22 },
-    { 0xAE, 22 },  { 0xAF, 22 },  { 0xB0, 22 },  { 0xB1, 22 },
-    { 0x53, 20 },  { 0x90, 21 },  { 0xB2, 22 },  { 0x91, 21 },
-    { 0xB3, 22 },  { 0xB4, 22 },  { 0x54, 20 },  { 0xB5, 22 },
-    { 0xB6, 22 },  { 0x8C, 21 },  { 0x34, 19 },  { 0x3D, 18 },
-    { 0x55, 20 },  { 0xB7, 22 },  { 0xB8, 22 },  { 0x8B, 21 },
-    { 0x56, 20 },  { 0x3D, 19 },  { 0x57, 20 },  { 0x58, 20 },
-    { 0x40, 19 },  { 0x43, 19 },  { 0x47, 19 },  { 0x2A, 18 },
-    { 0x2E, 19 },  { 0x2C, 18 },  { 0x46, 19 },  { 0x59, 20 },
-    { 0x49, 19 },  { 0x2D, 19 },  { 0x38, 18 },  { 0x36, 18 },
-    { 0x39, 18 },  { 0x45, 19 },  { 0x28, 18 },  { 0x30, 18 },
-    { 0x35, 18 },  { 0x20, 17 },  { 0x44, 19 },  { 0x32, 18 },
-    { 0x31, 18 },  { 0x1F, 17 },  { 0x2F, 18 },  { 0x2E, 18 },
-    { 0x2D, 18 },  { 0x21, 17 },  { 0x22, 17 },  { 0x23, 17 },
-    { 0x24, 17 },  { 0x27, 16 },  { 0x23, 16 },  { 0x20, 16 },
-    { 0x1D, 16 },  { 0x25, 16 },  { 0x1E, 16 },  { 0x24, 16 },
-    { 0x2A, 16 },  { 0x26, 16 },  { 0x21, 15 },  { 0x29, 16 },
-    { 0x22, 15 },  { 0x23, 15 },  { 0x24, 15 },  { 0x1B, 15 },
-    { 0x1A, 15 },  { 0x1D, 15 },  { 0x1F, 15 },  { 0x27, 15 },
-    { 0x17, 14 },  { 0x18, 14 },  { 0x19, 14 },  { 0x1B, 14 },
-    { 0x1C, 14 },  { 0x1E, 14 },  { 0x25, 14 },  { 0x20, 14 },
-    { 0x21, 14 },  { 0x13, 13 },  { 0x14, 13 },  { 0x15, 13 },
-    { 0x16, 13 },  { 0x17, 13 },  { 0x18, 13 },  { 0x19, 13 },
-    { 0x1A, 13 },  { 0x18, 12 },  { 0x17, 12 },  { 0x15, 12 },
-    { 0x14, 12 },  { 0x13, 12 },  { 0x12, 12 },  { 0xF, 11 },
-    { 0x10, 11 },  { 0x12, 11 },  { 0x13, 11 },  { 0x1B, 11 },
-    { 0x1A, 11 },  { 0xE, 10 },  { 0x13, 10 },  { 0xF, 10 },
-    { 0x10, 10 },  { 0x11, 10 },  { 0x12, 10 },  { 0xD, 9 },
-    { 0x14, 9 },  { 0x15, 9 },  { 0xC, 9 },  { 0x13, 9 },
-    { 0xF, 8 },  { 0xE, 8 },  { 0x10, 8 },  { 0x11, 8 },
-    { 0xC, 7 },  { 0x9, 7 },  { 0xA, 7 },  { 0x8, 6 },
-    { 0x9, 6 },  { 0x9, 5 },  { 0x8, 5 },  { 0x5, 4 },
-    { 0x1, 1 },  { 0x3, 3 },  { 0x7, 5 },  { 0x6, 5 },
-    { 0xB, 6 },  { 0xA, 6 },  { 0xE, 7 },  { 0xF, 7 },
-    { 0xB, 7 },  { 0xD, 7 },  { 0xB, 8 },  { 0xD, 8 },
-    { 0xC, 8 },  { 0xF, 9 },  { 0x10, 9 },  { 0x11, 9 },
-    { 0xE, 9 },  { 0x12, 9 },  { 0x17, 10 },  { 0x14, 10 },
-    { 0x16, 10 },  { 0x15, 10 },  { 0x19, 11 },  { 0x18, 11 },
-    { 0x17, 11 },  { 0x16, 11 },  { 0x15, 11 },  { 0x14, 11 },
-    { 0x11, 11 },  { 0x19, 12 },  { 0x1A, 12 },  { 0x16, 12 },
-    { 0x1D, 12 },  { 0x1B, 12 },  { 0x1C, 12 },  { 0x20, 13 },
-    { 0x1C, 13 },  { 0x23, 13 },  { 0x22, 13 },  { 0x21, 13 },
-    { 0x1F, 13 },  { 0x1E, 13 },  { 0x1B, 13 },  { 0x1D, 13 },
-    { 0x24, 14 },  { 0x16, 14 },  { 0x1A, 14 },  { 0x22, 14 },
-    { 0x1D, 14 },  { 0x1F, 14 },  { 0x15, 14 },  { 0x23, 14 },
-    { 0x18, 15 },  { 0x20, 15 },  { 0x29, 15 },  { 0x28, 15 },
-    { 0x26, 15 },  { 0x25, 15 },  { 0x19, 15 },  { 0x1C, 15 },
-    { 0x1E, 15 },  { 0x17, 15 },  { 0x2C, 16 },  { 0x2B, 16 },
-    { 0x1C, 16 },  { 0x21, 16 },  { 0x2D, 16 },  { 0x28, 16 },
-    { 0x1F, 16 },  { 0x1B, 16 },  { 0x1A, 16 },  { 0x22, 16 },
-    { 0x2D, 17 },  { 0x32, 17 },  { 0x2C, 17 },  { 0x27, 17 },
-    { 0x31, 17 },  { 0x33, 17 },  { 0x2F, 17 },  { 0x2B, 17 },
-    { 0x37, 18 },  { 0x2A, 17 },  { 0x2E, 17 },  { 0x30, 17 },
-    { 0x29, 17 },  { 0x28, 17 },  { 0x26, 17 },  { 0x25, 17 },
-    { 0x2F, 19 },  { 0x33, 18 },  { 0x34, 18 },  { 0x30, 19 },
-    { 0x3A, 18 },  { 0x3B, 18 },  { 0x31, 19 },  { 0x3C, 18 },
-    { 0x2B, 18 },  { 0x29, 18 },  { 0x48, 19 },  { 0x27, 18 },
-    { 0x42, 19 },  { 0x41, 19 },  { 0x26, 18 },  { 0x52, 20 },
-    { 0x51, 20 },  { 0x3F, 19 },  { 0x3E, 19 },  { 0x39, 19 },
-    { 0x3C, 19 },  { 0x3B, 19 },  { 0x3A, 19 },  { 0x25, 18 },
-    { 0x38, 19 },  { 0x50, 20 },  { 0x37, 19 },  { 0x36, 19 },
-    { 0x87, 21 },  { 0x4F, 20 },  { 0x35, 19 },  { 0x4E, 20 },
-    { 0x33, 19 },  { 0x32, 19 },  { 0x4D, 20 },  { 0x4C, 20 },
-    { 0x83, 22 },  { 0x4B, 20 },  { 0x81, 22 },  { 0x80, 22 },
-    { 0x8E, 21 },  { 0x7E, 22 },  { 0x7D, 22 },  { 0x84, 21 },
-    { 0x8D, 21 },  { 0x7A, 22 },  { 0x79, 22 },  { 0x4A, 20 },
-    { 0x77, 22 },  { 0x76, 22 },  { 0x89, 21 },  { 0x74, 22 },
-    { 0x73, 22 },  { 0x72, 22 },  { 0x49, 20 },  { 0x70, 22 },
-    { 0x6F, 22 },  { 0x6E, 22 },  { 0x6D, 22 },  { 0x6C, 22 },
-    { 0x6B, 22 },  { 0x6A, 22 },  { 0x69, 22 },  { 0x68, 22 },
-    { 0x67, 22 },  { 0x66, 22 },  { 0x65, 22 },  { 0x64, 22 },
-    { 0x63, 22 },  { 0x62, 22 },  { 0x8A, 21 },  { 0x88, 21 },
-    { 0x5F, 22 },  { 0x5E, 22 },  { 0x5D, 22 },  { 0x85, 21 },
-    { 0x5B, 22 },  { 0x83, 21 },  { 0x59, 22 },  { 0x58, 22 },
-    { 0x57, 22 },  { 0x56, 22 },  { 0x55, 22 },  { 0x54, 22 },
-    { 0x53, 22 },  { 0x52, 22 },  { 0x51, 22 },  { 0x50, 22 },
-    { 0x4F, 22 },  { 0x4E, 22 },  { 0x4D, 22 },  { 0x4C, 22 },
-    { 0x4B, 22 },  { 0x4A, 22 },  { 0x49, 22 },  { 0x48, 22 },
-    { 0x47, 22 },  { 0x46, 22 },  { 0x45, 22 },  { 0x44, 22 },
-    { 0x43, 22 },  { 0x42, 22 },  { 0x41, 22 },  { 0x40, 22 },
-    { 0x3F, 22 },  { 0x3E, 22 },  { 0x3D, 22 },  { 0x3C, 22 },
-    { 0x3B, 22 },  { 0x3A, 22 },  { 0x39, 22 },  { 0x38, 22 },
-    { 0x37, 22 },  { 0x36, 22 },  { 0x35, 22 },  { 0x34, 22 },
-    { 0x33, 22 },  { 0x32, 22 },  { 0x31, 22 },  { 0x30, 22 },
-    { 0x2F, 22 },  { 0x2E, 22 },  { 0x2D, 22 },  { 0x2C, 22 },
-    { 0x2B, 22 },  { 0x2A, 22 },  { 0x29, 22 },  { 0x28, 22 },
-    { 0x27, 22 },  { 0x26, 22 },  { 0x25, 22 },  { 0x24, 22 },
-    { 0x23, 22 },  { 0x22, 22 },  { 0x21, 22 },  { 0x20, 22 },
-    { 0x1F, 22 },  { 0x1E, 22 },  { 0x1D, 22 },  { 0x1C, 22 },
-    { 0x1B, 22 },  { 0x1A, 22 },  { 0x19, 22 },  { 0x18, 22 },
-    { 0x17, 22 },  { 0x16, 22 },  { 0x15, 22 },  { 0x14, 22 },
-    { 0x13, 22 },  { 0x12, 22 },  { 0x11, 22 },  { 0x10, 22 },
-    { 0xF, 22 },  { 0xE, 22 },  { 0xD, 22 },  { 0xC, 22 },
-    { 0xB, 22 },  { 0xA, 22 },  { 0x9, 22 },  { 0x8, 22 },
-    { 0x7, 22 },  { 0x6, 22 },  { 0x5, 22 },  { 0x4, 22 },
-    { 0x3, 22 },  { 0x2, 22 },  { 0x1, 22 },  { 0x0, 22 }
-};
-
-#endif
--- a/src/ffmpeg/libavcodec/svq3.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1014 +0,0 @@
-/*
- * Copyright (c) 2003 The FFmpeg Project.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- *
- * How to use this decoder:
- * SVQ3 data is transported within Apple Quicktime files. Quicktime files
- * have stsd atoms to describe media trak properties. A stsd atom for a
- * video trak contains 1 or more ImageDescription atoms. These atoms begin
- * with the 4-byte length of the atom followed by the codec fourcc. Some
- * decoders need information in this atom to operate correctly. Such
- * is the case with SVQ3. In order to get the best use out of this decoder,
- * the calling app must make the SVQ3 ImageDescription atom available
- * via the AVCodecContext's extradata[_size] field:
- *
- * AVCodecContext.extradata = pointer to ImageDescription, first characters
- * are expected to be 'S', 'V', 'Q', and '3', NOT the 4-byte atom length
- * AVCodecContext.extradata_size = size of ImageDescription atom memory
- * buffer (which will be the same as the ImageDescription atom size field
- * from the QT file, minus 4 bytes since the length is missing)
- *
- * You will know you have these parameters passed correctly when the decoder
- * correctly decodes this file:
- *  ftp://ftp.mplayerhq.hu/MPlayer/samples/V-codecs/SVQ3/Vertical400kbit.sorenson3.mov
- *
- */
-
-/**
- * @file svq3.c
- * svq3 decoder.
- */
-
-#define FULLPEL_MODE  1
-#define HALFPEL_MODE  2
-#define THIRDPEL_MODE 3
-#define PREDICT_MODE  4
-
-/* dual scan (from some older h264 draft)
- o-->o-->o   o
-         |  /|
- o   o   o / o
- | / |   |/  |
- o   o   o   o
-   /
- o-->o-->o-->o
-*/
-static const uint8_t svq3_scan[16]={
- 0+0*4, 1+0*4, 2+0*4, 2+1*4,
- 2+2*4, 3+0*4, 3+1*4, 3+2*4,
- 0+1*4, 0+2*4, 1+1*4, 1+2*4,
- 0+3*4, 1+3*4, 2+3*4, 3+3*4,
-};
-
-static const uint8_t svq3_pred_0[25][2] = {
-  { 0, 0 },
-  { 1, 0 }, { 0, 1 },
-  { 0, 2 }, { 1, 1 }, { 2, 0 },
-  { 3, 0 }, { 2, 1 }, { 1, 2 }, { 0, 3 },
-  { 0, 4 }, { 1, 3 }, { 2, 2 }, { 3, 1 }, { 4, 0 },
-  { 4, 1 }, { 3, 2 }, { 2, 3 }, { 1, 4 },
-  { 2, 4 }, { 3, 3 }, { 4, 2 },
-  { 4, 3 }, { 3, 4 },
-  { 4, 4 }
-};
-
-static const int8_t svq3_pred_1[6][6][5] = {
-  { { 2,-1,-1,-1,-1 }, { 2, 1,-1,-1,-1 }, { 1, 2,-1,-1,-1 },
-    { 2, 1,-1,-1,-1 }, { 1, 2,-1,-1,-1 }, { 1, 2,-1,-1,-1 } },
-  { { 0, 2,-1,-1,-1 }, { 0, 2, 1, 4, 3 }, { 0, 1, 2, 4, 3 },
-    { 0, 2, 1, 4, 3 }, { 2, 0, 1, 3, 4 }, { 0, 4, 2, 1, 3 } },
-  { { 2, 0,-1,-1,-1 }, { 2, 1, 0, 4, 3 }, { 1, 2, 4, 0, 3 },
-    { 2, 1, 0, 4, 3 }, { 2, 1, 4, 3, 0 }, { 1, 2, 4, 0, 3 } },
-  { { 2, 0,-1,-1,-1 }, { 2, 0, 1, 4, 3 }, { 1, 2, 0, 4, 3 },
-    { 2, 1, 0, 4, 3 }, { 2, 1, 3, 4, 0 }, { 2, 4, 1, 0, 3 } },
-  { { 0, 2,-1,-1,-1 }, { 0, 2, 1, 3, 4 }, { 1, 2, 3, 0, 4 },
-    { 2, 0, 1, 3, 4 }, { 2, 1, 3, 0, 4 }, { 2, 0, 4, 3, 1 } },
-  { { 0, 2,-1,-1,-1 }, { 0, 2, 4, 1, 3 }, { 1, 4, 2, 0, 3 },
-    { 4, 2, 0, 1, 3 }, { 2, 0, 1, 4, 3 }, { 4, 2, 1, 0, 3 } },
-};
-
-static const struct { uint8_t run; uint8_t level; } svq3_dct_tables[2][16] = {
-  { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 2, 1 }, { 0, 2 }, { 3, 1 }, { 4, 1 }, { 5, 1 },
-    { 0, 3 }, { 1, 2 }, { 2, 2 }, { 6, 1 }, { 7, 1 }, { 8, 1 }, { 9, 1 }, { 0, 4 } },
-  { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 0, 2 }, { 2, 1 }, { 0, 3 }, { 0, 4 }, { 0, 5 },
-    { 3, 1 }, { 4, 1 }, { 1, 2 }, { 1, 3 }, { 0, 6 }, { 0, 7 }, { 0, 8 }, { 0, 9 } }
-};
-
-static const uint32_t svq3_dequant_coeff[32] = {
-   3881,  4351,  4890,  5481,  6154,  6914,  7761,  8718,
-   9781, 10987, 12339, 13828, 15523, 17435, 19561, 21873,
-  24552, 27656, 30847, 34870, 38807, 43747, 49103, 54683,
-  61694, 68745, 77615, 89113,100253,109366,126635,141533
-};
-
-
-static void svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp){
-    const int qmul= svq3_dequant_coeff[qp];
-#define stride 16
-    int i;
-    int temp[16];
-    static const int x_offset[4]={0, 1*stride, 4* stride,  5*stride};
-    static const int y_offset[4]={0, 2*stride, 8* stride, 10*stride};
-
-    for(i=0; i<4; i++){
-        const int offset= y_offset[i];
-        const int z0= 13*(block[offset+stride*0] +    block[offset+stride*4]);
-        const int z1= 13*(block[offset+stride*0] -    block[offset+stride*4]);
-        const int z2=  7* block[offset+stride*1] - 17*block[offset+stride*5];
-        const int z3= 17* block[offset+stride*1] +  7*block[offset+stride*5];
-
-        temp[4*i+0]= z0+z3;
-        temp[4*i+1]= z1+z2;
-        temp[4*i+2]= z1-z2;
-        temp[4*i+3]= z0-z3;
-    }
-
-    for(i=0; i<4; i++){
-        const int offset= x_offset[i];
-        const int z0= 13*(temp[4*0+i] +    temp[4*2+i]);
-        const int z1= 13*(temp[4*0+i] -    temp[4*2+i]);
-        const int z2=  7* temp[4*1+i] - 17*temp[4*3+i];
-        const int z3= 17* temp[4*1+i] +  7*temp[4*3+i];
-
-        block[stride*0 +offset]= ((z0 + z3)*qmul + 0x80000)>>20;
-        block[stride*2 +offset]= ((z1 + z2)*qmul + 0x80000)>>20;
-        block[stride*8 +offset]= ((z1 - z2)*qmul + 0x80000)>>20;
-        block[stride*10+offset]= ((z0 - z3)*qmul + 0x80000)>>20;
-    }
-}
-#undef stride
-
-static void svq3_add_idct_c (uint8_t *dst, DCTELEM *block, int stride, int qp, int dc){
-    const int qmul= svq3_dequant_coeff[qp];
-    int i;
-    uint8_t *cm = cropTbl + MAX_NEG_CROP;
-
-    if (dc) {
-        dc = 13*13*((dc == 1) ? 1538*block[0] : ((qmul*(block[0] >> 3)) / 2));
-        block[0] = 0;
-    }
-
-    for (i=0; i < 4; i++) {
-        const int z0= 13*(block[0 + 4*i] +    block[2 + 4*i]);
-        const int z1= 13*(block[0 + 4*i] -    block[2 + 4*i]);
-        const int z2=  7* block[1 + 4*i] - 17*block[3 + 4*i];
-        const int z3= 17* block[1 + 4*i] +  7*block[3 + 4*i];
-
-        block[0 + 4*i]= z0 + z3;
-        block[1 + 4*i]= z1 + z2;
-        block[2 + 4*i]= z1 - z2;
-        block[3 + 4*i]= z0 - z3;
-    }
-
-    for (i=0; i < 4; i++) {
-        const int z0= 13*(block[i + 4*0] +    block[i + 4*2]);
-        const int z1= 13*(block[i + 4*0] -    block[i + 4*2]);
-        const int z2=  7* block[i + 4*1] - 17*block[i + 4*3];
-        const int z3= 17* block[i + 4*1] +  7*block[i + 4*3];
-        const int rr= (dc + 0x80000);
-
-        dst[i + stride*0]= cm[ dst[i + stride*0] + (((z0 + z3)*qmul + rr) >> 20) ];
-        dst[i + stride*1]= cm[ dst[i + stride*1] + (((z1 + z2)*qmul + rr) >> 20) ];
-        dst[i + stride*2]= cm[ dst[i + stride*2] + (((z1 - z2)*qmul + rr) >> 20) ];
-        dst[i + stride*3]= cm[ dst[i + stride*3] + (((z0 - z3)*qmul + rr) >> 20) ];
-    }
-}
-
-static void pred4x4_down_left_svq3_c(uint8_t *src, uint8_t *topright, int stride){
-    LOAD_TOP_EDGE
-    LOAD_LEFT_EDGE
-    const __attribute__((unused)) int unu0= t0;
-    const __attribute__((unused)) int unu1= l0;
-
-    src[0+0*stride]=(l1 + t1)>>1;
-    src[1+0*stride]=
-    src[0+1*stride]=(l2 + t2)>>1;
-    src[2+0*stride]=
-    src[1+1*stride]=
-    src[0+2*stride]=
-    src[3+0*stride]=
-    src[2+1*stride]=
-    src[1+2*stride]=
-    src[0+3*stride]=
-    src[3+1*stride]=
-    src[2+2*stride]=
-    src[1+3*stride]=
-    src[3+2*stride]=
-    src[2+3*stride]=
-    src[3+3*stride]=(l3 + t3)>>1;
-}
-
-static void pred16x16_plane_svq3_c(uint8_t *src, int stride){
-    pred16x16_plane_compat_c(src, stride, 1);
-}
-
-static inline int svq3_decode_block (GetBitContext *gb, DCTELEM *block,
-                                     int index, const int type) {
-
-  static const uint8_t *const scan_patterns[4] =
-  { luma_dc_zigzag_scan, zigzag_scan, svq3_scan, chroma_dc_scan };
-
-  int run, level, sign, vlc, limit;
-  const int intra = (3 * type) >> 2;
-  const uint8_t *const scan = scan_patterns[type];
-
-  for (limit=(16 >> intra); index < 16; index=limit, limit+=8) {
-    for (; (vlc = svq3_get_ue_golomb (gb)) != 0; index++) {
-
-      if (vlc == INVALID_VLC)
-        return -1;
-
-      sign = (vlc & 0x1) - 1;
-      vlc  = (vlc + 1) >> 1;
-
-      if (type == 3) {
-        if (vlc < 3) {
-          run   = 0;
-          level = vlc;
-        } else if (vlc < 4) {
-          run   = 1;
-          level = 1;
-        } else {
-          run   = (vlc & 0x3);
-          level = ((vlc + 9) >> 2) - run;
-        }
-      } else {
-        if (vlc < 16) {
-          run   = svq3_dct_tables[intra][vlc].run;
-          level = svq3_dct_tables[intra][vlc].level;
-        } else if (intra) {
-          run   = (vlc & 0x7);
-          level = (vlc >> 3) + ((run == 0) ? 8 : ((run < 2) ? 2 : ((run < 5) ? 0 : -1)));
-        } else {
-          run   = (vlc & 0xF);
-          level = (vlc >> 4) + ((run == 0) ? 4 : ((run < 3) ? 2 : ((run < 10) ? 1 : 0)));
-        }
-      }
-
-      if ((index += run) >= limit)
-        return -1;
-
-      block[scan[index]] = (level ^ sign) - sign;
-    }
-
-    if (type != 2) {
-      break;
-    }
-  }
-
-  return 0;
-}
-
-static inline void svq3_mc_dir_part (MpegEncContext *s,
-                                     int x, int y, int width, int height,
-                                     int mx, int my, int dxy,
-                                     int thirdpel, int dir, int avg) {
-
-  const Picture *pic = (dir == 0) ? &s->last_picture : &s->next_picture;
-  uint8_t *src, *dest;
-  int i, emu = 0;
-  int blocksize= 2 - (width>>3); //16->0, 8->1, 4->2
-
-  mx += x;
-  my += y;
-
-  if (mx < 0 || mx >= (s->h_edge_pos - width  - 1) ||
-      my < 0 || my >= (s->v_edge_pos - height - 1)) {
-
-    if ((s->flags & CODEC_FLAG_EMU_EDGE)) {
-      emu = 1;
-    }
-
-    mx = clip (mx, -16, (s->h_edge_pos - width  + 15));
-    my = clip (my, -16, (s->v_edge_pos - height + 15));
-  }
-
-  /* form component predictions */
-  dest = s->current_picture.data[0] + x + y*s->linesize;
-  src  = pic->data[0] + mx + my*s->linesize;
-
-  if (emu) {
-    ff_emulated_edge_mc (s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1),
-                         mx, my, s->h_edge_pos, s->v_edge_pos);
-    src = s->edge_emu_buffer;
-  }
-  if(thirdpel)
-    (avg ? s->dsp.avg_tpel_pixels_tab : s->dsp.put_tpel_pixels_tab)[dxy](dest, src, s->linesize, width, height);
-  else
-    (avg ? s->dsp.avg_pixels_tab : s->dsp.put_pixels_tab)[blocksize][dxy](dest, src, s->linesize, height);
-
-  if (!(s->flags & CODEC_FLAG_GRAY)) {
-    mx     = (mx + (mx < (int) x)) >> 1;
-    my     = (my + (my < (int) y)) >> 1;
-    width  = (width  >> 1);
-    height = (height >> 1);
-    blocksize++;
-
-    for (i=1; i < 3; i++) {
-      dest = s->current_picture.data[i] + (x >> 1) + (y >> 1)*s->uvlinesize;
-      src  = pic->data[i] + mx + my*s->uvlinesize;
-
-      if (emu) {
-        ff_emulated_edge_mc (s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1),
-                             mx, my, (s->h_edge_pos >> 1), (s->v_edge_pos >> 1));
-        src = s->edge_emu_buffer;
-      }
-      if(thirdpel)
-        (avg ? s->dsp.avg_tpel_pixels_tab : s->dsp.put_tpel_pixels_tab)[dxy](dest, src, s->uvlinesize, width, height);
-      else
-        (avg ? s->dsp.avg_pixels_tab : s->dsp.put_pixels_tab)[blocksize][dxy](dest, src, s->uvlinesize, height);
-    }
-  }
-}
-
-static inline int svq3_mc_dir (H264Context *h, int size, int mode, int dir, int avg) {
-
-  int i, j, k, mx, my, dx, dy, x, y;
-  MpegEncContext *const s = (MpegEncContext *) h;
-  const int part_width  = ((size & 5) == 4) ? 4 : 16 >> (size & 1);
-  const int part_height = 16 >> ((unsigned) (size + 1) / 3);
-  const int extra_width = (mode == PREDICT_MODE) ? -16*6 : 0;
-  const int h_edge_pos  = 6*(s->h_edge_pos - part_width ) - extra_width;
-  const int v_edge_pos  = 6*(s->v_edge_pos - part_height) - extra_width;
-
-  for (i=0; i < 16; i+=part_height) {
-    for (j=0; j < 16; j+=part_width) {
-      const int b_xy = (4*s->mb_x+(j>>2)) + (4*s->mb_y+(i>>2))*h->b_stride;
-      int dxy;
-      x = 16*s->mb_x + j;
-      y = 16*s->mb_y + i;
-      k = ((j>>2)&1) + ((i>>1)&2) + ((j>>1)&4) + (i&8);
-
-      if (mode != PREDICT_MODE) {
-        pred_motion (h, k, (part_width >> 2), dir, 1, &mx, &my);
-      } else {
-        mx = s->next_picture.motion_val[0][b_xy][0]<<1;
-        my = s->next_picture.motion_val[0][b_xy][1]<<1;
-
-        if (dir == 0) {
-          mx = ((mx * h->frame_num_offset) / h->prev_frame_num_offset + 1)>>1;
-          my = ((my * h->frame_num_offset) / h->prev_frame_num_offset + 1)>>1;
-        } else {
-          mx = ((mx * (h->frame_num_offset - h->prev_frame_num_offset)) / h->prev_frame_num_offset + 1)>>1;
-          my = ((my * (h->frame_num_offset - h->prev_frame_num_offset)) / h->prev_frame_num_offset + 1)>>1;
-        }
-      }
-
-      /* clip motion vector prediction to frame border */
-      mx = clip (mx, extra_width - 6*x, h_edge_pos - 6*x);
-      my = clip (my, extra_width - 6*y, v_edge_pos - 6*y);
-
-      /* get (optional) motion vector differential */
-      if (mode == PREDICT_MODE) {
-        dx = dy = 0;
-      } else {
-        dy = svq3_get_se_golomb (&s->gb);
-        dx = svq3_get_se_golomb (&s->gb);
-
-        if (dx == INVALID_VLC || dy == INVALID_VLC) {
-          av_log(h->s.avctx, AV_LOG_ERROR, "invalid MV vlc\n");
-          return -1;
-        }
-      }
-
-      /* compute motion vector */
-      if (mode == THIRDPEL_MODE) {
-        int fx, fy;
-        mx = ((mx + 1)>>1) + dx;
-        my = ((my + 1)>>1) + dy;
-        fx= ((unsigned)(mx + 0x3000))/3 - 0x1000;
-        fy= ((unsigned)(my + 0x3000))/3 - 0x1000;
-        dxy= (mx - 3*fx) + 4*(my - 3*fy);
-
-        svq3_mc_dir_part (s, x, y, part_width, part_height, fx, fy, dxy, 1, dir, avg);
-        mx += mx;
-        my += my;
-      } else if (mode == HALFPEL_MODE || mode == PREDICT_MODE) {
-        mx = ((unsigned)(mx + 1 + 0x3000))/3 + dx - 0x1000;
-        my = ((unsigned)(my + 1 + 0x3000))/3 + dy - 0x1000;
-        dxy= (mx&1) + 2*(my&1);
-
-        svq3_mc_dir_part (s, x, y, part_width, part_height, mx>>1, my>>1, dxy, 0, dir, avg);
-        mx *= 3;
-        my *= 3;
-      } else {
-        mx = ((unsigned)(mx + 3 + 0x6000))/6 + dx - 0x1000;
-        my = ((unsigned)(my + 3 + 0x6000))/6 + dy - 0x1000;
-
-        svq3_mc_dir_part (s, x, y, part_width, part_height, mx, my, 0, 0, dir, avg);
-        mx *= 6;
-        my *= 6;
-      }
-
-      /* update mv_cache */
-      if (mode != PREDICT_MODE) {
-        int32_t mv = pack16to32(mx,my);
-
-        if (part_height == 8 && i < 8) {
-          *(int32_t *) h->mv_cache[dir][scan8[k] + 1*8] = mv;
-
-          if (part_width == 8 && j < 8) {
-            *(int32_t *) h->mv_cache[dir][scan8[k] + 1 + 1*8] = mv;
-          }
-        }
-        if (part_width == 8 && j < 8) {
-          *(int32_t *) h->mv_cache[dir][scan8[k] + 1] = mv;
-        }
-        if (part_width == 4 || part_height == 4) {
-          *(int32_t *) h->mv_cache[dir][scan8[k]] = mv;
-        }
-      }
-
-      /* write back motion vectors */
-      fill_rectangle(s->current_picture.motion_val[dir][b_xy], part_width>>2, part_height>>2, h->b_stride, pack16to32(mx,my), 4);
-    }
-  }
-
-  return 0;
-}
-
-static int svq3_decode_mb (H264Context *h, unsigned int mb_type) {
-  int i, j, k, m, dir, mode;
-  int cbp = 0;
-  uint32_t vlc;
-  int8_t *top, *left;
-  MpegEncContext *const s = (MpegEncContext *) h;
-  const int mb_xy = s->mb_x + s->mb_y*s->mb_stride;
-  const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride;
-
-  h->top_samples_available        = (s->mb_y == 0) ? 0x33FF : 0xFFFF;
-  h->left_samples_available        = (s->mb_x == 0) ? 0x5F5F : 0xFFFF;
-  h->topright_samples_available        = 0xFFFF;
-
-  if (mb_type == 0) {           /* SKIP */
-    if (s->pict_type == P_TYPE || s->next_picture.mb_type[mb_xy] == -1) {
-      svq3_mc_dir_part (s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 0, 0);
-
-      if (s->pict_type == B_TYPE) {
-        svq3_mc_dir_part (s, 16*s->mb_x, 16*s->mb_y, 16, 16, 0, 0, 0, 0, 1, 1);
-      }
-
-      mb_type = MB_TYPE_SKIP;
-    } else {
-      mb_type= FFMIN(s->next_picture.mb_type[mb_xy], 6);
-      if(svq3_mc_dir (h, mb_type, PREDICT_MODE, 0, 0) < 0)
-        return -1;
-      if(svq3_mc_dir (h, mb_type, PREDICT_MODE, 1, 1) < 0)
-        return -1;
-
-      mb_type = MB_TYPE_16x16;
-    }
-  } else if (mb_type < 8) {     /* INTER */
-    if (h->thirdpel_flag && h->halfpel_flag == !get_bits (&s->gb, 1)) {
-      mode = THIRDPEL_MODE;
-    } else if (h->halfpel_flag && h->thirdpel_flag == !get_bits (&s->gb, 1)) {
-      mode = HALFPEL_MODE;
-    } else {
-      mode = FULLPEL_MODE;
-    }
-
-    /* fill caches */
-    /* note ref_cache should contain here:
-        ????????
-        ???11111
-        N??11111
-        N??11111
-        N??11111
-        N
-    */
-
-    for (m=0; m < 2; m++) {
-      if (s->mb_x > 0 && h->intra4x4_pred_mode[mb_xy - 1][0] != -1) {
-        for (i=0; i < 4; i++) {
-          *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - 1 + i*h->b_stride];
-        }
-      } else {
-        for (i=0; i < 4; i++) {
-          *(uint32_t *) h->mv_cache[m][scan8[0] - 1 + i*8] = 0;
-        }
-      }
-      if (s->mb_y > 0) {
-        memcpy (h->mv_cache[m][scan8[0] - 1*8], s->current_picture.motion_val[m][b_xy - h->b_stride], 4*2*sizeof(int16_t));
-        memset (&h->ref_cache[m][scan8[0] - 1*8], (h->intra4x4_pred_mode[mb_xy - s->mb_stride][4] == -1) ? PART_NOT_AVAILABLE : 1, 4);
-
-        if (s->mb_x < (s->mb_width - 1)) {
-          *(uint32_t *) h->mv_cache[m][scan8[0] + 4 - 1*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - h->b_stride + 4];
-          h->ref_cache[m][scan8[0] + 4 - 1*8] =
-                  (h->intra4x4_pred_mode[mb_xy - s->mb_stride + 1][0] == -1 ||
-                   h->intra4x4_pred_mode[mb_xy - s->mb_stride][4] == -1) ? PART_NOT_AVAILABLE : 1;
-        }else
-          h->ref_cache[m][scan8[0] + 4 - 1*8] = PART_NOT_AVAILABLE;
-        if (s->mb_x > 0) {
-          *(uint32_t *) h->mv_cache[m][scan8[0] - 1 - 1*8] = *(uint32_t *) s->current_picture.motion_val[m][b_xy - h->b_stride - 1];
-          h->ref_cache[m][scan8[0] - 1 - 1*8] = (h->intra4x4_pred_mode[mb_xy - s->mb_stride - 1][3] == -1) ? PART_NOT_AVAILABLE : 1;
-        }else
-          h->ref_cache[m][scan8[0] - 1 - 1*8] = PART_NOT_AVAILABLE;
-      }else
-        memset (&h->ref_cache[m][scan8[0] - 1*8 - 1], PART_NOT_AVAILABLE, 8);
-
-      if (s->pict_type != B_TYPE)
-        break;
-    }
-
-    /* decode motion vector(s) and form prediction(s) */
-    if (s->pict_type == P_TYPE) {
-      if(svq3_mc_dir (h, (mb_type - 1), mode, 0, 0) < 0)
-        return -1;
-    } else {        /* B_TYPE */
-      if (mb_type != 2) {
-        if(svq3_mc_dir (h, 0, mode, 0, 0) < 0)
-          return -1;
-      } else {
-        for (i=0; i < 4; i++) {
-          memset (s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
-        }
-      }
-      if (mb_type != 1) {
-        if(svq3_mc_dir (h, 0, mode, 1, (mb_type == 3)) < 0)
-          return -1;
-      } else {
-        for (i=0; i < 4; i++) {
-          memset (s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
-        }
-      }
-    }
-
-    mb_type = MB_TYPE_16x16;
-  } else if (mb_type == 8 || mb_type == 33) {   /* INTRA4x4 */
-    memset (h->intra4x4_pred_mode_cache, -1, 8*5*sizeof(int8_t));
-
-    if (mb_type == 8) {
-      if (s->mb_x > 0) {
-        for (i=0; i < 4; i++) {
-          h->intra4x4_pred_mode_cache[scan8[0] - 1 + i*8] = h->intra4x4_pred_mode[mb_xy - 1][i];
-        }
-        if (h->intra4x4_pred_mode_cache[scan8[0] - 1] == -1) {
-          h->left_samples_available = 0x5F5F;
-        }
-      }
-      if (s->mb_y > 0) {
-        h->intra4x4_pred_mode_cache[4+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][4];
-        h->intra4x4_pred_mode_cache[5+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][5];
-        h->intra4x4_pred_mode_cache[6+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][6];
-        h->intra4x4_pred_mode_cache[7+8*0] = h->intra4x4_pred_mode[mb_xy - s->mb_stride][3];
-
-        if (h->intra4x4_pred_mode_cache[4+8*0] == -1) {
-          h->top_samples_available = 0x33FF;
-        }
-      }
-
-      /* decode prediction codes for luma blocks */
-      for (i=0; i < 16; i+=2) {
-        vlc = svq3_get_ue_golomb (&s->gb);
-
-        if (vlc >= 25){
-          av_log(h->s.avctx, AV_LOG_ERROR, "luma prediction:%d\n", vlc);
-          return -1;
-        }
-
-        left    = &h->intra4x4_pred_mode_cache[scan8[i] - 1];
-        top     = &h->intra4x4_pred_mode_cache[scan8[i] - 8];
-
-        left[1] = svq3_pred_1[top[0] + 1][left[0] + 1][svq3_pred_0[vlc][0]];
-        left[2] = svq3_pred_1[top[1] + 1][left[1] + 1][svq3_pred_0[vlc][1]];
-
-        if (left[1] == -1 || left[2] == -1){
-          av_log(h->s.avctx, AV_LOG_ERROR, "weird prediction\n");
-          return -1;
-        }
-      }
-    } else {    /* mb_type == 33, DC_128_PRED block type */
-      for (i=0; i < 4; i++) {
-        memset (&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_PRED, 4);
-      }
-    }
-
-    write_back_intra_pred_mode (h);
-
-    if (mb_type == 8) {
-      check_intra4x4_pred_mode (h);
-
-      h->top_samples_available  = (s->mb_y == 0) ? 0x33FF : 0xFFFF;
-      h->left_samples_available = (s->mb_x == 0) ? 0x5F5F : 0xFFFF;
-    } else {
-      for (i=0; i < 4; i++) {
-        memset (&h->intra4x4_pred_mode_cache[scan8[0] + 8*i], DC_128_PRED, 4);
-      }
-
-      h->top_samples_available  = 0x33FF;
-      h->left_samples_available = 0x5F5F;
-    }
-
-    mb_type = MB_TYPE_INTRA4x4;
-  } else {                      /* INTRA16x16 */
-    dir = i_mb_type_info[mb_type - 8].pred_mode;
-    dir = (dir >> 1) ^ 3*(dir & 1) ^ 1;
-
-    if ((h->intra16x16_pred_mode = check_intra_pred_mode (h, dir)) == -1){
-      av_log(h->s.avctx, AV_LOG_ERROR, "check_intra_pred_mode = -1\n");
-      return -1;
-    }
-
-    cbp = i_mb_type_info[mb_type - 8].cbp;
-    mb_type = MB_TYPE_INTRA16x16;
-  }
-
-  if (!IS_INTER(mb_type) && s->pict_type != I_TYPE) {
-    for (i=0; i < 4; i++) {
-      memset (s->current_picture.motion_val[0][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
-    }
-    if (s->pict_type == B_TYPE) {
-      for (i=0; i < 4; i++) {
-        memset (s->current_picture.motion_val[1][b_xy + i*h->b_stride], 0, 4*2*sizeof(int16_t));
-      }
-    }
-  }
-  if (!IS_INTRA4x4(mb_type)) {
-    memset (h->intra4x4_pred_mode[mb_xy], DC_PRED, 8);
-  }
-  if (!IS_SKIP(mb_type) || s->pict_type == B_TYPE) {
-    memset (h->non_zero_count_cache + 8, 0, 4*9*sizeof(uint8_t));
-    s->dsp.clear_blocks(h->mb);
-  }
-
-  if (!IS_INTRA16x16(mb_type) && (!IS_SKIP(mb_type) || s->pict_type == B_TYPE)) {
-    if ((vlc = svq3_get_ue_golomb (&s->gb)) >= 48){
-      av_log(h->s.avctx, AV_LOG_ERROR, "cbp_vlc=%d\n", vlc);
-      return -1;
-    }
-
-    cbp = IS_INTRA(mb_type) ? golomb_to_intra4x4_cbp[vlc] : golomb_to_inter_cbp[vlc];
-  }
-  if (IS_INTRA16x16(mb_type) || (s->pict_type != I_TYPE && s->adaptive_quant && cbp)) {
-    s->qscale += svq3_get_se_golomb (&s->gb);
-
-    if (s->qscale > 31){
-      av_log(h->s.avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale);
-      return -1;
-    }
-  }
-  if (IS_INTRA16x16(mb_type)) {
-    if (svq3_decode_block (&s->gb, h->mb, 0, 0)){
-      av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding intra luma dc\n");
-      return -1;
-    }
-  }
-
-  if (cbp) {
-    const int index = IS_INTRA16x16(mb_type) ? 1 : 0;
-    const int type = ((s->qscale < 24 && IS_INTRA4x4(mb_type)) ? 2 : 1);
-
-    for (i=0; i < 4; i++) {
-      if ((cbp & (1 << i))) {
-        for (j=0; j < 4; j++) {
-          k = index ? ((j&1) + 2*(i&1) + 2*(j&2) + 4*(i&2)) : (4*i + j);
-          h->non_zero_count_cache[ scan8[k] ] = 1;
-
-          if (svq3_decode_block (&s->gb, &h->mb[16*k], index, type)){
-            av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding block\n");
-            return -1;
-          }
-        }
-      }
-    }
-
-    if ((cbp & 0x30)) {
-      for (i=0; i < 2; ++i) {
-        if (svq3_decode_block (&s->gb, &h->mb[16*(16 + 4*i)], 0, 3)){
-          av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma dc block\n");
-          return -1;
-        }
-      }
-
-      if ((cbp & 0x20)) {
-        for (i=0; i < 8; i++) {
-          h->non_zero_count_cache[ scan8[16+i] ] = 1;
-
-          if (svq3_decode_block (&s->gb, &h->mb[16*(16 + i)], 1, 1)){
-            av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding chroma ac block\n");
-            return -1;
-          }
-        }
-      }
-    }
-  }
-
-  s->current_picture.mb_type[mb_xy] = mb_type;
-
-  if (IS_INTRA(mb_type)) {
-    h->chroma_pred_mode = check_intra_pred_mode (h, DC_PRED8x8);
-  }
-
-  return 0;
-}
-
-static int svq3_decode_slice_header (H264Context *h) {
-  MpegEncContext *const s = (MpegEncContext *) h;
-  const int mb_xy = s->mb_x + s->mb_y*s->mb_stride;
-  int i, header;
-
-  header = get_bits (&s->gb, 8);
-
-  if (((header & 0x9F) != 1 && (header & 0x9F) != 2) || (header & 0x60) == 0) {
-    /* TODO: what? */
-    av_log(h->s.avctx, AV_LOG_ERROR, "unsupported slice header (%02X)\n", header);
-    return -1;
-  } else {
-    int length = (header >> 5) & 3;
-
-    h->next_slice_index = get_bits_count(&s->gb) + 8*show_bits (&s->gb, 8*length) + 8*length;
-
-    if (h->next_slice_index > s->gb.size_in_bits){
-      av_log(h->s.avctx, AV_LOG_ERROR, "slice after bitstream end\n");
-      return -1;
-    }
-
-    s->gb.size_in_bits = h->next_slice_index - 8*(length - 1);
-    skip_bits(&s->gb, 8);
-
-    if (length > 0) {
-      memcpy ((uint8_t *) &s->gb.buffer[get_bits_count(&s->gb) >> 3],
-             &s->gb.buffer[s->gb.size_in_bits >> 3], (length - 1));
-    }
-  }
-
-  if ((i = svq3_get_ue_golomb (&s->gb)) == INVALID_VLC || i >= 3){
-    av_log(h->s.avctx, AV_LOG_ERROR, "illegal slice type %d \n", i);
-    return -1;
-  }
-
-  h->slice_type = golomb_to_pict_type[i];
-
-  if ((header & 0x9F) == 2) {
-    i = (s->mb_num < 64) ? 6 : (1 + av_log2 (s->mb_num - 1));
-    s->mb_skip_run = get_bits (&s->gb, i) - (s->mb_x + (s->mb_y * s->mb_width));
-  } else {
-    get_bits1 (&s->gb);
-    s->mb_skip_run = 0;
-  }
-
-  h->slice_num = get_bits (&s->gb, 8);
-  s->qscale = get_bits (&s->gb, 5);
-  s->adaptive_quant = get_bits1 (&s->gb);
-
-  /* unknown fields */
-  get_bits1 (&s->gb);
-
-  if (h->unknown_svq3_flag) {
-    get_bits1 (&s->gb);
-  }
-
-  get_bits1 (&s->gb);
-  get_bits (&s->gb, 2);
-
-  while (get_bits1 (&s->gb)) {
-    get_bits (&s->gb, 8);
-  }
-
-  /* reset intra predictors and invalidate motion vector references */
-  if (s->mb_x > 0) {
-    memset (h->intra4x4_pred_mode[mb_xy - 1], -1, 4*sizeof(int8_t));
-    memset (h->intra4x4_pred_mode[mb_xy - s->mb_x], -1, 8*sizeof(int8_t)*s->mb_x);
-  }
-  if (s->mb_y > 0) {
-    memset (h->intra4x4_pred_mode[mb_xy - s->mb_stride], -1, 8*sizeof(int8_t)*(s->mb_width - s->mb_x));
-
-    if (s->mb_x > 0) {
-      h->intra4x4_pred_mode[mb_xy - s->mb_stride - 1][3] = -1;
-    }
-  }
-
-  return 0;
-}
-
-static int svq3_decode_frame (AVCodecContext *avctx,
-                              void *data, int *data_size,
-                              uint8_t *buf, int buf_size) {
-  MpegEncContext *const s = avctx->priv_data;
-  H264Context *const h = avctx->priv_data;
-  int m, mb_type;
-  unsigned char *extradata;
-  unsigned int size;
-
-  s->flags = avctx->flags;
-  s->flags2 = avctx->flags2;
-  s->unrestricted_mv = 1;
-
-  if (!s->context_initialized) {
-    s->width = avctx->width;
-    s->height = avctx->height;
-    h->pred4x4[DIAG_DOWN_LEFT_PRED] = pred4x4_down_left_svq3_c;
-    h->pred16x16[PLANE_PRED8x8] = pred16x16_plane_svq3_c;
-    h->halfpel_flag = 1;
-    h->thirdpel_flag = 1;
-    h->unknown_svq3_flag = 0;
-    h->chroma_qp = 4;
-
-    if (MPV_common_init (s) < 0)
-      return -1;
-
-    h->b_stride = 4*s->mb_width;
-
-    alloc_tables (h);
-
-    /* prowl for the "SEQH" marker in the extradata */
-    extradata = (unsigned char *)avctx->extradata;
-    for (m = 0; m < avctx->extradata_size; m++) {
-      if (!memcmp (extradata, "SEQH", 4))
-        break;
-      extradata++;
-    }
-
-    /* if a match was found, parse the extra data */
-    if (!memcmp (extradata, "SEQH", 4)) {
-
-      GetBitContext gb;
-
-      size = BE_32(&extradata[4]);
-      init_get_bits (&gb, extradata + 8, size*8);
-
-      /* 'frame size code' and optional 'width, height' */
-      if (get_bits (&gb, 3) == 7) {
-        get_bits (&gb, 12);
-        get_bits (&gb, 12);
-      }
-
-      h->halfpel_flag = get_bits1 (&gb);
-      h->thirdpel_flag = get_bits1 (&gb);
-
-      /* unknown fields */
-      get_bits1 (&gb);
-      get_bits1 (&gb);
-      get_bits1 (&gb);
-      get_bits1 (&gb);
-
-      s->low_delay = get_bits1 (&gb);
-
-      /* unknown field */
-      get_bits1 (&gb);
-
-      while (get_bits1 (&gb)) {
-        get_bits (&gb, 8);
-      }
-
-      h->unknown_svq3_flag = get_bits1 (&gb);
-      avctx->has_b_frames = !s->low_delay;
-    }
-  }
-
-  /* special case for last picture */
-  if (buf_size == 0) {
-    if (s->next_picture_ptr && !s->low_delay) {
-      *(AVFrame *) data = *(AVFrame *) &s->next_picture;
-      *data_size = sizeof(AVFrame);
-    }
-    return 0;
-  }
-
-  init_get_bits (&s->gb, buf, 8*buf_size);
-
-  s->mb_x = s->mb_y = 0;
-
-  if (svq3_decode_slice_header (h))
-    return -1;
-
-  s->pict_type = h->slice_type;
-  s->picture_number = h->slice_num;
-
-  if(avctx->debug&FF_DEBUG_PICT_INFO){
-      av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d\n",
-      av_get_pict_type_char(s->pict_type), h->halfpel_flag, h->thirdpel_flag,
-      s->adaptive_quant, s->qscale
-      );
-  }
-
-  /* for hurry_up==5 */
-  s->current_picture.pict_type = s->pict_type;
-  s->current_picture.key_frame = (s->pict_type == I_TYPE);
-
-  /* skip b frames if we dont have reference frames */
-  if (s->last_picture_ptr == NULL && s->pict_type == B_TYPE) return 0;
-  /* skip b frames if we are in a hurry */
-  if (avctx->hurry_up && s->pict_type == B_TYPE) return 0;
-  /* skip everything if we are in a hurry >= 5 */
-  if (avctx->hurry_up >= 5) return 0;
-  if(  (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==B_TYPE)
-     ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=I_TYPE)
-     || avctx->skip_frame >= AVDISCARD_ALL)
-      return 0;
-
-  if (s->next_p_frame_damaged) {
-    if (s->pict_type == B_TYPE)
-      return 0;
-    else
-      s->next_p_frame_damaged = 0;
-  }
-
-  frame_start (h);
-
-  if (s->pict_type == B_TYPE) {
-    h->frame_num_offset = (h->slice_num - h->prev_frame_num);
-
-    if (h->frame_num_offset < 0) {
-      h->frame_num_offset += 256;
-    }
-    if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {
-      av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n");
-      return -1;
-    }
-  } else {
-    h->prev_frame_num = h->frame_num;
-    h->frame_num = h->slice_num;
-    h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num);
-
-    if (h->prev_frame_num_offset < 0) {
-      h->prev_frame_num_offset += 256;
-    }
-  }
-
-  for(m=0; m<2; m++){
-    int i;
-    for(i=0; i<4; i++){
-      int j;
-      for(j=-1; j<4; j++)
-        h->ref_cache[m][scan8[0] + 8*i + j]= 1;
-      h->ref_cache[m][scan8[0] + 8*i + j]= PART_NOT_AVAILABLE;
-    }
-  }
-
-  for (s->mb_y=0; s->mb_y < s->mb_height; s->mb_y++) {
-    for (s->mb_x=0; s->mb_x < s->mb_width; s->mb_x++) {
-
-      if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&
-          ((get_bits_count(&s->gb) & 7) == 0 || show_bits (&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {
-
-        skip_bits(&s->gb, h->next_slice_index - get_bits_count(&s->gb));
-        s->gb.size_in_bits = 8*buf_size;
-
-        if (svq3_decode_slice_header (h))
-          return -1;
-
-        /* TODO: support s->mb_skip_run */
-      }
-
-      mb_type = svq3_get_ue_golomb (&s->gb);
-
-      if (s->pict_type == I_TYPE) {
-        mb_type += 8;
-      } else if (s->pict_type == B_TYPE && mb_type >= 4) {
-        mb_type += 4;
-      }
-      if (mb_type > 33 || svq3_decode_mb (h, mb_type)) {
-        av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
-        return -1;
-      }
-
-      if (mb_type != 0) {
-        hl_decode_mb (h);
-      }
-
-      if (s->pict_type != B_TYPE && !s->low_delay) {
-        s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] =
-                        (s->pict_type == P_TYPE && mb_type < 8) ? (mb_type - 1) : -1;
-      }
-    }
-
-    ff_draw_horiz_band(s, 16*s->mb_y, 16);
-  }
-
-  MPV_frame_end(s);
-
-  if (s->pict_type == B_TYPE || s->low_delay) {
-    *(AVFrame *) data = *(AVFrame *) &s->current_picture;
-  } else {
-    *(AVFrame *) data = *(AVFrame *) &s->last_picture;
-  }
-
-  avctx->frame_number = s->picture_number - 1;
-
-  /* dont output the last pic after seeking */
-  if (s->last_picture_ptr || s->low_delay) {
-    *data_size = sizeof(AVFrame);
-  }
-
-  return buf_size;
-}
-
-
-AVCodec svq3_decoder = {
-    "svq3",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_SVQ3,
-    sizeof(H264Context),
-    decode_init,
-    NULL,
-    decode_end,
-    svq3_decode_frame,
-    CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_DELAY,
-};
--- a/src/ffmpeg/libavcodec/tiertexseqv.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +0,0 @@
-/*
- * Tiertex Limited SEQ Video Decoder
- * Copyright (c) 2006 Gregory Montoir (cyx@users.sourceforge.net)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file tiertexseqv.c
- * Tiertex Limited SEQ video decoder
- */
-
-#include "avcodec.h"
-#include "common.h"
-#define ALT_BITSTREAM_READER_LE
-#include "bitstream.h"
-
-
-typedef struct SeqVideoContext {
-    AVCodecContext *avctx;
-    AVFrame frame;
-    unsigned int palette[256];
-    unsigned char block[8 * 8];
-} SeqVideoContext;
-
-
-static unsigned char *seq_unpack_rle_block(unsigned char *src, unsigned char *dst, int dst_size)
-{
-    int i, len, sz;
-    GetBitContext gb;
-    int code_table[64];
-
-    /* get the rle codes (at most 64 bytes) */
-    init_get_bits(&gb, src, 64 * 8);
-    for (i = 0, sz = 0; i < 64 && sz < dst_size; i++) {
-        code_table[i] = get_sbits(&gb, 4);
-        sz += FFABS(code_table[i]);
-    }
-    src += (get_bits_count(&gb) + 7) / 8;
-
-    /* do the rle unpacking */
-    for (i = 0; i < 64 && dst_size > 0; i++) {
-        len = code_table[i];
-        if (len < 0) {
-            len = -len;
-            memset(dst, *src++, FFMIN(len, dst_size));
-        } else {
-            memcpy(dst, src, FFMIN(len, dst_size));
-            src += len;
-        }
-        dst += len;
-        dst_size -= len;
-    }
-    return src;
-}
-
-static unsigned char *seq_decode_op1(SeqVideoContext *seq, unsigned char *src, unsigned char *dst)
-{
-    unsigned char *color_table;
-    int b, i, len, bits;
-    GetBitContext gb;
-
-    len = *src++;
-    if (len & 0x80) {
-        switch (len & 3) {
-        case 1:
-            src = seq_unpack_rle_block(src, seq->block, sizeof(seq->block));
-            for (b = 0; b < 8; b++) {
-                memcpy(dst, &seq->block[b * 8], 8);
-                dst += seq->frame.linesize[0];
-            }
-            break;
-        case 2:
-            src = seq_unpack_rle_block(src, seq->block, sizeof(seq->block));
-            for (i = 0; i < 8; i++) {
-                for (b = 0; b < 8; b++)
-                    dst[b * seq->frame.linesize[0]] = seq->block[i * 8 + b];
-                ++dst;
-            }
-            break;
-        }
-    } else {
-        color_table = src;
-        src += len;
-        bits = ff_log2_tab[len - 1] + 1;
-        init_get_bits(&gb, src, bits * 8 * 8); src += bits * 8;
-        for (b = 0; b < 8; b++) {
-            for (i = 0; i < 8; i++)
-                dst[i] = color_table[get_bits(&gb, bits)];
-            dst += seq->frame.linesize[0];
-        }
-    }
-
-    return src;
-}
-
-static unsigned char *seq_decode_op2(SeqVideoContext *seq, unsigned char *src, unsigned char *dst)
-{
-    int i;
-
-    for (i = 0; i < 8; i++) {
-        memcpy(dst, src, 8);
-        src += 8;
-        dst += seq->frame.linesize[0];
-    }
-
-    return src;
-}
-
-static unsigned char *seq_decode_op3(SeqVideoContext *seq, unsigned char *src, unsigned char *dst)
-{
-    int pos, offset;
-
-    do {
-        pos = *src++;
-        offset = ((pos >> 3) & 7) * seq->frame.linesize[0] + (pos & 7);
-        dst[offset] = *src++;
-    } while (!(pos & 0x80));
-
-    return src;
-}
-
-static void seqvideo_decode(SeqVideoContext *seq, unsigned char *data, int data_size)
-{
-    GetBitContext gb;
-    int flags, i, j, x, y, op;
-    unsigned char c[3];
-    unsigned char *dst;
-
-    flags = *data++;
-
-    if (flags & 1) {
-        for (i = 0; i < 256; i++) {
-            for (j = 0; j < 3; j++, data++)
-                c[j] = (*data << 2) | (*data >> 4);
-            seq->palette[i] = (c[0] << 16) | (c[1] << 8) | c[2];
-        }
-        memcpy(seq->frame.data[1], seq->palette, sizeof(seq->palette));
-        seq->frame.palette_has_changed = 1;
-    }
-
-    if (flags & 2) {
-        init_get_bits(&gb, data, 128 * 8); data += 128;
-        for (y = 0; y < 128; y += 8)
-            for (x = 0; x < 256; x += 8) {
-                dst = &seq->frame.data[0][y * seq->frame.linesize[0] + x];
-                op = get_bits(&gb, 2);
-                switch (op) {
-                case 1:
-                    data = seq_decode_op1(seq, data, dst);
-                    break;
-                case 2:
-                    data = seq_decode_op2(seq, data, dst);
-                    break;
-                case 3:
-                    data = seq_decode_op3(seq, data, dst);
-                    break;
-                }
-            }
-    }
-}
-
-static int seqvideo_decode_init(AVCodecContext *avctx)
-{
-    SeqVideoContext *seq = (SeqVideoContext *)avctx->priv_data;
-
-    seq->avctx = avctx;
-    avctx->pix_fmt = PIX_FMT_PAL8;
-    avctx->has_b_frames = 0;
-
-    seq->frame.data[0] = NULL;
-
-    return 0;
-}
-
-static int seqvideo_decode_frame(AVCodecContext *avctx,
-                                 void *data, int *data_size,
-                                 uint8_t *buf, int buf_size)
-{
-
-    SeqVideoContext *seq = (SeqVideoContext *)avctx->priv_data;
-
-    seq->frame.reference = 1;
-    seq->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if (avctx->reget_buffer(avctx, &seq->frame)) {
-        av_log(seq->avctx, AV_LOG_ERROR, "tiertexseqvideo: reget_buffer() failed\n");
-        return -1;
-    }
-
-    seqvideo_decode(seq, buf, buf_size);
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame *)data = seq->frame;
-
-    return buf_size;
-}
-
-static int seqvideo_decode_end(AVCodecContext *avctx)
-{
-    SeqVideoContext *seq = (SeqVideoContext *)avctx->priv_data;
-
-    if (seq->frame.data[0])
-        avctx->release_buffer(avctx, &seq->frame);
-
-    return 0;
-}
-
-AVCodec tiertexseqvideo_decoder = {
-    "tiertexseqvideo",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_TIERTEXSEQVIDEO,
-    sizeof(SeqVideoContext),
-    seqvideo_decode_init,
-    NULL,
-    seqvideo_decode_end,
-    seqvideo_decode_frame,
-    CODEC_CAP_DR1,
-};
--- a/src/ffmpeg/libavcodec/truemotion1.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,923 +0,0 @@
-/*
- * Duck TrueMotion 1.0 Decoder
- * Copyright (C) 2003 Alex Beregszaszi & Mike Melanson
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file truemotion1.c
- * Duck TrueMotion v1 Video Decoder by
- * Alex Beregszaszi (alex@fsn.hu) and
- * Mike Melanson (melanson@pcisys.net)
- *
- * The TrueMotion v1 decoder presently only decodes 16-bit TM1 data and
- * outputs RGB555 (or RGB565) data. 24-bit TM1 data is not supported yet.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "avcodec.h"
-#include "dsputil.h"
-
-#include "truemotion1data.h"
-
-typedef struct TrueMotion1Context {
-    AVCodecContext *avctx;
-    AVFrame frame;
-    AVFrame prev_frame;
-
-    uint8_t *buf;
-    int size;
-
-    uint8_t *mb_change_bits;
-    int mb_change_bits_row_size;
-    uint8_t *index_stream;
-    int index_stream_size;
-
-    int flags;
-    int x, y, w, h;
-
-    uint32_t y_predictor_table[1024];
-    uint32_t c_predictor_table[1024];
-    uint32_t fat_y_predictor_table[1024];
-    uint32_t fat_c_predictor_table[1024];
-
-    int compression;
-    int block_type;
-    int block_width;
-    int block_height;
-
-    int16_t ydt[8];
-    int16_t cdt[8];
-    int16_t fat_ydt[8];
-    int16_t fat_cdt[8];
-
-    int last_deltaset, last_vectable;
-
-    unsigned int *vert_pred;
-
-} TrueMotion1Context;
-
-#define FLAG_SPRITE         32
-#define FLAG_KEYFRAME       16
-#define FLAG_INTERFRAME      8
-#define FLAG_INTERPOLATED    4
-
-struct frame_header {
-    uint8_t header_size;
-    uint8_t compression;
-    uint8_t deltaset;
-    uint8_t vectable;
-    uint16_t ysize;
-    uint16_t xsize;
-    uint16_t checksum;
-    uint8_t version;
-    uint8_t header_type;
-    uint8_t flags;
-    uint8_t control;
-    uint16_t xoffset;
-    uint16_t yoffset;
-    uint16_t width;
-    uint16_t height;
-};
-
-#define ALGO_NOP        0
-#define ALGO_RGB16V     1
-#define ALGO_RGB16H     2
-#define ALGO_RGB24H     3
-
-/* these are the various block sizes that can occupy a 4x4 block */
-#define BLOCK_2x2  0
-#define BLOCK_2x4  1
-#define BLOCK_4x2  2
-#define BLOCK_4x4  3
-
-typedef struct comp_types {
-    int algorithm;
-    int block_width; // vres
-    int block_height; // hres
-    int block_type;
-} comp_types;
-
-/* { valid for metatype }, algorithm, num of deltas, vert res, horiz res */
-static comp_types compression_types[17] = {
-    { ALGO_NOP,    0, 0, 0 },
-
-    { ALGO_RGB16V, 4, 4, BLOCK_4x4 },
-    { ALGO_RGB16H, 4, 4, BLOCK_4x4 },
-    { ALGO_RGB16V, 4, 2, BLOCK_4x2 },
-    { ALGO_RGB16H, 4, 2, BLOCK_4x2 },
-
-    { ALGO_RGB16V, 2, 4, BLOCK_2x4 },
-    { ALGO_RGB16H, 2, 4, BLOCK_2x4 },
-    { ALGO_RGB16V, 2, 2, BLOCK_2x2 },
-    { ALGO_RGB16H, 2, 2, BLOCK_2x2 },
-
-    { ALGO_NOP,    4, 4, BLOCK_4x4 },
-    { ALGO_RGB24H, 4, 4, BLOCK_4x4 },
-    { ALGO_NOP,    4, 2, BLOCK_4x2 },
-    { ALGO_RGB24H, 4, 2, BLOCK_4x2 },
-
-    { ALGO_NOP,    2, 4, BLOCK_2x4 },
-    { ALGO_RGB24H, 2, 4, BLOCK_2x4 },
-    { ALGO_NOP,    2, 2, BLOCK_2x2 },
-    { ALGO_RGB24H, 2, 2, BLOCK_2x2 }
-};
-
-static void select_delta_tables(TrueMotion1Context *s, int delta_table_index)
-{
-    int i;
-
-    if (delta_table_index > 3)
-        return;
-
-    memcpy(s->ydt, ydts[delta_table_index], 8 * sizeof(int16_t));
-    memcpy(s->cdt, cdts[delta_table_index], 8 * sizeof(int16_t));
-    memcpy(s->fat_ydt, fat_ydts[delta_table_index], 8 * sizeof(int16_t));
-    memcpy(s->fat_cdt, fat_cdts[delta_table_index], 8 * sizeof(int16_t));
-
-    /* Y skinny deltas need to be halved for some reason; maybe the
-     * skinny Y deltas should be modified */
-    for (i = 0; i < 8; i++)
-    {
-        /* drop the lsb before dividing by 2-- net effect: round down
-         * when dividing a negative number (e.g., -3/2 = -2, not -1) */
-        s->ydt[i] &= 0xFFFE;
-        s->ydt[i] /= 2;
-    }
-}
-
-#ifdef WORDS_BIGENDIAN
-static int make_ydt15_entry(int p2, int p1, int16_t *ydt)
-#else
-static int make_ydt15_entry(int p1, int p2, int16_t *ydt)
-#endif
-{
-    int lo, hi;
-
-    lo = ydt[p1];
-    lo += (lo << 5) + (lo << 10);
-    hi = ydt[p2];
-    hi += (hi << 5) + (hi << 10);
-    return ((lo + (hi << 16)) << 1);
-}
-
-#ifdef WORDS_BIGENDIAN
-static int make_cdt15_entry(int p2, int p1, int16_t *cdt)
-#else
-static int make_cdt15_entry(int p1, int p2, int16_t *cdt)
-#endif
-{
-    int r, b, lo;
-
-    b = cdt[p2];
-    r = cdt[p1] << 10;
-    lo = b + r;
-    return ((lo + (lo << 16)) << 1);
-}
-
-#ifdef WORDS_BIGENDIAN
-static int make_ydt16_entry(int p2, int p1, int16_t *ydt)
-#else
-static int make_ydt16_entry(int p1, int p2, int16_t *ydt)
-#endif
-{
-    int lo, hi;
-
-    lo = ydt[p1];
-    lo += (lo << 6) + (lo << 11);
-    hi = ydt[p2];
-    hi += (hi << 6) + (hi << 11);
-    return ((lo + (hi << 16)) << 1);
-}
-
-#ifdef WORDS_BIGENDIAN
-static int make_cdt16_entry(int p2, int p1, int16_t *cdt)
-#else
-static int make_cdt16_entry(int p1, int p2, int16_t *cdt)
-#endif
-{
-    int r, b, lo;
-
-    b = cdt[p2];
-    r = cdt[p1] << 11;
-    lo = b + r;
-    return ((lo + (lo << 16)) << 1);
-}
-
-#ifdef WORDS_BIGENDIAN
-static int make_ydt24_entry(int p2, int p1, int16_t *ydt)
-#else
-static int make_ydt24_entry(int p1, int p2, int16_t *ydt)
-#endif
-{
-    int lo, hi;
-
-    lo = ydt[p1];
-    hi = ydt[p2];
-    return ((lo + (hi << 8) + (hi << 16)) << 1);
-}
-
-#ifdef WORDS_BIGENDIAN
-static int make_cdt24_entry(int p2, int p1, int16_t *cdt)
-#else
-static int make_cdt24_entry(int p1, int p2, int16_t *cdt)
-#endif
-{
-    int r, b;
-
-    b = cdt[p2];
-    r = cdt[p1]<<16;
-    return ((b+r) << 1);
-}
-
-static void gen_vector_table15(TrueMotion1Context *s, const uint8_t *sel_vector_table)
-{
-    int len, i, j;
-    unsigned char delta_pair;
-
-    for (i = 0; i < 1024; i += 4)
-    {
-        len = *sel_vector_table++ / 2;
-        for (j = 0; j < len; j++)
-        {
-            delta_pair = *sel_vector_table++;
-            s->y_predictor_table[i+j] = 0xfffffffe &
-                make_ydt15_entry(delta_pair >> 4, delta_pair & 0xf, s->ydt);
-            s->c_predictor_table[i+j] = 0xfffffffe &
-                make_cdt15_entry(delta_pair >> 4, delta_pair & 0xf, s->cdt);
-        }
-        s->y_predictor_table[i+(j-1)] |= 1;
-        s->c_predictor_table[i+(j-1)] |= 1;
-    }
-}
-
-static void gen_vector_table16(TrueMotion1Context *s, const uint8_t *sel_vector_table)
-{
-    int len, i, j;
-    unsigned char delta_pair;
-
-    for (i = 0; i < 1024; i += 4)
-    {
-        len = *sel_vector_table++ / 2;
-        for (j = 0; j < len; j++)
-        {
-            delta_pair = *sel_vector_table++;
-            s->y_predictor_table[i+j] = 0xfffffffe &
-                make_ydt16_entry(delta_pair >> 4, delta_pair & 0xf, s->ydt);
-            s->c_predictor_table[i+j] = 0xfffffffe &
-                make_cdt16_entry(delta_pair >> 4, delta_pair & 0xf, s->cdt);
-        }
-        s->y_predictor_table[i+(j-1)] |= 1;
-        s->c_predictor_table[i+(j-1)] |= 1;
-    }
-}
-
-static void gen_vector_table24(TrueMotion1Context *s, const uint8_t *sel_vector_table)
-{
-    int len, i, j;
-    unsigned char delta_pair;
-
-    for (i = 0; i < 1024; i += 4)
-    {
-        len = *sel_vector_table++ / 2;
-        for (j = 0; j < len; j++)
-        {
-            delta_pair = *sel_vector_table++;
-            s->y_predictor_table[i+j] = 0xfffffffe &
-                make_ydt24_entry(delta_pair >> 4, delta_pair & 0xf, s->ydt);
-            s->c_predictor_table[i+j] = 0xfffffffe &
-                make_cdt24_entry(delta_pair >> 4, delta_pair & 0xf, s->cdt);
-            s->fat_y_predictor_table[i+j] = 0xfffffffe &
-                make_ydt24_entry(delta_pair >> 4, delta_pair & 0xf, s->fat_ydt);
-            s->fat_c_predictor_table[i+j] = 0xfffffffe &
-                make_cdt24_entry(delta_pair >> 4, delta_pair & 0xf, s->fat_cdt);
-        }
-        s->y_predictor_table[i+(j-1)] |= 1;
-        s->c_predictor_table[i+(j-1)] |= 1;
-        s->fat_y_predictor_table[i+(j-1)] |= 1;
-        s->fat_c_predictor_table[i+(j-1)] |= 1;
-    }
-}
-
-/* Returns the number of bytes consumed from the bytestream. Returns -1 if
- * there was an error while decoding the header */
-static int truemotion1_decode_header(TrueMotion1Context *s)
-{
-    int i;
-    struct frame_header header;
-    uint8_t header_buffer[128];  /* logical maximum size of the header */
-    const uint8_t *sel_vector_table;
-
-    /* There is 1 change bit per 4 pixels, so each change byte represents
-     * 32 pixels; divide width by 4 to obtain the number of change bits and
-     * then round up to the nearest byte. */
-    s->mb_change_bits_row_size = ((s->avctx->width >> 2) + 7) >> 3;
-
-    header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f;
-    if (s->buf[0] < 0x10)
-    {
-        av_log(s->avctx, AV_LOG_ERROR, "invalid header size (%d)\n", s->buf[0]);
-        return -1;
-    }
-
-    /* unscramble the header bytes with a XOR operation */
-    memset(header_buffer, 0, 128);
-    for (i = 1; i < header.header_size; i++)
-        header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1];
-
-    header.compression = header_buffer[0];
-    header.deltaset = header_buffer[1];
-    header.vectable = header_buffer[2];
-    header.ysize = LE_16(&header_buffer[3]);
-    header.xsize = LE_16(&header_buffer[5]);
-    header.checksum = LE_16(&header_buffer[7]);
-    header.version = header_buffer[9];
-    header.header_type = header_buffer[10];
-    header.flags = header_buffer[11];
-    header.control = header_buffer[12];
-
-    /* Version 2 */
-    if (header.version >= 2)
-    {
-        if (header.header_type > 3)
-        {
-            av_log(s->avctx, AV_LOG_ERROR, "invalid header type (%d)\n", header.header_type);
-            return -1;
-        } else if ((header.header_type == 2) || (header.header_type == 3)) {
-            s->flags = header.flags;
-            if (!(s->flags & FLAG_INTERFRAME))
-                s->flags |= FLAG_KEYFRAME;
-        } else
-            s->flags = FLAG_KEYFRAME;
-    } else /* Version 1 */
-        s->flags = FLAG_KEYFRAME;
-
-    if (s->flags & FLAG_SPRITE) {
-        av_log(s->avctx, AV_LOG_INFO, "SPRITE frame found, please report the sample to the developers\n");
-        s->w = header.width;
-        s->h = header.height;
-        s->x = header.xoffset;
-        s->y = header.yoffset;
-    } else {
-        s->w = header.xsize;
-        s->h = header.ysize;
-        if (header.header_type < 2) {
-            if ((s->w < 213) && (s->h >= 176))
-            {
-                s->flags |= FLAG_INTERPOLATED;
-                av_log(s->avctx, AV_LOG_INFO, "INTERPOLATION selected, please report the sample to the developers\n");
-            }
-        }
-    }
-
-    if (header.compression > 17) {
-        av_log(s->avctx, AV_LOG_ERROR, "invalid compression type (%d)\n", header.compression);
-        return -1;
-    }
-
-    if ((header.deltaset != s->last_deltaset) ||
-        (header.vectable != s->last_vectable))
-        select_delta_tables(s, header.deltaset);
-
-    if ((header.compression & 1) && header.header_type)
-        sel_vector_table = pc_tbl2;
-    else {
-        if (header.vectable < 4)
-            sel_vector_table = tables[header.vectable - 1];
-        else {
-            av_log(s->avctx, AV_LOG_ERROR, "invalid vector table id (%d)\n", header.vectable);
-            return -1;
-        }
-    }
-
-    // FIXME: where to place this ?!?!
-    if (compression_types[header.compression].algorithm == ALGO_RGB24H)
-        s->avctx->pix_fmt = PIX_FMT_RGBA32;
-    else
-        s->avctx->pix_fmt = PIX_FMT_RGB555; // RGB565 is supported aswell
-
-    if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable))
-    {
-        if (compression_types[header.compression].algorithm == ALGO_RGB24H)
-            gen_vector_table24(s, sel_vector_table);
-        else
-        if (s->avctx->pix_fmt == PIX_FMT_RGB555)
-            gen_vector_table15(s, sel_vector_table);
-        else
-            gen_vector_table16(s, sel_vector_table);
-    }
-
-    /* set up pointers to the other key data chunks */
-    s->mb_change_bits = s->buf + header.header_size;
-    if (s->flags & FLAG_KEYFRAME) {
-        /* no change bits specified for a keyframe; only index bytes */
-        s->index_stream = s->mb_change_bits;
-    } else {
-        /* one change bit per 4x4 block */
-        s->index_stream = s->mb_change_bits +
-            (s->mb_change_bits_row_size * (s->avctx->height >> 2));
-    }
-    s->index_stream_size = s->size - (s->index_stream - s->buf);
-
-    s->last_deltaset = header.deltaset;
-    s->last_vectable = header.vectable;
-    s->compression = header.compression;
-    s->block_width = compression_types[header.compression].block_width;
-    s->block_height = compression_types[header.compression].block_height;
-    s->block_type = compression_types[header.compression].block_type;
-
-    if (s->avctx->debug & FF_DEBUG_PICT_INFO)
-        av_log(s->avctx, AV_LOG_INFO, "tables: %d / %d c:%d %dx%d t:%d %s%s%s%s\n",
-            s->last_deltaset, s->last_vectable, s->compression, s->block_width,
-            s->block_height, s->block_type,
-            s->flags & FLAG_KEYFRAME ? " KEY" : "",
-            s->flags & FLAG_INTERFRAME ? " INTER" : "",
-            s->flags & FLAG_SPRITE ? " SPRITE" : "",
-            s->flags & FLAG_INTERPOLATED ? " INTERPOL" : "");
-
-    return header.header_size;
-}
-
-static int truemotion1_decode_init(AVCodecContext *avctx)
-{
-    TrueMotion1Context *s = (TrueMotion1Context *)avctx->priv_data;
-
-    s->avctx = avctx;
-
-    // FIXME: it may change ?
-//    if (avctx->bits_per_sample == 24)
-//        avctx->pix_fmt = PIX_FMT_RGB24;
-//    else
-//        avctx->pix_fmt = PIX_FMT_RGB555;
-
-    avctx->has_b_frames = 0;
-    s->frame.data[0] = s->prev_frame.data[0] = NULL;
-
-    /* there is a vertical predictor for each pixel in a line; each vertical
-     * predictor is 0 to start with */
-    s->vert_pred =
-        (unsigned int *)av_malloc(s->avctx->width * sizeof(unsigned int));
-
-    return 0;
-}
-
-/*
-Block decoding order:
-
-dxi: Y-Y
-dxic: Y-C-Y
-dxic2: Y-C-Y-C
-
-hres,vres,i,i%vres (0 < i < 4)
-2x2 0: 0 dxic2
-2x2 1: 1 dxi
-2x2 2: 0 dxic2
-2x2 3: 1 dxi
-2x4 0: 0 dxic2
-2x4 1: 1 dxi
-2x4 2: 2 dxi
-2x4 3: 3 dxi
-4x2 0: 0 dxic
-4x2 1: 1 dxi
-4x2 2: 0 dxic
-4x2 3: 1 dxi
-4x4 0: 0 dxic
-4x4 1: 1 dxi
-4x4 2: 2 dxi
-4x4 3: 3 dxi
-*/
-
-#define GET_NEXT_INDEX() \
-{\
-    if (index_stream_index >= s->index_stream_size) { \
-        av_log(s->avctx, AV_LOG_INFO, " help! truemotion1 decoder went out of bounds\n"); \
-        return; \
-    } \
-    index = s->index_stream[index_stream_index++] * 4; \
-}
-
-#define APPLY_C_PREDICTOR() \
-    predictor_pair = s->c_predictor_table[index]; \
-    horiz_pred += (predictor_pair >> 1); \
-    if (predictor_pair & 1) { \
-        GET_NEXT_INDEX() \
-        if (!index) { \
-            GET_NEXT_INDEX() \
-            predictor_pair = s->c_predictor_table[index]; \
-            horiz_pred += ((predictor_pair >> 1) * 5); \
-            if (predictor_pair & 1) \
-                GET_NEXT_INDEX() \
-            else \
-                index++; \
-        } \
-    } else \
-        index++;
-
-#define APPLY_C_PREDICTOR_24() \
-    predictor_pair = s->c_predictor_table[index]; \
-    horiz_pred += (predictor_pair >> 1); \
-    if (predictor_pair & 1) { \
-        GET_NEXT_INDEX() \
-        if (!index) { \
-            GET_NEXT_INDEX() \
-            predictor_pair = s->fat_c_predictor_table[index]; \
-            horiz_pred += (predictor_pair >> 1); \
-            if (predictor_pair & 1) \
-                GET_NEXT_INDEX() \
-            else \
-                index++; \
-        } \
-    } else \
-        index++;
-
-
-#define APPLY_Y_PREDICTOR() \
-    predictor_pair = s->y_predictor_table[index]; \
-    horiz_pred += (predictor_pair >> 1); \
-    if (predictor_pair & 1) { \
-        GET_NEXT_INDEX() \
-        if (!index) { \
-            GET_NEXT_INDEX() \
-            predictor_pair = s->y_predictor_table[index]; \
-            horiz_pred += ((predictor_pair >> 1) * 5); \
-            if (predictor_pair & 1) \
-                GET_NEXT_INDEX() \
-            else \
-                index++; \
-        } \
-    } else \
-        index++;
-
-#define APPLY_Y_PREDICTOR_24() \
-    predictor_pair = s->y_predictor_table[index]; \
-    horiz_pred += (predictor_pair >> 1); \
-    if (predictor_pair & 1) { \
-        GET_NEXT_INDEX() \
-        if (!index) { \
-            GET_NEXT_INDEX() \
-            predictor_pair = s->fat_y_predictor_table[index]; \
-            horiz_pred += (predictor_pair >> 1); \
-            if (predictor_pair & 1) \
-                GET_NEXT_INDEX() \
-            else \
-                index++; \
-        } \
-    } else \
-        index++;
-
-#define OUTPUT_PIXEL_PAIR() \
-    *current_pixel_pair = *vert_pred + horiz_pred; \
-    *vert_pred++ = *current_pixel_pair++; \
-    prev_pixel_pair++;
-
-static void truemotion1_decode_16bit(TrueMotion1Context *s)
-{
-    int y;
-    int pixels_left;  /* remaining pixels on this line */
-    unsigned int predictor_pair;
-    unsigned int horiz_pred;
-    unsigned int *vert_pred;
-    unsigned int *current_pixel_pair;
-    unsigned int *prev_pixel_pair;
-    unsigned char *current_line = s->frame.data[0];
-    unsigned char *prev_line = s->prev_frame.data[0];
-    int keyframe = s->flags & FLAG_KEYFRAME;
-
-    /* these variables are for managing the stream of macroblock change bits */
-    unsigned char *mb_change_bits = s->mb_change_bits;
-    unsigned char mb_change_byte;
-    unsigned char mb_change_byte_mask;
-    int mb_change_index;
-
-    /* these variables are for managing the main index stream */
-    int index_stream_index = 0;  /* yes, the index into the index stream */
-    int index;
-
-    /* clean out the line buffer */
-    memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int));
-
-    GET_NEXT_INDEX();
-
-    for (y = 0; y < s->avctx->height; y++) {
-
-        /* re-init variables for the next line iteration */
-        horiz_pred = 0;
-        current_pixel_pair = (unsigned int *)current_line;
-        prev_pixel_pair = (unsigned int *)prev_line;
-        vert_pred = s->vert_pred;
-        mb_change_index = 0;
-        mb_change_byte = mb_change_bits[mb_change_index++];
-        mb_change_byte_mask = 0x01;
-        pixels_left = s->avctx->width;
-
-        while (pixels_left > 0) {
-
-            if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) {
-
-                switch (y & 3) {
-                case 0:
-                    /* if macroblock width is 2, apply C-Y-C-Y; else
-                     * apply C-Y-Y */
-                    if (s->block_width == 2) {
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    } else {
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    }
-                    break;
-
-                case 1:
-                case 3:
-                    /* always apply 2 Y predictors on these iterations */
-                    APPLY_Y_PREDICTOR();
-                    OUTPUT_PIXEL_PAIR();
-                    APPLY_Y_PREDICTOR();
-                    OUTPUT_PIXEL_PAIR();
-                    break;
-
-                case 2:
-                    /* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y
-                     * depending on the macroblock type */
-                    if (s->block_type == BLOCK_2x2) {
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    } else if (s->block_type == BLOCK_4x2) {
-                        APPLY_C_PREDICTOR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    } else {
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR();
-                        OUTPUT_PIXEL_PAIR();
-                    }
-                    break;
-                }
-
-            } else {
-
-                /* skip (copy) four pixels, but reassign the horizontal
-                 * predictor */
-                *current_pixel_pair = *prev_pixel_pair++;
-                *vert_pred++ = *current_pixel_pair++;
-                *current_pixel_pair = *prev_pixel_pair++;
-                horiz_pred = *current_pixel_pair - *vert_pred;
-                *vert_pred++ = *current_pixel_pair++;
-
-            }
-
-            if (!keyframe) {
-                mb_change_byte_mask <<= 1;
-
-                /* next byte */
-                if (!mb_change_byte_mask) {
-                    mb_change_byte = mb_change_bits[mb_change_index++];
-                    mb_change_byte_mask = 0x01;
-                }
-            }
-
-            pixels_left -= 4;
-        }
-
-        /* next change row */
-        if (((y + 1) & 3) == 0)
-            mb_change_bits += s->mb_change_bits_row_size;
-
-        current_line += s->frame.linesize[0];
-        prev_line += s->prev_frame.linesize[0];
-    }
-}
-
-static void truemotion1_decode_24bit(TrueMotion1Context *s)
-{
-    int y;
-    int pixels_left;  /* remaining pixels on this line */
-    unsigned int predictor_pair;
-    unsigned int horiz_pred;
-    unsigned int *vert_pred;
-    unsigned int *current_pixel_pair;
-    unsigned int *prev_pixel_pair;
-    unsigned char *current_line = s->frame.data[0];
-    unsigned char *prev_line = s->prev_frame.data[0];
-    int keyframe = s->flags & FLAG_KEYFRAME;
-
-    /* these variables are for managing the stream of macroblock change bits */
-    unsigned char *mb_change_bits = s->mb_change_bits;
-    unsigned char mb_change_byte;
-    unsigned char mb_change_byte_mask;
-    int mb_change_index;
-
-    /* these variables are for managing the main index stream */
-    int index_stream_index = 0;  /* yes, the index into the index stream */
-    int index;
-
-    /* clean out the line buffer */
-    memset(s->vert_pred, 0, s->avctx->width * sizeof(unsigned int));
-
-    GET_NEXT_INDEX();
-
-    for (y = 0; y < s->avctx->height; y++) {
-
-        /* re-init variables for the next line iteration */
-        horiz_pred = 0;
-        current_pixel_pair = (unsigned int *)current_line;
-        prev_pixel_pair = (unsigned int *)prev_line;
-        vert_pred = s->vert_pred;
-        mb_change_index = 0;
-        mb_change_byte = mb_change_bits[mb_change_index++];
-        mb_change_byte_mask = 0x01;
-        pixels_left = s->avctx->width;
-
-        while (pixels_left > 0) {
-
-            if (keyframe || ((mb_change_byte & mb_change_byte_mask) == 0)) {
-
-                switch (y & 3) {
-                case 0:
-                    /* if macroblock width is 2, apply C-Y-C-Y; else
-                     * apply C-Y-Y */
-                    if (s->block_width == 2) {
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    } else {
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    }
-                    break;
-
-                case 1:
-                case 3:
-                    /* always apply 2 Y predictors on these iterations */
-                    APPLY_Y_PREDICTOR_24();
-                    OUTPUT_PIXEL_PAIR();
-                    APPLY_Y_PREDICTOR_24();
-                    OUTPUT_PIXEL_PAIR();
-                    break;
-
-                case 2:
-                    /* this iteration might be C-Y-C-Y, Y-Y, or C-Y-Y
-                     * depending on the macroblock type */
-                    if (s->block_type == BLOCK_2x2) {
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    } else if (s->block_type == BLOCK_4x2) {
-                        APPLY_C_PREDICTOR_24();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    } else {
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                        APPLY_Y_PREDICTOR_24();
-                        OUTPUT_PIXEL_PAIR();
-                    }
-                    break;
-                }
-
-            } else {
-
-                /* skip (copy) four pixels, but reassign the horizontal
-                 * predictor */
-                *current_pixel_pair = *prev_pixel_pair++;
-                *vert_pred++ = *current_pixel_pair++;
-                *current_pixel_pair = *prev_pixel_pair++;
-                horiz_pred = *current_pixel_pair - *vert_pred;
-                *vert_pred++ = *current_pixel_pair++;
-
-            }
-
-            if (!keyframe) {
-                mb_change_byte_mask <<= 1;
-
-                /* next byte */
-                if (!mb_change_byte_mask) {
-                    mb_change_byte = mb_change_bits[mb_change_index++];
-                    mb_change_byte_mask = 0x01;
-                }
-            }
-
-            pixels_left -= 4;
-        }
-
-        /* next change row */
-        if (((y + 1) & 3) == 0)
-            mb_change_bits += s->mb_change_bits_row_size;
-
-        current_line += s->frame.linesize[0];
-        prev_line += s->prev_frame.linesize[0];
-    }
-}
-
-
-static int truemotion1_decode_frame(AVCodecContext *avctx,
-                                    void *data, int *data_size,
-                                    uint8_t *buf, int buf_size)
-{
-    TrueMotion1Context *s = (TrueMotion1Context *)avctx->priv_data;
-
-    s->buf = buf;
-    s->size = buf_size;
-
-    if (truemotion1_decode_header(s) == -1)
-        return -1;
-
-    s->frame.reference = 1;
-    if (avctx->get_buffer(avctx, &s->frame) < 0) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    /* check for a do-nothing frame and copy the previous frame */
-    if (compression_types[s->compression].algorithm == ALGO_NOP)
-    {
-        memcpy(s->frame.data[0], s->prev_frame.data[0],
-            s->frame.linesize[0] * s->avctx->height);
-    } else if (compression_types[s->compression].algorithm == ALGO_RGB24H) {
-        truemotion1_decode_24bit(s);
-    } else {
-        truemotion1_decode_16bit(s);
-    }
-
-    if (s->prev_frame.data[0])
-        avctx->release_buffer(avctx, &s->prev_frame);
-
-    /* shuffle frames */
-    s->prev_frame = s->frame;
-
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = s->frame;
-
-    /* report that the buffer was completely consumed */
-    return buf_size;
-}
-
-static int truemotion1_decode_end(AVCodecContext *avctx)
-{
-    TrueMotion1Context *s = (TrueMotion1Context *)avctx->priv_data;
-
-    /* release the last frame */
-    if (s->prev_frame.data[0])
-        avctx->release_buffer(avctx, &s->prev_frame);
-
-    av_free(s->vert_pred);
-
-    return 0;
-}
-
-AVCodec truemotion1_decoder = {
-    "truemotion1",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_TRUEMOTION1,
-    sizeof(TrueMotion1Context),
-    truemotion1_decode_init,
-    NULL,
-    truemotion1_decode_end,
-    truemotion1_decode_frame,
-    CODEC_CAP_DR1,
-};
--- a/src/ffmpeg/libavcodec/truemotion1data.h	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,829 +0,0 @@
-/*
- * Duck Truemotion v1 Decoding Tables
- *
- * Data in this file was originally part of VpVision from On2 which is
- * distributed under the GNU GPL. It is redistributed with ffmpeg under the
- * GNU LGPL using the common understanding that data tables necessary for
- * decoding algorithms are not necessarily licensable.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef TRUEMOTION1DATA_H
-#define TRUEMOTION1DATA_H
-
-/* Y delta tables, skinny and fat */
-static const int16_t ydt1[8] = { 0, -2, 2, -6, 6, -12, 12, -12 };
-static const int16_t ydt2[8] = { 0, -2, 4, -6, 8, -12, 12, -12 };
-static const int16_t ydt3[8] = { 4, -6, 20, -20, 46, -46, 94, -94 };
-static const int16_t fat_ydt3[8] = { 0, -15, 50, -50, 115, -115, 235, -235 };
-static const int16_t ydt4[8] = { 0, -4, 4, -16, 16, -36, 36, -80 };
-static const int16_t fat_ydt4[8] = { 0, 40, 80, -76, 160, -154, 236, -236 };
-
-/* C delta tables, skinny and fat */
-static const int16_t cdt1[8] = { 0, -1, 1, -2, 3, -4, 5, -4 };
-static const int16_t cdt2[8] = { 0, -4, 3, -16, 20, -32, 36, -32 };
-static const int16_t fat_cdt2[8] = { 0, -20, 15, -80, 100, -160, 180, -160 };
-static const int16_t cdt3[8] = { 0, -2, 2, -8, 8, -18, 18, -40 };
-/* NOTE: This table breaks the [+,-] pattern that the rest of the
- * tables maintain. Is this intentional? */
-static const int16_t fat_cdt3[8] = { 0, 40, 80, -76, 160, -154, 236, -236 };
-
-/* all the delta tables to choose from, at all 4 delta levels */
-static const int16_t *ydts[] = { ydt1, ydt2, ydt3, ydt4, NULL };
-static const int16_t *fat_ydts[] = { fat_ydt3, fat_ydt3, fat_ydt3, fat_ydt4, NULL };
-static const int16_t *cdts[] = { cdt1, cdt1, cdt2, cdt3, NULL };
-static const int16_t *fat_cdts[] = { fat_cdt2, fat_cdt2, fat_cdt2, fat_cdt3, NULL };
-
-static const uint8_t pc_tbl2[] = {
-0x8,0x00,0x00,0x00,0x00,
-0x8,0x00,0x00,0x00,0x00,
-0x8,0x10,0x00,0x00,0x00,
-0x8,0x01,0x00,0x00,0x00,
-0x8,0x00,0x10,0x00,0x00,
-0x8,0x00,0x01,0x00,0x00,
-0x8,0x00,0x00,0x10,0x00,
-0x8,0x00,0x00,0x01,0x00,
-0x8,0x00,0x00,0x00,0x10,
-0x8,0x00,0x00,0x00,0x01,
-0x6,0x00,0x00,0x00,
-0x6,0x10,0x00,0x00,
-0x6,0x01,0x00,0x00,
-0x6,0x00,0x10,0x00,
-0x6,0x00,0x01,0x00,
-0x6,0x00,0x00,0x01,
-0x6,0x00,0x00,0x10,
-0x6,0x00,0x00,0x02,
-0x6,0x00,0x00,0x20,
-0x6,0x20,0x10,0x00,
-0x6,0x00,0x02,0x01,
-0x6,0x00,0x20,0x10,
-0x6,0x02,0x01,0x00,
-0x6,0x11,0x00,0x00,
-0x6,0x00,0x20,0x00,
-0x6,0x00,0x02,0x00,
-0x6,0x20,0x00,0x00,
-0x6,0x01,0x10,0x00,
-0x6,0x02,0x00,0x00,
-0x6,0x01,0x00,0x02,
-0x6,0x10,0x00,0x20,
-0x6,0x00,0x01,0x02,
-0x6,0x10,0x01,0x00,
-0x6,0x00,0x10,0x20,
-0x6,0x10,0x10,0x00,
-0x6,0x10,0x00,0x01,
-0x6,0x20,0x00,0x10,
-0x6,0x02,0x00,0x01,
-0x6,0x01,0x01,0x00,
-0x6,0x01,0x00,0x10,
-0x6,0x00,0x11,0x00,
-0x6,0x10,0x00,0x02,
-0x6,0x00,0x01,0x10,
-0x6,0x00,0x00,0x11,
-0x6,0x10,0x00,0x10,
-0x6,0x01,0x00,0x01,
-0x6,0x00,0x00,0x22,
-0x6,0x02,0x01,0x01,
-0x6,0x10,0x20,0x10,
-0x6,0x01,0x02,0x01,
-0x6,0x20,0x10,0x10,
-0x6,0x01,0x00,0x20,
-0x6,0x00,0x10,0x01,
-0x6,0x21,0x10,0x00,
-0x6,0x10,0x02,0x01,
-0x6,0x12,0x01,0x00,
-0x6,0x01,0x20,0x10,
-0x6,0x01,0x02,0x00,
-0x6,0x10,0x20,0x00,
-0x6,0x00,0x10,0x02,
-0x6,0x00,0x01,0x20,
-0x6,0x00,0x02,0x21,
-0x6,0x00,0x02,0x20,
-0x6,0x00,0x00,0x12,
-0x6,0x00,0x00,0x21,
-0x6,0x20,0x11,0x00,
-0x6,0x00,0x01,0x01,
-0x6,0x11,0x10,0x00,
-0x6,0x00,0x20,0x12,
-0x6,0x00,0x20,0x11,
-0x6,0x20,0x10,0x02,
-0x6,0x02,0x01,0x20,
-0x6,0x00,0x22,0x11,
-0x6,0x00,0x10,0x10,
-0x6,0x02,0x11,0x00,
-0x6,0x00,0x21,0x10,
-0x6,0x00,0x02,0x03,
-0x6,0x20,0x10,0x01,
-0x6,0x00,0x12,0x01,
-0x4,0x11,0x00,
-0x4,0x00,0x22,
-0x4,0x20,0x00,
-0x4,0x01,0x10,
-0x4,0x02,0x20,
-0x4,0x00,0x20,
-0x4,0x02,0x00,
-0x4,0x10,0x01,
-0x4,0x00,0x11,
-0x4,0x02,0x01,
-0x4,0x02,0x21,
-0x4,0x00,0x02,
-0x4,0x20,0x02,
-0x4,0x01,0x01,
-0x4,0x10,0x10,
-0x4,0x10,0x02,
-0x4,0x22,0x00,
-0x4,0x10,0x00,
-0x4,0x01,0x00,
-0x4,0x21,0x00,
-0x4,0x12,0x00,
-0x4,0x00,0x10,
-0x4,0x20,0x12,
-0x4,0x01,0x11,
-0x4,0x00,0x01,
-0x4,0x01,0x02,
-0x4,0x11,0x02,
-0x4,0x11,0x01,
-0x4,0x10,0x20,
-0x4,0x20,0x01,
-0x4,0x22,0x11,
-0x4,0x00,0x12,
-0x4,0x20,0x10,
-0x4,0x22,0x01,
-0x4,0x01,0x20,
-0x4,0x00,0x21,
-0x4,0x10,0x11,
-0x4,0x21,0x10,
-0x4,0x10,0x22,
-0x4,0x02,0x03,
-0x4,0x12,0x01,
-0x4,0x20,0x11,
-0x4,0x11,0x10,
-0x4,0x20,0x30,
-0x4,0x11,0x20,
-0x4,0x02,0x10,
-0x4,0x22,0x10,
-0x4,0x11,0x11,
-0x4,0x30,0x20,
-0x4,0x30,0x00,
-0x4,0x01,0x22,
-0x4,0x01,0x12,
-0x4,0x02,0x11,
-0x4,0x03,0x02,
-0x4,0x03,0x00,
-0x4,0x10,0x21,
-0x4,0x12,0x20,
-0x4,0x00,0x00,
-0x4,0x12,0x21,
-0x4,0x21,0x11,
-0x4,0x02,0x22,
-0x4,0x10,0x12,
-0x4,0x31,0x00,
-0x4,0x20,0x20,
-0x4,0x00,0x03,
-0x4,0x02,0x02,
-0x4,0x22,0x20,
-0x4,0x01,0x21,
-0x4,0x21,0x02,
-0x4,0x21,0x12,
-0x4,0x11,0x22,
-0x4,0x00,0x30,
-0x4,0x12,0x11,
-0x4,0x20,0x22,
-0x4,0x31,0x20,
-0x4,0x21,0x30,
-0x4,0x22,0x02,
-0x4,0x22,0x22,
-0x4,0x20,0x31,
-0x4,0x13,0x02,
-0x4,0x03,0x10,
-0x4,0x11,0x12,
-0x4,0x00,0x13,
-0x4,0x21,0x01,
-0x4,0x12,0x03,
-0x4,0x13,0x00,
-0x4,0x13,0x10,
-0x4,0x02,0x13,
-0x4,0x30,0x01,
-0x4,0x12,0x10,
-0x4,0x22,0x13,
-0x4,0x03,0x12,
-0x4,0x31,0x01,
-0x4,0x30,0x22,
-0x4,0x00,0x31,
-0x4,0x01,0x31,
-0x4,0x02,0x23,
-0x4,0x01,0x30,
-0x4,0x11,0x21,
-0x4,0x22,0x21,
-0x4,0x01,0x13,
-0x4,0x10,0x03,
-0x4,0x22,0x03,
-0x4,0x30,0x21,
-0x4,0x21,0x31,
-0x4,0x33,0x00,
-0x4,0x13,0x12,
-0x4,0x11,0x31,
-0x4,0x30,0x02,
-0x4,0x12,0x02,
-0x4,0x11,0x13,
-0x4,0x12,0x22,
-0x4,0x20,0x32,
-0x4,0x10,0x13,
-0x4,0x22,0x31,
-0x4,0x21,0x20,
-0x4,0x01,0x33,
-0x4,0x33,0x10,
-0x4,0x20,0x13,
-0x4,0x31,0x22,
-0x4,0x13,0x30,
-0x4,0x01,0x03,
-0x4,0x11,0x33,
-0x4,0x20,0x21,
-0x4,0x13,0x31,
-0x4,0x03,0x22,
-0x4,0x31,0x02,
-0x4,0x00,0x24,
-0x2,0x00,
-0x2,0x10,
-0x2,0x20,
-0x2,0x30,
-0x2,0x40,
-0x2,0x50,
-0x2,0x60,
-0x2,0x01,
-0x2,0x11,
-0x2,0x21,
-0x2,0x31,
-0x2,0x41,
-0x2,0x51,
-0x2,0x61,
-0x2,0x02,
-0x2,0x12,
-0x2,0x22,
-0x2,0x32,
-0x2,0x42,
-0x2,0x52,
-0x2,0x62,
-0x2,0x03,
-0x2,0x13,
-0x2,0x23,
-0x2,0x33,
-0x2,0x43,
-0x2,0x53,
-0x2,0x63,
-0x2,0x04,
-0x2,0x14,
-0x2,0x24,
-0x2,0x34,
-0x2,0x44,
-0x2,0x54,
-0x2,0x64,
-0x2,0x05,
-0x2,0x15,
-0x2,0x25,
-0x2,0x35,
-0x2,0x45,
-0x2,0x55,
-0x2,0x65,
-0x2,0x06,
-0x2,0x16,
-0x2,0x26,
-0x2,0x36,
-0x2,0x46,
-0x2,0x56,
-0x2,0x66
-};
-
-static const uint8_t pc_tbl3[] = {
-0x6,0x00,0x00,0x00,
-0x6,0x00,0x00,0x00,
-0x6,0x00,0x00,0x01,
-0x6,0x00,0x00,0x10,
-0x6,0x00,0x00,0x11,
-0x6,0x00,0x01,0x00,
-0x6,0x00,0x01,0x01,
-0x6,0x00,0x01,0x10,
-0x6,0x00,0x01,0x11,
-0x6,0x00,0x10,0x00,
-0x6,0x00,0x10,0x01,
-0x6,0x00,0x10,0x10,
-0x6,0x00,0x10,0x11,
-0x6,0x00,0x11,0x00,
-0x6,0x00,0x11,0x01,
-0x6,0x00,0x11,0x10,
-0x6,0x00,0x11,0x11,
-0x6,0x01,0x00,0x00,
-0x6,0x01,0x00,0x01,
-0x6,0x01,0x00,0x10,
-0x6,0x01,0x00,0x11,
-0x6,0x01,0x01,0x00,
-0x6,0x01,0x01,0x01,
-0x6,0x01,0x01,0x10,
-0x6,0x01,0x01,0x11,
-0x6,0x01,0x10,0x00,
-0x6,0x01,0x10,0x01,
-0x6,0x01,0x10,0x10,
-0x6,0x01,0x10,0x11,
-0x6,0x01,0x11,0x00,
-0x6,0x01,0x11,0x01,
-0x6,0x01,0x11,0x10,
-0x6,0x01,0x11,0x11,
-0x6,0x10,0x00,0x00,
-0x6,0x10,0x00,0x01,
-0x6,0x10,0x00,0x10,
-0x6,0x10,0x00,0x11,
-0x6,0x10,0x01,0x00,
-0x6,0x10,0x01,0x01,
-0x6,0x10,0x01,0x10,
-0x6,0x10,0x01,0x11,
-0x6,0x10,0x10,0x00,
-0x6,0x10,0x10,0x01,
-0x6,0x10,0x10,0x10,
-0x6,0x10,0x10,0x11,
-0x6,0x10,0x11,0x00,
-0x6,0x10,0x11,0x01,
-0x6,0x10,0x11,0x10,
-0x6,0x10,0x11,0x11,
-0x6,0x11,0x00,0x00,
-0x6,0x11,0x00,0x01,
-0x6,0x11,0x00,0x10,
-0x6,0x11,0x00,0x11,
-0x6,0x11,0x01,0x00,
-0x6,0x11,0x01,0x01,
-0x6,0x11,0x01,0x10,
-0x6,0x11,0x01,0x11,
-0x6,0x11,0x10,0x00,
-0x6,0x11,0x10,0x01,
-0x6,0x11,0x10,0x10,
-0x6,0x11,0x10,0x11,
-0x6,0x11,0x11,0x00,
-0x6,0x11,0x11,0x01,
-0x6,0x11,0x11,0x10,
-0x4,0x00,0x00,
-0x4,0x00,0x01,
-0x4,0x00,0x02,
-0x4,0x00,0x03,
-0x4,0x00,0x10,
-0x4,0x00,0x11,
-0x4,0x00,0x12,
-0x4,0x00,0x13,
-0x4,0x00,0x20,
-0x4,0x00,0x21,
-0x4,0x00,0x22,
-0x4,0x00,0x23,
-0x4,0x00,0x30,
-0x4,0x00,0x31,
-0x4,0x00,0x32,
-0x4,0x00,0x33,
-0x4,0x01,0x00,
-0x4,0x01,0x01,
-0x4,0x01,0x02,
-0x4,0x01,0x03,
-0x4,0x01,0x10,
-0x4,0x01,0x11,
-0x4,0x01,0x12,
-0x4,0x01,0x13,
-0x4,0x01,0x20,
-0x4,0x01,0x21,
-0x4,0x01,0x22,
-0x4,0x01,0x23,
-0x4,0x01,0x30,
-0x4,0x01,0x31,
-0x4,0x01,0x32,
-0x4,0x01,0x33,
-0x4,0x02,0x00,
-0x4,0x02,0x01,
-0x4,0x02,0x02,
-0x4,0x02,0x03,
-0x4,0x02,0x10,
-0x4,0x02,0x11,
-0x4,0x02,0x12,
-0x4,0x02,0x13,
-0x4,0x02,0x20,
-0x4,0x02,0x21,
-0x4,0x02,0x22,
-0x4,0x02,0x23,
-0x4,0x02,0x30,
-0x4,0x02,0x31,
-0x4,0x02,0x32,
-0x4,0x02,0x33,
-0x4,0x03,0x00,
-0x4,0x03,0x01,
-0x4,0x03,0x02,
-0x4,0x03,0x03,
-0x4,0x03,0x10,
-0x4,0x03,0x11,
-0x4,0x03,0x12,
-0x4,0x03,0x13,
-0x4,0x03,0x20,
-0x4,0x03,0x21,
-0x4,0x03,0x22,
-0x4,0x03,0x23,
-0x4,0x03,0x30,
-0x4,0x03,0x31,
-0x4,0x03,0x32,
-0x4,0x03,0x33,
-0x4,0x10,0x00,
-0x4,0x10,0x01,
-0x4,0x10,0x02,
-0x4,0x10,0x03,
-0x4,0x10,0x10,
-0x4,0x10,0x11,
-0x4,0x10,0x12,
-0x4,0x10,0x13,
-0x4,0x10,0x20,
-0x4,0x10,0x21,
-0x4,0x10,0x22,
-0x4,0x10,0x23,
-0x4,0x10,0x30,
-0x4,0x10,0x31,
-0x4,0x10,0x32,
-0x4,0x10,0x33,
-0x4,0x11,0x00,
-0x4,0x11,0x01,
-0x4,0x11,0x02,
-0x4,0x11,0x03,
-0x4,0x11,0x10,
-0x4,0x11,0x11,
-0x4,0x11,0x12,
-0x4,0x11,0x13,
-0x4,0x11,0x20,
-0x4,0x11,0x21,
-0x4,0x11,0x22,
-0x4,0x11,0x23,
-0x4,0x11,0x30,
-0x4,0x11,0x31,
-0x4,0x11,0x32,
-0x4,0x11,0x33,
-0x4,0x12,0x00,
-0x4,0x12,0x01,
-0x4,0x12,0x02,
-0x4,0x12,0x03,
-0x4,0x12,0x10,
-0x4,0x12,0x11,
-0x4,0x12,0x12,
-0x4,0x12,0x13,
-0x4,0x12,0x20,
-0x4,0x12,0x21,
-0x4,0x12,0x22,
-0x4,0x12,0x23,
-0x4,0x12,0x30,
-0x4,0x12,0x31,
-0x4,0x12,0x32,
-0x4,0x12,0x33,
-0x4,0x13,0x00,
-0x4,0x13,0x01,
-0x4,0x13,0x02,
-0x4,0x13,0x03,
-0x4,0x13,0x10,
-0x4,0x13,0x11,
-0x4,0x13,0x12,
-0x4,0x13,0x13,
-0x4,0x13,0x20,
-0x4,0x13,0x21,
-0x4,0x13,0x22,
-0x4,0x13,0x23,
-0x4,0x13,0x30,
-0x4,0x13,0x31,
-0x4,0x13,0x32,
-0x4,0x13,0x33,
-0x2,0x00,
-0x2,0x10,
-0x2,0x20,
-0x2,0x30,
-0x2,0x40,
-0x2,0x50,
-0x2,0x60,
-0x2,0x70,
-0x2,0x01,
-0x2,0x11,
-0x2,0x21,
-0x2,0x31,
-0x2,0x41,
-0x2,0x51,
-0x2,0x61,
-0x2,0x71,
-0x2,0x02,
-0x2,0x12,
-0x2,0x22,
-0x2,0x32,
-0x2,0x42,
-0x2,0x52,
-0x2,0x62,
-0x2,0x72,
-0x2,0x03,
-0x2,0x13,
-0x2,0x23,
-0x2,0x33,
-0x2,0x43,
-0x2,0x53,
-0x2,0x63,
-0x2,0x73,
-0x2,0x04,
-0x2,0x14,
-0x2,0x24,
-0x2,0x34,
-0x2,0x44,
-0x2,0x54,
-0x2,0x64,
-0x2,0x74,
-0x2,0x05,
-0x2,0x15,
-0x2,0x25,
-0x2,0x35,
-0x2,0x45,
-0x2,0x55,
-0x2,0x65,
-0x2,0x75,
-0x2,0x06,
-0x2,0x16,
-0x2,0x26,
-0x2,0x36,
-0x2,0x46,
-0x2,0x56,
-0x2,0x66,
-0x2,0x76,
-0x2,0x07,
-0x2,0x17,
-0x2,0x27,
-0x2,0x37,
-0x2,0x47,
-0x2,0x57,
-0x2,0x67,
-0x2,0x77
-};
-
-static const uint8_t pc_tbl4[] = {
-0x8,0x00,0x00,0x00,0x00,
-0x8,0x00,0x00,0x00,0x00,
-0x8,0x20,0x00,0x00,0x00,
-0x8,0x00,0x00,0x00,0x01,
-0x8,0x10,0x00,0x00,0x00,
-0x8,0x00,0x00,0x00,0x02,
-0x8,0x01,0x00,0x00,0x00,
-0x8,0x00,0x00,0x00,0x10,
-0x8,0x02,0x00,0x00,0x00,
-0x6,0x00,0x00,0x00,
-0x6,0x20,0x00,0x00,
-0x6,0x00,0x00,0x01,
-0x6,0x10,0x00,0x00,
-0x6,0x00,0x00,0x02,
-0x6,0x00,0x10,0x00,
-0x6,0x00,0x20,0x00,
-0x6,0x00,0x02,0x00,
-0x6,0x00,0x01,0x00,
-0x6,0x01,0x00,0x00,
-0x6,0x00,0x00,0x20,
-0x6,0x02,0x00,0x00,
-0x6,0x00,0x00,0x10,
-0x6,0x10,0x00,0x20,
-0x6,0x01,0x00,0x02,
-0x6,0x20,0x00,0x10,
-0x6,0x02,0x00,0x01,
-0x6,0x20,0x10,0x00,
-0x6,0x00,0x12,0x00,
-0x6,0x00,0x02,0x01,
-0x6,0x02,0x01,0x00,
-0x6,0x00,0x21,0x00,
-0x6,0x00,0x01,0x02,
-0x6,0x00,0x20,0x10,
-0x6,0x00,0x00,0x21,
-0x6,0x00,0x00,0x12,
-0x6,0x00,0x01,0x20,
-0x6,0x12,0x00,0x00,
-0x6,0x00,0x10,0x20,
-0x6,0x01,0x20,0x00,
-0x6,0x02,0x10,0x00,
-0x6,0x10,0x20,0x00,
-0x6,0x01,0x02,0x00,
-0x6,0x21,0x00,0x00,
-0x6,0x00,0x02,0x10,
-0x6,0x20,0x01,0x00,
-0x6,0x00,0x22,0x00,
-0x6,0x10,0x02,0x00,
-0x6,0x00,0x10,0x02,
-0x6,0x11,0x00,0x00,
-0x6,0x00,0x11,0x00,
-0x6,0x22,0x00,0x00,
-0x6,0x20,0x00,0x02,
-0x6,0x10,0x00,0x01,
-0x6,0x00,0x20,0x01,
-0x6,0x02,0x20,0x00,
-0x6,0x01,0x10,0x00,
-0x6,0x01,0x00,0x20,
-0x6,0x00,0x20,0x02,
-0x6,0x01,0x20,0x02,
-0x6,0x10,0x01,0x00,
-0x6,0x02,0x00,0x10,
-0x6,0x00,0x10,0x01,
-0x6,0x10,0x01,0x20,
-0x6,0x20,0x02,0x10,
-0x6,0x00,0x00,0x22,
-0x6,0x10,0x00,0x02,
-0x6,0x00,0x02,0x20,
-0x6,0x20,0x02,0x00,
-0x6,0x00,0x00,0x11,
-0x6,0x02,0x10,0x01,
-0x6,0x00,0x01,0x10,
-0x6,0x00,0x02,0x11,
-0x4,0x01,0x02,
-0x4,0x02,0x01,
-0x4,0x01,0x00,
-0x4,0x10,0x20,
-0x4,0x20,0x10,
-0x4,0x20,0x00,
-0x4,0x11,0x00,
-0x4,0x02,0x00,
-0x4,0x12,0x00,
-0x4,0x00,0x21,
-0x4,0x22,0x00,
-0x4,0x00,0x12,
-0x4,0x21,0x00,
-0x4,0x02,0x11,
-0x4,0x00,0x01,
-0x4,0x10,0x02,
-0x4,0x02,0x20,
-0x4,0x20,0x11,
-0x4,0x01,0x10,
-0x4,0x21,0x10,
-0x4,0x10,0x00,
-0x4,0x10,0x22,
-0x4,0x20,0x20,
-0x4,0x00,0x22,
-0x4,0x01,0x22,
-0x4,0x20,0x01,
-0x4,0x02,0x02,
-0x4,0x00,0x20,
-0x4,0x00,0x10,
-0x4,0x00,0x11,
-0x4,0x22,0x01,
-0x4,0x11,0x20,
-0x4,0x12,0x01,
-0x4,0x12,0x20,
-0x4,0x11,0x02,
-0x4,0x10,0x10,
-0x4,0x01,0x01,
-0x4,0x02,0x21,
-0x4,0x20,0x12,
-0x4,0x01,0x12,
-0x4,0x22,0x11,
-0x4,0x21,0x12,
-0x4,0x22,0x10,
-0x4,0x21,0x02,
-0x4,0x20,0x02,
-0x4,0x10,0x01,
-0x4,0x00,0x02,
-0x4,0x10,0x21,
-0x4,0x01,0x20,
-0x4,0x11,0x22,
-0x4,0x12,0x21,
-0x4,0x22,0x20,
-0x4,0x02,0x10,
-0x4,0x02,0x22,
-0x4,0x11,0x10,
-0x4,0x22,0x02,
-0x4,0x20,0x21,
-0x4,0x01,0x11,
-0x4,0x11,0x01,
-0x4,0x10,0x12,
-0x4,0x02,0x12,
-0x4,0x20,0x22,
-0x4,0x21,0x20,
-0x4,0x01,0x21,
-0x4,0x12,0x02,
-0x4,0x21,0x11,
-0x4,0x12,0x22,
-0x4,0x12,0x10,
-0x4,0x22,0x21,
-0x4,0x10,0x11,
-0x4,0x21,0x01,
-0x4,0x11,0x12,
-0x4,0x12,0x11,
-0x4,0x66,0x66,
-0x4,0x22,0x22,
-0x4,0x11,0x21,
-0x4,0x11,0x11,
-0x4,0x21,0x22,
-0x4,0x00,0x00,
-0x4,0x22,0x12,
-0x4,0x12,0x12,
-0x4,0x21,0x21,
-0x4,0x42,0x00,
-0x4,0x00,0x04,
-0x4,0x40,0x00,
-0x4,0x30,0x00,
-0x4,0x31,0x00,
-0x4,0x00,0x03,
-0x4,0x00,0x14,
-0x4,0x00,0x13,
-0x4,0x01,0x24,
-0x4,0x20,0x13,
-0x4,0x01,0x42,
-0x4,0x14,0x20,
-0x4,0x42,0x02,
-0x4,0x13,0x00,
-0x4,0x00,0x24,
-0x4,0x31,0x20,
-0x4,0x22,0x13,
-0x4,0x11,0x24,
-0x4,0x12,0x66,
-0x4,0x30,0x01,
-0x4,0x02,0x13,
-0x4,0x12,0x42,
-0x4,0x40,0x10,
-0x4,0x40,0x02,
-0x4,0x01,0x04,
-0x4,0x24,0x00,
-0x4,0x42,0x10,
-0x4,0x21,0x13,
-0x4,0x13,0x12,
-0x4,0x31,0x21,
-0x4,0x21,0x24,
-0x4,0x00,0x40,
-0x4,0x10,0x24,
-0x4,0x10,0x42,
-0x4,0x32,0x01,
-0x4,0x11,0x42,
-0x4,0x20,0x31,
-0x4,0x12,0x40,
-0x2,0x00,
-0x2,0x10,
-0x2,0x20,
-0x2,0x30,
-0x2,0x40,
-0x2,0x50,
-0x2,0x60,
-0x2,0x70,
-0x2,0x01,
-0x2,0x11,
-0x2,0x21,
-0x2,0x31,
-0x2,0x41,
-0x2,0x51,
-0x2,0x61,
-0x2,0x71,
-0x2,0x02,
-0x2,0x12,
-0x2,0x22,
-0x2,0x32,
-0x2,0x42,
-0x2,0x52,
-0x2,0x62,
-0x2,0x72,
-0x2,0x03,
-0x2,0x13,
-0x2,0x23,
-0x2,0x33,
-0x2,0x43,
-0x2,0x53,
-0x2,0x63,
-0x2,0x73,
-0x2,0x04,
-0x2,0x14,
-0x2,0x24,
-0x2,0x34,
-0x2,0x44,
-0x2,0x54,
-0x2,0x64,
-0x2,0x74,
-0x2,0x05,
-0x2,0x15,
-0x2,0x25,
-0x2,0x35,
-0x2,0x45,
-0x2,0x55,
-0x2,0x65,
-0x2,0x75,
-0x2,0x06,
-0x2,0x16,
-0x2,0x26,
-0x2,0x36,
-0x2,0x46,
-0x2,0x56,
-0x2,0x66,
-0x2,0x76,
-0x2,0x07,
-0x2,0x17,
-0x2,0x27,
-0x2,0x37,
-0x2,0x47,
-0x2,0x57,
-0x2,0x67,
-0x2,0x77
-};
-
-static const uint8_t *tables[] = { pc_tbl2, pc_tbl3, pc_tbl4 };
-#endif
--- a/src/ffmpeg/libavcodec/truemotion2.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,893 +0,0 @@
-/*
- * Duck/ON2 TrueMotion 2 Decoder
- * Copyright (c) 2005 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-/**
- * @file truemotion2.c
- * Duck TrueMotion2 decoder.
- */
-
-#include "avcodec.h"
-#include "common.h"
-#include "bitstream.h"
-#include "dsputil.h"
-
-#define TM2_ESCAPE 0x80000000
-#define TM2_DELTAS 64
-/* Huffman-coded streams of different types of blocks */
-enum TM2_STREAMS{ TM2_C_HI = 0, TM2_C_LO, TM2_L_HI, TM2_L_LO,
-     TM2_UPD, TM2_MOT, TM2_TYPE, TM2_NUM_STREAMS};
-/* Block types */
-enum TM2_BLOCKS{ TM2_HI_RES = 0, TM2_MED_RES, TM2_LOW_RES, TM2_NULL_RES,
-                 TM2_UPDATE, TM2_STILL, TM2_MOTION};
-
-typedef struct TM2Context{
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    GetBitContext gb;
-    DSPContext dsp;
-
-    /* TM2 streams */
-    int *tokens[TM2_NUM_STREAMS];
-    int tok_lens[TM2_NUM_STREAMS];
-    int tok_ptrs[TM2_NUM_STREAMS];
-    int deltas[TM2_NUM_STREAMS][TM2_DELTAS];
-    /* for blocks decoding */
-    int D[4];
-    int CD[4];
-    int *last;
-    int *clast;
-
-    /* data for current and previous frame */
-    int *Y1, *U1, *V1, *Y2, *U2, *V2;
-    int cur;
-} TM2Context;
-
-/**
-* Huffman codes for each of streams
-*/
-typedef struct TM2Codes{
-    VLC vlc; ///< table for FFmpeg bitstream reader
-    int bits;
-    int *recode; ///< table for converting from code indexes to values
-    int length;
-} TM2Codes;
-
-/**
-* structure for gathering Huffman codes information
-*/
-typedef struct TM2Huff{
-    int val_bits; ///< length of literal
-    int max_bits; ///< maximum length of code
-    int min_bits; ///< minimum length of code
-    int nodes; ///< total number of nodes in tree
-    int num; ///< current number filled
-    int max_num; ///< total number of codes
-    int *nums; ///< literals
-    uint32_t *bits; ///< codes
-    int *lens; ///< codelengths
-} TM2Huff;
-
-static int tm2_read_tree(TM2Context *ctx, uint32_t prefix, int length, TM2Huff *huff)
-{
-    if(length > huff->max_bits) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Tree exceeded its given depth (%i)\n", huff->max_bits);
-        return -1;
-    }
-
-    if(!get_bits1(&ctx->gb)) { /* literal */
-        if (length == 0) {
-            length = 1;
-        }
-        if(huff->num >= huff->max_num) {
-            av_log(ctx->avctx, AV_LOG_DEBUG, "Too many literals\n");
-            return -1;
-        }
-        huff->nums[huff->num] = get_bits_long(&ctx->gb, huff->val_bits);
-        huff->bits[huff->num] = prefix;
-        huff->lens[huff->num] = length;
-        huff->num++;
-        return 0;
-    } else { /* non-terminal node */
-        if(tm2_read_tree(ctx, prefix << 1, length + 1, huff) == -1)
-            return -1;
-        if(tm2_read_tree(ctx, (prefix << 1) | 1, length + 1, huff) == -1)
-            return -1;
-    }
-    return 0;
-}
-
-static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
-{
-    TM2Huff huff;
-    int res = 0;
-
-    huff.val_bits = get_bits(&ctx->gb, 5);
-    huff.max_bits = get_bits(&ctx->gb, 5);
-    huff.min_bits = get_bits(&ctx->gb, 5);
-    huff.nodes = get_bits_long(&ctx->gb, 17);
-    huff.num = 0;
-
-    /* check for correct codes parameters */
-    if((huff.val_bits < 1) || (huff.val_bits > 32) ||
-       (huff.max_bits < 0) || (huff.max_bits > 32)) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n",
-               huff.val_bits, huff.max_bits);
-        return -1;
-    }
-    if((huff.nodes < 0) || (huff.nodes > 0x10000)) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\n", huff.nodes);
-        return -1;
-    }
-    /* one-node tree */
-    if(huff.max_bits == 0)
-        huff.max_bits = 1;
-
-    /* allocate space for codes - it is exactly ceil(nodes / 2) entries */
-    huff.max_num = (huff.nodes + 1) >> 1;
-    huff.nums = av_mallocz(huff.max_num * sizeof(int));
-    huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t));
-    huff.lens = av_mallocz(huff.max_num * sizeof(int));
-
-    if(tm2_read_tree(ctx, 0, 0, &huff) == -1)
-        res = -1;
-
-    if(huff.num != huff.max_num) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Got less codes than expected: %i of %i\n",
-               huff.num, huff.max_num);
-        res = -1;
-    }
-
-    /* convert codes to vlc_table */
-    if(res != -1) {
-        int i;
-
-        res = init_vlc(&code->vlc, huff.max_bits, huff.max_num,
-                    huff.lens, sizeof(int), sizeof(int),
-                    huff.bits, sizeof(uint32_t), sizeof(uint32_t), 0);
-        if(res < 0) {
-            av_log(ctx->avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
-            res = -1;
-        } else
-            res = 0;
-        if(res != -1) {
-            code->bits = huff.max_bits;
-            code->length = huff.max_num;
-            code->recode = av_malloc(code->length * sizeof(int));
-            for(i = 0; i < code->length; i++)
-                code->recode[i] = huff.nums[i];
-        }
-    }
-    /* free allocated memory */
-    av_free(huff.nums);
-    av_free(huff.bits);
-    av_free(huff.lens);
-
-    return res;
-}
-
-static void tm2_free_codes(TM2Codes *code)
-{
-    if(code->recode)
-        av_free(code->recode);
-    if(code->vlc.table)
-        free_vlc(&code->vlc);
-}
-
-static inline int tm2_get_token(GetBitContext *gb, TM2Codes *code)
-{
-    int val;
-    val = get_vlc2(gb, code->vlc.table, code->bits, 1);
-    return code->recode[val];
-}
-
-static inline int tm2_read_header(TM2Context *ctx, uint8_t *buf)
-{
-    uint32_t magic;
-    uint8_t *obuf;
-    int length;
-
-    obuf = buf;
-
-    magic = LE_32(buf);
-    buf += 4;
-
-    if(magic == 0x00000100) { /* old header */
-/*      av_log (ctx->avctx, AV_LOG_ERROR, "TM2 old header: not implemented (yet)\n"); */
-        return 40;
-    } else if(magic == 0x00000101) { /* new header */
-        int w, h, size, flags, xr, yr;
-
-        length = LE_32(buf);
-        buf += 4;
-
-        init_get_bits(&ctx->gb, buf, 32 * 8);
-        size = get_bits_long(&ctx->gb, 31);
-        h = get_bits(&ctx->gb, 15);
-        w = get_bits(&ctx->gb, 15);
-        flags = get_bits_long(&ctx->gb, 31);
-        yr = get_bits(&ctx->gb, 9);
-        xr = get_bits(&ctx->gb, 9);
-
-        return 40;
-    } else {
-        av_log (ctx->avctx, AV_LOG_ERROR, "Not a TM2 header: 0x%08X\n", magic);
-        return -1;
-    }
-
-    return (buf - obuf);
-}
-
-static int tm2_read_deltas(TM2Context *ctx, int stream_id) {
-    int d, mb;
-    int i, v;
-
-    d = get_bits(&ctx->gb, 9);
-    mb = get_bits(&ctx->gb, 5);
-
-    if((d < 1) || (d > TM2_DELTAS) || (mb < 1) || (mb > 32)) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect delta table: %i deltas x %i bits\n", d, mb);
-        return -1;
-    }
-
-    for(i = 0; i < d; i++) {
-        v = get_bits_long(&ctx->gb, mb);
-        if(v & (1 << (mb - 1)))
-            ctx->deltas[stream_id][i] = v - (1 << mb);
-        else
-            ctx->deltas[stream_id][i] = v;
-    }
-    for(; i < TM2_DELTAS; i++)
-        ctx->deltas[stream_id][i] = 0;
-
-    return 0;
-}
-
-static int tm2_read_stream(TM2Context *ctx, uint8_t *buf, int stream_id) {
-    int i;
-    int cur = 0;
-    int skip = 0;
-    int len, toks;
-    TM2Codes codes;
-
-    /* get stream length in dwords */
-    len = BE_32(buf); buf += 4; cur += 4;
-    skip = len * 4 + 4;
-
-    if(len == 0)
-        return 4;
-
-    toks = BE_32(buf); buf += 4; cur += 4;
-    if(toks & 1) {
-        len = BE_32(buf); buf += 4; cur += 4;
-        if(len == TM2_ESCAPE) {
-            len = BE_32(buf); buf += 4; cur += 4;
-        }
-        if(len > 0) {
-            init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
-            if(tm2_read_deltas(ctx, stream_id) == -1)
-                return -1;
-            buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
-            cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
-        }
-    }
-    /* skip unused fields */
-    if(BE_32(buf) == TM2_ESCAPE) {
-        buf += 4; cur += 4; /* some unknown length - could be escaped too */
-    }
-    buf += 4; cur += 4;
-    buf += 4; cur += 4; /* unused by decoder */
-
-    init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
-    if(tm2_build_huff_table(ctx, &codes) == -1)
-        return -1;
-    buf += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
-    cur += ((get_bits_count(&ctx->gb) + 31) >> 5) << 2;
-
-    toks >>= 1;
-    /* check if we have sane number of tokens */
-    if((toks < 0) || (toks > 0xFFFFFF)){
-        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of tokens: %i\n", toks);
-        tm2_free_codes(&codes);
-        return -1;
-    }
-    ctx->tokens[stream_id] = av_realloc(ctx->tokens[stream_id], toks * sizeof(int));
-    ctx->tok_lens[stream_id] = toks;
-    len = BE_32(buf); buf += 4; cur += 4;
-    if(len > 0) {
-        init_get_bits(&ctx->gb, buf, (skip - cur) * 8);
-        for(i = 0; i < toks; i++)
-            ctx->tokens[stream_id][i] = tm2_get_token(&ctx->gb, &codes);
-    } else {
-        for(i = 0; i < toks; i++)
-            ctx->tokens[stream_id][i] = codes.recode[0];
-    }
-    tm2_free_codes(&codes);
-
-    return skip;
-}
-
-static inline int GET_TOK(TM2Context *ctx,int type) {
-    if(ctx->tok_ptrs[type] >= ctx->tok_lens[type]) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "Read token from stream %i out of bounds (%i>=%i)\n", type, ctx->tok_ptrs[type], ctx->tok_lens[type]);
-        return 0;
-    }
-    if(type <= TM2_MOT)
-        return ctx->deltas[type][ctx->tokens[type][ctx->tok_ptrs[type]++]];
-    return ctx->tokens[type][ctx->tok_ptrs[type]++];
-}
-
-/* blocks decoding routines */
-
-/* common Y, U, V pointers initialisation */
-#define TM2_INIT_POINTERS() \
-    int *last, *clast; \
-    int *Y, *U, *V;\
-    int Ystride, Ustride, Vstride;\
-\
-    Ystride = ctx->avctx->width;\
-    Vstride = (ctx->avctx->width + 1) >> 1;\
-    Ustride = (ctx->avctx->width + 1) >> 1;\
-    Y = (ctx->cur?ctx->Y2:ctx->Y1) + by * 4 * Ystride + bx * 4;\
-    V = (ctx->cur?ctx->V2:ctx->V1) + by * 2 * Vstride + bx * 2;\
-    U = (ctx->cur?ctx->U2:ctx->U1) + by * 2 * Ustride + bx * 2;\
-    last = ctx->last + bx * 4;\
-    clast = ctx->clast + bx * 4;
-
-#define TM2_INIT_POINTERS_2() \
-    int *Yo, *Uo, *Vo;\
-    int oYstride, oUstride, oVstride;\
-\
-    TM2_INIT_POINTERS();\
-    oYstride = Ystride;\
-    oVstride = Vstride;\
-    oUstride = Ustride;\
-    Yo = (ctx->cur?ctx->Y1:ctx->Y2) + by * 4 * oYstride + bx * 4;\
-    Vo = (ctx->cur?ctx->V1:ctx->V2) + by * 2 * oVstride + bx * 2;\
-    Uo = (ctx->cur?ctx->U1:ctx->U2) + by * 2 * oUstride + bx * 2;
-
-/* recalculate last and delta values for next blocks */
-#define TM2_RECALC_BLOCK(CHR, stride, last, CD) {\
-    CD[0] = (CHR[1] - 128) - last[1];\
-    CD[1] = (int)CHR[stride + 1] - (int)CHR[1];\
-    last[0] = (int)CHR[stride + 0] - 128;\
-    last[1] = (int)CHR[stride + 1] - 128;}
-
-/* common operations - add deltas to 4x4 block of luma or 2x2 blocks of chroma */
-static inline void tm2_apply_deltas(TM2Context *ctx, int* Y, int stride, int *deltas, int *last)
-{
-    int ct, d;
-    int i, j;
-
-    for(j = 0; j < 4; j++){
-        ct = ctx->D[j];
-        for(i = 0; i < 4; i++){
-            d = deltas[i + j * 4];
-            ct += d;
-            last[i] += ct;
-            Y[i] = clip_uint8(last[i]);
-        }
-        Y += stride;
-        ctx->D[j] = ct;
-    }
-}
-
-static inline void tm2_high_chroma(int *data, int stride, int *last, int *CD, int *deltas)
-{
-    int i, j;
-    for(j = 0; j < 2; j++){
-        for(i = 0; i < 2; i++){
-            CD[j] += deltas[i + j * 2];
-            last[i] += CD[j];
-            data[i] = last[i] + 128;
-        }
-        data += stride;
-    }
-}
-
-static inline void tm2_low_chroma(int *data, int stride, int *clast, int *CD, int *deltas, int bx)
-{
-    int t;
-    int l;
-    int prev;
-
-    if(bx > 0)
-        prev = clast[-3];
-    else
-        prev = 0;
-    t = (CD[0] + CD[1]) >> 1;
-    l = (prev - CD[0] - CD[1] + clast[1]) >> 1;
-    CD[1] = CD[0] + CD[1] - t;
-    CD[0] = t;
-    clast[0] = l;
-
-    tm2_high_chroma(data, stride, clast, CD, deltas);
-}
-
-static inline void tm2_hi_res_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i;
-    int deltas[16];
-    TM2_INIT_POINTERS();
-
-    /* hi-res chroma */
-    for(i = 0; i < 4; i++) {
-        deltas[i] = GET_TOK(ctx, TM2_C_HI);
-        deltas[i + 4] = GET_TOK(ctx, TM2_C_HI);
-    }
-    tm2_high_chroma(U, Ustride, clast, ctx->CD, deltas);
-    tm2_high_chroma(V, Vstride, clast + 2, ctx->CD + 2, deltas + 4);
-
-    /* hi-res luma */
-    for(i = 0; i < 16; i++)
-        deltas[i] = GET_TOK(ctx, TM2_L_HI);
-
-    tm2_apply_deltas(ctx, Y, Ystride, deltas, last);
-}
-
-static inline void tm2_med_res_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i;
-    int deltas[16];
-    TM2_INIT_POINTERS();
-
-    /* low-res chroma */
-    deltas[0] = GET_TOK(ctx, TM2_C_LO);
-    deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(U, Ustride, clast, ctx->CD, deltas, bx);
-
-    deltas[0] = GET_TOK(ctx, TM2_C_LO);
-    deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(V, Vstride, clast + 2, ctx->CD + 2, deltas, bx);
-
-    /* hi-res luma */
-    for(i = 0; i < 16; i++)
-        deltas[i] = GET_TOK(ctx, TM2_L_HI);
-
-    tm2_apply_deltas(ctx, Y, Ystride, deltas, last);
-}
-
-static inline void tm2_low_res_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i;
-    int t1, t2;
-    int deltas[16];
-    TM2_INIT_POINTERS();
-
-    /* low-res chroma */
-    deltas[0] = GET_TOK(ctx, TM2_C_LO);
-    deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(U, Ustride, clast, ctx->CD, deltas, bx);
-
-    deltas[0] = GET_TOK(ctx, TM2_C_LO);
-    deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(V, Vstride, clast + 2, ctx->CD + 2, deltas, bx);
-
-    /* low-res luma */
-    for(i = 0; i < 16; i++)
-        deltas[i] = 0;
-
-    deltas[ 0] = GET_TOK(ctx, TM2_L_LO);
-    deltas[ 2] = GET_TOK(ctx, TM2_L_LO);
-    deltas[ 8] = GET_TOK(ctx, TM2_L_LO);
-    deltas[10] = GET_TOK(ctx, TM2_L_LO);
-
-    if(bx > 0)
-        last[0] = (last[-1] - ctx->D[0] - ctx->D[1] - ctx->D[2] - ctx->D[3] + last[1]) >> 1;
-    else
-        last[0] = (last[1]  - ctx->D[0] - ctx->D[1] - ctx->D[2] - ctx->D[3])>> 1;
-    last[2] = (last[1] + last[3]) >> 1;
-
-    t1 = ctx->D[0] + ctx->D[1];
-    ctx->D[0] = t1 >> 1;
-    ctx->D[1] = t1 - (t1 >> 1);
-    t2 = ctx->D[2] + ctx->D[3];
-    ctx->D[2] = t2 >> 1;
-    ctx->D[3] = t2 - (t2 >> 1);
-
-    tm2_apply_deltas(ctx, Y, Ystride, deltas, last);
-}
-
-static inline void tm2_null_res_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i;
-    int ct;
-    int left, right, diff;
-    int deltas[16];
-    TM2_INIT_POINTERS();
-
-    /* null chroma */
-    deltas[0] = deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(U, Ustride, clast, ctx->CD, deltas, bx);
-
-    deltas[0] = deltas[1] = deltas[2] = deltas[3] = 0;
-    tm2_low_chroma(V, Vstride, clast + 2, ctx->CD + 2, deltas, bx);
-
-    /* null luma */
-    for(i = 0; i < 16; i++)
-        deltas[i] = 0;
-
-    ct = ctx->D[0] + ctx->D[1] + ctx->D[2] + ctx->D[3];
-
-    if(bx > 0)
-        left = last[-1] - ct;
-    else
-        left = 0;
-
-    right = last[3];
-    diff = right - left;
-    last[0] = left + (diff >> 2);
-    last[1] = left + (diff >> 1);
-    last[2] = right - (diff >> 2);
-    last[3] = right;
-    {
-        int tp = left;
-
-        ctx->D[0] = (tp + (ct >> 2)) - left;
-        left += ctx->D[0];
-        ctx->D[1] = (tp + (ct >> 1)) - left;
-        left += ctx->D[1];
-        ctx->D[2] = ((tp + ct) - (ct >> 2)) - left;
-        left += ctx->D[2];
-        ctx->D[3] = (tp + ct) - left;
-    }
-    tm2_apply_deltas(ctx, Y, Ystride, deltas, last);
-}
-
-static inline void tm2_still_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i, j;
-    TM2_INIT_POINTERS_2();
-
-    /* update chroma */
-    for(j = 0; j < 2; j++){
-        for(i = 0; i < 2; i++){
-            U[i] = Uo[i];
-            V[i] = Vo[i];
-        }
-        U += Ustride; V += Vstride;
-        Uo += oUstride; Vo += oVstride;
-    }
-    U -= Ustride * 2;
-    V -= Vstride * 2;
-    TM2_RECALC_BLOCK(U, Ustride, clast, ctx->CD);
-    TM2_RECALC_BLOCK(V, Vstride, (clast + 2), (ctx->CD + 2));
-
-    /* update deltas */
-    ctx->D[0] = Yo[3] - last[3];
-    ctx->D[1] = Yo[3 + oYstride] - Yo[3];
-    ctx->D[2] = Yo[3 + oYstride * 2] - Yo[3 + oYstride];
-    ctx->D[3] = Yo[3 + oYstride * 3] - Yo[3 + oYstride * 2];
-
-    for(j = 0; j < 4; j++){
-        for(i = 0; i < 4; i++){
-            Y[i] = Yo[i];
-            last[i] = Yo[i];
-        }
-        Y += Ystride;
-        Yo += oYstride;
-    }
-}
-
-static inline void tm2_update_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i, j;
-    int d;
-    TM2_INIT_POINTERS_2();
-
-    /* update chroma */
-    for(j = 0; j < 2; j++){
-        for(i = 0; i < 2; i++){
-            U[i] = Uo[i] + GET_TOK(ctx, TM2_UPD);
-            V[i] = Vo[i] + GET_TOK(ctx, TM2_UPD);
-        }
-        U += Ustride; V += Vstride;
-        Uo += oUstride; Vo += oVstride;
-    }
-    U -= Ustride * 2;
-    V -= Vstride * 2;
-    TM2_RECALC_BLOCK(U, Ustride, clast, ctx->CD);
-    TM2_RECALC_BLOCK(V, Vstride, (clast + 2), (ctx->CD + 2));
-
-    /* update deltas */
-    ctx->D[0] = Yo[3] - last[3];
-    ctx->D[1] = Yo[3 + oYstride] - Yo[3];
-    ctx->D[2] = Yo[3 + oYstride * 2] - Yo[3 + oYstride];
-    ctx->D[3] = Yo[3 + oYstride * 3] - Yo[3 + oYstride * 2];
-
-    for(j = 0; j < 4; j++){
-        d = last[3];
-        for(i = 0; i < 4; i++){
-            Y[i] = Yo[i] + GET_TOK(ctx, TM2_UPD);
-            last[i] = Y[i];
-        }
-        ctx->D[j] = last[3] - d;
-        Y += Ystride;
-        Yo += oYstride;
-    }
-}
-
-static inline void tm2_motion_block(TM2Context *ctx, AVFrame *pic, int bx, int by)
-{
-    int i, j;
-    int mx, my;
-    TM2_INIT_POINTERS_2();
-
-    mx = GET_TOK(ctx, TM2_MOT);
-    my = GET_TOK(ctx, TM2_MOT);
-
-    Yo += my * oYstride + mx;
-    Uo += (my >> 1) * oUstride + (mx >> 1);
-    Vo += (my >> 1) * oVstride + (mx >> 1);
-
-    /* copy chroma */
-    for(j = 0; j < 2; j++){
-        for(i = 0; i < 2; i++){
-            U[i] = Uo[i];
-            V[i] = Vo[i];
-        }
-        U += Ustride; V += Vstride;
-        Uo += oUstride; Vo += oVstride;
-    }
-    U -= Ustride * 2;
-    V -= Vstride * 2;
-    TM2_RECALC_BLOCK(U, Ustride, clast, ctx->CD);
-    TM2_RECALC_BLOCK(V, Vstride, (clast + 2), (ctx->CD + 2));
-
-    /* copy luma */
-    for(j = 0; j < 4; j++){
-        for(i = 0; i < 4; i++){
-            Y[i] = Yo[i];
-        }
-        Y += Ystride;
-        Yo += oYstride;
-    }
-    /* calculate deltas */
-    Y -= Ystride * 4;
-    ctx->D[0] = Y[3] - last[3];
-    ctx->D[1] = Y[3 + Ystride] - Y[3];
-    ctx->D[2] = Y[3 + Ystride * 2] - Y[3 + Ystride];
-    ctx->D[3] = Y[3 + Ystride * 3] - Y[3 + Ystride * 2];
-    for(i = 0; i < 4; i++)
-        last[i] = Y[i + Ystride * 3];
-}
-
-static int tm2_decode_blocks(TM2Context *ctx, AVFrame *p)
-{
-    int i, j;
-    int bw, bh;
-    int type;
-    int keyframe = 1;
-    uint8_t *Y, *U, *V;
-    int *src;
-
-    bw = ctx->avctx->width >> 2;
-    bh = ctx->avctx->height >> 2;
-
-    for(i = 0; i < TM2_NUM_STREAMS; i++)
-        ctx->tok_ptrs[i] = 0;
-
-    if (ctx->tok_lens[TM2_TYPE]<bw*bh){
-        av_log(ctx->avctx,AV_LOG_ERROR,"Got %i tokens for %i blocks\n",ctx->tok_lens[TM2_TYPE],bw*bh);
-        return -1;
-    }
-
-    memset(ctx->last, 0, 4 * bw * sizeof(int));
-    memset(ctx->clast, 0, 4 * bw * sizeof(int));
-
-    for(j = 0; j < bh; j++) {
-        memset(ctx->D, 0, 4 * sizeof(int));
-        memset(ctx->CD, 0, 4 * sizeof(int));
-        for(i = 0; i < bw; i++) {
-            type = GET_TOK(ctx, TM2_TYPE);
-            switch(type) {
-            case TM2_HI_RES:
-                tm2_hi_res_block(ctx, p, i, j);
-                break;
-            case TM2_MED_RES:
-                tm2_med_res_block(ctx, p, i, j);
-                break;
-            case TM2_LOW_RES:
-                tm2_low_res_block(ctx, p, i, j);
-                break;
-            case TM2_NULL_RES:
-                tm2_null_res_block(ctx, p, i, j);
-                break;
-            case TM2_UPDATE:
-                tm2_update_block(ctx, p, i, j);
-                keyframe = 0;
-                break;
-            case TM2_STILL:
-                tm2_still_block(ctx, p, i, j);
-                keyframe = 0;
-                break;
-            case TM2_MOTION:
-                tm2_motion_block(ctx, p, i, j);
-                keyframe = 0;
-                break;
-            default:
-                av_log(ctx->avctx, AV_LOG_ERROR, "Skipping unknown block type %i\n", type);
-            }
-        }
-    }
-
-    /* copy data from our buffer to AVFrame */
-    Y = p->data[0];
-    src = (ctx->cur?ctx->Y2:ctx->Y1);
-    for(j = 0; j < ctx->avctx->height; j++){
-        for(i = 0; i < ctx->avctx->width; i++){
-            Y[i] = clip_uint8(*src++);
-        }
-        Y += p->linesize[0];
-    }
-    U = p->data[2];
-    src = (ctx->cur?ctx->U2:ctx->U1);
-    for(j = 0; j < (ctx->avctx->height + 1) >> 1; j++){
-        for(i = 0; i < (ctx->avctx->width + 1) >> 1; i++){
-            U[i] = clip_uint8(*src++);
-        }
-        U += p->linesize[2];
-    }
-    V = p->data[1];
-    src = (ctx->cur?ctx->V2:ctx->V1);
-    for(j = 0; j < (ctx->avctx->height + 1) >> 1; j++){
-        for(i = 0; i < (ctx->avctx->width + 1) >> 1; i++){
-            V[i] = clip_uint8(*src++);
-        }
-        V += p->linesize[1];
-    }
-
-    return keyframe;
-}
-
-static int decode_frame(AVCodecContext *avctx,
-                        void *data, int *data_size,
-                        uint8_t *buf, int buf_size)
-{
-    TM2Context * const l = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&l->pic;
-    int skip, t;
-
-    p->reference = 1;
-    p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if(avctx->reget_buffer(avctx, p) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    l->dsp.bswap_buf((uint32_t*)buf, (uint32_t*)buf, buf_size >> 2);
-    skip = tm2_read_header(l, buf);
-
-    if(skip == -1)
-        return -1;
-
-    t = tm2_read_stream(l, buf + skip, TM2_C_HI);
-    if(t == -1)
-        return -1;
-    skip += t;
-    t = tm2_read_stream(l, buf + skip, TM2_C_LO);
-    if(t == -1)
-        return -1;
-    skip += t;
-    t = tm2_read_stream(l, buf + skip, TM2_L_HI);
-    if(t == -1)
-        return -1;
-    skip += t;
-    t = tm2_read_stream(l, buf + skip, TM2_L_LO);
-    if(t == -1)
-        return -1;
-    skip += t;
-    t = tm2_read_stream(l, buf + skip, TM2_UPD);
-    if(t == -1)
-        return -1;
-    skip += t;
-    t = tm2_read_stream(l, buf + skip, TM2_MOT);
-    if(t == -1)
-        return -1;
-    skip += t;
-    t = tm2_read_stream(l, buf + skip, TM2_TYPE);
-    if(t == -1)
-        return -1;
-    p->key_frame = tm2_decode_blocks(l, p);
-    if(p->key_frame)
-        p->pict_type = FF_I_TYPE;
-    else
-        p->pict_type = FF_P_TYPE;
-
-    l->cur = !l->cur;
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = l->pic;
-
-    return buf_size;
-}
-
-static int decode_init(AVCodecContext *avctx){
-    TM2Context * const l = avctx->priv_data;
-    int i;
-
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return -1;
-    }
-    if((avctx->width & 3) || (avctx->height & 3)){
-        av_log(avctx, AV_LOG_ERROR, "Width and height must be multiple of 4\n");
-        return -1;
-    }
-
-    l->avctx = avctx;
-    l->pic.data[0]=NULL;
-    avctx->has_b_frames = 0;
-    avctx->pix_fmt = PIX_FMT_YUV420P;
-
-    dsputil_init(&l->dsp, avctx);
-
-    l->last = av_malloc(4 * sizeof(int) * (avctx->width >> 2));
-    l->clast = av_malloc(4 * sizeof(int) * (avctx->width >> 2));
-
-    for(i = 0; i < TM2_NUM_STREAMS; i++) {
-        l->tokens[i] = NULL;
-        l->tok_lens[i] = 0;
-    }
-
-    l->Y1 = av_malloc(sizeof(int) * avctx->width * avctx->height);
-    l->U1 = av_malloc(sizeof(int) * ((avctx->width + 1) >> 1) * ((avctx->height + 1) >> 1));
-    l->V1 = av_malloc(sizeof(int) * ((avctx->width + 1) >> 1) * ((avctx->height + 1) >> 1));
-    l->Y2 = av_malloc(sizeof(int) * avctx->width * avctx->height);
-    l->U2 = av_malloc(sizeof(int) * ((avctx->width + 1) >> 1) * ((avctx->height + 1) >> 1));
-    l->V2 = av_malloc(sizeof(int) * ((avctx->width + 1) >> 1) * ((avctx->height + 1) >> 1));
-    l->cur = 0;
-
-    return 0;
-}
-
-static int decode_end(AVCodecContext *avctx){
-    TM2Context * const l = avctx->priv_data;
-    int i;
-
-    if(l->last)
-        av_free(l->last);
-    if(l->clast)
-        av_free(l->clast);
-    for(i = 0; i < TM2_NUM_STREAMS; i++)
-        if(l->tokens[i])
-            av_free(l->tokens[i]);
-    if(l->Y1){
-        av_free(l->Y1);
-        av_free(l->U1);
-        av_free(l->V1);
-        av_free(l->Y2);
-        av_free(l->U2);
-        av_free(l->V2);
-    }
-    return 0;
-}
-
-AVCodec truemotion2_decoder = {
-    "truemotion2",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_TRUEMOTION2,
-    sizeof(TM2Context),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
-};
--- a/src/ffmpeg/libavcodec/ulti.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,428 +0,0 @@
-/*
- * IBM Ultimotion Video Decoder
- * Copyright (C) 2004 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-/**
- * @file ulti.c
- * IBM Ultimotion Video Decoder.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "common.h"
-#include "avcodec.h"
-
-#include "ulti_cb.h"
-
-typedef struct UltimotionDecodeContext {
-    AVCodecContext *avctx;
-    int width, height, blocks;
-    AVFrame frame;
-    const uint8_t *ulti_codebook;
-} UltimotionDecodeContext;
-
-static int ulti_decode_init(AVCodecContext *avctx)
-{
-    UltimotionDecodeContext *s = avctx->priv_data;
-
-    s->avctx = avctx;
-    s->width = avctx->width;
-    s->height = avctx->height;
-    s->blocks = (s->width / 8) * (s->height / 8);
-    avctx->pix_fmt = PIX_FMT_YUV410P;
-    avctx->has_b_frames = 0;
-    avctx->coded_frame = (AVFrame*) &s->frame;
-    s->ulti_codebook = ulti_codebook;
-
-    return 0;
-}
-
-static int block_coords[8] = // 4x4 block coords in 8x8 superblock
-    { 0, 0, 0, 4, 4, 4, 4, 0};
-
-static int angle_by_index[4] = { 0, 2, 6, 12};
-
-/* Lookup tables for luma and chroma - used by ulti_convert_yuv() */
-static uint8_t ulti_lumas[64] =
-    { 0x10, 0x13, 0x17, 0x1A, 0x1E, 0x21, 0x25, 0x28,
-      0x2C, 0x2F, 0x33, 0x36, 0x3A, 0x3D, 0x41, 0x44,
-      0x48, 0x4B, 0x4F, 0x52, 0x56, 0x59, 0x5C, 0x60,
-      0x63, 0x67, 0x6A, 0x6E, 0x71, 0x75, 0x78, 0x7C,
-      0x7F, 0x83, 0x86, 0x8A, 0x8D, 0x91, 0x94, 0x98,
-      0x9B, 0x9F, 0xA2, 0xA5, 0xA9, 0xAC, 0xB0, 0xB3,
-      0xB7, 0xBA, 0xBE, 0xC1, 0xC5, 0xC8, 0xCC, 0xCF,
-      0xD3, 0xD6, 0xDA, 0xDD, 0xE1, 0xE4, 0xE8, 0xEB};
-
-static uint8_t ulti_chromas[16] =
-    { 0x60, 0x67, 0x6D, 0x73, 0x7A, 0x80, 0x86, 0x8D,
-      0x93, 0x99, 0xA0, 0xA6, 0xAC, 0xB3, 0xB9, 0xC0};
-
-/* convert Ultimotion YUV block (sixteen 6-bit Y samples and
- two 4-bit chroma samples) into standard YUV and put it into frame */
-static void ulti_convert_yuv(AVFrame *frame, int x, int y,
-                             uint8_t *luma,int chroma)
-{
-    uint8_t *y_plane, *cr_plane, *cb_plane;
-    int i;
-
-    y_plane = frame->data[0] + x + y * frame->linesize[0];
-    cr_plane = frame->data[1] + (x / 4) + (y / 4) * frame->linesize[1];
-    cb_plane = frame->data[2] + (x / 4) + (y / 4) * frame->linesize[2];
-
-    cr_plane[0] = ulti_chromas[chroma >> 4];
-
-    cb_plane[0] = ulti_chromas[chroma & 0xF];
-
-
-    for(i = 0; i < 16; i++){
-        y_plane[i & 3] = ulti_lumas[luma[i]];
-        if((i & 3) == 3) { //next row
-            y_plane += frame->linesize[0];
-        }
-    }
-}
-
-/* generate block like in MS Video1 */
-static void ulti_pattern(AVFrame *frame, int x, int y,
-                         int f0, int f1, int Y0, int Y1, int chroma)
-{
-    uint8_t Luma[16];
-    int mask, i;
-    for(mask = 0x80, i = 0; mask; mask >>= 1, i++) {
-        if(f0 & mask)
-            Luma[i] = Y1;
-        else
-            Luma[i] = Y0;
-    }
-
-    for(mask = 0x80, i = 8; mask; mask >>= 1, i++) {
-        if(f1 & mask)
-            Luma[i] = Y1;
-        else
-            Luma[i] = Y0;
-    }
-
-    ulti_convert_yuv(frame, x, y, Luma, chroma);
-}
-
-/* fill block with some gradient */
-static void ulti_grad(AVFrame *frame, int x, int y, uint8_t *Y, int chroma, int angle)
-{
-    uint8_t Luma[16];
-    if(angle & 8) { //reverse order
-        int t;
-        angle &= 0x7;
-        t = Y[0];
-        Y[0] = Y[3];
-        Y[3] = t;
-        t = Y[1];
-        Y[1] = Y[2];
-        Y[2] = t;
-    }
-    switch(angle){
-    case 0:
-        Luma[0]  = Y[0]; Luma[1]  = Y[1]; Luma[2]  = Y[2]; Luma[3]  = Y[3];
-        Luma[4]  = Y[0]; Luma[5]  = Y[1]; Luma[6]  = Y[2]; Luma[7]  = Y[3];
-        Luma[8]  = Y[0]; Luma[9]  = Y[1]; Luma[10] = Y[2]; Luma[11] = Y[3];
-        Luma[12] = Y[0]; Luma[13] = Y[1]; Luma[14] = Y[2]; Luma[15] = Y[3];
-        break;
-    case 1:
-        Luma[0]  = Y[1]; Luma[1]  = Y[2]; Luma[2]  = Y[3]; Luma[3]  = Y[3];
-        Luma[4]  = Y[0]; Luma[5]  = Y[1]; Luma[6]  = Y[2]; Luma[7]  = Y[3];
-        Luma[8]  = Y[0]; Luma[9]  = Y[1]; Luma[10] = Y[2]; Luma[11] = Y[3];
-        Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[1]; Luma[15] = Y[2];
-        break;
-    case 2:
-        Luma[0]  = Y[1]; Luma[1]  = Y[2]; Luma[2]  = Y[3]; Luma[3]  = Y[3];
-        Luma[4]  = Y[1]; Luma[5]  = Y[2]; Luma[6]  = Y[2]; Luma[7]  = Y[3];
-        Luma[8]  = Y[0]; Luma[9]  = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[2];
-        Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[1]; Luma[15] = Y[2];
-        break;
-    case 3:
-        Luma[0]  = Y[2]; Luma[1]  = Y[3]; Luma[2]  = Y[3]; Luma[3]  = Y[3];
-        Luma[4]  = Y[1]; Luma[5]  = Y[2]; Luma[6]  = Y[2]; Luma[7]  = Y[3];
-        Luma[8]  = Y[0]; Luma[9]  = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[2];
-        Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[0]; Luma[15] = Y[1];
-        break;
-    case 4:
-        Luma[0]  = Y[3]; Luma[1]  = Y[3]; Luma[2]  = Y[3]; Luma[3]  = Y[3];
-        Luma[4]  = Y[2]; Luma[5]  = Y[2]; Luma[6]  = Y[2]; Luma[7]  = Y[2];
-        Luma[8]  = Y[1]; Luma[9]  = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[1];
-        Luma[12] = Y[0]; Luma[13] = Y[0]; Luma[14] = Y[0]; Luma[15] = Y[0];
-        break;
-    case 5:
-        Luma[0]  = Y[3]; Luma[1]  = Y[3]; Luma[2]  = Y[3]; Luma[3]  = Y[2];
-        Luma[4]  = Y[3]; Luma[5]  = Y[2]; Luma[6]  = Y[2]; Luma[7]  = Y[1];
-        Luma[8]  = Y[2]; Luma[9]  = Y[1]; Luma[10] = Y[1]; Luma[11] = Y[0];
-        Luma[12] = Y[1]; Luma[13] = Y[0]; Luma[14] = Y[0]; Luma[15] = Y[0];
-        break;
-    case 6:
-        Luma[0]  = Y[3]; Luma[1]  = Y[3]; Luma[2]  = Y[2]; Luma[3]  = Y[2];
-        Luma[4]  = Y[3]; Luma[5]  = Y[2]; Luma[6]  = Y[1]; Luma[7]  = Y[1];
-        Luma[8]  = Y[2]; Luma[9]  = Y[2]; Luma[10] = Y[1]; Luma[11] = Y[0];
-        Luma[12] = Y[1]; Luma[13] = Y[1]; Luma[14] = Y[0]; Luma[15] = Y[0];
-        break;
-    case 7:
-        Luma[0]  = Y[3]; Luma[1]  = Y[3]; Luma[2]  = Y[2]; Luma[3]  = Y[1];
-        Luma[4]  = Y[3]; Luma[5]  = Y[2]; Luma[6]  = Y[1]; Luma[7]  = Y[0];
-        Luma[8]  = Y[3]; Luma[9]  = Y[2]; Luma[10] = Y[1]; Luma[11] = Y[0];
-        Luma[12] = Y[2]; Luma[13] = Y[1]; Luma[14] = Y[0]; Luma[15] = Y[0];
-        break;
-    default:
-        Luma[0]  = Y[0]; Luma[1]  = Y[0]; Luma[2]  = Y[1]; Luma[3]  = Y[1];
-        Luma[4]  = Y[0]; Luma[5]  = Y[0]; Luma[6]  = Y[1]; Luma[7]  = Y[1];
-        Luma[8]  = Y[2]; Luma[9]  = Y[2]; Luma[10] = Y[3]; Luma[11] = Y[3];
-        Luma[12] = Y[2]; Luma[13] = Y[2]; Luma[14] = Y[3]; Luma[15] = Y[3];
-        break;
-    }
-
-    ulti_convert_yuv(frame, x, y, Luma, chroma);
-}
-
-static int ulti_decode_frame(AVCodecContext *avctx,
-                             void *data, int *data_size,
-                             uint8_t *buf, int buf_size)
-{
-    UltimotionDecodeContext *s=avctx->priv_data;
-    int modifier = 0;
-    int uniq = 0;
-    int mode = 0;
-    int blocks = 0;
-    int done = 0;
-    int x = 0, y = 0;
-    int i;
-    int skip;
-    int tmp;
-
-    if(s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
-
-    s->frame.reference = 1;
-    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
-    if(avctx->get_buffer(avctx, &s->frame) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    while(!done) {
-        int idx;
-        if(blocks >= s->blocks || y >= s->height)
-            break;//all blocks decoded
-
-        idx = *buf++;
-        if((idx & 0xF8) == 0x70) {
-            switch(idx) {
-            case 0x70: //change modifier
-                modifier = *buf++;
-                if(modifier>1)
-                    av_log(avctx, AV_LOG_INFO, "warning: modifier must be 0 or 1, got %i\n", modifier);
-                break;
-            case 0x71: // set uniq flag
-                uniq = 1;
-                break;
-            case 0x72: //toggle mode
-                mode = !mode;
-                break;
-            case 0x73: //end-of-frame
-                done = 1;
-                break;
-            case 0x74: //skip some blocks
-                skip = *buf++;
-                if ((blocks + skip) >= s->blocks)
-                    break;
-                blocks += skip;
-                x += skip * 8;
-                while(x >= s->width) {
-                    x -= s->width;
-                    y += 8;
-                }
-                break;
-            default:
-                av_log(avctx, AV_LOG_INFO, "warning: unknown escape 0x%02X\n", idx);
-            }
-        } else { //handle one block
-            int code;
-            int cf;
-            int angle = 0;
-            uint8_t Y[4]; // luma samples of block
-            int tx = 0, ty = 0; //coords of subblock
-            int chroma = 0;
-            if (mode || uniq) {
-                uniq = 0;
-                cf = 1;
-                chroma = 0;
-            } else {
-                cf = 0;
-                if (idx)
-                    chroma = *buf++;
-            }
-            for (i = 0; i < 4; i++) { // for every subblock
-                code = (idx >> (6 - i*2)) & 3; //extract 2 bits
-                if(!code) //skip subblock
-                    continue;
-                if(cf)
-                    chroma = *buf++;
-                tx = x + block_coords[i * 2];
-                ty = y + block_coords[(i * 2) + 1];
-                switch(code) {
-                case 1:
-                    tmp = *buf++;
-
-                    angle = angle_by_index[(tmp >> 6) & 0x3];
-
-                    Y[0] = tmp & 0x3F;
-                    Y[1] = Y[0];
-
-                    if (angle) {
-                        Y[2] = Y[0]+1;
-                        if (Y[2] > 0x3F)
-                            Y[2] = 0x3F;
-                        Y[3] = Y[2];
-                    } else {
-                        Y[2] = Y[0];
-                        Y[3] = Y[0];
-                    }
-                    break;
-
-                case 2:
-                    if (modifier) { // unpack four luma samples
-                        tmp = (*buf++) << 16;
-                        tmp += (*buf++) << 8;
-                        tmp += *buf++;
-
-                        Y[0] = (tmp >> 18) & 0x3F;
-                        Y[1] = (tmp >> 12) & 0x3F;
-                        Y[2] = (tmp >> 6) & 0x3F;
-                        Y[3] = tmp & 0x3F;
-                        angle = 16;
-                    } else { // retrieve luma samples from codebook
-                        tmp = (*buf++) << 8;
-                        tmp += (*buf++);
-
-                        angle = (tmp >> 12) & 0xF;
-                        tmp &= 0xFFF;
-                        tmp <<= 2;
-                        Y[0] = s->ulti_codebook[tmp];
-                        Y[1] = s->ulti_codebook[tmp + 1];
-                        Y[2] = s->ulti_codebook[tmp + 2];
-                        Y[3] = s->ulti_codebook[tmp + 3];
-                    }
-                    break;
-
-                case 3:
-                    if (modifier) { // all 16 luma samples
-                        uint8_t Luma[16];
-
-                        tmp = (*buf++) << 16;
-                        tmp += (*buf++) << 8;
-                        tmp += *buf++;
-                        Luma[0] = (tmp >> 18) & 0x3F;
-                        Luma[1] = (tmp >> 12) & 0x3F;
-                        Luma[2] = (tmp >> 6) & 0x3F;
-                        Luma[3] = tmp & 0x3F;
-
-                        tmp = (*buf++) << 16;
-                        tmp += (*buf++) << 8;
-                        tmp += *buf++;
-                        Luma[4] = (tmp >> 18) & 0x3F;
-                        Luma[5] = (tmp >> 12) & 0x3F;
-                        Luma[6] = (tmp >> 6) & 0x3F;
-                        Luma[7] = tmp & 0x3F;
-
-                        tmp = (*buf++) << 16;
-                        tmp += (*buf++) << 8;
-                        tmp += *buf++;
-                        Luma[8] = (tmp >> 18) & 0x3F;
-                        Luma[9] = (tmp >> 12) & 0x3F;
-                        Luma[10] = (tmp >> 6) & 0x3F;
-                        Luma[11] = tmp & 0x3F;
-
-                        tmp = (*buf++) << 16;
-                        tmp += (*buf++) << 8;
-                        tmp += *buf++;
-                        Luma[12] = (tmp >> 18) & 0x3F;
-                        Luma[13] = (tmp >> 12) & 0x3F;
-                        Luma[14] = (tmp >> 6) & 0x3F;
-                        Luma[15] = tmp & 0x3F;
-
-                        ulti_convert_yuv(&s->frame, tx, ty, Luma, chroma);
-                    } else {
-                        tmp = *buf++;
-                        if(tmp & 0x80) {
-                            angle = (tmp >> 4) & 0x7;
-                            tmp = (tmp << 8) + *buf++;
-                            Y[0] = (tmp >> 6) & 0x3F;
-                            Y[1] = tmp & 0x3F;
-                            Y[2] = (*buf++) & 0x3F;
-                            Y[3] = (*buf++) & 0x3F;
-                            ulti_grad(&s->frame, tx, ty, Y, chroma, angle); //draw block
-                        } else { // some patterns
-                            int f0, f1;
-                            f0 = *buf++;
-                            f1 = tmp;
-                            Y[0] = (*buf++) & 0x3F;
-                            Y[1] = (*buf++) & 0x3F;
-                            ulti_pattern(&s->frame, tx, ty, f1, f0, Y[0], Y[1], chroma);
-                        }
-                    }
-                    break;
-                }
-                if(code != 3)
-                    ulti_grad(&s->frame, tx, ty, Y, chroma, angle); // draw block
-            }
-            blocks++;
-                x += 8;
-            if(x >= s->width) {
-                x = 0;
-                y += 8;
-            }
-        }
-    }
-
-    *data_size=sizeof(AVFrame);
-    *(AVFrame*)data= s->frame;
-
-    return buf_size;
-}
-
-static int ulti_decode_end(AVCodecContext *avctx)
-{
-/*    UltimotionDecodeContext *s = avctx->priv_data;*/
-
-    return 0;
-}
-
-AVCodec ulti_decoder = {
-    "ultimotion",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_ULTI,
-    sizeof(UltimotionDecodeContext),
-    ulti_decode_init,
-    NULL,
-    ulti_decode_end,
-    ulti_decode_frame,
-    CODEC_CAP_DR1,
-    NULL
-};
-
--- a/src/ffmpeg/libavcodec/ulti_cb.h	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4119 +0,0 @@
-/*
- * IBM Ultimotion Video Decoder
- * copyright (C) 2004 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-static const unsigned char ulti_codebook[16384]={
-    0x00, 0x01, 0x01, 0x02,
-    0x00, 0x01, 0x02, 0x03,
-    0x00, 0x02, 0x03, 0x04,
-    0x00, 0x01, 0x03, 0x04,
-    0x00, 0x01, 0x02, 0x04,
-    0x00, 0x02, 0x03, 0x05,
-    0x00, 0x02, 0x04, 0x05,
-    0x00, 0x01, 0x04, 0x05,
-    0x00, 0x01, 0x03, 0x05,
-    0x00, 0x02, 0x04, 0x06,
-    0x00, 0x03, 0x05, 0x06,
-    0x00, 0x01, 0x05, 0x06,
-    0x00, 0x01, 0x03, 0x06,
-    0x00, 0x06, 0x06, 0x06,
-    0x00, 0x00, 0x06, 0x06,
-    0x00, 0x00, 0x00, 0x06,
-    0x00, 0x03, 0x04, 0x07,
-    0x00, 0x03, 0x06, 0x07,
-    0x00, 0x01, 0x06, 0x07,
-    0x00, 0x01, 0x04, 0x07,
-    0x00, 0x03, 0x05, 0x08,
-    0x00, 0x04, 0x06, 0x08,
-    0x00, 0x02, 0x06, 0x08,
-    0x00, 0x02, 0x04, 0x08,
-    0x00, 0x08, 0x08, 0x08,
-    0x00, 0x00, 0x08, 0x08,
-    0x00, 0x00, 0x00, 0x08,
-    0x00, 0x04, 0x07, 0x0B,
-    0x00, 0x05, 0x09, 0x0B,
-    0x00, 0x02, 0x09, 0x0B,
-    0x00, 0x02, 0x06, 0x0B,
-    0x00, 0x0B, 0x0B, 0x0B,
-    0x00, 0x00, 0x0B, 0x0B,
-    0x00, 0x00, 0x00, 0x0B,
-    0x00, 0x05, 0x09, 0x0E,
-    0x00, 0x07, 0x0B, 0x0E,
-    0x00, 0x03, 0x0B, 0x0E,
-    0x00, 0x03, 0x07, 0x0E,
-    0x00, 0x0E, 0x0E, 0x0E,
-    0x00, 0x00, 0x0E, 0x0E,
-    0x00, 0x00, 0x00, 0x0E,
-    0x00, 0x06, 0x0B, 0x11,
-    0x00, 0x08, 0x0D, 0x11,
-    0x00, 0x04, 0x0D, 0x11,
-    0x00, 0x04, 0x09, 0x11,
-    0x00, 0x11, 0x11, 0x11,
-    0x00, 0x00, 0x11, 0x11,
-    0x00, 0x00, 0x00, 0x11,
-    0x00, 0x07, 0x0D, 0x14,
-    0x00, 0x0A, 0x0F, 0x14,
-    0x00, 0x05, 0x0F, 0x14,
-    0x00, 0x05, 0x0A, 0x14,
-    0x00, 0x14, 0x14, 0x14,
-    0x00, 0x00, 0x14, 0x14,
-    0x00, 0x00, 0x00, 0x14,
-    0x00, 0x0B, 0x12, 0x17,
-    0x00, 0x05, 0x12, 0x17,
-    0x00, 0x05, 0x0C, 0x17,
-    0x00, 0x17, 0x17, 0x17,
-    0x00, 0x00, 0x17, 0x17,
-    0x00, 0x00, 0x00, 0x17,
-    0x00, 0x0D, 0x14, 0x1A,
-    0x00, 0x06, 0x14, 0x1A,
-    0x00, 0x06, 0x0D, 0x1A,
-    0x00, 0x1A, 0x1A, 0x1A,
-    0x00, 0x00, 0x1A, 0x1A,
-    0x00, 0x00, 0x00, 0x1A,
-    0x00, 0x0E, 0x16, 0x1D,
-    0x00, 0x07, 0x16, 0x1D,
-    0x00, 0x07, 0x0F, 0x1D,
-    0x00, 0x1D, 0x1D, 0x1D,
-    0x00, 0x00, 0x1D, 0x1D,
-    0x00, 0x00, 0x00, 0x1D,
-    0x00, 0x10, 0x18, 0x20,
-    0x00, 0x08, 0x18, 0x20,
-    0x00, 0x08, 0x10, 0x20,
-    0x00, 0x20, 0x20, 0x20,
-    0x00, 0x00, 0x20, 0x20,
-    0x00, 0x00, 0x00, 0x20,
-    0x00, 0x23, 0x23, 0x23,
-    0x00, 0x00, 0x23, 0x23,
-    0x00, 0x00, 0x00, 0x23,
-    0x00, 0x12, 0x1B, 0x24,
-    0x00, 0x09, 0x1B, 0x24,
-    0x00, 0x09, 0x12, 0x24,
-    0x00, 0x28, 0x28, 0x28,
-    0x00, 0x00, 0x28, 0x28,
-    0x00, 0x00, 0x00, 0x28,
-    0x00, 0x2E, 0x2E, 0x2E,
-    0x00, 0x00, 0x2E, 0x2E,
-    0x00, 0x00, 0x00, 0x2E,
-    0x01, 0x02, 0x02, 0x03,
-    0x01, 0x02, 0x03, 0x04,
-    0x01, 0x03, 0x04, 0x05,
-    0x01, 0x02, 0x04, 0x05,
-    0x01, 0x02, 0x03, 0x05,
-    0x01, 0x03, 0x04, 0x06,
-    0x01, 0x03, 0x05, 0x06,
-    0x01, 0x02, 0x05, 0x06,
-    0x01, 0x02, 0x04, 0x06,
-    0x01, 0x03, 0x05, 0x07,
-    0x01, 0x04, 0x06, 0x07,
-    0x01, 0x02, 0x06, 0x07,
-    0x01, 0x02, 0x04, 0x07,
-    0x01, 0x07, 0x07, 0x07,
-    0x01, 0x01, 0x07, 0x07,
-    0x01, 0x01, 0x01, 0x07,
-    0x01, 0x04, 0x05, 0x08,
-    0x01, 0x04, 0x07, 0x08,
-    0x01, 0x02, 0x07, 0x08,
-    0x01, 0x02, 0x05, 0x08,
-    0x01, 0x04, 0x06, 0x09,
-    0x01, 0x05, 0x07, 0x09,
-    0x01, 0x03, 0x07, 0x09,
-    0x01, 0x03, 0x05, 0x09,
-    0x01, 0x09, 0x09, 0x09,
-    0x01, 0x01, 0x09, 0x09,
-    0x01, 0x01, 0x01, 0x09,
-    0x01, 0x05, 0x08, 0x0C,
-    0x01, 0x06, 0x0A, 0x0C,
-    0x01, 0x03, 0x0A, 0x0C,
-    0x01, 0x03, 0x07, 0x0C,
-    0x01, 0x0C, 0x0C, 0x0C,
-    0x01, 0x01, 0x0C, 0x0C,
-    0x01, 0x01, 0x01, 0x0C,
-    0x01, 0x06, 0x0A, 0x0F,
-    0x01, 0x08, 0x0C, 0x0F,
-    0x01, 0x04, 0x0C, 0x0F,
-    0x01, 0x04, 0x08, 0x0F,
-    0x01, 0x0F, 0x0F, 0x0F,
-    0x01, 0x01, 0x0F, 0x0F,
-    0x01, 0x01, 0x01, 0x0F,
-    0x01, 0x07, 0x0C, 0x12,
-    0x01, 0x09, 0x0E, 0x12,
-    0x01, 0x05, 0x0E, 0x12,
-    0x01, 0x05, 0x0A, 0x12,
-    0x01, 0x12, 0x12, 0x12,
-    0x01, 0x01, 0x12, 0x12,
-    0x01, 0x01, 0x01, 0x12,
-    0x01, 0x08, 0x0E, 0x15,
-    0x01, 0x0B, 0x10, 0x15,
-    0x01, 0x06, 0x10, 0x15,
-    0x01, 0x06, 0x0B, 0x15,
-    0x01, 0x15, 0x15, 0x15,
-    0x01, 0x01, 0x15, 0x15,
-    0x01, 0x01, 0x01, 0x15,
-    0x01, 0x0C, 0x13, 0x18,
-    0x01, 0x06, 0x13, 0x18,
-    0x01, 0x06, 0x0D, 0x18,
-    0x01, 0x18, 0x18, 0x18,
-    0x01, 0x01, 0x18, 0x18,
-    0x01, 0x01, 0x01, 0x18,
-    0x01, 0x0E, 0x15, 0x1B,
-    0x01, 0x07, 0x15, 0x1B,
-    0x01, 0x07, 0x0E, 0x1B,
-    0x01, 0x1B, 0x1B, 0x1B,
-    0x01, 0x01, 0x1B, 0x1B,
-    0x01, 0x01, 0x01, 0x1B,
-    0x01, 0x0F, 0x17, 0x1E,
-    0x01, 0x08, 0x17, 0x1E,
-    0x01, 0x08, 0x10, 0x1E,
-    0x01, 0x1E, 0x1E, 0x1E,
-    0x01, 0x01, 0x1E, 0x1E,
-    0x01, 0x01, 0x01, 0x1E,
-    0x01, 0x11, 0x19, 0x21,
-    0x01, 0x09, 0x19, 0x21,
-    0x01, 0x09, 0x11, 0x21,
-    0x01, 0x21, 0x21, 0x21,
-    0x01, 0x01, 0x21, 0x21,
-    0x01, 0x01, 0x01, 0x21,
-    0x01, 0x24, 0x24, 0x24,
-    0x01, 0x01, 0x24, 0x24,
-    0x01, 0x01, 0x01, 0x24,
-    0x01, 0x13, 0x1C, 0x25,
-    0x01, 0x0A, 0x1C, 0x25,
-    0x01, 0x0A, 0x13, 0x25,
-    0x01, 0x29, 0x29, 0x29,
-    0x01, 0x01, 0x29, 0x29,
-    0x01, 0x01, 0x01, 0x29,
-    0x01, 0x2F, 0x2F, 0x2F,
-    0x01, 0x01, 0x2F, 0x2F,
-    0x01, 0x01, 0x01, 0x2F,
-    0x02, 0x03, 0x03, 0x04,
-    0x02, 0x03, 0x04, 0x05,
-    0x02, 0x04, 0x05, 0x06,
-    0x02, 0x03, 0x05, 0x06,
-    0x02, 0x03, 0x04, 0x06,
-    0x02, 0x04, 0x05, 0x07,
-    0x02, 0x04, 0x06, 0x07,
-    0x02, 0x03, 0x06, 0x07,
-    0x02, 0x03, 0x05, 0x07,
-    0x02, 0x04, 0x06, 0x08,
-    0x02, 0x05, 0x07, 0x08,
-    0x02, 0x03, 0x07, 0x08,
-    0x02, 0x03, 0x05, 0x08,
-    0x02, 0x08, 0x08, 0x08,
-    0x02, 0x02, 0x08, 0x08,
-    0x02, 0x02, 0x02, 0x08,
-    0x02, 0x05, 0x06, 0x09,
-    0x02, 0x05, 0x08, 0x09,
-    0x02, 0x03, 0x08, 0x09,
-    0x02, 0x03, 0x06, 0x09,
-    0x02, 0x05, 0x07, 0x0A,
-    0x02, 0x06, 0x08, 0x0A,
-    0x02, 0x04, 0x08, 0x0A,
-    0x02, 0x04, 0x06, 0x0A,
-    0x02, 0x0A, 0x0A, 0x0A,
-    0x02, 0x02, 0x0A, 0x0A,
-    0x02, 0x02, 0x02, 0x0A,
-    0x02, 0x06, 0x09, 0x0D,
-    0x02, 0x07, 0x0B, 0x0D,
-    0x02, 0x04, 0x0B, 0x0D,
-    0x02, 0x04, 0x08, 0x0D,
-    0x02, 0x0D, 0x0D, 0x0D,
-    0x02, 0x02, 0x0D, 0x0D,
-    0x02, 0x02, 0x02, 0x0D,
-    0x02, 0x07, 0x0B, 0x10,
-    0x02, 0x09, 0x0D, 0x10,
-    0x02, 0x05, 0x0D, 0x10,
-    0x02, 0x05, 0x09, 0x10,
-    0x02, 0x10, 0x10, 0x10,
-    0x02, 0x02, 0x10, 0x10,
-    0x02, 0x02, 0x02, 0x10,
-    0x02, 0x08, 0x0D, 0x13,
-    0x02, 0x0A, 0x0F, 0x13,
-    0x02, 0x06, 0x0F, 0x13,
-    0x02, 0x06, 0x0B, 0x13,
-    0x02, 0x13, 0x13, 0x13,
-    0x02, 0x02, 0x13, 0x13,
-    0x02, 0x02, 0x02, 0x13,
-    0x02, 0x09, 0x0F, 0x16,
-    0x02, 0x0C, 0x11, 0x16,
-    0x02, 0x07, 0x11, 0x16,
-    0x02, 0x07, 0x0C, 0x16,
-    0x02, 0x16, 0x16, 0x16,
-    0x02, 0x02, 0x16, 0x16,
-    0x02, 0x02, 0x02, 0x16,
-    0x02, 0x0D, 0x14, 0x19,
-    0x02, 0x07, 0x14, 0x19,
-    0x02, 0x07, 0x0E, 0x19,
-    0x02, 0x19, 0x19, 0x19,
-    0x02, 0x02, 0x19, 0x19,
-    0x02, 0x02, 0x02, 0x19,
-    0x02, 0x0F, 0x16, 0x1C,
-    0x02, 0x08, 0x16, 0x1C,
-    0x02, 0x08, 0x0F, 0x1C,
-    0x02, 0x1C, 0x1C, 0x1C,
-    0x02, 0x02, 0x1C, 0x1C,
-    0x02, 0x02, 0x02, 0x1C,
-    0x02, 0x10, 0x18, 0x1F,
-    0x02, 0x09, 0x18, 0x1F,
-    0x02, 0x09, 0x11, 0x1F,
-    0x02, 0x1F, 0x1F, 0x1F,
-    0x02, 0x02, 0x1F, 0x1F,
-    0x02, 0x02, 0x02, 0x1F,
-    0x02, 0x12, 0x1A, 0x22,
-    0x02, 0x0A, 0x1A, 0x22,
-    0x02, 0x0A, 0x12, 0x22,
-    0x02, 0x22, 0x22, 0x22,
-    0x02, 0x02, 0x22, 0x22,
-    0x02, 0x02, 0x02, 0x22,
-    0x02, 0x25, 0x25, 0x25,
-    0x02, 0x02, 0x25, 0x25,
-    0x02, 0x02, 0x02, 0x25,
-    0x02, 0x14, 0x1D, 0x26,
-    0x02, 0x0B, 0x1D, 0x26,
-    0x02, 0x0B, 0x14, 0x26,
-    0x02, 0x2A, 0x2A, 0x2A,
-    0x02, 0x02, 0x2A, 0x2A,
-    0x02, 0x02, 0x02, 0x2A,
-    0x02, 0x30, 0x30, 0x30,
-    0x02, 0x02, 0x30, 0x30,
-    0x02, 0x02, 0x02, 0x30,
-    0x03, 0x04, 0x04, 0x05,
-    0x03, 0x04, 0x05, 0x06,
-    0x03, 0x05, 0x06, 0x07,
-    0x03, 0x04, 0x06, 0x07,
-    0x03, 0x04, 0x05, 0x07,
-    0x03, 0x05, 0x06, 0x08,
-    0x03, 0x05, 0x07, 0x08,
-    0x03, 0x04, 0x07, 0x08,
-    0x03, 0x04, 0x06, 0x08,
-    0x03, 0x05, 0x07, 0x09,
-    0x03, 0x06, 0x08, 0x09,
-    0x03, 0x04, 0x08, 0x09,
-    0x03, 0x04, 0x06, 0x09,
-    0x03, 0x09, 0x09, 0x09,
-    0x03, 0x03, 0x09, 0x09,
-    0x03, 0x03, 0x03, 0x09,
-    0x03, 0x06, 0x07, 0x0A,
-    0x03, 0x06, 0x09, 0x0A,
-    0x03, 0x04, 0x09, 0x0A,
-    0x03, 0x04, 0x07, 0x0A,
-    0x03, 0x06, 0x08, 0x0B,
-    0x03, 0x07, 0x09, 0x0B,
-    0x03, 0x05, 0x09, 0x0B,
-    0x03, 0x05, 0x07, 0x0B,
-    0x03, 0x0B, 0x0B, 0x0B,
-    0x03, 0x03, 0x0B, 0x0B,
-    0x03, 0x03, 0x03, 0x0B,
-    0x03, 0x07, 0x0A, 0x0E,
-    0x03, 0x08, 0x0C, 0x0E,
-    0x03, 0x05, 0x0C, 0x0E,
-    0x03, 0x05, 0x09, 0x0E,
-    0x03, 0x0E, 0x0E, 0x0E,
-    0x03, 0x03, 0x0E, 0x0E,
-    0x03, 0x03, 0x03, 0x0E,
-    0x03, 0x08, 0x0C, 0x11,
-    0x03, 0x0A, 0x0E, 0x11,
-    0x03, 0x06, 0x0E, 0x11,
-    0x03, 0x06, 0x0A, 0x11,
-    0x03, 0x11, 0x11, 0x11,
-    0x03, 0x03, 0x11, 0x11,
-    0x03, 0x03, 0x03, 0x11,
-    0x03, 0x09, 0x0E, 0x14,
-    0x03, 0x0B, 0x10, 0x14,
-    0x03, 0x07, 0x10, 0x14,
-    0x03, 0x07, 0x0C, 0x14,
-    0x03, 0x14, 0x14, 0x14,
-    0x03, 0x03, 0x14, 0x14,
-    0x03, 0x03, 0x03, 0x14,
-    0x03, 0x0A, 0x10, 0x17,
-    0x03, 0x0D, 0x12, 0x17,
-    0x03, 0x08, 0x12, 0x17,
-    0x03, 0x08, 0x0D, 0x17,
-    0x03, 0x17, 0x17, 0x17,
-    0x03, 0x03, 0x17, 0x17,
-    0x03, 0x03, 0x03, 0x17,
-    0x03, 0x0E, 0x15, 0x1A,
-    0x03, 0x08, 0x15, 0x1A,
-    0x03, 0x08, 0x0F, 0x1A,
-    0x03, 0x1A, 0x1A, 0x1A,
-    0x03, 0x03, 0x1A, 0x1A,
-    0x03, 0x03, 0x03, 0x1A,
-    0x03, 0x10, 0x17, 0x1D,
-    0x03, 0x09, 0x17, 0x1D,
-    0x03, 0x09, 0x10, 0x1D,
-    0x03, 0x1D, 0x1D, 0x1D,
-    0x03, 0x03, 0x1D, 0x1D,
-    0x03, 0x03, 0x03, 0x1D,
-    0x03, 0x11, 0x19, 0x20,
-    0x03, 0x0A, 0x19, 0x20,
-    0x03, 0x0A, 0x12, 0x20,
-    0x03, 0x20, 0x20, 0x20,
-    0x03, 0x03, 0x20, 0x20,
-    0x03, 0x03, 0x03, 0x20,
-    0x03, 0x13, 0x1B, 0x23,
-    0x03, 0x0B, 0x1B, 0x23,
-    0x03, 0x0B, 0x13, 0x23,
-    0x03, 0x23, 0x23, 0x23,
-    0x03, 0x03, 0x23, 0x23,
-    0x03, 0x03, 0x03, 0x23,
-    0x03, 0x26, 0x26, 0x26,
-    0x03, 0x03, 0x26, 0x26,
-    0x03, 0x03, 0x03, 0x26,
-    0x03, 0x15, 0x1E, 0x27,
-    0x03, 0x0C, 0x1E, 0x27,
-    0x03, 0x0C, 0x15, 0x27,
-    0x03, 0x2B, 0x2B, 0x2B,
-    0x03, 0x03, 0x2B, 0x2B,
-    0x03, 0x03, 0x03, 0x2B,
-    0x03, 0x31, 0x31, 0x31,
-    0x03, 0x03, 0x31, 0x31,
-    0x03, 0x03, 0x03, 0x31,
-    0x04, 0x05, 0x05, 0x06,
-    0x04, 0x05, 0x06, 0x07,
-    0x04, 0x06, 0x07, 0x08,
-    0x04, 0x05, 0x07, 0x08,
-    0x04, 0x05, 0x06, 0x08,
-    0x04, 0x06, 0x07, 0x09,
-    0x04, 0x06, 0x08, 0x09,
-    0x04, 0x05, 0x08, 0x09,
-    0x04, 0x05, 0x07, 0x09,
-    0x04, 0x06, 0x08, 0x0A,
-    0x04, 0x07, 0x09, 0x0A,
-    0x04, 0x05, 0x09, 0x0A,
-    0x04, 0x05, 0x07, 0x0A,
-    0x04, 0x0A, 0x0A, 0x0A,
-    0x04, 0x04, 0x0A, 0x0A,
-    0x04, 0x04, 0x04, 0x0A,
-    0x04, 0x07, 0x08, 0x0B,
-    0x04, 0x07, 0x0A, 0x0B,
-    0x04, 0x05, 0x0A, 0x0B,
-    0x04, 0x05, 0x08, 0x0B,
-    0x04, 0x07, 0x09, 0x0C,
-    0x04, 0x08, 0x0A, 0x0C,
-    0x04, 0x06, 0x0A, 0x0C,
-    0x04, 0x06, 0x08, 0x0C,
-    0x04, 0x0C, 0x0C, 0x0C,
-    0x04, 0x04, 0x0C, 0x0C,
-    0x04, 0x04, 0x04, 0x0C,
-    0x04, 0x08, 0x0B, 0x0F,
-    0x04, 0x09, 0x0D, 0x0F,
-    0x04, 0x06, 0x0D, 0x0F,
-    0x04, 0x06, 0x0A, 0x0F,
-    0x04, 0x0F, 0x0F, 0x0F,
-    0x04, 0x04, 0x0F, 0x0F,
-    0x04, 0x04, 0x04, 0x0F,
-    0x04, 0x09, 0x0D, 0x12,
-    0x04, 0x0B, 0x0F, 0x12,
-    0x04, 0x07, 0x0F, 0x12,
-    0x04, 0x07, 0x0B, 0x12,
-    0x04, 0x12, 0x12, 0x12,
-    0x04, 0x04, 0x12, 0x12,
-    0x04, 0x04, 0x04, 0x12,
-    0x04, 0x0A, 0x0F, 0x15,
-    0x04, 0x0C, 0x11, 0x15,
-    0x04, 0x08, 0x11, 0x15,
-    0x04, 0x08, 0x0D, 0x15,
-    0x04, 0x15, 0x15, 0x15,
-    0x04, 0x04, 0x15, 0x15,
-    0x04, 0x04, 0x04, 0x15,
-    0x04, 0x0B, 0x11, 0x18,
-    0x04, 0x0E, 0x13, 0x18,
-    0x04, 0x09, 0x13, 0x18,
-    0x04, 0x09, 0x0E, 0x18,
-    0x04, 0x18, 0x18, 0x18,
-    0x04, 0x04, 0x18, 0x18,
-    0x04, 0x04, 0x04, 0x18,
-    0x04, 0x0F, 0x16, 0x1B,
-    0x04, 0x09, 0x16, 0x1B,
-    0x04, 0x09, 0x10, 0x1B,
-    0x04, 0x1B, 0x1B, 0x1B,
-    0x04, 0x04, 0x1B, 0x1B,
-    0x04, 0x04, 0x04, 0x1B,
-    0x04, 0x11, 0x18, 0x1E,
-    0x04, 0x0A, 0x18, 0x1E,
-    0x04, 0x0A, 0x11, 0x1E,
-    0x04, 0x1E, 0x1E, 0x1E,
-    0x04, 0x04, 0x1E, 0x1E,
-    0x04, 0x04, 0x04, 0x1E,
-    0x04, 0x12, 0x1A, 0x21,
-    0x04, 0x0B, 0x1A, 0x21,
-    0x04, 0x0B, 0x13, 0x21,
-    0x04, 0x21, 0x21, 0x21,
-    0x04, 0x04, 0x21, 0x21,
-    0x04, 0x04, 0x04, 0x21,
-    0x04, 0x14, 0x1C, 0x24,
-    0x04, 0x0C, 0x1C, 0x24,
-    0x04, 0x0C, 0x14, 0x24,
-    0x04, 0x24, 0x24, 0x24,
-    0x04, 0x04, 0x24, 0x24,
-    0x04, 0x04, 0x04, 0x24,
-    0x04, 0x27, 0x27, 0x27,
-    0x04, 0x04, 0x27, 0x27,
-    0x04, 0x04, 0x04, 0x27,
-    0x04, 0x16, 0x1F, 0x28,
-    0x04, 0x0D, 0x1F, 0x28,
-    0x04, 0x0D, 0x16, 0x28,
-    0x04, 0x2C, 0x2C, 0x2C,
-    0x04, 0x04, 0x2C, 0x2C,
-    0x04, 0x04, 0x04, 0x2C,
-    0x04, 0x32, 0x32, 0x32,
-    0x04, 0x04, 0x32, 0x32,
-    0x04, 0x04, 0x04, 0x32,
-    0x05, 0x06, 0x06, 0x07,
-    0x05, 0x06, 0x07, 0x08,
-    0x05, 0x07, 0x08, 0x09,
-    0x05, 0x06, 0x08, 0x09,
-    0x05, 0x06, 0x07, 0x09,
-    0x05, 0x07, 0x08, 0x0A,
-    0x05, 0x07, 0x09, 0x0A,
-    0x05, 0x06, 0x09, 0x0A,
-    0x05, 0x06, 0x08, 0x0A,
-    0x05, 0x07, 0x09, 0x0B,
-    0x05, 0x08, 0x0A, 0x0B,
-    0x05, 0x06, 0x0A, 0x0B,
-    0x05, 0x06, 0x08, 0x0B,
-    0x05, 0x0B, 0x0B, 0x0B,
-    0x05, 0x05, 0x0B, 0x0B,
-    0x05, 0x05, 0x05, 0x0B,
-    0x05, 0x08, 0x09, 0x0C,
-    0x05, 0x08, 0x0B, 0x0C,
-    0x05, 0x06, 0x0B, 0x0C,
-    0x05, 0x06, 0x09, 0x0C,
-    0x05, 0x08, 0x0A, 0x0D,
-    0x05, 0x09, 0x0B, 0x0D,
-    0x05, 0x07, 0x0B, 0x0D,
-    0x05, 0x07, 0x09, 0x0D,
-    0x05, 0x0D, 0x0D, 0x0D,
-    0x05, 0x05, 0x0D, 0x0D,
-    0x05, 0x05, 0x05, 0x0D,
-    0x05, 0x09, 0x0C, 0x10,
-    0x05, 0x0A, 0x0E, 0x10,
-    0x05, 0x07, 0x0E, 0x10,
-    0x05, 0x07, 0x0B, 0x10,
-    0x05, 0x10, 0x10, 0x10,
-    0x05, 0x05, 0x10, 0x10,
-    0x05, 0x05, 0x05, 0x10,
-    0x05, 0x0A, 0x0E, 0x13,
-    0x05, 0x0C, 0x10, 0x13,
-    0x05, 0x08, 0x10, 0x13,
-    0x05, 0x08, 0x0C, 0x13,
-    0x05, 0x13, 0x13, 0x13,
-    0x05, 0x05, 0x13, 0x13,
-    0x05, 0x05, 0x05, 0x13,
-    0x05, 0x0B, 0x10, 0x16,
-    0x05, 0x0D, 0x12, 0x16,
-    0x05, 0x09, 0x12, 0x16,
-    0x05, 0x09, 0x0E, 0x16,
-    0x05, 0x16, 0x16, 0x16,
-    0x05, 0x05, 0x16, 0x16,
-    0x05, 0x05, 0x05, 0x16,
-    0x05, 0x0C, 0x12, 0x19,
-    0x05, 0x0F, 0x14, 0x19,
-    0x05, 0x0A, 0x14, 0x19,
-    0x05, 0x0A, 0x0F, 0x19,
-    0x05, 0x19, 0x19, 0x19,
-    0x05, 0x05, 0x19, 0x19,
-    0x05, 0x05, 0x05, 0x19,
-    0x05, 0x10, 0x17, 0x1C,
-    0x05, 0x0A, 0x17, 0x1C,
-    0x05, 0x0A, 0x11, 0x1C,
-    0x05, 0x1C, 0x1C, 0x1C,
-    0x05, 0x05, 0x1C, 0x1C,
-    0x05, 0x05, 0x05, 0x1C,
-    0x05, 0x12, 0x19, 0x1F,
-    0x05, 0x0B, 0x19, 0x1F,
-    0x05, 0x0B, 0x12, 0x1F,
-    0x05, 0x1F, 0x1F, 0x1F,
-    0x05, 0x05, 0x1F, 0x1F,
-    0x05, 0x05, 0x05, 0x1F,
-    0x05, 0x13, 0x1B, 0x22,
-    0x05, 0x0C, 0x1B, 0x22,
-    0x05, 0x0C, 0x14, 0x22,
-    0x05, 0x22, 0x22, 0x22,
-    0x05, 0x05, 0x22, 0x22,
-    0x05, 0x05, 0x05, 0x22,
-    0x05, 0x15, 0x1D, 0x25,
-    0x05, 0x0D, 0x1D, 0x25,
-    0x05, 0x0D, 0x15, 0x25,
-    0x05, 0x25, 0x25, 0x25,
-    0x05, 0x05, 0x25, 0x25,
-    0x05, 0x05, 0x05, 0x25,
-    0x05, 0x28, 0x28, 0x28,
-    0x05, 0x05, 0x28, 0x28,
-    0x05, 0x05, 0x05, 0x28,
-    0x05, 0x17, 0x20, 0x29,
-    0x05, 0x0E, 0x20, 0x29,
-    0x05, 0x0E, 0x17, 0x29,
-    0x05, 0x2D, 0x2D, 0x2D,
-    0x05, 0x05, 0x2D, 0x2D,
-    0x05, 0x05, 0x05, 0x2D,
-    0x05, 0x33, 0x33, 0x33,
-    0x05, 0x05, 0x33, 0x33,
-    0x05, 0x05, 0x05, 0x33,
-    0x06, 0x07, 0x07, 0x08,
-    0x06, 0x07, 0x08, 0x09,
-    0x06, 0x08, 0x09, 0x0A,
-    0x06, 0x07, 0x09, 0x0A,
-    0x06, 0x07, 0x08, 0x0A,
-    0x06, 0x08, 0x09, 0x0B,
-    0x06, 0x08, 0x0A, 0x0B,
-    0x06, 0x07, 0x0A, 0x0B,
-    0x06, 0x07, 0x09, 0x0B,
-    0x06, 0x08, 0x0A, 0x0C,
-    0x06, 0x09, 0x0B, 0x0C,
-    0x06, 0x07, 0x0B, 0x0C,
-    0x06, 0x07, 0x09, 0x0C,
-    0x06, 0x0C, 0x0C, 0x0C,
-    0x06, 0x06, 0x0C, 0x0C,
-    0x06, 0x06, 0x06, 0x0C,
-    0x06, 0x09, 0x0A, 0x0D,
-    0x06, 0x09, 0x0C, 0x0D,
-    0x06, 0x07, 0x0C, 0x0D,
-    0x06, 0x07, 0x0A, 0x0D,
-    0x06, 0x09, 0x0B, 0x0E,
-    0x06, 0x0A, 0x0C, 0x0E,
-    0x06, 0x08, 0x0C, 0x0E,
-    0x06, 0x08, 0x0A, 0x0E,
-    0x06, 0x0E, 0x0E, 0x0E,
-    0x06, 0x06, 0x0E, 0x0E,
-    0x06, 0x06, 0x06, 0x0E,
-    0x06, 0x0A, 0x0D, 0x11,
-    0x06, 0x0B, 0x0F, 0x11,
-    0x06, 0x08, 0x0F, 0x11,
-    0x06, 0x08, 0x0C, 0x11,
-    0x06, 0x11, 0x11, 0x11,
-    0x06, 0x06, 0x11, 0x11,
-    0x06, 0x06, 0x06, 0x11,
-    0x06, 0x0B, 0x0F, 0x14,
-    0x06, 0x0D, 0x11, 0x14,
-    0x06, 0x09, 0x11, 0x14,
-    0x06, 0x09, 0x0D, 0x14,
-    0x06, 0x14, 0x14, 0x14,
-    0x06, 0x06, 0x14, 0x14,
-    0x06, 0x06, 0x06, 0x14,
-    0x06, 0x0C, 0x11, 0x17,
-    0x06, 0x0E, 0x13, 0x17,
-    0x06, 0x0A, 0x13, 0x17,
-    0x06, 0x0A, 0x0F, 0x17,
-    0x06, 0x17, 0x17, 0x17,
-    0x06, 0x06, 0x17, 0x17,
-    0x06, 0x06, 0x06, 0x17,
-    0x06, 0x0D, 0x13, 0x1A,
-    0x06, 0x10, 0x15, 0x1A,
-    0x06, 0x0B, 0x15, 0x1A,
-    0x06, 0x0B, 0x10, 0x1A,
-    0x06, 0x1A, 0x1A, 0x1A,
-    0x06, 0x06, 0x1A, 0x1A,
-    0x06, 0x06, 0x06, 0x1A,
-    0x06, 0x11, 0x18, 0x1D,
-    0x06, 0x0B, 0x18, 0x1D,
-    0x06, 0x0B, 0x12, 0x1D,
-    0x06, 0x1D, 0x1D, 0x1D,
-    0x06, 0x06, 0x1D, 0x1D,
-    0x06, 0x06, 0x06, 0x1D,
-    0x06, 0x13, 0x1A, 0x20,
-    0x06, 0x0C, 0x1A, 0x20,
-    0x06, 0x0C, 0x13, 0x20,
-    0x06, 0x20, 0x20, 0x20,
-    0x06, 0x06, 0x20, 0x20,
-    0x06, 0x06, 0x06, 0x20,
-    0x06, 0x14, 0x1C, 0x23,
-    0x06, 0x0D, 0x1C, 0x23,
-    0x06, 0x0D, 0x15, 0x23,
-    0x06, 0x23, 0x23, 0x23,
-    0x06, 0x06, 0x23, 0x23,
-    0x06, 0x06, 0x06, 0x23,
-    0x06, 0x16, 0x1E, 0x26,
-    0x06, 0x0E, 0x1E, 0x26,
-    0x06, 0x0E, 0x16, 0x26,
-    0x06, 0x26, 0x26, 0x26,
-    0x06, 0x06, 0x26, 0x26,
-    0x06, 0x06, 0x06, 0x26,
-    0x06, 0x29, 0x29, 0x29,
-    0x06, 0x06, 0x29, 0x29,
-    0x06, 0x06, 0x06, 0x29,
-    0x06, 0x18, 0x21, 0x2A,
-    0x06, 0x0F, 0x21, 0x2A,
-    0x06, 0x0F, 0x18, 0x2A,
-    0x06, 0x2E, 0x2E, 0x2E,
-    0x06, 0x06, 0x2E, 0x2E,
-    0x06, 0x06, 0x06, 0x2E,
-    0x06, 0x34, 0x34, 0x34,
-    0x06, 0x06, 0x34, 0x34,
-    0x06, 0x06, 0x06, 0x34,
-    0x07, 0x08, 0x08, 0x09,
-    0x07, 0x08, 0x09, 0x0A,
-    0x07, 0x09, 0x0A, 0x0B,
-    0x07, 0x08, 0x0A, 0x0B,
-    0x07, 0x08, 0x09, 0x0B,
-    0x07, 0x09, 0x0A, 0x0C,
-    0x07, 0x09, 0x0B, 0x0C,
-    0x07, 0x08, 0x0B, 0x0C,
-    0x07, 0x08, 0x0A, 0x0C,
-    0x07, 0x09, 0x0B, 0x0D,
-    0x07, 0x0A, 0x0C, 0x0D,
-    0x07, 0x08, 0x0C, 0x0D,
-    0x07, 0x08, 0x0A, 0x0D,
-    0x07, 0x0D, 0x0D, 0x0D,
-    0x07, 0x07, 0x0D, 0x0D,
-    0x07, 0x07, 0x07, 0x0D,
-    0x07, 0x0A, 0x0B, 0x0E,
-    0x07, 0x0A, 0x0D, 0x0E,
-    0x07, 0x08, 0x0D, 0x0E,
-    0x07, 0x08, 0x0B, 0x0E,
-    0x07, 0x0A, 0x0C, 0x0F,
-    0x07, 0x0B, 0x0D, 0x0F,
-    0x07, 0x09, 0x0D, 0x0F,
-    0x07, 0x09, 0x0B, 0x0F,
-    0x07, 0x0F, 0x0F, 0x0F,
-    0x07, 0x07, 0x0F, 0x0F,
-    0x07, 0x07, 0x07, 0x0F,
-    0x07, 0x0B, 0x0E, 0x12,
-    0x07, 0x0C, 0x10, 0x12,
-    0x07, 0x09, 0x10, 0x12,
-    0x07, 0x09, 0x0D, 0x12,
-    0x07, 0x12, 0x12, 0x12,
-    0x07, 0x07, 0x12, 0x12,
-    0x07, 0x07, 0x07, 0x12,
-    0x07, 0x0C, 0x10, 0x15,
-    0x07, 0x0E, 0x12, 0x15,
-    0x07, 0x0A, 0x12, 0x15,
-    0x07, 0x0A, 0x0E, 0x15,
-    0x07, 0x15, 0x15, 0x15,
-    0x07, 0x07, 0x15, 0x15,
-    0x07, 0x07, 0x07, 0x15,
-    0x07, 0x0D, 0x12, 0x18,
-    0x07, 0x0F, 0x14, 0x18,
-    0x07, 0x0B, 0x14, 0x18,
-    0x07, 0x0B, 0x10, 0x18,
-    0x07, 0x18, 0x18, 0x18,
-    0x07, 0x07, 0x18, 0x18,
-    0x07, 0x07, 0x07, 0x18,
-    0x07, 0x0E, 0x14, 0x1B,
-    0x07, 0x11, 0x16, 0x1B,
-    0x07, 0x0C, 0x16, 0x1B,
-    0x07, 0x0C, 0x11, 0x1B,
-    0x07, 0x1B, 0x1B, 0x1B,
-    0x07, 0x07, 0x1B, 0x1B,
-    0x07, 0x07, 0x07, 0x1B,
-    0x07, 0x12, 0x19, 0x1E,
-    0x07, 0x0C, 0x19, 0x1E,
-    0x07, 0x0C, 0x13, 0x1E,
-    0x07, 0x1E, 0x1E, 0x1E,
-    0x07, 0x07, 0x1E, 0x1E,
-    0x07, 0x07, 0x07, 0x1E,
-    0x07, 0x14, 0x1B, 0x21,
-    0x07, 0x0D, 0x1B, 0x21,
-    0x07, 0x0D, 0x14, 0x21,
-    0x07, 0x21, 0x21, 0x21,
-    0x07, 0x07, 0x21, 0x21,
-    0x07, 0x07, 0x07, 0x21,
-    0x07, 0x15, 0x1D, 0x24,
-    0x07, 0x0E, 0x1D, 0x24,
-    0x07, 0x0E, 0x16, 0x24,
-    0x07, 0x24, 0x24, 0x24,
-    0x07, 0x07, 0x24, 0x24,
-    0x07, 0x07, 0x07, 0x24,
-    0x07, 0x17, 0x1F, 0x27,
-    0x07, 0x0F, 0x1F, 0x27,
-    0x07, 0x0F, 0x17, 0x27,
-    0x07, 0x27, 0x27, 0x27,
-    0x07, 0x07, 0x27, 0x27,
-    0x07, 0x07, 0x07, 0x27,
-    0x07, 0x2A, 0x2A, 0x2A,
-    0x07, 0x07, 0x2A, 0x2A,
-    0x07, 0x07, 0x07, 0x2A,
-    0x07, 0x19, 0x22, 0x2B,
-    0x07, 0x10, 0x22, 0x2B,
-    0x07, 0x10, 0x19, 0x2B,
-    0x07, 0x2F, 0x2F, 0x2F,
-    0x07, 0x07, 0x2F, 0x2F,
-    0x07, 0x07, 0x07, 0x2F,
-    0x07, 0x35, 0x35, 0x35,
-    0x07, 0x07, 0x35, 0x35,
-    0x07, 0x07, 0x07, 0x35,
-    0x08, 0x09, 0x09, 0x0A,
-    0x08, 0x09, 0x0A, 0x0B,
-    0x08, 0x0A, 0x0B, 0x0C,
-    0x08, 0x09, 0x0B, 0x0C,
-    0x08, 0x09, 0x0A, 0x0C,
-    0x08, 0x0A, 0x0B, 0x0D,
-    0x08, 0x0A, 0x0C, 0x0D,
-    0x08, 0x09, 0x0C, 0x0D,
-    0x08, 0x09, 0x0B, 0x0D,
-    0x08, 0x0A, 0x0C, 0x0E,
-    0x08, 0x0B, 0x0D, 0x0E,
-    0x08, 0x09, 0x0D, 0x0E,
-    0x08, 0x09, 0x0B, 0x0E,
-    0x08, 0x0E, 0x0E, 0x0E,
-    0x08, 0x08, 0x0E, 0x0E,
-    0x08, 0x08, 0x08, 0x0E,
-    0x08, 0x0B, 0x0C, 0x0F,
-    0x08, 0x0B, 0x0E, 0x0F,
-    0x08, 0x09, 0x0E, 0x0F,
-    0x08, 0x09, 0x0C, 0x0F,
-    0x08, 0x0B, 0x0D, 0x10,
-    0x08, 0x0C, 0x0E, 0x10,
-    0x08, 0x0A, 0x0E, 0x10,
-    0x08, 0x0A, 0x0C, 0x10,
-    0x08, 0x10, 0x10, 0x10,
-    0x08, 0x08, 0x10, 0x10,
-    0x08, 0x08, 0x08, 0x10,
-    0x08, 0x0C, 0x0F, 0x13,
-    0x08, 0x0D, 0x11, 0x13,
-    0x08, 0x0A, 0x11, 0x13,
-    0x08, 0x0A, 0x0E, 0x13,
-    0x08, 0x13, 0x13, 0x13,
-    0x08, 0x08, 0x13, 0x13,
-    0x08, 0x08, 0x08, 0x13,
-    0x08, 0x0D, 0x11, 0x16,
-    0x08, 0x0F, 0x13, 0x16,
-    0x08, 0x0B, 0x13, 0x16,
-    0x08, 0x0B, 0x0F, 0x16,
-    0x08, 0x16, 0x16, 0x16,
-    0x08, 0x08, 0x16, 0x16,
-    0x08, 0x08, 0x08, 0x16,
-    0x08, 0x0E, 0x13, 0x19,
-    0x08, 0x10, 0x15, 0x19,
-    0x08, 0x0C, 0x15, 0x19,
-    0x08, 0x0C, 0x11, 0x19,
-    0x08, 0x19, 0x19, 0x19,
-    0x08, 0x08, 0x19, 0x19,
-    0x08, 0x08, 0x08, 0x19,
-    0x08, 0x0F, 0x15, 0x1C,
-    0x08, 0x12, 0x17, 0x1C,
-    0x08, 0x0D, 0x17, 0x1C,
-    0x08, 0x0D, 0x12, 0x1C,
-    0x08, 0x1C, 0x1C, 0x1C,
-    0x08, 0x08, 0x1C, 0x1C,
-    0x08, 0x08, 0x08, 0x1C,
-    0x08, 0x13, 0x1A, 0x1F,
-    0x08, 0x0D, 0x1A, 0x1F,
-    0x08, 0x0D, 0x14, 0x1F,
-    0x08, 0x1F, 0x1F, 0x1F,
-    0x08, 0x08, 0x1F, 0x1F,
-    0x08, 0x08, 0x08, 0x1F,
-    0x08, 0x15, 0x1C, 0x22,
-    0x08, 0x0E, 0x1C, 0x22,
-    0x08, 0x0E, 0x15, 0x22,
-    0x08, 0x22, 0x22, 0x22,
-    0x08, 0x08, 0x22, 0x22,
-    0x08, 0x08, 0x08, 0x22,
-    0x08, 0x16, 0x1E, 0x25,
-    0x08, 0x0F, 0x1E, 0x25,
-    0x08, 0x0F, 0x17, 0x25,
-    0x08, 0x25, 0x25, 0x25,
-    0x08, 0x08, 0x25, 0x25,
-    0x08, 0x08, 0x08, 0x25,
-    0x08, 0x18, 0x20, 0x28,
-    0x08, 0x10, 0x20, 0x28,
-    0x08, 0x10, 0x18, 0x28,
-    0x08, 0x28, 0x28, 0x28,
-    0x08, 0x08, 0x28, 0x28,
-    0x08, 0x08, 0x08, 0x28,
-    0x08, 0x2B, 0x2B, 0x2B,
-    0x08, 0x08, 0x2B, 0x2B,
-    0x08, 0x08, 0x08, 0x2B,
-    0x08, 0x1A, 0x23, 0x2C,
-    0x08, 0x11, 0x23, 0x2C,
-    0x08, 0x11, 0x1A, 0x2C,
-    0x08, 0x30, 0x30, 0x30,
-    0x08, 0x08, 0x30, 0x30,
-    0x08, 0x08, 0x08, 0x30,
-    0x08, 0x36, 0x36, 0x36,
-    0x08, 0x08, 0x36, 0x36,
-    0x08, 0x08, 0x08, 0x36,
-    0x09, 0x0A, 0x0A, 0x0B,
-    0x09, 0x0A, 0x0B, 0x0C,
-    0x09, 0x0B, 0x0C, 0x0D,
-    0x09, 0x0A, 0x0C, 0x0D,
-    0x09, 0x0A, 0x0B, 0x0D,
-    0x09, 0x0B, 0x0C, 0x0E,
-    0x09, 0x0B, 0x0D, 0x0E,
-    0x09, 0x0A, 0x0D, 0x0E,
-    0x09, 0x0A, 0x0C, 0x0E,
-    0x09, 0x0B, 0x0D, 0x0F,
-    0x09, 0x0C, 0x0E, 0x0F,
-    0x09, 0x0A, 0x0E, 0x0F,
-    0x09, 0x0A, 0x0C, 0x0F,
-    0x09, 0x0F, 0x0F, 0x0F,
-    0x09, 0x09, 0x0F, 0x0F,
-    0x09, 0x09, 0x09, 0x0F,
-    0x09, 0x0C, 0x0D, 0x10,
-    0x09, 0x0C, 0x0F, 0x10,
-    0x09, 0x0A, 0x0F, 0x10,
-    0x09, 0x0A, 0x0D, 0x10,
-    0x09, 0x0C, 0x0E, 0x11,
-    0x09, 0x0D, 0x0F, 0x11,
-    0x09, 0x0B, 0x0F, 0x11,
-    0x09, 0x0B, 0x0D, 0x11,
-    0x09, 0x11, 0x11, 0x11,
-    0x09, 0x09, 0x11, 0x11,
-    0x09, 0x09, 0x09, 0x11,
-    0x09, 0x0D, 0x10, 0x14,
-    0x09, 0x0E, 0x12, 0x14,
-    0x09, 0x0B, 0x12, 0x14,
-    0x09, 0x0B, 0x0F, 0x14,
-    0x09, 0x14, 0x14, 0x14,
-    0x09, 0x09, 0x14, 0x14,
-    0x09, 0x09, 0x09, 0x14,
-    0x09, 0x0E, 0x12, 0x17,
-    0x09, 0x10, 0x14, 0x17,
-    0x09, 0x0C, 0x14, 0x17,
-    0x09, 0x0C, 0x10, 0x17,
-    0x09, 0x17, 0x17, 0x17,
-    0x09, 0x09, 0x17, 0x17,
-    0x09, 0x09, 0x09, 0x17,
-    0x09, 0x0F, 0x14, 0x1A,
-    0x09, 0x11, 0x16, 0x1A,
-    0x09, 0x0D, 0x16, 0x1A,
-    0x09, 0x0D, 0x12, 0x1A,
-    0x09, 0x1A, 0x1A, 0x1A,
-    0x09, 0x09, 0x1A, 0x1A,
-    0x09, 0x09, 0x09, 0x1A,
-    0x09, 0x10, 0x16, 0x1D,
-    0x09, 0x13, 0x18, 0x1D,
-    0x09, 0x0E, 0x18, 0x1D,
-    0x09, 0x0E, 0x13, 0x1D,
-    0x09, 0x1D, 0x1D, 0x1D,
-    0x09, 0x09, 0x1D, 0x1D,
-    0x09, 0x09, 0x09, 0x1D,
-    0x09, 0x14, 0x1B, 0x20,
-    0x09, 0x0E, 0x1B, 0x20,
-    0x09, 0x0E, 0x15, 0x20,
-    0x09, 0x20, 0x20, 0x20,
-    0x09, 0x09, 0x20, 0x20,
-    0x09, 0x09, 0x09, 0x20,
-    0x09, 0x16, 0x1D, 0x23,
-    0x09, 0x0F, 0x1D, 0x23,
-    0x09, 0x0F, 0x16, 0x23,
-    0x09, 0x23, 0x23, 0x23,
-    0x09, 0x09, 0x23, 0x23,
-    0x09, 0x09, 0x09, 0x23,
-    0x09, 0x17, 0x1F, 0x26,
-    0x09, 0x10, 0x1F, 0x26,
-    0x09, 0x10, 0x18, 0x26,
-    0x09, 0x26, 0x26, 0x26,
-    0x09, 0x09, 0x26, 0x26,
-    0x09, 0x09, 0x09, 0x26,
-    0x09, 0x19, 0x21, 0x29,
-    0x09, 0x11, 0x21, 0x29,
-    0x09, 0x11, 0x19, 0x29,
-    0x09, 0x29, 0x29, 0x29,
-    0x09, 0x09, 0x29, 0x29,
-    0x09, 0x09, 0x09, 0x29,
-    0x09, 0x2C, 0x2C, 0x2C,
-    0x09, 0x09, 0x2C, 0x2C,
-    0x09, 0x09, 0x09, 0x2C,
-    0x09, 0x1B, 0x24, 0x2D,
-    0x09, 0x12, 0x24, 0x2D,
-    0x09, 0x12, 0x1B, 0x2D,
-    0x09, 0x31, 0x31, 0x31,
-    0x09, 0x09, 0x31, 0x31,
-    0x09, 0x09, 0x09, 0x31,
-    0x09, 0x37, 0x37, 0x37,
-    0x09, 0x09, 0x37, 0x37,
-    0x09, 0x09, 0x09, 0x37,
-    0x0A, 0x0B, 0x0B, 0x0C,
-    0x0A, 0x0B, 0x0C, 0x0D,
-    0x0A, 0x0C, 0x0D, 0x0E,
-    0x0A, 0x0B, 0x0D, 0x0E,
-    0x0A, 0x0B, 0x0C, 0x0E,
-    0x0A, 0x0C, 0x0D, 0x0F,
-    0x0A, 0x0C, 0x0E, 0x0F,
-    0x0A, 0x0B, 0x0E, 0x0F,
-    0x0A, 0x0B, 0x0D, 0x0F,
-    0x0A, 0x0C, 0x0E, 0x10,
-    0x0A, 0x0D, 0x0F, 0x10,
-    0x0A, 0x0B, 0x0F, 0x10,
-    0x0A, 0x0B, 0x0D, 0x10,
-    0x0A, 0x10, 0x10, 0x10,
-    0x0A, 0x0A, 0x10, 0x10,
-    0x0A, 0x0A, 0x0A, 0x10,
-    0x0A, 0x0D, 0x0E, 0x11,
-    0x0A, 0x0D, 0x10, 0x11,
-    0x0A, 0x0B, 0x10, 0x11,
-    0x0A, 0x0B, 0x0E, 0x11,
-    0x0A, 0x0D, 0x0F, 0x12,
-    0x0A, 0x0E, 0x10, 0x12,
-    0x0A, 0x0C, 0x10, 0x12,
-    0x0A, 0x0C, 0x0E, 0x12,
-    0x0A, 0x12, 0x12, 0x12,
-    0x0A, 0x0A, 0x12, 0x12,
-    0x0A, 0x0A, 0x0A, 0x12,
-    0x0A, 0x0E, 0x11, 0x15,
-    0x0A, 0x0F, 0x13, 0x15,
-    0x0A, 0x0C, 0x13, 0x15,
-    0x0A, 0x0C, 0x10, 0x15,
-    0x0A, 0x15, 0x15, 0x15,
-    0x0A, 0x0A, 0x15, 0x15,
-    0x0A, 0x0A, 0x0A, 0x15,
-    0x0A, 0x0F, 0x13, 0x18,
-    0x0A, 0x11, 0x15, 0x18,
-    0x0A, 0x0D, 0x15, 0x18,
-    0x0A, 0x0D, 0x11, 0x18,
-    0x0A, 0x18, 0x18, 0x18,
-    0x0A, 0x0A, 0x18, 0x18,
-    0x0A, 0x0A, 0x0A, 0x18,
-    0x0A, 0x10, 0x15, 0x1B,
-    0x0A, 0x12, 0x17, 0x1B,
-    0x0A, 0x0E, 0x17, 0x1B,
-    0x0A, 0x0E, 0x13, 0x1B,
-    0x0A, 0x1B, 0x1B, 0x1B,
-    0x0A, 0x0A, 0x1B, 0x1B,
-    0x0A, 0x0A, 0x0A, 0x1B,
-    0x0A, 0x11, 0x17, 0x1E,
-    0x0A, 0x14, 0x19, 0x1E,
-    0x0A, 0x0F, 0x19, 0x1E,
-    0x0A, 0x0F, 0x14, 0x1E,
-    0x0A, 0x1E, 0x1E, 0x1E,
-    0x0A, 0x0A, 0x1E, 0x1E,
-    0x0A, 0x0A, 0x0A, 0x1E,
-    0x0A, 0x15, 0x1C, 0x21,
-    0x0A, 0x0F, 0x1C, 0x21,
-    0x0A, 0x0F, 0x16, 0x21,
-    0x0A, 0x21, 0x21, 0x21,
-    0x0A, 0x0A, 0x21, 0x21,
-    0x0A, 0x0A, 0x0A, 0x21,
-    0x0A, 0x17, 0x1E, 0x24,
-    0x0A, 0x10, 0x1E, 0x24,
-    0x0A, 0x10, 0x17, 0x24,
-    0x0A, 0x24, 0x24, 0x24,
-    0x0A, 0x0A, 0x24, 0x24,
-    0x0A, 0x0A, 0x0A, 0x24,
-    0x0A, 0x18, 0x20, 0x27,
-    0x0A, 0x11, 0x20, 0x27,
-    0x0A, 0x11, 0x19, 0x27,
-    0x0A, 0x27, 0x27, 0x27,
-    0x0A, 0x0A, 0x27, 0x27,
-    0x0A, 0x0A, 0x0A, 0x27,
-    0x0A, 0x1A, 0x22, 0x2A,
-    0x0A, 0x12, 0x22, 0x2A,
-    0x0A, 0x12, 0x1A, 0x2A,
-    0x0A, 0x2A, 0x2A, 0x2A,
-    0x0A, 0x0A, 0x2A, 0x2A,
-    0x0A, 0x0A, 0x0A, 0x2A,
-    0x0A, 0x2D, 0x2D, 0x2D,
-    0x0A, 0x0A, 0x2D, 0x2D,
-    0x0A, 0x0A, 0x0A, 0x2D,
-    0x0A, 0x1C, 0x25, 0x2E,
-    0x0A, 0x13, 0x25, 0x2E,
-    0x0A, 0x13, 0x1C, 0x2E,
-    0x0A, 0x32, 0x32, 0x32,
-    0x0A, 0x0A, 0x32, 0x32,
-    0x0A, 0x0A, 0x0A, 0x32,
-    0x0A, 0x38, 0x38, 0x38,
-    0x0A, 0x0A, 0x38, 0x38,
-    0x0A, 0x0A, 0x0A, 0x38,
-    0x0B, 0x0C, 0x0C, 0x0D,
-    0x0B, 0x0C, 0x0D, 0x0E,
-    0x0B, 0x0D, 0x0E, 0x0F,
-    0x0B, 0x0C, 0x0E, 0x0F,
-    0x0B, 0x0C, 0x0D, 0x0F,
-    0x0B, 0x0D, 0x0E, 0x10,
-    0x0B, 0x0D, 0x0F, 0x10,
-    0x0B, 0x0C, 0x0F, 0x10,
-    0x0B, 0x0C, 0x0E, 0x10,
-    0x0B, 0x0D, 0x0F, 0x11,
-    0x0B, 0x0E, 0x10, 0x11,
-    0x0B, 0x0C, 0x10, 0x11,
-    0x0B, 0x0C, 0x0E, 0x11,
-    0x0B, 0x11, 0x11, 0x11,
-    0x0B, 0x0B, 0x11, 0x11,
-    0x0B, 0x0B, 0x0B, 0x11,
-    0x0B, 0x0E, 0x0F, 0x12,
-    0x0B, 0x0E, 0x11, 0x12,
-    0x0B, 0x0C, 0x11, 0x12,
-    0x0B, 0x0C, 0x0F, 0x12,
-    0x0B, 0x0E, 0x10, 0x13,
-    0x0B, 0x0F, 0x11, 0x13,
-    0x0B, 0x0D, 0x11, 0x13,
-    0x0B, 0x0D, 0x0F, 0x13,
-    0x0B, 0x13, 0x13, 0x13,
-    0x0B, 0x0B, 0x13, 0x13,
-    0x0B, 0x0B, 0x0B, 0x13,
-    0x0B, 0x0F, 0x12, 0x16,
-    0x0B, 0x10, 0x14, 0x16,
-    0x0B, 0x0D, 0x14, 0x16,
-    0x0B, 0x0D, 0x11, 0x16,
-    0x0B, 0x16, 0x16, 0x16,
-    0x0B, 0x0B, 0x16, 0x16,
-    0x0B, 0x0B, 0x0B, 0x16,
-    0x0B, 0x10, 0x14, 0x19,
-    0x0B, 0x12, 0x16, 0x19,
-    0x0B, 0x0E, 0x16, 0x19,
-    0x0B, 0x0E, 0x12, 0x19,
-    0x0B, 0x19, 0x19, 0x19,
-    0x0B, 0x0B, 0x19, 0x19,
-    0x0B, 0x0B, 0x0B, 0x19,
-    0x0B, 0x11, 0x16, 0x1C,
-    0x0B, 0x13, 0x18, 0x1C,
-    0x0B, 0x0F, 0x18, 0x1C,
-    0x0B, 0x0F, 0x14, 0x1C,
-    0x0B, 0x1C, 0x1C, 0x1C,
-    0x0B, 0x0B, 0x1C, 0x1C,
-    0x0B, 0x0B, 0x0B, 0x1C,
-    0x0B, 0x12, 0x18, 0x1F,
-    0x0B, 0x15, 0x1A, 0x1F,
-    0x0B, 0x10, 0x1A, 0x1F,
-    0x0B, 0x10, 0x15, 0x1F,
-    0x0B, 0x1F, 0x1F, 0x1F,
-    0x0B, 0x0B, 0x1F, 0x1F,
-    0x0B, 0x0B, 0x0B, 0x1F,
-    0x0B, 0x16, 0x1D, 0x22,
-    0x0B, 0x10, 0x1D, 0x22,
-    0x0B, 0x10, 0x17, 0x22,
-    0x0B, 0x22, 0x22, 0x22,
-    0x0B, 0x0B, 0x22, 0x22,
-    0x0B, 0x0B, 0x0B, 0x22,
-    0x0B, 0x18, 0x1F, 0x25,
-    0x0B, 0x11, 0x1F, 0x25,
-    0x0B, 0x11, 0x18, 0x25,
-    0x0B, 0x25, 0x25, 0x25,
-    0x0B, 0x0B, 0x25, 0x25,
-    0x0B, 0x0B, 0x0B, 0x25,
-    0x0B, 0x19, 0x21, 0x28,
-    0x0B, 0x12, 0x21, 0x28,
-    0x0B, 0x12, 0x1A, 0x28,
-    0x0B, 0x28, 0x28, 0x28,
-    0x0B, 0x0B, 0x28, 0x28,
-    0x0B, 0x0B, 0x0B, 0x28,
-    0x0B, 0x1B, 0x23, 0x2B,
-    0x0B, 0x13, 0x23, 0x2B,
-    0x0B, 0x13, 0x1B, 0x2B,
-    0x0B, 0x2B, 0x2B, 0x2B,
-    0x0B, 0x0B, 0x2B, 0x2B,
-    0x0B, 0x0B, 0x0B, 0x2B,
-    0x0B, 0x2E, 0x2E, 0x2E,
-    0x0B, 0x0B, 0x2E, 0x2E,
-    0x0B, 0x0B, 0x0B, 0x2E,
-    0x0B, 0x1D, 0x26, 0x2F,
-    0x0B, 0x14, 0x26, 0x2F,
-    0x0B, 0x14, 0x1D, 0x2F,
-    0x0B, 0x33, 0x33, 0x33,
-    0x0B, 0x0B, 0x33, 0x33,
-    0x0B, 0x0B, 0x0B, 0x33,
-    0x0B, 0x39, 0x39, 0x39,
-    0x0B, 0x0B, 0x39, 0x39,
-    0x0B, 0x0B, 0x0B, 0x39,
-    0x0C, 0x0D, 0x0D, 0x0E,
-    0x0C, 0x0D, 0x0E, 0x0F,
-    0x0C, 0x0E, 0x0F, 0x10,
-    0x0C, 0x0D, 0x0F, 0x10,
-    0x0C, 0x0D, 0x0E, 0x10,
-    0x0C, 0x0E, 0x0F, 0x11,
-    0x0C, 0x0E, 0x10, 0x11,
-    0x0C, 0x0D, 0x10, 0x11,
-    0x0C, 0x0D, 0x0F, 0x11,
-    0x0C, 0x0E, 0x10, 0x12,
-    0x0C, 0x0F, 0x11, 0x12,
-    0x0C, 0x0D, 0x11, 0x12,
-    0x0C, 0x0D, 0x0F, 0x12,
-    0x0C, 0x12, 0x12, 0x12,
-    0x0C, 0x0C, 0x12, 0x12,
-    0x0C, 0x0C, 0x0C, 0x12,
-    0x0C, 0x0F, 0x10, 0x13,
-    0x0C, 0x0F, 0x12, 0x13,
-    0x0C, 0x0D, 0x12, 0x13,
-    0x0C, 0x0D, 0x10, 0x13,
-    0x0C, 0x0F, 0x11, 0x14,
-    0x0C, 0x10, 0x12, 0x14,
-    0x0C, 0x0E, 0x12, 0x14,
-    0x0C, 0x0E, 0x10, 0x14,
-    0x0C, 0x14, 0x14, 0x14,
-    0x0C, 0x0C, 0x14, 0x14,
-    0x0C, 0x0C, 0x0C, 0x14,
-    0x0C, 0x10, 0x13, 0x17,
-    0x0C, 0x11, 0x15, 0x17,
-    0x0C, 0x0E, 0x15, 0x17,
-    0x0C, 0x0E, 0x12, 0x17,
-    0x0C, 0x17, 0x17, 0x17,
-    0x0C, 0x0C, 0x17, 0x17,
-    0x0C, 0x0C, 0x0C, 0x17,
-    0x0C, 0x11, 0x15, 0x1A,
-    0x0C, 0x13, 0x17, 0x1A,
-    0x0C, 0x0F, 0x17, 0x1A,
-    0x0C, 0x0F, 0x13, 0x1A,
-    0x0C, 0x1A, 0x1A, 0x1A,
-    0x0C, 0x0C, 0x1A, 0x1A,
-    0x0C, 0x0C, 0x0C, 0x1A,
-    0x0C, 0x12, 0x17, 0x1D,
-    0x0C, 0x14, 0x19, 0x1D,
-    0x0C, 0x10, 0x19, 0x1D,
-    0x0C, 0x10, 0x15, 0x1D,
-    0x0C, 0x1D, 0x1D, 0x1D,
-    0x0C, 0x0C, 0x1D, 0x1D,
-    0x0C, 0x0C, 0x0C, 0x1D,
-    0x0C, 0x13, 0x19, 0x20,
-    0x0C, 0x16, 0x1B, 0x20,
-    0x0C, 0x11, 0x1B, 0x20,
-    0x0C, 0x11, 0x16, 0x20,
-    0x0C, 0x20, 0x20, 0x20,
-    0x0C, 0x0C, 0x20, 0x20,
-    0x0C, 0x0C, 0x0C, 0x20,
-    0x0C, 0x17, 0x1E, 0x23,
-    0x0C, 0x11, 0x1E, 0x23,
-    0x0C, 0x11, 0x18, 0x23,
-    0x0C, 0x23, 0x23, 0x23,
-    0x0C, 0x0C, 0x23, 0x23,
-    0x0C, 0x0C, 0x0C, 0x23,
-    0x0C, 0x19, 0x20, 0x26,
-    0x0C, 0x12, 0x20, 0x26,
-    0x0C, 0x12, 0x19, 0x26,
-    0x0C, 0x26, 0x26, 0x26,
-    0x0C, 0x0C, 0x26, 0x26,
-    0x0C, 0x0C, 0x0C, 0x26,
-    0x0C, 0x1A, 0x22, 0x29,
-    0x0C, 0x13, 0x22, 0x29,
-    0x0C, 0x13, 0x1B, 0x29,
-    0x0C, 0x29, 0x29, 0x29,
-    0x0C, 0x0C, 0x29, 0x29,
-    0x0C, 0x0C, 0x0C, 0x29,
-    0x0C, 0x1C, 0x24, 0x2C,
-    0x0C, 0x14, 0x24, 0x2C,
-    0x0C, 0x14, 0x1C, 0x2C,
-    0x0C, 0x2C, 0x2C, 0x2C,
-    0x0C, 0x0C, 0x2C, 0x2C,
-    0x0C, 0x0C, 0x0C, 0x2C,
-    0x0C, 0x2F, 0x2F, 0x2F,
-    0x0C, 0x0C, 0x2F, 0x2F,
-    0x0C, 0x0C, 0x0C, 0x2F,
-    0x0C, 0x1E, 0x27, 0x30,
-    0x0C, 0x15, 0x27, 0x30,
-    0x0C, 0x15, 0x1E, 0x30,
-    0x0C, 0x34, 0x34, 0x34,
-    0x0C, 0x0C, 0x34, 0x34,
-    0x0C, 0x0C, 0x0C, 0x34,
-    0x0C, 0x3A, 0x3A, 0x3A,
-    0x0C, 0x0C, 0x3A, 0x3A,
-    0x0C, 0x0C, 0x0C, 0x3A,
-    0x0D, 0x0E, 0x0E, 0x0F,
-    0x0D, 0x0E, 0x0F, 0x10,
-    0x0D, 0x0F, 0x10, 0x11,
-    0x0D, 0x0E, 0x10, 0x11,
-    0x0D, 0x0E, 0x0F, 0x11,
-    0x0D, 0x0F, 0x10, 0x12,
-    0x0D, 0x0F, 0x11, 0x12,
-    0x0D, 0x0E, 0x11, 0x12,
-    0x0D, 0x0E, 0x10, 0x12,
-    0x0D, 0x0F, 0x11, 0x13,
-    0x0D, 0x10, 0x12, 0x13,
-    0x0D, 0x0E, 0x12, 0x13,
-    0x0D, 0x0E, 0x10, 0x13,
-    0x0D, 0x13, 0x13, 0x13,
-    0x0D, 0x0D, 0x13, 0x13,
-    0x0D, 0x0D, 0x0D, 0x13,
-    0x0D, 0x10, 0x11, 0x14,
-    0x0D, 0x10, 0x13, 0x14,
-    0x0D, 0x0E, 0x13, 0x14,
-    0x0D, 0x0E, 0x11, 0x14,
-    0x0D, 0x10, 0x12, 0x15,
-    0x0D, 0x11, 0x13, 0x15,
-    0x0D, 0x0F, 0x13, 0x15,
-    0x0D, 0x0F, 0x11, 0x15,
-    0x0D, 0x15, 0x15, 0x15,
-    0x0D, 0x0D, 0x15, 0x15,
-    0x0D, 0x0D, 0x0D, 0x15,
-    0x0D, 0x11, 0x14, 0x18,
-    0x0D, 0x12, 0x16, 0x18,
-    0x0D, 0x0F, 0x16, 0x18,
-    0x0D, 0x0F, 0x13, 0x18,
-    0x0D, 0x18, 0x18, 0x18,
-    0x0D, 0x0D, 0x18, 0x18,
-    0x0D, 0x0D, 0x0D, 0x18,
-    0x0D, 0x12, 0x16, 0x1B,
-    0x0D, 0x14, 0x18, 0x1B,
-    0x0D, 0x10, 0x18, 0x1B,
-    0x0D, 0x10, 0x14, 0x1B,
-    0x0D, 0x1B, 0x1B, 0x1B,
-    0x0D, 0x0D, 0x1B, 0x1B,
-    0x0D, 0x0D, 0x0D, 0x1B,
-    0x0D, 0x13, 0x18, 0x1E,
-    0x0D, 0x15, 0x1A, 0x1E,
-    0x0D, 0x11, 0x1A, 0x1E,
-    0x0D, 0x11, 0x16, 0x1E,
-    0x0D, 0x1E, 0x1E, 0x1E,
-    0x0D, 0x0D, 0x1E, 0x1E,
-    0x0D, 0x0D, 0x0D, 0x1E,
-    0x0D, 0x14, 0x1A, 0x21,
-    0x0D, 0x17, 0x1C, 0x21,
-    0x0D, 0x12, 0x1C, 0x21,
-    0x0D, 0x12, 0x17, 0x21,
-    0x0D, 0x21, 0x21, 0x21,
-    0x0D, 0x0D, 0x21, 0x21,
-    0x0D, 0x0D, 0x0D, 0x21,
-    0x0D, 0x18, 0x1F, 0x24,
-    0x0D, 0x12, 0x1F, 0x24,
-    0x0D, 0x12, 0x19, 0x24,
-    0x0D, 0x24, 0x24, 0x24,
-    0x0D, 0x0D, 0x24, 0x24,
-    0x0D, 0x0D, 0x0D, 0x24,
-    0x0D, 0x1A, 0x21, 0x27,
-    0x0D, 0x13, 0x21, 0x27,
-    0x0D, 0x13, 0x1A, 0x27,
-    0x0D, 0x27, 0x27, 0x27,
-    0x0D, 0x0D, 0x27, 0x27,
-    0x0D, 0x0D, 0x0D, 0x27,
-    0x0D, 0x1B, 0x23, 0x2A,
-    0x0D, 0x14, 0x23, 0x2A,
-    0x0D, 0x14, 0x1C, 0x2A,
-    0x0D, 0x2A, 0x2A, 0x2A,
-    0x0D, 0x0D, 0x2A, 0x2A,
-    0x0D, 0x0D, 0x0D, 0x2A,
-    0x0D, 0x1D, 0x25, 0x2D,
-    0x0D, 0x15, 0x25, 0x2D,
-    0x0D, 0x15, 0x1D, 0x2D,
-    0x0D, 0x2D, 0x2D, 0x2D,
-    0x0D, 0x0D, 0x2D, 0x2D,
-    0x0D, 0x0D, 0x0D, 0x2D,
-    0x0D, 0x30, 0x30, 0x30,
-    0x0D, 0x0D, 0x30, 0x30,
-    0x0D, 0x0D, 0x0D, 0x30,
-    0x0D, 0x1F, 0x28, 0x31,
-    0x0D, 0x16, 0x28, 0x31,
-    0x0D, 0x16, 0x1F, 0x31,
-    0x0D, 0x35, 0x35, 0x35,
-    0x0D, 0x0D, 0x35, 0x35,
-    0x0D, 0x0D, 0x0D, 0x35,
-    0x0D, 0x3B, 0x3B, 0x3B,
-    0x0D, 0x0D, 0x3B, 0x3B,
-    0x0D, 0x0D, 0x0D, 0x3B,
-    0x0E, 0x0F, 0x0F, 0x10,
-    0x0E, 0x0F, 0x10, 0x11,
-    0x0E, 0x10, 0x11, 0x12,
-    0x0E, 0x0F, 0x11, 0x12,
-    0x0E, 0x0F, 0x10, 0x12,
-    0x0E, 0x10, 0x11, 0x13,
-    0x0E, 0x10, 0x12, 0x13,
-    0x0E, 0x0F, 0x12, 0x13,
-    0x0E, 0x0F, 0x11, 0x13,
-    0x0E, 0x10, 0x12, 0x14,
-    0x0E, 0x11, 0x13, 0x14,
-    0x0E, 0x0F, 0x13, 0x14,
-    0x0E, 0x0F, 0x11, 0x14,
-    0x0E, 0x14, 0x14, 0x14,
-    0x0E, 0x0E, 0x14, 0x14,
-    0x0E, 0x0E, 0x0E, 0x14,
-    0x0E, 0x11, 0x12, 0x15,
-    0x0E, 0x11, 0x14, 0x15,
-    0x0E, 0x0F, 0x14, 0x15,
-    0x0E, 0x0F, 0x12, 0x15,
-    0x0E, 0x11, 0x13, 0x16,
-    0x0E, 0x12, 0x14, 0x16,
-    0x0E, 0x10, 0x14, 0x16,
-    0x0E, 0x10, 0x12, 0x16,
-    0x0E, 0x16, 0x16, 0x16,
-    0x0E, 0x0E, 0x16, 0x16,
-    0x0E, 0x0E, 0x0E, 0x16,
-    0x0E, 0x12, 0x15, 0x19,
-    0x0E, 0x13, 0x17, 0x19,
-    0x0E, 0x10, 0x17, 0x19,
-    0x0E, 0x10, 0x14, 0x19,
-    0x0E, 0x19, 0x19, 0x19,
-    0x0E, 0x0E, 0x19, 0x19,
-    0x0E, 0x0E, 0x0E, 0x19,
-    0x0E, 0x13, 0x17, 0x1C,
-    0x0E, 0x15, 0x19, 0x1C,
-    0x0E, 0x11, 0x19, 0x1C,
-    0x0E, 0x11, 0x15, 0x1C,
-    0x0E, 0x1C, 0x1C, 0x1C,
-    0x0E, 0x0E, 0x1C, 0x1C,
-    0x0E, 0x0E, 0x0E, 0x1C,
-    0x0E, 0x14, 0x19, 0x1F,
-    0x0E, 0x16, 0x1B, 0x1F,
-    0x0E, 0x12, 0x1B, 0x1F,
-    0x0E, 0x12, 0x17, 0x1F,
-    0x0E, 0x1F, 0x1F, 0x1F,
-    0x0E, 0x0E, 0x1F, 0x1F,
-    0x0E, 0x0E, 0x0E, 0x1F,
-    0x0E, 0x15, 0x1B, 0x22,
-    0x0E, 0x18, 0x1D, 0x22,
-    0x0E, 0x13, 0x1D, 0x22,
-    0x0E, 0x13, 0x18, 0x22,
-    0x0E, 0x22, 0x22, 0x22,
-    0x0E, 0x0E, 0x22, 0x22,
-    0x0E, 0x0E, 0x0E, 0x22,
-    0x0E, 0x19, 0x20, 0x25,
-    0x0E, 0x13, 0x20, 0x25,
-    0x0E, 0x13, 0x1A, 0x25,
-    0x0E, 0x25, 0x25, 0x25,
-    0x0E, 0x0E, 0x25, 0x25,
-    0x0E, 0x0E, 0x0E, 0x25,
-    0x0E, 0x1B, 0x22, 0x28,
-    0x0E, 0x14, 0x22, 0x28,
-    0x0E, 0x14, 0x1B, 0x28,
-    0x0E, 0x28, 0x28, 0x28,
-    0x0E, 0x0E, 0x28, 0x28,
-    0x0E, 0x0E, 0x0E, 0x28,
-    0x0E, 0x1C, 0x24, 0x2B,
-    0x0E, 0x15, 0x24, 0x2B,
-    0x0E, 0x15, 0x1D, 0x2B,
-    0x0E, 0x2B, 0x2B, 0x2B,
-    0x0E, 0x0E, 0x2B, 0x2B,
-    0x0E, 0x0E, 0x0E, 0x2B,
-    0x0E, 0x1E, 0x26, 0x2E,
-    0x0E, 0x16, 0x26, 0x2E,
-    0x0E, 0x16, 0x1E, 0x2E,
-    0x0E, 0x2E, 0x2E, 0x2E,
-    0x0E, 0x0E, 0x2E, 0x2E,
-    0x0E, 0x0E, 0x0E, 0x2E,
-    0x0E, 0x31, 0x31, 0x31,
-    0x0E, 0x0E, 0x31, 0x31,
-    0x0E, 0x0E, 0x0E, 0x31,
-    0x0E, 0x20, 0x29, 0x32,
-    0x0E, 0x17, 0x29, 0x32,
-    0x0E, 0x17, 0x20, 0x32,
-    0x0E, 0x36, 0x36, 0x36,
-    0x0E, 0x0E, 0x36, 0x36,
-    0x0E, 0x0E, 0x0E, 0x36,
-    0x0E, 0x3C, 0x3C, 0x3C,
-    0x0E, 0x0E, 0x3C, 0x3C,
-    0x0E, 0x0E, 0x0E, 0x3C,
-    0x0F, 0x10, 0x10, 0x11,
-    0x0F, 0x10, 0x11, 0x12,
-    0x0F, 0x11, 0x12, 0x13,
-    0x0F, 0x10, 0x12, 0x13,
-    0x0F, 0x10, 0x11, 0x13,
-    0x0F, 0x11, 0x12, 0x14,
-    0x0F, 0x11, 0x13, 0x14,
-    0x0F, 0x10, 0x13, 0x14,
-    0x0F, 0x10, 0x12, 0x14,
-    0x0F, 0x11, 0x13, 0x15,
-    0x0F, 0x12, 0x14, 0x15,
-    0x0F, 0x10, 0x14, 0x15,
-    0x0F, 0x10, 0x12, 0x15,
-    0x0F, 0x15, 0x15, 0x15,
-    0x0F, 0x0F, 0x15, 0x15,
-    0x0F, 0x0F, 0x0F, 0x15,
-    0x0F, 0x12, 0x13, 0x16,
-    0x0F, 0x12, 0x15, 0x16,
-    0x0F, 0x10, 0x15, 0x16,
-    0x0F, 0x10, 0x13, 0x16,
-    0x0F, 0x12, 0x14, 0x17,
-    0x0F, 0x13, 0x15, 0x17,
-    0x0F, 0x11, 0x15, 0x17,
-    0x0F, 0x11, 0x13, 0x17,
-    0x0F, 0x17, 0x17, 0x17,
-    0x0F, 0x0F, 0x17, 0x17,
-    0x0F, 0x0F, 0x0F, 0x17,
-    0x0F, 0x13, 0x16, 0x1A,
-    0x0F, 0x14, 0x18, 0x1A,
-    0x0F, 0x11, 0x18, 0x1A,
-    0x0F, 0x11, 0x15, 0x1A,
-    0x0F, 0x1A, 0x1A, 0x1A,
-    0x0F, 0x0F, 0x1A, 0x1A,
-    0x0F, 0x0F, 0x0F, 0x1A,
-    0x0F, 0x14, 0x18, 0x1D,
-    0x0F, 0x16, 0x1A, 0x1D,
-    0x0F, 0x12, 0x1A, 0x1D,
-    0x0F, 0x12, 0x16, 0x1D,
-    0x0F, 0x1D, 0x1D, 0x1D,
-    0x0F, 0x0F, 0x1D, 0x1D,
-    0x0F, 0x0F, 0x0F, 0x1D,
-    0x0F, 0x15, 0x1A, 0x20,
-    0x0F, 0x17, 0x1C, 0x20,
-    0x0F, 0x13, 0x1C, 0x20,
-    0x0F, 0x13, 0x18, 0x20,
-    0x0F, 0x20, 0x20, 0x20,
-    0x0F, 0x0F, 0x20, 0x20,
-    0x0F, 0x0F, 0x0F, 0x20,
-    0x0F, 0x16, 0x1C, 0x23,
-    0x0F, 0x19, 0x1E, 0x23,
-    0x0F, 0x14, 0x1E, 0x23,
-    0x0F, 0x14, 0x19, 0x23,
-    0x0F, 0x23, 0x23, 0x23,
-    0x0F, 0x0F, 0x23, 0x23,
-    0x0F, 0x0F, 0x0F, 0x23,
-    0x0F, 0x1A, 0x21, 0x26,
-    0x0F, 0x14, 0x21, 0x26,
-    0x0F, 0x14, 0x1B, 0x26,
-    0x0F, 0x26, 0x26, 0x26,
-    0x0F, 0x0F, 0x26, 0x26,
-    0x0F, 0x0F, 0x0F, 0x26,
-    0x0F, 0x1C, 0x23, 0x29,
-    0x0F, 0x15, 0x23, 0x29,
-    0x0F, 0x15, 0x1C, 0x29,
-    0x0F, 0x29, 0x29, 0x29,
-    0x0F, 0x0F, 0x29, 0x29,
-    0x0F, 0x0F, 0x0F, 0x29,
-    0x0F, 0x1D, 0x25, 0x2C,
-    0x0F, 0x16, 0x25, 0x2C,
-    0x0F, 0x16, 0x1E, 0x2C,
-    0x0F, 0x2C, 0x2C, 0x2C,
-    0x0F, 0x0F, 0x2C, 0x2C,
-    0x0F, 0x0F, 0x0F, 0x2C,
-    0x0F, 0x1F, 0x27, 0x2F,
-    0x0F, 0x17, 0x27, 0x2F,
-    0x0F, 0x17, 0x1F, 0x2F,
-    0x0F, 0x2F, 0x2F, 0x2F,
-    0x0F, 0x0F, 0x2F, 0x2F,
-    0x0F, 0x0F, 0x0F, 0x2F,
-    0x0F, 0x32, 0x32, 0x32,
-    0x0F, 0x0F, 0x32, 0x32,
-    0x0F, 0x0F, 0x0F, 0x32,
-    0x0F, 0x21, 0x2A, 0x33,
-    0x0F, 0x18, 0x2A, 0x33,
-    0x0F, 0x18, 0x21, 0x33,
-    0x0F, 0x37, 0x37, 0x37,
-    0x0F, 0x0F, 0x37, 0x37,
-    0x0F, 0x0F, 0x0F, 0x37,
-    0x0F, 0x3D, 0x3D, 0x3D,
-    0x0F, 0x0F, 0x3D, 0x3D,
-    0x0F, 0x0F, 0x0F, 0x3D,
-    0x10, 0x11, 0x11, 0x12,
-    0x10, 0x11, 0x12, 0x13,
-    0x10, 0x12, 0x13, 0x14,
-    0x10, 0x11, 0x13, 0x14,
-    0x10, 0x11, 0x12, 0x14,
-    0x10, 0x12, 0x13, 0x15,
-    0x10, 0x12, 0x14, 0x15,
-    0x10, 0x11, 0x14, 0x15,
-    0x10, 0x11, 0x13, 0x15,
-    0x10, 0x12, 0x14, 0x16,
-    0x10, 0x13, 0x15, 0x16,
-    0x10, 0x11, 0x15, 0x16,
-    0x10, 0x11, 0x13, 0x16,
-    0x10, 0x16, 0x16, 0x16,
-    0x10, 0x10, 0x16, 0x16,
-    0x10, 0x10, 0x10, 0x16,
-    0x10, 0x13, 0x14, 0x17,
-    0x10, 0x13, 0x16, 0x17,
-    0x10, 0x11, 0x16, 0x17,
-    0x10, 0x11, 0x14, 0x17,
-    0x10, 0x13, 0x15, 0x18,
-    0x10, 0x14, 0x16, 0x18,
-    0x10, 0x12, 0x16, 0x18,
-    0x10, 0x12, 0x14, 0x18,
-    0x10, 0x18, 0x18, 0x18,
-    0x10, 0x10, 0x18, 0x18,
-    0x10, 0x10, 0x10, 0x18,
-    0x10, 0x14, 0x17, 0x1B,
-    0x10, 0x15, 0x19, 0x1B,
-    0x10, 0x12, 0x19, 0x1B,
-    0x10, 0x12, 0x16, 0x1B,
-    0x10, 0x1B, 0x1B, 0x1B,
-    0x10, 0x10, 0x1B, 0x1B,
-    0x10, 0x10, 0x10, 0x1B,
-    0x10, 0x15, 0x19, 0x1E,
-    0x10, 0x17, 0x1B, 0x1E,
-    0x10, 0x13, 0x1B, 0x1E,
-    0x10, 0x13, 0x17, 0x1E,
-    0x10, 0x1E, 0x1E, 0x1E,
-    0x10, 0x10, 0x1E, 0x1E,
-    0x10, 0x10, 0x10, 0x1E,
-    0x10, 0x16, 0x1B, 0x21,
-    0x10, 0x18, 0x1D, 0x21,
-    0x10, 0x14, 0x1D, 0x21,
-    0x10, 0x14, 0x19, 0x21,
-    0x10, 0x21, 0x21, 0x21,
-    0x10, 0x10, 0x21, 0x21,
-    0x10, 0x10, 0x10, 0x21,
-    0x10, 0x17, 0x1D, 0x24,
-    0x10, 0x1A, 0x1F, 0x24,
-    0x10, 0x15, 0x1F, 0x24,
-    0x10, 0x15, 0x1A, 0x24,
-    0x10, 0x24, 0x24, 0x24,
-    0x10, 0x10, 0x24, 0x24,
-    0x10, 0x10, 0x10, 0x24,
-    0x10, 0x1B, 0x22, 0x27,
-    0x10, 0x15, 0x22, 0x27,
-    0x10, 0x15, 0x1C, 0x27,
-    0x10, 0x27, 0x27, 0x27,
-    0x10, 0x10, 0x27, 0x27,
-    0x10, 0x10, 0x10, 0x27,
-    0x10, 0x1D, 0x24, 0x2A,
-    0x10, 0x16, 0x24, 0x2A,
-    0x10, 0x16, 0x1D, 0x2A,
-    0x10, 0x2A, 0x2A, 0x2A,
-    0x10, 0x10, 0x2A, 0x2A,
-    0x10, 0x10, 0x10, 0x2A,
-    0x10, 0x1E, 0x26, 0x2D,
-    0x10, 0x17, 0x26, 0x2D,
-    0x10, 0x17, 0x1F, 0x2D,
-    0x10, 0x2D, 0x2D, 0x2D,
-    0x10, 0x10, 0x2D, 0x2D,
-    0x10, 0x10, 0x10, 0x2D,
-    0x10, 0x20, 0x28, 0x30,
-    0x10, 0x18, 0x28, 0x30,
-    0x10, 0x18, 0x20, 0x30,
-    0x10, 0x30, 0x30, 0x30,
-    0x10, 0x10, 0x30, 0x30,
-    0x10, 0x10, 0x10, 0x30,
-    0x10, 0x33, 0x33, 0x33,
-    0x10, 0x10, 0x33, 0x33,
-    0x10, 0x10, 0x10, 0x33,
-    0x10, 0x22, 0x2B, 0x34,
-    0x10, 0x19, 0x2B, 0x34,
-    0x10, 0x19, 0x22, 0x34,
-    0x10, 0x38, 0x38, 0x38,
-    0x10, 0x10, 0x38, 0x38,
-    0x10, 0x10, 0x10, 0x38,
-    0x10, 0x3E, 0x3E, 0x3E,
-    0x10, 0x10, 0x3E, 0x3E,
-    0x10, 0x10, 0x10, 0x3E,
-    0x11, 0x12, 0x12, 0x13,
-    0x11, 0x12, 0x13, 0x14,
-    0x11, 0x13, 0x14, 0x15,
-    0x11, 0x12, 0x14, 0x15,
-    0x11, 0x12, 0x13, 0x15,
-    0x11, 0x13, 0x14, 0x16,
-    0x11, 0x13, 0x15, 0x16,
-    0x11, 0x12, 0x15, 0x16,
-    0x11, 0x12, 0x14, 0x16,
-    0x11, 0x13, 0x15, 0x17,
-    0x11, 0x14, 0x16, 0x17,
-    0x11, 0x12, 0x16, 0x17,
-    0x11, 0x12, 0x14, 0x17,
-    0x11, 0x17, 0x17, 0x17,
-    0x11, 0x11, 0x17, 0x17,
-    0x11, 0x11, 0x11, 0x17,
-    0x11, 0x14, 0x15, 0x18,
-    0x11, 0x14, 0x17, 0x18,
-    0x11, 0x12, 0x17, 0x18,
-    0x11, 0x12, 0x15, 0x18,
-    0x11, 0x14, 0x16, 0x19,
-    0x11, 0x15, 0x17, 0x19,
-    0x11, 0x13, 0x17, 0x19,
-    0x11, 0x13, 0x15, 0x19,
-    0x11, 0x19, 0x19, 0x19,
-    0x11, 0x11, 0x19, 0x19,
-    0x11, 0x11, 0x11, 0x19,
-    0x11, 0x15, 0x18, 0x1C,
-    0x11, 0x16, 0x1A, 0x1C,
-    0x11, 0x13, 0x1A, 0x1C,
-    0x11, 0x13, 0x17, 0x1C,
-    0x11, 0x1C, 0x1C, 0x1C,
-    0x11, 0x11, 0x1C, 0x1C,
-    0x11, 0x11, 0x11, 0x1C,
-    0x11, 0x16, 0x1A, 0x1F,
-    0x11, 0x18, 0x1C, 0x1F,
-    0x11, 0x14, 0x1C, 0x1F,
-    0x11, 0x14, 0x18, 0x1F,
-    0x11, 0x1F, 0x1F, 0x1F,
-    0x11, 0x11, 0x1F, 0x1F,
-    0x11, 0x11, 0x11, 0x1F,
-    0x11, 0x17, 0x1C, 0x22,
-    0x11, 0x19, 0x1E, 0x22,
-    0x11, 0x15, 0x1E, 0x22,
-    0x11, 0x15, 0x1A, 0x22,
-    0x11, 0x22, 0x22, 0x22,
-    0x11, 0x11, 0x22, 0x22,
-    0x11, 0x11, 0x11, 0x22,
-    0x11, 0x18, 0x1E, 0x25,
-    0x11, 0x1B, 0x20, 0x25,
-    0x11, 0x16, 0x20, 0x25,
-    0x11, 0x16, 0x1B, 0x25,
-    0x11, 0x25, 0x25, 0x25,
-    0x11, 0x11, 0x25, 0x25,
-    0x11, 0x11, 0x11, 0x25,
-    0x11, 0x1C, 0x23, 0x28,
-    0x11, 0x16, 0x23, 0x28,
-    0x11, 0x16, 0x1D, 0x28,
-    0x11, 0x28, 0x28, 0x28,
-    0x11, 0x11, 0x28, 0x28,
-    0x11, 0x11, 0x11, 0x28,
-    0x11, 0x1E, 0x25, 0x2B,
-    0x11, 0x17, 0x25, 0x2B,
-    0x11, 0x17, 0x1E, 0x2B,
-    0x11, 0x2B, 0x2B, 0x2B,
-    0x11, 0x11, 0x2B, 0x2B,
-    0x11, 0x11, 0x11, 0x2B,
-    0x11, 0x1F, 0x27, 0x2E,
-    0x11, 0x18, 0x27, 0x2E,
-    0x11, 0x18, 0x20, 0x2E,
-    0x11, 0x2E, 0x2E, 0x2E,
-    0x11, 0x11, 0x2E, 0x2E,
-    0x11, 0x11, 0x11, 0x2E,
-    0x11, 0x21, 0x29, 0x31,
-    0x11, 0x19, 0x29, 0x31,
-    0x11, 0x19, 0x21, 0x31,
-    0x11, 0x31, 0x31, 0x31,
-    0x11, 0x11, 0x31, 0x31,
-    0x11, 0x11, 0x11, 0x31,
-    0x11, 0x34, 0x34, 0x34,
-    0x11, 0x11, 0x34, 0x34,
-    0x11, 0x11, 0x11, 0x34,
-    0x11, 0x23, 0x2C, 0x35,
-    0x11, 0x1A, 0x2C, 0x35,
-    0x11, 0x1A, 0x23, 0x35,
-    0x11, 0x39, 0x39, 0x39,
-    0x11, 0x11, 0x39, 0x39,
-    0x11, 0x11, 0x11, 0x39,
-    0x11, 0x3F, 0x3F, 0x3F,
-    0x11, 0x11, 0x3F, 0x3F,
-    0x11, 0x11, 0x11, 0x3F,
-    0x12, 0x13, 0x13, 0x14,
-    0x12, 0x13, 0x14, 0x15,
-    0x12, 0x14, 0x15, 0x16,
-    0x12, 0x13, 0x15, 0x16,
-    0x12, 0x13, 0x14, 0x16,
-    0x12, 0x14, 0x15, 0x17,
-    0x12, 0x14, 0x16, 0x17,
-    0x12, 0x13, 0x16, 0x17,
-    0x12, 0x13, 0x15, 0x17,
-    0x12, 0x14, 0x16, 0x18,
-    0x12, 0x15, 0x17, 0x18,
-    0x12, 0x13, 0x17, 0x18,
-    0x12, 0x13, 0x15, 0x18,
-    0x12, 0x18, 0x18, 0x18,
-    0x12, 0x12, 0x18, 0x18,
-    0x12, 0x12, 0x12, 0x18,
-    0x12, 0x15, 0x16, 0x19,
-    0x12, 0x15, 0x18, 0x19,
-    0x12, 0x13, 0x18, 0x19,
-    0x12, 0x13, 0x16, 0x19,
-    0x12, 0x15, 0x17, 0x1A,
-    0x12, 0x16, 0x18, 0x1A,
-    0x12, 0x14, 0x18, 0x1A,
-    0x12, 0x14, 0x16, 0x1A,
-    0x12, 0x1A, 0x1A, 0x1A,
-    0x12, 0x12, 0x1A, 0x1A,
-    0x12, 0x12, 0x12, 0x1A,
-    0x12, 0x16, 0x19, 0x1D,
-    0x12, 0x17, 0x1B, 0x1D,
-    0x12, 0x14, 0x1B, 0x1D,
-    0x12, 0x14, 0x18, 0x1D,
-    0x12, 0x1D, 0x1D, 0x1D,
-    0x12, 0x12, 0x1D, 0x1D,
-    0x12, 0x12, 0x12, 0x1D,
-    0x12, 0x17, 0x1B, 0x20,
-    0x12, 0x19, 0x1D, 0x20,
-    0x12, 0x15, 0x1D, 0x20,
-    0x12, 0x15, 0x19, 0x20,
-    0x12, 0x20, 0x20, 0x20,
-    0x12, 0x12, 0x20, 0x20,
-    0x12, 0x12, 0x12, 0x20,
-    0x12, 0x18, 0x1D, 0x23,
-    0x12, 0x1A, 0x1F, 0x23,
-    0x12, 0x16, 0x1F, 0x23,
-    0x12, 0x16, 0x1B, 0x23,
-    0x12, 0x23, 0x23, 0x23,
-    0x12, 0x12, 0x23, 0x23,
-    0x12, 0x12, 0x12, 0x23,
-    0x12, 0x19, 0x1F, 0x26,
-    0x12, 0x1C, 0x21, 0x26,
-    0x12, 0x17, 0x21, 0x26,
-    0x12, 0x17, 0x1C, 0x26,
-    0x12, 0x26, 0x26, 0x26,
-    0x12, 0x12, 0x26, 0x26,
-    0x12, 0x12, 0x12, 0x26,
-    0x12, 0x1D, 0x24, 0x29,
-    0x12, 0x17, 0x24, 0x29,
-    0x12, 0x17, 0x1E, 0x29,
-    0x12, 0x29, 0x29, 0x29,
-    0x12, 0x12, 0x29, 0x29,
-    0x12, 0x12, 0x12, 0x29,
-    0x12, 0x1F, 0x26, 0x2C,
-    0x12, 0x18, 0x26, 0x2C,
-    0x12, 0x18, 0x1F, 0x2C,
-    0x12, 0x2C, 0x2C, 0x2C,
-    0x12, 0x12, 0x2C, 0x2C,
-    0x12, 0x12, 0x12, 0x2C,
-    0x12, 0x20, 0x28, 0x2F,
-    0x12, 0x19, 0x28, 0x2F,
-    0x12, 0x19, 0x21, 0x2F,
-    0x12, 0x2F, 0x2F, 0x2F,
-    0x12, 0x12, 0x2F, 0x2F,
-    0x12, 0x12, 0x12, 0x2F,
-    0x12, 0x22, 0x2A, 0x32,
-    0x12, 0x1A, 0x2A, 0x32,
-    0x12, 0x1A, 0x22, 0x32,
-    0x12, 0x32, 0x32, 0x32,
-    0x12, 0x12, 0x32, 0x32,
-    0x12, 0x12, 0x12, 0x32,
-    0x12, 0x35, 0x35, 0x35,
-    0x12, 0x12, 0x35, 0x35,
-    0x12, 0x12, 0x12, 0x35,
-    0x12, 0x24, 0x2D, 0x36,
-    0x12, 0x1B, 0x2D, 0x36,
-    0x12, 0x1B, 0x24, 0x36,
-    0x12, 0x3A, 0x3A, 0x3A,
-    0x12, 0x12, 0x3A, 0x3A,
-    0x12, 0x12, 0x12, 0x3A,
-    0x13, 0x14, 0x14, 0x15,
-    0x13, 0x14, 0x15, 0x16,
-    0x13, 0x15, 0x16, 0x17,
-    0x13, 0x14, 0x16, 0x17,
-    0x13, 0x14, 0x15, 0x17,
-    0x13, 0x15, 0x16, 0x18,
-    0x13, 0x15, 0x17, 0x18,
-    0x13, 0x14, 0x17, 0x18,
-    0x13, 0x14, 0x16, 0x18,
-    0x13, 0x15, 0x17, 0x19,
-    0x13, 0x16, 0x18, 0x19,
-    0x13, 0x14, 0x18, 0x19,
-    0x13, 0x14, 0x16, 0x19,
-    0x13, 0x19, 0x19, 0x19,
-    0x13, 0x13, 0x19, 0x19,
-    0x13, 0x13, 0x13, 0x19,
-    0x13, 0x16, 0x17, 0x1A,
-    0x13, 0x16, 0x19, 0x1A,
-    0x13, 0x14, 0x19, 0x1A,
-    0x13, 0x14, 0x17, 0x1A,
-    0x13, 0x16, 0x18, 0x1B,
-    0x13, 0x17, 0x19, 0x1B,
-    0x13, 0x15, 0x19, 0x1B,
-    0x13, 0x15, 0x17, 0x1B,
-    0x13, 0x1B, 0x1B, 0x1B,
-    0x13, 0x13, 0x1B, 0x1B,
-    0x13, 0x13, 0x13, 0x1B,
-    0x13, 0x17, 0x1A, 0x1E,
-    0x13, 0x18, 0x1C, 0x1E,
-    0x13, 0x15, 0x1C, 0x1E,
-    0x13, 0x15, 0x19, 0x1E,
-    0x13, 0x1E, 0x1E, 0x1E,
-    0x13, 0x13, 0x1E, 0x1E,
-    0x13, 0x13, 0x13, 0x1E,
-    0x13, 0x18, 0x1C, 0x21,
-    0x13, 0x1A, 0x1E, 0x21,
-    0x13, 0x16, 0x1E, 0x21,
-    0x13, 0x16, 0x1A, 0x21,
-    0x13, 0x21, 0x21, 0x21,
-    0x13, 0x13, 0x21, 0x21,
-    0x13, 0x13, 0x13, 0x21,
-    0x13, 0x19, 0x1E, 0x24,
-    0x13, 0x1B, 0x20, 0x24,
-    0x13, 0x17, 0x20, 0x24,
-    0x13, 0x17, 0x1C, 0x24,
-    0x13, 0x24, 0x24, 0x24,
-    0x13, 0x13, 0x24, 0x24,
-    0x13, 0x13, 0x13, 0x24,
-    0x13, 0x1A, 0x20, 0x27,
-    0x13, 0x1D, 0x22, 0x27,
-    0x13, 0x18, 0x22, 0x27,
-    0x13, 0x18, 0x1D, 0x27,
-    0x13, 0x27, 0x27, 0x27,
-    0x13, 0x13, 0x27, 0x27,
-    0x13, 0x13, 0x13, 0x27,
-    0x13, 0x1E, 0x25, 0x2A,
-    0x13, 0x18, 0x25, 0x2A,
-    0x13, 0x18, 0x1F, 0x2A,
-    0x13, 0x2A, 0x2A, 0x2A,
-    0x13, 0x13, 0x2A, 0x2A,
-    0x13, 0x13, 0x13, 0x2A,
-    0x13, 0x20, 0x27, 0x2D,
-    0x13, 0x19, 0x27, 0x2D,
-    0x13, 0x19, 0x20, 0x2D,
-    0x13, 0x2D, 0x2D, 0x2D,
-    0x13, 0x13, 0x2D, 0x2D,
-    0x13, 0x13, 0x13, 0x2D,
-    0x13, 0x21, 0x29, 0x30,
-    0x13, 0x1A, 0x29, 0x30,
-    0x13, 0x1A, 0x22, 0x30,
-    0x13, 0x30, 0x30, 0x30,
-    0x13, 0x13, 0x30, 0x30,
-    0x13, 0x13, 0x13, 0x30,
-    0x13, 0x23, 0x2B, 0x33,
-    0x13, 0x1B, 0x2B, 0x33,
-    0x13, 0x1B, 0x23, 0x33,
-    0x13, 0x33, 0x33, 0x33,
-    0x13, 0x13, 0x33, 0x33,
-    0x13, 0x13, 0x13, 0x33,
-    0x13, 0x36, 0x36, 0x36,
-    0x13, 0x13, 0x36, 0x36,
-    0x13, 0x13, 0x13, 0x36,
-    0x13, 0x25, 0x2E, 0x37,
-    0x13, 0x1C, 0x2E, 0x37,
-    0x13, 0x1C, 0x25, 0x37,
-    0x13, 0x3B, 0x3B, 0x3B,
-    0x13, 0x13, 0x3B, 0x3B,
-    0x13, 0x13, 0x13, 0x3B,
-    0x14, 0x15, 0x15, 0x16,
-    0x14, 0x15, 0x16, 0x17,
-    0x14, 0x16, 0x17, 0x18,
-    0x14, 0x15, 0x17, 0x18,
-    0x14, 0x15, 0x16, 0x18,
-    0x14, 0x16, 0x17, 0x19,
-    0x14, 0x16, 0x18, 0x19,
-    0x14, 0x15, 0x18, 0x19,
-    0x14, 0x15, 0x17, 0x19,
-    0x14, 0x16, 0x18, 0x1A,
-    0x14, 0x17, 0x19, 0x1A,
-    0x14, 0x15, 0x19, 0x1A,
-    0x14, 0x15, 0x17, 0x1A,
-    0x14, 0x1A, 0x1A, 0x1A,
-    0x14, 0x14, 0x1A, 0x1A,
-    0x14, 0x14, 0x14, 0x1A,
-    0x14, 0x17, 0x18, 0x1B,
-    0x14, 0x17, 0x1A, 0x1B,
-    0x14, 0x15, 0x1A, 0x1B,
-    0x14, 0x15, 0x18, 0x1B,
-    0x14, 0x17, 0x19, 0x1C,
-    0x14, 0x18, 0x1A, 0x1C,
-    0x14, 0x16, 0x1A, 0x1C,
-    0x14, 0x16, 0x18, 0x1C,
-    0x14, 0x1C, 0x1C, 0x1C,
-    0x14, 0x14, 0x1C, 0x1C,
-    0x14, 0x14, 0x14, 0x1C,
-    0x14, 0x18, 0x1B, 0x1F,
-    0x14, 0x19, 0x1D, 0x1F,
-    0x14, 0x16, 0x1D, 0x1F,
-    0x14, 0x16, 0x1A, 0x1F,
-    0x14, 0x1F, 0x1F, 0x1F,
-    0x14, 0x14, 0x1F, 0x1F,
-    0x14, 0x14, 0x14, 0x1F,
-    0x14, 0x19, 0x1D, 0x22,
-    0x14, 0x1B, 0x1F, 0x22,
-    0x14, 0x17, 0x1F, 0x22,
-    0x14, 0x17, 0x1B, 0x22,
-    0x14, 0x22, 0x22, 0x22,
-    0x14, 0x14, 0x22, 0x22,
-    0x14, 0x14, 0x14, 0x22,
-    0x14, 0x1A, 0x1F, 0x25,
-    0x14, 0x1C, 0x21, 0x25,
-    0x14, 0x18, 0x21, 0x25,
-    0x14, 0x18, 0x1D, 0x25,
-    0x14, 0x25, 0x25, 0x25,
-    0x14, 0x14, 0x25, 0x25,
-    0x14, 0x14, 0x14, 0x25,
-    0x14, 0x1B, 0x21, 0x28,
-    0x14, 0x1E, 0x23, 0x28,
-    0x14, 0x19, 0x23, 0x28,
-    0x14, 0x19, 0x1E, 0x28,
-    0x14, 0x28, 0x28, 0x28,
-    0x14, 0x14, 0x28, 0x28,
-    0x14, 0x14, 0x14, 0x28,
-    0x14, 0x1F, 0x26, 0x2B,
-    0x14, 0x19, 0x26, 0x2B,
-    0x14, 0x19, 0x20, 0x2B,
-    0x14, 0x2B, 0x2B, 0x2B,
-    0x14, 0x14, 0x2B, 0x2B,
-    0x14, 0x14, 0x14, 0x2B,
-    0x14, 0x21, 0x28, 0x2E,
-    0x14, 0x1A, 0x28, 0x2E,
-    0x14, 0x1A, 0x21, 0x2E,
-    0x14, 0x2E, 0x2E, 0x2E,
-    0x14, 0x14, 0x2E, 0x2E,
-    0x14, 0x14, 0x14, 0x2E,
-    0x14, 0x22, 0x2A, 0x31,
-    0x14, 0x1B, 0x2A, 0x31,
-    0x14, 0x1B, 0x23, 0x31,
-    0x14, 0x31, 0x31, 0x31,
-    0x14, 0x14, 0x31, 0x31,
-    0x14, 0x14, 0x14, 0x31,
-    0x14, 0x24, 0x2C, 0x34,
-    0x14, 0x1C, 0x2C, 0x34,
-    0x14, 0x1C, 0x24, 0x34,
-    0x14, 0x34, 0x34, 0x34,
-    0x14, 0x14, 0x34, 0x34,
-    0x14, 0x14, 0x14, 0x34,
-    0x14, 0x37, 0x37, 0x37,
-    0x14, 0x14, 0x37, 0x37,
-    0x14, 0x14, 0x14, 0x37,
-    0x14, 0x26, 0x2F, 0x38,
-    0x14, 0x1D, 0x2F, 0x38,
-    0x14, 0x1D, 0x26, 0x38,
-    0x14, 0x3C, 0x3C, 0x3C,
-    0x14, 0x14, 0x3C, 0x3C,
-    0x14, 0x14, 0x14, 0x3C,
-    0x15, 0x16, 0x16, 0x17,
-    0x15, 0x16, 0x17, 0x18,
-    0x15, 0x17, 0x18, 0x19,
-    0x15, 0x16, 0x18, 0x19,
-    0x15, 0x16, 0x17, 0x19,
-    0x15, 0x17, 0x18, 0x1A,
-    0x15, 0x17, 0x19, 0x1A,
-    0x15, 0x16, 0x19, 0x1A,
-    0x15, 0x16, 0x18, 0x1A,
-    0x15, 0x17, 0x19, 0x1B,
-    0x15, 0x18, 0x1A, 0x1B,
-    0x15, 0x16, 0x1A, 0x1B,
-    0x15, 0x16, 0x18, 0x1B,
-    0x15, 0x1B, 0x1B, 0x1B,
-    0x15, 0x15, 0x1B, 0x1B,
-    0x15, 0x15, 0x15, 0x1B,
-    0x15, 0x18, 0x19, 0x1C,
-    0x15, 0x18, 0x1B, 0x1C,
-    0x15, 0x16, 0x1B, 0x1C,
-    0x15, 0x16, 0x19, 0x1C,
-    0x15, 0x18, 0x1A, 0x1D,
-    0x15, 0x19, 0x1B, 0x1D,
-    0x15, 0x17, 0x1B, 0x1D,
-    0x15, 0x17, 0x19, 0x1D,
-    0x15, 0x1D, 0x1D, 0x1D,
-    0x15, 0x15, 0x1D, 0x1D,
-    0x15, 0x15, 0x15, 0x1D,
-    0x15, 0x19, 0x1C, 0x20,
-    0x15, 0x1A, 0x1E, 0x20,
-    0x15, 0x17, 0x1E, 0x20,
-    0x15, 0x17, 0x1B, 0x20,
-    0x15, 0x20, 0x20, 0x20,
-    0x15, 0x15, 0x20, 0x20,
-    0x15, 0x15, 0x15, 0x20,
-    0x15, 0x1A, 0x1E, 0x23,
-    0x15, 0x1C, 0x20, 0x23,
-    0x15, 0x18, 0x20, 0x23,
-    0x15, 0x18, 0x1C, 0x23,
-    0x15, 0x23, 0x23, 0x23,
-    0x15, 0x15, 0x23, 0x23,
-    0x15, 0x15, 0x15, 0x23,
-    0x15, 0x1B, 0x20, 0x26,
-    0x15, 0x1D, 0x22, 0x26,
-    0x15, 0x19, 0x22, 0x26,
-    0x15, 0x19, 0x1E, 0x26,
-    0x15, 0x26, 0x26, 0x26,
-    0x15, 0x15, 0x26, 0x26,
-    0x15, 0x15, 0x15, 0x26,
-    0x15, 0x1C, 0x22, 0x29,
-    0x15, 0x1F, 0x24, 0x29,
-    0x15, 0x1A, 0x24, 0x29,
-    0x15, 0x1A, 0x1F, 0x29,
-    0x15, 0x29, 0x29, 0x29,
-    0x15, 0x15, 0x29, 0x29,
-    0x15, 0x15, 0x15, 0x29,
-    0x15, 0x20, 0x27, 0x2C,
-    0x15, 0x1A, 0x27, 0x2C,
-    0x15, 0x1A, 0x21, 0x2C,
-    0x15, 0x2C, 0x2C, 0x2C,
-    0x15, 0x15, 0x2C, 0x2C,
-    0x15, 0x15, 0x15, 0x2C,
-    0x15, 0x22, 0x29, 0x2F,
-    0x15, 0x1B, 0x29, 0x2F,
-    0x15, 0x1B, 0x22, 0x2F,
-    0x15, 0x2F, 0x2F, 0x2F,
-    0x15, 0x15, 0x2F, 0x2F,
-    0x15, 0x15, 0x15, 0x2F,
-    0x15, 0x23, 0x2B, 0x32,
-    0x15, 0x1C, 0x2B, 0x32,
-    0x15, 0x1C, 0x24, 0x32,
-    0x15, 0x32, 0x32, 0x32,
-    0x15, 0x15, 0x32, 0x32,
-    0x15, 0x15, 0x15, 0x32,
-    0x15, 0x25, 0x2D, 0x35,
-    0x15, 0x1D, 0x2D, 0x35,
-    0x15, 0x1D, 0x25, 0x35,
-    0x15, 0x35, 0x35, 0x35,
-    0x15, 0x15, 0x35, 0x35,
-    0x15, 0x15, 0x15, 0x35,
-    0x15, 0x38, 0x38, 0x38,
-    0x15, 0x15, 0x38, 0x38,
-    0x15, 0x15, 0x15, 0x38,
-    0x15, 0x27, 0x30, 0x39,
-    0x15, 0x1E, 0x30, 0x39,
-    0x15, 0x1E, 0x27, 0x39,
-    0x15, 0x3D, 0x3D, 0x3D,
-    0x15, 0x15, 0x3D, 0x3D,
-    0x15, 0x15, 0x15, 0x3D,
-    0x16, 0x17, 0x17, 0x18,
-    0x16, 0x17, 0x18, 0x19,
-    0x16, 0x18, 0x19, 0x1A,
-    0x16, 0x17, 0x19, 0x1A,
-    0x16, 0x17, 0x18, 0x1A,
-    0x16, 0x18, 0x19, 0x1B,
-    0x16, 0x18, 0x1A, 0x1B,
-    0x16, 0x17, 0x1A, 0x1B,
-    0x16, 0x17, 0x19, 0x1B,
-    0x16, 0x18, 0x1A, 0x1C,
-    0x16, 0x19, 0x1B, 0x1C,
-    0x16, 0x17, 0x1B, 0x1C,
-    0x16, 0x17, 0x19, 0x1C,
-    0x16, 0x1C, 0x1C, 0x1C,
-    0x16, 0x16, 0x1C, 0x1C,
-    0x16, 0x16, 0x16, 0x1C,
-    0x16, 0x19, 0x1A, 0x1D,
-    0x16, 0x19, 0x1C, 0x1D,
-    0x16, 0x17, 0x1C, 0x1D,
-    0x16, 0x17, 0x1A, 0x1D,
-    0x16, 0x19, 0x1B, 0x1E,
-    0x16, 0x1A, 0x1C, 0x1E,
-    0x16, 0x18, 0x1C, 0x1E,
-    0x16, 0x18, 0x1A, 0x1E,
-    0x16, 0x1E, 0x1E, 0x1E,
-    0x16, 0x16, 0x1E, 0x1E,
-    0x16, 0x16, 0x16, 0x1E,
-    0x16, 0x1A, 0x1D, 0x21,
-    0x16, 0x1B, 0x1F, 0x21,
-    0x16, 0x18, 0x1F, 0x21,
-    0x16, 0x18, 0x1C, 0x21,
-    0x16, 0x21, 0x21, 0x21,
-    0x16, 0x16, 0x21, 0x21,
-    0x16, 0x16, 0x16, 0x21,
-    0x16, 0x1B, 0x1F, 0x24,
-    0x16, 0x1D, 0x21, 0x24,
-    0x16, 0x19, 0x21, 0x24,
-    0x16, 0x19, 0x1D, 0x24,
-    0x16, 0x24, 0x24, 0x24,
-    0x16, 0x16, 0x24, 0x24,
-    0x16, 0x16, 0x16, 0x24,
-    0x16, 0x1C, 0x21, 0x27,
-    0x16, 0x1E, 0x23, 0x27,
-    0x16, 0x1A, 0x23, 0x27,
-    0x16, 0x1A, 0x1F, 0x27,
-    0x16, 0x27, 0x27, 0x27,
-    0x16, 0x16, 0x27, 0x27,
-    0x16, 0x16, 0x16, 0x27,
-    0x16, 0x1D, 0x23, 0x2A,
-    0x16, 0x20, 0x25, 0x2A,
-    0x16, 0x1B, 0x25, 0x2A,
-    0x16, 0x1B, 0x20, 0x2A,
-    0x16, 0x2A, 0x2A, 0x2A,
-    0x16, 0x16, 0x2A, 0x2A,
-    0x16, 0x16, 0x16, 0x2A,
-    0x16, 0x21, 0x28, 0x2D,
-    0x16, 0x1B, 0x28, 0x2D,
-    0x16, 0x1B, 0x22, 0x2D,
-    0x16, 0x2D, 0x2D, 0x2D,
-    0x16, 0x16, 0x2D, 0x2D,
-    0x16, 0x16, 0x16, 0x2D,
-    0x16, 0x23, 0x2A, 0x30,
-    0x16, 0x1C, 0x2A, 0x30,
-    0x16, 0x1C, 0x23, 0x30,
-    0x16, 0x30, 0x30, 0x30,
-    0x16, 0x16, 0x30, 0x30,
-    0x16, 0x16, 0x16, 0x30,
-    0x16, 0x24, 0x2C, 0x33,
-    0x16, 0x1D, 0x2C, 0x33,
-    0x16, 0x1D, 0x25, 0x33,
-    0x16, 0x33, 0x33, 0x33,
-    0x16, 0x16, 0x33, 0x33,
-    0x16, 0x16, 0x16, 0x33,
-    0x16, 0x26, 0x2E, 0x36,
-    0x16, 0x1E, 0x2E, 0x36,
-    0x16, 0x1E, 0x26, 0x36,
-    0x16, 0x36, 0x36, 0x36,
-    0x16, 0x16, 0x36, 0x36,
-    0x16, 0x16, 0x16, 0x36,
-    0x16, 0x39, 0x39, 0x39,
-    0x16, 0x16, 0x39, 0x39,
-    0x16, 0x16, 0x16, 0x39,
-    0x16, 0x28, 0x31, 0x3A,
-    0x16, 0x1F, 0x31, 0x3A,
-    0x16, 0x1F, 0x28, 0x3A,
-    0x16, 0x3E, 0x3E, 0x3E,
-    0x16, 0x16, 0x3E, 0x3E,
-    0x16, 0x16, 0x16, 0x3E,
-    0x17, 0x18, 0x18, 0x19,
-    0x17, 0x18, 0x19, 0x1A,
-    0x17, 0x19, 0x1A, 0x1B,
-    0x17, 0x18, 0x1A, 0x1B,
-    0x17, 0x18, 0x19, 0x1B,
-    0x17, 0x19, 0x1A, 0x1C,
-    0x17, 0x19, 0x1B, 0x1C,
-    0x17, 0x18, 0x1B, 0x1C,
-    0x17, 0x18, 0x1A, 0x1C,
-    0x17, 0x19, 0x1B, 0x1D,
-    0x17, 0x1A, 0x1C, 0x1D,
-    0x17, 0x18, 0x1C, 0x1D,
-    0x17, 0x18, 0x1A, 0x1D,
-    0x17, 0x1D, 0x1D, 0x1D,
-    0x17, 0x17, 0x1D, 0x1D,
-    0x17, 0x17, 0x17, 0x1D,
-    0x17, 0x1A, 0x1B, 0x1E,
-    0x17, 0x1A, 0x1D, 0x1E,
-    0x17, 0x18, 0x1D, 0x1E,
-    0x17, 0x18, 0x1B, 0x1E,
-    0x17, 0x1A, 0x1C, 0x1F,
-    0x17, 0x1B, 0x1D, 0x1F,
-    0x17, 0x19, 0x1D, 0x1F,
-    0x17, 0x19, 0x1B, 0x1F,
-    0x17, 0x1F, 0x1F, 0x1F,
-    0x17, 0x17, 0x1F, 0x1F,
-    0x17, 0x17, 0x17, 0x1F,
-    0x17, 0x1B, 0x1E, 0x22,
-    0x17, 0x1C, 0x20, 0x22,
-    0x17, 0x19, 0x20, 0x22,
-    0x17, 0x19, 0x1D, 0x22,
-    0x17, 0x22, 0x22, 0x22,
-    0x17, 0x17, 0x22, 0x22,
-    0x17, 0x17, 0x17, 0x22,
-    0x17, 0x1C, 0x20, 0x25,
-    0x17, 0x1E, 0x22, 0x25,
-    0x17, 0x1A, 0x22, 0x25,
-    0x17, 0x1A, 0x1E, 0x25,
-    0x17, 0x25, 0x25, 0x25,
-    0x17, 0x17, 0x25, 0x25,
-    0x17, 0x17, 0x17, 0x25,
-    0x17, 0x1D, 0x22, 0x28,
-    0x17, 0x1F, 0x24, 0x28,
-    0x17, 0x1B, 0x24, 0x28,
-    0x17, 0x1B, 0x20, 0x28,
-    0x17, 0x28, 0x28, 0x28,
-    0x17, 0x17, 0x28, 0x28,
-    0x17, 0x17, 0x17, 0x28,
-    0x17, 0x1E, 0x24, 0x2B,
-    0x17, 0x21, 0x26, 0x2B,
-    0x17, 0x1C, 0x26, 0x2B,
-    0x17, 0x1C, 0x21, 0x2B,
-    0x17, 0x2B, 0x2B, 0x2B,
-    0x17, 0x17, 0x2B, 0x2B,
-    0x17, 0x17, 0x17, 0x2B,
-    0x17, 0x22, 0x29, 0x2E,
-    0x17, 0x1C, 0x29, 0x2E,
-    0x17, 0x1C, 0x23, 0x2E,
-    0x17, 0x2E, 0x2E, 0x2E,
-    0x17, 0x17, 0x2E, 0x2E,
-    0x17, 0x17, 0x17, 0x2E,
-    0x17, 0x24, 0x2B, 0x31,
-    0x17, 0x1D, 0x2B, 0x31,
-    0x17, 0x1D, 0x24, 0x31,
-    0x17, 0x31, 0x31, 0x31,
-    0x17, 0x17, 0x31, 0x31,
-    0x17, 0x17, 0x17, 0x31,
-    0x17, 0x25, 0x2D, 0x34,
-    0x17, 0x1E, 0x2D, 0x34,
-    0x17, 0x1E, 0x26, 0x34,
-    0x17, 0x34, 0x34, 0x34,
-    0x17, 0x17, 0x34, 0x34,
-    0x17, 0x17, 0x17, 0x34,
-    0x17, 0x27, 0x2F, 0x37,
-    0x17, 0x1F, 0x2F, 0x37,
-    0x17, 0x1F, 0x27, 0x37,
-    0x17, 0x37, 0x37, 0x37,
-    0x17, 0x17, 0x37, 0x37,
-    0x17, 0x17, 0x17, 0x37,
-    0x17, 0x3A, 0x3A, 0x3A,
-    0x17, 0x17, 0x3A, 0x3A,
-    0x17, 0x17, 0x17, 0x3A,
-    0x17, 0x29, 0x32, 0x3B,
-    0x17, 0x20, 0x32, 0x3B,
-    0x17, 0x20, 0x29, 0x3B,
-    0x17, 0x3F, 0x3F, 0x3F,
-    0x17, 0x17, 0x3F, 0x3F,
-    0x17, 0x17, 0x17, 0x3F,
-    0x18, 0x19, 0x19, 0x1A,
-    0x18, 0x19, 0x1A, 0x1B,
-    0x18, 0x1A, 0x1B, 0x1C,
-    0x18, 0x19, 0x1B, 0x1C,
-    0x18, 0x19, 0x1A, 0x1C,
-    0x18, 0x1A, 0x1B, 0x1D,
-    0x18, 0x1A, 0x1C, 0x1D,
-    0x18, 0x19, 0x1C, 0x1D,
-    0x18, 0x19, 0x1B, 0x1D,
-    0x18, 0x1A, 0x1C, 0x1E,
-    0x18, 0x1B, 0x1D, 0x1E,
-    0x18, 0x19, 0x1D, 0x1E,
-    0x18, 0x19, 0x1B, 0x1E,
-    0x18, 0x1E, 0x1E, 0x1E,
-    0x18, 0x18, 0x1E, 0x1E,
-    0x18, 0x18, 0x18, 0x1E,
-    0x18, 0x1B, 0x1C, 0x1F,
-    0x18, 0x1B, 0x1E, 0x1F,
-    0x18, 0x19, 0x1E, 0x1F,
-    0x18, 0x19, 0x1C, 0x1F,
-    0x18, 0x1B, 0x1D, 0x20,
-    0x18, 0x1C, 0x1E, 0x20,
-    0x18, 0x1A, 0x1E, 0x20,
-    0x18, 0x1A, 0x1C, 0x20,
-    0x18, 0x20, 0x20, 0x20,
-    0x18, 0x18, 0x20, 0x20,
-    0x18, 0x18, 0x18, 0x20,
-    0x18, 0x1C, 0x1F, 0x23,
-    0x18, 0x1D, 0x21, 0x23,
-    0x18, 0x1A, 0x21, 0x23,
-    0x18, 0x1A, 0x1E, 0x23,
-    0x18, 0x23, 0x23, 0x23,
-    0x18, 0x18, 0x23, 0x23,
-    0x18, 0x18, 0x18, 0x23,
-    0x18, 0x1D, 0x21, 0x26,
-    0x18, 0x1F, 0x23, 0x26,
-    0x18, 0x1B, 0x23, 0x26,
-    0x18, 0x1B, 0x1F, 0x26,
-    0x18, 0x26, 0x26, 0x26,
-    0x18, 0x18, 0x26, 0x26,
-    0x18, 0x18, 0x18, 0x26,
-    0x18, 0x1E, 0x23, 0x29,
-    0x18, 0x20, 0x25, 0x29,
-    0x18, 0x1C, 0x25, 0x29,
-    0x18, 0x1C, 0x21, 0x29,
-    0x18, 0x29, 0x29, 0x29,
-    0x18, 0x18, 0x29, 0x29,
-    0x18, 0x18, 0x18, 0x29,
-    0x18, 0x1F, 0x25, 0x2C,
-    0x18, 0x22, 0x27, 0x2C,
-    0x18, 0x1D, 0x27, 0x2C,
-    0x18, 0x1D, 0x22, 0x2C,
-    0x18, 0x2C, 0x2C, 0x2C,
-    0x18, 0x18, 0x2C, 0x2C,
-    0x18, 0x18, 0x18, 0x2C,
-    0x18, 0x23, 0x2A, 0x2F,
-    0x18, 0x1D, 0x2A, 0x2F,
-    0x18, 0x1D, 0x24, 0x2F,
-    0x18, 0x2F, 0x2F, 0x2F,
-    0x18, 0x18, 0x2F, 0x2F,
-    0x18, 0x18, 0x18, 0x2F,
-    0x18, 0x25, 0x2C, 0x32,
-    0x18, 0x1E, 0x2C, 0x32,
-    0x18, 0x1E, 0x25, 0x32,
-    0x18, 0x32, 0x32, 0x32,
-    0x18, 0x18, 0x32, 0x32,
-    0x18, 0x18, 0x18, 0x32,
-    0x18, 0x26, 0x2E, 0x35,
-    0x18, 0x1F, 0x2E, 0x35,
-    0x18, 0x1F, 0x27, 0x35,
-    0x18, 0x35, 0x35, 0x35,
-    0x18, 0x18, 0x35, 0x35,
-    0x18, 0x18, 0x18, 0x35,
-    0x18, 0x28, 0x30, 0x38,
-    0x18, 0x20, 0x30, 0x38,
-    0x18, 0x20, 0x28, 0x38,
-    0x18, 0x38, 0x38, 0x38,
-    0x18, 0x18, 0x38, 0x38,
-    0x18, 0x18, 0x18, 0x38,
-    0x18, 0x3B, 0x3B, 0x3B,
-    0x18, 0x18, 0x3B, 0x3B,
-    0x18, 0x18, 0x18, 0x3B,
-    0x18, 0x2A, 0x33, 0x3C,
-    0x18, 0x21, 0x33, 0x3C,
-    0x18, 0x21, 0x2A, 0x3C,
-    0x19, 0x1A, 0x1A, 0x1B,
-    0x19, 0x1A, 0x1B, 0x1C,
-    0x19, 0x1B, 0x1C, 0x1D,
-    0x19, 0x1A, 0x1C, 0x1D,
-    0x19, 0x1A, 0x1B, 0x1D,
-    0x19, 0x1B, 0x1C, 0x1E,
-    0x19, 0x1B, 0x1D, 0x1E,
-    0x19, 0x1A, 0x1D, 0x1E,
-    0x19, 0x1A, 0x1C, 0x1E,
-    0x19, 0x1B, 0x1D, 0x1F,
-    0x19, 0x1C, 0x1E, 0x1F,
-    0x19, 0x1A, 0x1E, 0x1F,
-    0x19, 0x1A, 0x1C, 0x1F,
-    0x19, 0x1F, 0x1F, 0x1F,
-    0x19, 0x19, 0x1F, 0x1F,
-    0x19, 0x19, 0x19, 0x1F,
-    0x19, 0x1C, 0x1D, 0x20,
-    0x19, 0x1C, 0x1F, 0x20,
-    0x19, 0x1A, 0x1F, 0x20,
-    0x19, 0x1A, 0x1D, 0x20,
-    0x19, 0x1C, 0x1E, 0x21,
-    0x19, 0x1D, 0x1F, 0x21,
-    0x19, 0x1B, 0x1F, 0x21,
-    0x19, 0x1B, 0x1D, 0x21,
-    0x19, 0x21, 0x21, 0x21,
-    0x19, 0x19, 0x21, 0x21,
-    0x19, 0x19, 0x19, 0x21,
-    0x19, 0x1D, 0x20, 0x24,
-    0x19, 0x1E, 0x22, 0x24,
-    0x19, 0x1B, 0x22, 0x24,
-    0x19, 0x1B, 0x1F, 0x24,
-    0x19, 0x24, 0x24, 0x24,
-    0x19, 0x19, 0x24, 0x24,
-    0x19, 0x19, 0x19, 0x24,
-    0x19, 0x1E, 0x22, 0x27,
-    0x19, 0x20, 0x24, 0x27,
-    0x19, 0x1C, 0x24, 0x27,
-    0x19, 0x1C, 0x20, 0x27,
-    0x19, 0x27, 0x27, 0x27,
-    0x19, 0x19, 0x27, 0x27,
-    0x19, 0x19, 0x19, 0x27,
-    0x19, 0x1F, 0x24, 0x2A,
-    0x19, 0x21, 0x26, 0x2A,
-    0x19, 0x1D, 0x26, 0x2A,
-    0x19, 0x1D, 0x22, 0x2A,
-    0x19, 0x2A, 0x2A, 0x2A,
-    0x19, 0x19, 0x2A, 0x2A,
-    0x19, 0x19, 0x19, 0x2A,
-    0x19, 0x20, 0x26, 0x2D,
-    0x19, 0x23, 0x28, 0x2D,
-    0x19, 0x1E, 0x28, 0x2D,
-    0x19, 0x1E, 0x23, 0x2D,
-    0x19, 0x2D, 0x2D, 0x2D,
-    0x19, 0x19, 0x2D, 0x2D,
-    0x19, 0x19, 0x19, 0x2D,
-    0x19, 0x24, 0x2B, 0x30,
-    0x19, 0x1E, 0x2B, 0x30,
-    0x19, 0x1E, 0x25, 0x30,
-    0x19, 0x30, 0x30, 0x30,
-    0x19, 0x19, 0x30, 0x30,
-    0x19, 0x19, 0x19, 0x30,
-    0x19, 0x26, 0x2D, 0x33,
-    0x19, 0x1F, 0x2D, 0x33,
-    0x19, 0x1F, 0x26, 0x33,
-    0x19, 0x33, 0x33, 0x33,
-    0x19, 0x19, 0x33, 0x33,
-    0x19, 0x19, 0x19, 0x33,
-    0x19, 0x27, 0x2F, 0x36,
-    0x19, 0x20, 0x2F, 0x36,
-    0x19, 0x20, 0x28, 0x36,
-    0x19, 0x36, 0x36, 0x36,
-    0x19, 0x19, 0x36, 0x36,
-    0x19, 0x19, 0x19, 0x36,
-    0x19, 0x29, 0x31, 0x39,
-    0x19, 0x21, 0x31, 0x39,
-    0x19, 0x21, 0x29, 0x39,
-    0x19, 0x39, 0x39, 0x39,
-    0x19, 0x19, 0x39, 0x39,
-    0x19, 0x19, 0x19, 0x39,
-    0x19, 0x3C, 0x3C, 0x3C,
-    0x19, 0x19, 0x3C, 0x3C,
-    0x19, 0x19, 0x19, 0x3C,
-    0x19, 0x2B, 0x34, 0x3D,
-    0x19, 0x22, 0x34, 0x3D,
-    0x19, 0x22, 0x2B, 0x3D,
-    0x1A, 0x1B, 0x1B, 0x1C,
-    0x1A, 0x1B, 0x1C, 0x1D,
-    0x1A, 0x1C, 0x1D, 0x1E,
-    0x1A, 0x1B, 0x1D, 0x1E,
-    0x1A, 0x1B, 0x1C, 0x1E,
-    0x1A, 0x1C, 0x1D, 0x1F,
-    0x1A, 0x1C, 0x1E, 0x1F,
-    0x1A, 0x1B, 0x1E, 0x1F,
-    0x1A, 0x1B, 0x1D, 0x1F,
-    0x1A, 0x1C, 0x1E, 0x20,
-    0x1A, 0x1D, 0x1F, 0x20,
-    0x1A, 0x1B, 0x1F, 0x20,
-    0x1A, 0x1B, 0x1D, 0x20,
-    0x1A, 0x20, 0x20, 0x20,
-    0x1A, 0x1A, 0x20, 0x20,
-    0x1A, 0x1A, 0x1A, 0x20,
-    0x1A, 0x1D, 0x1E, 0x21,
-    0x1A, 0x1D, 0x20, 0x21,
-    0x1A, 0x1B, 0x20, 0x21,
-    0x1A, 0x1B, 0x1E, 0x21,
-    0x1A, 0x1D, 0x1F, 0x22,
-    0x1A, 0x1E, 0x20, 0x22,
-    0x1A, 0x1C, 0x20, 0x22,
-    0x1A, 0x1C, 0x1E, 0x22,
-    0x1A, 0x22, 0x22, 0x22,
-    0x1A, 0x1A, 0x22, 0x22,
-    0x1A, 0x1A, 0x1A, 0x22,
-    0x1A, 0x1E, 0x21, 0x25,
-    0x1A, 0x1F, 0x23, 0x25,
-    0x1A, 0x1C, 0x23, 0x25,
-    0x1A, 0x1C, 0x20, 0x25,
-    0x1A, 0x25, 0x25, 0x25,
-    0x1A, 0x1A, 0x25, 0x25,
-    0x1A, 0x1A, 0x1A, 0x25,
-    0x1A, 0x1F, 0x23, 0x28,
-    0x1A, 0x21, 0x25, 0x28,
-    0x1A, 0x1D, 0x25, 0x28,
-    0x1A, 0x1D, 0x21, 0x28,
-    0x1A, 0x28, 0x28, 0x28,
-    0x1A, 0x1A, 0x28, 0x28,
-    0x1A, 0x1A, 0x1A, 0x28,
-    0x1A, 0x20, 0x25, 0x2B,
-    0x1A, 0x22, 0x27, 0x2B,
-    0x1A, 0x1E, 0x27, 0x2B,
-    0x1A, 0x1E, 0x23, 0x2B,
-    0x1A, 0x2B, 0x2B, 0x2B,
-    0x1A, 0x1A, 0x2B, 0x2B,
-    0x1A, 0x1A, 0x1A, 0x2B,
-    0x1A, 0x21, 0x27, 0x2E,
-    0x1A, 0x24, 0x29, 0x2E,
-    0x1A, 0x1F, 0x29, 0x2E,
-    0x1A, 0x1F, 0x24, 0x2E,
-    0x1A, 0x2E, 0x2E, 0x2E,
-    0x1A, 0x1A, 0x2E, 0x2E,
-    0x1A, 0x1A, 0x1A, 0x2E,
-    0x1A, 0x25, 0x2C, 0x31,
-    0x1A, 0x1F, 0x2C, 0x31,
-    0x1A, 0x1F, 0x26, 0x31,
-    0x1A, 0x31, 0x31, 0x31,
-    0x1A, 0x1A, 0x31, 0x31,
-    0x1A, 0x1A, 0x1A, 0x31,
-    0x1A, 0x27, 0x2E, 0x34,
-    0x1A, 0x20, 0x2E, 0x34,
-    0x1A, 0x20, 0x27, 0x34,
-    0x1A, 0x34, 0x34, 0x34,
-    0x1A, 0x1A, 0x34, 0x34,
-    0x1A, 0x1A, 0x1A, 0x34,
-    0x1A, 0x28, 0x30, 0x37,
-    0x1A, 0x21, 0x30, 0x37,
-    0x1A, 0x21, 0x29, 0x37,
-    0x1A, 0x37, 0x37, 0x37,
-    0x1A, 0x1A, 0x37, 0x37,
-    0x1A, 0x1A, 0x1A, 0x37,
-    0x1A, 0x2A, 0x32, 0x3A,
-    0x1A, 0x22, 0x32, 0x3A,
-    0x1A, 0x22, 0x2A, 0x3A,
-    0x1A, 0x3A, 0x3A, 0x3A,
-    0x1A, 0x1A, 0x3A, 0x3A,
-    0x1A, 0x1A, 0x1A, 0x3A,
-    0x1A, 0x3D, 0x3D, 0x3D,
-    0x1A, 0x1A, 0x3D, 0x3D,
-    0x1A, 0x1A, 0x1A, 0x3D,
-    0x1A, 0x2C, 0x35, 0x3E,
-    0x1A, 0x23, 0x35, 0x3E,
-    0x1A, 0x23, 0x2C, 0x3E,
-    0x1B, 0x1C, 0x1C, 0x1D,
-    0x1B, 0x1C, 0x1D, 0x1E,
-    0x1B, 0x1D, 0x1E, 0x1F,
-    0x1B, 0x1C, 0x1E, 0x1F,
-    0x1B, 0x1C, 0x1D, 0x1F,
-    0x1B, 0x1D, 0x1E, 0x20,
-    0x1B, 0x1D, 0x1F, 0x20,
-    0x1B, 0x1C, 0x1F, 0x20,
-    0x1B, 0x1C, 0x1E, 0x20,
-    0x1B, 0x1D, 0x1F, 0x21,
-    0x1B, 0x1E, 0x20, 0x21,
-    0x1B, 0x1C, 0x20, 0x21,
-    0x1B, 0x1C, 0x1E, 0x21,
-    0x1B, 0x21, 0x21, 0x21,
-    0x1B, 0x1B, 0x21, 0x21,
-    0x1B, 0x1B, 0x1B, 0x21,
-    0x1B, 0x1E, 0x1F, 0x22,
-    0x1B, 0x1E, 0x21, 0x22,
-    0x1B, 0x1C, 0x21, 0x22,
-    0x1B, 0x1C, 0x1F, 0x22,
-    0x1B, 0x1E, 0x20, 0x23,
-    0x1B, 0x1F, 0x21, 0x23,
-    0x1B, 0x1D, 0x21, 0x23,
-    0x1B, 0x1D, 0x1F, 0x23,
-    0x1B, 0x23, 0x23, 0x23,
-    0x1B, 0x1B, 0x23, 0x23,
-    0x1B, 0x1B, 0x1B, 0x23,
-    0x1B, 0x1F, 0x22, 0x26,
-    0x1B, 0x20, 0x24, 0x26,
-    0x1B, 0x1D, 0x24, 0x26,
-    0x1B, 0x1D, 0x21, 0x26,
-    0x1B, 0x26, 0x26, 0x26,
-    0x1B, 0x1B, 0x26, 0x26,
-    0x1B, 0x1B, 0x1B, 0x26,
-    0x1B, 0x20, 0x24, 0x29,
-    0x1B, 0x22, 0x26, 0x29,
-    0x1B, 0x1E, 0x26, 0x29,
-    0x1B, 0x1E, 0x22, 0x29,
-    0x1B, 0x29, 0x29, 0x29,
-    0x1B, 0x1B, 0x29, 0x29,
-    0x1B, 0x1B, 0x1B, 0x29,
-    0x1B, 0x21, 0x26, 0x2C,
-    0x1B, 0x23, 0x28, 0x2C,
-    0x1B, 0x1F, 0x28, 0x2C,
-    0x1B, 0x1F, 0x24, 0x2C,
-    0x1B, 0x2C, 0x2C, 0x2C,
-    0x1B, 0x1B, 0x2C, 0x2C,
-    0x1B, 0x1B, 0x1B, 0x2C,
-    0x1B, 0x22, 0x28, 0x2F,
-    0x1B, 0x25, 0x2A, 0x2F,
-    0x1B, 0x20, 0x2A, 0x2F,
-    0x1B, 0x20, 0x25, 0x2F,
-    0x1B, 0x2F, 0x2F, 0x2F,
-    0x1B, 0x1B, 0x2F, 0x2F,
-    0x1B, 0x1B, 0x1B, 0x2F,
-    0x1B, 0x26, 0x2D, 0x32,
-    0x1B, 0x20, 0x2D, 0x32,
-    0x1B, 0x20, 0x27, 0x32,
-    0x1B, 0x32, 0x32, 0x32,
-    0x1B, 0x1B, 0x32, 0x32,
-    0x1B, 0x1B, 0x1B, 0x32,
-    0x1B, 0x28, 0x2F, 0x35,
-    0x1B, 0x21, 0x2F, 0x35,
-    0x1B, 0x21, 0x28, 0x35,
-    0x1B, 0x35, 0x35, 0x35,
-    0x1B, 0x1B, 0x35, 0x35,
-    0x1B, 0x1B, 0x1B, 0x35,
-    0x1B, 0x29, 0x31, 0x38,
-    0x1B, 0x22, 0x31, 0x38,
-    0x1B, 0x22, 0x2A, 0x38,
-    0x1B, 0x38, 0x38, 0x38,
-    0x1B, 0x1B, 0x38, 0x38,
-    0x1B, 0x1B, 0x1B, 0x38,
-    0x1B, 0x2B, 0x33, 0x3B,
-    0x1B, 0x23, 0x33, 0x3B,
-    0x1B, 0x23, 0x2B, 0x3B,
-    0x1B, 0x3B, 0x3B, 0x3B,
-    0x1B, 0x1B, 0x3B, 0x3B,
-    0x1B, 0x1B, 0x1B, 0x3B,
-    0x1B, 0x3E, 0x3E, 0x3E,
-    0x1B, 0x1B, 0x3E, 0x3E,
-    0x1B, 0x1B, 0x1B, 0x3E,
-    0x1B, 0x2D, 0x36, 0x3F,
-    0x1B, 0x24, 0x36, 0x3F,
-    0x1B, 0x24, 0x2D, 0x3F,
-    0x1C, 0x1D, 0x1D, 0x1E,
-    0x1C, 0x1D, 0x1E, 0x1F,
-    0x1C, 0x1E, 0x1F, 0x20,
-    0x1C, 0x1D, 0x1F, 0x20,
-    0x1C, 0x1D, 0x1E, 0x20,
-    0x1C, 0x1E, 0x1F, 0x21,
-    0x1C, 0x1E, 0x20, 0x21,
-    0x1C, 0x1D, 0x20, 0x21,
-    0x1C, 0x1D, 0x1F, 0x21,
-    0x1C, 0x1E, 0x20, 0x22,
-    0x1C, 0x1F, 0x21, 0x22,
-    0x1C, 0x1D, 0x21, 0x22,
-    0x1C, 0x1D, 0x1F, 0x22,
-    0x1C, 0x22, 0x22, 0x22,
-    0x1C, 0x1C, 0x22, 0x22,
-    0x1C, 0x1C, 0x1C, 0x22,
-    0x1C, 0x1F, 0x20, 0x23,
-    0x1C, 0x1F, 0x22, 0x23,
-    0x1C, 0x1D, 0x22, 0x23,
-    0x1C, 0x1D, 0x20, 0x23,
-    0x1C, 0x1F, 0x21, 0x24,
-    0x1C, 0x20, 0x22, 0x24,
-    0x1C, 0x1E, 0x22, 0x24,
-    0x1C, 0x1E, 0x20, 0x24,
-    0x1C, 0x24, 0x24, 0x24,
-    0x1C, 0x1C, 0x24, 0x24,
-    0x1C, 0x1C, 0x1C, 0x24,
-    0x1C, 0x20, 0x23, 0x27,
-    0x1C, 0x21, 0x25, 0x27,
-    0x1C, 0x1E, 0x25, 0x27,
-    0x1C, 0x1E, 0x22, 0x27,
-    0x1C, 0x27, 0x27, 0x27,
-    0x1C, 0x1C, 0x27, 0x27,
-    0x1C, 0x1C, 0x1C, 0x27,
-    0x1C, 0x21, 0x25, 0x2A,
-    0x1C, 0x23, 0x27, 0x2A,
-    0x1C, 0x1F, 0x27, 0x2A,
-    0x1C, 0x1F, 0x23, 0x2A,
-    0x1C, 0x2A, 0x2A, 0x2A,
-    0x1C, 0x1C, 0x2A, 0x2A,
-    0x1C, 0x1C, 0x1C, 0x2A,
-    0x1C, 0x22, 0x27, 0x2D,
-    0x1C, 0x24, 0x29, 0x2D,
-    0x1C, 0x20, 0x29, 0x2D,
-    0x1C, 0x20, 0x25, 0x2D,
-    0x1C, 0x2D, 0x2D, 0x2D,
-    0x1C, 0x1C, 0x2D, 0x2D,
-    0x1C, 0x1C, 0x1C, 0x2D,
-    0x1C, 0x23, 0x29, 0x30,
-    0x1C, 0x26, 0x2B, 0x30,
-    0x1C, 0x21, 0x2B, 0x30,
-    0x1C, 0x21, 0x26, 0x30,
-    0x1C, 0x30, 0x30, 0x30,
-    0x1C, 0x1C, 0x30, 0x30,
-    0x1C, 0x1C, 0x1C, 0x30,
-    0x1C, 0x27, 0x2E, 0x33,
-    0x1C, 0x21, 0x2E, 0x33,
-    0x1C, 0x21, 0x28, 0x33,
-    0x1C, 0x33, 0x33, 0x33,
-    0x1C, 0x1C, 0x33, 0x33,
-    0x1C, 0x1C, 0x1C, 0x33,
-    0x1C, 0x29, 0x30, 0x36,
-    0x1C, 0x22, 0x30, 0x36,
-    0x1C, 0x22, 0x29, 0x36,
-    0x1C, 0x36, 0x36, 0x36,
-    0x1C, 0x1C, 0x36, 0x36,
-    0x1C, 0x1C, 0x1C, 0x36,
-    0x1C, 0x2A, 0x32, 0x39,
-    0x1C, 0x23, 0x32, 0x39,
-    0x1C, 0x23, 0x2B, 0x39,
-    0x1C, 0x39, 0x39, 0x39,
-    0x1C, 0x1C, 0x39, 0x39,
-    0x1C, 0x1C, 0x1C, 0x39,
-    0x1C, 0x2C, 0x34, 0x3C,
-    0x1C, 0x24, 0x34, 0x3C,
-    0x1C, 0x24, 0x2C, 0x3C,
-    0x1C, 0x3C, 0x3C, 0x3C,
-    0x1C, 0x1C, 0x3C, 0x3C,
-    0x1C, 0x1C, 0x1C, 0x3C,
-    0x1C, 0x3F, 0x3F, 0x3F,
-    0x1C, 0x1C, 0x3F, 0x3F,
-    0x1C, 0x1C, 0x1C, 0x3F,
-    0x1D, 0x1E, 0x1E, 0x1F,
-    0x1D, 0x1E, 0x1F, 0x20,
-    0x1D, 0x1F, 0x20, 0x21,
-    0x1D, 0x1E, 0x20, 0x21,
-    0x1D, 0x1E, 0x1F, 0x21,
-    0x1D, 0x1F, 0x20, 0x22,
-    0x1D, 0x1F, 0x21, 0x22,
-    0x1D, 0x1E, 0x21, 0x22,
-    0x1D, 0x1E, 0x20, 0x22,
-    0x1D, 0x1F, 0x21, 0x23,
-    0x1D, 0x20, 0x22, 0x23,
-    0x1D, 0x1E, 0x22, 0x23,
-    0x1D, 0x1E, 0x20, 0x23,
-    0x1D, 0x23, 0x23, 0x23,
-    0x1D, 0x1D, 0x23, 0x23,
-    0x1D, 0x1D, 0x1D, 0x23,
-    0x1D, 0x20, 0x21, 0x24,
-    0x1D, 0x20, 0x23, 0x24,
-    0x1D, 0x1E, 0x23, 0x24,
-    0x1D, 0x1E, 0x21, 0x24,
-    0x1D, 0x20, 0x22, 0x25,
-    0x1D, 0x21, 0x23, 0x25,
-    0x1D, 0x1F, 0x23, 0x25,
-    0x1D, 0x1F, 0x21, 0x25,
-    0x1D, 0x25, 0x25, 0x25,
-    0x1D, 0x1D, 0x25, 0x25,
-    0x1D, 0x1D, 0x1D, 0x25,
-    0x1D, 0x21, 0x24, 0x28,
-    0x1D, 0x22, 0x26, 0x28,
-    0x1D, 0x1F, 0x26, 0x28,
-    0x1D, 0x1F, 0x23, 0x28,
-    0x1D, 0x28, 0x28, 0x28,
-    0x1D, 0x1D, 0x28, 0x28,
-    0x1D, 0x1D, 0x1D, 0x28,
-    0x1D, 0x22, 0x26, 0x2B,
-    0x1D, 0x24, 0x28, 0x2B,
-    0x1D, 0x20, 0x28, 0x2B,
-    0x1D, 0x20, 0x24, 0x2B,
-    0x1D, 0x2B, 0x2B, 0x2B,
-    0x1D, 0x1D, 0x2B, 0x2B,
-    0x1D, 0x1D, 0x1D, 0x2B,
-    0x1D, 0x23, 0x28, 0x2E,
-    0x1D, 0x25, 0x2A, 0x2E,
-    0x1D, 0x21, 0x2A, 0x2E,
-    0x1D, 0x21, 0x26, 0x2E,
-    0x1D, 0x2E, 0x2E, 0x2E,
-    0x1D, 0x1D, 0x2E, 0x2E,
-    0x1D, 0x1D, 0x1D, 0x2E,
-    0x1D, 0x24, 0x2A, 0x31,
-    0x1D, 0x27, 0x2C, 0x31,
-    0x1D, 0x22, 0x2C, 0x31,
-    0x1D, 0x22, 0x27, 0x31,
-    0x1D, 0x31, 0x31, 0x31,
-    0x1D, 0x1D, 0x31, 0x31,
-    0x1D, 0x1D, 0x1D, 0x31,
-    0x1D, 0x28, 0x2F, 0x34,
-    0x1D, 0x22, 0x2F, 0x34,
-    0x1D, 0x22, 0x29, 0x34,
-    0x1D, 0x34, 0x34, 0x34,
-    0x1D, 0x1D, 0x34, 0x34,
-    0x1D, 0x1D, 0x1D, 0x34,
-    0x1D, 0x2A, 0x31, 0x37,
-    0x1D, 0x23, 0x31, 0x37,
-    0x1D, 0x23, 0x2A, 0x37,
-    0x1D, 0x37, 0x37, 0x37,
-    0x1D, 0x1D, 0x37, 0x37,
-    0x1D, 0x1D, 0x1D, 0x37,
-    0x1D, 0x2B, 0x33, 0x3A,
-    0x1D, 0x24, 0x33, 0x3A,
-    0x1D, 0x24, 0x2C, 0x3A,
-    0x1D, 0x3A, 0x3A, 0x3A,
-    0x1D, 0x1D, 0x3A, 0x3A,
-    0x1D, 0x1D, 0x1D, 0x3A,
-    0x1D, 0x2D, 0x35, 0x3D,
-    0x1D, 0x25, 0x35, 0x3D,
-    0x1D, 0x25, 0x2D, 0x3D,
-    0x1D, 0x3D, 0x3D, 0x3D,
-    0x1D, 0x1D, 0x3D, 0x3D,
-    0x1D, 0x1D, 0x1D, 0x3D,
-    0x1E, 0x1F, 0x1F, 0x20,
-    0x1E, 0x1F, 0x20, 0x21,
-    0x1E, 0x20, 0x21, 0x22,
-    0x1E, 0x1F, 0x21, 0x22,
-    0x1E, 0x1F, 0x20, 0x22,
-    0x1E, 0x20, 0x21, 0x23,
-    0x1E, 0x20, 0x22, 0x23,
-    0x1E, 0x1F, 0x22, 0x23,
-    0x1E, 0x1F, 0x21, 0x23,
-    0x1E, 0x20, 0x22, 0x24,
-    0x1E, 0x21, 0x23, 0x24,
-    0x1E, 0x1F, 0x23, 0x24,
-    0x1E, 0x1F, 0x21, 0x24,
-    0x1E, 0x24, 0x24, 0x24,
-    0x1E, 0x1E, 0x24, 0x24,
-    0x1E, 0x1E, 0x1E, 0x24,
-    0x1E, 0x21, 0x22, 0x25,
-    0x1E, 0x21, 0x24, 0x25,
-    0x1E, 0x1F, 0x24, 0x25,
-    0x1E, 0x1F, 0x22, 0x25,
-    0x1E, 0x21, 0x23, 0x26,
-    0x1E, 0x22, 0x24, 0x26,
-    0x1E, 0x20, 0x24, 0x26,
-    0x1E, 0x20, 0x22, 0x26,
-    0x1E, 0x26, 0x26, 0x26,
-    0x1E, 0x1E, 0x26, 0x26,
-    0x1E, 0x1E, 0x1E, 0x26,
-    0x1E, 0x22, 0x25, 0x29,
-    0x1E, 0x23, 0x27, 0x29,
-    0x1E, 0x20, 0x27, 0x29,
-    0x1E, 0x20, 0x24, 0x29,
-    0x1E, 0x29, 0x29, 0x29,
-    0x1E, 0x1E, 0x29, 0x29,
-    0x1E, 0x1E, 0x1E, 0x29,
-    0x1E, 0x23, 0x27, 0x2C,
-    0x1E, 0x25, 0x29, 0x2C,
-    0x1E, 0x21, 0x29, 0x2C,
-    0x1E, 0x21, 0x25, 0x2C,
-    0x1E, 0x2C, 0x2C, 0x2C,
-    0x1E, 0x1E, 0x2C, 0x2C,
-    0x1E, 0x1E, 0x1E, 0x2C,
-    0x1E, 0x24, 0x29, 0x2F,
-    0x1E, 0x26, 0x2B, 0x2F,
-    0x1E, 0x22, 0x2B, 0x2F,
-    0x1E, 0x22, 0x27, 0x2F,
-    0x1E, 0x2F, 0x2F, 0x2F,
-    0x1E, 0x1E, 0x2F, 0x2F,
-    0x1E, 0x1E, 0x1E, 0x2F,
-    0x1E, 0x25, 0x2B, 0x32,
-    0x1E, 0x28, 0x2D, 0x32,
-    0x1E, 0x23, 0x2D, 0x32,
-    0x1E, 0x23, 0x28, 0x32,
-    0x1E, 0x32, 0x32, 0x32,
-    0x1E, 0x1E, 0x32, 0x32,
-    0x1E, 0x1E, 0x1E, 0x32,
-    0x1E, 0x29, 0x30, 0x35,
-    0x1E, 0x23, 0x30, 0x35,
-    0x1E, 0x23, 0x2A, 0x35,
-    0x1E, 0x35, 0x35, 0x35,
-    0x1E, 0x1E, 0x35, 0x35,
-    0x1E, 0x1E, 0x1E, 0x35,
-    0x1E, 0x2B, 0x32, 0x38,
-    0x1E, 0x24, 0x32, 0x38,
-    0x1E, 0x24, 0x2B, 0x38,
-    0x1E, 0x38, 0x38, 0x38,
-    0x1E, 0x1E, 0x38, 0x38,
-    0x1E, 0x1E, 0x1E, 0x38,
-    0x1E, 0x2C, 0x34, 0x3B,
-    0x1E, 0x25, 0x34, 0x3B,
-    0x1E, 0x25, 0x2D, 0x3B,
-    0x1E, 0x3B, 0x3B, 0x3B,
-    0x1E, 0x1E, 0x3B, 0x3B,
-    0x1E, 0x1E, 0x1E, 0x3B,
-    0x1E, 0x2E, 0x36, 0x3E,
-    0x1E, 0x26, 0x36, 0x3E,
-    0x1E, 0x26, 0x2E, 0x3E,
-    0x1E, 0x3E, 0x3E, 0x3E,
-    0x1E, 0x1E, 0x3E, 0x3E,
-    0x1E, 0x1E, 0x1E, 0x3E,
-    0x1F, 0x20, 0x20, 0x21,
-    0x1F, 0x20, 0x21, 0x22,
-    0x1F, 0x21, 0x22, 0x23,
-    0x1F, 0x20, 0x22, 0x23,
-    0x1F, 0x20, 0x21, 0x23,
-    0x1F, 0x21, 0x22, 0x24,
-    0x1F, 0x21, 0x23, 0x24,
-    0x1F, 0x20, 0x23, 0x24,
-    0x1F, 0x20, 0x22, 0x24,
-    0x1F, 0x21, 0x23, 0x25,
-    0x1F, 0x22, 0x24, 0x25,
-    0x1F, 0x20, 0x24, 0x25,
-    0x1F, 0x20, 0x22, 0x25,
-    0x1F, 0x25, 0x25, 0x25,
-    0x1F, 0x1F, 0x25, 0x25,
-    0x1F, 0x1F, 0x1F, 0x25,
-    0x1F, 0x22, 0x23, 0x26,
-    0x1F, 0x22, 0x25, 0x26,
-    0x1F, 0x20, 0x25, 0x26,
-    0x1F, 0x20, 0x23, 0x26,
-    0x1F, 0x22, 0x24, 0x27,
-    0x1F, 0x23, 0x25, 0x27,
-    0x1F, 0x21, 0x25, 0x27,
-    0x1F, 0x21, 0x23, 0x27,
-    0x1F, 0x27, 0x27, 0x27,
-    0x1F, 0x1F, 0x27, 0x27,
-    0x1F, 0x1F, 0x1F, 0x27,
-    0x1F, 0x23, 0x26, 0x2A,
-    0x1F, 0x24, 0x28, 0x2A,
-    0x1F, 0x21, 0x28, 0x2A,
-    0x1F, 0x21, 0x25, 0x2A,
-    0x1F, 0x2A, 0x2A, 0x2A,
-    0x1F, 0x1F, 0x2A, 0x2A,
-    0x1F, 0x1F, 0x1F, 0x2A,
-    0x1F, 0x24, 0x28, 0x2D,
-    0x1F, 0x26, 0x2A, 0x2D,
-    0x1F, 0x22, 0x2A, 0x2D,
-    0x1F, 0x22, 0x26, 0x2D,
-    0x1F, 0x2D, 0x2D, 0x2D,
-    0x1F, 0x1F, 0x2D, 0x2D,
-    0x1F, 0x1F, 0x1F, 0x2D,
-    0x1F, 0x25, 0x2A, 0x30,
-    0x1F, 0x27, 0x2C, 0x30,
-    0x1F, 0x23, 0x2C, 0x30,
-    0x1F, 0x23, 0x28, 0x30,
-    0x1F, 0x30, 0x30, 0x30,
-    0x1F, 0x1F, 0x30, 0x30,
-    0x1F, 0x1F, 0x1F, 0x30,
-    0x1F, 0x26, 0x2C, 0x33,
-    0x1F, 0x29, 0x2E, 0x33,
-    0x1F, 0x24, 0x2E, 0x33,
-    0x1F, 0x24, 0x29, 0x33,
-    0x1F, 0x33, 0x33, 0x33,
-    0x1F, 0x1F, 0x33, 0x33,
-    0x1F, 0x1F, 0x1F, 0x33,
-    0x1F, 0x2A, 0x31, 0x36,
-    0x1F, 0x24, 0x31, 0x36,
-    0x1F, 0x24, 0x2B, 0x36,
-    0x1F, 0x36, 0x36, 0x36,
-    0x1F, 0x1F, 0x36, 0x36,
-    0x1F, 0x1F, 0x1F, 0x36,
-    0x1F, 0x2C, 0x33, 0x39,
-    0x1F, 0x25, 0x33, 0x39,
-    0x1F, 0x25, 0x2C, 0x39,
-    0x1F, 0x39, 0x39, 0x39,
-    0x1F, 0x1F, 0x39, 0x39,
-    0x1F, 0x1F, 0x1F, 0x39,
-    0x1F, 0x2D, 0x35, 0x3C,
-    0x1F, 0x26, 0x35, 0x3C,
-    0x1F, 0x26, 0x2E, 0x3C,
-    0x1F, 0x3C, 0x3C, 0x3C,
-    0x1F, 0x1F, 0x3C, 0x3C,
-    0x1F, 0x1F, 0x1F, 0x3C,
-    0x1F, 0x2F, 0x37, 0x3F,
-    0x1F, 0x27, 0x37, 0x3F,
-    0x1F, 0x27, 0x2F, 0x3F,
-    0x1F, 0x3F, 0x3F, 0x3F,
-    0x1F, 0x1F, 0x3F, 0x3F,
-    0x1F, 0x1F, 0x1F, 0x3F,
-    0x20, 0x21, 0x21, 0x22,
-    0x20, 0x21, 0x22, 0x23,
-    0x20, 0x22, 0x23, 0x24,
-    0x20, 0x21, 0x23, 0x24,
-    0x20, 0x21, 0x22, 0x24,
-    0x20, 0x22, 0x23, 0x25,
-    0x20, 0x22, 0x24, 0x25,
-    0x20, 0x21, 0x24, 0x25,
-    0x20, 0x21, 0x23, 0x25,
-    0x20, 0x22, 0x24, 0x26,
-    0x20, 0x23, 0x25, 0x26,
-    0x20, 0x21, 0x25, 0x26,
-    0x20, 0x21, 0x23, 0x26,
-    0x20, 0x26, 0x26, 0x26,
-    0x20, 0x20, 0x26, 0x26,
-    0x20, 0x20, 0x20, 0x26,
-    0x20, 0x23, 0x24, 0x27,
-    0x20, 0x23, 0x26, 0x27,
-    0x20, 0x21, 0x26, 0x27,
-    0x20, 0x21, 0x24, 0x27,
-    0x20, 0x23, 0x25, 0x28,
-    0x20, 0x24, 0x26, 0x28,
-    0x20, 0x22, 0x26, 0x28,
-    0x20, 0x22, 0x24, 0x28,
-    0x20, 0x28, 0x28, 0x28,
-    0x20, 0x20, 0x28, 0x28,
-    0x20, 0x20, 0x20, 0x28,
-    0x20, 0x24, 0x27, 0x2B,
-    0x20, 0x25, 0x29, 0x2B,
-    0x20, 0x22, 0x29, 0x2B,
-    0x20, 0x22, 0x26, 0x2B,
-    0x20, 0x2B, 0x2B, 0x2B,
-    0x20, 0x20, 0x2B, 0x2B,
-    0x20, 0x20, 0x20, 0x2B,
-    0x20, 0x25, 0x29, 0x2E,
-    0x20, 0x27, 0x2B, 0x2E,
-    0x20, 0x23, 0x2B, 0x2E,
-    0x20, 0x23, 0x27, 0x2E,
-    0x20, 0x2E, 0x2E, 0x2E,
-    0x20, 0x20, 0x2E, 0x2E,
-    0x20, 0x20, 0x20, 0x2E,
-    0x20, 0x26, 0x2B, 0x31,
-    0x20, 0x28, 0x2D, 0x31,
-    0x20, 0x24, 0x2D, 0x31,
-    0x20, 0x24, 0x29, 0x31,
-    0x20, 0x31, 0x31, 0x31,
-    0x20, 0x20, 0x31, 0x31,
-    0x20, 0x20, 0x20, 0x31,
-    0x20, 0x27, 0x2D, 0x34,
-    0x20, 0x2A, 0x2F, 0x34,
-    0x20, 0x25, 0x2F, 0x34,
-    0x20, 0x25, 0x2A, 0x34,
-    0x20, 0x34, 0x34, 0x34,
-    0x20, 0x20, 0x34, 0x34,
-    0x20, 0x20, 0x20, 0x34,
-    0x20, 0x2B, 0x32, 0x37,
-    0x20, 0x25, 0x32, 0x37,
-    0x20, 0x25, 0x2C, 0x37,
-    0x20, 0x37, 0x37, 0x37,
-    0x20, 0x20, 0x37, 0x37,
-    0x20, 0x20, 0x20, 0x37,
-    0x20, 0x2D, 0x34, 0x3A,
-    0x20, 0x26, 0x34, 0x3A,
-    0x20, 0x26, 0x2D, 0x3A,
-    0x20, 0x3A, 0x3A, 0x3A,
-    0x20, 0x20, 0x3A, 0x3A,
-    0x20, 0x20, 0x20, 0x3A,
-    0x20, 0x2E, 0x36, 0x3D,
-    0x20, 0x27, 0x36, 0x3D,
-    0x20, 0x27, 0x2F, 0x3D,
-    0x20, 0x3D, 0x3D, 0x3D,
-    0x20, 0x20, 0x3D, 0x3D,
-    0x20, 0x20, 0x20, 0x3D,
-    0x21, 0x22, 0x22, 0x23,
-    0x21, 0x22, 0x23, 0x24,
-    0x21, 0x23, 0x24, 0x25,
-    0x21, 0x22, 0x24, 0x25,
-    0x21, 0x22, 0x23, 0x25,
-    0x21, 0x23, 0x24, 0x26,
-    0x21, 0x23, 0x25, 0x26,
-    0x21, 0x22, 0x25, 0x26,
-    0x21, 0x22, 0x24, 0x26,
-    0x21, 0x23, 0x25, 0x27,
-    0x21, 0x24, 0x26, 0x27,
-    0x21, 0x22, 0x26, 0x27,
-    0x21, 0x22, 0x24, 0x27,
-    0x21, 0x27, 0x27, 0x27,
-    0x21, 0x21, 0x27, 0x27,
-    0x21, 0x21, 0x21, 0x27,
-    0x21, 0x24, 0x25, 0x28,
-    0x21, 0x24, 0x27, 0x28,
-    0x21, 0x22, 0x27, 0x28,
-    0x21, 0x22, 0x25, 0x28,
-    0x21, 0x24, 0x26, 0x29,
-    0x21, 0x25, 0x27, 0x29,
-    0x21, 0x23, 0x27, 0x29,
-    0x21, 0x23, 0x25, 0x29,
-    0x21, 0x29, 0x29, 0x29,
-    0x21, 0x21, 0x29, 0x29,
-    0x21, 0x21, 0x21, 0x29,
-    0x21, 0x25, 0x28, 0x2C,
-    0x21, 0x26, 0x2A, 0x2C,
-    0x21, 0x23, 0x2A, 0x2C,
-    0x21, 0x23, 0x27, 0x2C,
-    0x21, 0x2C, 0x2C, 0x2C,
-    0x21, 0x21, 0x2C, 0x2C,
-    0x21, 0x21, 0x21, 0x2C,
-    0x21, 0x26, 0x2A, 0x2F,
-    0x21, 0x28, 0x2C, 0x2F,
-    0x21, 0x24, 0x2C, 0x2F,
-    0x21, 0x24, 0x28, 0x2F,
-    0x21, 0x2F, 0x2F, 0x2F,
-    0x21, 0x21, 0x2F, 0x2F,
-    0x21, 0x21, 0x21, 0x2F,
-    0x21, 0x27, 0x2C, 0x32,
-    0x21, 0x29, 0x2E, 0x32,
-    0x21, 0x25, 0x2E, 0x32,
-    0x21, 0x25, 0x2A, 0x32,
-    0x21, 0x32, 0x32, 0x32,
-    0x21, 0x21, 0x32, 0x32,
-    0x21, 0x21, 0x21, 0x32,
-    0x21, 0x28, 0x2E, 0x35,
-    0x21, 0x2B, 0x30, 0x35,
-    0x21, 0x26, 0x30, 0x35,
-    0x21, 0x26, 0x2B, 0x35,
-    0x21, 0x35, 0x35, 0x35,
-    0x21, 0x21, 0x35, 0x35,
-    0x21, 0x21, 0x21, 0x35,
-    0x21, 0x2C, 0x33, 0x38,
-    0x21, 0x26, 0x33, 0x38,
-    0x21, 0x26, 0x2D, 0x38,
-    0x21, 0x38, 0x38, 0x38,
-    0x21, 0x21, 0x38, 0x38,
-    0x21, 0x21, 0x21, 0x38,
-    0x21, 0x2E, 0x35, 0x3B,
-    0x21, 0x27, 0x35, 0x3B,
-    0x21, 0x27, 0x2E, 0x3B,
-    0x21, 0x3B, 0x3B, 0x3B,
-    0x21, 0x21, 0x3B, 0x3B,
-    0x21, 0x21, 0x21, 0x3B,
-    0x21, 0x2F, 0x37, 0x3E,
-    0x21, 0x28, 0x37, 0x3E,
-    0x21, 0x28, 0x30, 0x3E,
-    0x21, 0x3E, 0x3E, 0x3E,
-    0x21, 0x21, 0x3E, 0x3E,
-    0x21, 0x21, 0x21, 0x3E,
-    0x22, 0x23, 0x23, 0x24,
-    0x22, 0x23, 0x24, 0x25,
-    0x22, 0x24, 0x25, 0x26,
-    0x22, 0x23, 0x25, 0x26,
-    0x22, 0x23, 0x24, 0x26,
-    0x22, 0x24, 0x25, 0x27,
-    0x22, 0x24, 0x26, 0x27,
-    0x22, 0x23, 0x26, 0x27,
-    0x22, 0x23, 0x25, 0x27,
-    0x22, 0x24, 0x26, 0x28,
-    0x22, 0x25, 0x27, 0x28,
-    0x22, 0x23, 0x27, 0x28,
-    0x22, 0x23, 0x25, 0x28,
-    0x22, 0x28, 0x28, 0x28,
-    0x22, 0x22, 0x28, 0x28,
-    0x22, 0x22, 0x22, 0x28,
-    0x22, 0x25, 0x26, 0x29,
-    0x22, 0x25, 0x28, 0x29,
-    0x22, 0x23, 0x28, 0x29,
-    0x22, 0x23, 0x26, 0x29,
-    0x22, 0x25, 0x27, 0x2A,
-    0x22, 0x26, 0x28, 0x2A,
-    0x22, 0x24, 0x28, 0x2A,
-    0x22, 0x24, 0x26, 0x2A,
-    0x22, 0x2A, 0x2A, 0x2A,
-    0x22, 0x22, 0x2A, 0x2A,
-    0x22, 0x22, 0x22, 0x2A,
-    0x22, 0x26, 0x29, 0x2D,
-    0x22, 0x27, 0x2B, 0x2D,
-    0x22, 0x24, 0x2B, 0x2D,
-    0x22, 0x24, 0x28, 0x2D,
-    0x22, 0x2D, 0x2D, 0x2D,
-    0x22, 0x22, 0x2D, 0x2D,
-    0x22, 0x22, 0x22, 0x2D,
-    0x22, 0x27, 0x2B, 0x30,
-    0x22, 0x29, 0x2D, 0x30,
-    0x22, 0x25, 0x2D, 0x30,
-    0x22, 0x25, 0x29, 0x30,
-    0x22, 0x30, 0x30, 0x30,
-    0x22, 0x22, 0x30, 0x30,
-    0x22, 0x22, 0x22, 0x30,
-    0x22, 0x28, 0x2D, 0x33,
-    0x22, 0x2A, 0x2F, 0x33,
-    0x22, 0x26, 0x2F, 0x33,
-    0x22, 0x26, 0x2B, 0x33,
-    0x22, 0x33, 0x33, 0x33,
-    0x22, 0x22, 0x33, 0x33,
-    0x22, 0x22, 0x22, 0x33,
-    0x22, 0x29, 0x2F, 0x36,
-    0x22, 0x2C, 0x31, 0x36,
-    0x22, 0x27, 0x31, 0x36,
-    0x22, 0x27, 0x2C, 0x36,
-    0x22, 0x36, 0x36, 0x36,
-    0x22, 0x22, 0x36, 0x36,
-    0x22, 0x22, 0x22, 0x36,
-    0x22, 0x2D, 0x34, 0x39,
-    0x22, 0x27, 0x34, 0x39,
-    0x22, 0x27, 0x2E, 0x39,
-    0x22, 0x39, 0x39, 0x39,
-    0x22, 0x22, 0x39, 0x39,
-    0x22, 0x22, 0x22, 0x39,
-    0x22, 0x2F, 0x36, 0x3C,
-    0x22, 0x28, 0x36, 0x3C,
-    0x22, 0x28, 0x2F, 0x3C,
-    0x22, 0x3C, 0x3C, 0x3C,
-    0x22, 0x22, 0x3C, 0x3C,
-    0x22, 0x22, 0x22, 0x3C,
-    0x22, 0x30, 0x38, 0x3F,
-    0x22, 0x29, 0x38, 0x3F,
-    0x22, 0x29, 0x31, 0x3F,
-    0x22, 0x3F, 0x3F, 0x3F,
-    0x22, 0x22, 0x3F, 0x3F,
-    0x22, 0x22, 0x22, 0x3F,
-    0x23, 0x24, 0x24, 0x25,
-    0x23, 0x24, 0x25, 0x26,
-    0x23, 0x25, 0x26, 0x27,
-    0x23, 0x24, 0x26, 0x27,
-    0x23, 0x24, 0x25, 0x27,
-    0x23, 0x25, 0x26, 0x28,
-    0x23, 0x25, 0x27, 0x28,
-    0x23, 0x24, 0x27, 0x28,
-    0x23, 0x24, 0x26, 0x28,
-    0x23, 0x25, 0x27, 0x29,
-    0x23, 0x26, 0x28, 0x29,
-    0x23, 0x24, 0x28, 0x29,
-    0x23, 0x24, 0x26, 0x29,
-    0x23, 0x29, 0x29, 0x29,
-    0x23, 0x23, 0x29, 0x29,
-    0x23, 0x23, 0x23, 0x29,
-    0x23, 0x26, 0x27, 0x2A,
-    0x23, 0x26, 0x29, 0x2A,
-    0x23, 0x24, 0x29, 0x2A,
-    0x23, 0x24, 0x27, 0x2A,
-    0x23, 0x26, 0x28, 0x2B,
-    0x23, 0x27, 0x29, 0x2B,
-    0x23, 0x25, 0x29, 0x2B,
-    0x23, 0x25, 0x27, 0x2B,
-    0x23, 0x2B, 0x2B, 0x2B,
-    0x23, 0x23, 0x2B, 0x2B,
-    0x23, 0x23, 0x23, 0x2B,
-    0x23, 0x27, 0x2A, 0x2E,
-    0x23, 0x28, 0x2C, 0x2E,
-    0x23, 0x25, 0x2C, 0x2E,
-    0x23, 0x25, 0x29, 0x2E,
-    0x23, 0x2E, 0x2E, 0x2E,
-    0x23, 0x23, 0x2E, 0x2E,
-    0x23, 0x23, 0x23, 0x2E,
-    0x23, 0x28, 0x2C, 0x31,
-    0x23, 0x2A, 0x2E, 0x31,
-    0x23, 0x26, 0x2E, 0x31,
-    0x23, 0x26, 0x2A, 0x31,
-    0x23, 0x31, 0x31, 0x31,
-    0x23, 0x23, 0x31, 0x31,
-    0x23, 0x23, 0x23, 0x31,
-    0x23, 0x29, 0x2E, 0x34,
-    0x23, 0x2B, 0x30, 0x34,
-    0x23, 0x27, 0x30, 0x34,
-    0x23, 0x27, 0x2C, 0x34,
-    0x23, 0x34, 0x34, 0x34,
-    0x23, 0x23, 0x34, 0x34,
-    0x23, 0x23, 0x23, 0x34,
-    0x23, 0x2A, 0x30, 0x37,
-    0x23, 0x2D, 0x32, 0x37,
-    0x23, 0x28, 0x32, 0x37,
-    0x23, 0x28, 0x2D, 0x37,
-    0x23, 0x37, 0x37, 0x37,
-    0x23, 0x23, 0x37, 0x37,
-    0x23, 0x23, 0x23, 0x37,
-    0x23, 0x2E, 0x35, 0x3A,
-    0x23, 0x28, 0x35, 0x3A,
-    0x23, 0x28, 0x2F, 0x3A,
-    0x23, 0x3A, 0x3A, 0x3A,
-    0x23, 0x23, 0x3A, 0x3A,
-    0x23, 0x23, 0x23, 0x3A,
-    0x23, 0x30, 0x37, 0x3D,
-    0x23, 0x29, 0x37, 0x3D,
-    0x23, 0x29, 0x30, 0x3D,
-    0x23, 0x3D, 0x3D, 0x3D,
-    0x23, 0x23, 0x3D, 0x3D,
-    0x23, 0x23, 0x23, 0x3D,
-    0x24, 0x25, 0x25, 0x26,
-    0x24, 0x25, 0x26, 0x27,
-    0x24, 0x26, 0x27, 0x28,
-    0x24, 0x25, 0x27, 0x28,
-    0x24, 0x25, 0x26, 0x28,
-    0x24, 0x26, 0x27, 0x29,
-    0x24, 0x26, 0x28, 0x29,
-    0x24, 0x25, 0x28, 0x29,
-    0x24, 0x25, 0x27, 0x29,
-    0x24, 0x26, 0x28, 0x2A,
-    0x24, 0x27, 0x29, 0x2A,
-    0x24, 0x25, 0x29, 0x2A,
-    0x24, 0x25, 0x27, 0x2A,
-    0x24, 0x2A, 0x2A, 0x2A,
-    0x24, 0x24, 0x2A, 0x2A,
-    0x24, 0x24, 0x24, 0x2A,
-    0x24, 0x27, 0x28, 0x2B,
-    0x24, 0x27, 0x2A, 0x2B,
-    0x24, 0x25, 0x2A, 0x2B,
-    0x24, 0x25, 0x28, 0x2B,
-    0x24, 0x27, 0x29, 0x2C,
-    0x24, 0x28, 0x2A, 0x2C,
-    0x24, 0x26, 0x2A, 0x2C,
-    0x24, 0x26, 0x28, 0x2C,
-    0x24, 0x2C, 0x2C, 0x2C,
-    0x24, 0x24, 0x2C, 0x2C,
-    0x24, 0x24, 0x24, 0x2C,
-    0x24, 0x28, 0x2B, 0x2F,
-    0x24, 0x29, 0x2D, 0x2F,
-    0x24, 0x26, 0x2D, 0x2F,
-    0x24, 0x26, 0x2A, 0x2F,
-    0x24, 0x2F, 0x2F, 0x2F,
-    0x24, 0x24, 0x2F, 0x2F,
-    0x24, 0x24, 0x24, 0x2F,
-    0x24, 0x29, 0x2D, 0x32,
-    0x24, 0x2B, 0x2F, 0x32,
-    0x24, 0x27, 0x2F, 0x32,
-    0x24, 0x27, 0x2B, 0x32,
-    0x24, 0x32, 0x32, 0x32,
-    0x24, 0x24, 0x32, 0x32,
-    0x24, 0x24, 0x24, 0x32,
-    0x24, 0x2A, 0x2F, 0x35,
-    0x24, 0x2C, 0x31, 0x35,
-    0x24, 0x28, 0x31, 0x35,
-    0x24, 0x28, 0x2D, 0x35,
-    0x24, 0x35, 0x35, 0x35,
-    0x24, 0x24, 0x35, 0x35,
-    0x24, 0x24, 0x24, 0x35,
-    0x24, 0x2B, 0x31, 0x38,
-    0x24, 0x2E, 0x33, 0x38,
-    0x24, 0x29, 0x33, 0x38,
-    0x24, 0x29, 0x2E, 0x38,
-    0x24, 0x38, 0x38, 0x38,
-    0x24, 0x24, 0x38, 0x38,
-    0x24, 0x24, 0x24, 0x38,
-    0x24, 0x2F, 0x36, 0x3B,
-    0x24, 0x29, 0x36, 0x3B,
-    0x24, 0x29, 0x30, 0x3B,
-    0x24, 0x3B, 0x3B, 0x3B,
-    0x24, 0x24, 0x3B, 0x3B,
-    0x24, 0x24, 0x24, 0x3B,
-    0x24, 0x31, 0x38, 0x3E,
-    0x24, 0x2A, 0x38, 0x3E,
-    0x24, 0x2A, 0x31, 0x3E,
-    0x24, 0x3E, 0x3E, 0x3E,
-    0x24, 0x24, 0x3E, 0x3E,
-    0x24, 0x24, 0x24, 0x3E,
-    0x25, 0x26, 0x26, 0x27,
-    0x25, 0x26, 0x27, 0x28,
-    0x25, 0x27, 0x28, 0x29,
-    0x25, 0x26, 0x28, 0x29,
-    0x25, 0x26, 0x27, 0x29,
-    0x25, 0x27, 0x28, 0x2A,
-    0x25, 0x27, 0x29, 0x2A,
-    0x25, 0x26, 0x29, 0x2A,
-    0x25, 0x26, 0x28, 0x2A,
-    0x25, 0x27, 0x29, 0x2B,
-    0x25, 0x28, 0x2A, 0x2B,
-    0x25, 0x26, 0x2A, 0x2B,
-    0x25, 0x26, 0x28, 0x2B,
-    0x25, 0x2B, 0x2B, 0x2B,
-    0x25, 0x25, 0x2B, 0x2B,
-    0x25, 0x25, 0x25, 0x2B,
-    0x25, 0x28, 0x29, 0x2C,
-    0x25, 0x28, 0x2B, 0x2C,
-    0x25, 0x26, 0x2B, 0x2C,
-    0x25, 0x26, 0x29, 0x2C,
-    0x25, 0x28, 0x2A, 0x2D,
-    0x25, 0x29, 0x2B, 0x2D,
-    0x25, 0x27, 0x2B, 0x2D,
-    0x25, 0x27, 0x29, 0x2D,
-    0x25, 0x2D, 0x2D, 0x2D,
-    0x25, 0x25, 0x2D, 0x2D,
-    0x25, 0x25, 0x25, 0x2D,
-    0x25, 0x29, 0x2C, 0x30,
-    0x25, 0x2A, 0x2E, 0x30,
-    0x25, 0x27, 0x2E, 0x30,
-    0x25, 0x27, 0x2B, 0x30,
-    0x25, 0x30, 0x30, 0x30,
-    0x25, 0x25, 0x30, 0x30,
-    0x25, 0x25, 0x25, 0x30,
-    0x25, 0x2A, 0x2E, 0x33,
-    0x25, 0x2C, 0x30, 0x33,
-    0x25, 0x28, 0x30, 0x33,
-    0x25, 0x28, 0x2C, 0x33,
-    0x25, 0x33, 0x33, 0x33,
-    0x25, 0x25, 0x33, 0x33,
-    0x25, 0x25, 0x25, 0x33,
-    0x25, 0x2B, 0x30, 0x36,
-    0x25, 0x2D, 0x32, 0x36,
-    0x25, 0x29, 0x32, 0x36,
-    0x25, 0x29, 0x2E, 0x36,
-    0x25, 0x36, 0x36, 0x36,
-    0x25, 0x25, 0x36, 0x36,
-    0x25, 0x25, 0x25, 0x36,
-    0x25, 0x2C, 0x32, 0x39,
-    0x25, 0x2F, 0x34, 0x39,
-    0x25, 0x2A, 0x34, 0x39,
-    0x25, 0x2A, 0x2F, 0x39,
-    0x25, 0x39, 0x39, 0x39,
-    0x25, 0x25, 0x39, 0x39,
-    0x25, 0x25, 0x25, 0x39,
-    0x25, 0x30, 0x37, 0x3C,
-    0x25, 0x2A, 0x37, 0x3C,
-    0x25, 0x2A, 0x31, 0x3C,
-    0x25, 0x3C, 0x3C, 0x3C,
-    0x25, 0x25, 0x3C, 0x3C,
-    0x25, 0x25, 0x25, 0x3C,
-    0x25, 0x32, 0x39, 0x3F,
-    0x25, 0x2B, 0x39, 0x3F,
-    0x25, 0x2B, 0x32, 0x3F,
-    0x25, 0x3F, 0x3F, 0x3F,
-    0x25, 0x25, 0x3F, 0x3F,
-    0x25, 0x25, 0x25, 0x3F,
-    0x26, 0x27, 0x27, 0x28,
-    0x26, 0x27, 0x28, 0x29,
-    0x26, 0x28, 0x29, 0x2A,
-    0x26, 0x27, 0x29, 0x2A,
-    0x26, 0x27, 0x28, 0x2A,
-    0x26, 0x28, 0x29, 0x2B,
-    0x26, 0x28, 0x2A, 0x2B,
-    0x26, 0x27, 0x2A, 0x2B,
-    0x26, 0x27, 0x29, 0x2B,
-    0x26, 0x28, 0x2A, 0x2C,
-    0x26, 0x29, 0x2B, 0x2C,
-    0x26, 0x27, 0x2B, 0x2C,
-    0x26, 0x27, 0x29, 0x2C,
-    0x26, 0x2C, 0x2C, 0x2C,
-    0x26, 0x26, 0x2C, 0x2C,
-    0x26, 0x26, 0x26, 0x2C,
-    0x26, 0x29, 0x2A, 0x2D,
-    0x26, 0x29, 0x2C, 0x2D,
-    0x26, 0x27, 0x2C, 0x2D,
-    0x26, 0x27, 0x2A, 0x2D,
-    0x26, 0x29, 0x2B, 0x2E,
-    0x26, 0x2A, 0x2C, 0x2E,
-    0x26, 0x28, 0x2C, 0x2E,
-    0x26, 0x28, 0x2A, 0x2E,
-    0x26, 0x2E, 0x2E, 0x2E,
-    0x26, 0x26, 0x2E, 0x2E,
-    0x26, 0x26, 0x26, 0x2E,
-    0x26, 0x2A, 0x2D, 0x31,
-    0x26, 0x2B, 0x2F, 0x31,
-    0x26, 0x28, 0x2F, 0x31,
-    0x26, 0x28, 0x2C, 0x31,
-    0x26, 0x31, 0x31, 0x31,
-    0x26, 0x26, 0x31, 0x31,
-    0x26, 0x26, 0x26, 0x31,
-    0x26, 0x2B, 0x2F, 0x34,
-    0x26, 0x2D, 0x31, 0x34,
-    0x26, 0x29, 0x31, 0x34,
-    0x26, 0x29, 0x2D, 0x34,
-    0x26, 0x34, 0x34, 0x34,
-    0x26, 0x26, 0x34, 0x34,
-    0x26, 0x26, 0x26, 0x34,
-    0x26, 0x2C, 0x31, 0x37,
-    0x26, 0x2E, 0x33, 0x37,
-    0x26, 0x2A, 0x33, 0x37,
-    0x26, 0x2A, 0x2F, 0x37,
-    0x26, 0x37, 0x37, 0x37,
-    0x26, 0x26, 0x37, 0x37,
-    0x26, 0x26, 0x26, 0x37,
-    0x26, 0x2D, 0x33, 0x3A,
-    0x26, 0x30, 0x35, 0x3A,
-    0x26, 0x2B, 0x35, 0x3A,
-    0x26, 0x2B, 0x30, 0x3A,
-    0x26, 0x3A, 0x3A, 0x3A,
-    0x26, 0x26, 0x3A, 0x3A,
-    0x26, 0x26, 0x26, 0x3A,
-    0x26, 0x31, 0x38, 0x3D,
-    0x26, 0x2B, 0x38, 0x3D,
-    0x26, 0x2B, 0x32, 0x3D,
-    0x26, 0x3D, 0x3D, 0x3D,
-    0x26, 0x26, 0x3D, 0x3D,
-    0x26, 0x26, 0x26, 0x3D,
-    0x27, 0x28, 0x28, 0x29,
-    0x27, 0x28, 0x29, 0x2A,
-    0x27, 0x29, 0x2A, 0x2B,
-    0x27, 0x28, 0x2A, 0x2B,
-    0x27, 0x28, 0x29, 0x2B,
-    0x27, 0x29, 0x2A, 0x2C,
-    0x27, 0x29, 0x2B, 0x2C,
-    0x27, 0x28, 0x2B, 0x2C,
-    0x27, 0x28, 0x2A, 0x2C,
-    0x27, 0x29, 0x2B, 0x2D,
-    0x27, 0x2A, 0x2C, 0x2D,
-    0x27, 0x28, 0x2C, 0x2D,
-    0x27, 0x28, 0x2A, 0x2D,
-    0x27, 0x2D, 0x2D, 0x2D,
-    0x27, 0x27, 0x2D, 0x2D,
-    0x27, 0x27, 0x27, 0x2D,
-    0x27, 0x2A, 0x2B, 0x2E,
-    0x27, 0x2A, 0x2D, 0x2E,
-    0x27, 0x28, 0x2D, 0x2E,
-    0x27, 0x28, 0x2B, 0x2E,
-    0x27, 0x2A, 0x2C, 0x2F,
-    0x27, 0x2B, 0x2D, 0x2F,
-    0x27, 0x29, 0x2D, 0x2F,
-    0x27, 0x29, 0x2B, 0x2F,
-    0x27, 0x2F, 0x2F, 0x2F,
-    0x27, 0x27, 0x2F, 0x2F,
-    0x27, 0x27, 0x27, 0x2F,
-    0x27, 0x2B, 0x2E, 0x32,
-    0x27, 0x2C, 0x30, 0x32,
-    0x27, 0x29, 0x30, 0x32,
-    0x27, 0x29, 0x2D, 0x32,
-    0x27, 0x32, 0x32, 0x32,
-    0x27, 0x27, 0x32, 0x32,
-    0x27, 0x27, 0x27, 0x32,
-    0x27, 0x2C, 0x30, 0x35,
-    0x27, 0x2E, 0x32, 0x35,
-    0x27, 0x2A, 0x32, 0x35,
-    0x27, 0x2A, 0x2E, 0x35,
-    0x27, 0x35, 0x35, 0x35,
-    0x27, 0x27, 0x35, 0x35,
-    0x27, 0x27, 0x27, 0x35,
-    0x27, 0x2D, 0x32, 0x38,
-    0x27, 0x2F, 0x34, 0x38,
-    0x27, 0x2B, 0x34, 0x38,
-    0x27, 0x2B, 0x30, 0x38,
-    0x27, 0x38, 0x38, 0x38,
-    0x27, 0x27, 0x38, 0x38,
-    0x27, 0x27, 0x27, 0x38,
-    0x27, 0x2E, 0x34, 0x3B,
-    0x27, 0x31, 0x36, 0x3B,
-    0x27, 0x2C, 0x36, 0x3B,
-    0x27, 0x2C, 0x31, 0x3B,
-    0x27, 0x3B, 0x3B, 0x3B,
-    0x27, 0x27, 0x3B, 0x3B,
-    0x27, 0x27, 0x27, 0x3B,
-    0x27, 0x32, 0x39, 0x3E,
-    0x27, 0x2C, 0x39, 0x3E,
-    0x27, 0x2C, 0x33, 0x3E,
-    0x27, 0x3E, 0x3E, 0x3E,
-    0x27, 0x27, 0x3E, 0x3E,
-    0x27, 0x27, 0x27, 0x3E,
-    0x28, 0x29, 0x29, 0x2A,
-    0x28, 0x29, 0x2A, 0x2B,
-    0x28, 0x2A, 0x2B, 0x2C,
-    0x28, 0x29, 0x2B, 0x2C,
-    0x28, 0x29, 0x2A, 0x2C,
-    0x28, 0x2A, 0x2B, 0x2D,
-    0x28, 0x2A, 0x2C, 0x2D,
-    0x28, 0x29, 0x2C, 0x2D,
-    0x28, 0x29, 0x2B, 0x2D,
-    0x28, 0x2A, 0x2C, 0x2E,
-    0x28, 0x2B, 0x2D, 0x2E,
-    0x28, 0x29, 0x2D, 0x2E,
-    0x28, 0x29, 0x2B, 0x2E,
-    0x28, 0x2E, 0x2E, 0x2E,
-    0x28, 0x28, 0x2E, 0x2E,
-    0x28, 0x28, 0x28, 0x2E,
-    0x28, 0x2B, 0x2C, 0x2F,
-    0x28, 0x2B, 0x2E, 0x2F,
-    0x28, 0x29, 0x2E, 0x2F,
-    0x28, 0x29, 0x2C, 0x2F,
-    0x28, 0x2B, 0x2D, 0x30,
-    0x28, 0x2C, 0x2E, 0x30,
-    0x28, 0x2A, 0x2E, 0x30,
-    0x28, 0x2A, 0x2C, 0x30,
-    0x28, 0x30, 0x30, 0x30,
-    0x28, 0x28, 0x30, 0x30,
-    0x28, 0x28, 0x28, 0x30,
-    0x28, 0x2C, 0x2F, 0x33,
-    0x28, 0x2D, 0x31, 0x33,
-    0x28, 0x2A, 0x31, 0x33,
-    0x28, 0x2A, 0x2E, 0x33,
-    0x28, 0x33, 0x33, 0x33,
-    0x28, 0x28, 0x33, 0x33,
-    0x28, 0x28, 0x28, 0x33,
-    0x28, 0x2D, 0x31, 0x36,
-    0x28, 0x2F, 0x33, 0x36,
-    0x28, 0x2B, 0x33, 0x36,
-    0x28, 0x2B, 0x2F, 0x36,
-    0x28, 0x36, 0x36, 0x36,
-    0x28, 0x28, 0x36, 0x36,
-    0x28, 0x28, 0x28, 0x36,
-    0x28, 0x2E, 0x33, 0x39,
-    0x28, 0x30, 0x35, 0x39,
-    0x28, 0x2C, 0x35, 0x39,
-    0x28, 0x2C, 0x31, 0x39,
-    0x28, 0x39, 0x39, 0x39,
-    0x28, 0x28, 0x39, 0x39,
-    0x28, 0x28, 0x28, 0x39,
-    0x28, 0x2F, 0x35, 0x3C,
-    0x28, 0x32, 0x37, 0x3C,
-    0x28, 0x2D, 0x37, 0x3C,
-    0x28, 0x2D, 0x32, 0x3C,
-    0x28, 0x3C, 0x3C, 0x3C,
-    0x28, 0x28, 0x3C, 0x3C,
-    0x28, 0x28, 0x28, 0x3C,
-    0x28, 0x33, 0x3A, 0x3F,
-    0x28, 0x2D, 0x3A, 0x3F,
-    0x28, 0x2D, 0x34, 0x3F,
-    0x28, 0x3F, 0x3F, 0x3F,
-    0x28, 0x28, 0x3F, 0x3F,
-    0x28, 0x28, 0x28, 0x3F,
-    0x29, 0x2A, 0x2A, 0x2B,
-    0x29, 0x2A, 0x2B, 0x2C,
-    0x29, 0x2B, 0x2C, 0x2D,
-    0x29, 0x2A, 0x2C, 0x2D,
-    0x29, 0x2A, 0x2B, 0x2D,
-    0x29, 0x2B, 0x2C, 0x2E,
-    0x29, 0x2B, 0x2D, 0x2E,
-    0x29, 0x2A, 0x2D, 0x2E,
-    0x29, 0x2A, 0x2C, 0x2E,
-    0x29, 0x2B, 0x2D, 0x2F,
-    0x29, 0x2C, 0x2E, 0x2F,
-    0x29, 0x2A, 0x2E, 0x2F,
-    0x29, 0x2A, 0x2C, 0x2F,
-    0x29, 0x2F, 0x2F, 0x2F,
-    0x29, 0x29, 0x2F, 0x2F,
-    0x29, 0x29, 0x29, 0x2F,
-    0x29, 0x2C, 0x2D, 0x30,
-    0x29, 0x2C, 0x2F, 0x30,
-    0x29, 0x2A, 0x2F, 0x30,
-    0x29, 0x2A, 0x2D, 0x30,
-    0x29, 0x2C, 0x2E, 0x31,
-    0x29, 0x2D, 0x2F, 0x31,
-    0x29, 0x2B, 0x2F, 0x31,
-    0x29, 0x2B, 0x2D, 0x31,
-    0x29, 0x31, 0x31, 0x31,
-    0x29, 0x29, 0x31, 0x31,
-    0x29, 0x29, 0x29, 0x31,
-    0x29, 0x2D, 0x30, 0x34,
-    0x29, 0x2E, 0x32, 0x34,
-    0x29, 0x2B, 0x32, 0x34,
-    0x29, 0x2B, 0x2F, 0x34,
-    0x29, 0x34, 0x34, 0x34,
-    0x29, 0x29, 0x34, 0x34,
-    0x29, 0x29, 0x29, 0x34,
-    0x29, 0x2E, 0x32, 0x37,
-    0x29, 0x30, 0x34, 0x37,
-    0x29, 0x2C, 0x34, 0x37,
-    0x29, 0x2C, 0x30, 0x37,
-    0x29, 0x37, 0x37, 0x37,
-    0x29, 0x29, 0x37, 0x37,
-    0x29, 0x29, 0x29, 0x37,
-    0x29, 0x2F, 0x34, 0x3A,
-    0x29, 0x31, 0x36, 0x3A,
-    0x29, 0x2D, 0x36, 0x3A,
-    0x29, 0x2D, 0x32, 0x3A,
-    0x29, 0x3A, 0x3A, 0x3A,
-    0x29, 0x29, 0x3A, 0x3A,
-    0x29, 0x29, 0x29, 0x3A,
-    0x29, 0x30, 0x36, 0x3D,
-    0x29, 0x33, 0x38, 0x3D,
-    0x29, 0x2E, 0x38, 0x3D,
-    0x29, 0x2E, 0x33, 0x3D,
-    0x29, 0x3D, 0x3D, 0x3D,
-    0x29, 0x29, 0x3D, 0x3D,
-    0x29, 0x29, 0x29, 0x3D,
-    0x2A, 0x2B, 0x2B, 0x2C,
-    0x2A, 0x2B, 0x2C, 0x2D,
-    0x2A, 0x2C, 0x2D, 0x2E,
-    0x2A, 0x2B, 0x2D, 0x2E,
-    0x2A, 0x2B, 0x2C, 0x2E,
-    0x2A, 0x2C, 0x2D, 0x2F,
-    0x2A, 0x2C, 0x2E, 0x2F,
-    0x2A, 0x2B, 0x2E, 0x2F,
-    0x2A, 0x2B, 0x2D, 0x2F,
-    0x2A, 0x2C, 0x2E, 0x30,
-    0x2A, 0x2D, 0x2F, 0x30,
-    0x2A, 0x2B, 0x2F, 0x30,
-    0x2A, 0x2B, 0x2D, 0x30,
-    0x2A, 0x30, 0x30, 0x30,
-    0x2A, 0x2A, 0x30, 0x30,
-    0x2A, 0x2A, 0x2A, 0x30,
-    0x2A, 0x2D, 0x2E, 0x31,
-    0x2A, 0x2D, 0x30, 0x31,
-    0x2A, 0x2B, 0x30, 0x31,
-    0x2A, 0x2B, 0x2E, 0x31,
-    0x2A, 0x2D, 0x2F, 0x32,
-    0x2A, 0x2E, 0x30, 0x32,
-    0x2A, 0x2C, 0x30, 0x32,
-    0x2A, 0x2C, 0x2E, 0x32,
-    0x2A, 0x32, 0x32, 0x32,
-    0x2A, 0x2A, 0x32, 0x32,
-    0x2A, 0x2A, 0x2A, 0x32,
-    0x2A, 0x2E, 0x31, 0x35,
-    0x2A, 0x2F, 0x33, 0x35,
-    0x2A, 0x2C, 0x33, 0x35,
-    0x2A, 0x2C, 0x30, 0x35,
-    0x2A, 0x35, 0x35, 0x35,
-    0x2A, 0x2A, 0x35, 0x35,
-    0x2A, 0x2A, 0x2A, 0x35,
-    0x2A, 0x2F, 0x33, 0x38,
-    0x2A, 0x31, 0x35, 0x38,
-    0x2A, 0x2D, 0x35, 0x38,
-    0x2A, 0x2D, 0x31, 0x38,
-    0x2A, 0x38, 0x38, 0x38,
-    0x2A, 0x2A, 0x38, 0x38,
-    0x2A, 0x2A, 0x2A, 0x38,
-    0x2A, 0x30, 0x35, 0x3B,
-    0x2A, 0x32, 0x37, 0x3B,
-    0x2A, 0x2E, 0x37, 0x3B,
-    0x2A, 0x2E, 0x33, 0x3B,
-    0x2A, 0x3B, 0x3B, 0x3B,
-    0x2A, 0x2A, 0x3B, 0x3B,
-    0x2A, 0x2A, 0x2A, 0x3B,
-    0x2A, 0x31, 0x37, 0x3E,
-    0x2A, 0x34, 0x39, 0x3E,
-    0x2A, 0x2F, 0x39, 0x3E,
-    0x2A, 0x2F, 0x34, 0x3E,
-    0x2A, 0x3E, 0x3E, 0x3E,
-    0x2A, 0x2A, 0x3E, 0x3E,
-    0x2A, 0x2A, 0x2A, 0x3E,
-    0x2B, 0x2C, 0x2C, 0x2D,
-    0x2B, 0x2C, 0x2D, 0x2E,
-    0x2B, 0x2D, 0x2E, 0x2F,
-    0x2B, 0x2C, 0x2E, 0x2F,
-    0x2B, 0x2C, 0x2D, 0x2F,
-    0x2B, 0x2D, 0x2E, 0x30,
-    0x2B, 0x2D, 0x2F, 0x30,
-    0x2B, 0x2C, 0x2F, 0x30,
-    0x2B, 0x2C, 0x2E, 0x30,
-    0x2B, 0x2D, 0x2F, 0x31,
-    0x2B, 0x2E, 0x30, 0x31,
-    0x2B, 0x2C, 0x30, 0x31,
-    0x2B, 0x2C, 0x2E, 0x31,
-    0x2B, 0x31, 0x31, 0x31,
-    0x2B, 0x2B, 0x31, 0x31,
-    0x2B, 0x2B, 0x2B, 0x31,
-    0x2B, 0x2E, 0x2F, 0x32,
-    0x2B, 0x2E, 0x31, 0x32,
-    0x2B, 0x2C, 0x31, 0x32,
-    0x2B, 0x2C, 0x2F, 0x32,
-    0x2B, 0x2E, 0x30, 0x33,
-    0x2B, 0x2F, 0x31, 0x33,
-    0x2B, 0x2D, 0x31, 0x33,
-    0x2B, 0x2D, 0x2F, 0x33,
-    0x2B, 0x33, 0x33, 0x33,
-    0x2B, 0x2B, 0x33, 0x33,
-    0x2B, 0x2B, 0x2B, 0x33,
-    0x2B, 0x2F, 0x32, 0x36,
-    0x2B, 0x30, 0x34, 0x36,
-    0x2B, 0x2D, 0x34, 0x36,
-    0x2B, 0x2D, 0x31, 0x36,
-    0x2B, 0x36, 0x36, 0x36,
-    0x2B, 0x2B, 0x36, 0x36,
-    0x2B, 0x2B, 0x2B, 0x36,
-    0x2B, 0x30, 0x34, 0x39,
-    0x2B, 0x32, 0x36, 0x39,
-    0x2B, 0x2E, 0x36, 0x39,
-    0x2B, 0x2E, 0x32, 0x39,
-    0x2B, 0x39, 0x39, 0x39,
-    0x2B, 0x2B, 0x39, 0x39,
-    0x2B, 0x2B, 0x2B, 0x39,
-    0x2B, 0x31, 0x36, 0x3C,
-    0x2B, 0x33, 0x38, 0x3C,
-    0x2B, 0x2F, 0x38, 0x3C,
-    0x2B, 0x2F, 0x34, 0x3C,
-    0x2B, 0x3C, 0x3C, 0x3C,
-    0x2B, 0x2B, 0x3C, 0x3C,
-    0x2B, 0x2B, 0x2B, 0x3C,
-    0x2B, 0x32, 0x38, 0x3F,
-    0x2B, 0x35, 0x3A, 0x3F,
-    0x2B, 0x30, 0x3A, 0x3F,
-    0x2B, 0x30, 0x35, 0x3F,
-    0x2B, 0x3F, 0x3F, 0x3F,
-    0x2B, 0x2B, 0x3F, 0x3F,
-    0x2B, 0x2B, 0x2B, 0x3F,
-    0x2C, 0x2D, 0x2D, 0x2E,
-    0x2C, 0x2D, 0x2E, 0x2F,
-    0x2C, 0x2E, 0x2F, 0x30,
-    0x2C, 0x2D, 0x2F, 0x30,
-    0x2C, 0x2D, 0x2E, 0x30,
-    0x2C, 0x2E, 0x2F, 0x31,
-    0x2C, 0x2E, 0x30, 0x31,
-    0x2C, 0x2D, 0x30, 0x31,
-    0x2C, 0x2D, 0x2F, 0x31,
-    0x2C, 0x2E, 0x30, 0x32,
-    0x2C, 0x2F, 0x31, 0x32,
-    0x2C, 0x2D, 0x31, 0x32,
-    0x2C, 0x2D, 0x2F, 0x32,
-    0x2C, 0x32, 0x32, 0x32,
-    0x2C, 0x2C, 0x32, 0x32,
-    0x2C, 0x2C, 0x2C, 0x32,
-    0x2C, 0x2F, 0x30, 0x33,
-    0x2C, 0x2F, 0x32, 0x33,
-    0x2C, 0x2D, 0x32, 0x33,
-    0x2C, 0x2D, 0x30, 0x33,
-    0x2C, 0x2F, 0x31, 0x34,
-    0x2C, 0x30, 0x32, 0x34,
-    0x2C, 0x2E, 0x32, 0x34,
-    0x2C, 0x2E, 0x30, 0x34,
-    0x2C, 0x34, 0x34, 0x34,
-    0x2C, 0x2C, 0x34, 0x34,
-    0x2C, 0x2C, 0x2C, 0x34,
-    0x2C, 0x30, 0x33, 0x37,
-    0x2C, 0x31, 0x35, 0x37,
-    0x2C, 0x2E, 0x35, 0x37,
-    0x2C, 0x2E, 0x32, 0x37,
-    0x2C, 0x37, 0x37, 0x37,
-    0x2C, 0x2C, 0x37, 0x37,
-    0x2C, 0x2C, 0x2C, 0x37,
-    0x2C, 0x31, 0x35, 0x3A,
-    0x2C, 0x33, 0x37, 0x3A,
-    0x2C, 0x2F, 0x37, 0x3A,
-    0x2C, 0x2F, 0x33, 0x3A,
-    0x2C, 0x3A, 0x3A, 0x3A,
-    0x2C, 0x2C, 0x3A, 0x3A,
-    0x2C, 0x2C, 0x2C, 0x3A,
-    0x2C, 0x32, 0x37, 0x3D,
-    0x2C, 0x34, 0x39, 0x3D,
-    0x2C, 0x30, 0x39, 0x3D,
-    0x2C, 0x30, 0x35, 0x3D,
-    0x2C, 0x3D, 0x3D, 0x3D,
-    0x2C, 0x2C, 0x3D, 0x3D,
-    0x2C, 0x2C, 0x2C, 0x3D,
-    0x2D, 0x2E, 0x2E, 0x2F,
-    0x2D, 0x2E, 0x2F, 0x30,
-    0x2D, 0x2F, 0x30, 0x31,
-    0x2D, 0x2E, 0x30, 0x31,
-    0x2D, 0x2E, 0x2F, 0x31,
-    0x2D, 0x2F, 0x30, 0x32,
-    0x2D, 0x2F, 0x31, 0x32,
-    0x2D, 0x2E, 0x31, 0x32,
-    0x2D, 0x2E, 0x30, 0x32,
-    0x2D, 0x2F, 0x31, 0x33,
-    0x2D, 0x30, 0x32, 0x33,
-    0x2D, 0x2E, 0x32, 0x33,
-    0x2D, 0x2E, 0x30, 0x33,
-    0x2D, 0x33, 0x33, 0x33,
-    0x2D, 0x2D, 0x33, 0x33,
-    0x2D, 0x2D, 0x2D, 0x33,
-    0x2D, 0x30, 0x31, 0x34,
-    0x2D, 0x30, 0x33, 0x34,
-    0x2D, 0x2E, 0x33, 0x34,
-    0x2D, 0x2E, 0x31, 0x34,
-    0x2D, 0x30, 0x32, 0x35,
-    0x2D, 0x31, 0x33, 0x35,
-    0x2D, 0x2F, 0x33, 0x35,
-    0x2D, 0x2F, 0x31, 0x35,
-    0x2D, 0x35, 0x35, 0x35,
-    0x2D, 0x2D, 0x35, 0x35,
-    0x2D, 0x2D, 0x2D, 0x35,
-    0x2D, 0x31, 0x34, 0x38,
-    0x2D, 0x32, 0x36, 0x38,
-    0x2D, 0x2F, 0x36, 0x38,
-    0x2D, 0x2F, 0x33, 0x38,
-    0x2D, 0x38, 0x38, 0x38,
-    0x2D, 0x2D, 0x38, 0x38,
-    0x2D, 0x2D, 0x2D, 0x38,
-    0x2D, 0x32, 0x36, 0x3B,
-    0x2D, 0x34, 0x38, 0x3B,
-    0x2D, 0x30, 0x38, 0x3B,
-    0x2D, 0x30, 0x34, 0x3B,
-    0x2D, 0x3B, 0x3B, 0x3B,
-    0x2D, 0x2D, 0x3B, 0x3B,
-    0x2D, 0x2D, 0x2D, 0x3B,
-    0x2D, 0x33, 0x38, 0x3E,
-    0x2D, 0x35, 0x3A, 0x3E,
-    0x2D, 0x31, 0x3A, 0x3E,
-    0x2D, 0x31, 0x36, 0x3E,
-    0x2D, 0x3E, 0x3E, 0x3E,
-    0x2D, 0x2D, 0x3E, 0x3E,
-    0x2D, 0x2D, 0x2D, 0x3E,
-    0x2E, 0x2F, 0x2F, 0x30,
-    0x2E, 0x2F, 0x30, 0x31,
-    0x2E, 0x30, 0x31, 0x32,
-    0x2E, 0x2F, 0x31, 0x32,
-    0x2E, 0x2F, 0x30, 0x32,
-    0x2E, 0x30, 0x31, 0x33,
-    0x2E, 0x30, 0x32, 0x33,
-    0x2E, 0x2F, 0x32, 0x33,
-    0x2E, 0x2F, 0x31, 0x33,
-    0x2E, 0x30, 0x32, 0x34,
-    0x2E, 0x31, 0x33, 0x34,
-    0x2E, 0x2F, 0x33, 0x34,
-    0x2E, 0x2F, 0x31, 0x34,
-    0x2E, 0x34, 0x34, 0x34,
-    0x2E, 0x2E, 0x34, 0x34,
-    0x2E, 0x2E, 0x2E, 0x34,
-    0x2E, 0x31, 0x32, 0x35,
-    0x2E, 0x31, 0x34, 0x35,
-    0x2E, 0x2F, 0x34, 0x35,
-    0x2E, 0x2F, 0x32, 0x35,
-    0x2E, 0x31, 0x33, 0x36,
-    0x2E, 0x32, 0x34, 0x36,
-    0x2E, 0x30, 0x34, 0x36,
-    0x2E, 0x30, 0x32, 0x36,
-    0x2E, 0x36, 0x36, 0x36,
-    0x2E, 0x2E, 0x36, 0x36,
-    0x2E, 0x2E, 0x2E, 0x36,
-    0x2E, 0x32, 0x35, 0x39,
-    0x2E, 0x33, 0x37, 0x39,
-    0x2E, 0x30, 0x37, 0x39,
-    0x2E, 0x30, 0x34, 0x39,
-    0x2E, 0x39, 0x39, 0x39,
-    0x2E, 0x2E, 0x39, 0x39,
-    0x2E, 0x2E, 0x2E, 0x39,
-    0x2E, 0x33, 0x37, 0x3C,
-    0x2E, 0x35, 0x39, 0x3C,
-    0x2E, 0x31, 0x39, 0x3C,
-    0x2E, 0x31, 0x35, 0x3C,
-    0x2E, 0x3C, 0x3C, 0x3C,
-    0x2E, 0x2E, 0x3C, 0x3C,
-    0x2E, 0x2E, 0x2E, 0x3C,
-    0x2E, 0x34, 0x39, 0x3F,
-    0x2E, 0x36, 0x3B, 0x3F,
-    0x2E, 0x32, 0x3B, 0x3F,
-    0x2E, 0x32, 0x37, 0x3F,
-    0x2E, 0x3F, 0x3F, 0x3F,
-    0x2E, 0x2E, 0x3F, 0x3F,
-    0x2E, 0x2E, 0x2E, 0x3F,
-    0x2F, 0x30, 0x30, 0x31,
-    0x2F, 0x30, 0x31, 0x32,
-    0x2F, 0x31, 0x32, 0x33,
-    0x2F, 0x30, 0x32, 0x33,
-    0x2F, 0x30, 0x31, 0x33,
-    0x2F, 0x31, 0x32, 0x34,
-    0x2F, 0x31, 0x33, 0x34,
-    0x2F, 0x30, 0x33, 0x34,
-    0x2F, 0x30, 0x32, 0x34,
-    0x2F, 0x31, 0x33, 0x35,
-    0x2F, 0x32, 0x34, 0x35,
-    0x2F, 0x30, 0x34, 0x35,
-    0x2F, 0x30, 0x32, 0x35,
-    0x2F, 0x35, 0x35, 0x35,
-    0x2F, 0x2F, 0x35, 0x35,
-    0x2F, 0x2F, 0x2F, 0x35,
-    0x2F, 0x32, 0x33, 0x36,
-    0x2F, 0x32, 0x35, 0x36,
-    0x2F, 0x30, 0x35, 0x36,
-    0x2F, 0x30, 0x33, 0x36,
-    0x2F, 0x32, 0x34, 0x37,
-    0x2F, 0x33, 0x35, 0x37,
-    0x2F, 0x31, 0x35, 0x37,
-    0x2F, 0x31, 0x33, 0x37,
-    0x2F, 0x37, 0x37, 0x37,
-    0x2F, 0x2F, 0x37, 0x37,
-    0x2F, 0x2F, 0x2F, 0x37,
-    0x2F, 0x33, 0x36, 0x3A,
-    0x2F, 0x34, 0x38, 0x3A,
-    0x2F, 0x31, 0x38, 0x3A,
-    0x2F, 0x31, 0x35, 0x3A,
-    0x2F, 0x3A, 0x3A, 0x3A,
-    0x2F, 0x2F, 0x3A, 0x3A,
-    0x2F, 0x2F, 0x2F, 0x3A,
-    0x2F, 0x34, 0x38, 0x3D,
-    0x2F, 0x36, 0x3A, 0x3D,
-    0x2F, 0x32, 0x3A, 0x3D,
-    0x2F, 0x32, 0x36, 0x3D,
-    0x2F, 0x3D, 0x3D, 0x3D,
-    0x2F, 0x2F, 0x3D, 0x3D,
-    0x2F, 0x2F, 0x2F, 0x3D,
-    0x30, 0x31, 0x31, 0x32,
-    0x30, 0x31, 0x32, 0x33,
-    0x30, 0x32, 0x33, 0x34,
-    0x30, 0x31, 0x33, 0x34,
-    0x30, 0x31, 0x32, 0x34,
-    0x30, 0x32, 0x33, 0x35,
-    0x30, 0x32, 0x34, 0x35,
-    0x30, 0x31, 0x34, 0x35,
-    0x30, 0x31, 0x33, 0x35,
-    0x30, 0x32, 0x34, 0x36,
-    0x30, 0x33, 0x35, 0x36,
-    0x30, 0x31, 0x35, 0x36,
-    0x30, 0x31, 0x33, 0x36,
-    0x30, 0x36, 0x36, 0x36,
-    0x30, 0x30, 0x36, 0x36,
-    0x30, 0x30, 0x30, 0x36,
-    0x30, 0x33, 0x34, 0x37,
-    0x30, 0x33, 0x36, 0x37,
-    0x30, 0x31, 0x36, 0x37,
-    0x30, 0x31, 0x34, 0x37,
-    0x30, 0x33, 0x35, 0x38,
-    0x30, 0x34, 0x36, 0x38,
-    0x30, 0x32, 0x36, 0x38,
-    0x30, 0x32, 0x34, 0x38,
-    0x30, 0x38, 0x38, 0x38,
-    0x30, 0x30, 0x38, 0x38,
-    0x30, 0x30, 0x30, 0x38,
-    0x30, 0x34, 0x37, 0x3B,
-    0x30, 0x35, 0x39, 0x3B,
-    0x30, 0x32, 0x39, 0x3B,
-    0x30, 0x32, 0x36, 0x3B,
-    0x30, 0x3B, 0x3B, 0x3B,
-    0x30, 0x30, 0x3B, 0x3B,
-    0x30, 0x30, 0x30, 0x3B,
-    0x30, 0x35, 0x39, 0x3E,
-    0x30, 0x37, 0x3B, 0x3E,
-    0x30, 0x33, 0x3B, 0x3E,
-    0x30, 0x33, 0x37, 0x3E,
-    0x30, 0x3E, 0x3E, 0x3E,
-    0x30, 0x30, 0x3E, 0x3E,
-    0x30, 0x30, 0x30, 0x3E,
-    0x31, 0x32, 0x32, 0x33,
-    0x31, 0x32, 0x33, 0x34,
-    0x31, 0x33, 0x34, 0x35,
-    0x31, 0x32, 0x34, 0x35,
-    0x31, 0x32, 0x33, 0x35,
-    0x31, 0x33, 0x34, 0x36,
-    0x31, 0x33, 0x35, 0x36,
-    0x31, 0x32, 0x35, 0x36,
-    0x31, 0x32, 0x34, 0x36,
-    0x31, 0x33, 0x35, 0x37,
-    0x31, 0x34, 0x36, 0x37,
-    0x31, 0x32, 0x36, 0x37,
-    0x31, 0x32, 0x34, 0x37,
-    0x31, 0x37, 0x37, 0x37,
-    0x31, 0x31, 0x37, 0x37,
-    0x31, 0x31, 0x31, 0x37,
-    0x31, 0x34, 0x35, 0x38,
-    0x31, 0x34, 0x37, 0x38,
-    0x31, 0x32, 0x37, 0x38,
-    0x31, 0x32, 0x35, 0x38,
-    0x31, 0x34, 0x36, 0x39,
-    0x31, 0x35, 0x37, 0x39,
-    0x31, 0x33, 0x37, 0x39,
-    0x31, 0x33, 0x35, 0x39,
-    0x31, 0x39, 0x39, 0x39,
-    0x31, 0x31, 0x39, 0x39,
-    0x31, 0x31, 0x31, 0x39,
-    0x31, 0x35, 0x38, 0x3C,
-    0x31, 0x36, 0x3A, 0x3C,
-    0x31, 0x33, 0x3A, 0x3C,
-    0x31, 0x33, 0x37, 0x3C,
-    0x31, 0x3C, 0x3C, 0x3C,
-    0x31, 0x31, 0x3C, 0x3C,
-    0x31, 0x31, 0x31, 0x3C,
-    0x31, 0x36, 0x3A, 0x3F,
-    0x31, 0x38, 0x3C, 0x3F,
-    0x31, 0x34, 0x3C, 0x3F,
-    0x31, 0x34, 0x38, 0x3F,
-    0x31, 0x3F, 0x3F, 0x3F,
-    0x31, 0x31, 0x3F, 0x3F,
-    0x31, 0x31, 0x31, 0x3F,
-    0x32, 0x33, 0x33, 0x34,
-    0x32, 0x33, 0x34, 0x35,
-    0x32, 0x34, 0x35, 0x36,
-    0x32, 0x33, 0x35, 0x36,
-    0x32, 0x33, 0x34, 0x36,
-    0x32, 0x34, 0x35, 0x37,
-    0x32, 0x34, 0x36, 0x37,
-    0x32, 0x33, 0x36, 0x37,
-    0x32, 0x33, 0x35, 0x37,
-    0x32, 0x34, 0x36, 0x38,
-    0x32, 0x35, 0x37, 0x38,
-    0x32, 0x33, 0x37, 0x38,
-    0x32, 0x33, 0x35, 0x38,
-    0x32, 0x38, 0x38, 0x38,
-    0x32, 0x32, 0x38, 0x38,
-    0x32, 0x32, 0x32, 0x38,
-    0x32, 0x35, 0x36, 0x39,
-    0x32, 0x35, 0x38, 0x39,
-    0x32, 0x33, 0x38, 0x39,
-    0x32, 0x33, 0x36, 0x39,
-    0x32, 0x35, 0x37, 0x3A,
-    0x32, 0x36, 0x38, 0x3A,
-    0x32, 0x34, 0x38, 0x3A,
-    0x32, 0x34, 0x36, 0x3A,
-    0x32, 0x3A, 0x3A, 0x3A,
-    0x32, 0x32, 0x3A, 0x3A,
-    0x32, 0x32, 0x32, 0x3A,
-    0x32, 0x36, 0x39, 0x3D,
-    0x32, 0x37, 0x3B, 0x3D,
-    0x32, 0x34, 0x3B, 0x3D,
-    0x32, 0x34, 0x38, 0x3D,
-    0x32, 0x3D, 0x3D, 0x3D,
-    0x32, 0x32, 0x3D, 0x3D,
-    0x32, 0x32, 0x32, 0x3D,
-    0x33, 0x34, 0x34, 0x35,
-    0x33, 0x34, 0x35, 0x36,
-    0x33, 0x35, 0x36, 0x37,
-    0x33, 0x34, 0x36, 0x37,
-    0x33, 0x34, 0x35, 0x37,
-    0x33, 0x35, 0x36, 0x38,
-    0x33, 0x35, 0x37, 0x38,
-    0x33, 0x34, 0x37, 0x38,
-    0x33, 0x34, 0x36, 0x38,
-    0x33, 0x35, 0x37, 0x39,
-    0x33, 0x36, 0x38, 0x39,
-    0x33, 0x34, 0x38, 0x39,
-    0x33, 0x34, 0x36, 0x39,
-    0x33, 0x39, 0x39, 0x39,
-    0x33, 0x33, 0x39, 0x39,
-    0x33, 0x33, 0x33, 0x39,
-    0x33, 0x36, 0x37, 0x3A,
-    0x33, 0x36, 0x39, 0x3A,
-    0x33, 0x34, 0x39, 0x3A,
-    0x33, 0x34, 0x37, 0x3A,
-    0x33, 0x36, 0x38, 0x3B,
-    0x33, 0x37, 0x39, 0x3B,
-    0x33, 0x35, 0x39, 0x3B,
-    0x33, 0x35, 0x37, 0x3B,
-    0x33, 0x3B, 0x3B, 0x3B,
-    0x33, 0x33, 0x3B, 0x3B,
-    0x33, 0x33, 0x33, 0x3B,
-    0x33, 0x37, 0x3A, 0x3E,
-    0x33, 0x38, 0x3C, 0x3E,
-    0x33, 0x35, 0x3C, 0x3E,
-    0x33, 0x35, 0x39, 0x3E,
-    0x33, 0x3E, 0x3E, 0x3E,
-    0x33, 0x33, 0x3E, 0x3E,
-    0x33, 0x33, 0x33, 0x3E,
-    0x34, 0x35, 0x35, 0x36,
-    0x34, 0x35, 0x36, 0x37,
-    0x34, 0x36, 0x37, 0x38,
-    0x34, 0x35, 0x37, 0x38,
-    0x34, 0x35, 0x36, 0x38,
-    0x34, 0x36, 0x37, 0x39,
-    0x34, 0x36, 0x38, 0x39,
-    0x34, 0x35, 0x38, 0x39,
-    0x34, 0x35, 0x37, 0x39,
-    0x34, 0x36, 0x38, 0x3A,
-    0x34, 0x37, 0x39, 0x3A,
-    0x34, 0x35, 0x39, 0x3A,
-    0x34, 0x35, 0x37, 0x3A,
-    0x34, 0x3A, 0x3A, 0x3A,
-    0x34, 0x34, 0x3A, 0x3A,
-    0x34, 0x34, 0x34, 0x3A,
-    0x34, 0x37, 0x38, 0x3B,
-    0x34, 0x37, 0x3A, 0x3B,
-    0x34, 0x35, 0x3A, 0x3B,
-    0x34, 0x35, 0x38, 0x3B,
-    0x34, 0x37, 0x39, 0x3C,
-    0x34, 0x38, 0x3A, 0x3C,
-    0x34, 0x36, 0x3A, 0x3C,
-    0x34, 0x36, 0x38, 0x3C,
-    0x34, 0x3C, 0x3C, 0x3C,
-    0x34, 0x34, 0x3C, 0x3C,
-    0x34, 0x34, 0x34, 0x3C,
-    0x34, 0x38, 0x3B, 0x3F,
-    0x34, 0x39, 0x3D, 0x3F,
-    0x34, 0x36, 0x3D, 0x3F,
-    0x34, 0x36, 0x3A, 0x3F,
-    0x34, 0x3F, 0x3F, 0x3F,
-    0x34, 0x34, 0x3F, 0x3F,
-    0x34, 0x34, 0x34, 0x3F,
-    0x35, 0x36, 0x36, 0x37,
-    0x35, 0x36, 0x37, 0x38,
-    0x35, 0x37, 0x38, 0x39,
-    0x35, 0x36, 0x38, 0x39,
-    0x35, 0x36, 0x37, 0x39,
-    0x35, 0x37, 0x38, 0x3A,
-    0x35, 0x37, 0x39, 0x3A,
-    0x35, 0x36, 0x39, 0x3A,
-    0x35, 0x36, 0x38, 0x3A,
-    0x35, 0x37, 0x39, 0x3B,
-    0x35, 0x38, 0x3A, 0x3B,
-    0x35, 0x36, 0x3A, 0x3B,
-    0x35, 0x36, 0x38, 0x3B,
-    0x35, 0x3B, 0x3B, 0x3B,
-    0x35, 0x35, 0x3B, 0x3B,
-    0x35, 0x35, 0x35, 0x3B,
-    0x35, 0x38, 0x39, 0x3C,
-    0x35, 0x38, 0x3B, 0x3C,
-    0x35, 0x36, 0x3B, 0x3C,
-    0x35, 0x36, 0x39, 0x3C,
-    0x35, 0x38, 0x3A, 0x3D,
-    0x35, 0x39, 0x3B, 0x3D,
-    0x35, 0x37, 0x3B, 0x3D,
-    0x35, 0x37, 0x39, 0x3D,
-    0x35, 0x3D, 0x3D, 0x3D,
-    0x35, 0x35, 0x3D, 0x3D,
-    0x35, 0x35, 0x35, 0x3D,
-    0x36, 0x37, 0x37, 0x38,
-    0x36, 0x37, 0x38, 0x39,
-    0x36, 0x38, 0x39, 0x3A,
-    0x36, 0x37, 0x39, 0x3A,
-    0x36, 0x37, 0x38, 0x3A,
-    0x36, 0x38, 0x39, 0x3B,
-    0x36, 0x38, 0x3A, 0x3B,
-    0x36, 0x37, 0x3A, 0x3B,
-    0x36, 0x37, 0x39, 0x3B,
-    0x36, 0x38, 0x3A, 0x3C,
-    0x36, 0x39, 0x3B, 0x3C,
-    0x36, 0x37, 0x3B, 0x3C,
-    0x36, 0x37, 0x39, 0x3C,
-    0x36, 0x3C, 0x3C, 0x3C,
-    0x36, 0x36, 0x3C, 0x3C,
-    0x36, 0x36, 0x36, 0x3C,
-    0x36, 0x39, 0x3A, 0x3D,
-    0x36, 0x39, 0x3C, 0x3D,
-    0x36, 0x37, 0x3C, 0x3D,
-    0x36, 0x37, 0x3A, 0x3D,
-    0x36, 0x39, 0x3B, 0x3E,
-    0x36, 0x3A, 0x3C, 0x3E,
-    0x36, 0x38, 0x3C, 0x3E,
-    0x36, 0x38, 0x3A, 0x3E,
-    0x36, 0x3E, 0x3E, 0x3E,
-    0x36, 0x36, 0x3E, 0x3E,
-    0x36, 0x36, 0x36, 0x3E,
-    0x37, 0x38, 0x38, 0x39,
-    0x37, 0x38, 0x39, 0x3A,
-    0x37, 0x39, 0x3A, 0x3B,
-    0x37, 0x38, 0x3A, 0x3B,
-    0x37, 0x38, 0x39, 0x3B,
-    0x37, 0x39, 0x3A, 0x3C,
-    0x37, 0x39, 0x3B, 0x3C,
-    0x37, 0x38, 0x3B, 0x3C,
-    0x37, 0x38, 0x3A, 0x3C,
-    0x37, 0x39, 0x3B, 0x3D,
-    0x37, 0x3A, 0x3C, 0x3D,
-    0x37, 0x38, 0x3C, 0x3D,
-    0x37, 0x38, 0x3A, 0x3D,
-    0x37, 0x3D, 0x3D, 0x3D,
-    0x37, 0x37, 0x3D, 0x3D,
-    0x37, 0x37, 0x37, 0x3D,
-    0x37, 0x3A, 0x3B, 0x3E,
-    0x37, 0x3A, 0x3D, 0x3E,
-    0x37, 0x38, 0x3D, 0x3E,
-    0x37, 0x38, 0x3B, 0x3E,
-    0x37, 0x3A, 0x3C, 0x3F,
-    0x37, 0x3B, 0x3D, 0x3F,
-    0x37, 0x39, 0x3D, 0x3F,
-    0x37, 0x39, 0x3B, 0x3F,
-    0x37, 0x3F, 0x3F, 0x3F,
-    0x37, 0x37, 0x3F, 0x3F,
-    0x37, 0x37, 0x37, 0x3F,
-    0x38, 0x39, 0x39, 0x3A,
-    0x38, 0x39, 0x3A, 0x3B,
-    0x38, 0x3A, 0x3B, 0x3C,
-    0x38, 0x39, 0x3B, 0x3C,
-    0x38, 0x39, 0x3A, 0x3C,
-    0x38, 0x3A, 0x3B, 0x3D,
-    0x38, 0x3A, 0x3C, 0x3D,
-    0x38, 0x39, 0x3C, 0x3D,
-    0x38, 0x39, 0x3B, 0x3D,
-    0x38, 0x3A, 0x3C, 0x3E,
-    0x38, 0x3B, 0x3D, 0x3E,
-    0x38, 0x39, 0x3D, 0x3E,
-    0x38, 0x39, 0x3B, 0x3E,
-    0x38, 0x3E, 0x3E, 0x3E,
-    0x38, 0x38, 0x3E, 0x3E,
-    0x38, 0x38, 0x38, 0x3E,
-    0x38, 0x3B, 0x3C, 0x3F,
-    0x38, 0x3B, 0x3E, 0x3F,
-    0x38, 0x39, 0x3E, 0x3F,
-    0x38, 0x39, 0x3C, 0x3F,
-    0x39, 0x3A, 0x3A, 0x3B,
-    0x39, 0x3A, 0x3B, 0x3C,
-    0x39, 0x3B, 0x3C, 0x3D,
-    0x39, 0x3A, 0x3C, 0x3D,
-    0x39, 0x3A, 0x3B, 0x3D,
-    0x39, 0x3B, 0x3C, 0x3E,
-    0x39, 0x3B, 0x3D, 0x3E,
-    0x39, 0x3A, 0x3D, 0x3E,
-    0x39, 0x3A, 0x3C, 0x3E,
-    0x39, 0x3B, 0x3D, 0x3F,
-    0x39, 0x3C, 0x3E, 0x3F,
-    0x39, 0x3A, 0x3E, 0x3F,
-    0x39, 0x3A, 0x3C, 0x3F,
-    0x39, 0x3F, 0x3F, 0x3F,
-    0x39, 0x39, 0x3F, 0x3F,
-    0x39, 0x39, 0x39, 0x3F,
-    0x3A, 0x3B, 0x3B, 0x3C,
-    0x3A, 0x3B, 0x3C, 0x3D,
-    0x3A, 0x3C, 0x3D, 0x3E,
-    0x3A, 0x3B, 0x3D, 0x3E,
-    0x3A, 0x3B, 0x3C, 0x3E,
-    0x3A, 0x3C, 0x3D, 0x3F,
-    0x3A, 0x3C, 0x3E, 0x3F,
-    0x3A, 0x3B, 0x3E, 0x3F,
-    0x3A, 0x3B, 0x3D, 0x3F,
-    0x3B, 0x3C, 0x3C, 0x3D,
-    0x3B, 0x3C, 0x3D, 0x3E,
-    0x3B, 0x3D, 0x3E, 0x3F,
-    0x3B, 0x3C, 0x3E, 0x3F,
-    0x3B, 0x3C, 0x3D, 0x3F,
-    0x3C, 0x3D, 0x3D, 0x3E,
-    0x3C, 0x3D, 0x3E, 0x3F,
-    0x3D, 0x3E, 0x3E, 0x3F
-};
--- a/src/ffmpeg/libavcodec/vc1dsp.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,453 +0,0 @@
-/*
- * VC-1 and WMV3 decoder - DSP functions
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-/**
-* @file vc1dsp.c
- * VC-1 and WMV3 decoder
- *
- */
-
-#include "dsputil.h"
-
-
-/** Apply overlap transform to vertical edge
-*/
-static void vc1_v_overlap_c(uint8_t* src, int stride, int rnd)
-{
-    int i;
-    int a, b, c, d;
-    for(i = 0; i < 8; i++) {
-        a = src[-2*stride];
-        b = src[-stride];
-        c = src[0];
-        d = src[stride];
-
-        src[-2*stride] = clip_uint8((7*a + d + 4 - rnd) >> 3);
-        src[-stride] = clip_uint8((-a + 7*b + c + d + 3 + rnd) >> 3);
-        src[0] = clip_uint8((a + b + 7*c - d + 4 - rnd) >> 3);
-        src[stride] = clip_uint8((a + 7*d + 3 + rnd) >> 3);
-        src++;
-    }
-}
-
-/** Apply overlap transform to horizontal edge
-*/
-static void vc1_h_overlap_c(uint8_t* src, int stride, int rnd)
-{
-    int i;
-    int a, b, c, d;
-    for(i = 0; i < 8; i++) {
-        a = src[-2];
-        b = src[-1];
-        c = src[0];
-        d = src[1];
-
-        src[-2] = clip_uint8((7*a + d + 4 - rnd) >> 3);
-        src[-1] = clip_uint8((-a + 7*b + c + d + 3 + rnd) >> 3);
-        src[0] = clip_uint8((a + b + 7*c - d + 4 - rnd) >> 3);
-        src[1] = clip_uint8((a + 7*d + 3 + rnd) >> 3);
-        src += stride;
-    }
-}
-
-
-/** Do inverse transform on 8x8 block
-*/
-static void vc1_inv_trans_8x8_c(DCTELEM block[64])
-{
-    int i;
-    register int t1,t2,t3,t4,t5,t6,t7,t8;
-    DCTELEM *src, *dst;
-
-    src = block;
-    dst = block;
-    for(i = 0; i < 8; i++){
-        t1 = 12 * (src[0] + src[4]);
-        t2 = 12 * (src[0] - src[4]);
-        t3 = 16 * src[2] +  6 * src[6];
-        t4 =  6 * src[2] - 16 * src[6];
-
-        t5 = t1 + t3;
-        t6 = t2 + t4;
-        t7 = t2 - t4;
-        t8 = t1 - t3;
-
-        t1 = 16 * src[1] + 15 * src[3] +  9 * src[5] +  4 * src[7];
-        t2 = 15 * src[1] -  4 * src[3] - 16 * src[5] -  9 * src[7];
-        t3 =  9 * src[1] - 16 * src[3] +  4 * src[5] + 15 * src[7];
-        t4 =  4 * src[1] -  9 * src[3] + 15 * src[5] - 16 * src[7];
-
-        dst[0] = (t5 + t1 + 4) >> 3;
-        dst[1] = (t6 + t2 + 4) >> 3;
-        dst[2] = (t7 + t3 + 4) >> 3;
-        dst[3] = (t8 + t4 + 4) >> 3;
-        dst[4] = (t8 - t4 + 4) >> 3;
-        dst[5] = (t7 - t3 + 4) >> 3;
-        dst[6] = (t6 - t2 + 4) >> 3;
-        dst[7] = (t5 - t1 + 4) >> 3;
-
-        src += 8;
-        dst += 8;
-    }
-
-    src = block;
-    dst = block;
-    for(i = 0; i < 8; i++){
-        t1 = 12 * (src[ 0] + src[32]);
-        t2 = 12 * (src[ 0] - src[32]);
-        t3 = 16 * src[16] +  6 * src[48];
-        t4 =  6 * src[16] - 16 * src[48];
-
-        t5 = t1 + t3;
-        t6 = t2 + t4;
-        t7 = t2 - t4;
-        t8 = t1 - t3;
-
-        t1 = 16 * src[ 8] + 15 * src[24] +  9 * src[40] +  4 * src[56];
-        t2 = 15 * src[ 8] -  4 * src[24] - 16 * src[40] -  9 * src[56];
-        t3 =  9 * src[ 8] - 16 * src[24] +  4 * src[40] + 15 * src[56];
-        t4 =  4 * src[ 8] -  9 * src[24] + 15 * src[40] - 16 * src[56];
-
-        dst[ 0] = (t5 + t1 + 64) >> 7;
-        dst[ 8] = (t6 + t2 + 64) >> 7;
-        dst[16] = (t7 + t3 + 64) >> 7;
-        dst[24] = (t8 + t4 + 64) >> 7;
-        dst[32] = (t8 - t4 + 64 + 1) >> 7;
-        dst[40] = (t7 - t3 + 64 + 1) >> 7;
-        dst[48] = (t6 - t2 + 64 + 1) >> 7;
-        dst[56] = (t5 - t1 + 64 + 1) >> 7;
-
-        src++;
-        dst++;
-    }
-}
-
-/** Do inverse transform on 8x4 part of block
-*/
-static void vc1_inv_trans_8x4_c(DCTELEM block[64], int n)
-{
-    int i;
-    register int t1,t2,t3,t4,t5,t6,t7,t8;
-    DCTELEM *src, *dst;
-    int off;
-
-    off = n * 32;
-    src = block + off;
-    dst = block + off;
-    for(i = 0; i < 4; i++){
-        t1 = 12 * (src[0] + src[4]);
-        t2 = 12 * (src[0] - src[4]);
-        t3 = 16 * src[2] +  6 * src[6];
-        t4 =  6 * src[2] - 16 * src[6];
-
-        t5 = t1 + t3;
-        t6 = t2 + t4;
-        t7 = t2 - t4;
-        t8 = t1 - t3;
-
-        t1 = 16 * src[1] + 15 * src[3] +  9 * src[5] +  4 * src[7];
-        t2 = 15 * src[1] -  4 * src[3] - 16 * src[5] -  9 * src[7];
-        t3 =  9 * src[1] - 16 * src[3] +  4 * src[5] + 15 * src[7];
-        t4 =  4 * src[1] -  9 * src[3] + 15 * src[5] - 16 * src[7];
-
-        dst[0] = (t5 + t1 + 4) >> 3;
-        dst[1] = (t6 + t2 + 4) >> 3;
-        dst[2] = (t7 + t3 + 4) >> 3;
-        dst[3] = (t8 + t4 + 4) >> 3;
-        dst[4] = (t8 - t4 + 4) >> 3;
-        dst[5] = (t7 - t3 + 4) >> 3;
-        dst[6] = (t6 - t2 + 4) >> 3;
-        dst[7] = (t5 - t1 + 4) >> 3;
-
-        src += 8;
-        dst += 8;
-    }
-
-    src = block + off;
-    dst = block + off;
-    for(i = 0; i < 8; i++){
-        t1 = 17 * (src[ 0] + src[16]);
-        t2 = 17 * (src[ 0] - src[16]);
-        t3 = 22 * src[ 8];
-        t4 = 22 * src[24];
-        t5 = 10 * src[ 8];
-        t6 = 10 * src[24];
-
-        dst[ 0] = (t1 + t3 + t6 + 64) >> 7;
-        dst[ 8] = (t2 - t4 + t5 + 64) >> 7;
-        dst[16] = (t2 + t4 - t5 + 64) >> 7;
-        dst[24] = (t1 - t3 - t6 + 64) >> 7;
-
-        src ++;
-        dst ++;
-    }
-}
-
-/** Do inverse transform on 4x8 parts of block
-*/
-static void vc1_inv_trans_4x8_c(DCTELEM block[64], int n)
-{
-    int i;
-    register int t1,t2,t3,t4,t5,t6,t7,t8;
-    DCTELEM *src, *dst;
-    int off;
-
-    off = n * 4;
-    src = block + off;
-    dst = block + off;
-    for(i = 0; i < 8; i++){
-        t1 = 17 * (src[0] + src[2]);
-        t2 = 17 * (src[0] - src[2]);
-        t3 = 22 * src[1];
-        t4 = 22 * src[3];
-        t5 = 10 * src[1];
-        t6 = 10 * src[3];
-
-        dst[0] = (t1 + t3 + t6 + 4) >> 3;
-        dst[1] = (t2 - t4 + t5 + 4) >> 3;
-        dst[2] = (t2 + t4 - t5 + 4) >> 3;
-        dst[3] = (t1 - t3 - t6 + 4) >> 3;
-
-        src += 8;
-        dst += 8;
-    }
-
-    src = block + off;
-    dst = block + off;
-    for(i = 0; i < 4; i++){
-        t1 = 12 * (src[ 0] + src[32]);
-        t2 = 12 * (src[ 0] - src[32]);
-        t3 = 16 * src[16] +  6 * src[48];
-        t4 =  6 * src[16] - 16 * src[48];
-
-        t5 = t1 + t3;
-        t6 = t2 + t4;
-        t7 = t2 - t4;
-        t8 = t1 - t3;
-
-        t1 = 16 * src[ 8] + 15 * src[24] +  9 * src[40] +  4 * src[56];
-        t2 = 15 * src[ 8] -  4 * src[24] - 16 * src[40] -  9 * src[56];
-        t3 =  9 * src[ 8] - 16 * src[24] +  4 * src[40] + 15 * src[56];
-        t4 =  4 * src[ 8] -  9 * src[24] + 15 * src[40] - 16 * src[56];
-
-        dst[ 0] = (t5 + t1 + 64) >> 7;
-        dst[ 8] = (t6 + t2 + 64) >> 7;
-        dst[16] = (t7 + t3 + 64) >> 7;
-        dst[24] = (t8 + t4 + 64) >> 7;
-        dst[32] = (t8 - t4 + 64 + 1) >> 7;
-        dst[40] = (t7 - t3 + 64 + 1) >> 7;
-        dst[48] = (t6 - t2 + 64 + 1) >> 7;
-        dst[56] = (t5 - t1 + 64 + 1) >> 7;
-
-        src++;
-        dst++;
-    }
-}
-
-/** Do inverse transform on 4x4 part of block
-*/
-static void vc1_inv_trans_4x4_c(DCTELEM block[64], int n)
-{
-    int i;
-    register int t1,t2,t3,t4,t5,t6;
-    DCTELEM *src, *dst;
-    int off;
-
-    off = (n&1) * 4 + (n&2) * 16;
-    src = block + off;
-    dst = block + off;
-    for(i = 0; i < 4; i++){
-        t1 = 17 * (src[0] + src[2]);
-        t2 = 17 * (src[0] - src[2]);
-        t3 = 22 * src[1];
-        t4 = 22 * src[3];
-        t5 = 10 * src[1];
-        t6 = 10 * src[3];
-
-        dst[0] = (t1 + t3 + t6 + 4) >> 3;
-        dst[1] = (t2 - t4 + t5 + 4) >> 3;
-        dst[2] = (t2 + t4 - t5 + 4) >> 3;
-        dst[3] = (t1 - t3 - t6 + 4) >> 3;
-
-        src += 8;
-        dst += 8;
-    }
-
-    src = block + off;
-    dst = block + off;
-    for(i = 0; i < 4; i++){
-        t1 = 17 * (src[ 0] + src[16]);
-        t2 = 17 * (src[ 0] - src[16]);
-        t3 = 22 * src[ 8];
-        t4 = 22 * src[24];
-        t5 = 10 * src[ 8];
-        t6 = 10 * src[24];
-
-        dst[ 0] = (t1 + t3 + t6 + 64) >> 7;
-        dst[ 8] = (t2 - t4 + t5 + 64) >> 7;
-        dst[16] = (t2 + t4 - t5 + 64) >> 7;
-        dst[24] = (t1 - t3 - t6 + 64) >> 7;
-
-        src ++;
-        dst ++;
-    }
-}
-
-/* motion compensation functions */
-
-/** Filter used to interpolate fractional pel values
- */
-static always_inline int vc1_mspel_filter(const uint8_t *src, int stride, int mode, int r)
-{
-    switch(mode){
-    case 0: //no shift
-        return src[0];
-    case 1: // 1/4 shift
-        return (-4*src[-stride] + 53*src[0] + 18*src[stride] - 3*src[stride*2] + 32 - r) >> 6;
-    case 2: // 1/2 shift
-        return (-src[-stride] + 9*src[0] + 9*src[stride] - src[stride*2] + 8 - r) >> 4;
-    case 3: // 3/4 shift
-        return (-3*src[-stride] + 18*src[0] + 53*src[stride] - 4*src[stride*2] + 32 - r) >> 6;
-    }
-    return 0; //should not occur
-}
-
-/** Function used to do motion compensation with bicubic interpolation
- */
-static void vc1_mspel_mc(uint8_t *dst, const uint8_t *src, int stride, int mode, int rnd)
-{
-    int i, j;
-    uint8_t tmp[8*11], *tptr;
-    int m, r;
-
-    m = (mode & 3);
-    r = rnd;
-    src -= stride;
-    tptr = tmp;
-    for(j = 0; j < 11; j++) {
-        for(i = 0; i < 8; i++)
-            tptr[i] = clip_uint8(vc1_mspel_filter(src + i, 1, m, r));
-        src += stride;
-        tptr += 8;
-    }
-    r = 1 - rnd;
-    m = (mode >> 2) & 3;
-
-    tptr = tmp + 8;
-    for(j = 0; j < 8; j++) {
-        for(i = 0; i < 8; i++)
-            dst[i] = clip_uint8(vc1_mspel_filter(tptr + i, 8, m, r));
-        dst += stride;
-        tptr += 8;
-    }
-}
-
-/* pixel functions - really are entry points to vc1_mspel_mc */
-
-/* this one is defined in dsputil.c */
-void ff_put_vc1_mspel_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int rnd);
-
-static void ff_put_vc1_mspel_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x1, rnd);
-}
-
-static void ff_put_vc1_mspel_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x2, rnd);
-}
-
-static void ff_put_vc1_mspel_mc30_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x3, rnd);
-}
-
-static void ff_put_vc1_mspel_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x4, rnd);
-}
-
-static void ff_put_vc1_mspel_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x5, rnd);
-}
-
-static void ff_put_vc1_mspel_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x6, rnd);
-}
-
-static void ff_put_vc1_mspel_mc31_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x7, rnd);
-}
-
-static void ff_put_vc1_mspel_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x8, rnd);
-}
-
-static void ff_put_vc1_mspel_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0x9, rnd);
-}
-
-static void ff_put_vc1_mspel_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xA, rnd);
-}
-
-static void ff_put_vc1_mspel_mc32_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xB, rnd);
-}
-
-static void ff_put_vc1_mspel_mc03_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xC, rnd);
-}
-
-static void ff_put_vc1_mspel_mc13_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xD, rnd);
-}
-
-static void ff_put_vc1_mspel_mc23_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xE, rnd);
-}
-
-static void ff_put_vc1_mspel_mc33_c(uint8_t *dst, const uint8_t *src, int stride, int rnd) {
-    vc1_mspel_mc(dst, src, stride, 0xF, rnd);
-}
-
-void ff_vc1dsp_init(DSPContext* dsp, AVCodecContext *avctx) {
-    dsp->vc1_inv_trans_8x8 = vc1_inv_trans_8x8_c;
-    dsp->vc1_inv_trans_4x8 = vc1_inv_trans_4x8_c;
-    dsp->vc1_inv_trans_8x4 = vc1_inv_trans_8x4_c;
-    dsp->vc1_inv_trans_4x4 = vc1_inv_trans_4x4_c;
-    dsp->vc1_h_overlap = vc1_h_overlap_c;
-    dsp->vc1_v_overlap = vc1_v_overlap_c;
-
-    dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_vc1_mspel_mc00_c;
-    dsp->put_vc1_mspel_pixels_tab[ 1] = ff_put_vc1_mspel_mc10_c;
-    dsp->put_vc1_mspel_pixels_tab[ 2] = ff_put_vc1_mspel_mc20_c;
-    dsp->put_vc1_mspel_pixels_tab[ 3] = ff_put_vc1_mspel_mc30_c;
-    dsp->put_vc1_mspel_pixels_tab[ 4] = ff_put_vc1_mspel_mc01_c;
-    dsp->put_vc1_mspel_pixels_tab[ 5] = ff_put_vc1_mspel_mc11_c;
-    dsp->put_vc1_mspel_pixels_tab[ 6] = ff_put_vc1_mspel_mc21_c;
-    dsp->put_vc1_mspel_pixels_tab[ 7] = ff_put_vc1_mspel_mc31_c;
-    dsp->put_vc1_mspel_pixels_tab[ 8] = ff_put_vc1_mspel_mc02_c;
-    dsp->put_vc1_mspel_pixels_tab[ 9] = ff_put_vc1_mspel_mc12_c;
-    dsp->put_vc1_mspel_pixels_tab[10] = ff_put_vc1_mspel_mc22_c;
-    dsp->put_vc1_mspel_pixels_tab[11] = ff_put_vc1_mspel_mc32_c;
-    dsp->put_vc1_mspel_pixels_tab[12] = ff_put_vc1_mspel_mc03_c;
-    dsp->put_vc1_mspel_pixels_tab[13] = ff_put_vc1_mspel_mc13_c;
-    dsp->put_vc1_mspel_pixels_tab[14] = ff_put_vc1_mspel_mc23_c;
-    dsp->put_vc1_mspel_pixels_tab[15] = ff_put_vc1_mspel_mc33_c;
-}
--- a/src/ffmpeg/libavcodec/zmbv.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,692 +0,0 @@
-/*
- * Zip Motion Blocks Video (ZMBV) decoder
- * Copyright (c) 2006 Konstantin Shishkov
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-/**
- * @file zmbv.c
- * Zip Motion Blocks Video decoder
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "common.h"
-#include "avcodec.h"
-
-#ifdef CONFIG_ZLIB
-#include <zlib.h>
-#endif
-
-#define ZMBV_KEYFRAME 1
-#define ZMBV_DELTAPAL 2
-
-enum ZmbvFormat {
-    ZMBV_FMT_NONE  = 0,
-    ZMBV_FMT_1BPP  = 1,
-    ZMBV_FMT_2BPP  = 2,
-    ZMBV_FMT_4BPP  = 3,
-    ZMBV_FMT_8BPP  = 4,
-    ZMBV_FMT_15BPP = 5,
-    ZMBV_FMT_16BPP = 6,
-    ZMBV_FMT_24BPP = 7,
-    ZMBV_FMT_32BPP = 8
-};
-
-/*
- * Decoder context
- */
-typedef struct ZmbvContext {
-    AVCodecContext *avctx;
-    AVFrame pic;
-
-    int bpp;
-    unsigned int decomp_size;
-    uint8_t* decomp_buf;
-    uint8_t pal[768];
-    uint8_t *prev, *cur;
-    int width, height;
-    int fmt;
-    int comp;
-    int flags;
-    int bw, bh, bx, by;
-    int decomp_len;
-#ifdef CONFIG_ZLIB
-    z_stream zstream;
-#endif
-    int (*decode_intra)(struct ZmbvContext *c);
-    int (*decode_xor)(struct ZmbvContext *c);
-} ZmbvContext;
-
-/**
- * Decode XOR'ed frame - 8bpp version
- */
-
-static int zmbv_decode_xor_8(ZmbvContext *c)
-{
-    uint8_t *src = c->decomp_buf;
-    uint8_t *output, *prev;
-    int8_t *mvec;
-    int x, y;
-    int d, dx, dy, bw2, bh2;
-    int block;
-    int i, j;
-    int mx, my;
-
-    output = c->cur;
-    prev = c->prev;
-
-    if(c->flags & ZMBV_DELTAPAL){
-        for(i = 0; i < 768; i++)
-            c->pal[i] ^= *src++;
-    }
-
-    mvec = (int8_t*)src;
-    src += ((c->bx * c->by * 2 + 3) & ~3);
-
-    block = 0;
-    for(y = 0; y < c->height; y += c->bh) {
-        bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
-        for(x = 0; x < c->width; x += c->bw) {
-            uint8_t *out, *tprev;
-
-            d = mvec[block] & 1;
-            dx = mvec[block] >> 1;
-            dy = mvec[block + 1] >> 1;
-            block += 2;
-
-            bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
-
-            /* copy block - motion vectors out of bounds are used to zero blocks */
-            out = output + x;
-            tprev = prev + x + dx + dy * c->width;
-            mx = x + dx;
-            my = y + dy;
-            for(j = 0; j < bh2; j++){
-                if((my + j < 0) || (my + j >= c->height)) {
-                    memset(out, 0, bw2);
-                } else {
-                    for(i = 0; i < bw2; i++){
-                        if((mx + i < 0) || (mx + i >= c->width))
-                            out[i] = 0;
-                        else
-                            out[i] = tprev[i];
-                    }
-                }
-                out += c->width;
-                tprev += c->width;
-            }
-
-            if(d) { /* apply XOR'ed difference */
-                out = output + x;
-                for(j = 0; j < bh2; j++){
-                    for(i = 0; i < bw2; i++)
-                        out[i] ^= *src++;
-                    out += c->width;
-                }
-            }
-        }
-        output += c->width * c->bh;
-        prev += c->width * c->bh;
-    }
-    if(src - c->decomp_buf != c->decomp_len)
-        av_log(c->avctx, AV_LOG_ERROR, "Used %i of %i bytes\n", src-c->decomp_buf, c->decomp_len);
-    return 0;
-}
-
-/**
- * Decode XOR'ed frame - 15bpp and 16bpp version
- */
-
-static int zmbv_decode_xor_16(ZmbvContext *c)
-{
-    uint8_t *src = c->decomp_buf;
-    uint16_t *output, *prev;
-    int8_t *mvec;
-    int x, y;
-    int d, dx, dy, bw2, bh2;
-    int block;
-    int i, j;
-    int mx, my;
-
-    output = (uint16_t*)c->cur;
-    prev = (uint16_t*)c->prev;
-
-    mvec = (int8_t*)src;
-    src += ((c->bx * c->by * 2 + 3) & ~3);
-
-    block = 0;
-    for(y = 0; y < c->height; y += c->bh) {
-        bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
-        for(x = 0; x < c->width; x += c->bw) {
-            uint16_t *out, *tprev;
-
-            d = mvec[block] & 1;
-            dx = mvec[block] >> 1;
-            dy = mvec[block + 1] >> 1;
-            block += 2;
-
-            bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
-
-            /* copy block - motion vectors out of bounds are used to zero blocks */
-            out = output + x;
-            tprev = prev + x + dx + dy * c->width;
-            mx = x + dx;
-            my = y + dy;
-            for(j = 0; j < bh2; j++){
-                if((my + j < 0) || (my + j >= c->height)) {
-                    memset(out, 0, bw2 * 2);
-                } else {
-                    for(i = 0; i < bw2; i++){
-                        if((mx + i < 0) || (mx + i >= c->width))
-                            out[i] = 0;
-                        else
-                            out[i] = tprev[i];
-                    }
-                }
-                out += c->width;
-                tprev += c->width;
-            }
-
-            if(d) { /* apply XOR'ed difference */
-                out = output + x;
-                for(j = 0; j < bh2; j++){
-                    for(i = 0; i < bw2; i++) {
-                        out[i] ^= *((uint16_t*)src);
-                        src += 2;
-                    }
-                    out += c->width;
-                }
-            }
-        }
-        output += c->width * c->bh;
-        prev += c->width * c->bh;
-    }
-    if(src - c->decomp_buf != c->decomp_len)
-        av_log(c->avctx, AV_LOG_ERROR, "Used %i of %i bytes\n", src-c->decomp_buf, c->decomp_len);
-    return 0;
-}
-
-#ifdef ZMBV_ENABLE_24BPP
-/**
- * Decode XOR'ed frame - 24bpp version
- */
-
-static int zmbv_decode_xor_24(ZmbvContext *c)
-{
-    uint8_t *src = c->decomp_buf;
-    uint8_t *output, *prev;
-    int8_t *mvec;
-    int x, y;
-    int d, dx, dy, bw2, bh2;
-    int block;
-    int i, j;
-    int mx, my;
-    int stride;
-
-    output = c->cur;
-    prev = c->prev;
-
-    stride = c->width * 3;
-    mvec = (int8_t*)src;
-    src += ((c->bx * c->by * 2 + 3) & ~3);
-
-    block = 0;
-    for(y = 0; y < c->height; y += c->bh) {
-        bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
-        for(x = 0; x < c->width; x += c->bw) {
-            uint8_t *out, *tprev;
-
-            d = mvec[block] & 1;
-            dx = mvec[block] >> 1;
-            dy = mvec[block + 1] >> 1;
-            block += 2;
-
-            bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
-
-            /* copy block - motion vectors out of bounds are used to zero blocks */
-            out = output + x * 3;
-            tprev = prev + (x + dx) * 3 + dy * stride;
-            mx = x + dx;
-            my = y + dy;
-            for(j = 0; j < bh2; j++){
-                if((my + j < 0) || (my + j >= c->height)) {
-                    memset(out, 0, bw2 * 3);
-                } else {
-                    for(i = 0; i < bw2; i++){
-                        if((mx + i < 0) || (mx + i >= c->width)) {
-                            out[i * 3 + 0] = 0;
-                            out[i * 3 + 1] = 0;
-                            out[i * 3 + 2] = 0;
-                        } else {
-                            out[i * 3 + 0] = tprev[i * 3 + 0];
-                            out[i * 3 + 1] = tprev[i * 3 + 1];
-                            out[i * 3 + 2] = tprev[i * 3 + 2];
-                        }
-                    }
-                }
-                out += stride;
-                tprev += stride;
-            }
-
-            if(d) { /* apply XOR'ed difference */
-                out = output + x * 3;
-                for(j = 0; j < bh2; j++){
-                    for(i = 0; i < bw2; i++) {
-                        out[i * 3 + 0] ^= *src++;
-                        out[i * 3 + 1] ^= *src++;
-                        out[i * 3 + 2] ^= *src++;
-                    }
-                    out += stride;
-                }
-            }
-        }
-        output += stride * c->bh;
-        prev += stride * c->bh;
-    }
-    if(src - c->decomp_buf != c->decomp_len)
-        av_log(c->avctx, AV_LOG_ERROR, "Used %i of %i bytes\n", src-c->decomp_buf, c->decomp_len);
-    return 0;
-}
-#endif //ZMBV_ENABLE_24BPP
-
-/**
- * Decode XOR'ed frame - 32bpp version
- */
-
-static int zmbv_decode_xor_32(ZmbvContext *c)
-{
-    uint8_t *src = c->decomp_buf;
-    uint32_t *output, *prev;
-    int8_t *mvec;
-    int x, y;
-    int d, dx, dy, bw2, bh2;
-    int block;
-    int i, j;
-    int mx, my;
-
-    output = (uint32_t*)c->cur;
-    prev = (uint32_t*)c->prev;
-
-    mvec = (int8_t*)src;
-    src += ((c->bx * c->by * 2 + 3) & ~3);
-
-    block = 0;
-    for(y = 0; y < c->height; y += c->bh) {
-        bh2 = ((c->height - y) > c->bh) ? c->bh : (c->height - y);
-        for(x = 0; x < c->width; x += c->bw) {
-            uint32_t *out, *tprev;
-
-            d = mvec[block] & 1;
-            dx = mvec[block] >> 1;
-            dy = mvec[block + 1] >> 1;
-            block += 2;
-
-            bw2 = ((c->width - x) > c->bw) ? c->bw : (c->width - x);
-
-            /* copy block - motion vectors out of bounds are used to zero blocks */
-            out = output + x;
-            tprev = prev + x + dx + dy * c->width;
-            mx = x + dx;
-            my = y + dy;
-            for(j = 0; j < bh2; j++){
-                if((my + j < 0) || (my + j >= c->height)) {
-                    memset(out, 0, bw2 * 4);
-                } else {
-                    for(i = 0; i < bw2; i++){
-                        if((mx + i < 0) || (mx + i >= c->width))
-                            out[i] = 0;
-                        else
-                            out[i] = tprev[i];
-                    }
-                }
-                out += c->width;
-                tprev += c->width;
-            }
-
-            if(d) { /* apply XOR'ed difference */
-                out = output + x;
-                for(j = 0; j < bh2; j++){
-                    for(i = 0; i < bw2; i++) {
-                        out[i] ^= *((uint32_t*)src);
-                        src += 4;
-                    }
-                    out += c->width;
-                }
-            }
-        }
-        output += c->width * c->bh;
-        prev += c->width * c->bh;
-    }
-    if(src - c->decomp_buf != c->decomp_len)
-        av_log(c->avctx, AV_LOG_ERROR, "Used %i of %i bytes\n", src-c->decomp_buf, c->decomp_len);
-    return 0;
-}
-
-/**
- * Decode intraframe
- */
-static int zmbv_decode_intra(ZmbvContext *c)
-{
-    uint8_t *src = c->decomp_buf;
-
-    /* make the palette available on the way out */
-    if (c->fmt == ZMBV_FMT_8BPP) {
-        memcpy(c->pal, src, 768);
-        src += 768;
-    }
-
-    memcpy(c->cur, src, c->width * c->height * (c->bpp / 8));
-    return 0;
-}
-
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size)
-{
-    ZmbvContext * const c = (ZmbvContext *)avctx->priv_data;
-    uint8_t *outptr;
-#ifdef CONFIG_ZLIB
-    int zret = Z_OK; // Zlib return code
-#endif
-    int len = buf_size;
-    int hi_ver, lo_ver;
-
-    if(c->pic.data[0])
-            avctx->release_buffer(avctx, &c->pic);
-
-    c->pic.reference = 1;
-    c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
-    if(avctx->get_buffer(avctx, &c->pic) < 0){
-        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
-
-    outptr = c->pic.data[0]; // Output image pointer
-
-    /* parse header */
-    c->flags = buf[0];
-    buf++; len--;
-    if(c->flags & ZMBV_KEYFRAME) {
-        hi_ver = buf[0];
-        lo_ver = buf[1];
-        c->comp = buf[2];
-        c->fmt = buf[3];
-        c->bw = buf[4];
-        c->bh = buf[5];
-
-        buf += 6;
-        len -= 6;
-        av_log(avctx, AV_LOG_DEBUG, "Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",c->flags,hi_ver,lo_ver,c->comp,c->fmt,c->bw,c->bh);
-        if(hi_ver != 0 || lo_ver != 1) {
-            av_log(avctx, AV_LOG_ERROR, "Unsupported version %i.%i\n", hi_ver, lo_ver);
-            return -1;
-        }
-        if(c->bw == 0 || c->bh == 0) {
-            av_log(avctx, AV_LOG_ERROR, "Unsupported block size %ix%i\n", c->bw, c->bh);
-        }
-        if(c->comp != 0 && c->comp != 1) {
-            av_log(avctx, AV_LOG_ERROR, "Unsupported compression type %i\n", c->comp);
-            return -1;
-        }
-
-        switch(c->fmt) {
-        case ZMBV_FMT_8BPP:
-            c->bpp = 8;
-            c->decode_intra = zmbv_decode_intra;
-            c->decode_xor = zmbv_decode_xor_8;
-            break;
-        case ZMBV_FMT_15BPP:
-        case ZMBV_FMT_16BPP:
-            c->bpp = 16;
-            c->decode_intra = zmbv_decode_intra;
-            c->decode_xor = zmbv_decode_xor_16;
-            break;
-#ifdef ZMBV_ENABLE_24BPP
-        case ZMBV_FMT_24BPP:
-            c->bpp = 24;
-            c->decode_intra = zmbv_decode_intra;
-            c->decode_xor = zmbv_decode_xor_24;
-            break;
-#endif //ZMBV_ENABLE_24BPP
-        case ZMBV_FMT_32BPP:
-            c->bpp = 32;
-            c->decode_intra = zmbv_decode_intra;
-            c->decode_xor = zmbv_decode_xor_32;
-            break;
-        default:
-            c->decode_intra = NULL;
-            c->decode_xor = NULL;
-            av_log(avctx, AV_LOG_ERROR, "Unsupported (for now) format %i\n", c->fmt);
-            return -1;
-        }
-#ifdef CONFIG_ZLIB
-        zret = inflateReset(&c->zstream);
-        if (zret != Z_OK) {
-            av_log(avctx, AV_LOG_ERROR, "Inflate reset error: %d\n", zret);
-            return -1;
-        }
-#else
-        av_log(avctx, AV_LOG_ERROR, "BUG! Zlib support not compiled in frame decoder.\n");
-        return -1;
-#endif  /* CONFIG_ZLIB */
-        c->cur = av_realloc(c->cur, avctx->width * avctx->height * (c->bpp / 8));
-        c->prev = av_realloc(c->prev, avctx->width * avctx->height * (c->bpp / 8));
-        c->bx = (c->width + c->bw - 1) / c->bw;
-        c->by = (c->height+ c->bh - 1) / c->bh;
-    }
-
-    if(c->decode_intra == NULL) {
-        av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
-        return -1;
-    }
-
-    if(c->comp == 0) { //Uncompressed data
-        memcpy(c->decomp_buf, buf, len);
-        c->decomp_size = 1;
-    } else { // ZLIB-compressed data
-#ifdef CONFIG_ZLIB
-        c->zstream.total_in = c->zstream.total_out = 0;
-        c->zstream.next_in = buf;
-        c->zstream.avail_in = len;
-        c->zstream.next_out = c->decomp_buf;
-        c->zstream.avail_out = c->decomp_size;
-        inflate(&c->zstream, Z_FINISH);
-        c->decomp_len = c->zstream.total_out;
-#else
-        av_log(avctx, AV_LOG_ERROR, "BUG! Zlib support not compiled in frame decoder.\n");
-        return -1;
-#endif
-    }
-    if(c->flags & ZMBV_KEYFRAME) {
-        c->pic.key_frame = 1;
-        c->pic.pict_type = FF_I_TYPE;
-        c->decode_intra(c);
-    } else {
-        c->pic.key_frame = 0;
-        c->pic.pict_type = FF_P_TYPE;
-        c->decode_xor(c);
-    }
-
-    /* update frames */
-    {
-        uint8_t *out, *src;
-        int i, j;
-
-        out = c->pic.data[0];
-        src = c->cur;
-        switch(c->fmt) {
-        case ZMBV_FMT_8BPP:
-            for(j = 0; j < c->height; j++) {
-                for(i = 0; i < c->width; i++) {
-                    out[i * 3 + 0] = c->pal[(*src) * 3 + 0];
-                    out[i * 3 + 1] = c->pal[(*src) * 3 + 1];
-                    out[i * 3 + 2] = c->pal[(*src) * 3 + 2];
-                    *src++;
-                }
-                out += c->pic.linesize[0];
-            }
-            break;
-        case ZMBV_FMT_15BPP:
-            for(j = 0; j < c->height; j++) {
-                for(i = 0; i < c->width; i++) {
-                    uint16_t tmp = LE_16(src);
-                    src += 2;
-                    out[i * 3 + 0] = (tmp & 0x7C00) >> 7;
-                    out[i * 3 + 1] = (tmp & 0x03E0) >> 2;
-                    out[i * 3 + 2] = (tmp & 0x001F) << 3;
-                }
-                out += c->pic.linesize[0];
-            }
-            break;
-        case ZMBV_FMT_16BPP:
-            for(j = 0; j < c->height; j++) {
-                for(i = 0; i < c->width; i++) {
-                    uint16_t tmp = LE_16(src);
-                    src += 2;
-                    out[i * 3 + 0] = (tmp & 0xF800) >> 8;
-                    out[i * 3 + 1] = (tmp & 0x07E0) >> 3;
-                    out[i * 3 + 2] = (tmp & 0x001F) << 3;
-                }
-                out += c->pic.linesize[0];
-            }
-            break;
-#ifdef ZMBV_ENABLE_24BPP
-        case ZMBV_FMT_24BPP:
-            for(j = 0; j < c->height; j++) {
-                memcpy(out, src, c->width * 3);
-                src += c->width * 3;
-                out += c->pic.linesize[0];
-            }
-            break;
-#endif //ZMBV_ENABLE_24BPP
-        case ZMBV_FMT_32BPP:
-            for(j = 0; j < c->height; j++) {
-                for(i = 0; i < c->width; i++) {
-                    uint32_t tmp = LE_32(src);
-                    src += 4;
-                    out[i * 3 + 0] = tmp >> 16;
-                    out[i * 3 + 1] = tmp >> 8;
-                    out[i * 3 + 2] = tmp >> 0;
-                }
-                out += c->pic.linesize[0];
-            }
-            break;
-        default:
-            av_log(avctx, AV_LOG_ERROR, "Cannot handle format %i\n", c->fmt);
-        }
-        memcpy(c->prev, c->cur, c->width * c->height * (c->bpp / 8));
-    }
-    *data_size = sizeof(AVFrame);
-    *(AVFrame*)data = c->pic;
-
-    /* always report that the buffer was completely consumed */
-    return buf_size;
-}
-
-
-
-/*
- *
- * Init zmbv decoder
- *
- */
-static int decode_init(AVCodecContext *avctx)
-{
-    ZmbvContext * const c = (ZmbvContext *)avctx->priv_data;
-    int zret; // Zlib return code
-
-    c->avctx = avctx;
-    avctx->has_b_frames = 0;
-
-    c->pic.data[0] = NULL;
-    c->width = avctx->width;
-    c->height = avctx->height;
-
-    if (avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0) {
-        return 1;
-    }
-    c->bpp = avctx->bits_per_sample;
-
-#ifdef CONFIG_ZLIB
-    // Needed if zlib unused or init aborted before inflateInit
-    memset(&(c->zstream), 0, sizeof(z_stream));
-#else
-    av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled.\n");
-    return 1;
-#endif
-    avctx->pix_fmt = PIX_FMT_RGB24;
-    c->decomp_size = (avctx->width + 255) * 4 * (avctx->height + 64);
-
-    /* Allocate decompression buffer */
-    if (c->decomp_size) {
-        if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {
-            av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
-            return 1;
-        }
-    }
-
-#ifdef CONFIG_ZLIB
-    c->zstream.zalloc = Z_NULL;
-    c->zstream.zfree = Z_NULL;
-    c->zstream.opaque = Z_NULL;
-    zret = inflateInit(&(c->zstream));
-    if (zret != Z_OK) {
-        av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
-        return 1;
-    }
-#endif
-
-    return 0;
-}
-
-
-
-/*
- *
- * Uninit zmbv decoder
- *
- */
-static int decode_end(AVCodecContext *avctx)
-{
-    ZmbvContext * const c = (ZmbvContext *)avctx->priv_data;
-
-    av_freep(&c->decomp_buf);
-
-    if (c->pic.data[0])
-        avctx->release_buffer(avctx, &c->pic);
-#ifdef CONFIG_ZLIB
-    inflateEnd(&(c->zstream));
-#endif
-    av_freep(&c->cur);
-    av_freep(&c->prev);
-
-    return 0;
-}
-
-AVCodec zmbv_decoder = {
-    "zmbv",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_ZMBV,
-    sizeof(ZmbvContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame
-};
-
--- a/src/ffmpeg/libavformat/Makefile	Mon Mar 12 11:47:10 2007 -0700
+++ b/src/ffmpeg/libavformat/Makefile	Mon Mar 12 13:00:06 2007 -0700
@@ -5,31 +5,31 @@
 
 SOURCES = \
 4xm.c               electronicarts.c    mov.c               rm.c	\
-adtsenc.c           ffm.c               movenc.c            rtp.c	\
+adtsenc.c           ffm.c               movenc.c            \
 aiff.c              file.c              mp3.c               rtpproto.c	\
-allformats.c        flic.c              mpeg.c              rtsp.c	\
+allformats.c        flic.c              mpeg.c              \
 amr.c               flvdec.c            mpegts.c            segafilm.c	\
 asf-enc.c           flvenc.c            mpegtsenc.c         sgi.c	\
 asf.c               framehook.c         mpjpeg.c            sierravmd.c	\
 au.c                gif.c               mtv.c               smacker.c	\
 audio.c             gifdec.c            mxf.c               sol.c	\
 avidec.c            grab.c              nsvdec.c            swf.c	\
-avienc.c            grab_bktr.c         nut.c               tcp.c	\
+avienc.c            nut.c               \
 avio.c              gxf.c               nuv.c               tiertexseq.c\
 aviobuf.c           gxfenc.c            ogg.c               tta.c	\
-avisynth.c          http.c              ogg2.c              udp.c	\
+ogg2.c              \
 avs.c               idcin.c             oggparseflac.c      utils.c	\
 barpainet.c         idroq.c             oggparseogm.c       v4l2.c	\
 crc.c               img.c               oggparsetheora.c    voc.c	\
 cutils.c            img2.c              oggparsevorbis.c    wav.c	\
 daud.c              ipmovie.c           os_support.c        wc3movie.c	\
-dc1394.c            isom.c              png.c               westwood.c	\
+isom.c              png.c               westwood.c	\
 dsicin.c            jpeg.c              pnm.c               wv.c	\
-dv.c                matroska.c          psxstr.c            yuv.c	\
-dv1394.c            mm.c                raw.c               yuv4mpeg.c	\
-dvenc.c             mmf.c               riff.c
+matroska.c          psxstr.c            yuv.c	\
+mm.c                raw.c               yuv4mpeg.c	\
+dv.c                dvenc.c             mmf.c               riff.c
 
-CFLAGS+=	$(PICFLAGS) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -I../../.. -I../libavformat -I../libavutil -I..
+CFLAGS+=	$(PICFLAGS) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -I../../.. -I../libavcodec -I../libavformat -I../libavutil -I.. -DHAVE_AV_CONFIG_H
 
 OBJECTS=${SOURCES:.c=.o}
 
--- a/src/ffmpeg/libavformat/avformat.h	Mon Mar 12 11:47:10 2007 -0700
+++ b/src/ffmpeg/libavformat/avformat.h	Mon Mar 12 13:00:06 2007 -0700
@@ -424,10 +424,6 @@
 /* XXX: use automatic init with either ELF sections or C file parser */
 /* modules */
 
-#include "rtp.h"
-
-#include "rtsp.h"
-
 /* utils.c */
 void av_register_input_format(AVInputFormat *format);
 void av_register_output_format(AVOutputFormat *format);
--- a/src/ffmpeg/libavformat/avisynth.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-/*
- * AVISynth support for ffmpeg system
- * Copyright (c) 2006 DivX, Inc.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-#include "riff.h"
-
-#include <windows.h>
-#include <vfw.h>
-
-typedef struct {
-  PAVISTREAM handle;
-  AVISTREAMINFO info;
-  DWORD read;
-  LONG chunck_size;
-  LONG chunck_samples;
-} AVISynthStream;
-
-typedef struct {
-  PAVIFILE file;
-  AVISynthStream *streams;
-  int nb_streams;
-  int next_stream;
-} AVISynthContext;
-
-static int avisynth_read_header(AVFormatContext *s, AVFormatParameters *ap)
-{
-  AVISynthContext *avs = s->priv_data;
-  HRESULT res;
-  AVIFILEINFO info;
-  DWORD id;
-  AVStream *st;
-  AVISynthStream *stream;
-
-  AVIFileInit();
-
-  res = AVIFileOpen(&avs->file, s->filename, OF_READ|OF_SHARE_DENY_WRITE, NULL);
-  if (res != S_OK)
-    {
-      av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res);
-      AVIFileExit();
-      return -1;
-    }
-
-  res = AVIFileInfo(avs->file, &info, sizeof(info));
-  if (res != S_OK)
-    {
-      av_log(s, AV_LOG_ERROR, "AVIFileInfo failed with error %ld", res);
-      AVIFileExit();
-      return -1;
-    }
-
-  avs->streams = av_mallocz(info.dwStreams * sizeof(AVISynthStream));
-
-  for (id=0; id<info.dwStreams; id++)
-    {
-      stream = &avs->streams[id];
-      stream->read = 0;
-      if (AVIFileGetStream(avs->file, &stream->handle, 0, id) == S_OK)
-        {
-          if (AVIStreamInfo(stream->handle, &stream->info, sizeof(stream->info)) == S_OK)
-            {
-              if (stream->info.fccType == streamtypeAUDIO)
-                {
-                  WAVEFORMATEX wvfmt;
-                  LONG struct_size = sizeof(WAVEFORMATEX);
-                  if (AVIStreamReadFormat(stream->handle, 0, &wvfmt, &struct_size) != S_OK)
-                    continue;
-
-                  st = av_new_stream(s, id);
-                  st->codec->codec_type = CODEC_TYPE_AUDIO;
-
-                  st->codec->block_align = wvfmt.nBlockAlign;
-                  st->codec->channels = wvfmt.nChannels;
-                  st->codec->sample_rate = wvfmt.nSamplesPerSec;
-                  st->codec->bit_rate = wvfmt.nAvgBytesPerSec * 8;
-                  st->codec->bits_per_sample = wvfmt.wBitsPerSample;
-
-                  stream->chunck_samples = wvfmt.nSamplesPerSec * (uint64_t)info.dwScale / (uint64_t)info.dwRate;
-                  stream->chunck_size = stream->chunck_samples * wvfmt.nChannels * wvfmt.wBitsPerSample / 8;
-
-                  st->codec->codec_tag = wvfmt.wFormatTag;
-                  st->codec->codec_id = wav_codec_get_id(wvfmt.wFormatTag, st->codec->bits_per_sample);
-                }
-              else if (stream->info.fccType == streamtypeVIDEO)
-                {
-                  BITMAPINFO imgfmt;
-                  LONG struct_size = sizeof(BITMAPINFO);
-
-                  stream->chunck_size = stream->info.dwSampleSize;
-                  stream->chunck_samples = 1;
-
-                  if (AVIStreamReadFormat(stream->handle, 0, &imgfmt, &struct_size) != S_OK)
-                    continue;
-
-                  st = av_new_stream(s, id);
-                  st->codec->codec_type = CODEC_TYPE_VIDEO;
-                  st->r_frame_rate.num = stream->info.dwRate;
-                  st->r_frame_rate.den = stream->info.dwScale;
-
-                  st->codec->width = imgfmt.bmiHeader.biWidth;
-                  st->codec->height = imgfmt.bmiHeader.biHeight;
-
-                  st->codec->bits_per_sample = imgfmt.bmiHeader.biBitCount;
-                  st->codec->bit_rate = (uint64_t)stream->info.dwSampleSize * (uint64_t)stream->info.dwRate * 8 / (uint64_t)stream->info.dwScale;
-                  st->codec->codec_tag = imgfmt.bmiHeader.biCompression;
-                  st->codec->codec_id = codec_get_id(codec_bmp_tags, imgfmt.bmiHeader.biCompression);
-
-                  st->duration = stream->info.dwLength;
-                }
-              else
-                {
-                  AVIStreamRelease(stream->handle);
-                  continue;
-                }
-
-              avs->nb_streams++;
-
-              st->codec->stream_codec_tag = stream->info.fccHandler;
-
-              av_set_pts_info(st, 64, info.dwScale, info.dwRate);
-              st->start_time = stream->info.dwStart;
-            }
-        }
-    }
-
-  return 0;
-}
-
-static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-  AVISynthContext *avs = s->priv_data;
-  HRESULT res;
-  AVISynthStream *stream;
-  int stream_id = avs->next_stream;
-  LONG read_size;
-
-  // handle interleaving manually...
-  stream = &avs->streams[stream_id];
-
-  if (stream->read >= stream->info.dwLength)
-    return AVERROR_IO;
-
-  if (av_new_packet(pkt, stream->chunck_size))
-    return AVERROR_IO;
-  pkt->stream_index = stream_id;
-  pkt->pts = avs->streams[stream_id].read / avs->streams[stream_id].chunck_samples;
-
-  res = AVIStreamRead(stream->handle, stream->read, stream->chunck_samples, pkt->data, stream->chunck_size, &read_size, NULL);
-
-  pkt->pts = stream->read;
-  pkt->size = read_size;
-
-  stream->read += stream->chunck_samples;
-
-  // prepare for the next stream to read
-  do {
-    avs->next_stream = (avs->next_stream+1) % avs->nb_streams;
-  } while (avs->next_stream != stream_id && s->streams[avs->next_stream]->discard >= AVDISCARD_ALL);
-
-  return (res == S_OK) ? pkt->size : -1;
-}
-
-static int avisynth_read_close(AVFormatContext *s)
-{
-  AVISynthContext *avs = s->priv_data;
-  int i;
-
-  for (i=0;i<avs->nb_streams;i++)
-    {
-      AVIStreamRelease(avs->streams[i].handle);
-    }
-
-  av_free(avs->streams);
-  AVIFileRelease(avs->file);
-  AVIFileExit();
-  return 0;
-}
-
-static int avisynth_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
-{
-  AVISynthContext *avs = s->priv_data;
-  int stream_id;
-
-  for (stream_id = 0; stream_id < avs->nb_streams; stream_id++)
-    {
-      avs->streams[stream_id].read = pts * avs->streams[stream_id].chunck_samples;
-    }
-
-  return 0;
-}
-
-AVInputFormat avisynth_demuxer = {
-  "avs",
-  "AVISynth",
-  sizeof(AVISynthContext),
-  NULL,
-  avisynth_read_header,
-  avisynth_read_packet,
-  avisynth_read_close,
-  avisynth_read_seek,
-  NULL,
-  0,
-  "avs",
-};
--- a/src/ffmpeg/libavformat/dc1394.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*
- * IIDC1394 grab interface (uses libdc1394 and libraw1394)
- * Copyright (c) 2004 Roman Shaposhnik
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "avformat.h"
-
-#include <libraw1394/raw1394.h>
-#include <libdc1394/dc1394_control.h>
-
-#undef free
-
-typedef struct dc1394_data {
-    raw1394handle_t handle;
-    dc1394_cameracapture camera;
-    int current_frame;
-    int fps;
-
-    AVPacket packet;
-} dc1394_data;
-
-struct dc1394_frame_format {
-    int width;
-    int height;
-    enum PixelFormat pix_fmt;
-    int frame_size_id;
-} dc1394_frame_formats[] = {
-    { 320, 240, PIX_FMT_UYVY422, MODE_320x240_YUV422 },
-    { 640, 480, PIX_FMT_UYVY411, MODE_640x480_YUV411 },
-    { 640, 480, PIX_FMT_UYVY422, MODE_640x480_YUV422 },
-    {   0,   0, 0, MODE_320x240_YUV422 } /* default -- gotta be the last one */
-};
-
-struct dc1394_frame_rate {
-    int frame_rate;
-    int frame_rate_id;
-} dc1394_frame_rates[] = {
-    {  1875, FRAMERATE_1_875 },
-    {  3750, FRAMERATE_3_75  },
-    {  7500, FRAMERATE_7_5   },
-    { 15000, FRAMERATE_15    },
-    { 30000, FRAMERATE_30    },
-    { 60000, FRAMERATE_60    },
-    {     0, FRAMERATE_30    } /* default -- gotta be the last one */
-};
-
-static int dc1394_read_header(AVFormatContext *c, AVFormatParameters * ap)
-{
-    dc1394_data* dc1394 = c->priv_data;
-    AVStream* vst;
-    nodeid_t* camera_nodes;
-    int res;
-    struct dc1394_frame_format *fmt;
-    struct dc1394_frame_rate *fps;
-
-    for (fmt = dc1394_frame_formats; fmt->width; fmt++)
-         if (fmt->pix_fmt == ap->pix_fmt && fmt->width == ap->width && fmt->height == ap->height)
-             break;
-
-    for (fps = dc1394_frame_rates; fps->frame_rate; fps++)
-         if (fps->frame_rate == av_rescale(1000, ap->time_base.den, ap->time_base.num))
-             break;
-
-    /* create a video stream */
-    vst = av_new_stream(c, 0);
-    if (!vst)
-        return -1;
-    av_set_pts_info(vst, 64, 1, 1000);
-    vst->codec->codec_type = CODEC_TYPE_VIDEO;
-    vst->codec->codec_id = CODEC_ID_RAWVIDEO;
-    vst->codec->time_base.den = fps->frame_rate;
-    vst->codec->time_base.num = 1000;
-    vst->codec->width = fmt->width;
-    vst->codec->height = fmt->height;
-    vst->codec->pix_fmt = fmt->pix_fmt;
-
-    /* packet init */
-    av_init_packet(&dc1394->packet);
-    dc1394->packet.size = avpicture_get_size(fmt->pix_fmt, fmt->width, fmt->height);
-    dc1394->packet.stream_index = vst->index;
-    dc1394->packet.flags |= PKT_FLAG_KEY;
-
-    dc1394->current_frame = 0;
-    dc1394->fps = fps->frame_rate;
-
-    vst->codec->bit_rate = av_rescale(dc1394->packet.size * 8, fps->frame_rate, 1000);
-
-    /* Now lets prep the hardware */
-    dc1394->handle = dc1394_create_handle(0); /* FIXME: gotta have ap->port */
-    if (!dc1394->handle) {
-        av_log(c, AV_LOG_ERROR, "Can't acquire dc1394 handle on port %d\n", 0 /* ap->port */);
-        goto out;
-    }
-    camera_nodes = dc1394_get_camera_nodes(dc1394->handle, &res, 1);
-    if (!camera_nodes || camera_nodes[ap->channel] == DC1394_NO_CAMERA) {
-        av_log(c, AV_LOG_ERROR, "There's no IIDC camera on the channel %d\n", ap->channel);
-        goto out_handle;
-    }
-    res = dc1394_dma_setup_capture(dc1394->handle, camera_nodes[ap->channel],
-                                   0,
-                                   FORMAT_VGA_NONCOMPRESSED,
-                                   fmt->frame_size_id,
-                                   SPEED_400,
-                                   fps->frame_rate_id, 8, 1,
-                                   ap->device,
-                                   &dc1394->camera);
-    dc1394_free_camera_nodes(camera_nodes);
-    if (res != DC1394_SUCCESS) {
-        av_log(c, AV_LOG_ERROR, "Can't prepare camera for the DMA capture\n");
-        goto out_handle;
-    }
-
-    res = dc1394_start_iso_transmission(dc1394->handle, dc1394->camera.node);
-    if (res != DC1394_SUCCESS) {
-        av_log(c, AV_LOG_ERROR, "Can't start isochronous transmission\n");
-        goto out_handle_dma;
-    }
-
-    return 0;
-
-out_handle_dma:
-    dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
-    dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
-out_handle:
-    dc1394_destroy_handle(dc1394->handle);
-out:
-    return -1;
-}
-
-static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt)
-{
-    struct dc1394_data *dc1394 = c->priv_data;
-    int res;
-
-    /* discard stale frame */
-    if (dc1394->current_frame++) {
-        if (dc1394_dma_done_with_buffer(&dc1394->camera) != DC1394_SUCCESS)
-            av_log(c, AV_LOG_ERROR, "failed to release %d frame\n", dc1394->current_frame);
-    }
-
-    res = dc1394_dma_single_capture(&dc1394->camera);
-
-    if (res == DC1394_SUCCESS) {
-        dc1394->packet.data = (uint8_t *)(dc1394->camera.capture_buffer);
-        dc1394->packet.pts = (dc1394->current_frame * 1000000) / dc1394->fps;
-        res = dc1394->packet.size;
-    } else {
-        av_log(c, AV_LOG_ERROR, "DMA capture failed\n");
-        dc1394->packet.data = NULL;
-        res = -1;
-    }
-
-    *pkt = dc1394->packet;
-    return res;
-}
-
-static int dc1394_close(AVFormatContext * context)
-{
-    struct dc1394_data *dc1394 = context->priv_data;
-
-    dc1394_stop_iso_transmission(dc1394->handle, dc1394->camera.node);
-    dc1394_dma_unlisten(dc1394->handle, &dc1394->camera);
-    dc1394_dma_release_camera(dc1394->handle, &dc1394->camera);
-    dc1394_destroy_handle(dc1394->handle);
-
-    return 0;
-}
-
-AVInputFormat dc1394_demuxer = {
-    .name           = "dc1394",
-    .long_name      = "dc1394 A/V grab",
-    .priv_data_size = sizeof(struct dc1394_data),
-    .read_header    = dc1394_read_header,
-    .read_packet    = dc1394_read_packet,
-    .read_close     = dc1394_close,
-    .flags          = AVFMT_NOFILE
-};
--- a/src/ffmpeg/libavformat/dv1394.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,240 +0,0 @@
-/*
- * Linux DV1394 interface
- * Copyright (c) 2003 Max Krasnyansky <maxk@qualcomm.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/poll.h>
-#include <sys/time.h>
-#include <time.h>
-
-#include "avformat.h"
-
-#undef DV1394_DEBUG
-
-#include "dv1394.h"
-#include "dv.h"
-
-struct dv1394_data {
-    int fd;
-    int channel;
-    int format;
-
-    void *ring; /* Ring buffer */
-    int index;  /* Current frame index */
-    int avail;  /* Number of frames available for reading */
-    int done;   /* Number of completed frames */
-
-    DVDemuxContext* dv_demux; /* Generic DV muxing/demuxing context */
-};
-
-/*
- * The trick here is to kludge around well known problem with kernel Ooopsing
- * when you try to capture PAL on a device node configure for NTSC. That's
- * why we have to configure the device node for PAL, and then read only NTSC
- * amount of data.
- */
-static int dv1394_reset(struct dv1394_data *dv)
-{
-    struct dv1394_init init;
-
-    init.channel     = dv->channel;
-    init.api_version = DV1394_API_VERSION;
-    init.n_frames    = DV1394_RING_FRAMES;
-    init.format      = DV1394_PAL;
-
-    if (ioctl(dv->fd, DV1394_INIT, &init) < 0)
-        return -1;
-
-    dv->avail  = dv->done = 0;
-    return 0;
-}
-
-static int dv1394_start(struct dv1394_data *dv)
-{
-    /* Tell DV1394 driver to enable receiver */
-    if (ioctl(dv->fd, DV1394_START_RECEIVE, 0) < 0) {
-        perror("Failed to start receiver");
-        return -1;
-    }
-    return 0;
-}
-
-static int dv1394_read_header(AVFormatContext * context, AVFormatParameters * ap)
-{
-    struct dv1394_data *dv = context->priv_data;
-    const char *video_device;
-
-    dv->dv_demux = dv_init_demux(context);
-    if (!dv->dv_demux)
-        goto failed;
-
-    if (ap->standard && !strcasecmp(ap->standard, "pal"))
-        dv->format = DV1394_PAL;
-    else
-        dv->format = DV1394_NTSC;
-
-    if (ap->channel)
-        dv->channel = ap->channel;
-    else
-        dv->channel = DV1394_DEFAULT_CHANNEL;
-
-    /* Open and initialize DV1394 device */
-    video_device = ap->device;
-    if (!video_device)
-        video_device = "/dev/dv1394/0";
-    dv->fd = open(video_device, O_RDONLY);
-    if (dv->fd < 0) {
-        perror("Failed to open DV interface");
-        goto failed;
-    }
-
-    if (dv1394_reset(dv) < 0) {
-        perror("Failed to initialize DV interface");
-        goto failed;
-    }
-
-    dv->ring = mmap(NULL, DV1394_PAL_FRAME_SIZE * DV1394_RING_FRAMES,
-                    PROT_READ, MAP_PRIVATE, dv->fd, 0);
-    if (dv->ring == MAP_FAILED) {
-        perror("Failed to mmap DV ring buffer");
-        goto failed;
-    }
-
-    if (dv1394_start(dv) < 0)
-        goto failed;
-
-    return 0;
-
-failed:
-    close(dv->fd);
-    return AVERROR_IO;
-}
-
-static int dv1394_read_packet(AVFormatContext *context, AVPacket *pkt)
-{
-    struct dv1394_data *dv = context->priv_data;
-    int size;
-
-    size = dv_get_packet(dv->dv_demux, pkt);
-    if (size > 0)
-        return size;
-
-    if (!dv->avail) {
-        struct dv1394_status s;
-        struct pollfd p;
-
-        if (dv->done) {
-            /* Request more frames */
-            if (ioctl(dv->fd, DV1394_RECEIVE_FRAMES, dv->done) < 0) {
-                /* This usually means that ring buffer overflowed.
-                 * We have to reset :(.
-                 */
-
-                av_log(context, AV_LOG_ERROR, "DV1394: Ring buffer overflow. Reseting ..\n");
-
-                dv1394_reset(dv);
-                dv1394_start(dv);
-            }
-            dv->done = 0;
-        }
-
-        /* Wait until more frames are available */
-restart_poll:
-        p.fd = dv->fd;
-        p.events = POLLIN | POLLERR | POLLHUP;
-        if (poll(&p, 1, -1) < 0) {
-            if (errno == EAGAIN || errno == EINTR)
-                goto restart_poll;
-            perror("Poll failed");
-            return AVERROR_IO;
-        }
-
-        if (ioctl(dv->fd, DV1394_GET_STATUS, &s) < 0) {
-            perror("Failed to get status");
-            return AVERROR_IO;
-        }
-#ifdef DV1394_DEBUG
-        av_log(context, AV_LOG_DEBUG, "DV1394: status\n"
-                "\tactive_frame\t%d\n"
-                "\tfirst_clear_frame\t%d\n"
-                "\tn_clear_frames\t%d\n"
-                "\tdropped_frames\t%d\n",
-                s.active_frame, s.first_clear_frame,
-                s.n_clear_frames, s.dropped_frames);
-#endif
-
-        dv->avail = s.n_clear_frames;
-        dv->index = s.first_clear_frame;
-        dv->done  = 0;
-
-        if (s.dropped_frames) {
-            av_log(context, AV_LOG_ERROR, "DV1394: Frame drop detected (%d). Reseting ..\n",
-                    s.dropped_frames);
-
-            dv1394_reset(dv);
-            dv1394_start(dv);
-        }
-    }
-
-#ifdef DV1394_DEBUG
-    av_log(context, AV_LOG_DEBUG, "index %d, avail %d, done %d\n", dv->index, dv->avail,
-            dv->done);
-#endif
-
-    size = dv_produce_packet(dv->dv_demux, pkt,
-                             dv->ring + (dv->index * DV1394_PAL_FRAME_SIZE),
-                             DV1394_PAL_FRAME_SIZE);
-    dv->index = (dv->index + 1) % DV1394_RING_FRAMES;
-    dv->done++; dv->avail--;
-
-    return size;
-}
-
-static int dv1394_close(AVFormatContext * context)
-{
-    struct dv1394_data *dv = context->priv_data;
-
-    /* Shutdown DV1394 receiver */
-    if (ioctl(dv->fd, DV1394_SHUTDOWN, 0) < 0)
-        perror("Failed to shutdown DV1394");
-
-    /* Unmap ring buffer */
-    if (munmap(dv->ring, DV1394_NTSC_FRAME_SIZE * DV1394_RING_FRAMES) < 0)
-        perror("Failed to munmap DV1394 ring buffer");
-
-    close(dv->fd);
-    av_free(dv->dv_demux);
-
-    return 0;
-}
-
-AVInputFormat dv1394_demuxer = {
-    .name           = "dv1394",
-    .long_name      = "dv1394 A/V grab",
-    .priv_data_size = sizeof(struct dv1394_data),
-    .read_header    = dv1394_read_header,
-    .read_packet    = dv1394_read_packet,
-    .read_close     = dv1394_close,
-    .flags          = AVFMT_NOFILE
-};
--- a/src/ffmpeg/libavformat/dv1394.h	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,357 +0,0 @@
-/*
- * dv1394.h - DV input/output over IEEE 1394 on OHCI chips
- *   Copyright (C)2001 Daniel Maas <dmaas@dcine.com>
- *     receive, proc_fs by Dan Dennedy <dan@dennedy.org>
- *
- * based on:
- *   video1394.h - driver for OHCI 1394 boards
- *   Copyright (C)1999,2000 Sebastien Rougeaux <sebastien.rougeaux@anu.edu.au>
- *                          Peter Schlaile <udbz@rz.uni-karlsruhe.de>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
-#ifndef _DV_1394_H
-#define _DV_1394_H
-
-#define DV1394_DEFAULT_CHANNEL 63
-#define DV1394_DEFAULT_CARD    0
-#define DV1394_RING_FRAMES     20
-
-#define DV1394_WIDTH  720
-#define DV1394_NTSC_HEIGHT 480
-#define DV1394_PAL_HEIGHT 576
-
-/* This is the public user-space interface. Try not to break it. */
-
-#define DV1394_API_VERSION 0x20011127
-
-/* ********************
-   **                **
-   **   DV1394 API   **
-   **                **
-   ********************
-
-   There are two methods of operating the DV1394 DV output device.
-
-   1)
-
-   The simplest is an interface based on write(): simply write
-   full DV frames of data to the device, and they will be transmitted
-   as quickly as possible. The FD may be set for non-blocking I/O,
-   in which case you can use select() or poll() to wait for output
-   buffer space.
-
-   To set the DV output parameters (e.g. whether you want NTSC or PAL
-   video), use the DV1394_INIT ioctl, passing in the parameters you
-   want in a struct dv1394_init.
-
-   Example 1:
-         To play a raw .DV file:   cat foo.DV > /dev/dv1394
-         (cat will use write() internally)
-
-   Example 2:
-           static struct dv1394_init init = {
-              0x63,        (broadcast channel)
-              4,           (four-frame ringbuffer)
-              DV1394_NTSC, (send NTSC video)
-              0, 0         (default empty packet rate)
-           }
-
-           ioctl(fd, DV1394_INIT, &init);
-
-           while(1) {
-                  read( <a raw DV file>, buf, DV1394_NTSC_FRAME_SIZE );
-                  write( <the dv1394 FD>, buf, DV1394_NTSC_FRAME_SIZE );
-           }
-
-   2)
-
-   For more control over buffering, and to avoid unnecessary copies
-   of the DV data, you can use the more sophisticated the mmap() interface.
-   First, call the DV1394_INIT ioctl to specify your parameters,
-   including the number of frames in the ringbuffer. Then, calling mmap()
-   on the dv1394 device will give you direct access to the ringbuffer
-   from which the DV card reads your frame data.
-
-   The ringbuffer is simply one large, contiguous region of memory
-   containing two or more frames of packed DV data. Each frame of DV data
-   is 120000 bytes (NTSC) or 144000 bytes (PAL).
-
-   Fill one or more frames in the ringbuffer, then use the DV1394_SUBMIT_FRAMES
-   ioctl to begin I/O. You can use either the DV1394_WAIT_FRAMES ioctl
-   or select()/poll() to wait until the frames are transmitted. Next, you'll
-   need to call the DV1394_GET_STATUS ioctl to determine which ringbuffer
-   frames are clear (ready to be filled with new DV data). Finally, use
-   DV1394_SUBMIT_FRAMES again to send the new data to the DV output.
-
-
-   Example: here is what a four-frame ringbuffer might look like
-            during DV transmission:
-
-
-         frame 0   frame 1   frame 2   frame 3
-
-        *--------------------------------------*
-        | CLEAR   | DV data | DV data | CLEAR  |
-        *--------------------------------------*
-                   <ACTIVE>
-
-        transmission goes in this direction --->>>
-
-
-   The DV hardware is currently transmitting the data in frame 1.
-   Once frame 1 is finished, it will automatically transmit frame 2.
-   (if frame 2 finishes before frame 3 is submitted, the device
-   will continue to transmit frame 2, and will increase the dropped_frames
-   counter each time it repeats the transmission).
-
-
-   If you called DV1394_GET_STATUS at this instant, you would
-   receive the following values:
-
-                  n_frames          = 4
-                  active_frame      = 1
-                  first_clear_frame = 3
-                  n_clear_frames    = 2
-
-   At this point, you should write new DV data into frame 3 and optionally
-   frame 0. Then call DV1394_SUBMIT_FRAMES to inform the device that
-   it may transmit the new frames.
-
-   ERROR HANDLING
-
-   An error (buffer underflow/overflow or a break in the DV stream due
-   to a 1394 bus reset) can be detected by checking the dropped_frames
-   field of struct dv1394_status (obtained through the
-   DV1394_GET_STATUS ioctl).
-
-   The best way to recover from such an error is to re-initialize
-   dv1394, either by using the DV1394_INIT ioctl call, or closing the
-   file descriptor and opening it again. (note that you must unmap all
-   ringbuffer mappings when closing the file descriptor, or else
-   dv1394 will still be considered 'in use').
-
-   MAIN LOOP
-
-   For maximum efficiency and robustness against bus errors, you are
-   advised to model the main loop of your application after the
-   following pseudo-code example:
-
-   (checks of system call return values omitted for brevity; always
-   check return values in your code!)
-
-   while( frames left ) {
-
-    struct pollfd *pfd = ...;
-
-    pfd->fd = dv1394_fd;
-    pfd->revents = 0;
-    pfd->events = POLLOUT | POLLIN; (OUT for transmit, IN for receive)
-
-    (add other sources of I/O here)
-
-    poll(pfd, 1, -1); (or select(); add a timeout if you want)
-
-    if(pfd->revents) {
-         struct dv1394_status status;
-
-         ioctl(dv1394_fd, DV1394_GET_STATUS, &status);
-
-         if(status.dropped_frames > 0) {
-              reset_dv1394();
-         } else {
-              for(int i = 0; i < status.n_clear_frames; i++) {
-                  copy_DV_frame();
-              }
-         }
-    }
-   }
-
-   where copy_DV_frame() reads or writes on the dv1394 file descriptor
-   (read/write mode) or copies data to/from the mmap ringbuffer and
-   then calls ioctl(DV1394_SUBMIT_FRAMES) to notify dv1394 that new
-   frames are availble (mmap mode).
-
-   reset_dv1394() is called in the event of a buffer
-   underflow/overflow or a halt in the DV stream (e.g. due to a 1394
-   bus reset). To guarantee recovery from the error, this function
-   should close the dv1394 file descriptor (and munmap() all
-   ringbuffer mappings, if you are using them), then re-open the
-   dv1394 device (and re-map the ringbuffer).
-
-*/
-
-
-/* maximum number of frames in the ringbuffer */
-#define DV1394_MAX_FRAMES 32
-
-/* number of *full* isochronous packets per DV frame */
-#define DV1394_NTSC_PACKETS_PER_FRAME 250
-#define DV1394_PAL_PACKETS_PER_FRAME  300
-
-/* size of one frame's worth of DV data, in bytes */
-#define DV1394_NTSC_FRAME_SIZE (480 * DV1394_NTSC_PACKETS_PER_FRAME)
-#define DV1394_PAL_FRAME_SIZE  (480 * DV1394_PAL_PACKETS_PER_FRAME)
-
-
-/* ioctl() commands */
-
-enum {
-        /* I don't like using 0 as a valid ioctl() */
-        DV1394_INVALID = 0,
-
-
-        /* get the driver ready to transmit video.
-           pass a struct dv1394_init* as the parameter (see below),
-           or NULL to get default parameters */
-        DV1394_INIT,
-
-
-        /* stop transmitting video and free the ringbuffer */
-        DV1394_SHUTDOWN,
-
-
-        /* submit N new frames to be transmitted, where
-           the index of the first new frame is first_clear_buffer,
-           and the index of the last new frame is
-           (first_clear_buffer + N) % n_frames */
-        DV1394_SUBMIT_FRAMES,
-
-
-        /* block until N buffers are clear (pass N as the parameter)
-           Because we re-transmit the last frame on underrun, there
-           will at most be n_frames - 1 clear frames at any time */
-        DV1394_WAIT_FRAMES,
-
-        /* capture new frames that have been received, where
-           the index of the first new frame is first_clear_buffer,
-           and the index of the last new frame is
-           (first_clear_buffer + N) % n_frames */
-        DV1394_RECEIVE_FRAMES,
-
-
-        DV1394_START_RECEIVE,
-
-
-        /* pass a struct dv1394_status* as the parameter (see below) */
-        DV1394_GET_STATUS,
-};
-
-
-
-enum pal_or_ntsc {
-        DV1394_NTSC = 0,
-        DV1394_PAL
-};
-
-
-
-
-/* this is the argument to DV1394_INIT */
-struct dv1394_init {
-        /* DV1394_API_VERSION */
-        unsigned int api_version;
-
-        /* isochronous transmission channel to use */
-        unsigned int channel;
-
-        /* number of frames in the ringbuffer. Must be at least 2
-           and at most DV1394_MAX_FRAMES. */
-        unsigned int n_frames;
-
-        /* send/receive PAL or NTSC video format */
-        enum pal_or_ntsc format;
-
-        /* the following are used only for transmission */
-
-        /* set these to zero unless you want a
-           non-default empty packet rate (see below) */
-        unsigned long cip_n;
-        unsigned long cip_d;
-
-        /* set this to zero unless you want a
-           non-default SYT cycle offset (default = 3 cycles) */
-        unsigned int syt_offset;
-};
-
-/* NOTE: you may only allocate the DV frame ringbuffer once each time
-   you open the dv1394 device. DV1394_INIT will fail if you call it a
-   second time with different 'n_frames' or 'format' arguments (which
-   would imply a different size for the ringbuffer). If you need a
-   different buffer size, simply close and re-open the device, then
-   initialize it with your new settings. */
-
-/* Q: What are cip_n and cip_d? */
-
-/*
-  A: DV video streams do not utilize 100% of the potential bandwidth offered
-  by IEEE 1394 (FireWire). To achieve the correct rate of data transmission,
-  DV devices must periodically insert empty packets into the 1394 data stream.
-  Typically there is one empty packet per 14-16 data-carrying packets.
-
-  Some DV devices will accept a wide range of empty packet rates, while others
-  require a precise rate. If the dv1394 driver produces empty packets at
-  a rate that your device does not accept, you may see ugly patterns on the
-  DV output, or even no output at all.
-
-  The default empty packet insertion rate seems to work for many people; if
-  your DV output is stable, you can simply ignore this discussion. However,
-  we have exposed the empty packet rate as a parameter to support devices that
-  do not work with the default rate.
-
-  The decision to insert an empty packet is made with a numerator/denominator
-  algorithm. Empty packets are produced at an average rate of CIP_N / CIP_D.
-  You can alter the empty packet rate by passing non-zero values for cip_n
-  and cip_d to the INIT ioctl.
-
- */
-
-
-
-struct dv1394_status {
-        /* this embedded init struct returns the current dv1394
-           parameters in use */
-        struct dv1394_init init;
-
-        /* the ringbuffer frame that is currently being
-           displayed. (-1 if the device is not transmitting anything) */
-        int active_frame;
-
-        /* index of the first buffer (ahead of active_frame) that
-           is ready to be filled with data */
-        unsigned int first_clear_frame;
-
-        /* how many buffers, including first_clear_buffer, are
-           ready to be filled with data */
-        unsigned int n_clear_frames;
-
-        /* how many times the DV stream has underflowed, overflowed,
-           or otherwise encountered an error, since the previous call
-           to DV1394_GET_STATUS */
-        unsigned int dropped_frames;
-
-        /* N.B. The dropped_frames counter is only a lower bound on the actual
-           number of dropped frames, with the special case that if dropped_frames
-           is zero, then it is guaranteed that NO frames have been dropped
-           since the last call to DV1394_GET_STATUS.
-        */
-};
-
-
-#endif /* _DV_1394_H */
--- a/src/ffmpeg/libavformat/file.c	Mon Mar 12 11:47:10 2007 -0700
+++ b/src/ffmpeg/libavformat/file.c	Mon Mar 12 13:00:06 2007 -0700
@@ -17,7 +17,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #include "avformat.h"
-#include "cutils.h"
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
--- a/src/ffmpeg/libavformat/grab_bktr.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,330 +0,0 @@
-/*
- * *BSD video grab interface
- * Copyright (c) 2002 Steve O'Hara-Smith
- * based on
- *           Linux video grab interface
- *           Copyright (c) 2000,2001 Gerard Lantau.
- * and
- *           simple_grab.c Copyright (c) 1999 Roger Hardiman
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#if defined(__FreeBSD__)
-# if __FreeBSD__ >= 502100
-#  include <dev/bktr/ioctl_meteor.h>
-#  include <dev/bktr/ioctl_bt848.h>
-# else
-#  include <machine/ioctl_meteor.h>
-#  include <machine/ioctl_bt848.h>
-# endif
-#elif defined(__FreeBSD_kernel__)
-# include <dev/bktr/ioctl_meteor.h>
-# include <dev/bktr/ioctl_bt848.h>
-#elif defined(__DragonFly__)
-# include <dev/video/meteor/ioctl_meteor.h>
-# include <dev/video/bktr/ioctl_bt848.h>
-#else
-# include <dev/ic/bt8xx.h>
-#endif
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <sys/time.h>
-#include <signal.h>
-
-typedef struct {
-    int video_fd;
-    int tuner_fd;
-    int width, height;
-    int frame_rate;
-    int frame_rate_base;
-    u_int64_t per_frame;
-} VideoData;
-
-
-#define PAL 1
-#define PALBDGHI 1
-#define NTSC 2
-#define NTSCM 2
-#define SECAM 3
-#define PALN 4
-#define PALM 5
-#define NTSCJ 6
-
-/* PAL is 768 x 576. NTSC is 640 x 480 */
-#define PAL_HEIGHT 576
-#define SECAM_HEIGHT 576
-#define NTSC_HEIGHT 480
-
-#ifndef VIDEO_FORMAT
-#define VIDEO_FORMAT NTSC
-#endif
-
-static int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2,
-    METEOR_DEV3, METEOR_DEV_SVIDEO };
-
-uint8_t *video_buf;
-size_t video_buf_size;
-u_int64_t last_frame_time;
-volatile sig_atomic_t nsignals;
-
-
-static void catchsignal(int signal)
-{
-    nsignals++;
-    return;
-}
-
-static int bktr_init(const char *video_device, int width, int height,
-    int format, int *video_fd, int *tuner_fd, int idev, double frequency)
-{
-    struct meteor_geomet geo;
-    int h_max;
-    long ioctl_frequency;
-    char *arg;
-    int c;
-    struct sigaction act, old;
-
-    if (idev < 0 || idev > 4)
-    {
-        arg = getenv ("BKTR_DEV");
-        if (arg)
-            idev = atoi (arg);
-        if (idev < 0 || idev > 4)
-            idev = 1;
-    }
-
-    if (format < 1 || format > 6)
-    {
-        arg = getenv ("BKTR_FORMAT");
-        if (arg)
-            format = atoi (arg);
-        if (format < 1 || format > 6)
-            format = VIDEO_FORMAT;
-    }
-
-    if (frequency <= 0)
-    {
-        arg = getenv ("BKTR_FREQUENCY");
-        if (arg)
-            frequency = atof (arg);
-        if (frequency <= 0)
-            frequency = 0.0;
-    }
-
-    memset(&act, 0, sizeof(act));
-    sigemptyset(&act.sa_mask);
-    act.sa_handler = catchsignal;
-    sigaction(SIGUSR1, &act, &old);
-
-    *tuner_fd = open("/dev/tuner0", O_RDONLY);
-    if (*tuner_fd < 0)
-        perror("Warning: Tuner not opened, continuing");
-
-    *video_fd = open(video_device, O_RDONLY);
-    if (*video_fd < 0) {
-        perror(video_device);
-        return -1;
-    }
-
-    geo.rows = height;
-    geo.columns = width;
-    geo.frames = 1;
-    geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12;
-
-    switch (format) {
-    case PAL:   h_max = PAL_HEIGHT;   c = BT848_IFORM_F_PALBDGHI; break;
-    case PALN:  h_max = PAL_HEIGHT;   c = BT848_IFORM_F_PALN;     break;
-    case PALM:  h_max = PAL_HEIGHT;   c = BT848_IFORM_F_PALM;     break;
-    case SECAM: h_max = SECAM_HEIGHT; c = BT848_IFORM_F_SECAM;    break;
-    case NTSC:  h_max = NTSC_HEIGHT;  c = BT848_IFORM_F_NTSCM;    break;
-    case NTSCJ: h_max = NTSC_HEIGHT;  c = BT848_IFORM_F_NTSCJ;    break;
-    default:    h_max = PAL_HEIGHT;   c = BT848_IFORM_F_PALBDGHI; break;
-    }
-
-    if (height <= h_max / 2)
-        geo.oformat |= METEOR_GEO_EVEN_ONLY;
-
-    if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) {
-        perror("METEORSETGEO");
-        return -1;
-    }
-
-    if (ioctl(*video_fd, BT848SFMT, &c) < 0) {
-        perror("BT848SFMT");
-        return -1;
-    }
-
-    c = bktr_dev[idev];
-    if (ioctl(*video_fd, METEORSINPUT, &c) < 0) {
-        perror("METEORSINPUT");
-        return -1;
-    }
-
-    video_buf_size = width * height * 12 / 8;
-
-    video_buf = (uint8_t *)mmap((caddr_t)0, video_buf_size,
-        PROT_READ, MAP_SHARED, *video_fd, (off_t)0);
-    if (video_buf == MAP_FAILED) {
-        perror("mmap");
-        return -1;
-    }
-
-    if (frequency != 0.0) {
-        ioctl_frequency  = (unsigned long)(frequency*16);
-        if (ioctl(*tuner_fd, TVTUNER_SETFREQ, &ioctl_frequency) < 0)
-            perror("TVTUNER_SETFREQ");
-    }
-
-    c = AUDIO_UNMUTE;
-    if (ioctl(*tuner_fd, BT848_SAUDIO, &c) < 0)
-        perror("TVTUNER_SAUDIO");
-
-    c = METEOR_CAP_CONTINOUS;
-    ioctl(*video_fd, METEORCAPTUR, &c);
-
-    c = SIGUSR1;
-    ioctl(*video_fd, METEORSSIGNAL, &c);
-
-    return 0;
-}
-
-static void bktr_getframe(u_int64_t per_frame)
-{
-    u_int64_t curtime;
-
-    curtime = av_gettime();
-    if (!last_frame_time
-        || ((last_frame_time + per_frame) > curtime)) {
-        if (!usleep(last_frame_time + per_frame + per_frame / 8 - curtime)) {
-            if (!nsignals)
-                av_log(NULL, AV_LOG_INFO,
-                       "SLEPT NO signals - %d microseconds late\n",
-                       (int)(av_gettime() - last_frame_time - per_frame));
-        }
-    }
-    nsignals = 0;
-    last_frame_time = curtime;
-}
-
-
-/* note: we support only one picture read at a time */
-static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    VideoData *s = s1->priv_data;
-
-    if (av_new_packet(pkt, video_buf_size) < 0)
-        return -EIO;
-
-    bktr_getframe(s->per_frame);
-
-    pkt->pts = av_gettime();
-    memcpy(pkt->data, video_buf, video_buf_size);
-
-    return video_buf_size;
-}
-
-static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
-{
-    VideoData *s = s1->priv_data;
-    AVStream *st;
-    int width, height;
-    int frame_rate;
-    int frame_rate_base;
-    int format = -1;
-    const char *video_device;
-
-    if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
-        return -1;
-
-    width = ap->width;
-    height = ap->height;
-    frame_rate = ap->time_base.den;
-    frame_rate_base = ap->time_base.num;
-
-    video_device = ap->device;
-    if (!video_device)
-        video_device = "/dev/bktr0";
-
-    st = av_new_stream(s1, 0);
-    if (!st)
-        return -ENOMEM;
-    av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in use */
-
-    s->width = width;
-    s->height = height;
-    s->frame_rate = frame_rate;
-    s->frame_rate_base = frame_rate_base;
-    s->per_frame = ((u_int64_t)1000000 * s->frame_rate_base) / s->frame_rate;
-
-    st->codec->codec_type = CODEC_TYPE_VIDEO;
-    st->codec->pix_fmt = PIX_FMT_YUV420P;
-    st->codec->codec_id = CODEC_ID_RAWVIDEO;
-    st->codec->width = width;
-    st->codec->height = height;
-    st->codec->time_base.den = frame_rate;
-    st->codec->time_base.num = frame_rate_base;
-
-    if (ap->standard) {
-        if (!strcasecmp(ap->standard, "pal"))
-            format = PAL;
-        else if (!strcasecmp(ap->standard, "secam"))
-            format = SECAM;
-        else if (!strcasecmp(ap->standard, "ntsc"))
-            format = NTSC;
-    }
-
-    if (bktr_init(video_device, width, height, format,
-            &(s->video_fd), &(s->tuner_fd), -1, 0.0) < 0)
-        return -EIO;
-
-    nsignals = 0;
-    last_frame_time = 0;
-
-    return 0;
-}
-
-static int grab_read_close(AVFormatContext *s1)
-{
-    VideoData *s = s1->priv_data;
-    int c;
-
-    c = METEOR_CAP_STOP_CONT;
-    ioctl(s->video_fd, METEORCAPTUR, &c);
-    close(s->video_fd);
-
-    c = AUDIO_MUTE;
-    ioctl(s->tuner_fd, BT848_SAUDIO, &c);
-    close(s->tuner_fd);
-
-    munmap((caddr_t)video_buf, video_buf_size);
-
-    return 0;
-}
-
-AVInputFormat video_grab_device_demuxer = {
-    "bktr",
-    "video grab",
-     sizeof(VideoData),
-     NULL,
-    grab_read_header,
-    grab_read_packet,
-    grab_read_close,
-    .flags = AVFMT_NOFILE,
-};
--- a/src/ffmpeg/libavformat/rtp.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,876 +0,0 @@
-/*
- * RTP input/output format
- * Copyright (c) 2002 Fabrice Bellard.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include "mpegts.h"
-#include "bitstream.h"
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#ifndef __BEOS__
-# include <arpa/inet.h>
-#else
-# include "barpainet.h"
-#endif
-#include <netdb.h>
-
-//#define DEBUG
-
-
-/* TODO: - add RTCP statistics reporting (should be optional).
-
-         - add support for h263/mpeg4 packetized output : IDEA: send a
-         buffer to 'rtp_write_packet' contains all the packets for ONE
-         frame. Each packet should have a four byte header containing
-         the length in big endian format (same trick as
-         'url_open_dyn_packet_buf')
-*/
-
-/* from http://www.iana.org/assignments/rtp-parameters last updated 05 January 2005 */
-AVRtpPayloadType_t AVRtpPayloadTypes[]=
-{
-  {0, "PCMU",        CODEC_TYPE_AUDIO,   CODEC_ID_PCM_MULAW, 8000, 1},
-  {1, "Reserved",    CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {2, "Reserved",    CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {3, "GSM",         CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {4, "G723",        CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {5, "DVI4",        CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {6, "DVI4",        CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 16000, 1},
-  {7, "LPC",         CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {8, "PCMA",        CODEC_TYPE_AUDIO,   CODEC_ID_PCM_ALAW, 8000, 1},
-  {9, "G722",        CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {10, "L16",        CODEC_TYPE_AUDIO,   CODEC_ID_PCM_S16BE, 44100, 2},
-  {11, "L16",        CODEC_TYPE_AUDIO,   CODEC_ID_PCM_S16BE, 44100, 1},
-  {12, "QCELP",      CODEC_TYPE_AUDIO,   CODEC_ID_QCELP, 8000, 1},
-  {13, "CN",         CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {14, "MPA",        CODEC_TYPE_AUDIO,   CODEC_ID_MP2, 90000, -1},
-  {15, "G728",       CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {16, "DVI4",       CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 11025, 1},
-  {17, "DVI4",       CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 22050, 1},
-  {18, "G729",       CODEC_TYPE_AUDIO,   CODEC_ID_NONE, 8000, 1},
-  {19, "reserved",   CODEC_TYPE_AUDIO,   CODEC_ID_NONE, -1, -1},
-  {20, "unassigned", CODEC_TYPE_AUDIO,   CODEC_ID_NONE, -1, -1},
-  {21, "unassigned", CODEC_TYPE_AUDIO,   CODEC_ID_NONE, -1, -1},
-  {22, "unassigned", CODEC_TYPE_AUDIO,   CODEC_ID_NONE, -1, -1},
-  {23, "unassigned", CODEC_TYPE_AUDIO,   CODEC_ID_NONE, -1, -1},
-  {24, "unassigned", CODEC_TYPE_VIDEO,   CODEC_ID_NONE, -1, -1},
-  {25, "CelB",       CODEC_TYPE_VIDEO,   CODEC_ID_NONE, 90000, -1},
-  {26, "JPEG",       CODEC_TYPE_VIDEO,   CODEC_ID_MJPEG, 90000, -1},
-  {27, "unassigned", CODEC_TYPE_VIDEO,   CODEC_ID_NONE, -1, -1},
-  {28, "nv",         CODEC_TYPE_VIDEO,   CODEC_ID_NONE, 90000, -1},
-  {29, "unassigned", CODEC_TYPE_VIDEO,   CODEC_ID_NONE, -1, -1},
-  {30, "unassigned", CODEC_TYPE_VIDEO,   CODEC_ID_NONE, -1, -1},
-  {31, "H261",       CODEC_TYPE_VIDEO,   CODEC_ID_H261, 90000, -1},
-  {32, "MPV",        CODEC_TYPE_VIDEO,   CODEC_ID_MPEG1VIDEO, 90000, -1},
-  {33, "MP2T",       CODEC_TYPE_DATA,    CODEC_ID_MPEG2TS, 90000, -1},
-  {34, "H263",       CODEC_TYPE_VIDEO,   CODEC_ID_H263, 90000, -1},
-  {35, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {36, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {37, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {38, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {39, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {40, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {41, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {42, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {43, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {44, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {45, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {46, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {47, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {48, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {49, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {50, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {51, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {52, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {53, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {54, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {55, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {56, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {57, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {58, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {59, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {60, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {61, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {62, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {63, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {64, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {65, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {66, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {67, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {68, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {69, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {70, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {71, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {72, "reserved for RTCP conflict avoidance", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {73, "reserved for RTCP conflict avoidance", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {74, "reserved for RTCP conflict avoidance", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {75, "reserved for RTCP conflict avoidance", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {76, "reserved for RTCP conflict avoidance", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {77, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {78, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {79, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {80, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {81, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {82, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {83, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {84, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {85, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {86, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {87, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {88, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {89, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {90, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {91, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {92, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {93, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {94, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {95, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {96, "dynamic",    CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {97, "dynamic",    CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {98, "dynamic",    CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {99, "dynamic",    CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {100, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {101, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {102, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {103, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {104, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {105, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {106, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {107, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {108, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {109, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {110, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {111, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {112, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {113, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {114, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {115, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {116, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {117, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {118, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {119, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {120, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {121, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {122, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {123, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {124, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {125, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {126, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {127, "dynamic",   CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1},
-  {-1, "",           CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1}
-};
-
-AVRtpDynamicPayloadType_t AVRtpDynamicPayloadTypes[]=
-{
-    {"MP4V-ES", CODEC_TYPE_VIDEO, CODEC_ID_MPEG4},
-    {"mpeg4-generic", CODEC_TYPE_AUDIO, CODEC_ID_MPEG4AAC},
-    {"", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE}
-};
-
-struct RTPDemuxContext {
-    AVFormatContext *ic;
-    AVStream *st;
-    int payload_type;
-    uint32_t ssrc;
-    uint16_t seq;
-    uint32_t timestamp;
-    uint32_t base_timestamp;
-    uint32_t cur_timestamp;
-    int max_payload_size;
-    MpegTSContext *ts; /* only used for MP2T payloads */
-    int read_buf_index;
-    int read_buf_size;
-
-    /* rtcp sender statistics receive */
-    int64_t last_rtcp_ntp_time;
-    int64_t first_rtcp_ntp_time;
-    uint32_t last_rtcp_timestamp;
-    /* rtcp sender statistics */
-    unsigned int packet_count;
-    unsigned int octet_count;
-    unsigned int last_octet_count;
-    int first_packet;
-    /* buffer for output */
-    uint8_t buf[RTP_MAX_PACKET_LENGTH];
-    uint8_t *buf_ptr;
-    /* special infos for au headers parsing */
-    rtp_payload_data_t *rtp_payload_data;
-};
-
-int rtp_get_codec_info(AVCodecContext *codec, int payload_type)
-{
-    if (AVRtpPayloadTypes[payload_type].codec_id != CODEC_ID_NONE) {
-        codec->codec_type = AVRtpPayloadTypes[payload_type].codec_type;
-        codec->codec_id = AVRtpPayloadTypes[payload_type].codec_id;
-        if (AVRtpPayloadTypes[payload_type].audio_channels > 0)
-            codec->channels = AVRtpPayloadTypes[payload_type].audio_channels;
-        if (AVRtpPayloadTypes[payload_type].clock_rate > 0)
-            codec->sample_rate = AVRtpPayloadTypes[payload_type].clock_rate;
-        return 0;
-    }
-    return -1;
-}
-
-/* return < 0 if unknown payload type */
-int rtp_get_payload_type(AVCodecContext *codec)
-{
-    int i, payload_type;
-
-    /* compute the payload type */
-    for (payload_type = -1, i = 0; AVRtpPayloadTypes[i].pt >= 0; ++i)
-        if (AVRtpPayloadTypes[i].codec_id == codec->codec_id) {
-            if (codec->codec_id == CODEC_ID_PCM_S16BE)
-                if (codec->channels != AVRtpPayloadTypes[i].audio_channels)
-                    continue;
-            payload_type = AVRtpPayloadTypes[i].pt;
-        }
-    return payload_type;
-}
-
-static inline uint32_t decode_be32(const uint8_t *p)
-{
-    return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
-}
-
-static inline uint64_t decode_be64(const uint8_t *p)
-{
-    return ((uint64_t)decode_be32(p) << 32) | decode_be32(p + 4);
-}
-
-static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int len)
-{
-    if (buf[1] != 200)
-        return -1;
-    s->last_rtcp_ntp_time = decode_be64(buf + 8);
-    if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE)
-        s->first_rtcp_ntp_time = s->last_rtcp_ntp_time;
-    s->last_rtcp_timestamp = decode_be32(buf + 16);
-    return 0;
-}
-
-/**
- * open a new RTP parse context for stream 'st'. 'st' can be NULL for
- * MPEG2TS streams to indicate that they should be demuxed inside the
- * rtp demux (otherwise CODEC_ID_MPEG2TS packets are returned)
- */
-RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, int payload_type, rtp_payload_data_t *rtp_payload_data)
-{
-    RTPDemuxContext *s;
-
-    s = av_mallocz(sizeof(RTPDemuxContext));
-    if (!s)
-        return NULL;
-    s->payload_type = payload_type;
-    s->last_rtcp_ntp_time = AV_NOPTS_VALUE;
-    s->first_rtcp_ntp_time = AV_NOPTS_VALUE;
-    s->ic = s1;
-    s->st = st;
-    s->rtp_payload_data = rtp_payload_data;
-    if (!strcmp(AVRtpPayloadTypes[payload_type].enc_name, "MP2T")) {
-        s->ts = mpegts_parse_open(s->ic);
-        if (s->ts == NULL) {
-            av_free(s);
-            return NULL;
-        }
-    } else {
-        switch(st->codec->codec_id) {
-        case CODEC_ID_MPEG1VIDEO:
-        case CODEC_ID_MPEG2VIDEO:
-        case CODEC_ID_MP2:
-        case CODEC_ID_MP3:
-        case CODEC_ID_MPEG4:
-            st->need_parsing = 1;
-            break;
-        default:
-            break;
-        }
-    }
-    return s;
-}
-
-static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
-{
-    int au_headers_length, au_header_size, i;
-    GetBitContext getbitcontext;
-    rtp_payload_data_t *infos;
-
-    infos = s->rtp_payload_data;
-
-    if (infos == NULL)
-        return -1;
-
-    /* decode the first 2 bytes where are stored the AUHeader sections
-       length in bits */
-    au_headers_length = BE_16(buf);
-
-    if (au_headers_length > RTP_MAX_PACKET_LENGTH)
-      return -1;
-
-    infos->au_headers_length_bytes = (au_headers_length + 7) / 8;
-
-    /* skip AU headers length section (2 bytes) */
-    buf += 2;
-
-    init_get_bits(&getbitcontext, buf, infos->au_headers_length_bytes * 8);
-
-    /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */
-    au_header_size = infos->sizelength + infos->indexlength;
-    if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
-        return -1;
-
-    infos->nb_au_headers = au_headers_length / au_header_size;
-    infos->au_headers = av_malloc(sizeof(struct AUHeaders) * infos->nb_au_headers);
-
-    /* XXX: We handle multiple AU Section as only one (need to fix this for interleaving)
-       In my test, the faad decoder doesnt behave correctly when sending each AU one by one
-       but does when sending the whole as one big packet...  */
-    infos->au_headers[0].size = 0;
-    infos->au_headers[0].index = 0;
-    for (i = 0; i < infos->nb_au_headers; ++i) {
-        infos->au_headers[0].size += get_bits_long(&getbitcontext, infos->sizelength);
-        infos->au_headers[0].index = get_bits_long(&getbitcontext, infos->indexlength);
-    }
-
-    infos->nb_au_headers = 1;
-
-    return 0;
-}
-
-/**
- * Parse an RTP or RTCP packet directly sent as a buffer.
- * @param s RTP parse context.
- * @param pkt returned packet
- * @param buf input buffer or NULL to read the next packets
- * @param len buffer len
- * @return 0 if a packet is returned, 1 if a packet is returned and more can follow
- * (use buf as NULL to read the next). -1 if no packet (error or no more packet).
- */
-int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
-                     const uint8_t *buf, int len)
-{
-    unsigned int ssrc, h;
-    int payload_type, seq, delta_timestamp, ret;
-    AVStream *st;
-    uint32_t timestamp;
-
-    if (!buf) {
-        /* return the next packets, if any */
-        if (s->read_buf_index >= s->read_buf_size)
-            return -1;
-        ret = mpegts_parse_packet(s->ts, pkt, s->buf + s->read_buf_index,
-                                  s->read_buf_size - s->read_buf_index);
-        if (ret < 0)
-            return -1;
-        s->read_buf_index += ret;
-        if (s->read_buf_index < s->read_buf_size)
-            return 1;
-        else
-            return 0;
-    }
-
-    if (len < 12)
-        return -1;
-
-    if ((buf[0] & 0xc0) != (RTP_VERSION << 6))
-        return -1;
-    if (buf[1] >= 200 && buf[1] <= 204) {
-        rtcp_parse_packet(s, buf, len);
-        return -1;
-    }
-    payload_type = buf[1] & 0x7f;
-    seq  = (buf[2] << 8) | buf[3];
-    timestamp = decode_be32(buf + 4);
-    ssrc = decode_be32(buf + 8);
-
-    /* NOTE: we can handle only one payload type */
-    if (s->payload_type != payload_type)
-        return -1;
-
-    st = s->st;
-#if defined(DEBUG) || 1
-    if (seq != ((s->seq + 1) & 0xffff)) {
-        av_log(st?st->codec:NULL, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n",
-               payload_type, seq, ((s->seq + 1) & 0xffff));
-    }
-#endif
-    s->seq = seq;
-    len -= 12;
-    buf += 12;
-
-    if (!st) {
-        /* specific MPEG2TS demux support */
-        ret = mpegts_parse_packet(s->ts, pkt, buf, len);
-        if (ret < 0)
-            return -1;
-        if (ret < len) {
-            s->read_buf_size = len - ret;
-            memcpy(s->buf, buf + ret, s->read_buf_size);
-            s->read_buf_index = 0;
-            return 1;
-        }
-    } else {
-        switch(st->codec->codec_id) {
-        case CODEC_ID_MP2:
-            /* better than nothing: skip mpeg audio RTP header */
-            if (len <= 4)
-                return -1;
-            h = decode_be32(buf);
-            len -= 4;
-            buf += 4;
-            av_new_packet(pkt, len);
-            memcpy(pkt->data, buf, len);
-            break;
-        case CODEC_ID_MPEG1VIDEO:
-            /* better than nothing: skip mpeg video RTP header */
-            if (len <= 4)
-                return -1;
-            h = decode_be32(buf);
-            buf += 4;
-            len -= 4;
-            if (h & (1 << 26)) {
-                /* mpeg2 */
-                if (len <= 4)
-                    return -1;
-                buf += 4;
-                len -= 4;
-            }
-            av_new_packet(pkt, len);
-            memcpy(pkt->data, buf, len);
-            break;
-        default:
-            av_new_packet(pkt, len);
-            memcpy(pkt->data, buf, len);
-            break;
-        }
-
-        switch(st->codec->codec_id) {
-        case CODEC_ID_MP2:
-        case CODEC_ID_MPEG1VIDEO:
-            if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) {
-                int64_t addend;
-                /* XXX: is it really necessary to unify the timestamp base ? */
-                /* compute pts from timestamp with received ntp_time */
-                delta_timestamp = timestamp - s->last_rtcp_timestamp;
-                /* convert to 90 kHz without overflow */
-                addend = (s->last_rtcp_ntp_time - s->first_rtcp_ntp_time) >> 14;
-                addend = (addend * 5625) >> 14;
-                pkt->pts = addend + delta_timestamp;
-            }
-            break;
-        case CODEC_ID_MPEG4:
-            pkt->pts = timestamp;
-            break;
-        case CODEC_ID_MPEG4AAC:
-            if (rtp_parse_mp4_au(s, buf))
-              return -1;
-            {
-            rtp_payload_data_t *infos = s->rtp_payload_data;
-            if (infos == NULL)
-                return -1;
-            buf += infos->au_headers_length_bytes + 2;
-            len -= infos->au_headers_length_bytes + 2;
-
-            /* XXX: Fixme we only handle the case where rtp_parse_mp4_au define
-               one au_header */
-            av_new_packet(pkt, infos->au_headers[0].size);
-            memcpy(pkt->data, buf, infos->au_headers[0].size);
-            buf += infos->au_headers[0].size;
-            len -= infos->au_headers[0].size;
-            }
-            s->read_buf_size = len;
-            s->buf_ptr = buf;
-            pkt->stream_index = s->st->index;
-            return 0;
-        default:
-            /* no timestamp info yet */
-            break;
-        }
-        pkt->stream_index = s->st->index;
-    }
-    return 0;
-}
-
-void rtp_parse_close(RTPDemuxContext *s)
-{
-    if (!strcmp(AVRtpPayloadTypes[s->payload_type].enc_name, "MP2T")) {
-        mpegts_parse_close(s->ts);
-    }
-    av_free(s);
-}
-
-/* rtp output */
-
-static int rtp_write_header(AVFormatContext *s1)
-{
-    RTPDemuxContext *s = s1->priv_data;
-    int payload_type, max_packet_size, n;
-    AVStream *st;
-
-    if (s1->nb_streams != 1)
-        return -1;
-    st = s1->streams[0];
-
-    payload_type = rtp_get_payload_type(st->codec);
-    if (payload_type < 0)
-        payload_type = RTP_PT_PRIVATE; /* private payload type */
-    s->payload_type = payload_type;
-
-// following 2 FIXMies could be set based on the current time, theres normaly no info leak, as rtp will likely be transmitted immedeatly
-    s->base_timestamp = 0; /* FIXME: was random(), what should this be? */
-    s->timestamp = s->base_timestamp;
-    s->ssrc = 0; /* FIXME: was random(), what should this be? */
-    s->first_packet = 1;
-
-    max_packet_size = url_fget_max_packet_size(&s1->pb);
-    if (max_packet_size <= 12)
-        return AVERROR_IO;
-    s->max_payload_size = max_packet_size - 12;
-
-    switch(st->codec->codec_id) {
-    case CODEC_ID_MP2:
-    case CODEC_ID_MP3:
-        s->buf_ptr = s->buf + 4;
-        s->cur_timestamp = 0;
-        break;
-    case CODEC_ID_MPEG1VIDEO:
-        s->cur_timestamp = 0;
-        break;
-    case CODEC_ID_MPEG2TS:
-        n = s->max_payload_size / TS_PACKET_SIZE;
-        if (n < 1)
-            n = 1;
-        s->max_payload_size = n * TS_PACKET_SIZE;
-        s->buf_ptr = s->buf;
-        break;
-    default:
-        s->buf_ptr = s->buf;
-        break;
-    }
-
-    return 0;
-}
-
-/* send an rtcp sender report packet */
-static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time)
-{
-    RTPDemuxContext *s = s1->priv_data;
-#if defined(DEBUG)
-    printf("RTCP: %02x %Lx %x\n", s->payload_type, ntp_time, s->timestamp);
-#endif
-    put_byte(&s1->pb, (RTP_VERSION << 6));
-    put_byte(&s1->pb, 200);
-    put_be16(&s1->pb, 6); /* length in words - 1 */
-    put_be32(&s1->pb, s->ssrc);
-    put_be64(&s1->pb, ntp_time);
-    put_be32(&s1->pb, s->timestamp);
-    put_be32(&s1->pb, s->packet_count);
-    put_be32(&s1->pb, s->octet_count);
-    put_flush_packet(&s1->pb);
-}
-
-/* send an rtp packet. sequence number is incremented, but the caller
-   must update the timestamp itself */
-static void rtp_send_data(AVFormatContext *s1, const uint8_t *buf1, int len, int m)
-{
-    RTPDemuxContext *s = s1->priv_data;
-
-#ifdef DEBUG
-    printf("rtp_send_data size=%d\n", len);
-#endif
-
-    /* build the RTP header */
-    put_byte(&s1->pb, (RTP_VERSION << 6));
-    put_byte(&s1->pb, (s->payload_type & 0x7f) | ((m & 0x01) << 7));
-    put_be16(&s1->pb, s->seq);
-    put_be32(&s1->pb, s->timestamp);
-    put_be32(&s1->pb, s->ssrc);
-
-    put_buffer(&s1->pb, buf1, len);
-    put_flush_packet(&s1->pb);
-
-    s->seq++;
-    s->octet_count += len;
-    s->packet_count++;
-}
-
-/* send an integer number of samples and compute time stamp and fill
-   the rtp send buffer before sending. */
-static void rtp_send_samples(AVFormatContext *s1,
-                             const uint8_t *buf1, int size, int sample_size)
-{
-    RTPDemuxContext *s = s1->priv_data;
-    int len, max_packet_size, n;
-
-    max_packet_size = (s->max_payload_size / sample_size) * sample_size;
-    /* not needed, but who nows */
-    if ((size % sample_size) != 0)
-        av_abort();
-    while (size > 0) {
-        len = (max_packet_size - (s->buf_ptr - s->buf));
-        if (len > size)
-            len = size;
-
-        /* copy data */
-        memcpy(s->buf_ptr, buf1, len);
-        s->buf_ptr += len;
-        buf1 += len;
-        size -= len;
-        n = (s->buf_ptr - s->buf);
-        /* if buffer full, then send it */
-        if (n >= max_packet_size) {
-            rtp_send_data(s1, s->buf, n, 0);
-            s->buf_ptr = s->buf;
-            /* update timestamp */
-            s->timestamp += n / sample_size;
-        }
-    }
-}
-
-/* NOTE: we suppose that exactly one frame is given as argument here */
-/* XXX: test it */
-static void rtp_send_mpegaudio(AVFormatContext *s1,
-                               const uint8_t *buf1, int size)
-{
-    RTPDemuxContext *s = s1->priv_data;
-    AVStream *st = s1->streams[0];
-    int len, count, max_packet_size;
-
-    max_packet_size = s->max_payload_size;
-
-    /* test if we must flush because not enough space */
-    len = (s->buf_ptr - s->buf);
-    if ((len + size) > max_packet_size) {
-        if (len > 4) {
-            rtp_send_data(s1, s->buf, s->buf_ptr - s->buf, 0);
-            s->buf_ptr = s->buf + 4;
-            /* 90 KHz time stamp */
-            s->timestamp = s->base_timestamp +
-                (s->cur_timestamp * 90000LL) / st->codec->sample_rate;
-        }
-    }
-
-    /* add the packet */
-    if (size > max_packet_size) {
-        /* big packet: fragment */
-        count = 0;
-        while (size > 0) {
-            len = max_packet_size - 4;
-            if (len > size)
-                len = size;
-            /* build fragmented packet */
-            s->buf[0] = 0;
-            s->buf[1] = 0;
-            s->buf[2] = count >> 8;
-            s->buf[3] = count;
-            memcpy(s->buf + 4, buf1, len);
-            rtp_send_data(s1, s->buf, len + 4, 0);
-            size -= len;
-            buf1 += len;
-            count += len;
-        }
-    } else {
-        if (s->buf_ptr == s->buf + 4) {
-            /* no fragmentation possible */
-            s->buf[0] = 0;
-            s->buf[1] = 0;
-            s->buf[2] = 0;
-            s->buf[3] = 0;
-        }
-        memcpy(s->buf_ptr, buf1, size);
-        s->buf_ptr += size;
-    }
-    s->cur_timestamp += st->codec->frame_size;
-}
-
-/* NOTE: a single frame must be passed with sequence header if
-   needed. XXX: use slices. */
-static void rtp_send_mpegvideo(AVFormatContext *s1,
-                               const uint8_t *buf1, int size)
-{
-    RTPDemuxContext *s = s1->priv_data;
-    AVStream *st = s1->streams[0];
-    int len, h, max_packet_size;
-    uint8_t *q;
-
-    max_packet_size = s->max_payload_size;
-
-    while (size > 0) {
-        /* XXX: more correct headers */
-        h = 0;
-        if (st->codec->sub_id == 2)
-            h |= 1 << 26; /* mpeg 2 indicator */
-        q = s->buf;
-        *q++ = h >> 24;
-        *q++ = h >> 16;
-        *q++ = h >> 8;
-        *q++ = h;
-
-        if (st->codec->sub_id == 2) {
-            h = 0;
-            *q++ = h >> 24;
-            *q++ = h >> 16;
-            *q++ = h >> 8;
-            *q++ = h;
-        }
-
-        len = max_packet_size - (q - s->buf);
-        if (len > size)
-            len = size;
-
-        memcpy(q, buf1, len);
-        q += len;
-
-        /* 90 KHz time stamp */
-        s->timestamp = s->base_timestamp +
-            av_rescale((int64_t)s->cur_timestamp * st->codec->time_base.num, 90000, st->codec->time_base.den); //FIXME pass timestamps
-        rtp_send_data(s1, s->buf, q - s->buf, (len == size));
-
-        buf1 += len;
-        size -= len;
-    }
-    s->cur_timestamp++;
-}
-
-static void rtp_send_raw(AVFormatContext *s1,
-                         const uint8_t *buf1, int size)
-{
-    RTPDemuxContext *s = s1->priv_data;
-    AVStream *st = s1->streams[0];
-    int len, max_packet_size;
-
-    max_packet_size = s->max_payload_size;
-
-    while (size > 0) {
-        len = max_packet_size;
-        if (len > size)
-            len = size;
-
-        /* 90 KHz time stamp */
-        s->timestamp = s->base_timestamp +
-            av_rescale((int64_t)s->cur_timestamp * st->codec->time_base.num, 90000, st->codec->time_base.den); //FIXME pass timestamps
-        rtp_send_data(s1, buf1, len, (len == size));
-
-        buf1 += len;
-        size -= len;
-    }
-    s->cur_timestamp++;
-}
-
-/* NOTE: size is assumed to be an integer multiple of TS_PACKET_SIZE */
-static void rtp_send_mpegts_raw(AVFormatContext *s1,
-                                const uint8_t *buf1, int size)
-{
-    RTPDemuxContext *s = s1->priv_data;
-    int len, out_len;
-
-    while (size >= TS_PACKET_SIZE) {
-        len = s->max_payload_size - (s->buf_ptr - s->buf);
-        if (len > size)
-            len = size;
-        memcpy(s->buf_ptr, buf1, len);
-        buf1 += len;
-        size -= len;
-        s->buf_ptr += len;
-
-        out_len = s->buf_ptr - s->buf;
-        if (out_len >= s->max_payload_size) {
-            rtp_send_data(s1, s->buf, out_len, 0);
-            s->buf_ptr = s->buf;
-        }
-    }
-}
-
-/* write an RTP packet. 'buf1' must contain a single specific frame. */
-static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
-{
-    RTPDemuxContext *s = s1->priv_data;
-    AVStream *st = s1->streams[0];
-    int rtcp_bytes;
-    int64_t ntp_time;
-    int size= pkt->size;
-    uint8_t *buf1= pkt->data;
-
-#ifdef DEBUG
-    printf("%d: write len=%d\n", pkt->stream_index, size);
-#endif
-
-    /* XXX: mpeg pts hardcoded. RTCP send every 0.5 seconds */
-    rtcp_bytes = ((s->octet_count - s->last_octet_count) * RTCP_TX_RATIO_NUM) /
-        RTCP_TX_RATIO_DEN;
-    if (s->first_packet || rtcp_bytes >= 28) {
-        /* compute NTP time */
-        /* XXX: 90 kHz timestamp hardcoded */
-        ntp_time = (pkt->pts << 28) / 5625;
-        rtcp_send_sr(s1, ntp_time);
-        s->last_octet_count = s->octet_count;
-        s->first_packet = 0;
-    }
-
-    switch(st->codec->codec_id) {
-    case CODEC_ID_PCM_MULAW:
-    case CODEC_ID_PCM_ALAW:
-    case CODEC_ID_PCM_U8:
-    case CODEC_ID_PCM_S8:
-        rtp_send_samples(s1, buf1, size, 1 * st->codec->channels);
-        break;
-    case CODEC_ID_PCM_U16BE:
-    case CODEC_ID_PCM_U16LE:
-    case CODEC_ID_PCM_S16BE:
-    case CODEC_ID_PCM_S16LE:
-        rtp_send_samples(s1, buf1, size, 2 * st->codec->channels);
-        break;
-    case CODEC_ID_MP2:
-    case CODEC_ID_MP3:
-        rtp_send_mpegaudio(s1, buf1, size);
-        break;
-    case CODEC_ID_MPEG1VIDEO:
-        rtp_send_mpegvideo(s1, buf1, size);
-        break;
-    case CODEC_ID_MPEG2TS:
-        rtp_send_mpegts_raw(s1, buf1, size);
-        break;
-    default:
-        /* better than nothing : send the codec raw data */
-        rtp_send_raw(s1, buf1, size);
-        break;
-    }
-    return 0;
-}
-
-static int rtp_write_trailer(AVFormatContext *s1)
-{
-    //    RTPDemuxContext *s = s1->priv_data;
-    return 0;
-}
-
-AVOutputFormat rtp_muxer = {
-    "rtp",
-    "RTP output format",
-    NULL,
-    NULL,
-    sizeof(RTPDemuxContext),
-    CODEC_ID_PCM_MULAW,
-    CODEC_ID_NONE,
-    rtp_write_header,
-    rtp_write_packet,
-    rtp_write_trailer,
-};
--- a/src/ffmpeg/libavformat/rtp.h	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/*
- * RTP definitions
- * Copyright (c) 2002 Fabrice Bellard.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef RTP_H
-#define RTP_H
-
-#define RTP_MIN_PACKET_LENGTH 12
-#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
-
-int rtp_init(void);
-int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
-int rtp_get_payload_type(AVCodecContext *codec);
-
-typedef struct RTPDemuxContext RTPDemuxContext;
-typedef struct rtp_payload_data_s rtp_payload_data_s;
-RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, int payload_type, rtp_payload_data_s *rtp_payload_data);
-int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
-                     const uint8_t *buf, int len);
-void rtp_parse_close(RTPDemuxContext *s);
-
-extern AVOutputFormat rtp_muxer;
-extern AVInputFormat rtp_demuxer;
-
-int rtp_get_local_port(URLContext *h);
-int rtp_set_remote_url(URLContext *h, const char *uri);
-void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
-
-extern URLProtocol rtp_protocol;
-
-#define RTP_PT_PRIVATE 96
-#define RTP_VERSION 2
-#define RTP_MAX_SDES 256   /* maximum text length for SDES */
-
-/* RTCP paquets use 0.5 % of the bandwidth */
-#define RTCP_TX_RATIO_NUM 5
-#define RTCP_TX_RATIO_DEN 1000
-
-/* Structure listing usefull vars to parse RTP packet payload*/
-typedef struct rtp_payload_data_s
-{
-    int sizelength;
-    int indexlength;
-    int indexdeltalength;
-    int profile_level_id;
-    int streamtype;
-    int objecttype;
-    char *mode;
-
-    /* mpeg 4 AU headers */
-    struct AUHeaders {
-        int size;
-        int index;
-        int cts_flag;
-        int cts;
-        int dts_flag;
-        int dts;
-        int rap_flag;
-        int streamstate;
-    } *au_headers;
-    int nb_au_headers;
-    int au_headers_length_bytes;
-    int cur_au_index;
-} rtp_payload_data_t;
-
-typedef struct AVRtpPayloadType_s
-{
-    int pt;
-    const char enc_name[50]; /* XXX: why 50 ? */
-    enum CodecType codec_type;
-    enum CodecID codec_id;
-    int clock_rate;
-    int audio_channels;
-} AVRtpPayloadType_t;
-
-typedef struct AVRtpDynamicPayloadType_s /* payload type >= 96 */
-{
-    const char enc_name[50]; /* XXX: still why 50 ? ;-) */
-    enum CodecType codec_type;
-    enum CodecID codec_id;
-} AVRtpDynamicPayloadType_t;
-
-#if 0
-typedef enum {
-  RTCP_SR   = 200,
-  RTCP_RR   = 201,
-  RTCP_SDES = 202,
-  RTCP_BYE  = 203,
-  RTCP_APP  = 204
-} rtcp_type_t;
-
-typedef enum {
-  RTCP_SDES_END    =  0,
-  RTCP_SDES_CNAME  =  1,
-  RTCP_SDES_NAME   =  2,
-  RTCP_SDES_EMAIL  =  3,
-  RTCP_SDES_PHONE  =  4,
-  RTCP_SDES_LOC    =  5,
-  RTCP_SDES_TOOL   =  6,
-  RTCP_SDES_NOTE   =  7,
-  RTCP_SDES_PRIV   =  8,
-  RTCP_SDES_IMG    =  9,
-  RTCP_SDES_DOOR   = 10,
-  RTCP_SDES_SOURCE = 11
-} rtcp_sdes_type_t;
-#endif
-
-extern AVRtpPayloadType_t AVRtpPayloadTypes[];
-extern AVRtpDynamicPayloadType_t AVRtpDynamicPayloadTypes[];
-
-#endif /* RTP_H */
--- a/src/ffmpeg/libavformat/tcp.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +0,0 @@
-/*
- * TCP protocol
- * Copyright (c) 2002 Fabrice Bellard.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#if defined(__BEOS__) || defined(__INNOTEK_LIBC__)
-typedef int socklen_t;
-#endif
-#ifndef __BEOS__
-# include <arpa/inet.h>
-#else
-# include "barpainet.h"
-#endif
-#include <netdb.h>
-#include <sys/time.h>
-#include <fcntl.h>
-
-typedef struct TCPContext {
-    int fd;
-} TCPContext;
-
-/* resolve host with also IP address parsing */
-int resolve_host(struct in_addr *sin_addr, const char *hostname)
-{
-    struct hostent *hp;
-
-    if ((inet_aton(hostname, sin_addr)) == 0) {
-        hp = gethostbyname(hostname);
-        if (!hp)
-            return -1;
-        memcpy (sin_addr, hp->h_addr, sizeof(struct in_addr));
-    }
-    return 0;
-}
-
-/* return non zero if error */
-static int tcp_open(URLContext *h, const char *uri, int flags)
-{
-    struct sockaddr_in dest_addr;
-    char hostname[1024], *q;
-    int port, fd = -1;
-    TCPContext *s = NULL;
-    fd_set wfds;
-    int fd_max, ret;
-    struct timeval tv;
-    socklen_t optlen;
-    char proto[1024],path[1024],tmp[1024];  // PETR: protocol and path strings
-
-    url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
-      &port, path, sizeof(path), uri);  // PETR: use url_split
-    if (strcmp(proto,"tcp")) goto fail; // PETR: check protocol
-    if ((q = strchr(hostname,'@'))) { strcpy(tmp,q+1); strcpy(hostname,tmp); } // PETR: take only the part after '@' for tcp protocol
-
-    s = av_malloc(sizeof(TCPContext));
-    if (!s)
-        return -ENOMEM;
-    h->priv_data = s;
-
-    if (port <= 0 || port >= 65536)
-        goto fail;
-
-    dest_addr.sin_family = AF_INET;
-    dest_addr.sin_port = htons(port);
-    if (resolve_host(&dest_addr.sin_addr, hostname) < 0)
-        goto fail;
-
-    fd = socket(PF_INET, SOCK_STREAM, 0);
-    if (fd < 0)
-        goto fail;
-    fcntl(fd, F_SETFL, O_NONBLOCK);
-
- redo:
-    ret = connect(fd, (struct sockaddr *)&dest_addr,
-                  sizeof(dest_addr));
-    if (ret < 0) {
-        if (errno == EINTR)
-            goto redo;
-        if (errno != EINPROGRESS)
-            goto fail;
-
-        /* wait until we are connected or until abort */
-        for(;;) {
-            if (url_interrupt_cb()) {
-                ret = -EINTR;
-                goto fail1;
-            }
-            fd_max = fd;
-            FD_ZERO(&wfds);
-            FD_SET(fd, &wfds);
-            tv.tv_sec = 0;
-            tv.tv_usec = 100 * 1000;
-            ret = select(fd_max + 1, NULL, &wfds, NULL, &tv);
-            if (ret > 0 && FD_ISSET(fd, &wfds))
-                break;
-        }
-
-        /* test error */
-        optlen = sizeof(ret);
-        getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
-        if (ret != 0)
-            goto fail;
-    }
-    s->fd = fd;
-    return 0;
-
- fail:
-    ret = AVERROR_IO;
- fail1:
-    if (fd >= 0)
-        close(fd);
-    av_free(s);
-    return ret;
-}
-
-static int tcp_read(URLContext *h, uint8_t *buf, int size)
-{
-    TCPContext *s = h->priv_data;
-    int len, fd_max, ret;
-    fd_set rfds;
-    struct timeval tv;
-
-    for (;;) {
-        if (url_interrupt_cb())
-            return -EINTR;
-        fd_max = s->fd;
-        FD_ZERO(&rfds);
-        FD_SET(s->fd, &rfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 100 * 1000;
-        ret = select(fd_max + 1, &rfds, NULL, NULL, &tv);
-        if (ret > 0 && FD_ISSET(s->fd, &rfds)) {
-#ifdef __BEOS__
-            len = recv(s->fd, buf, size, 0);
-#else
-            len = read(s->fd, buf, size);
-#endif
-            if (len < 0) {
-                if (errno != EINTR && errno != EAGAIN)
-#ifdef __BEOS__
-                    return errno;
-#else
-                    return -errno;
-#endif
-            } else return len;
-        } else if (ret < 0) {
-            return -1;
-        }
-    }
-}
-
-static int tcp_write(URLContext *h, uint8_t *buf, int size)
-{
-    TCPContext *s = h->priv_data;
-    int ret, size1, fd_max, len;
-    fd_set wfds;
-    struct timeval tv;
-
-    size1 = size;
-    while (size > 0) {
-        if (url_interrupt_cb())
-            return -EINTR;
-        fd_max = s->fd;
-        FD_ZERO(&wfds);
-        FD_SET(s->fd, &wfds);
-        tv.tv_sec = 0;
-        tv.tv_usec = 100 * 1000;
-        ret = select(fd_max + 1, NULL, &wfds, NULL, &tv);
-        if (ret > 0 && FD_ISSET(s->fd, &wfds)) {
-#ifdef __BEOS__
-            len = send(s->fd, buf, size, 0);
-#else
-            len = write(s->fd, buf, size);
-#endif
-            if (len < 0) {
-                if (errno != EINTR && errno != EAGAIN) {
-#ifdef __BEOS__
-                    return errno;
-#else
-                    return -errno;
-#endif
-                }
-                continue;
-            }
-            size -= len;
-            buf += len;
-        } else if (ret < 0) {
-            return -1;
-        }
-    }
-    return size1 - size;
-}
-
-static int tcp_close(URLContext *h)
-{
-    TCPContext *s = h->priv_data;
-#ifdef CONFIG_BEOS_NETSERVER
-    closesocket(s->fd);
-#else
-    close(s->fd);
-#endif
-    av_free(s);
-    return 0;
-}
-
-URLProtocol tcp_protocol = {
-    "tcp",
-    tcp_open,
-    tcp_read,
-    tcp_write,
-    NULL, /* seek */
-    tcp_close,
-};
--- a/src/ffmpeg/libavformat/udp.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,504 +0,0 @@
-/*
- * UDP prototype streaming system
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard.
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include "avformat.h"
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#ifndef __BEOS__
-# include <arpa/inet.h>
-#else
-# include "barpainet.h"
-#endif
-#include <netdb.h>
-
-#ifndef IPV6_ADD_MEMBERSHIP
-#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP
-#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP
-#endif
-
-typedef struct {
-    int udp_fd;
-    int ttl;
-    int is_multicast;
-    int local_port;
-#ifndef CONFIG_IPV6
-    struct ip_mreq mreq;
-    struct sockaddr_in dest_addr;
-#else
-    struct sockaddr_storage dest_addr;
-    size_t dest_addr_len;
-#endif
-} UDPContext;
-
-#define UDP_TX_BUF_SIZE 32768
-
-#ifdef CONFIG_IPV6
-
-static int udp_ipv6_is_multicast_address(const struct sockaddr *addr) {
-    if (addr->sa_family == AF_INET)
-        return IN_MULTICAST(ntohl(((struct sockaddr_in *)addr)->sin_addr.s_addr));
-    if (addr->sa_family == AF_INET6)
-        return IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6 *)addr)->sin6_addr);
-    return -1;
-}
-
-static int udp_ipv6_set_multicast_ttl(int sockfd, int mcastTTL, struct sockaddr *addr) {
-    if (addr->sa_family == AF_INET) {
-        if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &mcastTTL, sizeof(mcastTTL)) < 0) {
-            perror("setsockopt(IP_MULTICAST_TTL)");
-            return -1;
-        }
-    }
-    if (addr->sa_family == AF_INET6) {
-        if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &mcastTTL, sizeof(mcastTTL)) < 0) {
-            perror("setsockopt(IPV6_MULTICAST_HOPS)");
-            return -1;
-        }
-    }
-    return 0;
-}
-
-static int udp_ipv6_join_multicast_group(int sockfd, struct sockaddr *addr) {
-    struct ip_mreq   mreq;
-    struct ipv6_mreq mreq6;
-    if (addr->sa_family == AF_INET) {
-        mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
-        mreq.imr_interface.s_addr= INADDR_ANY;
-        if (setsockopt(sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) < 0) {
-            perror("setsockopt(IP_ADD_MEMBERSHIP)");
-            return -1;
-        }
-    }
-    if (addr->sa_family == AF_INET6) {
-        memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr));
-        mreq6.ipv6mr_interface= 0;
-        if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
-            perror("setsockopt(IPV6_ADD_MEMBERSHIP)");
-            return -1;
-        }
-    }
-    return 0;
-}
-
-static int udp_ipv6_leave_multicast_group(int sockfd, struct sockaddr *addr) {
-    struct ip_mreq   mreq;
-    struct ipv6_mreq mreq6;
-    if (addr->sa_family == AF_INET) {
-        mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;
-        mreq.imr_interface.s_addr= INADDR_ANY;
-        if (setsockopt(sockfd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (const void *)&mreq, sizeof(mreq)) < 0) {
-            perror("setsockopt(IP_DROP_MEMBERSHIP)");
-            return -1;
-        }
-    }
-    if (addr->sa_family == AF_INET6) {
-        memcpy(&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *)addr)->sin6_addr), sizeof(struct in6_addr));
-        mreq6.ipv6mr_interface= 0;
-        if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, &mreq6, sizeof(mreq6)) < 0) {
-            perror("setsockopt(IPV6_DROP_MEMBERSHIP)");
-            return -1;
-        }
-    }
-    return 0;
-}
-
-static struct addrinfo* udp_ipv6_resolve_host(const char *hostname, int port, int type, int family, int flags) {
-    struct addrinfo hints, *res = 0;
-    int error;
-    char sport[16];
-    const char *node = 0, *service = 0;
-
-    if (port > 0) {
-        snprintf(sport, sizeof(sport), "%d", port);
-        service = sport;
-    }
-    if ((hostname) && (hostname[0] != '\0') && (hostname[0] != '?')) {
-        node = hostname;
-    }
-    if ((node) || (service)) {
-        memset(&hints, 0, sizeof(hints));
-        hints.ai_socktype = type;
-        hints.ai_family   = family;
-        hints.ai_flags = flags;
-        if ((error = getaddrinfo(node, service, &hints, &res))) {
-            av_log(NULL, AV_LOG_ERROR, "udp_ipv6_resolve_host: %s\n", gai_strerror(error));
-        }
-    }
-    return res;
-}
-
-static int udp_ipv6_set_remote_url(URLContext *h, const char *uri) {
-    UDPContext *s = h->priv_data;
-    char hostname[256];
-    int port;
-    struct addrinfo *res0;
-    url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
-    res0 = udp_ipv6_resolve_host(hostname, port, SOCK_DGRAM, AF_UNSPEC, 0);
-    if (res0 == 0) return AVERROR_IO;
-    memcpy(&s->dest_addr, res0->ai_addr, res0->ai_addrlen);
-    s->dest_addr_len = res0->ai_addrlen;
-    freeaddrinfo(res0);
-    return 0;
-}
-
-static int udp_ipv6_set_local(URLContext *h) {
-    UDPContext *s = h->priv_data;
-    int udp_fd = -1;
-    struct sockaddr_storage clientaddr;
-    socklen_t addrlen;
-    char sbuf[NI_MAXSERV];
-    char hbuf[NI_MAXHOST];
-    struct addrinfo *res0 = NULL, *res = NULL;
-
-    if (s->local_port != 0) {
-        res0 = udp_ipv6_resolve_host(0, s->local_port, SOCK_DGRAM, AF_UNSPEC, AI_PASSIVE);
-        if (res0 == 0)
-            goto fail;
-        for (res = res0; res; res=res->ai_next) {
-            udp_fd = socket(res->ai_family, SOCK_DGRAM, 0);
-            if (udp_fd > 0) break;
-            perror("socket");
-        }
-    } else {
-        udp_fd = socket(s->dest_addr.ss_family, SOCK_DGRAM, 0);
-        if (udp_fd < 0)
-            perror("socket");
-    }
-
-    if (udp_fd < 0)
-        goto fail;
-
-    if (s->local_port != 0) {
-        if (bind(udp_fd, res0->ai_addr, res0->ai_addrlen) < 0) {
-            perror("bind");
-            goto fail;
-        }
-        freeaddrinfo(res0);
-        res0 = NULL;
-    }
-
-    addrlen = sizeof(clientaddr);
-    if (getsockname(udp_fd, (struct sockaddr *)&clientaddr, &addrlen) < 0) {
-        perror("getsockname");
-        goto fail;
-    }
-
-    if (getnameinfo((struct sockaddr *)&clientaddr, addrlen, hbuf, sizeof(hbuf),  sbuf, sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) != 0) {
-        perror("getnameinfo");
-        goto fail;
-    }
-
-    s->local_port = strtol(sbuf, NULL, 10);
-
-    return udp_fd;
-
- fail:
-    if (udp_fd >= 0)
-#ifdef CONFIG_BEOS_NETSERVER
-        closesocket(udp_fd);
-#else
-        close(udp_fd);
-#endif
-    if(res0)
-        freeaddrinfo(res0);
-    return -1;
-}
-
-#endif
-
-
-/**
- * If no filename is given to av_open_input_file because you want to
- * get the local port first, then you must call this function to set
- * the remote server address.
- *
- * url syntax: udp://host:port[?option=val...]
- * option: 'multicast=1' : enable multicast
- *         'ttl=n'       : set the ttl value (for multicast only)
- *         'localport=n' : set the local port
- *         'pkt_size=n'  : set max packet size
- *
- * @param s1 media file context
- * @param uri of the remote server
- * @return zero if no error.
- */
-int udp_set_remote_url(URLContext *h, const char *uri)
-{
-#ifdef CONFIG_IPV6
-    return udp_ipv6_set_remote_url(h, uri);
-#else
-    UDPContext *s = h->priv_data;
-    char hostname[256];
-    int port;
-
-    url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
-
-    /* set the destination address */
-    if (resolve_host(&s->dest_addr.sin_addr, hostname) < 0)
-        return AVERROR_IO;
-    s->dest_addr.sin_family = AF_INET;
-    s->dest_addr.sin_port = htons(port);
-    return 0;
-#endif
-}
-
-/**
- * Return the local port used by the UDP connexion
- * @param s1 media file context
- * @return the local port number
- */
-int udp_get_local_port(URLContext *h)
-{
-    UDPContext *s = h->priv_data;
-    return s->local_port;
-}
-
-/**
- * Return the udp file handle for select() usage to wait for several RTP
- * streams at the same time.
- * @param h media file context
- */
-int udp_get_file_handle(URLContext *h)
-{
-    UDPContext *s = h->priv_data;
-    return s->udp_fd;
-}
-
-/* put it in UDP context */
-/* return non zero if error */
-static int udp_open(URLContext *h, const char *uri, int flags)
-{
-    char hostname[1024];
-    int port, udp_fd = -1, tmp;
-    UDPContext *s = NULL;
-    int is_output;
-    const char *p;
-    char buf[256];
-#ifndef CONFIG_IPV6
-    struct sockaddr_in my_addr, my_addr1;
-    int len;
-#endif
-
-    h->is_streamed = 1;
-    h->max_packet_size = 1472;
-
-    is_output = (flags & URL_WRONLY);
-
-    s = av_malloc(sizeof(UDPContext));
-    if (!s)
-        return -ENOMEM;
-
-    h->priv_data = s;
-    s->ttl = 16;
-    s->is_multicast = 0;
-    s->local_port = 0;
-    p = strchr(uri, '?');
-    if (p) {
-        s->is_multicast = find_info_tag(buf, sizeof(buf), "multicast", p);
-        if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
-            s->ttl = strtol(buf, NULL, 10);
-        }
-        if (find_info_tag(buf, sizeof(buf), "localport", p)) {
-            s->local_port = strtol(buf, NULL, 10);
-        }
-        if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
-            h->max_packet_size = strtol(buf, NULL, 10);
-        }
-    }
-
-    /* fill the dest addr */
-    url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
-
-    /* XXX: fix url_split */
-    if (hostname[0] == '\0' || hostname[0] == '?') {
-        /* only accepts null hostname if input */
-        if (s->is_multicast || (flags & URL_WRONLY))
-            goto fail;
-    } else {
-        udp_set_remote_url(h, uri);
-    }
-
-#ifndef CONFIG_IPV6
-    udp_fd = socket(PF_INET, SOCK_DGRAM, 0);
-    if (udp_fd < 0)
-        goto fail;
-
-    my_addr.sin_family = AF_INET;
-    my_addr.sin_addr.s_addr = htonl (INADDR_ANY);
-    if (s->is_multicast && !(h->flags & URL_WRONLY)) {
-        /* special case: the bind must be done on the multicast address port */
-        my_addr.sin_port = s->dest_addr.sin_port;
-    } else {
-        my_addr.sin_port = htons(s->local_port);
-    }
-
-    /* the bind is needed to give a port to the socket now */
-    if (bind(udp_fd,(struct sockaddr *)&my_addr, sizeof(my_addr)) < 0)
-        goto fail;
-
-    len = sizeof(my_addr1);
-    getsockname(udp_fd, (struct sockaddr *)&my_addr1, &len);
-    s->local_port = ntohs(my_addr1.sin_port);
-
-#ifndef CONFIG_BEOS_NETSERVER
-    if (s->is_multicast) {
-        if (h->flags & URL_WRONLY) {
-            /* output */
-            if (setsockopt(udp_fd, IPPROTO_IP, IP_MULTICAST_TTL,
-                           &s->ttl, sizeof(s->ttl)) < 0) {
-                perror("IP_MULTICAST_TTL");
-                goto fail;
-            }
-        } else {
-            /* input */
-            memset(&s->mreq, 0, sizeof(s->mreq));
-            s->mreq.imr_multiaddr = s->dest_addr.sin_addr;
-            s->mreq.imr_interface.s_addr = htonl (INADDR_ANY);
-            if (setsockopt(udp_fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
-                           &s->mreq, sizeof(s->mreq)) < 0) {
-                perror("rtp: IP_ADD_MEMBERSHIP");
-                goto fail;
-            }
-        }
-    }
-#endif
-#else
-    if (s->is_multicast && !(h->flags & URL_WRONLY))
-        s->local_port = port;
-    udp_fd = udp_ipv6_set_local(h);
-    if (udp_fd < 0)
-        goto fail;
-#ifndef CONFIG_BEOS_NETSERVER
-    if (s->is_multicast) {
-        if (h->flags & URL_WRONLY) {
-            if (udp_ipv6_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0)
-                goto fail;
-        } else {
-            if (udp_ipv6_join_multicast_group(udp_fd, (struct sockaddr *)&s->dest_addr) < 0)
-                goto fail;
-        }
-    }
-#endif
-#endif
-
-    if (is_output) {
-        /* limit the tx buf size to limit latency */
-        tmp = UDP_TX_BUF_SIZE;
-        if (setsockopt(udp_fd, SOL_SOCKET, SO_SNDBUF, &tmp, sizeof(tmp)) < 0) {
-            perror("setsockopt sndbuf");
-            goto fail;
-        }
-    }
-
-    s->udp_fd = udp_fd;
-    return 0;
- fail:
-    if (udp_fd >= 0)
-#ifdef CONFIG_BEOS_NETSERVER
-        closesocket(udp_fd);
-#else
-        close(udp_fd);
-#endif
-    av_free(s);
-    return AVERROR_IO;
-}
-
-static int udp_read(URLContext *h, uint8_t *buf, int size)
-{
-    UDPContext *s = h->priv_data;
-#ifndef CONFIG_IPV6
-    struct sockaddr_in from;
-#else
-    struct sockaddr_storage from;
-#endif
-    socklen_t from_len;
-    int len;
-
-    for(;;) {
-        from_len = sizeof(from);
-        len = recvfrom (s->udp_fd, buf, size, 0,
-                        (struct sockaddr *)&from, &from_len);
-        if (len < 0) {
-            if (errno != EAGAIN && errno != EINTR)
-                return AVERROR_IO;
-        } else {
-            break;
-        }
-    }
-    return len;
-}
-
-static int udp_write(URLContext *h, uint8_t *buf, int size)
-{
-    UDPContext *s = h->priv_data;
-    int ret;
-
-    for(;;) {
-        ret = sendto (s->udp_fd, buf, size, 0,
-                      (struct sockaddr *) &s->dest_addr,
-#ifndef CONFIG_IPV6
-                      sizeof (s->dest_addr));
-#else
-                      s->dest_addr_len);
-#endif
-        if (ret < 0) {
-            if (errno != EINTR && errno != EAGAIN)
-                return AVERROR_IO;
-        } else {
-            break;
-        }
-    }
-    return size;
-}
-
-static int udp_close(URLContext *h)
-{
-    UDPContext *s = h->priv_data;
-
-#ifndef CONFIG_BEOS_NETSERVER
-#ifndef CONFIG_IPV6
-    if (s->is_multicast && !(h->flags & URL_WRONLY)) {
-        if (setsockopt(s->udp_fd, IPPROTO_IP, IP_DROP_MEMBERSHIP,
-                       &s->mreq, sizeof(s->mreq)) < 0) {
-            perror("IP_DROP_MEMBERSHIP");
-        }
-    }
-#else
-    if (s->is_multicast && !(h->flags & URL_WRONLY))
-        udp_ipv6_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
-#endif
-    close(s->udp_fd);
-#else
-    closesocket(s->udp_fd);
-#endif
-    av_free(s);
-    return 0;
-}
-
-URLProtocol udp_protocol = {
-    "udp",
-    udp_open,
-    udp_read,
-    udp_write,
-    NULL, /* seek */
-    udp_close,
-};
--- a/src/ffmpeg/wma.c	Mon Mar 12 11:47:10 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,478 +0,0 @@
-/*
- *  Audacious WMA input plugin
- *  (C) 2005 Audacious development team
- *
- *  Based on:
- *  xmms-wma - WMA player for BMP
- *  Copyright (C) 2004,2005 McMCC <mcmcc@mail.ru>
- *  bmp-wma - WMA player for BMP
- *  Copyright (C) 2004 Roman Bogorodskiy <bogorodskiy@inbox.ru>
- *
- *  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-#define _XOPEN_SOURCE 600
-#include <stdlib.h>
-#include <unistd.h>
-#include <math.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <strings.h>
-#include <glib.h>
-
-#include <audacious/plugin.h>
-#include <audacious/output.h>
-#include <audacious/util.h>
-#include <audacious/titlestring.h>
-#include <audacious/vfs.h>
-#include <audacious/strings.h>
-#include <audacious/i18n.h>
-
-#include "avcodec.h"
-#include "avformat.h"
-
-#define ABOUT_TXT "Adapted for use in audacious by Tony Vroon (chainsaw@gentoo.org) from\n \
-the BEEP-WMA plugin which is Copyright (C) 2004,2005 Mokrushin I.V. aka McMCC (mcmcc@mail.ru)\n \
-and the BMP-WMA plugin which is Copyright (C) 2004 Roman Bogorodskiy <bogorodskiy@inbox.ru>.\n \
-This plugin based on source code " LIBAVCODEC_IDENT "\nby Fabrice Bellard from \
-http://ffmpeg.sourceforge.net.\n\n \
-This program is free software; you can redistribute it and/or modify \n \
-it under the terms of the GNU General Public License as published by \n \
-the Free Software Foundation; either version 2 of the License, or \n \
-(at your option) any later version. \n\n \
-This program is distributed in the hope that it will be useful, \n \
-but WITHOUT ANY WARRANTY; without even the implied warranty of \n \
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. \n \
-See the GNU General Public License for more details.\n"
-#define PLUGIN_NAME "Audacious-WMA"
-#define PLUGIN_VERSION "v.1.0.5"
-#define ST_BUFF 1024
-
-static int wma_decode = 0;
-static gboolean wma_pause = 0;
-static int wma_seekpos = -1;
-static int wma_st_buff, wma_idx, wma_idx2;
-static GThread *wma_decode_thread;
-GStaticMutex wma_mutex = G_STATIC_MUTEX_INIT;
-static AVCodecContext *c = NULL;
-static AVFormatContext *ic = NULL;
-static AVCodecContext *c2 = NULL;
-static AVFormatContext *ic2 = NULL;
-static uint8_t *wma_outbuf, *wma_s_outbuf;
-
-char description[64];
-static void wma_about(void);
-static void wma_init(void);
-static int wma_is_our_file(char *filename);
-static int wma_is_our_fd(char *filename, VFSFile *fd);
-static void wma_play_file(InputPlayback *data);
-static void wma_stop(InputPlayback *data);
-static void wma_seek(InputPlayback *data, int time);
-static void wma_do_pause(InputPlayback *data, short p);
-static int wma_get_time(InputPlayback *data);
-static void wma_get_song_info(char *filename, char **title, int *length);
-static TitleInput *wma_get_song_tuple(char *filename);
-static char *wsong_title;
-static int wsong_time;
-
-static GtkWidget *dialog1, *button1, *label1;
-
-InputPlugin *get_iplugin_info(void);
-
-gchar *wma_fmts[] = { "wma", NULL };
-
-InputPlugin wma_ip =
-{
-    NULL,           	// Filled in by xmms
-    NULL,           	// Filled in by xmms
-    description,    	// The description that is shown in the preferences box
-    wma_init,           // Called when the plugin is loaded
-    wma_about,          // Show the about box
-    NULL,  	    	// Show the configure box
-    wma_is_our_file,    // Return 1 if the plugin can handle the file
-    NULL,           	// Scan dir
-    wma_play_file,      // Play file
-    wma_stop,           // Stop
-    wma_do_pause,       // Pause
-    wma_seek,           // Seek
-    NULL,               // Set the equalizer, most plugins won't be able to do this
-    wma_get_time,       // Get the time, usually returns the output plugins output time
-    NULL,           	// Get volume
-    NULL,           	// Set volume
-    NULL,           	// OBSOLETE!
-    NULL,           	// OBSOLETE!
-    NULL,           	// Send data to the visualization plugins
-    NULL,           	// Fill in the stuff that is shown in the player window
-    NULL,           	// Show some text in the song title box. Filled in by xmms
-    wma_get_song_info,  // Function to grab the title string
-    NULL,               // Bring up an info window for the filename passed in
-    NULL,           	// Handle to the current output plugin. Filled in by xmms
-    wma_get_song_tuple, // Tuple builder
-    NULL,
-    NULL,
-    wma_is_our_fd,	// vfs
-    wma_fmts
-};
-
-InputPlugin *get_iplugin_info(void)
-{
-    memset(description, 0, 64);
-    wma_ip.description = g_strdup_printf(_("WMA Player %s"), PACKAGE_VERSION);
-    return &wma_ip;
-}
-
-static gchar *str_twenty_to_space(gchar * str)
-{
-    gchar *match, *match_end;
-
-    g_return_val_if_fail(str != NULL, NULL);
-
-    while ((match = strstr(str, "%20"))) {
-        match_end = match + 3;
-        *match++ = ' ';
-        while (*match_end)
-            *match++ = *match_end++;
-        *match = 0;
-    }
-
-    return str;
-}
-
-static void wma_about(void) 
-{
-    char *title;
-    char *message;
-
-    if (dialog1) return;
-    
-    title = (char *)g_malloc(80);
-    message = (char *)g_malloc(1000);
-    memset(title, 0, 80);
-    memset(message, 0, 1000);
-
-    sprintf(title, _("About %s"), PLUGIN_NAME);
-    sprintf(message, "%s %s\n\n%s", PLUGIN_NAME, PLUGIN_VERSION, ABOUT_TXT);
-
-    dialog1 = gtk_dialog_new();
-    g_signal_connect(G_OBJECT(dialog1), "destroy",
-                        G_CALLBACK(gtk_widget_destroyed), &dialog1);
-    gtk_window_set_title(GTK_WINDOW(dialog1), title);
-    gtk_window_set_policy(GTK_WINDOW(dialog1), FALSE, FALSE, FALSE);
-    gtk_container_border_width(GTK_CONTAINER(dialog1), 5);
-    label1 = gtk_label_new(message);
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog1)->vbox), label1, TRUE, TRUE, 0);
-    gtk_widget_show(label1);
-
-    button1 = gtk_button_new_with_label(_(" Close "));
-    g_signal_connect_swapped(G_OBJECT(button1), "clicked",
-	                        G_CALLBACK(gtk_widget_destroy),
-    	                        GTK_OBJECT(dialog1));
-    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog1)->action_area), button1,
-                     FALSE, FALSE, 0);
-
-    gtk_widget_show(button1);
-    gtk_widget_show(dialog1);
-    gtk_widget_grab_focus(button1);
-    g_free(title);
-    g_free(message);
-}
-
-static void wma_init(void)
-{
-    avcodec_init();
-    avcodec_register_all();
-    av_register_all();
-}
-
-static int wma_is_our_file(char *filename)
-{
-    AVCodec *codec2;
-
-    if(av_open_input_file(&ic2, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return 0;
-
-    for(wma_idx2 = 0; wma_idx2 < ic2->nb_streams; wma_idx2++) {
-        c2 = &ic2->streams[wma_idx2]->codec;
-        if(c2->codec_type == CODEC_TYPE_AUDIO) break;
-    }
-
-    av_find_stream_info(ic2);
-
-    codec2 = avcodec_find_decoder(c2->codec_id);
-
-    if(!codec2) {
-        av_close_input_file(ic2);
-	return 0;
-    }
-	
-    av_close_input_file(ic2);
-    return 1;
-}
-
-static int wma_is_our_fd(char *filename, VFSFile *fd)
-{
-    AVCodec *codec2;
-
-    if(av_open_input_vfsfile(&ic2, filename, fd, NULL, 0, NULL) < 0) return 0;
-
-    for(wma_idx2 = 0; wma_idx2 < ic2->nb_streams; wma_idx2++) {
-        c2 = &ic2->streams[wma_idx2]->codec;
-        if(c2->codec_type == CODEC_TYPE_AUDIO) break;
-    }
-
-    av_find_stream_info(ic2);
-
-    codec2 = avcodec_find_decoder(c2->codec_id);
-
-    return 1;
-}
-
-static void wma_do_pause(InputPlayback *playback, short p)
-{
-    wma_pause = p;
-    playback->output->pause(wma_pause);
-}
-
-static void wma_seek(InputPlayback *playback, int time) 
-{
-    wma_seekpos = time;
-    if(wma_pause) playback->output->pause(0);
-    while(wma_decode && wma_seekpos!=-1) xmms_usleep(10000);
-    if(wma_pause) playback->output->pause(1);
-}
-
-static int wma_get_time(InputPlayback *playback)
-{
-    playback->output->buffer_free();
-    if(wma_decode) return playback->output->output_time();
-    return -1;
-}
-
-static gchar *extname(const char *filename)
-{
-    gchar *ext = strrchr(filename, '.');
-    if(ext != NULL) ++ext;
-    return ext;
-}
-
-static char* w_getstr(char* str)
-{
-    if(str && strlen(str) > 0) return g_strdup(str);
-    return NULL;
-}
-
-static TitleInput *wma_get_song_tuple(gchar * filename)
-{
-    TitleInput *tuple = NULL;
-    AVFormatContext *in = NULL;
-    gchar *filename_proxy = g_strdup(filename);
-
-    if (av_open_input_file(&in, str_twenty_to_space(filename), NULL, 0, NULL) < 0)
-	return NULL;
-
-    tuple = bmp_title_input_new();
-
-    tuple->file_name = g_path_get_basename(filename_proxy);
-    tuple->file_path = g_path_get_dirname(filename_proxy);
-    tuple->file_ext = extname(filename_proxy);
-	
-    av_find_stream_info(in);
-
-    if((in->title[0] != '\0') || (in->author[0] != '\0') || (in->album[0] != '\0') ||
-       (in->comment[0] != '\0') || (in->genre[0] != '\0') || (in->year != 0) || (in->track != 0))
-    {	
-	tuple->performer = str_to_utf8(w_getstr(in->author));
-	tuple->album_name = str_to_utf8(w_getstr(in->album));
-	tuple->track_name = str_to_utf8(w_getstr(in->title));
-	tuple->year = in->year;
-	tuple->track_number = in->track;
-	tuple->genre = str_to_utf8(w_getstr(in->genre));
-	tuple->comment = str_to_utf8(w_getstr(in->comment));
-    }
-
-    if (in->duration)
-        tuple->length = in->duration / 1000;
-
-    av_close_input_file(in);
-
-    return tuple;
-}
-
-static gchar *get_song_title(AVFormatContext *in, gchar * filename)
-{
-    gchar *ret = NULL;
-    TitleInput *input;
-
-    input = bmp_title_input_new();
-    
-    if((in->title[0] != '\0') || (in->author[0] != '\0') || (in->album[0] != '\0') ||
-       (in->comment[0] != '\0') || (in->genre[0] != '\0') || (in->year != 0) || (in->track != 0))
-    {	
-	input->performer = w_getstr(in->author);
-	input->album_name = w_getstr(in->album);
-	input->track_name = w_getstr(in->title);
-	input->year = in->year;
-	input->track_number = in->track;
-	input->genre = w_getstr(in->genre);
-	input->comment = w_getstr(in->comment);
-    }
-    input->file_name = g_path_get_basename(filename);
-    input->file_path = g_path_get_dirname(filename);
-    input->file_ext = extname(filename);
-    ret = xmms_get_titlestring(xmms_get_gentitle_format(), input);
-    if(input) g_free(input);
-
-    if(!ret)
-    {
-	    ret = g_strdup(input->file_name);
-            if (extname(ret) != NULL)
-                    *(extname(ret) - 1) = '\0';
-    }
-    return ret;
-}
-
-static guint get_song_time(AVFormatContext *in)
-{
-    if(in->duration)
-	return in->duration/1000;
-    else
-	return 0;
-}
-
-static void wma_get_song_info(char *filename, char **title_real, int *len_real)
-{
-    TitleInput *tuple = wma_get_song_tuple(filename);
-
-    if (tuple == NULL)
-        return;
-
-    (*len_real) = tuple->length;
-    (*title_real) = xmms_get_titlestring(xmms_get_gentitle_format(), tuple);
-}
-
-static void wma_playbuff(InputPlayback *playback, int out_size)
-{
-    FifoBuffer f;
-    int sst_buff;
-    
-    fifo_init(&f, out_size*2);
-    fifo_write(&f, wma_outbuf, out_size, &f.wptr);
-    while(!fifo_read(&f, wma_s_outbuf, wma_st_buff, &f.rptr) && wma_decode)
-    {
-        sst_buff = wma_st_buff;
-	if(wma_pause) memset(wma_s_outbuf, 0, sst_buff);	
-    	while(playback->output->buffer_free() < wma_st_buff) xmms_usleep(20000);
-	produce_audio(playback->output->written_time(), FMT_S16_NE,
-    			    c->channels, sst_buff, (short *)wma_s_outbuf, NULL);
-	memset(wma_s_outbuf, 0, sst_buff);
-    }
-    fifo_free(&f);
-    return;
-}
-
-static void *wma_play_loop(void *arg)
-{
-    InputPlayback *playback = arg;
-    uint8_t *inbuf_ptr;
-    int out_size, size, len;
-    AVPacket pkt;
-    
-    g_static_mutex_lock(&wma_mutex);
-    while(wma_decode){
-
-	if(wma_seekpos != -1)
-	{
-	    av_seek_frame(ic, wma_idx, wma_seekpos * 1000000LL);
-	    playback->output->flush(wma_seekpos * 1000);
-	    wma_seekpos = -1;
-	}
-
-        if(av_read_frame(ic, &pkt) < 0) break;
-
-        size = pkt.size;
-        inbuf_ptr = pkt.data;
-	
-        if(size == 0) break;
-	
-        while(size > 0){
-            len = avcodec_decode_audio(c, (short *)wma_outbuf, &out_size,
-                                       inbuf_ptr, size);
-	    if(len < 0) break;
-	    
-            if(out_size <= 0) continue;
-
-	    wma_playbuff(playback, out_size);
-
-            size -= len;
-            inbuf_ptr += len;
-            if(pkt.data) av_free_packet(&pkt);
-        }
-    }
-    while(wma_decode && playback->output->buffer_playing()) xmms_usleep(30000);
-    wma_decode = 0;
-    if(wma_s_outbuf) g_free(wma_s_outbuf);
-    if(wma_outbuf) g_free(wma_outbuf);
-    if(pkt.data) av_free_packet(&pkt);
-    if(c) avcodec_close(c);
-    if(ic) av_close_input_file(ic);
-    g_static_mutex_unlock(&wma_mutex);
-    g_thread_exit(NULL);
-    return(NULL);
-}
-
-static void wma_play_file(InputPlayback *playback)
-{
-    char *filename = playback->filename;
-    AVCodec *codec;
-    
-    if(av_open_input_file(&ic, str_twenty_to_space(filename), NULL, 0, NULL) < 0) return;
-
-    for(wma_idx = 0; wma_idx < ic->nb_streams; wma_idx++) {
-        c = &ic->streams[wma_idx]->codec;
-        if(c->codec_type == CODEC_TYPE_AUDIO) break;
-    }
-
-    av_find_stream_info(ic);
-
-    codec = avcodec_find_decoder(c->codec_id);
-
-    if(!codec) return;
-	
-    if(avcodec_open(c, codec) < 0) return;
-	    	    
-    wsong_title = get_song_title(ic, filename);
-    wsong_time = get_song_time(ic);
-
-    if(playback->output->open_audio(FMT_S16_NE, c->sample_rate, c->channels) <= 0) return;
-
-    wma_st_buff  = ST_BUFF;
-	
-    wma_ip.set_info(wsong_title, wsong_time, c->bit_rate, c->sample_rate, c->channels);
-
-    /* av_malloc() will wrap posix_memalign() if necessary -nenolod */
-    wma_s_outbuf = av_malloc(wma_st_buff);
-    wma_outbuf = av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
-
-    wma_seekpos = -1;
-    wma_decode = 1;
-    wma_decode_thread = g_thread_create((GThreadFunc)wma_play_loop, playback, TRUE, NULL);
-}
-
-static void wma_stop(InputPlayback *playback) 
-{
-    wma_decode = 0;
-    if(wma_pause) wma_do_pause(playback, 0);
-    g_thread_join(wma_decode_thread);
-    playback->output->close_audio();
-}