summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Crete <olivier.crete@collabora.co.uk>2008-03-23 17:38:32 (GMT)
committerOlivier Crete <olivier.crete@collabora.co.uk>2008-03-23 17:38:32 (GMT)
commitb7c433233cebddf813e0448c9ec86f24dee15e2a (patch)
treeb3df35dfa3d70cc159bd0d8a8b67ef02cd52f6e3
parentbd394709e5fce1ebe007dee1037926da186d0550 (diff)
downloadgst-plugins-farsight-tester-b7c433233cebddf813e0448c9ec86f24dee15e2a.tar.gz
gst-plugins-farsight-tester-b7c433233cebddf813e0448c9ec86f24dee15e2a.tar.xz
Remove unused r263 plugin
20080323173832-3e2dc-da36e5b900014b44c2a4e93e0e30601d04a8efe6.gz
-rw-r--r--gst/r263/.git-darcs-dir0
-rw-r--r--gst/r263/Makefile.am11
-rw-r--r--gst/r263/gstr263.c56
-rw-r--r--gst/r263/gstr263enc.c565
-rw-r--r--gst/r263/gstr263enc.h77
-rw-r--r--gst/r263/libr263/.git-darcs-dir0
-rw-r--r--gst/r263/libr263/DISCLAIMER26
-rw-r--r--gst/r263/libr263/Makefile95
-rw-r--r--gst/r263/libr263/README72
-rw-r--r--gst/r263/libr263/coder.c1106
-rw-r--r--gst/r263/libr263/config.h168
-rw-r--r--gst/r263/libr263/countbit.c761
-rw-r--r--gst/r263/libr263/ctables.h264
-rw-r--r--gst/r263/libr263/dct.c885
-rw-r--r--gst/r263/libr263/huffman.c242
-rw-r--r--gst/r263/libr263/huffman.h79
-rw-r--r--gst/r263/libr263/indices.h45
-rw-r--r--gst/r263/libr263/libr263.c270
-rw-r--r--gst/r263/libr263/libr263.h131
-rw-r--r--gst/r263/libr263/macros.h38
-rw-r--r--gst/r263/libr263/manual.dvibin17836 -> 0 bytes
-rw-r--r--gst/r263/libr263/manual.pdfbin129271 -> 0 bytes
-rw-r--r--gst/r263/libr263/manual.tex440
-rw-r--r--gst/r263/libr263/mot_est.c409
-rw-r--r--gst/r263/libr263/owntypes.h28
-rw-r--r--gst/r263/libr263/pred.c508
-rw-r--r--gst/r263/libr263/quant.c109
-rw-r--r--gst/r263/libr263/rlib.c174
-rw-r--r--gst/r263/libr263/rlib.h132
-rw-r--r--gst/r263/libr263/sim.h354
-rw-r--r--gst/r263/libr263/stream.c166
31 files changed, 0 insertions, 7211 deletions
diff --git a/gst/r263/.git-darcs-dir b/gst/r263/.git-darcs-dir
deleted file mode 100644
index e69de29..0000000
--- a/gst/r263/.git-darcs-dir
+++ /dev/null
diff --git a/gst/r263/Makefile.am b/gst/r263/Makefile.am
deleted file mode 100644
index bc440fd..0000000
--- a/gst/r263/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-SUBDIRS = libr263
-
-plugin_LTLIBRARIES = libgstr263.la
-
-libgstr263_la_SOURCES = gstr263.c gstr263enc.c
-
-libgstr263_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(ERROR_CFLAGS) -DEXTERN_BUF -DRTP_SUPPORT
-libgstr263_la_LIBADD = $(GST_LIBS_LIBS) libr263/libr263.a libr263/rlib.a
-libgstr263_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstrtp-@GST_MAJORMINOR@
-
-noinst_HEADERS = gstr263enc.h
diff --git a/gst/r263/gstr263.c b/gst/r263/gstr263.c
deleted file mode 100644
index 6b0db4a..0000000
--- a/gst/r263/gstr263.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * GStreamer
- * Copyright (C) 2005 Philippe Khalaf <burger@speedy.org>
- * Copyright (C) 1999-2005 Wang, Zhanglei <filamoon@hotmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-
-#include "gstr263enc.h"
-
-/* entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and pad r263s
- * register the features
- */
- static gboolean
-plugin_init (GstPlugin *plugin)
-{
- return gst_element_register (plugin, "r263enc",
- GST_RANK_NONE,
- GST_TYPE_R263ENC);
-}
-
-/* this is the structure that gst-register looks for
- * so keep the name plugin_desc, or you cannot get your plug-in registered */
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "r263",
- "h.263 encoder and RTP payloader",
- plugin_init,
- VERSION,
- "LGPL",
- "Farsight",
- "http://farsight.sf.net/"
- )
diff --git a/gst/r263/gstr263enc.c b/gst/r263/gstr263enc.c
deleted file mode 100644
index e44f69c..0000000
--- a/gst/r263/gstr263enc.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Philippe Khalaf <burger@speedy.org>
- * Copyright (C) 1999-2005 Wang, Zhanglei <filamoon@hotmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <string.h>
-
-#include <gst/gst.h>
-
-#include <gstr263enc.h>
-#include <gst/rtp/gstrtpbuffer.h>
-
-GST_DEBUG_CATEGORY (r263enc_debug);
-#define GST_CAT_DEFAULT (r263enc_debug)
-
-/* FIXME: this should be defined in an appropriate header file. */
-#ifndef GST_RTP_PAYLOAD_H263
-#define GST_RTP_PAYLOAD_H263 34
-#define GST_RTP_H263_CLOCKRATE 90000
-#endif /* GST_RTP_PAYLOAD_H263 */
-
-/* Filter signals and args */
-enum {
- /* FILL ME */
- LAST_SIGNAL
-};
-
-enum {
- ARG_0,
- ARG_SILENT,
- ARG_RTP,
-};
-
-static GstStaticPadTemplate sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw-yuv, "
- "format = (fourcc) I420, "
- "width = (int) [16, 4096], "
- "height = (int) [12, 4096], "
- "framerate = (double) [1, 30]" )
- );
-
-static GstStaticPadTemplate src_factory =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-h263; application/x-rtp")
-// GST_STATIC_CAPS("ANY")
- );
-
-static void gst_r263enc_class_init (GstR263EncClass *klass);
-static void gst_r263enc_base_init (GstR263EncClass *klass);
-static void gst_r263enc_init (GstR263Enc *filter);
-
-/*
-static GstStateChangeReturn
-gst_r263enc_change_state (GstElement *element, GstStateChange transition);
-*/
-
-static void gst_r263enc_finalize (GObject * object);
-static void gst_r263enc_set_property (GObject *object, guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gst_r263enc_get_property (GObject *object, guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static GstFlowReturn gst_r263enc_chain (GstPad *pad, GstBuffer *in);
-
-static gboolean gst_r263enc_setcaps (GstPad * pad, GstCaps * caps);
-static GstCaps *gst_r263enc_src_getcaps (GstPad * pad);
-
-static GstElementClass *parent_class = NULL;
-
-/**********************************************
- * libr263 functions begin here *
- **********************************************/
-static void uninit_encoder(GstR263Enc *enc)
-{
- if (!enc->enc_inited) return;
- CloseCompress(&enc->cparams); /* Use standard compression parameters */
- g_free(enc->src_int_frame);
- g_free(enc->EncodeBlocks);
- enc->enc_inited = FALSE;
- enc->is_qcif = FALSE;
-}
-
-static gboolean init_encoder(GstR263Enc *enc)
-{
- if (enc->enc_inited)
- {
- uninit_encoder(enc);
- }
-
- if (enc->width==QCIF_YWIDTH && enc->height==QCIF_YHEIGHT)
- {
- enc->is_qcif = TRUE;
- enc->src_int_frame = g_malloc(sizeof(struct qcif));
- enc->cparams.format = CPARAM_QCIF;
- }
- else if (enc->width==CIF_YWIDTH && enc->height==CIF_YHEIGHT)
- {
- enc->src_int_frame = g_malloc(sizeof(struct cif));
- enc->cparams.format = CPARAM_CIF;
- }
- else if (enc->width==SQCIF_YWIDTH && enc->height==SQCIF_YHEIGHT)
- {
- enc->src_int_frame = g_malloc(sizeof(int)*SQCIF_YWIDTH*SQCIF_YHEIGHT*3/2);
- enc->cparams.format = CPARAM_SQCIF;
- }
- else if (enc->width==CIF4_YWIDTH && enc->height==CIF4_YHEIGHT)
- {
- enc->src_int_frame = g_malloc(sizeof(int)*CIF4_YWIDTH*CIF4_YHEIGHT*3/2);
- enc->cparams.format = CPARAM_4CIF;
- }
- else if (enc->width==CIF16_YWIDTH && enc->height==CIF16_YHEIGHT)
- {
- enc->src_int_frame = g_malloc(sizeof(int)*CIF16_YWIDTH*CIF16_YHEIGHT*3/2);
- enc->cparams.format = CPARAM_16CIF;
- }
- else
- {
- GST_ERROR("UNSUPORTED SIZE/WIDTH! %d %d quiting", enc->width, enc->height);
- return FALSE;
- //enc->cparams.format = CPARAM_OTHER;
- //enc->cparams.pels = enc->width;
- //enc->cparams.lines = enc->height;
- //enc->src_int_frame = g_malloc(sizeof(int)*enc->width*enc->height*3/2);
- }
-
- enc->EncodeBlocks = g_malloc0(sizeof(gint)*enc->width*enc->height/16/16);
- InitCompress(&enc->cparams); /* Use standard compression parameters */
- enc->cparams.Q_intra = 8;
- enc->cparams.half_pixel_searchwindow = 4;
- enc->cparams.search_method = CPARAM_LOGARITHMIC;
- enc->cparams.Q_inter = 8;
- enc->cparams.advanced_method = CPARAM_ADVANCED;
- enc->cparams.EncodeThisBlock = (int *)enc->EncodeBlocks;
- enc->gop_length = 32;
- enc->cparams.rtp_threshold = enc->rtp_support? 850 : 0;
- enc->cparams.data = (unsigned int *)enc->src_int_frame;
- stream_ptr = 0;
- enc->frame_no = 0;
-
- enc->enc_inited = TRUE;
-
- return TRUE;
-}
-
-
-/**********************************************
- * libr263 functions end here *
- **********************************************/
-
-GType
-gst_r263enc_get_type (void)
-{
- static GType plugin_type = 0;
-
- if (!plugin_type)
- {
- static const GTypeInfo plugin_info =
- {
- sizeof (GstR263EncClass),
- (GBaseInitFunc) gst_r263enc_base_init,
- NULL,
- (GClassInitFunc) gst_r263enc_class_init,
- NULL,
- NULL,
- sizeof (GstR263Enc),
- 0,
- (GInstanceInitFunc) gst_r263enc_init,
- };
- plugin_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstR263Enc",
- &plugin_info, 0);
- }
- return plugin_type;
-}
-
-static gboolean gst_r263enc_setcaps (GstPad * pad, GstCaps * caps)
-{
- GstStructure *structure = gst_caps_get_structure (caps, 0);
- GstR263Enc *filter;
-
- filter = GST_R263ENC (gst_pad_get_parent (pad));
-
- GST_DEBUG("calling setcaps");
-
- gboolean ret;
-
-#if 0
- struct fourcc_list_struct *fourcc;
- fourcc = (struct fourcc_list_struct *)paintinfo_find_by_structure (structure);
- if (!fourcc) {
- g_critical ("videotestsrc format not found\n");
- gst_object_unref(filter);
- return GST_PAD_LINK_REFUSED;
- }
-#endif
-
- if (pad == filter->sinkpad)
- {
- ret = gst_structure_get_int (structure, "width", &filter->width);
- ret &= gst_structure_get_int (structure, "height", &filter->height);
- ret &= gst_structure_get_double (structure, "framerate", &filter->framerate);
-
- if (!ret) {
- gst_object_unref(filter);
- return FALSE;
- }
- //if (filter->width % 16 || filter->height % 16)
- // return FALSE;
-
- GST_DEBUG ("got size %d x %d framerate %d, initing compression lib",
- filter->width, filter->height, filter->framerate);
- }
-
- if (!init_encoder(filter))
- {
- gst_object_unref(filter);
- return FALSE;
- }
- gst_object_unref(filter);
- return TRUE;
-}
-
-GstCaps *
-gst_r263enc_src_getcaps (GstPad * pad)
-{
- GstR263Enc *filter;
-
- filter = GST_R263ENC (gst_pad_get_parent (pad));
- g_return_val_if_fail (filter != NULL, NULL);
-
- if (filter->rtp_support)
- {
- gst_object_unref(filter);
- return gst_caps_new_simple ("application/x-rtp",
- "payload", G_TYPE_INT, GST_RTP_PAYLOAD_H263,
- "media", G_TYPE_STRING, "video",
- "clock_rate", G_TYPE_INT, GST_RTP_H263_CLOCKRATE,
- NULL);
- }
- else
- {
- gst_object_unref(filter);
- return gst_caps_new_simple ("video/x-h263", NULL);
- }
-}
-
-static void
-gst_r263enc_base_init (GstR263EncClass *klass)
-{
- static GstElementDetails plugin_details = {
- "h.263 video encoder",
- "Codec/Encoder/Video",
- "Using libr263 by Roalt Aalmoes, http://www.huygens.org",
- "Zhanglei Wang <filamoon@hotmail.com>, Philippe Khalaf <burger@speedy.org>"
- };
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
- gst_element_class_set_details (element_class, &plugin_details);
-}
-
-/* initialize the plugin's class */
-static void
-gst_r263enc_class_init (GstR263EncClass *klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass*) klass;
- gstelement_class = (GstElementClass*) klass;
-
- parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
- gobject_class->set_property = gst_r263enc_set_property;
- gobject_class->get_property = gst_r263enc_get_property;
-
- g_object_class_install_property (gobject_class, ARG_SILENT,
- g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
- FALSE, G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, ARG_RTP,
- g_param_spec_boolean ("rtp-support", "rtp support", "Turn on RTP support ?",
- FALSE, G_PARAM_READWRITE));
-
- /* gstelement_class->change_state = gst_r263enc_change_state; */
- gobject_class->finalize = gst_r263enc_finalize;
-
- GST_DEBUG_CATEGORY_INIT (r263enc_debug, "r263enc", 0, "R263 Encoder and RTP payloader");
-}
-
-/* initialize the new element
- * instantiate pads and add them to element
- * set functions
- * initialize structure
- */
-static void
-gst_r263enc_init (GstR263Enc *filter)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (filter);
-
- filter->sinkpad = gst_pad_new_from_template (
- gst_element_class_get_pad_template (klass, "sink"), "sink");
- gst_pad_set_setcaps_function (filter->sinkpad, gst_r263enc_setcaps);
-// gst_pad_set_getcaps_function (filter->sinkpad, gst_r263enc_sink_getcaps);
-
- filter->srcpad = gst_pad_new_from_template (
- gst_element_class_get_pad_template (klass, "src"), "src");
- gst_pad_set_setcaps_function (filter->srcpad, gst_r263enc_setcaps);
- gst_pad_set_getcaps_function (filter->srcpad, gst_r263enc_src_getcaps);
-
- gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
-
- gst_pad_set_chain_function (filter->sinkpad, gst_r263enc_chain);
-
- filter->silent = FALSE;
- filter->rtp_support = FALSE;
- filter->enc_inited = FALSE;
- filter->is_qcif = FALSE;
-}
-
-static void gst_r263enc_finalize (GObject * object)
-{
- GstR263Enc *filter;
-
- g_return_if_fail (GST_IS_R263ENC (object));
- filter = GST_R263ENC (object);
-
- uninit_encoder (filter);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/* chain function
- * this function does the actual processing
- */
-static GstFlowReturn
-gst_r263enc_chain (GstPad *pad, GstBuffer *in)
-{
- GstR263Enc *r;
- GstBuffer *out_buf;
- GstBuffer *rtp_buf = NULL;
- gint offset;
- gint header_int;
- gchar * header = (gchar*) &header_int;
- gint i;
- static gboolean first = TRUE;
-
- g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
- g_return_val_if_fail (GST_BUFFER_DATA(in) != NULL, GST_FLOW_ERROR);
-
- r = GST_R263ENC (GST_OBJECT_PARENT (pad));
- g_return_val_if_fail (GST_IS_R263ENC (r), GST_FLOW_ERROR);
-
- if (!r->enc_inited)
- {
- GST_DEBUG("Encoder not initiated! exiting chain");
- return GST_FLOW_ERROR;
- }
-
- if (r->is_qcif)
- {
- //ReadQCIFBuffer((const unsigned char*)GST_BUFFER_DATA(in), r->src_int_frame);
- GST_DEBUG("QCIF dosent work yet!");
- return GST_FLOW_ERROR;
- }
- else
- {
- ReadBuffer((const unsigned char*)GST_BUFFER_DATA(in), r->src_int_frame, r->width, r->height);
- }
-
- out_buf = gst_buffer_new_and_alloc(1024*40);
- stream_buffer = (char*)GST_BUFFER_DATA(out_buf);
- stream_ptr = r->rtp_support? 4 : 0;
-
- if ( ( (r->frame_no++) % r->gop_length) == 0 )
- {
- r->cparams.inter = CPARAM_INTRA;
- CompressToH263(&r->cparams, &r->bits);
- }
- else
- {
- r->cparams.inter = CPARAM_INTER;
- if(r->cparams.advanced_method)
- FindMotion(&r->cparams,2,2);
- CompressToH263(&r->cparams, &r->bits);
- }
-
- GST_BUFFER_SIZE(out_buf) = stream_ptr;
- GST_DEBUG("Got buffer, QCIF is %d size is %d", r->is_qcif, GST_BUFFER_SIZE(out_buf));
- /* payload header mode A */
- if (r->rtp_support)
- {
- header[0] = 0;
- /* header[0] |= (sbit << 3 | ebit); */ /* always byte-aligned */
- //1: SRC(3) I U S A R
- header[1] = 0x40 | ( (r->cparams.inter == CPARAM_INTER) << 4 ); //SRC=010, QCIF
- //2: R R R DBQ(2) TRB(3)
- header[2] = 0; //R must be 0, we don't use B frames, so DBQ=00, TRB=000
- //3: TR(8)
- header[3] = (char) r->frame_no; //(((int64_t)s->picture_number * 30 * s->avctx->frame_rate_base) /
-
- GST_DEBUG("Got frame size is %d, rtp_count is : %d, rtp_offsetlast is : %d, frame : %d\n",
- stream_ptr, r->bits.rtp_count, r->bits.rtp_offset[r->bits.rtp_count-1],
- r->frame_no);
-
- offset = 0;
- //gst_util_dump_mem (GST_BUFFER_DATA(out_buf), 32);
- //for(i=1; i<r->bits.rtp_count-1; i++)
- for(i=1; i<r->bits.rtp_count; i++)
- {
- *(int*)(stream_buffer+offset) = header_int;
- int size = r->bits.rtp_offset[i] - r->bits.rtp_offset[i-1];
- rtp_buf = gst_rtp_buffer_new_allocate (size, 0, 0);
- memcpy ((guint8 *)gst_rtp_buffer_get_payload (rtp_buf), GST_BUFFER_DATA(out_buf)+offset, size);
- if (first)
- {
- GST_DEBUG("Setting caps on first buffer");
- gst_buffer_set_caps (rtp_buf, gst_pad_get_caps(r->srcpad));
- first = FALSE;
- }
- gst_rtp_buffer_set_payload_type (rtp_buf, GST_RTP_PAYLOAD_H263);
- gst_rtp_buffer_set_marker (rtp_buf, FALSE);
- // clock rate is 90 kHz for this payload
- //rtp_buf->timestampinc = 90000 / r->framerate;
- GstClockTime timestamp = GST_BUFFER_TIMESTAMP (in);
- guint32 ts = 0;
- if (GST_CLOCK_TIME_IS_VALID (timestamp))
- {
- ts = timestamp * GST_RTP_H263_CLOCKRATE / GST_SECOND;
- gst_rtp_buffer_set_timestamp (rtp_buf, ts);
- }
- GST_DEBUG("Calculated timestamp is %u", ts);
-
- GST_DEBUG("%d : One part is %d, from %d %d %d", i, size, offset, r->bits.rtp_offset[i-1], r->bits.rtp_offset[i]);
-
- if(i+1 >= r->bits.rtp_count)
- {
- gst_rtp_buffer_set_marker (rtp_buf, TRUE);
- }
-
- gst_pad_push (r->srcpad, GST_BUFFER(rtp_buf));
-
- offset = r->bits.rtp_offset[i];
- }
- gst_buffer_unref(out_buf);
- }
- else
- {
- if (first)
- {
- GST_DEBUG("Setting caps on first buffer");
- gst_buffer_set_caps (out_buf, gst_pad_get_caps(r->srcpad));
- first = FALSE;
- }
- //gst_util_dump_mem (GST_BUFFER_DATA(out_buf), 24);
- gst_pad_push (r->srcpad, out_buf);
- }
- gst_buffer_unref(in);
- return GST_FLOW_OK;
-}
-
-/*
-static GstStateChangeReturn
-gst_r263enc_change_state (GstElement *element, GstStateChange transition);
-{
- GST_DEBUG("custom change state");
- GstR263Enc *filter;
-
- g_return_if_fail (GST_IS_R263ENC (element));
- filter = GST_R263ENC (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- init_encoder(filter);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- init_encoder(filter);
- break;
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- uninit_encoder(filter);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- }
-
- return parent_class->change_state (element, transition);
-}*/
-
-static void
-gst_r263enc_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
-{
- GstR263Enc *filter;
-
- g_return_if_fail (GST_IS_R263ENC (object));
- filter = GST_R263ENC (object);
-
- switch (prop_id)
- {
- case ARG_SILENT:
- filter->silent = g_value_get_boolean (value);
- break;
- case ARG_RTP:
- filter->rtp_support = g_value_get_boolean (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_r263enc_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
-{
- GstR263Enc *filter;
-
- g_return_if_fail (GST_IS_R263ENC (object));
- filter = GST_R263ENC (object);
-
- switch (prop_id) {
- case ARG_SILENT:
- g_value_set_boolean (value, filter->silent);
- break;
- case ARG_RTP:
- g_value_set_boolean (value, filter->rtp_support);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/gst/r263/gstr263enc.h b/gst/r263/gstr263enc.h
deleted file mode 100644
index 5477726..0000000
--- a/gst/r263/gstr263enc.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* GStreamer
- * Copyright (C) 2005 Philippe Khalaf <burger@speedy.org>
- * Copyright (C) 1999-2005 Wang, Zhanglei <filamoon@hotmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_R263ENC_H__
-#define __GST_R263ENC_H__
-
-#include <gst/gst.h>
-
-#include <libr263/libr263.h>
-G_BEGIN_DECLS
-
-/* #define's don't like whitespacey bits */
-#define GST_TYPE_R263ENC (gst_r263enc_get_type())
-#define GST_R263ENC(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_R263ENC,GstR263Enc))
-#define GST_R263ENC_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_R263ENC,GstR263Enc))
-#define GST_IS_R263ENC(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_R263ENC))
-#define GST_IS_R263ENC_CLASS(obj) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_R263ENC))
-
-typedef struct _GstR263Enc GstR263Enc;
-typedef struct _GstR263EncClass GstR263EncClass;
-
-GType gst_r263enc_get_type (void);
-
-struct _GstR263Enc
-{
- GstElement element;
-
- GstPad *sinkpad, *srcpad;
-
- gboolean silent;
- gboolean rtp_support;
- gint width, height;
- gdouble framerate;
- gboolean enc_inited;
- gboolean is_qcif;
-
- /* libr263 parameters */
- CParam cparams;
- Bits bits;
- gint * EncodeBlocks;
- gint gop_length;
- guint frame_no;
- //struct qcif * qcif_frame;
- unsigned int * src_int_frame;
-};
-
-struct _GstR263EncClass
-{
- GstElementClass parent_class;
-};
-
-GType gst_plugin_r263enc_get_type (void);
-
-G_END_DECLS
-
-#endif /* __GST_R263ENC_H__ */
diff --git a/gst/r263/libr263/.git-darcs-dir b/gst/r263/libr263/.git-darcs-dir
deleted file mode 100644
index e69de29..0000000
--- a/gst/r263/libr263/.git-darcs-dir
+++ /dev/null
diff --git a/gst/r263/libr263/DISCLAIMER b/gst/r263/libr263/DISCLAIMER
deleted file mode 100644
index 6cfa473..0000000
--- a/gst/r263/libr263/DISCLAIMER
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Disclaimer of Warranty
- *
- * These software programs are available to the user without any
- * license fee or royalty on an "as is" basis. Roalt Aalmoes and the
- * Twente University disclaims any and all warranties, whether express,
- * implied, or statuary, including any implied warranties or
- * merchantability or of fitness for a particular purpose. In no
- * event shall the copyright-holder be liable for any incidental,
- * punitive, or consequential damages of any kind whatsoever arising
- * from the use of these programs.
- *
- * This disclaimer of warranty extends to the user of these programs
- * and user's customers, employees, agents, transferees, successors,
- * and assigns.
- *
- * Roalt Aalmoes and Twente University do not represent or warrant that
- * the programs furnished hereunder are free of infringement of any
- * third-party patents.
- *
- * Commercial implementations of H.263, including shareware, are
- * subject to royalty fees to patent holders. Many of these patents
- * are general enough such that they are unavoidable regardless of
- * implementation design.
- * */
-
diff --git a/gst/r263/libr263/Makefile b/gst/r263/libr263/Makefile
deleted file mode 100644
index 869d678..0000000
--- a/gst/r263/libr263/Makefile
+++ /dev/null
@@ -1,95 +0,0 @@
-# Makefile for R263 library functions, a compression library
-# to H.263 bitstreams.
-# (C) Copyright 1996, Twente University
-# All rights reserved. Other copyrights and/or patents may also apply, see
-# source code
-
-SRCS = libr263.c dct.c coder.c quant.c mot_est.c pred.c \
- countbit.c stream.c huffman.c \
- rlib.c \
- Makefile manual.tex README DISCLAIMER
-HDRS = libr263.h sim.h macros.h huffman.h ctables.h config.h \
- indices.h \
- owntypes.h \
- rlib.h
-OBJS = dct.o coder.o quant.o mot_est.o pred.o \
- countbit.o stream.o huffman.o libr263.o \
- rlib.o
-
-# use -DLONGISDOUBLEINT if sizeof(long) is 2*sizeof(int) as copy
-# operations with longs are faster than with ints
-# (for instance, Alpha processor, but not for i486)
-# Use either STANDARDIDCT, FASTIDCT or VERYFASTIDCT for IDCT operations.
-# Use either STANDARDDCT or FASTDCT for DCT operations.
-
-FORMAT = -DFASTDCT -DVERYFASTIDCT
-
-CC = gcc
-CFLAGS = -O3 -finline-functions -Winline -funroll-loops -pedantic $(FORMAT) -Wall -Winline -c -DEXTERN_BUF -DRTP_SUPPORT -g
-
-# If you want to compile with -Wall -pedantic -ansi on a Sun, use
-# -DBROKEN_SUN_HEADERS to avoid a lot of compiler warnings
-
-library: rlib.a libr263.a
-
-help:
- @echo "libr263 package - (C) Copyright 1996, 1997, Roalt Aalmoes"
- @echo " and Twente University "
- @echo " - Version 0.1"
- @echo "make library: Create libr263.a library and supporting"
- @echo " rlib.a library"
- @echo " "
- @echo "make man : Create manual for libr263 in postscript"
- @echo " "
- @echo "make all : Create both libraries and manual"
- @echo " "
- @echo "make tar : Create tar file for distribution or backup"
- @echo " "
-
-
-#library: rlib.a libr263.a
-
-all: rlib.a libr263.a
-
-libr263.o: libr263.c libr263.h sim.h
-coder.o: coder.c sim.h libr263.h
-dct.o: dct.c sim.h libr263.h
-quant.o: quant.c sim.h libr263.h
-pred.o: pred.c sim.h libr263.h
-mot_est.o: mot_est.c sim.h config.h libr263.h
-stream.o: stream.c sim.h libr263.h
-huffman.o: huffman.c huffman.h ctables.h
-countbit.o: huffman.c countbit.c huffman.h sim.h indices.h libr263.h
-
-
-man: manual.tex
- latex manual
- dvips manual
-
-
-clean:
- rm -f $(OBJS) *~ libr263.a rlib.a manual.ps manual.log manual.aux
-
-tar: $(SRCS) $(HDRS)
- tar cvf libr263.tar $(SRCS) $(HDRS)
- gzip libr263.tar
-
-distdir:
- cp -rf * $(distdir)/.
- cd $(distdir); make distclean
-
-distclean: clean
-
-
-libr263.a: $(OBJS)
- ar rc libr263.a $(OBJS)
-
-rlib.a: rlib.o
- ar rc rlib.a rlib.o
-
-rlib.o: rlib.c rlib.h
-
-
-install: all
-
-uninstall:
diff --git a/gst/r263/libr263/README b/gst/r263/libr263/README
deleted file mode 100644
index c7a65c3..0000000
--- a/gst/r263/libr263/README
+++ /dev/null
@@ -1,72 +0,0 @@
-(C) Copyright 1996, 1997 by Roalt Aalmoes (aalmoes@huygens.nl)
- and Huygens group of Twente University
-
-All rights reserved.
-
-This source code may be distributed freely as long as it is distributed as a
-whole and may be used for evaluation purposes only. For other use, please
-contact the author, Roalt Aalmoes.
-
-See http://www.huygens.org
-
-
-
-DISCLAIMER: THE AUTHOR OR THE TWENTE UNIVERSITY IS NOT RESPONSIBLE FOR
-ANY DAMAGE CAUSED BY THIS PACKAGE. USE THIS SOURCE CODE AT YOUR OWN RISK.
-
-
-This packages contains the R263 encoder library (LIBR263). The code is
-based on the freely available telenor implementation of Karl
-Lillevold. Other code that is used includes an optimized (I)DCT
-transformation function from University of Berkeley MPEG Codec. All
-rights that these source codes posses will also apply to this code.
-
-Only a few parts of the original telenor code can be found back in
-this code, especially the bit-manipulation function and the general
-set-up of function headers. However, most algorithms have been
-optimized and rewritten from the ground. An example of completely new
-code (which is not even borrowed from the MPEG encoder) is the
-logarithmic search algorithm. Other changes is the variable size of
-video formats (which is later also included in a new implementation of
-the telenor code).
-
-
-The source code is tested on the following platforms:
-
-* Intel 80486DX2 66 MHz, Linux, kernel 1.3.71.
-* Intel Pentium 150 MHz, Linux, kernel ?.
-* DEC Alpha, 133 and 150 MHz running OSF.
-* Sun UltraSPARC-1, Solaris version ?.
-
-As far as I know, the source code is pretty ansi-compatible. Most
-changes that may be needed are changes in the Makefile. If you have
-longs that are twice the size of ints, compile with the
--DLONGISDOUBLEINT option to take advantage of faster long copy
-operations (e.g. 64-bit instead of 32-bit).
-
-
-PROBLEMS DURING COMPILATION
-
-
-The following messages is generated during compilation:
-
- pred.c: In function `Predict_P':
- pred.c:40: warning: passing arg 4 of `FindMB' from incompatible pointer type
-
-It seems some wrong pointer type is given through. This is not harmful
-and it might be changed in a next version. A general note: in the
-encoder, signed and unsigned ints are sometimes mixed. This is not
-very good practice so be very careful what your doing if you change
-it. I think it is a heritage from the telenor code.
-
-
-
-Good luck!
-
-Roalt
-
-
-
-
-
-
diff --git a/gst/r263/libr263/coder.c b/gst/r263/libr263/coder.c
deleted file mode 100644
index 955c372..0000000
--- a/gst/r263/libr263/coder.c
+++ /dev/null
@@ -1,1106 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-/* Modyfied by Roalt Aalmoes with better algorithms and performance
- * objectives
- *
- * Warning: Although I tried to remove all advanced options code,
- * there might still be some artifacts in the code. Please do not
- * blame me for not removing all of it.
- * Removing all advanced and alternating quantization code was done
- * for performance reasons. I'm sorry these options are not
- * implemented here, but see the tmn1.7 code for a slow functioning
- * advanced H.263 compression algorithm.
- *****************************************************************/
-
-/* Notes for clear code: */
-/* var. j is used for row indexing of MB in frame */
-/* var. i is used for column indexing of MB in frame */
-
-/* pic is declared global */
-/* MV is changed: it is now a real array of MV instead of array of pointers
- to MV. Its range is also equal to MVs encoded, without border MVs
- Advantages: No more mallocs and frees in the code, disadvantages: ?? */
-/* PictImage structure is replaced by int pointer. Drawback: not flexible for
- other format. */
-
-#include"sim.h"
-
-/**********************************************************************
- *
- * Name: Clip
- * Description: clips recontructed data 0-255
- *
- * Input: pointer to recon. data structure
- * Side effects: data structure clipped
- *
- * Date: 960715 Author: Roalt Aalmoes
- *
- ***********************************************************************/
-
-__inline__ void Clip(MB_Structure *data)
-{
- int n;
- int *mb_ptr = (int *) data;
- for (n = 0; n < 256 + 64 + 64; n++) {
- *mb_ptr = mmin(255,mmax(0,*mb_ptr));
- mb_ptr++;
- }
-}
-
-/* Encodes one frame intra using params */
-
-void CodeIntraH263(CParam *params, Bits *bits)
-{
- unsigned int *new_recon;
-
- MB_Structure *data = (MB_Structure *)malloc(sizeof(MB_Structure));
- int *qcoeff;
- int Mode = MODE_INTRA;
- int CBP;
- int i,j;
-
-
- new_recon = params->recon;
-
- ZeroBits(bits);
-
- pic->QUANT = params->Q_intra;
- pic->picture_coding_type = PCT_INTRA;
-
- bits->header += CountBitsPicture(pic);
-
-
-
- for ( j = 0; j < mbr; j++) {
-
- #ifdef RTP_SUPPORT
- if ( (params->rtp_threshold != 0) && (stream_ptr > params->rtp_threshold + bits->rtp_offset[bits->rtp_count-1]) )
- {
- zeroflush();
- bits->rtp_offset[bits->rtp_count++] = stream_ptr;
- stream_ptr += 4; /* 4 bytes payload header to avoid memcpy */
- bits->header += CountBitsSlice(j,params->Q_intra); /* insert gob sync */
- }
- else
- #endif
- /* insert sync in *every* slice if use_gobsync is chosen */
- if (pic->use_gobsync && j != 0)
- bits->header += CountBitsSlice(j,params->Q_intra);
-
- for ( i = 0; i < mbc; i++) {
-
- pic->MB = i + j * mbc;
- bits->no_intra++;
-
- FillLumBlock(i*MB_SIZE, j*MB_SIZE, params->data, data);
- FillChromBlock(i*MB_SIZE, j*MB_SIZE, params->data, data);
- qcoeff = MB_EncodeAndFindCBP(data, params->Q_intra, Mode, &CBP);
-
- /* Do standard VLC encoding */
- /* COD = 0 ,Every block is coded as Intra frame */
- CountBitsMB(Mode,0,CBP,0,pic,bits);
- CountBitsCoeff(qcoeff, Mode, CBP,bits,64);
-
- MB_Decode(qcoeff, data, params->Q_intra, Mode);
- Clip(data);
- ReconImage(i,j,data,new_recon);
- free(qcoeff);
- }
- }
- pic->QP_mean = params->Q_intra;
-
- params->recon = new_recon;
-
- AddBitsPicture(bits);
- free(data);
- return;
-}
-
-/**********************************************************************
- *
- * Name: MB_Encode
- * Description: DCT and quantization of Macroblocks
- *
- * Input: MB data struct, mquant (1-31, 0 = no quant),
- * MB info struct
- * Returns: Pointer to quantized coefficients
- * Side effects:
- *
- * Date: 930128 Author: Robert.Danielsen@nta.no
- *
- **********************************************************************/
-/* If you compare original quant with FindCBP, you see they both act
- on the same range of coefficients in the cases INTRA (1..63) or
- INTER (0..63) */
-
-int *MB_EncodeAndFindCBP(MB_Structure *mb_orig, int QP, int I, int *CBP)
-{
- int i, j, k, l, row, col;
- int fblock[64];
- int coeff[384];
- int *coeff_ind;
- int *qcoeff;
- int *qcoeff_ind;
- int CBP_Mask = 32;
-
- *CBP = 0; /* CBP gives bit pattern of lowest 6 bits
- that specify which coordinates are not
- zero. Bits 6 (32) to 2 (4) repr. four
- 8x8 Y parts of macroblock, while bits
- 1 (2) and 0 (1) repr. resp. the U and
- V component */
-
- if ((qcoeff=(int *)malloc(sizeof(int)*384)) == 0) {
- fprintf(stderr,"mb_encode(): Couldn't allocate qcoeff.\n");
- exit(0);
- }
-
- coeff_ind = coeff;
- qcoeff_ind = qcoeff;
- for (k=0;k<16;k+=8) {
- for (l=0;l<16;l+=8) {
- for (i=k,row=0;row<64;i++,row+=8) {
-#if LONGISDOUBLEINT
- for (j=l,col=0;col<8;j += 2,col +=2 ) {
- *(long *) (fblock+row+col) = * (long *) &(mb_orig->lum[i][j]);
- }
-#else
- for (j=l,col=0;col<8;j++ , col++ ) {
- *(int *) (fblock+row+col) = * (int *) &(mb_orig->lum[i][j]);
- }
-#endif
-
- }
- Dct(fblock,coeff_ind);
- *CBP |= QuantAndFindCBP(coeff_ind,qcoeff_ind,QP,I,CBP_Mask);
- coeff_ind += 64;
- qcoeff_ind += 64;
- CBP_Mask = CBP_Mask>>1;
- } /* end l */
- } /* End k */
-
- for (i=0;i<8;i++) {
-#ifdef LONGISDOUBLEINT
- for (j=0;j<8;j += 2) {
- *(long *) (fblock+i*8+j) = *(long *) &(mb_orig->Cb[i][j]);
- }
-#else
- for (j=0;j<8;j++) {
- *(int *) (fblock+i*8+j) = *(int *) &(mb_orig->Cb[i][j]);
- }
-#endif
- }
- Dct(fblock,coeff_ind);
- *CBP |= QuantAndFindCBP(coeff_ind,qcoeff_ind,QP,I,CBP_Mask /* i == 4 */);
- coeff_ind += 64;
- qcoeff_ind += 64;
- CBP_Mask = CBP_Mask>>1;
-
- for (i=0;i<8;i++) {
-
-#ifdef LONGISDOUBLEINT
- for (j=0;j<8;j += 2) {
- * (long *) (fblock+i*8+j) = *(long *) &(mb_orig->Cr[i][j]);
- }
-#else
- for (j=0;j<8;j ++) {
- * (int *) (fblock+i*8+j) = *(int *) &(mb_orig->Cr[i][j]);
- }
-#endif
-
- }
- Dct(fblock,coeff_ind);
- *CBP |= QuantAndFindCBP(coeff_ind,qcoeff_ind,QP,I, CBP_Mask /* i == 5 */);
-
- return qcoeff;
-}
-
-/**********************************************************************
- *
- * Name: MB_Decode
- * Description: Reconstruction of quantized DCT-coded Macroblocks
- *
- * Input: Quantized coefficients, MB data
- * QP (1-31, 0 = no quant), MB info block
- * Returns: int (just 0)
- * Side effects:
- *
- * Date: 930128 Author: Robert.Danielsen@nta.no
- *
- **********************************************************************/
-
-
-int MB_Decode(int *qcoeff, MB_Structure *mb_recon, int QP, int I)
-{
- int i, j, k, l, row, col;
- int *iblock;
- int *qcoeff_ind;
- int *rcoeff, *rcoeff_ind;
-
-
- if ((iblock = (int *)malloc(sizeof(int)*64)) == NULL) {
- fprintf(stderr,"MB_Coder: Could not allocate space for iblock\n");
- exit(-1);
- }
- if ((rcoeff = (int *)malloc(sizeof(int)*384)) == NULL) {
- fprintf(stderr,"MB_Coder: Could not allocate space for rcoeff\n");
- exit(-1);
- }
-
- /* For control purposes */
- /* Zero data */
- for (i = 0; i < 16; i++)
-
-#ifdef LONGISDOUBLEINT
- for (j = 0; j < 8; j+=2)
- *(long *) &(mb_recon->lum[i][j]) = 0L;
-#else
- for (j = 0; j < 8; j++)
- *(int *) &(mb_recon->lum[i][j]) = 0;
-#endif
-
- for (i = 0; i < 8; i++)
-#ifdef LONGISDOUBLEINT
- for (j = 0; j < 8; j += 2) {
- *(long *) &(mb_recon->Cb[i][j]) = 0L;
- *(long *) &(mb_recon->Cr[i][j]) = 0L;
- }
-#else
- for (j = 0; j < 8; j ++) {
- *(int *) &(mb_recon->Cb[i][j]) = 0;
- *(int *) &(mb_recon->Cr[i][j]) = 0;
- }
-#endif
-
- qcoeff_ind = qcoeff;
- rcoeff_ind = rcoeff;
-
- for (k=0;k<16;k+=8) {
- for (l=0;l<16;l+=8) {
- Dequant(qcoeff_ind,rcoeff_ind,QP,I);
-
-#ifdef STANDARDIDCT
- idctref(rcoeff_ind,iblock);
-#else
- idct(rcoeff_ind,iblock);
-#endif
-
- qcoeff_ind += 64;
- rcoeff_ind += 64;
- for (i=k,row=0;row<64;i++,row+=8) {
-#ifdef LONGISDOUBLEINT
- for (j=l,col=0;col<8;j += 2,col += 2) {
- *(long *) &(mb_recon->lum[i][j]) = * (long *) (iblock+row+col);
- }
-#else
- for (j=l,col=0;col<8; j++, col++) {
- *(int *) &(mb_recon->lum[i][j]) = * (int *) (iblock+row+col);
- }
-#endif
- }
- }
- }
- Dequant(qcoeff_ind,rcoeff_ind,QP,I);
-
-#ifdef STANDARDIDCT
- idctref(rcoeff_ind,iblock);
-#else
- idct(rcoeff_ind,iblock);
-#endif
-
- qcoeff_ind += 64;
- rcoeff_ind += 64;
- for (i=0;i<8;i++) {
-#ifdef LONGISDOUBLEINT
- for (j=0;j<8;j +=2 ) {
- *(long *) &(mb_recon->Cb[i][j]) = *(long *) (iblock+i*8+j);
- }
-#else
- for (j=0;j<8;j++ ) {
- *(int *) &(mb_recon->Cb[i][j]) = *(int *) (iblock+i*8+j);
- }
-#endif
- }
- Dequant(qcoeff_ind,rcoeff_ind,QP,I);
-#ifdef STANDARDIDCT
- idctref(rcoeff_ind,iblock);
-#else
- idct(rcoeff_ind,iblock);
-#endif
-
- for (i=0;i<8;i++) {
-#ifdef LONGISDOUBLEINT
- for (j=0;j<8;j += 2) {
- *(long *) &(mb_recon->Cr[i][j]) = *(long *) (iblock+i*8+j);
- }
-#else
- for (j=0;j<8;j++) {
- *(int *) &(mb_recon->Cr[i][j]) = *(int *) (iblock+i*8+j);
- }
-#endif
- }
- free(iblock);
- free(rcoeff);
- return 0;
-}
-
-
-/**********************************************************************
- *
- * Name: FillLumBlock
- * Description: Fills the luminance of one block of lines*pels
- *
- * Input: Position, pointer to qcif, array to fill
- * Returns:
- * Side effects: fills array
- *
- * Date: 930129 Author: Karl.Lillevold@nta.no
- *
- ***********************************************************************/
-
-void FillLumBlock( int x, int y, unsigned int *image, MB_Structure *data)
-{
- int n, m;
- /* OPTIMIZE HERE */
- /* m -> int conversion is done here, so no long optimiz. possible */
- for (n = 0; n < MB_SIZE; n++)
- for (m = 0; m < MB_SIZE; m++)
- data->lum[n][m] =
- (int) (*(image + x+m + (y+n)*pels));
- return;
-}
-
-/**********************************************************************
- *
- * Name: FillChromBlock
- * Description: Fills the chrominance of one block of qcif
- *
- * Input: Position, pointer to qcif, array to fill
- * Returns:
- * Side effects: fills array
- * 128 subtracted from each
- *
- * Date: 930129 Author: Karl.Lillevold@nta.no
- *
- ***********************************************************************/
-
-void FillChromBlock(int x_curr, int y_curr, unsigned int *image,
- MB_Structure *data)
-{
- int n;
- register int m;
-
- int x, y;
-
- x = x_curr>>1;
- y = y_curr>>1;
-
- for (n = 0; n < (MB_SIZE>>1); n++)
- for (m = 0; m < (MB_SIZE>>1); m++) {
- data->Cr[n][m] =
- (int) (*(image + vskip + x+m + (y+n)*cpels));
- data->Cb[n][m] =
- (int) (*(image + uskip + x+m + (y+n)*cpels));
- }
- return;
-}
-
-
-/**********************************************************************
- *
- * Name: ZeroMBlock
- * Description: Fills one MB with Zeros
- *
- * Input: MB_Structure to zero out
- * Returns:
- * Side effects:
- *
- * Date: 940829 Author: Karl.Lillevold@nta.no
- *
- ***********************************************************************/
-
-void ZeroMBlock(MB_Structure *data)
-{
- int n;
- register int m;
-
- /* ALPHA optimization */
-#ifdef LONGISDOUBLEINT
- for (n = 0; n < MB_SIZE; n++)
- for (m = 0; m < MB_SIZE; m +=2 )
- *(long *) &(data->lum[n][m]) = 0L;
- for (n = 0; n < (MB_SIZE>>1); n++)
- for (m = 0; m < (MB_SIZE>>1); m +=2 ) {
- *(long *) &(data->Cr[n][m]) = 0L;
- *(long *) &(data->Cb[n][m]) = 0L;
- }
-#else
- for (n = 0; n < MB_SIZE; n++)
- for (m = 0; m < MB_SIZE; m++ )
- *(int *) &(data->lum[n][m]) = 0;
- for (n = 0; n < (MB_SIZE>>1); n++)
- for (m = 0; m < (MB_SIZE>>1); m++ ) {
- *(int *) &(data->Cr[n][m]) = 0;
- *(int *) &(data->Cb[n][m]) = 0;
- }
-#endif
- return;
-}
-
-/**********************************************************************
- *
- * Name: ReconImage
- * Description: Puts together reconstructed image
- *
- * Input: position of curr block, reconstructed
- * macroblock, pointer to recontructed image
- * Returns:
- * Side effects:
- *
- * Date: 930123 Author: Karl.Lillevold@nta.no
- *
- ***********************************************************************/
-
-void ReconImage (int i, int j, MB_Structure *data, unsigned int *recon)
-{
- int n;
- int x_curr, y_curr;
- int *lum_ptr, *Cb_ptr, *Cr_ptr;
- unsigned int *recon_ptr, *recon_Cb_ptr, *recon_Cr_ptr;
-
-
- x_curr = i * MB_SIZE;
- y_curr = j * MB_SIZE;
-
- lum_ptr = &(data->lum[0][0]);
- recon_ptr = recon + x_curr + y_curr*pels;
-
- /* Fill in luminance data */
- for (n = 0; n < MB_SIZE; n++) {
-#ifdef LONGISDOUBLEINT
- * (long *) recon_ptr = * (long *) lum_ptr;
- recon_ptr += 2; lum_ptr += 2;
- * (long *) recon_ptr = * (long *) lum_ptr;
- recon_ptr += 2; lum_ptr += 2;
- * (long *) recon_ptr = * (long *) lum_ptr;
- recon_ptr += 2; lum_ptr += 2;
- * (long *) recon_ptr = * (long *) lum_ptr;
- recon_ptr += 2; lum_ptr += 2;
- * (long *) recon_ptr = * (long *) lum_ptr;
- recon_ptr += 2; lum_ptr += 2;
- * (long *) recon_ptr = * (long *) lum_ptr;
- recon_ptr += 2; lum_ptr += 2;
- * (long *) recon_ptr = * (long *) lum_ptr;
- recon_ptr += 2; lum_ptr += 2;
- * (long *) recon_ptr = * (long *) lum_ptr;
- recon_ptr += pels - 14; lum_ptr += 2;
- /* Was: for every m = 0..15 :
- *(recon->lum + x_curr+m + (y_curr+n)*pels) = *(lum_ptr++);
- */
-#else
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
- recon_ptr++; lum_ptr++;
- * (int *) recon_ptr = * (int *) lum_ptr;
-
- recon_ptr += pels - 15; lum_ptr++;
-#endif
- }
-
- recon_Cb_ptr = recon+uskip+ (x_curr>>1) + (y_curr>>1)*cpels;
- recon_Cr_ptr = recon+vskip+ (x_curr>>1) + (y_curr>>1)*cpels;
- Cb_ptr = &(data->Cb[0][0]);
- Cr_ptr = &(data->Cr[0][0]);
-
- /* Fill in chrominance data */
- for (n = 0; n < MB_SIZE>>1; n++) {
-#ifdef LONGISDOUBLEINT
- * (long *) recon_Cb_ptr = * (long *) Cb_ptr;
- recon_Cb_ptr += 2; Cb_ptr += 2;
- * (long *) recon_Cr_ptr = * (long *) Cr_ptr;
- recon_Cr_ptr += 2; Cr_ptr += 2;
- * (long *) recon_Cb_ptr = * (long *) Cb_ptr;
- recon_Cb_ptr += 2; Cb_ptr += 2;
- * (long *) recon_Cr_ptr = * (long *) Cr_ptr;
- recon_Cr_ptr += 2; Cr_ptr += 2;
- * (long *) recon_Cb_ptr = * (long *) Cb_ptr;
- recon_Cb_ptr += 2; Cb_ptr += 2;
- * (long *) recon_Cr_ptr = * (long *) Cr_ptr;
- recon_Cr_ptr += 2; Cr_ptr += 2;
- * (long *) recon_Cb_ptr = * (long *) Cb_ptr;
- recon_Cb_ptr += cpels - 6; Cb_ptr += 2;
- * (long *) recon_Cr_ptr = * (long *) Cr_ptr;
- recon_Cr_ptr += cpels - 6; Cr_ptr += 2;
-#else
- * (int *) recon_Cb_ptr = * (int *) Cb_ptr;
- recon_Cb_ptr++; Cb_ptr++;
- * (int *) recon_Cr_ptr = * (int *) Cr_ptr;
- recon_Cr_ptr++; Cr_ptr++;
- * (int *) recon_Cb_ptr = * (int *) Cb_ptr;
- recon_Cb_ptr++; Cb_ptr++;
- * (int *) recon_Cr_ptr = * (int *) Cr_ptr;
- recon_Cr_ptr++; Cr_ptr++;
- * (int *) recon_Cb_ptr = * (int *) Cb_ptr;
- recon_Cb_ptr++; Cb_ptr++;
- * (int *) recon_Cr_ptr = * (int *) Cr_ptr;
- recon_Cr_ptr++; Cr_ptr++;
- * (int *) recon_Cb_ptr = * (int *) Cb_ptr;
- recon_Cb_ptr++; Cb_ptr++;
- * (int *) recon_Cr_ptr = * (int *) Cr_ptr;
- recon_Cr_ptr++; Cr_ptr++;
- * (int *) recon_Cb_ptr = * (int *) Cb_ptr;
- recon_Cb_ptr++; Cb_ptr++;
- * (int *) recon_Cr_ptr = * (int *) Cr_ptr;
- recon_Cr_ptr++; Cr_ptr++;
- * (int *) recon_Cb_ptr = * (int *) Cb_ptr;
- recon_Cb_ptr++; Cb_ptr++;
- * (int *) recon_Cr_ptr = * (int *) Cr_ptr;
- recon_Cr_ptr++; Cr_ptr++;
- * (int *) recon_Cb_ptr = * (int *) Cb_ptr;
- recon_Cb_ptr++; Cb_ptr++;
- * (int *) recon_Cr_ptr = * (int *) Cr_ptr;
- recon_Cr_ptr++; Cr_ptr++;
-
- * (int *) recon_Cb_ptr = * (int *) Cb_ptr;
- * (int *) recon_Cr_ptr = * (int *) Cr_ptr;
-
- recon_Cb_ptr += cpels - 7; Cb_ptr ++;
- recon_Cr_ptr += cpels - 7; Cr_ptr ++;
-#endif
- }
- /* WAS:
- for (m = 0; m < MB_SIZE>>1; m++) {
- *(recon->Cr + (x_curr>>1)+m + ((y_curr>>1)+n)*cpels) = data->Cr[n][m];
- *(recon->Cb + (x_curr>>1)+m + ((y_curr>>1)+n)*cpels) = data->Cb[n][m];
- }
- */
- return;
-}
-
-/**********************************************************************
- *
- * Name: ReconCopyImage
- * Description: Copies previous recon_image to current recon image
- *
- * Input: position of curr block, reconstructed
- * macroblock, pointer to recontructed image
- * Returns:
- * Side effects:
- *
- * Date: 960423 Author: Roalt Aalmoes
- *
- ***********************************************************************/
-
-void ReconCopyImage (int i, int j, unsigned int *recon, unsigned int *prev_recon)
-{
- int n;
- int x_curr, y_curr;
- unsigned int *lum_now, *lum_prev, *cb_now, *cr_now, *cb_prev, *cr_prev;
-
-
- x_curr = i * MB_SIZE;
- y_curr = j * MB_SIZE;
-
- lum_now = recon + x_curr + y_curr*pels;
- lum_prev = prev_recon + x_curr + y_curr*pels;
-
- /* Fill in luminance data */
- for (n = 0; n < 16; n++) {
-#ifdef LONGISDOUBLEINT
- *(long *)(lum_now) = *(long *)(lum_prev);
- *(long *)(lum_now + 2) = *(long *)(lum_prev + 2);
- *(long *)(lum_now + 4) = *(long *)(lum_prev + 4);
- *(long *)(lum_now + 6) = *(long *)(lum_prev + 6);
- *(long *)(lum_now + 8) = *(long *)(lum_prev + 8);
- *(long *)(lum_now + 10) = *(long *)(lum_prev + 10);
- *(long *)(lum_now + 12) = *(long *)(lum_prev + 12);
- *(long *)(lum_now + 14) = *(long *)(lum_prev + 14);
-#else
- *(int *)(lum_now) = *(int *)(lum_prev);
- *(int *)(lum_now + 1) = *(int *)(lum_prev + 1);
-
- *(int *)(lum_now + 2) = *(int *)(lum_prev + 2);
- *(int *)(lum_now + 3) = *(int *)(lum_prev + 3);
- *(int *)(lum_now + 4) = *(int *)(lum_prev + 4);
- *(int *)(lum_now + 5) = *(int *)(lum_prev + 5);
- *(int *)(lum_now + 6) = *(int *)(lum_prev + 6);
- *(int *)(lum_now + 7) = *(int *)(lum_prev + 7);
- *(int *)(lum_now + 8) = *(int *)(lum_prev + 8);
- *(int *)(lum_now + 9) = *(int *)(lum_prev + 9);
- *(int *)(lum_now + 10) = *(int *)(lum_prev + 10);
- *(int *)(lum_now + 11) = *(int *)(lum_prev + 11);
- *(int *)(lum_now + 12) = *(int *)(lum_prev + 12);
- *(int *)(lum_now + 13) = *(int *)(lum_prev + 13);
- *(int *)(lum_now + 14) = *(int *)(lum_prev + 14);
- *(int *)(lum_now + 15) = *(int *)(lum_prev + 15);
-
-#endif
- lum_now += pels;
- lum_prev += pels;
-
- }
-
-
- cb_now = recon+uskip + (x_curr>>1) + (y_curr>>1)*cpels;
- cr_now = recon+vskip + (x_curr>>1) + (y_curr>>1)*cpels;
- cb_prev = prev_recon+uskip+ (x_curr>>1) + (y_curr>>1)*cpels;
- cr_prev = prev_recon+vskip + (x_curr>>1) + (y_curr>>1)*cpels;
-
- /* Fill in chrominance data */
- for (n = 0; n < (MB_SIZE>>1); n++) {
-#ifdef LONGISDOUBLEINT
- *(long *)(cb_now) = *(long *)(cb_prev);
- *(long *)(cb_now + 2) = *(long *)(cb_prev + 2);
- *(long *)(cb_now + 4) = *(long *)(cb_prev + 4);
- *(long *)(cb_now + 6) = *(long *)(cb_prev + 6);
- cb_now += cpels;
- cb_prev += cpels;
-
- *(long *)(cr_now) = *(long *)(cr_prev);
- *(long *)(cr_now + 2) = *(long *)(cr_prev + 2);
- *(long *)(cr_now + 4) = *(long *)(cr_prev + 4);
- *(long *)(cr_now + 6) = *(long *)(cr_prev + 6);
- cr_now += cpels;
- cr_prev += cpels;
-#else
- *(int *)(cb_now) = *(int *)(cb_prev);
- *(int *)(cb_now + 1) = *(int *)(cb_prev + 1);
- *(int *)(cb_now + 2) = *(int *)(cb_prev + 2);
- *(int *)(cb_now + 3) = *(int *)(cb_prev + 3);
- *(int *)(cb_now + 4) = *(int *)(cb_prev + 4);
- *(int *)(cb_now + 5) = *(int *)(cb_prev + 5);
- *(int *)(cb_now + 6) = *(int *)(cb_prev + 6);
- *(int *)(cb_now + 7) = *(int *)(cb_prev + 7);
- cb_now += cpels;
- cb_prev += cpels;
-
- *(int *)(cr_now) = *(int *)(cr_prev);
- *(int *)(cr_now + 1) = *(int *)(cr_prev + 1);
- *(int *)(cr_now + 2) = *(int *)(cr_prev + 2);
- *(int *)(cr_now + 3) = *(int *)(cr_prev + 3);
- *(int *)(cr_now + 4) = *(int *)(cr_prev + 4);
- *(int *)(cr_now + 5) = *(int *)(cr_prev + 5);
- *(int *)(cr_now + 6) = *(int *)(cr_prev + 6);
- *(int *)(cr_now + 7) = *(int *)(cr_prev + 7);
- cr_now += cpels;
- cr_prev += cpels;
-#endif
- }
-
- return;
-}
-
-
-/**********************************************************************
- *
- * Name: InterpolateImage
- * Description: Interpolates a complete image for easier half
- * pel prediction
- *
- * Input: pointer to image structure
- * Returns: pointer to interpolated image
- * Side effects: allocates memory to interpolated image
- *
- * Date: 950207 Author: Karl.Lillevold@nta.no
- * 960207 Author: Roalt aalmoes
- ***********************************************************************/
-
-void InterpolateImage(unsigned int *image, unsigned int *ipol_image,
- int width, int height)
-{
- /* If anyone has better ideas to optimize this code, be my guest!
- note: assembly or some advanced bitshifts routine might do the trick...*/
-
- register unsigned int *ii, *oo,
- *ii_new,
- *ii_new_line2,
- *oo_prev,
- *oo_prev_line2;
-
- register int i,j;
-
- register unsigned int pix1,pix2,pix3,pix4;
-
- ii = ipol_image;
- oo = image;
-
- oo_prev = image;
- oo_prev_line2 = image + width;
- ii_new = ipol_image;
- ii_new_line2 = ipol_image + (width<<1);
-
- /* main image */
- for (j = 0; j < height-1; j++) {
- /* get Pix1 and Pix3, because they are
- not known the first time */
- pix1 = *oo_prev;
- pix3 = *oo_prev_line2;
-
- for (i = 0; i < width-1; i++) {
- /* Pix1 Pix2
- Pix3 Pix4 */
- /* Pix2 and Pix4 are used here for first time */
- pix2 = *(oo_prev + 1);
- pix4 = *(oo_prev_line2 + 1);
-
- *(ii_new) = pix1; /* X.
- ..*/
- *(ii_new + 1) = (pix1 + pix2 + 1)>>1; /* *X
- .. */
- *ii_new_line2 = (pix1 + pix3 + 1)>>1; /* *.
- X. */
- *(ii_new_line2 + 1) = (pix1 + pix2 + pix3 + pix4 + 2)>>2;
-
- oo_prev++; oo_prev_line2++; ii_new += 2; ii_new_line2 += 2;
-
- pix1 = pix2;
- pix3 = pix4; /* Pix1 Pix2=Pix1' Pix2' */
- /* Pix3 Pix4=Pix3' Pix4' */
- }
-
- /* One but last column */
- *(ii_new++) = pix1;
- *(ii_new++) = pix3;
-
- /* Last column -On the Edge - */
- *(ii_new_line2++) = (pix1 + pix3 + 1 ) >>1;
- *(ii_new_line2++) = (pix1 + pix3 + 1 ) >>1;
-
- ii_new += (width<<1); /* ii_new now on old position ii_new_line2,so
- one interpolated screen line must be added*/
-
- ii_new_line2 += (width<<1); /* In fact, ii_new_line here has same value
- as ii_new */
-
- oo_prev += 1; /* Remember, loop is done one time less! */
-
- oo_prev_line2 += 1;
-
- }
-
- /* last lines */
- pix1 = *oo_prev;
-
- for (i = 0; i < width-1; i++) {
- pix2 = *(oo_prev + 1);
- *ii_new = *ii_new_line2 = pix1;
- *(ii_new + 1) = *(ii_new_line2 + 1) = (pix1 + pix2 + 1)>>1;
- ii_new += 2;
- ii_new_line2 += 2;
- oo_prev += 1;
- pix1 = pix2; /* Pix1 Pix2=Pix1' Pix2' */
- }
-
- /* bottom right corner pels */
- *(ii_new) = pix1;
- *(ii_new + 1) = pix1;
- *(ii_new_line2) = pix1;
- *(ii_new_line2+1) = pix1;
-
- return;
-}
-
-
-
-/**********************************************************************
- *
- * Name: FullMotionEstimatePicture
- * Description: Finds integer and half pel motion estimation
- *
- * Input: current image, previous image, interpolated
- * reconstructed previous image, seek_dist,
- * motion vector array
- * Returns:
- * Side effects: allocates memory for MV structure
- *
- * Date: 960418 Author: Roatlt
- *
- ***********************************************************************/
-
-
-void FullMotionEstimatePicture(unsigned int *curr, unsigned int *prev,
- unsigned int *prev_ipol, int seek_dist,
- MotionVector *MV_ptr,
- int advanced_method,
- int *EncodeThisBlock)
-{
- int i,j;
- MotionVector *current_MV;
-
-
-
- for(j = 0; j < mbr; j++) {
-
- for(i = 0; i < mbc; i++) {
- current_MV = MV_ptr + j*mbc + i;
-
- if(advanced_method && !*(EncodeThisBlock + j*mbc + i) ) {
-
- current_MV->x = current_MV->y = current_MV->x_half =
- current_MV->y_half = 0;
- current_MV->Mode = MODE_SKIP;
-
- } else { /* EncodeThisBlock */
-
- FullMotionEstimation(curr, prev_ipol, seek_dist, current_MV,
- i*MB_SIZE, j*MB_SIZE);
-
- current_MV->Mode = ChooseMode(curr,i*MB_SIZE,j*MB_SIZE,
- current_MV->min_error);
- if(current_MV->Mode == MODE_INTRA)
- ZeroVec(current_MV);
- }
-
- }
- }
-
-
-}
-
-
-void CodeInterH263(CParam *params, Bits *bits)
-{
-
- MotionVector *MV;
- MotionVector ZERO = {0,0,0,0,0};
- MB_Structure *recon_data_P;
- MB_Structure *diff;
- int *qcoeff_P;
- unsigned int *new_recon=NULL;
- unsigned int *prev_recon;
- int Mode;
- int CBP, CBPB=0;
- int newgob;
- int i,j;
-
- search_p_frames = params->search_method;
-
- MV = malloc(sizeof(MotionVector)*mbc*mbr);
-
- new_recon = malloc(sizeof_frame);
- prev_recon = params->recon;
- /* buffer control vars */
-
- ZeroBits(bits);
-
- /* Interpolate luminance from reconstr. picture */
-
-
- InterpolateImage(prev_recon,params->interpolated_lum,pels,lines);
-
- FullMotionEstimatePicture( params->data,
- prev_recon,
- params->interpolated_lum,
- params->half_pixel_searchwindow,MV,
- params->advanced_method, params->EncodeThisBlock);
-
- /* Calculate MV for each MB */
-
- /* ENCODE TO H.263 STREAM */
-
- for ( j = 0; j < mbr; j++) {
-
- newgob = 0;
-
- if (j == 0) {
- pic->QUANT = params->Q_inter;
- pic->picture_coding_type = PCT_INTER;
- bits->header += CountBitsPicture(pic);
- }
- else
- {
- #ifdef RTP_SUPPORT
- if ( (params->rtp_threshold != 0) && (stream_ptr > params->rtp_threshold + bits->rtp_offset[bits->rtp_count-1]) )
- {
- zeroflush();
- bits->rtp_offset[bits->rtp_count++] = stream_ptr;
- stream_ptr += 4; /* 4 bytes payload header to avoid memcpy */
- bits->header += CountBitsSlice(j,params->Q_inter); /* insert gob sync */
- newgob = 1;
- }
- else
- #endif
- if (pic->use_gobsync && j%pic->use_gobsync == 0 ) {
- bits->header += CountBitsSlice(j,params->Q_inter); /* insert gob sync */
- newgob = 1;
- }
- }
-
- for ( i = 0; i < mbc; i++) {
- /* This means: For every macroblock (i,j) do ... */
-
-
- /* We have 4 different situations:
- 1) !EncodeThisBlock: this means that the
- macroblock in not encoded
- 2) EncodeThisBlock: This means that the MB is
- encoded by using the predicted motion vector.
- 3) EncodeThisBlock: However, the approx of the
- motion vector was so bad, that INTRA coding is more
- appropiate here ...
- 4) EncodeThisBlock: The approx is so good that
- the coefficients are all zero (after quant.) and are not
- send.
- */
-
- /* This means: For every macroblock (i,j) do ... */
- pic->DQUANT = 0;
-
- Mode = MV[j*mbc + i].Mode;
-
- /* Determine position of MB */
- pic->MB = i + j * mbc;
-
- if(Mode == MODE_SKIP) {
- /* SITUATION 1 */
- Mode = MODE_INTRA; /* This might be done "better" in the future*/
- MV[j*mbc + i].Mode = Mode;
-
- ZeroVec(&(MV[j*mbc + i]));
-
- CBP = CBPB = 0;
-
- /* Now send code for "skip this MB" */
- CountBitsMB(Mode,1,CBP,CBPB,pic,bits);
-
- ReconCopyImage(i,j,new_recon,prev_recon);
-
- } else { /* Encode this block */
-
- if (Mode == MODE_INTER) {
- /* SITUATION 2 */
- /* Predict P-MB */
- diff = Predict_P(params->data,
- prev_recon,
- params->interpolated_lum,i*MB_SIZE,
- j*MB_SIZE,MV);
- } else {
- /* SITUATION 3 */
-
- /* Create MB_Structure diff that contains coefficients that must be
- sent to the other end */
-
- diff = (MB_Structure *)malloc(sizeof(MB_Structure));
- FillLumBlock(i*MB_SIZE, j*MB_SIZE, params->data, diff);
- /* Copy curr->lum to diff for macroblock (i,j) */
- FillChromBlock(i*MB_SIZE, j*MB_SIZE, params->data, diff);
- /* Equiv. for curr->Cb and curr->Cr */
- }
- /* P or INTRA Macroblock */
- /* diff -> DCT -> QUANTIZED -> qcoeff_P */
- qcoeff_P = MB_EncodeAndFindCBP(diff, params->Q_inter, Mode,&CBP);
-
- /* CBP = FindCBP(qcoeff_P, Mode, 64); -> Not required anymore */
-
- /* All encoded, now calculate decoded image
- for comparison in next frame */
-
- /* Do DECODING */
-
- if (CBP == 0 && (Mode == MODE_INTER) ) {
- /* SITUATION 4 */
- ZeroMBlock(diff);
- } else {
- /* qcoeff_P -> Dequantized -> IDCT -> diff */
- MB_Decode(qcoeff_P, diff, params->Q_inter, Mode);
- }
-
- recon_data_P = MB_Recon_P(prev_recon,
- params->interpolated_lum,diff,
- i*MB_SIZE,j*MB_SIZE,MV);
-
- Clip(recon_data_P);
- free(diff);
-
- /* Do bitstream encoding */
-
- if((CBP==0) && (EqualVec(&(MV[j*mbc+i]),&ZERO)) &&
- (Mode == MODE_INTER) ) {
-
- /* Skipped MB : both CBP and CBPB are zero, 16x16 vector is zero,
- PB delta vector is zero and Mode = MODE_INTER */
- /* Now send code for "skip this MB" */
- CountBitsMB(Mode,1,CBP,CBPB,pic,bits);
-
- } else {
-
- /* Normal MB */
- /* VLC */
- CountBitsMB(Mode,0,CBP,CBPB,pic,bits);
-
- if (Mode == MODE_INTER) {
- bits->no_inter++;
- CountBitsVectors(MV, bits, i, j, Mode, newgob, pic);
- } else {
- /* MODE_INTRA */
- bits->no_intra++;
- }
- /* Only encode coefficient if they are nonzero or Mode is INTRA*/
-
- if (CBP || Mode == MODE_INTRA)
- CountBitsCoeff(qcoeff_P, Mode, CBP, bits, 64);
-
-
- } /* End skip/not skip macroblock encoding */
-
- ReconImage(i,j,recon_data_P,new_recon);
- free(recon_data_P);
- free(qcoeff_P);
-
- } /* End advanced */
-
- } /* End for i */
-
- } /* End for j */
-
- pic->QP_mean = params->Q_inter;
-
- free(prev_recon);
- params->recon = new_recon;
-
- AddBitsPicture(bits);
- free(MV);
-
- return;
-}
-
diff --git a/gst/r263/libr263/config.h b/gst/r263/libr263/config.h
deleted file mode 100644
index 863c3ef..0000000
--- a/gst/r263/libr263/config.h
+++ /dev/null
@@ -1,168 +0,0 @@
-
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-/*****************************************************************
- * tmn (TMN encoder)
- * Copyright (C) 1995 Telenor R&D
- * Karl Olav Lillevold <kol@nta.no>
- *
- *
- *****************************************************************/
-
-#define YES 1
-#define NO 0
-
-/*************************************************************************/
-
-/* Default modes */
-/* see http://www.nta.no/brukere/DVC/h263_options.html */
-
-/* use Unrestricted Motion Vector mode as default (also option "-D") */
-#define DEF_UMV_MODE NO
-
-/* use Syntax-based Arithmetic Coding mode as default (also option "-E") */
-#define DEF_SAC_MODE NO
-
-/* use Advanced Prediction mode as default (also option "-F") */
-#define DEF_ADV_MODE NO
-
-/* use PB-frames mode as default (also option "-G") */
-#define DEF_PBF_MODE NO
-
-/*************************************************************************/
-
-
-/* Default filenames */
-
-/* default input sequence filename (also option "-i <filename>") */
-#define DEF_SEQNAME "/b2/qcif/claire.qcif"
-
-/* default output bitstream filename (also option "-B <filename>") */
-#define DEF_STREAMNAME "./stream.263"
-
-/* default filename for reconstructed sequence
- (also option "-o <filename>") */
-#define DEF_OUTFILENAME "/b2/kol/out.qcif"
-
-/* write difference image to file (also option "-w") */
-#define DEF_WRITE_DIFF NO
-
-/* default filename for difference images if "-w" is used */
-#define DEF_DIFFILENAME "./diff.qcif"
-
-/* added by Roalt */
-#define DEF_MV_FILENAME "./mvfile.dat"
-#define DEF_SKIN_LIMIT 37
-#define DEF_FACE_VALUE_LIMIT 132
-/*************************************************************************/
-
-
-/* Frame rate parameters */
-
-/* default reference frame rate, 25 or 30 Hz
- * (also option "-Z <n>") */
-#define DEF_REF_FRAME_RATE 30.0
-
-/* default number of skipped frames in original sequence compared to */
-/* the reference picture rate ( also option "-O <n>" ) */
-/* 3 means that the original sequence is grabbed at 6.25/7.5 Hz */
-/* 0 means that the original sequence is grabbed at 25.0/30.0 Hz */
-#define DEF_ORIG_SKIP 0
-
-/* default skipped frames between encoded frames (P or B) */
-/* reference is original sequence */
-/* 2 means 8.33/10.0 fps encoded frame rate with 25.0/30.0 fps original */
-/* 0 means 8.33/10.0 fps encoded frame rate with 8.33/10.0 fps original */
-#define DEF_FRAMESKIP 2
-
-/*************************************************************************/
-
-/* Search windows */
-
-
-/* default integer pel search seek distance ( also option "-s <n> " ) */
-#define DEF_SEEK_DIST 15
-
-/* default integer search window for 8x8 search centered
- around 16x16 vector. When it is zero only half pel estimation
- around the integer 16x16 vector will be performed */
-/* for best performance, keep this small, preferably zero,
- but do your own simulations if you want to try something else */
-#define DEF_8X8_WIN 0
-
-/* default search window for PB delta vectors */
-/* keep this small also */
-#define DEF_PBDELTA_WIN 2
-
-/*************************************************************************/
-
-
-/* Frame numbers to start and stop encoding at */
-
-/* default frame number to start at (also option "-a <n>") */
-#define DEF_START_FRAME 0
-
-/* default frame number to stop at (also option "-b <n>") */
-#define DEF_STOP_FRAME 0
-
-/*************************************************************************/
-
-
-/* Quantization parameters */
-
-/* default inter quantization parameter (also option "-q <n>") */
-#define DEF_INTER_QUANT 10
-
-/* default intra quantization parameter (also option "-I <n>") */
-#define DEF_INTRA_QUANT 10
-
-/* BQUANT parameter for PB-frame coding
- * (n * QP / 4 )
- *
- * BQUANT n
- * 0 5
- * 1 6
- * 2 7
- * 3 8
- * ( also option "-Q <BQUANT>" ) */
-#define DEF_BQUANT 2
-
-
-/*************************************************************************/
-
-/* Miscellaneous */
-
-/* write repeated reconstructed frames to disk (useful for variable
- * framerate, since sequence will be saved at 25 Hz)
- * Can be changed at run-time with option "-m" */
-#define DEF_WRITE_REPEATED NO
-
-/* write bitstream trace to files trace.intra / trace
- * (also option "-t") */
-#define DEF_WRITE_TRACE NO
-
-/* start rate control after DEF_START_RATE_CONTROL % of sequence
- * has been encoded. Can be changed at run-time with option "-R <n>" */
-#define DEF_START_RATE_CONTROL 0
-
-/* headerlength on concatenated 4:1:1 YUV input file
- * Can be changed at run-time with option -e <headerlength> */
-#define DEF_HEADERLENGTH 0
-
-/* insert sync after each DEF_INSERT_SYNC for increased error robustness
- * 0 means do not insert extra syncs */
-#define DEF_INSERT_SYNC 0
-
-/*************************************************************************/
diff --git a/gst/r263/libr263/countbit.c b/gst/r263/libr263/countbit.c
deleted file mode 100644
index 8723363..0000000
--- a/gst/r263/libr263/countbit.c
+++ /dev/null
@@ -1,761 +0,0 @@
-/*************************************************
- * libr263: fast H.263 encoder library
- *
- * Copyright (C) 1996, Roalt Aalmoes, Twente University
- * SPA multimedia group
- *
- * Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D)
- * created by Karl Lillevold
- *
- * Author encoder: Roalt Aalmoes, <aalmoes@huygens.nl>
- *
- * Date: 31-07-96
- **************************************************/
-
-
-#include"sim.h"
-#include"huffman.h"
-#include"indices.h"
-
-/**********************************************************************
- *
- * Name: CountBitsMB
- * Description: counts bits used for MB info
- *
- * Input: Mode, COD, CBP, Picture and Bits structures
- * Returns:
- * Side effects:
- *
- * Date: 941129 Author: Karl.Lillevold@nta.no
- *
- ***********************************************************************/
-
-void CountBitsMB(int Mode, int COD, int CBP, int CBPB, Pict *pic, Bits *bits)
-{
- extern EHUFF *vlc_cbpy, *vlc_cbpcm, *vlc_cbpcm_intra;
- int cbpy, cbpcm, length;
-
- /* COD */
- if (trace) {
- fprintf(tf,"MB-nr: %d",pic->MB);
- if (pic->picture_coding_type == PCT_INTER)
- fprintf(tf," COD: %d\n",COD);
- }
- if (pic->picture_coding_type == PCT_INTER) {
- mputv(1,COD);
- bits->COD++;
- }
-
- if (COD)
- return; /* not coded */
-
- /* CBPCM */
- cbpcm = Mode | ((CBP&3)<<4);
-
-
- if (trace) {
- fprintf(tf,"CBPCM (CBP=%d) (cbpcm=%d): ",CBP,cbpcm);
- }
- if (pic->picture_coding_type == PCT_INTRA) {
- length = Encode(cbpcm,vlc_cbpcm_intra);
- } else {
- length = Encode(cbpcm,vlc_cbpcm);
- }
- bits->CBPCM += length;
-
-
- /* CBPY */
- cbpy = CBP>>2;
- if (Mode == MODE_INTRA || Mode == MODE_INTRA_Q) /* Intra */
- cbpy = cbpy^15;
- if (trace) {
- fprintf(tf,"CBPY (CBP=%d) (cbpy=%d): ",CBP,cbpy);
- }
- length = Encode(cbpy, vlc_cbpy);
- bits->CBPY += length;
-
-
- return;
-}
-
-
-/**********************************************************************
- *
- * Name: CountBitsSlice
- * Description: couonts bits used for slice (GOB) info
- *
- * Input: slice no., quantizer
- *
- * Date: 94???? Author: Karl.Lillevold@nta.no
- *
- ***********************************************************************/
-
-int CountBitsSlice(int slice, int quant)
-{
- int bits = 0;
-
-
- /* Picture Start Code */
- if (trace)
- fprintf(tf,"GOB sync (GBSC): ");
- mputv(PSC_LENGTH,PSC); /* PSC */
- bits += PSC_LENGTH;
-
- /* Group Number */
- if (trace)
- fprintf(tf,"GN: ");
- mputv(5,slice);
- bits += 5;
-
- /* GOB Sub Bitstream Indicator */
- /* if CPM == 1: read 2 bits GSBI */
- /* not supported in this version */
-
- /* GOB Frame ID */
- if (trace)
- fprintf(tf,"GFID: ");
- mputv(2, 0);
- /* NB: in error-prone environments this value should change if
- PTYPE in picture header changes. In this version of the encoder
- PTYPE only changes when PB-frames are used in the following cases:
- (i) after the first intra frame
- (ii) if the distance between two P-frames is very large
- Therefore I haven't implemented this GFID change */
- /* GFID is not allowed to change unless PTYPE changes */
- bits += 2;
-
- /* Gquant */
- if (trace)
- fprintf(tf,"GQUANT: ");
- mputv(5,quant);
- bits += 5;
-
- return bits;
-}
-
-
-/**********************************************************************
- *
- * Name: CountBitsCoeff
- * Description: counts bits used for coeffs
- *
- * Input: qcoeff, coding mode CBP, bits structure, no. of
- * coeffs
- *
- * Returns: struct with no. of bits used
- * Side effects:
- *
- * Date: 940111 Author: Karl.Lillevold@nta.no
- *
- ***********************************************************************/
-
-void CountBitsCoeff(int *qcoeff, int Mode, int CBP, Bits *bits, int ncoeffs)
-
-{
-
- int i;
-
- if (Mode == MODE_INTRA) {
- for (i = 0; i < 4; i++) {
- bits->Y += CodeCoeff(Mode, qcoeff,i,ncoeffs);
- }
- for (i = 4; i < 6; i++) {
- bits->C += CodeCoeff(Mode, qcoeff,i,ncoeffs);
- }
- }
- else {
- for (i = 0; i < 4; i++) {
- if ((i==0 && CBP&32) ||
- (i==1 && CBP&16) ||
- (i==2 && CBP&8) ||
- (i==3 && CBP&4) ||
- (i==4 && CBP&2) ||
- (i==5 && CBP&1)) {
- bits->Y += CodeCoeff(Mode, qcoeff, i, ncoeffs);
- }
- }
- for (i = 4; i < 6; i++) {
- if ((i==0 && CBP&32) ||
- (i==1 && CBP&16) ||
- (i==2 && CBP&8) ||
- (i==3 && CBP&4) ||
- (i==4 && CBP&2) ||
- (i==5 && CBP&1)) {
- bits->C += CodeCoeff(Mode, qcoeff, i, ncoeffs);
- }
- }
- }
- return;
-}
-
-int CodeCoeff(int Mode, int *qcoeff, int block, int ncoeffs)
-{
- int j, bits;
- int prev_run, run, prev_level, level, first;
- int prev_ind, ind, prev_s, s, length;
-
- extern EHUFF *vlc_3d;
-
- run = bits = 0;
- first = 1;
- prev_run = prev_level = prev_ind = level = s = prev_s = ind = 0;
-
- for (j = block*ncoeffs; j< (block + 1)*ncoeffs; j++) {
- /* Do this block's DC-coefficient first */
- if (!(j%ncoeffs) && (Mode == MODE_INTRA)) {
- /* DC coeff */
- if (trace) {
- fprintf(tf,"DC: ");
- }
- if (qcoeff[block*ncoeffs] != 128)
- mputv(8,qcoeff[block*ncoeffs]);
- else
- mputv(8,255);
- bits += 8;
- }
- else {
- /* AC coeff */
- s = 0;
- /* Increment run if coeff is zero */
- if ((level = qcoeff[j]) == 0) {
- run++;
- }
- else {
- /* code run & level and count bits */
- if (level < 0) {
- s = 1;
- level = -level;
- }
- ind = level | run<<4;
- ind = ind | 0<<12; /* Not last coeff */
-
- if (!first) {
- /* Encode the previous ind */
- if (prev_level < 13 && prev_run < 64) {
- length = Encode(prev_ind,vlc_3d);
-
- } else
- length = 0;
- if (length == 0) { /* Escape coding */
- if (trace) {
- fprintf(tf,"Escape coding:\n");
- }
- if (prev_s == 1) {prev_level = (prev_level^0xff)+1;}
- Encode(ESCAPE,vlc_3d);
- mputv(1,0);
- mputv(6,prev_run);
- mputv(8,prev_level);
- bits += 22;
- }
- else {
- mputv(1,prev_s);
- bits += length + 1;
- }
- }
- prev_run = run; prev_s = s;
- prev_level = level; prev_ind = ind;
-
- run = first = 0;
- }
- }
- }
- /* Encode the last coeff */
- if (!first) {
- if (trace) {
- fprintf(tf,"Last coeff: ");
- }
- prev_ind = prev_ind | 1<<12; /* last coeff */
- if (prev_level < 13 && prev_run < 64) {
- length = Encode(prev_ind,vlc_3d);
- } else
- length = 0;
- if (length == 0) { /* Escape coding */
- if (trace) {
- fprintf(tf,"Escape coding:\n");
- }
- if (prev_s == 1) {prev_level = (prev_level^0xff)+1;}
- Encode(ESCAPE,vlc_3d);
- mputv(1,1);
- mputv(6,prev_run);
- mputv(8,prev_level);
- bits += 22;
- }
- else {
- mputv(1,prev_s);
- bits += length + 1;
- }
- }
- return bits;
-}
-
-
-/**********************************************************************
- *
- * Name: FindCBP
- * Description: Finds the CBP for a macroblock
- *
- * Input: qcoeff and mode
- *
- * Returns: CBP
- * Side effects:
- *
- * Date: 940829 Author: Karl.Lillevold@nta.no
- *
- ***********************************************************************/
-
-
-int FindCBP(int *qcoeff, int Mode, int ncoeffs)
-{
-
- int i,j;
- int CBP = 0;
-
- /* IF INTRABLOCK then intra =1 else 0 */
- int intra = (Mode == MODE_INTRA);
-
- /* Set CBP for this Macroblock */
- for (i = 0; i < 6; i++) {
-
- /* First time i = 0: j = 0 ..64-1 set bit 5 if coeff != 0
- Sec. time i = 1; j = 64..128-1 set bit 4 if coeff != 0
- */
- /* OPTIMIZE: I think for i can be removed
- and only values i=0 must be proessed */
- for (j = i*ncoeffs + intra; j < (i+1)*ncoeffs; j++) {
- if (qcoeff[j]) {
- if (i == 0) {CBP |= 32;}
- else if (i == 1) {CBP |= 16;}
- else if (i == 2) {CBP |= 8;}
- else if (i == 3) {CBP |= 4;}
- else if (i == 4) {CBP |= 2;}
- else if (i == 5) {CBP |= 1;}
- else {
- fprintf(stderr,"Error in CBP assignment\n");
- exit(-1);
- }
- break;
- }
- }
- }
-
- return CBP;
-}
-
-
-void CountBitsVectors(MotionVector *MV_ptr, Bits *bits,
- int x, int y, int Mode, int newgob, Pict *pic)
-{
- int y_vec, x_vec;
- extern EHUFF *vlc_mv;
- int pmv0, pmv1;
- int start,stop,block;
- MotionVector *MV_xy;
-
- start = 0; stop = 0;
- MV_xy = MV_ptr + y*mbc + x;
-
- for (block = start; block <= stop; block++) {
-
- FindPMV(MV_ptr,x,y,&pmv0,&pmv1, block, newgob, 1);
-
- x_vec = (2*(*MV_xy).x + (*MV_xy).x_half) - pmv0;
- y_vec = (2*(*MV_xy).y + (*MV_xy).y_half) - pmv1;
-
- if (!long_vectors) {
- if (x_vec < -32) x_vec += 64;
- else if (x_vec > 31) x_vec -= 64;
-
- if (y_vec < -32) y_vec += 64;
- else if (y_vec > 31) y_vec -= 64;
- }
- else {
- if (pmv0 < -31 && x_vec < -63) x_vec += 64;
- else if (pmv0 > 32 && x_vec > 63) x_vec -= 64;
-
- if (pmv1 < -31 && y_vec < -63) y_vec += 64;
- else if (pmv1 > 32 && y_vec > 63) y_vec -= 64;
- }
-
- if (x_vec < 0) x_vec += 64;
- if (y_vec < 0) y_vec += 64;
-
- if (trace) {
- fprintf(tf,"Vectors:\n");
- }
- bits->vec += Encode(x_vec,vlc_mv);
- bits->vec += Encode(y_vec,vlc_mv);
-
- if (trace) {
- if (x_vec > 31) x_vec -= 64;
- if (y_vec > 31) y_vec -= 64;
- fprintf(tf,"(x,y) = (%d,%d) - ",
- (2*(*MV_xy).x + (*MV_xy).x_half),
- (2*(*MV_xy).y + (*MV_xy).y_half));
- fprintf(tf,"(Px,Py) = (%d,%d)\n", pmv0,pmv1);
- fprintf(tf,"(x_diff,y_diff) = (%d,%d)\n",x_vec,y_vec);
- }
- }
-
- return;
-}
-
-void FindPMV(MotionVector *MV_ptr, int x, int y,
- int *pmv0, int *pmv1, int block, int newgob, int half_pel)
-{
- int p1,p2,p3;
- int xin1,xin2,xin3;
- int yin1,yin2,yin3;
- int vec1,vec2,vec3;
- int l8,o8,or8;
-
- l8 = o8 = or8 = 0;
-
- vec1 = (l8 ? 2 : 0) ; yin1 = y ; xin1 = x-1;
- vec2 = (o8 ? 3 : 0) ; yin2 = y-1; xin2 = x;
- vec3 = (or8? 3 : 0) ; yin3 = y-1; xin3 = x+1;
-
- if (half_pel) {
-
- p1 = (x > 0) ?
- 2*((*(MV_ptr + yin1*mbc + xin1)).x) + (*(MV_ptr+ yin1*mbc + xin1)).x_half : 0;
- p2 = (y > 0) ?
- 2*((*(MV_ptr + yin2*mbc + xin2)).x) + (*(MV_ptr + yin2*mbc + xin2)).x_half : 2*NO_VEC;
- if((y > 0) && (x < mbc - 1))
- p3 = 2*((*(MV_ptr+yin3*mbc + xin3)).x) + ((*(MV_ptr + yin3*mbc + xin3)).x_half);
- else if(x == mbc - 1)
- p3 = 0;
- else /* y == 0 && x != mbc - 1 */
- p3 = 2*NO_VEC;
- }
- else {
- p1 = (x > 0) ?
- (2*((*(MV_ptr + yin1*mbc + xin1)).x)) : 0;
- p2 = (y > 0) ?
- (2*((*(MV_ptr + yin2*mbc + xin2)).x)) : 2*NO_VEC;
- if((y > 0) && (x < mbc - 1))
- p3 = 2*((*(MV_ptr + yin3*mbc + xin3)).x);
- else if(x == mbc - 1)
- p3 = 0;
- else /* y == 0 && x != mbc - 1 */
- p3 = 2*NO_VEC;
- }
-
- if (newgob && (block == 0 || block == 1 || block == 2))
- p2 = 2*NO_VEC;
-
- if (p2 == 2*NO_VEC) { p2 = p3 = p1; }
-
- *pmv0 = p1+p2+p3 - mmax(p1,mmax(p2,p3)) - mmin(p1,mmin(p2,p3));
- if (half_pel) {
- p1 = (x > 0) ?
- (2*((*(MV_ptr + yin1*mbc + xin1)).y)) + ((*(MV_ptr + yin1*mbc + xin1)).y_half) : 0;
- p2 = (y > 0) ?
- 2*((*(MV_ptr + yin2*mbc + xin2)).y) + ((*(MV_ptr + yin2*mbc + xin2)).y_half) : 2*NO_VEC;
-
- if((y > 0) && (x < mbc - 1))
- p3 = 2*((*(MV_ptr + yin3*mbc + xin3)).y) + ((*(MV_ptr + mbc*yin3 + xin3)).y_half);
- else if(x == mbc - 1)
- p3 = 0;
- else /* y == 0 && x != mbc - 1 */
- p3 = 2*NO_VEC;
-
- }
- else {
- p1 = (x > 0) ?
- (2*((*(MV_ptr + yin1*mbc + xin1)).y)) : 0;
- p2 = (y > 0) ?
- (2*((*(MV_ptr + yin2*mbc + xin2)).y)) : 2*NO_VEC;
- if((y > 0) && (x < mbc - 1))
- p3 = 2*((*(MV_ptr + yin3*mbc + xin3)).y);
- else if(x == mbc - 1)
- p3 = 0;
- else /* y == 0 && x != mbc - 1 */
- p3 = 2*NO_VEC;
- }
-
-
- if (newgob && (block == 0 || block == 1 || block == 2))
- p2 = 2*NO_VEC;
-
- if (p2 == 2*NO_VEC) { p2 = p3 = p1; }
-
- *pmv1 = p1+p2+p3 - mmax(p1,mmax(p2,p3)) - mmin(p1,mmin(p2,p3));
-
- return;
-}
-
-void ZeroBits(Bits *bits)
-{
-#ifndef MINIMAL_REPORT
- bits->Y = 0;
- bits->C = 0;
- bits->vec = 0;
- bits->CBPY = 0;
- bits->CBPCM = 0;
- bits->MODB = 0;
- bits->CBPB = 0;
- bits->COD = 0;
- bits->DQUANT = 0;
- bits->header = 0;
- bits->total = 0;
- bits->no_inter = 0;
- bits->no_inter4v = 0;
- bits->no_intra = 0;
-#endif
- /* added by Wang, Zhanglei */
-#ifdef RTP_SUPPORT
- int i;
- for (i=0; i<16; i++)
- bits->rtp_offset[i]=0;
- //bits->rtp_offset[0] = bits->rtp_offset[1] = bits->rtp_offset[2] = bits->rtp_offset[3] = bits->rtp_offset[4] = 0;
- bits->rtp_count = 1; /* special concern */
-#endif
- return;
-}
-
-void ZeroRes(Results *res)
-{
-#ifndef MINIMAL_REPORT
- res->SNR_l = 0;
- res->SNR_Cr = 0;
- res->SNR_Cb = 0;
- res->QP_mean = 0;
-#endif
-}
-
-void AddBits(Bits *total, Bits *bits)
-{
-#ifndef MINIMAL_REPORT
- total->Y += bits->Y;
- total->C += bits->C;
- total->vec += bits->vec;
- total->CBPY += bits->CBPY;
- total->CBPCM += bits->CBPCM;
- total->MODB += bits->MODB;
- total->CBPB += bits->CBPB;
- total->COD += bits->COD;
- total->DQUANT += bits->DQUANT;
- total->header += bits->header;
- total->total += bits->total;
- total->no_inter += bits->no_inter;
- total->no_inter4v += bits->no_inter4v;
- total->no_intra += bits->no_intra;
-#endif
- return;
-}
-void AddRes(Results *total, Results *res, Pict *pic)
-{
-#ifndef MINIMAL_REPORT
- total->SNR_l += res->SNR_l;
- total->SNR_Cr += res->SNR_Cr;
- total->SNR_Cb += res->SNR_Cb;
- total->QP_mean += pic->QP_mean;
-#endif
- return;
-}
-
-void AddBitsPicture(Bits *bits)
-{
-#ifndef MINIMAL_REPORT
- bits->total =
- bits->Y +
- bits->C +
- bits->vec +
- bits->CBPY +
- bits->CBPCM +
- bits->MODB +
- bits->CBPB +
- bits->COD +
- bits->DQUANT +
- bits->header ;
-#endif
-}
-void ZeroVec(MotionVector *MV)
-{
- MV->x = 0;
- MV->y = 0;
- MV->x_half = 0;
- MV->y_half = 0;
- return;
-}
-void MarkVec(MotionVector *MV)
-{
- MV->x = NO_VEC;
- MV->y = NO_VEC;
- MV->x_half = 0;
- MV->y_half = 0;
- return;
-}
-
-void CopyVec(MotionVector *MV2, MotionVector *MV1)
-{
- MV2->x = MV1->x;
- MV2->x_half = MV1->x_half;
- MV2->y = MV1->y;
- MV2->y_half = MV1->y_half;
- return;
-}
-
-int EqualVec(MotionVector *MV2, MotionVector *MV1)
-{
- if (MV1->x != MV2->x)
- return 0;
- if (MV1->y != MV2->y)
- return 0;
- if (MV1->x_half != MV2->x_half)
- return 0;
- if (MV1->y_half != MV2->y_half)
- return 0;
- return 1;
-}
-
-/**********************************************************************
- *
- * Name: CountBitsPicture(Pict *pic)
- * Description: counts the number of bits needed for picture
- * header
- *
- * Input: pointer to picture structure
- * Returns: number of bits
- * Side effects:
- *
- * Date: 941128 Author:Karl.Lillevold@nta.no
- *
- ***********************************************************************/
-
-int CountBitsPicture(Pict *pic)
-{
- int bits = 0;
-
-
- /* Picture start code */
- if (trace) {
- fprintf(tf,"picture_start_code: ");
- }
- mputv(PSC_LENGTH,PSC);
- bits += PSC_LENGTH;
-
- /* Group number */
- if (trace) {
- fprintf(tf,"Group number in picture header: ");
- }
- mputv(5,0);
- bits += 5;
-
- /* Time reference */
- if (trace) {
- fprintf(tf,"Time reference: ");
- }
- mputv(8,pic->TR);
- bits += 8;
-
- /* bit 1 */
- if (trace) {
- fprintf(tf,"spare: ");
- }
- pic->spare = 1; /* always 1 to avoid start code emulation */
- mputv(1,pic->spare);
- bits += 1;
-
- /* bit 2 */
- if (trace) {
- fprintf(tf,"always zero for distinction with H.261\n");
- }
- mputv(1,0);
- bits += 1;
-
- /* bit 3 */
- if (trace) {
- fprintf(tf,"split_screen_indicator: ");
- }
- mputv(1,0); /* no support for split-screen in this software */
- bits += 1;
-
- /* bit 4 */
- if (trace) {
- fprintf(tf,"document_camera_indicator: ");
- }
- mputv(1,0);
- bits += 1;
-
- /* bit 5 */
- if (trace) {
- fprintf(tf,"freeze_picture_release: ");
- }
- mputv(1,0);
- bits += 1;
-
- /* bit 6-8 */
- if (trace) {
- fprintf(tf,"source_format: ");
- }
- mputv(3,pic->source_format);
- bits += 3;
-
- /* bit 9 */
- if (trace) {
- fprintf(tf,"picture_coding_type: ");
- }
- mputv(1,pic->picture_coding_type);
- bits += 1;
-
- /* bit 10 */
- if (trace) {
- fprintf(tf,"mv_outside_frame: ");
- }
- mputv(1,pic->unrestricted_mv_mode); /* Unrestricted Motion Vector mode */
- bits += 1;
-
- /* bit 11 */
- if (trace) {
- fprintf(tf,"sac_coding: ");
- }
- mputv(1,0); /* Syntax-based Arithmetic Coding mode not used*/
- bits += 1;
-
- /* bit 12 */
- if (trace) {
- fprintf(tf,"adv_pred_mode: ");
- }
- mputv(1,advanced); /* Advanced Prediction mode */
- bits += 1;
-
- /* bit 13 */
- if (trace) {
- fprintf(tf,"PB-coded: "); /* PB-frames mode */
- }
- mputv(1,pic->PB);
- bits += 1;
-
-
- /* QUANT */
- if (trace) {
- fprintf(tf,"QUANT: ");
- }
- mputv(5,pic->QUANT);
- bits += 5;
-
- /* Continuous Presence Multipoint (CPM) */
- mputv(1,0); /* CPM is not supported in this software */
- bits += 1;
-
- /* Picture Sub Bitstream Indicator (PSBI) */
- /* if CPM == 1: 2 bits PSBI */
- /* not supported */
-
-
- /* PEI (extra information) */
- if (trace) {
- fprintf(tf,"PEI: ");
- }
- /* "Encoders shall not insert PSPARE until specified by the ITU" */
- mputv(1,0);
- bits += 1;
-
- /* PSPARE */
- /* if PEI == 1: 8 bits PSPARE + another PEI bit */
- /* not supported */
-
- return bits;
-}
-
diff --git a/gst/r263/libr263/ctables.h b/gst/r263/libr263/ctables.h
deleted file mode 100644
index 5b9ef26..0000000
--- a/gst/r263/libr263/ctables.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-/**********************************************************************
- *
- * Copyright (c) 1995 Telenor R&D
- * All rights reserved
- *
- **********************************************************************/
-
-/* tables.h */
-/* TMN Huffman tables */
-
-/* Motion vectors */
-int vlc_mv_coeff[] = {
-32,13,5,
-33,13,7,
-34,12,5,
-35,12,7,
-36,12,9,
-37,12,11,
-38,12,13,
-39,12,15,
-40,11,9,
-41,11,11,
-42,11,13,
-43,11,15,
-44,11,17,
-45,11,19,
-46,11,21,
-47,11,23,
-48,11,25,
-49,11,27,
-50,11,29,
-51,11,31,
-52,11,33,
-53,11,35,
-54,10,19,
-55,10,21,
-56,10,23,
-57,8,7,
-58,8,9,
-59,8,11,
-60,7,7,
-61,5,3,
-62,4,3,
-63,3,3,
- 0,1,1,
- 1,3,2,
- 2,4,2,
- 3,5,2,
- 4,7,6,
- 5,8,10,
- 6,8,8,
- 7,8,6,
- 8,10,22,
- 9,10,20,
-10,10,18,
-11,11,34,
-12,11,32,
-13,11,30,
-14,11,28,
-15,11,26,
-16,11,24,
-17,11,22,
-18,11,20,
-19,11,18,
-20,11,16,
-21,11,14,
-22,11,12,
-23,11,10,
-24,11,8,
-25,12,14,
-26,12,12,
-27,12,10,
-28,12,8,
-29,12,6,
-30,12,4,
-31,13,6,
--1,-1
-};
-
-/* CBPCM (MCBPC) */
-int vlc_cbpcm_intra_coeff[] = {
-3,1,1,
-19,3,1,
-35,3,2,
-51,3,3,
-4,4,1,
-20,6,1,
-36,6,2,
-52,6,3,
-255,9,1,
--1,-1
-};
-
-int vlc_cbpcm_coeff[] = {
-0,1,1,
-16,4,3,
-32,4,2,
-48,6,5,
-1,3,3,
-17,7,7,
-33,7,6,
-49,9,5,
-2,3,2,
-18,7,5,
-34,7,4,
-50,8,5,
-3,5,3,
-19,8,4,
-35,8,3,
-51,7,3,
-4,6,4,
-20,9,4,
-36,9,3,
-52,9,2,
-255,9,1,
--1,-1
-};
-
-
-/* CBPY */
-int vlc_cbpy_coeff[] = {
-0, 2,3,
-8, 4,11,
-4, 4,10,
-12, 4,9,
-2, 4,8,
-10, 4,7,
-6, 6,3,
-14, 5,5,
-1, 4,6,
-9, 6,2,
-5, 4,5,
-13, 5,4,
-3, 4,4,
-11, 5,3,
-7, 5,2,
-15, 4,3,
--1,-1
-};
-
-/* 3D VLC */
-int vlc_3d_coeff[] = {
-1,2,2,
-2,4,15,
-3,6,21,
-4,7,23,
-5,8,31,
-6,9,37,
-7,9,36,
-8,10,33,
-9,10,32,
-10,11,7,
-11,11,6,
-12,11,32,
-17,3,6,
-18,6,20,
-19,8,30,
-20,10,15,
-21,11,33,
-22,12,80,
-33,4,14,
-34,8,29,
-35,10,14,
-36,12,81,
-49,5,13,
-50,9,35,
-51,10,13,
-65,5,12,
-66,9,34,
-67,12,82,
-81,5,11,
-82,10,12,
-83,12,83,
-97,6,19,
-98,10,11,
-99,12,84,
-113,6,18,
-114,10,10,
-129,6,17,
-130,10,9,
-145,6,16,
-146,10,8,
-161,7,22,
-162,12,85,
-177,7,21,
-193,7,20,
-209,8,28,
-225,8,27,
-241,9,33,
-257,9,32,
-273,9,31,
-289,9,30,
-305,9,29,
-321,9,28,
-337,9,27,
-353,9,26,
-369,11,34,
-385,11,35,
-401,12,86,
-417,12,87,
-
-4097,4,7, /* Table for last coeff */
-4098,9,25,
-4099,11,5,
-4113,6,15,
-4114,11,4,
-4129,6,14,
-4145,6,13,
-4161,6,12,
-4177,7,19,
-4193,7,18,
-4209,7,17,
-4225,7,16,
-4241,8,26,
-4257,8,25,
-4273,8,24,
-4289,8,23,
-4305,8,22,
-4321,8,21,
-4337,8,20,
-4353,8,19,
-4369,9,24,
-4385,9,23,
-4401,9,22,
-4417,9,21,
-4433,9,20,
-4449,9,19,
-4465,9,18,
-4481,9,17,
-4497,10,7,
-4513,10,6,
-4529,10,5,
-4545,10,4,
-4561,11,36,
-4577,11,37,
-4593,11,38,
-4609,11,39,
-4625,12,88,
-4641,12,89,
-4657,12,90,
-4673,12,91,
-4689,12,92,
-4705,12,93,
-4721,12,94,
-4737,12,95,
-7167,7,3, /* escape */
--1,-1
-};
-
diff --git a/gst/r263/libr263/dct.c b/gst/r263/libr263/dct.c
deleted file mode 100644
index f066258..0000000
--- a/gst/r263/libr263/dct.c
+++ /dev/null
@@ -1,885 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-/*****************************************************************
- * Some routines are translated from Gisle Bj°ntegaards's FORTRAN
- * routines by Robert.Danielsen@nta.no
- *
- *****************************************************************/
-
-/*****************************************************************
- * This source includes sources from Berkeley's MPEG-1 encoder
- * which are copyright of Berkeley University, California, USA
- *****************************************************************/
-
-#include "macros.h"
-#include "sim.h"
-
-/*#include <math.h>*/
-
-#ifndef PI
-# ifdef M_PI
-# define PI M_PI
-# else
-# define PI 3.14159265358979323846
-# endif
-#endif
-
-int zigzag[8][8] = {
- {0, 1, 5, 6,14,15,27,28},
- {2, 4, 7,13,16,26,29,42},
- {3, 8,12,17,25,30,41,43},
- {9,11,18,24,31,40,44,53},
- {10,19,23,32,39,45,52,54},
- {20,22,33,38,46,51,55,60},
- {21,34,37,47,50,56,59,61},
- {35,36,48,49,57,58,62,63},
-};
-
-#ifndef FASTDCT
-
-/**********************************************************************
- *
- * Name: Dct
- * Description: Does dct on an 8x8 block, does zigzag-scanning of
- * coefficients
- *
- * Input: 64 pixels in a 1D array
- * Returns: 64 coefficients in a 1D array
- * Side effects:
- *
- * Date: 930128 Author: Robert.Danielsen@nta.no
- *
- **********************************************************************/
-
-int Dct( int *block, int *coeff)
-{
- int j1, i, j, k;
- float b[8];
- float b1[8];
- float d[8][8];
- float f0=.7071068,f1=.4903926,f2=.4619398,f3=.4157348,f4=.3535534;
- float f5=.2777851,f6=.1913417,f7=.0975452;
-
- for (i = 0, k = 0; i < 8; i++, k += 8) {
- for (j = 0; j < 8; j++) {
- b[j] = block[k+j];
- }
- /* Horizontal transform */
- for (j = 0; j < 4; j++) {
- j1 = 7 - j;
- b1[j] = b[j] + b[j1];
- b1[j1] = b[j] - b[j1];
- }
- b[0] = b1[0] + b1[3];
- b[1] = b1[1] + b1[2];
- b[2] = b1[1] - b1[2];
- b[3] = b1[0] - b1[3];
- b[4] = b1[4];
- b[5] = (b1[6] - b1[5]) * f0;
- b[6] = (b1[6] + b1[5]) * f0;
- b[7] = b1[7];
- d[i][0] = (b[0] + b[1]) * f4;
- d[i][4] = (b[0] - b[1]) * f4;
- d[i][2] = b[2] * f6 + b[3] * f2;
- d[i][6] = b[3] * f6 - b[2] * f2;
- b1[4] = b[4] + b[5];
- b1[7] = b[7] + b[6];
- b1[5] = b[4] - b[5];
- b1[6] = b[7] - b[6];
- d[i][1] = b1[4] * f7 + b1[7] * f1;
- d[i][5] = b1[5] * f3 + b1[6] * f5;
- d[i][7] = b1[7] * f7 - b1[4] * f1;
- d[i][3] = b1[6] * f3 - b1[5] * f5;
- }
- /* Vertical transform */
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 4; j++) {
- j1 = 7 - j;
- b1[j] = d[j][i] + d[j1][i];
- b1[j1] = d[j][i] - d[j1][i];
- }
- b[0] = b1[0] + b1[3];
- b[1] = b1[1] + b1[2];
- b[2] = b1[1] - b1[2];
- b[3] = b1[0] - b1[3];
- b[4] = b1[4];
- b[5] = (b1[6] - b1[5]) * f0;
- b[6] = (b1[6] + b1[5]) * f0;
- b[7] = b1[7];
- d[0][i] = (b[0] + b[1]) * f4;
- d[4][i] = (b[0] - b[1]) * f4;
- d[2][i] = b[2] * f6 + b[3] * f2;
- d[6][i] = b[3] * f6 - b[2] * f2;
- b1[4] = b[4] + b[5];
- b1[7] = b[7] + b[6];
- b1[5] = b[4] - b[5];
- b1[6] = b[7] - b[6];
- d[1][i] = b1[4] * f7 + b1[7] * f1;
- d[5][i] = b1[5] * f3 + b1[6] * f5;
- d[7][i] = b1[7] * f7 - b1[4] * f1;
- d[3][i] = b1[6] * f3 - b1[5] * f5;
- }
- /* Zigzag - scanning */
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- *(coeff + zigzag[i][j]) = (int)(d[i][j]);
- }
- }
- return 0;
-}
-
-#else
- /* Start of MPEG DCT operation */
-
-typedef unsigned char uint8;
-typedef char int8;
-typedef unsigned short uint16;
-typedef short int16;
-
-#ifdef LONG_32
-typedef unsigned long uint32;
-typedef long int32;
-#else
-typedef unsigned int uint32;
-typedef int int32;
-#endif
-
-/* this is ansi.h */
-#undef _ANSI_ARGS_
-#undef const
-
-#ifdef NON_ANSI_COMPILER
-#define _ANSI_ARGS_(x) ()
-#define CONST
-
-#else
-
-#define _ANSI_ARGS_(x) x
-#define CONST const
-
-#ifdef __cplusplus
-#define VARARGS (...)
-#else
-#define VARARGS ()
-#endif
-
-#endif
-
-
-#define DCTSIZE 8 /* you really don't want to change this */
-#define DCTSIZE_SQ 64 /* you really don't want to change this */
-
-#define DCTSIZE2 DCTSIZE*DCTSIZE
-typedef short DCTELEM;
-typedef DCTELEM DCTBLOCK[DCTSIZE2];
-typedef DCTELEM DCTBLOCK_2D[DCTSIZE][DCTSIZE];
-
-/* We assume that right shift corresponds to signed division by 2 with
- * rounding towards minus infinity. This is correct for typical "arithmetic
- * shift" instructions that shift in copies of the sign bit. But some
- * C compilers implement >> with an unsigned shift. For these machines you
- * must define RIGHT_SHIFT_IS_UNSIGNED.
- * RIGHT_SHIFT provides a proper signed right shift of an int32 quantity.
- * It is only applied with constant shift counts. SHIFT_TEMPS must be
- * included in the variables of any routine using RIGHT_SHIFT.
- */
-
-#ifdef RIGHT_SHIFT_IS_UNSIGNED
-#define SHIFT_TEMPS int32 shift_temp
-
-/*
-#define RIGHT_SHIFT(x,shft) ((shift_temp = (x)) < 0 ? (shift_temp >> (shft)) |((~((int32) 0)) << (32-(shft))) : (shift_temp >> (shft)))
-
- */
-
-#else
-#define SHIFT_TEMPS
-#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
-#endif
-
-#define LG2_DCT_SCALE 16
-
-#define ONE ((int32) 1)
-
-#define DCT_SCALE (ONE << LG2_DCT_SCALE)
-
-/* In some places we shift the inputs left by a couple more bits, */
-/* so that they can be added to fractional results without too much */
- /* loss of precision. */
-#define LG2_OVERSCALE 2
-#define OVERSCALE (ONE << LG2_OVERSCALE)
-#define OVERSHIFT(x) ((x) <<= LG2_OVERSCALE)
-
-/* Scale a fractional constant by DCT_SCALE */
-#define FIX(x) ((int32) ((x) * DCT_SCALE + 0.5))
-
-/* Scale a fractional constant by DCT_SCALE/OVERSCALE */
-/* Such a constant can be multiplied with an overscaled input */
-/* to produce something that's scaled by DCT_SCALE */
-#define FIXO(x) ((int32) ((x) * DCT_SCALE / OVERSCALE + 0.5))
-
-/* Descale and correctly round a value that's scaled by DCT_SCALE */
-#define UNFIX(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1)), LG2_DCT_SCALE)
-
-/* Same with an additional division by 2, ie, correctly rounded UNFIX(x/2) */
-#define UNFIXH(x) RIGHT_SHIFT((x) + (ONE << LG2_DCT_SCALE), LG2_DCT_SCALE+1)
-
-/* Take a value scaled by DCT_SCALE and round to integer scaled by OVERSCALE */
-#define UNFIXO(x) RIGHT_SHIFT((x) + (ONE << (LG2_DCT_SCALE-1-LG2_OVERSCALE)),LG2_DCT_SCALE-LG2_OVERSCALE)
-
-
-/* Here are the constants we need */
-/* SIN_i_j is sine of i*pi/j, scaled by DCT_SCALE */
-/* COS_i_j is cosine of i*pi/j, scaled by DCT_SCALE */
-
-#define SIN_1_4 FIX(0.707106781)
-#define COS_1_4 SIN_1_4
-
-#define SIN_1_8 FIX(0.382683432)
-#define COS_1_8 FIX(0.923879533)
-#define SIN_3_8 COS_1_8
-#define COS_3_8 SIN_1_8
-
-#define SIN_1_16 FIX(0.195090322)
-#define COS_1_16 FIX(0.980785280)
-#define SIN_7_16 COS_1_16
-#define COS_7_16 SIN_1_16
-
-#define SIN_3_16 FIX(0.555570233)
-#define COS_3_16 FIX(0.831469612)
-#define SIN_5_16 COS_3_16
-#define COS_5_16 SIN_3_16
-
-/* OSIN_i_j is sine of i*pi/j, scaled by DCT_SCALE/OVERSCALE */
-/* OCOS_i_j is cosine of i*pi/j, scaled by DCT_SCALE/OVERSCALE */
-
-#define OSIN_1_4 FIXO(0.707106781)
-#define OCOS_1_4 OSIN_1_4
-
-#define OSIN_1_8 FIXO(0.382683432)
-#define OCOS_1_8 FIXO(0.923879533)
-#define OSIN_3_8 OCOS_1_8
-#define OCOS_3_8 OSIN_1_8
-
-#define OSIN_1_16 FIXO(0.195090322)
-#define OCOS_1_16 FIXO(0.980785280)
-#define OSIN_7_16 OCOS_1_16
-#define OCOS_7_16 OSIN_1_16
-
-#define OSIN_3_16 FIXO(0.555570233)
-#define OCOS_3_16 FIXO(0.831469612)
-#define OSIN_5_16 OCOS_3_16
-#define OCOS_5_16 OSIN_3_16
-
-/*==================*
- * TYPE DEFINITIONS *
- *==================*/
-
-/*
- * your basic Block type
- */
-typedef int32 Block[DCTSIZE][DCTSIZE];
-typedef int32 FlatBlock[DCTSIZE_SQ];
-typedef int32 LumBlock[2*DCTSIZE][2*DCTSIZE];
-typedef int32 ChromBlock[DCTSIZE][DCTSIZE];
-
-
-
-/* Prototypes */
-void reference_fwd_dct(Block block, Block dest);
-
-void mp_fwd_dct_fast(Block data2d, Block dest2d);
-
-/*void mp_fwd_dct_fast _ANSI_ARGS_((int16 *data2d, int16 *dest2d));
- */
-void init_fdct(void);
-
-/*
- * --------------------------------------------------------------
- *
- * mp_fwd_dct_fast --
- *
- * Perform the forward DCT on one block of samples.
- *
- * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT on each
- * column.
- *
- * Results: None
- *
- * Side effects: Overwrites the input data
- *
- * --------------------------------------------------------------
- */
-/*
-__inline__ voidmp_fwd_dct_fast(data2d, dest2d)
- Block data2d, dest2d;
- */
-__inline__ void mp_fwd_dct_fast(Block data2d, Block dest2d)
-{
- int32 *data = (int32 *) data2d; /* this algorithm wants
- * a 1-d array */
- int32 *dest = (int32 *) dest2d;
- int rowctr, columncounter;
- register int32 *inptr, *outptr;
- int32 workspace[DCTSIZE_SQ];
- int32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
- int32 tmp10, tmp11, tmp12, tmp13;
- int32 tmp14, tmp15, tmp16, tmp17;
- int32 tmp25, tmp26;
-
- SHIFT_TEMPS;
-
- /*
- * Each iteration of the inner loop performs one 8-point 1-D DCT. It
- * reads from a *row* of the input matrix and stores into a *column*
- * of the output matrix. In the first pass, we read from the data[]
- * array and store into the local workspace[]. In the second pass,
- * we read from the workspace[] array and store into data[], thus
- * performing the equivalent of a columnar DCT pass with no variable
- * array indexing.
- */
-
- inptr = data; /* initialize pointers for first pass */
- outptr = workspace;
-
- /* PASS ONE */
-
- for (rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) {
- /*
- * many tmps have nonoverlapping lifetime -- flashy
- * register colourers should be able to do this lot
- * very well
- */
- /* SHIFT_TEMPS */
-
- /* temp0 through tmp7: -512 to +512 */
- /* if I-block, then -256 to +256 */
- tmp0 = inptr[7] + inptr[0];
- tmp1 = inptr[6] + inptr[1];
- tmp2 = inptr[5] + inptr[2];
- tmp3 = inptr[4] + inptr[3];
- tmp4 = inptr[3] - inptr[4];
- tmp5 = inptr[2] - inptr[5];
- tmp6 = inptr[1] - inptr[6];
- tmp7 = inptr[0] - inptr[7];
-
- /* tmp10 through tmp13: -1024 to +1024 */
- /* if I-block, then -512 to +512 */
- tmp10 = tmp3 + tmp0;
- tmp11 = tmp2 + tmp1;
- tmp12 = tmp1 - tmp2;
-
- tmp13 = tmp0 - tmp3;
-
- outptr[0] = (int32) UNFIXH((tmp10 + tmp11) * SIN_1_4);
- outptr[DCTSIZE * 4] = (int32) UNFIXH((tmp10 - tmp11) * COS_1_4);
-
- outptr[DCTSIZE * 2] = (int32) UNFIXH(tmp13 * COS_1_8 + tmp12 * SIN_1_8);
- outptr[DCTSIZE * 6] = (int32) UNFIXH(tmp13 * SIN_1_8 - tmp12 * COS_1_8);
-
- tmp16 = UNFIXO((tmp6 + tmp5) * SIN_1_4);
- tmp15 = UNFIXO((tmp6 - tmp5) * COS_1_4);
-
- OVERSHIFT(tmp4);
- OVERSHIFT(tmp7);
-
- /*
- * tmp4, tmp7, tmp15, tmp16 are overscaled by
- * OVERSCALE
- */
-
- tmp14 = tmp4 + tmp15;
- tmp25 = tmp4 - tmp15;
- tmp26 = tmp7 - tmp16;
- tmp17 = tmp7 + tmp16;
-
- outptr[DCTSIZE] = (int32) UNFIXH(tmp17 * OCOS_1_16 + tmp14 * OSIN_1_16);
- outptr[DCTSIZE * 7] = (int32) UNFIXH(tmp17 * OCOS_7_16 - tmp14 * OSIN_7_16);
- outptr[DCTSIZE * 5] = (int32) UNFIXH(tmp26 * OCOS_5_16 + tmp25 * OSIN_5_16);
- outptr[DCTSIZE * 3] = (int32) UNFIXH(tmp26 * OCOS_3_16 - tmp25 * OSIN_3_16);
-
- inptr += DCTSIZE; /* advance inptr to next row */
- outptr++; /* advance outptr to next column */
-
- }
-
- /* end of pass; in case it was pass 1, set up for pass 2 */
- inptr = workspace;
- outptr = dest;
-
- columncounter = 0;
- /* PASS TWO */
-
- for (rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) {
- /*
- * many tmps have nonoverlapping lifetime -- flashy
- * register colourers should be able to do this lot
- * very well
- */
- /* SHIFT_TEMPS */
-
- /* temp0 through tmp7: -512 to +512 */
- /* if I-block, then -256 to +256 */
- tmp0 = inptr[7] + inptr[0];
- tmp1 = inptr[6] + inptr[1];
- tmp2 = inptr[5] + inptr[2];
- tmp3 = inptr[4] + inptr[3];
- tmp4 = inptr[3] - inptr[4];
- tmp5 = inptr[2] - inptr[5];
- tmp6 = inptr[1] - inptr[6];
- tmp7 = inptr[0] - inptr[7];
-
- /* tmp10 through tmp13: -1024 to +1024 */
- /* if I-block, then -512 to +512 */
- tmp10 = tmp3 + tmp0;
- tmp11 = tmp2 + tmp1;
- tmp12 = tmp1 - tmp2;
-
- tmp13 = tmp0 - tmp3;
-
- outptr[ zigzag[0][columncounter] ] = (int32) UNFIXH((tmp10 + tmp11) * SIN_1_4);
- outptr[ zigzag[4][columncounter] ] = (int32) UNFIXH((tmp10 - tmp11) * COS_1_4);
-
- outptr[ zigzag[2][columncounter] ] = (int32) UNFIXH(tmp13 * COS_1_8 + tmp12 * SIN_1_8);
- outptr[ zigzag[6][columncounter] ] = (int32) UNFIXH(tmp13 * SIN_1_8 - tmp12 * COS_1_8);
-
- tmp16 = UNFIXO((tmp6 + tmp5) * SIN_1_4);
- tmp15 = UNFIXO((tmp6 - tmp5) * COS_1_4);
-
- OVERSHIFT(tmp4);
- OVERSHIFT(tmp7);
-
- /*
- * tmp4, tmp7, tmp15, tmp16 are overscaled by
- * OVERSCALE
- */
-
- tmp14 = tmp4 + tmp15;
- tmp25 = tmp4 - tmp15;
- tmp26 = tmp7 - tmp16;
- tmp17 = tmp7 + tmp16;
-
- outptr[ zigzag[1][columncounter] ] = (int32) UNFIXH(tmp17 * OCOS_1_16 + tmp14 * OSIN_1_16);
- outptr[ zigzag[7][columncounter] ] = (int32) UNFIXH(tmp17 * OCOS_7_16 - tmp14 * OSIN_7_16);
- outptr[ zigzag[5][columncounter] ] = (int32) UNFIXH(tmp26 * OCOS_5_16 + tmp25 * OSIN_5_16);
- outptr[ zigzag[3][columncounter] ] = (int32) UNFIXH(tmp26 * OCOS_3_16 - tmp25 * OSIN_3_16);
-
- inptr += DCTSIZE; /* advance inptr to next row */
- /* outptr++;*/ /* advance outptr to next column */
- columncounter++;
-
- }
- /* END OF PASS TWO */
-
-
-}
-
-int Dct( int *block, int *coeff)
-{
-
- mp_fwd_dct_fast( *(Block *) &block[0], *(Block *) &coeff[0]);
-
- return 0;
-}
-
-#endif /* End of ifnotdef FASTDCT */
-
-#ifdef FASTIDCT
-
-/**********************************************************************
- *
- * Name: idct
- * Description: Descans zigzag-scanned coefficients and does
- * inverse dct on 64 coefficients
- * single precision floats
- *
- * Input: 64 coefficients, block for 64 pixels
- * Returns: 0
- * Side effects:
- *
- * Date: 930128 Author: Robert.Danielsen@nta.no
- *
- **********************************************************************/
-
-int idct(int *coeff,int *block)
-{
- int j1, i, j;
- double b[8], b1[8], d[8][8];
- double f0=.7071068, f1=.4903926, f2=.4619398, f3=.4157348;
- double f4=.3535534;
- double f5=.2777851, f6=.1913417, f7=.0975452;
- double e, f, g, h;
-
- /* Horizontal */
-
- /* Descan coefficients first */
-
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- b[j] = *( coeff + zigzag[i][j]);
- }
- e = b[1] * f7 - b[7] * f1;
- h = b[7] * f7 + b[1] * f1;
- f = b[5] * f3 - b[3] * f5;
- g = b[3] * f3 + b[5] * f5;
-
- b1[0] = (b[0] + b[4]) * f4;
- b1[1] = (b[0] - b[4]) * f4;
- b1[2] = b[2] * f6 - b[6] * f2;
- b1[3] = b[6] * f6 + b[2] * f2;
- b[4] = e + f;
- b1[5] = e - f;
- b1[6] = h - g;
- b[7] = h + g;
-
- b[5] = (b1[6] - b1[5]) * f0;
- b[6] = (b1[6] + b1[5]) * f0;
- b[0] = b1[0] + b1[3];
- b[1] = b1[1] + b1[2];
- b[2] = b1[1] - b1[2];
- b[3] = b1[0] - b1[3];
-
- for (j = 0; j < 4; j++) {
- j1 = 7 - j;
- d[i][j] = b[j] + b[j1];
- d[i][j1] = b[j] - b[j1];
- }
- }
-
- /* Vertical */
-
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- b[j] = d[j][i];
- }
- e = b[1] * f7 - b[7] * f1;
- h = b[7] * f7 + b[1] * f1;
- f = b[5] * f3 - b[3] * f5;
- g = b[3] * f3 + b[5] * f5;
-
- b1[0] = (b[0] + b[4]) * f4;
- b1[1] = (b[0] - b[4]) * f4;
- b1[2] = b[2] * f6 - b[6] * f2;
- b1[3] = b[6] * f6 + b[2] * f2;
- b[4] = e + f;
- b1[5] = e - f;
- b1[6] = h - g;
- b[7] = h + g;
-
- b[5] = (b1[6] - b1[5]) * f0;
- b[6] = (b1[6] + b1[5]) * f0;
- b[0] = b1[0] + b1[3];
- b[1] = b1[1] + b1[2];
- b[2] = b1[1] - b1[2];
- b[3] = b1[0] - b1[3];
-
- for (j = 0; j < 4; j++) {
- j1 = 7 - j;
- d[j][i] = b[j] + b[j1];
- d[j1][i] = b[j] - b[j1];
- }
- }
-
- for (i = 0; i < 8; i++) {
- for (j = 0; j < 8; j++) {
- *(block + i * 8 + j) = mnint(d[i][j]);
- }
- }
- return 0;
-}
-
-#elif VERYFASTIDCT
-/*
- * tmndecode
- * Copyright (C) 1995 Telenor R&D
- * Karl Olav Lillevold <kol@nta.no>
- *
- * based on mpeg2decode, (C) 1994, MPEG Software Simulation Group
- * and mpeg2play, (C) 1994 Stefan Eckart
- * <stefan@lis.e-technik.tu-muenchen.de>
- *
- */
-
-
-/**********************************************************/
-/* inverse two dimensional DCT, Chen-Wang algorithm */
-/* (cf. IEEE ASSP-32, pp. 803-816, Aug. 1984) */
-/* 32-bit integer arithmetic (8 bit coefficients) */
-/* 11 mults, 29 adds per DCT */
-/* sE, 18.8.91 */
-/**********************************************************/
-/* coefficients extended to 12 bit for IEEE1180-1990 */
-/* compliance sE, 2.1.94 */
-/**********************************************************/
-
-/* this code assumes >> to be a two's-complement arithmetic */
-/* right shift: (-2)>>1 == -1 , (-3)>>1 == -2 */
-
-
-#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
-#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */
-#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */
-#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */
-#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */
-#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */
-
-/* private data */
-static int iclip[1024]; /* clipping table */
-static int *iclp;
-
-/* private prototypes */
-static void idctrow(int *blk);
-static void idctcol(int *blk);
-
-/* row (horizontal) IDCT
- *
- * 7 pi 1
- * dst[k] = sum c[l] * src[l] * cos( -- * ( k + - ) * l )
- * l=0 8 2
- *
- * where: c[0] = 128
- * c[1..7] = 128*sqrt(2)
- */
-
-static void idctrow(int *blk)
-{
- int x0, x1, x2, x3, x4, x5, x6, x7, x8;
-
- /* shortcut */
- if (!((x1 = blk[4]<<11) | (x2 = blk[6]) | (x3 = blk[2]) |
- (x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3])))
- {
- blk[0]=blk[1]=blk[2]=blk[3]=blk[4]=blk[5]=blk[6]=blk[7]=blk[0]<<3;
- return;
- }
-
- x0 = (blk[0]<<11) + 128; /* for proper rounding in the fourth stage */
-
- /* first stage */
- x8 = W7*(x4+x5);
- x4 = x8 + (W1-W7)*x4;
- x5 = x8 - (W1+W7)*x5;
- x8 = W3*(x6+x7);
- x6 = x8 - (W3-W5)*x6;
- x7 = x8 - (W3+W5)*x7;
-
- /* second stage */
- x8 = x0 + x1;
- x0 -= x1;
- x1 = W6*(x3+x2);
- x2 = x1 - (W2+W6)*x2;
- x3 = x1 + (W2-W6)*x3;
- x1 = x4 + x6;
- x4 -= x6;
- x6 = x5 + x7;
- x5 -= x7;
-
- /* third stage */
- x7 = x8 + x3;
- x8 -= x3;
- x3 = x0 + x2;
- x0 -= x2;
- x2 = (181*(x4+x5)+128)>>8;
- x4 = (181*(x4-x5)+128)>>8;
-
- /* fourth stage */
- blk[0] = (x7+x1)>>8;
- blk[1] = (x3+x2)>>8;
- blk[2] = (x0+x4)>>8;
- blk[3] = (x8+x6)>>8;
- blk[4] = (x8-x6)>>8;
- blk[5] = (x0-x4)>>8;
- blk[6] = (x3-x2)>>8;
- blk[7] = (x7-x1)>>8;
-}
-
-/* column (vertical) IDCT
- *
- * 7 pi 1
- * dst[8*k] = sum c[l] * src[8*l] * cos( -- * ( k + - ) * l )
- * l=0 8 2
- *
- * where: c[0] = 1/1024
- * c[1..7] = (1/1024)*sqrt(2)
- */
-__inline__ static void idctcol(int *blk)
-{
- int x0, x1, x2, x3, x4, x5, x6, x7, x8;
-
- /* shortcut */
- if (!((x1 = (blk[32]<<8)) | (x2 = blk[48]) | (x3 = blk[16]) |
- (x4 = blk[8]) | (x5 = blk[56]) | (x6 = blk[40]) | (x7 = blk[24])))
- {
- blk[0]=blk[8]=blk[16]=blk[24]=blk[32]=blk[40]=blk[48]=blk[56]=
- iclp[(blk[0]+32)>>6];
- return;
- }
-
- x0 = (blk[8*0]<<8) + 8192;
-
- /* first stage */
- x8 = W7*(x4+x5) + 4;
- x4 = (x8+(W1-W7)*x4)>>3;
- x5 = (x8-(W1+W7)*x5)>>3;
- x8 = W3*(x6+x7) + 4;
- x6 = (x8-(W3-W5)*x6)>>3;
- x7 = (x8-(W3+W5)*x7)>>3;
-
- /* second stage */
- x8 = x0 + x1;
- x0 -= x1;
- x1 = W6*(x3+x2) + 4;
- x2 = (x1-(W2+W6)*x2)>>3;
- x3 = (x1+(W2-W6)*x3)>>3;
- x1 = x4 + x6;
- x4 -= x6;
- x6 = x5 + x7;
- x5 -= x7;
-
- /* third stage */
- x7 = x8 + x3;
- x8 -= x3;
- x3 = x0 + x2;
- x0 -= x2;
- x2 = (181*(x4+x5)+128)>>8;
- x4 = (181*(x4-x5)+128)>>8;
-
- /* fourth stage */
- blk[0] = iclp[(x7+x1)>>14];
- blk[8] = iclp[(x3+x2)>>14];
- blk[16] = iclp[(x0+x4)>>14];
- blk[24] = iclp[(x8+x6)>>14];
- blk[32] = iclp[(x8-x6)>>14];
- blk[40] = iclp[(x0-x4)>>14];
- blk[48] = iclp[(x3-x2)>>14];
- blk[56] = iclp[(x7-x1)>>14];
-}
-
-/* two dimensional inverse discrete cosine transform */
-int idct(int *coeff, int *block)
-{
- int i;
- extern int zigzag[8][8];
- int *block_ptr, *zigzag_ptr;
-
- block_ptr = block; zigzag_ptr = &(zigzag[0][0]);
-
- for (i = 0; i < 8; i++) {
- *(block_ptr++) = *(coeff + *(zigzag_ptr++));
- *(block_ptr++) = *(coeff + *(zigzag_ptr++));
- *(block_ptr++) = *(coeff + *(zigzag_ptr++));
- *(block_ptr++) = *(coeff + *(zigzag_ptr++));
- *(block_ptr++) = *(coeff + *(zigzag_ptr++));
- *(block_ptr++) = *(coeff + *(zigzag_ptr++));
- *(block_ptr++) = *(coeff + *(zigzag_ptr++));
- *(block_ptr++) = *(coeff + *(zigzag_ptr++));
- /* WAS: block[j + i*8] = (int) *( coeff + zigzag[i][j]); */
- }
-
- for (i=0; i<8; i++)
- idctrow(block+8*i);
-
- for (i=0; i<8; i++)
- idctcol(block+i);
-
-
- return 0;
-}
-
-void init_idct()
-{
- int i;
-
- iclp = iclip+512;
- for (i= -512; i<512; i++)
- iclp[i] = (i<-256) ? -256 : ((i>255) ? 255 : i);
-}
-
-
-#else
-
-/* Perform IEEE 1180 reference (64-bit floating point, separable 8x1
- * direct matrix multiply) Inverse Discrete Cosine Transform
-*/
-
-
-/* Here we use math.h to generate constants. Compiler results may
- vary a little */
-
-
-/* private data */
-
-/* cosine transform matrix for 8x1 IDCT */
-static double c[8][8];
-
-/* initialize DCT coefficient matrix */
-
-void init_idctref()
-{
- int freq, time;
- double scale;
-
- for (freq=0; freq < 8; freq++)
- {
- scale = (freq == 0) ? sqrt(0.125) : 0.5;
- for (time=0; time<8; time++)
- c[freq][time] = scale*cos((PI/8.0)*freq*(time + 0.5));
- }
-}
-
-/* perform IDCT matrix multiply for 8x8 coefficient block */
-
-void idctref(int *coeff, int *block)
-{
- int i, j, k, v;
- double partial_product;
- double tmp[64];
- int tmp2[64];
- extern int zigzag[8][8];
-
- for (i=0; i<8; i++)
- for (j=0; j<8; j++)
- tmp2[j+i*8] = *(coeff + zigzag[i][j]);
-
- for (i=0; i<8; i++)
- for (j=0; j<8; j++)
- {
- partial_product = 0.0;
-
- for (k=0; k<8; k++)
- partial_product+= c[k][j]*tmp2[8*i+k];
-
- tmp[8*i+j] = partial_product;
- }
-
- /* Transpose operation is integrated into address mapping by switching
- loop order of i and j */
-
- for (j=0; j<8; j++)
- for (i=0; i<8; i++)
- {
- partial_product = 0.0;
-
- for (k=0; k<8; k++)
- partial_product+= c[k][i]*tmp[8*k+j];
-
- v = floor(partial_product+0.5);
- block[8*i+j] = (v<-256) ? -256 : ((v>255) ? 255 : v);
- }
-
-
-}
-#endif
diff --git a/gst/r263/libr263/huffman.c b/gst/r263/libr263/huffman.c
deleted file mode 100644
index 12ac078..0000000
--- a/gst/r263/libr263/huffman.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-/*****************************************************************
- * tmn (TMN encoder)
- * Copyright (C) 1995 Telenor R&D
- * Karl Olav Lillevold <kol@nta.no>
- *
- * These routines are written by Andy C. Hung
- *
- *****************************************************************/
-
-/*************************************************************
-Copyright (C) 1990, 1991, 1993 Andy C. Hung, all rights reserved.
-PUBLIC DOMAIN LICENSE: Stanford University Portable Video Research
-Group. If you use this software, you agree to the following: This
-program package is purely experimental, and is licensed "as is".
-Permission is granted to use, modify, and distribute this program
-without charge for any purpose, provided this license/ disclaimer
-notice appears in the copies. No warranty or maintenance is given,
-either expressed or implied. In no event shall the author(s) be
-liable to you or a third party for any special, incidental,
-consequential, or other damages, arising out of the use or inability
-to use the program for any purpose (or the loss of data), even if we
-have been advised of such possibilities. Any public reference or
-advertisement of this source code should refer to it as the Portable
-Video Research Group (PVRG) code, and not by any author(s) (or
-Stanford University) name.
-*************************************************************/
-/*
-************************************************************
-huffman.c
-
-This file contains the Huffman routines. They are constructed to use
-no look-ahead in the stream.
-
-************************************************************
-*/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "sim.h"
-#include "huffman.h"
-#include "ctables.h"
-
-#define MakeStructure(S) (S *) malloc(sizeof(S))
-
-EHUFF *vlc_3d;
-EHUFF *vlc_cbpcm;
-EHUFF *vlc_cbpcm_intra;
-EHUFF *vlc_cbpy;
-EHUFF *vlc_mv;
-
-/**********************************************************************
- *
- * Name: InitHuff
- * Description: Initializes vlc-tables
- *
- * Input:
- * Returns:
- * Side effects:
- *
- * Date: 941128 Author: Karl.Lillevold@ta.no
- * Idea: see above
- *
- ***********************************************************************/
-
-void InitHuff()
-{
- vlc_3d = MakeEhuff(8192);
- vlc_cbpcm = MakeEhuff(256);
- vlc_cbpcm_intra = MakeEhuff(256);
- vlc_cbpy = MakeEhuff(16);
- vlc_mv = MakeEhuff(65);
- LoadETable(vlc_3d_coeff,vlc_3d);
- LoadETable(vlc_cbpcm_coeff,vlc_cbpcm);
- LoadETable(vlc_cbpcm_intra_coeff,vlc_cbpcm_intra);
- LoadETable(vlc_cbpy_coeff,vlc_cbpy);
- LoadETable(vlc_mv_coeff,vlc_mv);
- return;
-}
-
-/* FreeHuff(): Frees the VLC-tables */
-void FreeHuff()
-{
- FreeEhuff(vlc_3d);
- FreeEhuff(vlc_cbpcm);
- FreeEhuff(vlc_cbpcm_intra);
- FreeEhuff(vlc_cbpy);
- FreeEhuff(vlc_mv);
-}
-
-/*
-MakeEhuff() constructs an encoder huff with a designated table-size.
-This table-size, n, is used for the lookup of Huffman values, and must
-represent the largest positive Huffman value.
-
-*/
-
-EHUFF *MakeEhuff(int n)
-{
- int i;
- EHUFF *temp;
-
- temp = MakeStructure(EHUFF);
- temp->n = n;
- temp->Hlen = (int *) calloc(n,sizeof(int));
- temp->Hcode = (int *) calloc(n,sizeof(int));
- for(i=0;i<n;i++)
- {
- temp->Hlen[i] = -1;
- temp->Hcode[i] = -1;
- }
- return(temp);
-}
-
-void FreeEhuff(EHUFF *eh)
-{
- free(eh->Hlen);
- free(eh->Hcode);
- free(eh);
-}
-
-/*
-
-LoadETable() is used to load an array into an encoder table. The
-array is grouped in triplets and the first negative value signals the
-end of the table.
-
-*/
-
-void LoadETable(int *array,EHUFF *table)
-{
- while(*array>=0)
- {
- if (*array>table->n)
- {
- printf("Table overflow.\n");
- exit(-1);
- }
- table->Hlen[*array] = array[1];
- table->Hcode[*array] = array[2];
- array+=3;
- }
-}
-
-/*
-
-PrintEhuff() prints the encoder Huffman structure passed into it.
-
-*/
-
-/*$void PrintEhuff(EHUFF *huff)
-{
- int i;
-
- printf("Modified Huffman Encoding Structure: %x\n",&huff);
- printf("Number of values %d\n",huff->n);
- for(i=0;i<huff->n;i++)
- {
- if (huff->Hlen[i]>=0)
- {
- printf("Value: %x Length: %d Code: %x\n",
- i,huff->Hlen[i],huff->Hcode[i]);
- }
- }
-}$*/
-
-/*
-
-PrintTable() prints out 256 elements in a nice byte ordered fashion.
-
-*/
-
-void PrintTable(int *table)
-{
- int i,j;
-
- for(i=0;i<16;i++)
- {
- for(j=0;j<16;j++)
- printf("%2x ",*(table++));
- printf("\n");
- }
-}
-
-/*
-Encode() encodes a symbol according to a designated encoder Huffman
-table out to the stream. It returns the number of bits written to the
-stream and a zero on error.
-*/
-
-int Encode(int val,EHUFF *huff)
-{
-
- if (val < 0)
- {
- fprintf(stderr,"Out of bounds val:%d.\n",val);
- fflush(tf);
- exit(-1);
- }
- else if (val >= huff->n) {
- return 0; /* No serious error, can occur with some values */
- }
- else if (huff->Hlen[val] < 0) {
- return 0;
- }
- else {
- mputv(huff->Hlen[val],huff->Hcode[val]);
- return(huff->Hlen[val]);
- }
-}
-
-
-char *BitPrint(int length, int val)
-{
- int m;
- char *bit = (char *)malloc(sizeof(char)*(length+3));
-
- m = length;
- bit[0] = '"';
- while (m--)
- bit[length-m] = (val & (1<<m)) ? '1' : '0';
- bit[length+1] = '"';
- bit[length+2] = '\0';
- return bit;
-}
-
-
diff --git a/gst/r263/libr263/huffman.h b/gst/r263/libr263/huffman.h
deleted file mode 100644
index 707372f..0000000
--- a/gst/r263/libr263/huffman.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
- /*****************************************************************
- * tmn (TMN encoder)
- * Copyright (C) 1995 Telenor R&D
- * Karl Olav Lillevold <kol@nta.no>
- *
- * This is written by Andy C. Hung
- *
- *****************************************************************/
-
-/*************************************************************
-Copyright (C) 1990, 1991, 1993 Andy C. Hung, all rights reserved.
-PUBLIC DOMAIN LICENSE: Stanford University Portable Video Research
-Group. If you use this software, you agree to the following: This
-program package is purely experimental, and is licensed "as is".
-Permission is granted to use, modify, and distribute this program
-without charge for any purpose, provided this license/ disclaimer
-notice appears in the copies. No warranty or maintenance is given,
-either expressed or implied. In no event shall the author(s) be
-liable to you or a third party for any special, incidental,
-consequential, or other damages, arising out of the use or inability
-to use the program for any purpose (or the loss of data), even if we
-have been advised of such possibilities. Any public reference or
-advertisement of this source code should refer to it as the Portable
-Video Research Group (PVRG) code, and not by any author(s) (or
-Stanford University) name.
-*************************************************************/
-/*
-************************************************************
-huffman.h
-
-Huffman stuff...
-************************************************************
-*/
-
-#define EHUFF struct Modified_Encoder_Huffman
-
-EHUFF
-{
- int n;
- int *Hlen;
- int *Hcode;
-};
-
-/* From huffman.c */
-void InitHuff();
-void FreeHuff();
-void PrintEhuff();
-
-EHUFF *MakeEhuff();
-void FreeEhuff(EHUFF *eh);
-void LoadETable();
-int Encode(int val,EHUFF *huff);
-void mputv(int n,int b);
-
-/* From stream.c */
-void mwopen();
-void mwclose();
-int zeroflush();
-void mputv();
-long mwtell();
-void mwseek();
-
-
-
diff --git a/gst/r263/libr263/indices.h b/gst/r263/libr263/indices.h
deleted file mode 100644
index 1d92ad3..0000000
--- a/gst/r263/libr263/indices.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-int codtab[2] = {0,1};
-
-int mcbpctab[21] = {0,16,32,48,1,17,33,49,2,18,34,50,3,19,35,51,4,20,36,52,255};
-
-int mcbpc_intratab[9] = {3,19,35,51,4,20,36,52,255};
-
-int cbpytab[16] = {15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0};
-
-int cbpy_intratab[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-
-int dquanttab[4] = {1,0,3,4};
-
-int mvdtab[64] = {32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,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};
-
-int intradctab[254] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,255,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254};
-
-int tcoeftab[103] = {1,2,3,4,5,6,7,8,9,10,11,12,17,18,19,20,21,22,33,34,35,36,49,50,51,65,66,67,81,82,83,97,98,99,113,114,129,130,145,146,161,162,177,193,209,225,241,257,273,289,305,321,337,353,369,385,401,417,4097,4098,4099,4113,4114,4129,4145,4161,4177,4193,4209,4225,4241,4257,4273,4289,4305,4321,4337,4353,4369,4385,4401,4417,4433,4449,4465,4481,4497,4513,4529,4545,4561,4577,4593,4609,4625,4641,4657,4673,4689,4705,4721,4737,7167};
-
-int signtab[2] = {0,1};
-
-int lasttab[2] = {0,1};
-
-int last_intratab[2] = {0,1};
-
-int runtab[64] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
-
-int leveltab[254] = {129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127};
-
-
-
diff --git a/gst/r263/libr263/libr263.c b/gst/r263/libr263/libr263.c
deleted file mode 100644
index 33f7f0b..0000000
--- a/gst/r263/libr263/libr263.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-#include "sim.h"
-#include "huffman.h"
-
-/* static libr263.c prototypes */
-static void init_motion_detection(void);
-__inline__ static int Check8x8(unsigned int *orig,
- unsigned int *recon, int pos);
-static int HasMoved(int call_time, void *real, void *recon, int x, int y);
-
-
-
-int InitCompress(CParam *params)
-{
-
-
- pic = (Pict *)malloc(sizeof(Pict));
- if(!pic) {
- return -1;
- }
-
- pic->unrestricted_mv_mode = DEF_UMV_MODE;
- pic->use_gobsync = DEF_INSERT_SYNC;
- pic->PB = 0;
- pic->TR = 0;
- pic->QP_mean = 0.0;
-
- if(params->format == CPARAM_QCIF) {
- pels = QCIF_YWIDTH;
- lines = QCIF_YHEIGHT;
- cpels = QCIF_YWIDTH/2;
- pic->source_format = SF_QCIF;
- } else if (params->format == CPARAM_CIF) {
- pels = CIF_YWIDTH;
- lines = CIF_YHEIGHT;
- cpels = CIF_YWIDTH/2;
- pic->source_format = SF_CIF;
- } else if (params->format == CPARAM_SQCIF) {
- pels = SQCIF_YWIDTH;
- lines = SQCIF_YHEIGHT;
- cpels = SQCIF_YWIDTH/2;
- pic->source_format = SF_SQCIF;
- } else if (params->format == CPARAM_4CIF) {
- pels = CIF4_YWIDTH;
- lines = CIF4_YHEIGHT;
- cpels = CIF4_YWIDTH/2;
- pic->source_format = SF_4CIF;
- } else if (params->format == CPARAM_16CIF) {
- pels = CIF16_YWIDTH;
- lines = CIF16_YHEIGHT;
- cpels = CIF16_YWIDTH/2;
- pic->source_format = SF_16CIF;
- } else {
- pels = params->pels;
- lines = params->lines;
- cpels = params->pels / 2;
- pic->source_format = 0; /* ILLEGAL H.263! Use it only for testing */
- }
-
- mbr = lines / MB_SIZE;
- mbc = pels / MB_SIZE;
- uskip = lines*pels;
- vskip = uskip + lines*pels/4;
- sizeof_frame = (vskip + lines*pels/4)*sizeof(int);
-
-
- headerlength = DEF_HEADERLENGTH;
- /* Initalize VLC_tables */
- InitHuff();
- mwinit();
-
- /* Init motion detection */
- init_motion_detection();
-
-
-#ifdef VERYFASTIDCT
- init_idct(); /* Do this in case of VERYFASTIDCT */
-#elif STANDARDIDCT
- init_idctref(); /* Do this in case of standard IDCT */
-#endif
- /* Do nothing for FASTIDCT */
-
- /* Set internal variables */
- advanced = DEF_ADV_MODE;
- mv_outside_frame = DEF_UMV_MODE || DEF_ADV_MODE;
- long_vectors = DEF_UMV_MODE;
- pb_frames = DEF_PBF_MODE;
- search_p_frames = DEF_SPIRAL_SEARCH;
- trace = DEF_WRITE_TRACE;
-
- params->half_pixel_searchwindow = CPARAM_DEFAULT_SEARCHWINDOW;
- params->inter = CPARAM_DEFAULT_INTER;
- params->search_method = CPARAM_DEFAULT_SEARCH_METHOD;
- params->advanced_method = CPARAM_DEFAULT_ADVANCED_METHOD;
- params->Q_inter = CPARAM_DEFAULT_INTER_Q;
- params->Q_intra = CPARAM_DEFAULT_INTRA_Q;
-
- params->interpolated_lum = malloc(pels*lines*4*sizeof(int));
-
- if(!params->interpolated_lum)
- return -1;
-
- params->recon = malloc(sizeof_frame);
- if(!params->recon) {
- free(params->interpolated_lum);
- free(pic);
- return -1;
- }
-
- return 0;
-}
-
-void SkipH263Frames(int frames_to_skip)
-{
- pic->TR += frames_to_skip % 256;
-}
-
-int CompressToH263(CParam *params, Bits *bits)
-{
- if(!params->inter) {
- CodeIntraH263(params, bits);
- } else {
- CodeInterH263(params, bits);
- }
- bits->header += zeroflush(); /* pictures shall be byte aligned */
- pic->TR += 1 % 256; /* one means 30 fps */
- /* added by Wang, Zhanglei */
- bits->rtp_offset[bits->rtp_count++] = stream_ptr;
- return 0;
-}
-
-void CloseCompress(CParam *params)
-{
- mwcloseinit();
- free(params->interpolated_lum);
- free(params->recon);
- free(pic);
- return;
-}
-
-/* Motion Detection part */
-
-static int global_mb_threshold;
-static int global_pixel_threshold;
-
-/* This array is computed for QCIF
- movement_detection[] = {0, 354, 528, 177,
- 3, 353, 531, 178,
- 352, 179, 530, 1,
- 355, 176, 2, 529 };
- */
-/* This array determines the order in a pixel is checked per 4x4 block */
-/* {x, y} within [0..3] */
-static unsigned int movement_coords[16][2] = { {0,0}, {2,2},{0,3},{1,1},
- {3,0},{1,2},{3,3},{2,1},
- {0,2},{3,1},{2,3},{1,0},
- {3,2},{0,1},{2,0},{1,3} };
-
-
-static int movement_detection[16][4];
-
-void init_motion_detection()
-{
- unsigned int counter, pos;
-
- for(counter = 0; counter < 16; counter++) {
- pos = movement_coords[counter][0] + movement_coords[counter][1]*pels;
- movement_detection[counter][0] = pos;
- movement_detection[counter][1] = pos + 4;
- movement_detection[counter][2] = pos + pels*4;
- movement_detection[counter][3] = pos + pels*4 + 4;
- }
- return;
-}
-
-__inline__ static int Check8x8(unsigned int *orig, unsigned int *recon, int pos)
-{
- int value, index;
- register int thres = global_pixel_threshold;
-
- value = 0;
-
- /* Mark pixel changed when lum value differs more than "thres" */
- index = movement_detection[pos][0];
- value += abs(*(orig + index) - *(recon+index)) > thres;
-
- index = movement_detection[pos][1];
- value += abs(*(orig + index) - *(recon+index)) > thres;
-
- index = movement_detection[pos][2];
- value += abs(*(orig + index) - *(recon+index)) > thres;
-
- index = movement_detection[pos][3];
- value += abs(*(orig + index) - *(recon+index)) > thres;
-
- return value;
-}
-
-static int HasMoved(int call_time, void *real,
- void *recon, int x, int y)
-{
- int offset1;
- unsigned int *MB_orig;
- unsigned int *MB_recon;
- int position;
- int value = 0;
-
- offset1 = (y*pels+x)*MB_SIZE;
- position = call_time;
-
- /* Integration of 8x8 and 4x4 check might improve performance,
- but is not done here */
- MB_orig = (unsigned int *) real + offset1;
- MB_recon = (unsigned int *) recon + offset1;
- value += Check8x8(MB_orig, MB_recon, position);
-
- MB_orig += 8; MB_recon += 8;
- value += Check8x8(MB_orig, MB_recon, position);
-
- MB_orig += 8*pels - 8; MB_recon += 8*pels - 8;
- value += Check8x8(MB_orig, MB_recon, position);
-
- MB_orig += 8; MB_recon += 8;
- value += Check8x8(MB_orig, MB_recon, position);
-
- return value > global_mb_threshold;
- /* Mark MB changed if more than "global_mb_threshold" pixels are changed */
-}
-
-
-int FindMotion(CParam *params, int mb_threshold, int pixel_threshold)
-{
- static int call_time = 0;
-
- int j,i;
- int counter = 0;
-
- global_mb_threshold = mb_threshold;
- global_pixel_threshold = pixel_threshold;
-
- for(j = 0; j < mbr; j++) {
- for(i = 0; i < mbc; i++) {
- *(params->EncodeThisBlock + j*mbc + i) =
- HasMoved(call_time, params->data, params->recon, i,j);
-
- counter += *(params->EncodeThisBlock +j*mbc + i);
- }
- }
-
- call_time = (call_time + 1) % 16;
-
- return counter;
-}
-
-
-
diff --git a/gst/r263/libr263/libr263.h b/gst/r263/libr263/libr263.h
deleted file mode 100644
index 85c7523..0000000
--- a/gst/r263/libr263/libr263.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-#include "rlib.h"
-
-#ifndef LIBR263_H
-#define LIBR263_H
-/* This should not be changed */
-#define MB_SIZE 16
-
-
-/* Order of usage of lib263:
- 1. Assign size of frame type to "format" field and call InitCompress()
- 2. WriteByteFunction = OwnWriteFunction (1 and 2 in arbitrary order)
- 3. Set cparams and do CompressQCIFToH263(cparams) with INTRA encoding
- 4. Set cparams and do CompressQCIFToH263(cparams) with either INTRA
- or INTER encoding
- 5. redo 4. or to stop do 6
- 6. CloseCompress()
- */
-
-/* Compression parameter structure */
-
-#define CPARAM_INTER TRUE
-#define CPARAM_INTRA FALSE
-#define CPARAM_EXHAUSTIVE TRUE
-#define CPARAM_LOGARITHMIC FALSE
-#define CPARAM_ADVANCED TRUE
-#define CPARAM_NOADVANCED FALSE
-
-#define CPARAM_QCIF 0
-#define CPARAM_CIF 1
-#define CPARAM_4CIF 2
-#define CPARAM_16CIF 3
-#define CPARAM_SQCIF 4
-#define CPARAM_OTHER 99
-
-#define CPARAM_DEFAULT_INTER_Q 8
-#define CPARAM_DEFAULT_INTRA_Q 8
-#define CPARAM_DEFAULT_SEARCHWINDOW 3
-
-#define CPARAM_DEFAULT_INTER CPARAM_INTRA
-#define CPARAM_DEFAULT_SEARCH_METHOD CPARAM_LOGARITHMIC
-#define CPARAM_DEFAULT_ADVANCED_METHOD CPARAM_NOADVANCED
-#define CPARAM_DEFAULT_FORMAT CPARAM_QCIF
-
-typedef struct compression_parameters {
-/* Contains all the parameters that are needed for
- encoding plus all the status between two encodings */
- int half_pixel_searchwindow; /* size of search window in half pixels
- if this value is 0, no search is performed
- */
- int format; /* */
- int pels; /* Only used when format == CPARAM_OTHER */
- int lines; /* Only used when format == CPARAM_OTHER */
- int inter; /* TRUE of INTER frame encoded frames,
- FALSE for INTRA frames */
- int search_method; /* DEF_EXHAUSTIVE or DEF_LOGARITHMIC */
- int advanced_method; /* TRUE : Use array to determine
- macroblocks in INTER frame
- mode to be encoded */
- int Q_inter; /* Quantization factor for INTER frames */
- int Q_intra; /* Quantization factor for INTRA frames */
- unsigned int *data; /* source data in qcif format */
- unsigned int *interpolated_lum; /* intepolated recon luminance part */
- unsigned int *recon; /* Reconstructed copy of compressed frame */
- int *EncodeThisBlock;
- /* Array when advanced_method is used */
- /* added by Wang, Zhanglei */
- int rtp_threshold; /* if you don't want rtp support, set it to 0 */
-} CParam;
-/* Structure for counted bits */
-
-typedef struct bits_counted {
- int Y;
- int C;
- int vec;
- int CBPY;
- int CBPCM;
- int MODB;
- int CBPB;
- int COD;
- int header;
- int DQUANT;
- int total;
- int no_inter;
- int no_inter4v;
- int no_intra;
-/* NB: Remember to change AddBits(), ZeroBits() and AddBitsPicture()
- when entries are added here */
- /* added by Wang, Zhanglei */
-/* #ifdef RTP_SUPPORT */ /* avoid #ifdef in struct definition */
- int rtp_offset[16]; /* at most 4 packets per frame, I guess, the first one is dummy, not used */
- int rtp_count;
-/* #endif */
-} Bits;
-
-typedef void (*WriteByte) (int);
-
-/* Global variable */
-#ifndef EXTERN_BUF
-extern WriteByte WriteByteFunction;
-#else
-extern char * stream_buffer;
-extern int stream_ptr;
-#endif
-
-/* Prototypes */
-int CompressToH263(CParam *params, Bits *bits);
-int InitCompress(CParam *params);
-void CloseCompress(CParam *params);
-void SkipH263Frames(int frames_to_skip);
-
-/* Procedure to detect motion, expects param->EncodeThisBlock is set to
- array.
- Advised values for threshold: mb_threholds = 2; pixel_threshold = 2 */
-int FindMotion(CParam *params, int mb_threshold, int pixel_threshold);
-
-#endif
diff --git a/gst/r263/libr263/macros.h b/gst/r263/libr263/macros.h
deleted file mode 100644
index 4d0b736..0000000
--- a/gst/r263/libr263/macros.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-/*****************************************************************
- * tmn (TMN encoder)
- * Copyright (C) 1995 Telenor R&D
- * Karl Olav Lillevold <kol@nta.no>
- *
- *
- *****************************************************************/
-
-
-#define sign(a) ((a) < 0 ? -1 : 1)
-#define Int(a) ((a) < 0 ? (int)(a-0.5) : (int)(a))
-#define mnint(a) ((a) < 0 ? (int)(a - 0.5) : (int)(a + 0.5))
-#define mfloor(a) ((a) < 0 ? (int)(a - 0.5) : (int)(a))
-#define mmax(a, b) ((a) > (b) ? (a) : (b))
-#define mmin(a, b) ((a) < (b) ? (a) : (b))
-#define limit(x) \
-{ \
- if (x > 255) x = 255; \
- if (x < 0) x = 0; \
-}
-
-
-
diff --git a/gst/r263/libr263/manual.dvi b/gst/r263/libr263/manual.dvi
deleted file mode 100644
index fbd1cf8..0000000
--- a/gst/r263/libr263/manual.dvi
+++ /dev/null
Binary files differ
diff --git a/gst/r263/libr263/manual.pdf b/gst/r263/libr263/manual.pdf
deleted file mode 100644
index d3e6726..0000000
--- a/gst/r263/libr263/manual.pdf
+++ /dev/null
Binary files differ
diff --git a/gst/r263/libr263/manual.tex b/gst/r263/libr263/manual.tex
deleted file mode 100644
index c052634..0000000
--- a/gst/r263/libr263/manual.tex
+++ /dev/null
@@ -1,440 +0,0 @@
-
-\documentclass{article}
-
-\usepackage{epsf}
-\usepackage{utf}
-
-\title{libr263 video compression library}
-\author{Roalt Aalmoes}
-\date{draft of \today}
-
-
-\begin{document}
-
-
-\bibliographystyle{refalpha}
-
-\maketitle
-
-
-\begin{abstract} \label{abstract}
-
- This paper describes the usage of the libr263 library, a fast
- implementation of an H.263 encoder. The implementations does not
- feature the advantaged options, as they are currently too
- computational expensive for real-time compression. However, the
- encoder includes variable-sized frames encoding and an
- implementation of a logarithmic search algorithm. The encoder
- itself is optimized for 64-bit processors, although it also works on
- 32-bit processors. The encoder has the ability to encode only parts
- of the picture by supplying an array of booleans for each
- macroblock.
-
-\end{abstract}
-
-\section{Introduction}
-
-The implementation of the encoder is derived from the telenor TMN 1.6
-implementation. Where the telenor implementation is focussed on
-functionality of all (advanced) options, this implementation is aimed
-at real-time compression. This results in a slim implementation with
-no \emph{processing time}-consuming advanced features. The most
-significant difference with an H.261 encoder is the use of half-pixel
-prediction which reduces bitrate significantly.
-
-This library function is currently in beta-testing. Please feel free
-to send any comments to aalmoes@huygens.nl. There is not
-a decoder, as the TMN 1.7 implementation from telenor is fast and
-useful.
-
-I would especially like to thank Karl Lillevold for making the
-original source freely available.
-
-
-\section{How to use the encoder}
-
-\subsection{Initialization}
-
-To use the encoder, a number of variables must be declared:
-
-\begin{verbatim}
-
- /* Variables to be declared */
- CParam cparams;
- Bits bits;
-
-\end{verbatim}
-
-The cparams variable will hold parameter information for
-the encoder. The \texttt{CParam} structure is shown below:
-
-\begin{verbatim}
-
-typedef struct compression_parameters {
-/* Contains all the parameters that are needed for
- encoding plus all the status between two encodings */
- int half_pixel_searchwindow; /* size of search window in half pixels
- if this value is 0, no search is performed
- */
- int format;
- int pels; /* Only used when format == CPARAM_OTHER */
- int lines; /* Only used when format == CPARAM_OTHER */
- int inter; /* TRUE of INTER frame encoded frames,
- FALSE for INTRA frames */
- int search_method; /* DEF_EXHAUSTIVE or DEF_LOGARITHMIC */
- int advanced_method; /* TRUE : Use array to determine
- macroblocks in INTER frame
- mode to be encoded */
- int Q_inter; /* Quantization factor for INTER frames */
- int Q_intra; /* Quantization factor for INTRA frames */
- unsinged int *data; /* source data */
- unsigned int *interpolated_lum; /* intepolated reconstructed
- luminance part (internal) */
- unsigned int *recon; /* Reconstructed copy of compressed frame */
- int *EncodeThisBlock;
- /* Array of mbr*mbc when advanced_method
- is used */
-} CParam;
-
-\end{verbatim}
-
-The following constants are also defined:
-
-\begin{verbatim}
-/* Compression parameter structure */
-
-#define CPARAM_INTER TRUE
-#define CPARAM_INTRA FALSE
-#define CPARAM_EXHAUSTIVE TRUE
-#define CPARAM_LOGARITHMIC FALSE
-#define CPARAM_ADVANCED TRUE
-#define CPARAM_NOADVANCED FALSE
-
-#define CPARAM_QCIF 0
-#define CPARAM_CIF 1
-#define CPARAM_4CIF 2
-#define CPARAM_16CIF 3
-#define CPARAM_SQCIF 4
-#define CPARAM_OTHER 99
-
-#define CPARAM_DEFAULT_INTER_Q 8
-#define CPARAM_DEFAULT_INTRA_Q 8
-#define CPARAM_DEFAULT_SEARCHWINDOW 3
-#define CPARAM_DEFAULT_INTER = CPARAM_INTRA
-#define CPARAM_DEFAULT_SEARCH_METHOD = CPARAM_LOGARITHMIC
-#define CPARAM_DEFAULT_ADVANCED_METHOD = CPARAM_NOADVANCED
-
-\end{verbatim}
-
-The CPARAM\_DEFAULT\_ defines give the default values after
-initialization. The initialization of the cparams structure is done
-as follows:
-\begin{verbatim}
-
-/* Initialisation */
-cparams.format = CPARAM_QCIF; /* For quarter-CIF sized frames */
-InitCompress(&cparams); /* Use standard compression parameters */
-WriteByteFunction = OwnWriteFunction;
-
-\end{verbatim}
-
-The first assignment determines the size of the video frames that are
-compressed. To use the $176 \times 144$ QCIF format, assign here {\tt
- CPARAM\_QCIF} to {\tt format}. To use the $352 \times 288$ CIF
-format, define here {\tt CPARAM\_CIF} to {\tt format}. Other format
-that may be used are {\tt CPARAM\_SQCIF}, {\tt CPARAM\_4CIF} and {\tt
- CPARAM\_16CIF} (see the file {\tt libr263.h}). To use an
-alternative format, assign {\tt CPARAM\_OTHER} to {\tt format} and also
-assign the pixels per line to {\tt pels} and the number of lines to
-{\tt lines}. In any format, the size of the two chrominance
-components is half the {lines} and {pels} size. For example, the QCIF
-format has a chrominance size of $88 \times 72$, which means that the
-total number of integers a frame consists of is $176 \times 144 + 88
-\times 72 + 88 \times 72 = 38016$.
-
-The {\tt InitCompress} function allocates some local memory and
-initializes some structures. It also fills in the defaults values in
-the cparam structure. The only value that must be initialized
-\emph{before} the {\tt InitCompress} call is {\tt format}. Beware that
-you overrule the default values {\emph after\/} the InitCompress
-function. The WriteByteFunction has the following type:
-
-\begin{verbatim}
-
-typedef void (*WriteByte) (int);
-
-/* Global variable */
-WriteByte WriteByteFunction;
-
-\end{verbatim}
-
-In order to use the output data of the compression, you should assign
-this value to your own function with the same type. An example
-WriteByteFunction is given below:
-
-\begin{verbatim}
-
-void OwnWriteFunction(int byte)
-{
- putc(byte, outputstream);
-
- return;
-}
-
-\end{verbatim}
-
-\texttt{byte} is the byte to be written and \texttt{outputstream} is a file pointer defined by yourself.
-
-\subsection{Intra encoding}
-
-After these function are defined, a frame can be INTRA
-encoded. Remember that the first frame must always be an INTRA frame:
-
-\begin{verbatim}
-
- /* Parameters to encode INTRA */
- cparams.inter = CPARAM_INTRA;
- cparams.data = (unsinged int *) &qcif_frame;
- /* struct qcif qcif_frame holds QCIF frame */
- CompressToH263(&cparams, &bits);
-
-\end{verbatim}
-
-The \texttt{data} field holds the frame. The structure of this frame
-for the QCIF format is as follows:
-
-\begin{verbatim}
-
-#define QCIF_YWIDTH 176
-#define QCIF_YHEIGHT 144
-#define QCIF_UWIDTH 88
-#define QCIF_UHEIGHT 72
-#define QCIF_VWIDTH 88
-#define QCIF_VHEIGHT 72
-
-struct qcif {
- unsigned int Y[QCIF_YHEIGHT][QCIF_YWIDTH];
- unsigned int U[QCIF_UHEIGHT][QCIF_UWIDTH];
- unsigned int V[QCIF_VHEIGHT][QCIF_VWIDTH];
-};
-
-\end{verbatim}
-
-Other parameters that can be set for INTRA encoding is the
-quantization factor \texttt{Q\_intra}. Other parameters do not effect intra
-encoding.
-
-\subsection{inter encoding}
-
-To encode a frame INTER, the following parameters must be set:
-
-\begin{verbatim}
-
- /* Parameters to encode INTER */
- cparams.inter = CPARAM_INTER;
- CompressToH263(&cparams, &bits);
-
-\end{verbatim}
-
-These are the minimal parameters to be set. Other parameter that may
-be used are the quantization factor \texttt{Q\_inter},
-\texttt{half\_pixel\_search\_window}, \texttt{advanced\_method}
-combined with the \texttt{EncodeThisBlock} array, and the
-\texttt{search\_method}.
-
-\subsection{Quantization setting}
-
-To set the quantization for INTRA frames, fill in a value into the
-{\tt Q\_intra} field. To set the quantization for INTER frames, fill
-in a value into the {\tt Q\_inter} field. Quantization determines
-directly the quality: the lower the quantization, the higher the
-quality but the larger the output bitstream. Although the quantization
-may have any values equal or higher than 1, useful values are between
-4 and 16. The encoder is optimized for quantization of 8 and uses this
-as default.
-
-\subsection{Search method}
-
-In the {\tt search\_method} field, two available algorithms can
-currently be used. {\tt CPARAM\_EXHAUSTIVE} determines a full
-exhaustive search, while {\tt CPARAM\_LOGARITHMIC} determines a
-logarithmic search. Exhaustive search creates smaller bitstreams, but
-for large movement videos performes significant worse than logarithmic
-search. See also the next section.
-
-\subsection{Half pixel search window}
-
-This field gives the size of the half pixel search window, expressed
-in half pixel sizes from the center of the search. A value of 1 means
-the search area is $[-0.5..+0.5]$ in both horizontal as vertical
-directions. With EXHAUSTIVE search, all possible places within the
-area are examined, and with LOGARITHMIC, only some of them (evenly
-distributed across the area) are examined.
-
-The value that may be used here is between 0 and 30, both numbers
-included. With EXHAUSTIVE search, using a value greater than 2 here
-may increase computation time significantly. With LOGARITHMIC search,
-performance for using larger search window areas is much better.
-
-\section{Information from the encoder}
-
-The encoder delivers information to the user in much the same way as
-the telenor implementation. It returns a Bits structure that gives a
-detailed summary of the bits used for different parts:
-
-\begin{verbatim}
-
-typedef struct bits_counted {
- int Y;
- int C;
- int vec;
- int CBPY;
- int CBPCM;
- int MODB;
- int CBPB;
- int COD;
- int header;
- int DQUANT;
- int total;
- int no_inter;
- int no_inter4v;
- int no_intra;
-} Bits;
-
-\end{verbatim}
-
-In particularly the {\tt total} field might be of interest. Also
-returned is a reconstructed picture that can be found in the
-\texttt{recon} field of the {\tt CParam} structure. The encoder uses
-this field for Inter frame encoding, so do not alter this field unless
-you know what you are doing.
-
-\section{{\tt libr263.h} include file}
-
-This section contains the {\tt libr263.h} source file, which must be
-included into the source file where you use the compression library.
-
-\begin{verbatim}
-/*************************************************
- * libr263: fast H.263 encoder library
- *
- * Copyright (C) 1996, Roalt Aalmoes, Twente University
- * SPA multimedia group
- *
- * Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D)
- * created by Karl Lillevold
- *
- * Author encoder: Roalt Aalmoes, <aalmoes@huygens.nl>
- *
- * Date: 31-07-96
- **************************************************/
-
-#include "rlib.h"
-
-#ifndef LIBR263_H
-#define LIBR263_H
-/* This should not be changed */
-#define MB_SIZE 16
-
-
-/* Order of usage of lib263:
- 1. Assign size of frame type to "format" field and call InitCompress()
- 2. WriteByteFunction = OwnWriteFunction (1 and 2 in arbitrary order)
- 3. Set cparams and do CompressQCIFToH263(cparams) with INTRA encoding
- 4. Set cparams and do CompressQCIFToH263(cparams) with either INTRA
- or INTER encoding
- 5. redo 4. or to stop do 6
- 6. CloseCompress()
- */
-
-/* Compression parameter structure */
-
-#define CPARAM_INTER TRUE
-#define CPARAM_INTRA FALSE
-#define CPARAM_EXHAUSTIVE TRUE
-#define CPARAM_LOGARITHMIC FALSE
-#define CPARAM_ADVANCED TRUE
-#define CPARAM_NOADVANCED FALSE
-
-#define CPARAM_QCIF 0
-#define CPARAM_CIF 1
-#define CPARAM_4CIF 2
-#define CPARAM_16CIF 3
-#define CPARAM_SQCIF 4
-#define CPARAM_OTHER 99
-
-#define CPARAM_DEFAULT_INTER_Q 8
-#define CPARAM_DEFAULT_INTRA_Q 8
-#define CPARAM_DEFAULT_SEARCHWINDOW 3
-
-#define CPARAM_DEFAULT_INTER CPARAM_INTRA
-#define CPARAM_DEFAULT_SEARCH_METHOD CPARAM_LOGARITHMIC
-#define CPARAM_DEFAULT_ADVANCED_METHOD CPARAM_NOADVANCED
-#define CPARAM_DEFAULT_FORMAT CPARAM_QCIF
-
-typedef struct compression_parameters {
-/* Contains all the parameters that are needed for
- encoding plus all the status between two encodings */
- int half_pixel_searchwindow; /* size of search window in half pixels
- if this value is 0, no search is performed
- */
- int format; /* */
- int pels; /* Only used when format == CPARAM_OTHER */
- int lines; /* Only used when format == CPARAM_OTHER */
- int inter; /* TRUE of INTER frame encoded frames,
- FALSE for INTRA frames */
- int search_method; /* DEF_EXHAUSTIVE or DEF_LOGARITHMIC */
- int advanced_method; /* TRUE : Use array to determine
- macroblocks in INTER frame
- mode to be encoded */
- int Q_inter; /* Quantization factor for INTER frames */
- int Q_intra; /* Quantization factor for INTRA frames */
- unsigned int *data; /* source data in qcif format */
- unsigned int *interpolated_lum; /* intepolated recon luminance part */
- unsigned int *recon; /* Reconstructed copy of compressed frame */
- int *EncodeThisBlock;
- /* Array when advanced_method is used */
-} CParam;
-/* Structure for counted bits */
-
-typedef struct bits_counted {
- int Y;
- int C;
- int vec;
- int CBPY;
- int CBPCM;
- int MODB;
- int CBPB;
- int COD;
- int header;
- int DQUANT;
- int total;
- int no_inter;
- int no_inter4v;
- int no_intra;
-/* NB: Remember to change AddBits(), ZeroBits() and AddBitsPicture()
- when entries are added here */
-} Bits;
-
-typedef void (*WriteByte) (int);
-
-/* Global variable */
-extern WriteByte WriteByteFunction;
-
-/* Prototypes */
-int CompressToH263(CParam *params, Bits *bits);
-int InitCompress(CParam *params);
-void CloseCompress(CParam *params);
-void SkipH263Frames(int frames_to_skip);
-
-/* Procedure to detect motion, expects param->EncodeThisBlock is set to
- array.
- Advised values for threshold: mb_threholds = 2; pixel_threshold = 2 */
-int FindMotion(CParam *params, int mb_threshold, int pixel_threshold);
-
-#endif
-
-\end{verbatim}
-
-\end{document}
-
diff --git a/gst/r263/libr263/mot_est.c b/gst/r263/libr263/mot_est.c
deleted file mode 100644
index cdf30e4..0000000
--- a/gst/r263/libr263/mot_est.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-#include"sim.h"
-/* Efficient macroblock comparison op. */
-
-/* The comparison is between a non-interpolated lowres block of pixel
- and a interpolated hires block of pixel. This might be confusing:
-
- Example: compare 3x3 block with 3x3 block, then the 1s of block 1 are
- compared with the 2s of block 2.
-
- Block 1: Block 2:
- 1.1.1. 222
- ...... 222
- 1.1.1. 222
- ......
- 1.1.1.
-
- You see, for block one (ii), you have 4 times more data!
-
-*/
-
-__inline__ int SAD_HalfPixelMacroblock(unsigned int *ii,
- unsigned int *curr,
- int pixels_on_line, int Min_SAD)
-{
- int j = 16;
- int sad = 0;
- while(j--) {
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii- (*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-(*curr++));
- ii += 2;
- sad += abs(*ii-*curr);
-
- if(sad > Min_SAD)
- return INT_MAX;
-
- ii += pixels_on_line*4 - 30;
- /* Interpolated image, that means two times */
- /* We also take only one of the two pixels */
- /* This means another two times ... */
- curr += pixels_on_line - 15;
-
- } /* end while */
-
- return sad;
-}
-
-/* This implementation contains two mayor algorithms: exhaustive and
- logarithmic. The exhaustive algorithm was adapted to be applied on
- half-pixel luminance, and the logarithmic algorithm was implemented
- by Roalt Aalmoes and is functional equivalent to the one in berkeley's
- MPEG encoder. */
-
-void FullMotionEstimation(unsigned int *curr, unsigned int *prev_ipol,
- int seek_dist, MotionVector *current_MV, int x_curr,
- int y_curr)
- /* x_curr and y_curr are whole-pixel
- values to indicate upperleft (0,0)
- pixel of this MB in whole frame curr */
-{
-
- int Min_FRAME;
- MotionVector MV_FRAME;
- unsigned int *curr_image_MB;
- int sxy,xblock,k,yblock,l;
- int RightXBorder,LeftXBorder,RightYBorder,LeftYBorder;
- int xmax,ymax,sad;
- int CenterX, CenterY, origCenterX, origCenterY, newCenterX, newCenterY;
- int StepSizeX, StepSizeY;
-
-
-
- curr_image_MB = curr + pels*y_curr + x_curr;
- /* from now on, all pixel related operations are based on prev_ipol */
- /* way: thus resolution is enhanced by 2 for halfpixel search */
- CenterX = 2*x_curr;
- CenterY = 2*y_curr;
-
- xmax = 2*pels;
- ymax = 2*lines;
- sxy = mmin(31, seek_dist);
-
-
- LeftXBorder = CenterX - sxy;
- RightXBorder = CenterX + sxy;
-
- LeftYBorder = CenterY - sxy;
- RightYBorder = CenterY + sxy;
-
- if (LeftXBorder<0) LeftXBorder = 0;
- if (RightXBorder>xmax-32) RightXBorder = xmax-32;
- /* Comparison is still on 16x16 blocks */
- if (LeftYBorder<0) LeftYBorder = 0;
- /* but this is interleaved by 1 pixel! */
- if (RightYBorder>ymax-32) RightYBorder = ymax-32;
- /* e.g. comp. pixno.1 3 5 7 or 2 4 6 8 */
- /*but never 1 2 3 4 as this is halfres.*/
-
- Min_FRAME = INT_MAX;
- MV_FRAME.x = 0;
- MV_FRAME.y = 0;
- MV_FRAME.x_half = 0;
- MV_FRAME.y_half = 0;
-
-
- if(search_p_frames == CPARAM_EXHAUSTIVE) {
- /* This is the spriral search variant of exhaustive seach */
- /* First determine zero MV value SAD */
- xblock = CenterX; yblock = CenterY;
-
- sad = SAD_HalfPixelMacroblock(prev_ipol + xblock + yblock*pels*2,
- curr_image_MB,
- pels, Min_FRAME) - PREF_NULL_VEC;
-
- /* I assume sad < INT_MAX */
- Min_FRAME = sad;
-
- /* Then do the surrounding MV SADs */
-
- for (l = 1; l <= sxy; l++) {
- /* For every loop from inside to outside do */
- xblock = CenterX - l;
- yblock = CenterY - l;
- for (k = 0; k < 8*l; k++) {
- if (xblock>=LeftXBorder && xblock<=RightXBorder
- && yblock>=LeftYBorder && yblock<=RightYBorder) {
-
- /* 16x16 integer pel MV */
- sad = SAD_HalfPixelMacroblock(prev_ipol + xblock + yblock*pels*2,
- curr_image_MB,
- pels, Min_FRAME);
- if (sad < Min_FRAME) {
- MV_FRAME.x = xblock - CenterX;
- MV_FRAME.y = yblock - CenterY;
- Min_FRAME = sad;
- }
-
- }
- if (k<2*l) xblock++;
- else if (k<4*l) yblock++;
- else if (k<6*l) xblock--;
- else yblock--;
- }
- } /* end for */
- } else { /* search_p_frames == DEF_LOGARITHMIC_SEARCH */
-
-
-
- /* origCenter* is necessary because Center* changes */
- origCenterX = CenterX; origCenterY = CenterY;
-
-
- StepSizeX = ((2*sxy + 1) + 1)/3; /* round(Size of Xinterval / 3),
- this is maximum size of between two
- probes */
- StepSizeY = ((2*sxy + 1) + 1)/3; /* round(Size of Yinterval / 3) */
-
-
- sad = SAD_HalfPixelMacroblock(prev_ipol + CenterX + CenterY*pels*2,
- curr_image_MB,pels,
- Min_FRAME) - PREF_NULL_VEC;
-
- /* I assume sad < INT_MAX */
- Min_FRAME = sad;
-
-
- while (StepSizeX >= 1 || StepSizeY >= 1) {
- newCenterX = CenterX;
- newCenterY = CenterY;
-
-
- /* Do this loop three times */
- for(xblock = CenterX - StepSizeX; xblock <= CenterX + StepSizeX &&
- (StepSizeX != 0); xblock += StepSizeX) {
- if(xblock < LeftXBorder || xblock > RightXBorder)
- continue;
- /* Do this loop three times */
- for(yblock = CenterY - StepSizeY; yblock <= CenterY + StepSizeY &&
- (StepSizeY != 0); yblock+= StepSizeY) {
- if(yblock < LeftYBorder || yblock > RightYBorder)
- continue;
- /* In fact, the middlest comparison is only required
- the first time, as the last time it is calculated
- on the previous while-loop, remember:
- NewCenterZ = zblock */
-
- sad = SAD_HalfPixelMacroblock(prev_ipol + xblock + yblock*pels*2,
- curr_image_MB,pels, Min_FRAME);
- if (sad < Min_FRAME) {
- MV_FRAME.x = xblock - origCenterX;
- MV_FRAME.y = yblock - origCenterY;
- Min_FRAME = sad;
- newCenterX = xblock; newCenterY = yblock;
- }
-
- } /* end for yblock */
- } /* end for xblock */
-
- if(newCenterX < CenterX) {
- RightXBorder = LeftXBorder + StepSizeX - 1;
- } else if(newCenterX == CenterX) {
- LeftXBorder = LeftXBorder + StepSizeX;
- RightXBorder = RightXBorder - StepSizeX;
- } else {
- LeftXBorder = RightXBorder - StepSizeX + 1;
- }
-
- if(newCenterY < CenterY) {
- RightYBorder = LeftYBorder + StepSizeY - 1;
- } else if(newCenterY == CenterY) {
- LeftYBorder = LeftYBorder + StepSizeY;
- RightYBorder = RightYBorder - StepSizeY;
- } else {
- LeftYBorder = RightYBorder - StepSizeY + 1;
- }
-
- CenterX = newCenterX;
- CenterY = newCenterY;
-
- /* Stepsizes are 0 when RightZBorder == LeftZBorder */
- StepSizeX = ((RightXBorder - LeftXBorder + 1) + 1)/3;
- /* round(Size of Xinterval / 3), this is maximum size of between two
- probes */
- StepSizeY = ((RightYBorder - LeftYBorder + 1) + 1)/3;
- /* round(Size of Yinterval / 3) */
-
- } /* End while stepsize */
- } /* end logarithmic search algorithm */
-
-
-
- current_MV->x = MV_FRAME.x / 2;
- current_MV->x_half = MV_FRAME.x % 2; /*This might not work for neg. values!*/
- current_MV->y = MV_FRAME.y / 2;
- current_MV->y_half = MV_FRAME.y % 2; /* This might not work! */
- current_MV->min_error = Min_FRAME;
-
-
-
- return;
-}
-
-
-int SAD_HalfPixelMacroblock2(unsigned int *ii,
- unsigned int *curr,
- int pixels_on_line, int Min_SAD)
-{
- int j = 16;
- int sad = 0;
- while(j--) {
- sad += abs(*ii-(*curr));
-
- sad += abs(*(ii + 2)-(*(curr+1)));
- sad += abs(*(ii + 4)-(*(curr+2)));
- sad += abs(*(ii + 6)-(*(curr+3)));
- sad += abs(*(ii + 8)-(*(curr+4)));
- sad += abs(*(ii + 10)-(*(curr+5)));
- sad += abs(*(ii + 12)-(*(curr+6)));
- sad += abs(*(ii + 14)-(*(curr+7)));
- sad += abs(*(ii + 16)-(*(curr+8)));
- sad += abs(*(ii + 18)-(*(curr+9)));
- sad += abs(*(ii + 20)-(*(curr+10)));
- sad += abs(*(ii + 22)-(*(curr+11)));
- sad += abs(*(ii + 24)-(*(curr+12)));
- sad += abs(*(ii + 26)-(*(curr+13)));
- sad += abs(*(ii + 28)-(*(curr+14)));
- sad += abs(*(ii + 30)-(*(curr+15)));
-
- if(sad > Min_SAD)
- return INT_MAX;
-
- ii += pixels_on_line*2*2;
- /* Interpolated image, that means two times */
- /* We also take only one of the two pixels */
- /* This means another two times ... */
- curr += pixels_on_line;
-
- } /* end while */
-
- return sad;
-}
-
-
-unsigned int *LoadArea(unsigned int *im, int x, int y,
- int x_size, int y_size, int lx)
-{
- unsigned int *res = (unsigned int *)malloc(sizeof(int)*x_size*y_size);
- unsigned int *in;
- unsigned int *out;
- int i = x_size;
- int j = y_size;
-
- in = im + (y*lx) + x;
- out = res;
-
- while (j--) {
- while (i--)
- *out++ = *in++;
- i = x_size;
- in += lx - x_size;
- };
- return res;
-}
-
-
-
-void FindMB(int x, int y, unsigned int *image, unsigned int MB[16][16])
-
-{
- int n;
- unsigned int *MB_ptr = &MB[0][0];
- unsigned int *image_ptr;
-
- MB_ptr = &MB[0][0];
- image_ptr = image + x + y*pels;
-
-#ifdef LONGISDOUBLEINT
- for(n = 0; n < 16; n++) {
- * (unsigned long *) MB_ptr = * (unsigned long *) image_ptr;
- MB_ptr += 2; image_ptr += 2;
- * (unsigned long *) MB_ptr = * (unsigned long *) image_ptr;
- MB_ptr += 2; image_ptr += 2;
- * (unsigned long *) MB_ptr = * (unsigned long *) image_ptr;
- MB_ptr += 2; image_ptr += 2;
- * (unsigned long *) MB_ptr = * (unsigned long *) image_ptr;
- MB_ptr += 2; image_ptr += 2;
- * (unsigned long *) MB_ptr = * (unsigned long *) image_ptr;
- MB_ptr += 2; image_ptr += 2;
- * (unsigned long *) MB_ptr = * (unsigned long *) image_ptr;
- MB_ptr += 2; image_ptr += 2;
- * (unsigned long *) MB_ptr = * (unsigned long *) image_ptr;
- MB_ptr += 2; image_ptr += 2;
- * (unsigned long *) MB_ptr = * (unsigned long *) image_ptr;
- MB_ptr += 2; image_ptr += 2;
-
- image_ptr += pels - 16;
- }
-
-#else
-
- for (n = 0; n < 16; n++) {
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- *(unsigned int *) MB_ptr++ = *(unsigned int *) image_ptr++;
- image_ptr += pels - 16;
- }
-#endif
-
-}
-
-
-
-
-
-
diff --git a/gst/r263/libr263/owntypes.h b/gst/r263/libr263/owntypes.h
deleted file mode 100644
index 9219e08..0000000
--- a/gst/r263/libr263/owntypes.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-#ifndef OWN_TYPES_H
-#define OWN_TYPES_H
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-
-#endif
diff --git a/gst/r263/libr263/pred.c b/gst/r263/libr263/pred.c
deleted file mode 100644
index 75c2bd2..0000000
--- a/gst/r263/libr263/pred.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-#include "sim.h"
-
-MB_Structure *Predict_P(unsigned int *curr_image, unsigned int *prev_image,
- unsigned int *prev_ipol, int x, int y,
- MotionVector *MV_ptr)
-{
- int m,n;
- int curr[16][16];
- int pred[16][16];
- MotionVector *fr0;
- int dx, dy;
- int xmb, ymb;
- MB_Structure *pred_error;
-
- pred_error = (MB_Structure *)malloc(sizeof(MB_Structure));
-
- xmb = x/MB_SIZE;
- ymb = y/MB_SIZE;
-
- fr0 = MV_ptr + ymb*mbc + xmb;
-
- /* Find MB in current image */
-#ifdef PRINT_DEBUG
- fprintf(debugf,"FindMB(%d,%d,%p,%p)\n",x,y,curr_image->Y,curr);
-#endif
- FindMB(x, y, curr_image, curr);
-
- /* Find prediction based on half pel MV */
-
- FindPred(x, y, fr0, prev_ipol, &pred[0][0]);
-
- /* Do the actual prediction */
- if (fr0->Mode == MODE_INTER) {
- for (n = 0; n < MB_SIZE; n++)
- for (m = 0; m < MB_SIZE; m++)
- pred_error->lum[n][m] = (int)(curr[n][m] - pred[n][m]);
-
- dx = 2*fr0->x + fr0->x_half;
- dy = 2*fr0->y + fr0->y_half;
- dx = ( dx % 4 == 0 ? dx >> 1 : (dx>>1)|1 );
- dy = ( dy % 4 == 0 ? dy >> 1 : (dy>>1)|1 );
-#ifdef PRINTDEBUG
- fprintf(debugf,"DoPredChrom_P(%d,%d,%d,%d,%p,%p,%p)\n",x, y, dx, dy, curr_image, prev_image, pred_error);
-#endif
- DoPredChrom_P(x, y, dx, dy, curr_image, prev_image, pred_error);
- }
- else
- fprintf(stderr,"Illegal Mode in Predict_P (pred.c)\n");
-
- return pred_error;
-}
-
-void DoPredChrom_P(int x_curr, int y_curr, int dx, int dy,
- unsigned int *curr, unsigned int *prev,
- MB_Structure *pred_error)
-{
- int m,n;
-
- int x, y, ofx, ofy, pel, lx;
- int xint, yint;
- int xh, yh;
-
- lx = pels/2;
-
- x = x_curr>>1;
- y = y_curr>>1;
-
- xint = dx>>1;
- xh = dx & 1;
- yint = dy>>1;
- yh = dy & 1;
-
- if (!xh && !yh) {
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
-
- ofx = x + xint + m;
- ofy = y + yint + n;
- /* prev+vskip does not work directly... */
- pel=*(prev+vskip + ofx + (ofy )*lx);
- pred_error->Cr[n][m] =
- (int)(*(curr+vskip + x+m + (y+n)*cpels) - pel);
-
- pel=*(prev+uskip + ofx + (ofy )*lx);
- pred_error->Cb[n][m] =
- (int)(*(curr + uskip + x+m + (y+n)*cpels) - pel);
- }
- }
- }
- else if (!xh && yh) {
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
-
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=(*(prev+vskip + ofx + (ofy )*lx)+
- *(prev+vskip + ofx + (ofy+yh)*lx) + 1)>>1;
-
- pred_error->Cr[n][m] =
- (int)(*(curr+vskip + x+m + (y+n)*cpels) - pel);
-
- pel=(*(prev+uskip + ofx + (ofy )*lx)+
- *(prev+uskip + ofx + (ofy+yh)*lx) + 1)>>1;
-
- pred_error->Cb[n][m] =
- (int)(*( curr+uskip + x+m + (y+n)*cpels) - pel);
-
- }
- }
- }
- else if (xh && !yh) {
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
-
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=(*(prev+vskip+ofx + (ofy )*lx)+
- *(prev+vskip+ofx+xh + (ofy )*lx) + 1)>>1;
-
- pred_error->Cr[n][m] =
- (int)(*(curr+vskip + x+m + (y+n)*cpels) - pel);
-
- pel=(*(prev+uskip+ofx + (ofy )*lx)+
- *(prev+uskip+ofx+xh + (ofy )*lx) + 1)>>1;
-
- pred_error->Cb[n][m] =
- (int)( *( curr+uskip + x+m + (y+n)*cpels) - pel);
-
- }
- }
- }
- else { /* xh && yh */
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=(*(prev+vskip+ofx + (ofy )*lx)+
- *(prev+vskip+ofx+xh + (ofy )*lx)+
- *(prev+vskip+ofx + (ofy+yh)*lx)+
- *(prev+vskip+ofx+xh + (ofy+yh)*lx)+
- 2)>>2;
-
- pred_error->Cr[n][m] =
- (int)(*(curr+vskip + x+m + (y+n)*cpels) - pel);
-
- pel=(*(prev+uskip+ofx + (ofy )*lx)+
- *(prev+uskip+ofx+xh + (ofy )*lx)+
- *(prev+uskip+ofx + (ofy+yh)*lx)+
- *(prev+uskip+ofx+xh + (ofy+yh)*lx)+
- 2)>>2;
-
- pred_error->Cb[n][m] =
- (int)(*(curr+uskip + x+m + (y+n)*cpels) - pel);
-
- }
- }
- }
- return;
-}
-
-
-void FindPred(int x, int y, MotionVector *fr, unsigned int *prev,
- int *pred)
-{
- int n;
- int new_x, new_y;
- int *prev_ptr;
-
- new_x = 2*(x + fr->x) + fr->x_half;
- new_y = 2*(y + fr->y) + fr->y_half;
-
- prev_ptr = (int *) prev + 2*new_y*pels + new_x;
- /* Fill pred. data */
- for (n = 0; n < 16; n++) {
- /* Interpolated data -> too bad it can't be done in longs... */
-
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
- prev_ptr += 2;
- *(pred++) = *(prev_ptr);
-
- prev_ptr += pels*4 - 30;
- }
- return;
-}
-
-
-MB_Structure *MB_Recon_P(unsigned int *prev_image, unsigned int *prev_ipol,
- MB_Structure *diff, int x_curr, int y_curr,
- MotionVector *MV_ptr)
-{
- MB_Structure *recon_data = (MB_Structure *)malloc(sizeof(MB_Structure));
- MotionVector *fr0;
- int dx, dy;
-
- fr0 = MV_ptr + (y_curr/MB_SIZE)*mbc + (x_curr/MB_SIZE);
-
- if (fr0->Mode == MODE_INTER) {
- /* Inter 16x16 */
- ReconLumBlock_P(x_curr,y_curr,fr0,prev_ipol,&diff->lum[0][0]);
-
- dx = 2*fr0->x + fr0->x_half;
- dy = 2*fr0->y + fr0->y_half;
- dx = ( dx % 4 == 0 ? dx >> 1 : (dx>>1)|1 );
- dy = ( dy % 4 == 0 ? dy >> 1 : (dy>>1)|1 );
- ReconChromBlock_P(x_curr, y_curr, dx, dy, prev_image, diff);
- }
-
- memcpy(recon_data, diff, sizeof(MB_Structure));
-
- return recon_data;
-}
-
-void ReconLumBlock_P(int x, int y, MotionVector *fr,
- unsigned int *prev, int *data)
-{
- int m, n;
- int x1, y1;
- int *data_ptr = data;
- unsigned int *prev_ptr;
-
- x1 = 2*(x + fr->x) + fr->x_half;
- y1 = 2*(y + fr->y) + fr->y_half;
-
- prev_ptr = prev + x1 + y1*2*pels;
- for (n = 0; n < 16; n++) {
- for (m = 0; m < 16; m++) {
- *data_ptr++ += (int)(*prev_ptr);
- prev_ptr += 2;
- }
- prev_ptr += 2*2*pels - 32;
- }
-
- return;
-}
-
-
-void ReconChromBlock_P(int x_curr, int y_curr, int dx, int dy,
- unsigned int *prev, MB_Structure *data)
-
-{
- int m,n;
-
- int x, y, ofx, ofy, pel,lx;
- int xint, yint;
- int xh, yh;
-
- lx = pels/2;
-
- x = x_curr>>1;
- y = y_curr>>1;
-
- xint = dx>>1;
- xh = dx & 1;
- yint = dy>>1;
- yh = dy & 1;
-
- if (!xh && !yh) {
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
-
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=*(prev+vskip+ ofx + (ofy )*lx);
- data->Cr[n][m] += pel;
-
- pel=*(prev+uskip + ofx + (ofy )*lx);
- data->Cb[n][m] += pel;
- }
- }
- }
- else if (!xh && yh) {
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
-
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=(*(prev+vskip+ ofx + (ofy )*lx)+
- *(prev+vskip+ ofx + (ofy+yh)*lx) + 1)>>1;
-
- data->Cr[n][m] += pel;
-
- pel=(*(prev+uskip+ofx + (ofy )*lx)+
- *(prev+uskip+ofx + (ofy+yh)*lx) + 1)>>1;
-
- data->Cb[n][m] += pel;
-
- }
- }
- }
- else if (xh && !yh) {
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
-
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=(*(prev+vskip+ofx + (ofy )*lx)+
- *(prev+vskip+ofx+xh + (ofy )*lx) + 1)>>1;
-
- data->Cr[n][m] += pel;
-
- pel=(*(prev+uskip+ofx + (ofy )*lx)+
- *(prev+uskip+ofx+xh + (ofy )*lx) + 1)>>1;
-
- data->Cb[n][m] += pel;
-
- }
- }
- }
- else { /* xh && yh */
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=(*(prev+vskip+ofx + (ofy )*lx)+
- *(prev+vskip+ofx+xh + (ofy )*lx)+
- *(prev+vskip+ofx + (ofy+yh)*lx)+
- *(prev+vskip+ofx+xh + (ofy+yh)*lx)+
- 2)>>2;
-
- data->Cr[n][m] += pel;
-
- pel=(*(prev+uskip+ofx + (ofy )*lx)+
- *(prev+uskip+ofx+xh + (ofy )*lx)+
- *(prev+uskip+ofx + (ofy+yh)*lx)+
- *(prev+uskip+ofx+xh + (ofy+yh)*lx)+
- 2)>>2;
-
- data->Cb[n][m] += pel;
-
- }
- }
- }
- return;
-}
-
-void FindChromBlock_P(int x_curr, int y_curr, int dx, int dy,
- unsigned int *prev, MB_Structure *data)
-
-{
- int m,n;
-
- int x, y, ofx, ofy, pel,lx;
- int xint, yint;
- int xh, yh;
-
- lx = pels/2;
-
- x = x_curr>>1;
- y = y_curr>>1;
-
- xint = dx>>1;
- xh = dx & 1;
- yint = dy>>1;
- yh = dy & 1;
-
- if (!xh && !yh) {
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
-
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=*(prev+vskip+ofx + (ofy )*lx);
- data->Cr[n][m] = pel;
-
- pel=*(prev+uskip+ofx + (ofy )*lx);
- data->Cb[n][m] = pel;
- }
- }
- }
- else if (!xh && yh) {
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
-
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=(*(prev+vskip+ofx + (ofy )*lx)+
- *(prev+vskip+ofx + (ofy+yh)*lx) + 1)>>1;
-
- data->Cr[n][m] = pel;
-
- pel=(*(prev+uskip+ofx + (ofy )*lx)+
- *(prev+uskip+ofx + (ofy+yh)*lx) + 1)>>1;
-
- data->Cb[n][m] = pel;
-
- }
- }
- }
- else if (xh && !yh) {
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
-
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=(*(prev+vskip+ofx + (ofy )*lx)+
- *(prev+vskip+ofx+xh + (ofy )*lx) + 1)>>1;
-
- data->Cr[n][m] = pel;
-
- pel=(*(prev+uskip+ofx + (ofy )*lx)+
- *(prev+uskip+ofx+xh + (ofy )*lx) + 1)>>1;
-
- data->Cb[n][m] = pel;
-
- }
- }
- }
- else { /* xh && yh */
- for (n = 0; n < 8; n++) {
- for (m = 0; m < 8; m++) {
- ofx = x + xint + m;
- ofy = y + yint + n;
- pel=(*(prev+vskip+ofx + (ofy )*lx)+
- *(prev+vskip+ofx+xh + (ofy )*lx)+
- *(prev+vskip+ofx + (ofy+yh)*lx)+
- *(prev+vskip+ofx+xh + (ofy+yh)*lx)+
- 2)>>2;
-
- data->Cr[n][m] = pel;
-
- pel=(*(prev+uskip+ofx + (ofy )*lx)+
- *(prev+uskip+ofx+xh + (ofy )*lx)+
- *(prev+uskip+ofx + (ofy+yh)*lx)+
- *(prev+uskip+ofx+xh + (ofy+yh)*lx)+
- 2)>>2;
-
- data->Cb[n][m] = pel;
-
- }
- }
- }
- return;
-}
-
-
-
-
-int ChooseMode(unsigned int *curr, int x_pos, int y_pos, int min_SAD)
-{
- int i,j;
- int MB_mean = 0, A = 0;
- int y_off;
-
- for (j = 0; j < MB_SIZE; j++) {
- y_off = (y_pos + j) * pels;
- for (i = 0; i < MB_SIZE; i++) {
- MB_mean += *(curr + x_pos + i + y_off);
- }
- }
- MB_mean /= (MB_SIZE*MB_SIZE);
- for (j = 0; j < MB_SIZE; j++) {
- y_off = (y_pos + j) * pels;
- for (i = 0; i < MB_SIZE; i++) {
- A += abs( *(curr + x_pos + i + y_off) - MB_mean );
- }
- }
-
- if (A < (min_SAD - 500))
- return MODE_INTRA;
- else
- return MODE_INTER;
-}
-
-
-
diff --git a/gst/r263/libr263/quant.c b/gst/r263/libr263/quant.c
deleted file mode 100644
index a1a8517..0000000
--- a/gst/r263/libr263/quant.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-
-#include"sim.h"
-
-/* For q=8, a "speedy" version is integrated */
-int QuantAndFindCBP(int *coeff, int *qcoeff, int QP, int Mode, int CBP_Mask)
-{
- int i;
- int level;
- int tempje;
- int CBP = 0;
-
- if (Mode == MODE_INTRA) { /* Intra */
- qcoeff[0] = mmax(1,mmin(254,coeff[0] >> 3)); /* was: /8 */
-
- if(QP == 8) {
-
- for(i = 1; i < 64; i++) {
- level = (abs(coeff[i])) >> 4;
- qcoeff[i] = mmin(127, mmax(-127,sign(coeff[i]) * level));
- if(qcoeff[i])
- CBP = CBP_Mask;
- }
- } else { /* QP != 8 */
- for(i = 1; i < 64; i++) {
-
- level = (abs(coeff[i])) / (2*QP);
- qcoeff[i] = mmin(127,mmax(-127,sign(coeff[i]) * level));
- if(qcoeff[i])
- CBP = CBP_Mask;
- }
-
- } /* End QP == 8 */
- }
- else { /* non Intra */
- if(QP == 8) {
- for(i = 0; i < 64; i++) {
- tempje = abs(coeff[i]) - 4;
- if(tempje < 0) {
- *(qcoeff++) = 0;
- } else {
- level = tempje >> 4; /* Note 2*QP == 2*8 = 2^4 == ">>4" */
- if((*(qcoeff++) = mmin(127,mmax(-127,(sign(coeff[i]) > 0) ?
- level :
- -level))) != 0)
- CBP = CBP_Mask;
- }
- }
-
- } else { /* QP != 8 */
-
- for (i = 0; i < 64; i++) {
- level = (abs(coeff[i])-QP/2) / (2*QP);
- if((*(qcoeff++) = mmin(127,mmax(-127,sign(coeff[i]) * level)))!= 0)
- CBP = CBP_Mask;
- }
-
- } /* End QP == 8 */
-
- }
- return CBP;
-}
-
-
-void Dequant(int *qcoeff, int *rcoeff, int QP, int Mode)
-{
- int i;
-
- if (QP) {
- for (i = 0; i < 64; i++) {
- if (qcoeff[i]) {
- if ((QP % 2) == 1)
- rcoeff[i] = QP * (2*abs(qcoeff[i]) + 1);
- else
- rcoeff[i] = QP * (2*abs(qcoeff[i]) + 1) - 1;
- rcoeff[i] = sign(qcoeff[i]) * rcoeff[i];
- }
- else
- rcoeff[i] = 0;
- }
- if (Mode == MODE_INTRA) { /* Intra */
- rcoeff[0] = qcoeff[0]*8;
- }
- }
- else {
- /* No quantizing at all */
- for (i = 0; i < 64; i++) {
- rcoeff[i] = qcoeff[i];
- }
- }
- return;
-}
-
-
-
diff --git a/gst/r263/libr263/rlib.c b/gst/r263/libr263/rlib.c
deleted file mode 100644
index b6788db..0000000
--- a/gst/r263/libr263/rlib.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-#include "rlib.h"
-#include "owntypes.h"
-
-/* this function is added by Wang, Zhanglei */
-void ReadBuffer(const unsigned char * src, unsigned int *dst, int width, int height)
-{
- unsigned int *ud;
- unsigned char *us;
- int i;
-
- us = src;
- ud = dst;
-
- for(i = 0; i < width*height; i++)
- *ud++ = (unsigned int) *us++;
-
- us = src + width*height;
- ud = dst + width*height;
-
- for(; i < width*height*3/2; i++)
- *ud++ = (signed int) *us++;
-
- return;
-}
-
-void ReadQCIFBuffer(const unsigned char * data, struct qcif *qc)
-{
- struct qcif8bit * source = (struct qcif8bit *)data;
- unsigned int *ud;
- unsigned char *us;
- int i;
-
- us = &source->Y[0][0];
- ud = &qc->Y[0][0];
-
- for(i = 0; i < QCIF_YWIDTH*QCIF_YHEIGHT; i++)
- *ud++ = (unsigned int) *us++;
-
- us = &source->U[0][0];
- ud = &qc->U[0][0];
-
- for(; i < QCIF_YWIDTH*QCIF_YHEIGHT + QCIF_UWIDTH*QCIF_UHEIGHT +
- QCIF_VWIDTH*QCIF_VHEIGHT; i++)
- *ud++ = (signed int) *us++;
-
- return;
-}
-
-int ReadQCIF(FILE *f, struct qcif *qc)
-{
- struct qcif8bit source;
- int i;
- int file_err;
- unsigned int *ud;
- unsigned char *us;
-
- file_err = fread(&source, sizeof(source), 1, f);
-
- if(file_err != 1)
- return FALSE;
-
- us = &source.Y[0][0];
- ud = &qc->Y[0][0];
-
- for(i = 0; i < QCIF_YWIDTH*QCIF_YHEIGHT; i++)
- *ud++ = (unsigned int) *us++;
-
- us = &source.U[0][0];
- ud = &qc->U[0][0];
-
- for(; i < QCIF_YWIDTH*QCIF_YHEIGHT + QCIF_UWIDTH*QCIF_UHEIGHT +
- QCIF_VWIDTH*QCIF_VHEIGHT; i++)
- *ud++ = (signed int) *us++;
-
- return TRUE;
-}
-
-int ReadCIF(FILE *f, struct cif *qc)
-{
- struct cif8bit source;
- int i;
- int file_err;
- unsigned int *ud;
- unsigned char *us;
-
- file_err = fread(&source, sizeof(source), 1, f);
-
- if(file_err != 1)
- return FALSE;
-
- us = &source.Y[0][0];
- ud = &qc->Y[0][0];
-
- for(i = 0; i < CIF_YWIDTH*CIF_YHEIGHT; i++)
- *ud++ = (unsigned int) *us++;
-
- us = &source.U[0][0];
- ud = &qc->U[0][0];
-
- for(; i < CIF_YWIDTH*CIF_YHEIGHT + CIF_UWIDTH*CIF_UHEIGHT +
- CIF_VWIDTH*CIF_VHEIGHT; i++)
- *ud++ = (signed int) *us++;
-
- return TRUE;
-}
-
-int WriteQCIF(FILE *f, struct qcif *qc)
-{
- struct qcif8bit dest;
- int i;
- int file_err;
- unsigned char *ud;
- unsigned int *us;
-
- us = &qc->Y[0][0];
- ud = &dest.Y[0][0];
-
- for(i = 0; i < QCIF_YWIDTH*QCIF_YHEIGHT; i++)
- *ud++ = (unsigned char) *us++;
-
- us = &qc->U[0][0];
- ud = &dest.U[0][0];
-
- for(; i < QCIF_YWIDTH*QCIF_YHEIGHT + QCIF_UWIDTH*QCIF_UHEIGHT +
- QCIF_VWIDTH*QCIF_VHEIGHT; i++)
- *ud++ = (unsigned char) *us++;
-
- file_err = fwrite(&dest, sizeof(dest), 1, f);
-
- return (file_err == 1);
-
-}
-
-int WriteCIF(FILE *f, struct cif *qc)
-{
- struct cif8bit dest;
- int i;
- int file_err;
- unsigned char *ud;
- unsigned int *us;
-
- us = &qc->Y[0][0];
- ud = &dest.Y[0][0];
-
- for(i = 0; i < CIF_YWIDTH*CIF_YHEIGHT; i++)
- *ud++ = (unsigned char) *us++;
-
- us = &qc->U[0][0];
- ud = &dest.U[0][0];
-
- for(; i < CIF_YWIDTH*CIF_YHEIGHT + CIF_UWIDTH*CIF_UHEIGHT +
- CIF_VWIDTH*CIF_VHEIGHT; i++)
- *ud++ = (unsigned char) *us++;
-
- file_err = fwrite(&dest, sizeof(dest), 1, f);
-
- return (file_err == 1);
-
-}
diff --git a/gst/r263/libr263/rlib.h b/gst/r263/libr263/rlib.h
deleted file mode 100644
index 98f1097..0000000
--- a/gst/r263/libr263/rlib.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-/* This is the prototypes and definitions file associated with
- rlib.c
-*/
-#ifndef RLIB_H
-#define RLIB_H
-
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-
-
-/* Definitions for AVA */
-#define XTILESIZE 8
-#define YTILESIZE 8
-
-#define QCIF_YWIDTH 176
-#define QCIF_YHEIGHT 144
-#define QCIF_UWIDTH 88
-#define QCIF_UHEIGHT 72
-#define QCIF_VWIDTH 88
-#define QCIF_VHEIGHT 72
-#define QCIFXTILES 22
-#define QCIFYTILES 18
-
-#define SQCIF_YWIDTH 128
-#define SQCIF_YHEIGHT 96
-
-#define SQCIFXTILES 16
-#define SQCIFYTILES 12
-
-#define CIF4_YWIDTH 704
-#define CIF4_YHEIGHT 576
-
-#define CIF16_YWIDTH 1408
-#define CIF16_YHEIGHT 1152
-
-
-#define CIF_YWIDTH 352
-#define CIF_YHEIGHT 288
-#define CIF_UWIDTH 176
-#define CIF_UHEIGHT 144
-#define CIF_VWIDTH 176
-#define CIF_VHEIGHT 144
-#define CIFXTILES 44
-#define CIFYTILES 36
-
-/* As you can see, there are 2 different formats:
- - avaqcif format, U and V signed (not used in this distribution)
- - qcif format, U and V unsigned
-
- Also note that the data is received and stored as 8-bit characters,but
- is processed as 32-bit integers. This is done because the data can fit
- into 8-bit, but on most systems 8-bit operations are a LOT slower than
- 32-bit operations.
-*/
-
-/* Format as expected by encoder/decoder */
-
-/* Note that from AVA, the U and V values must be converted from signed to
- unsigned, like U.new = (unsigned char) U.old + 128
- (Not applicable for this distribution)
-*/
-
-struct qcif {
- unsigned int Y[QCIF_YHEIGHT][QCIF_YWIDTH];
- unsigned int U[QCIF_UHEIGHT][QCIF_UWIDTH];
- unsigned int V[QCIF_VHEIGHT][QCIF_VWIDTH];
-};
-
-struct cif {
- unsigned int Y[CIF_YHEIGHT][CIF_YWIDTH];
- unsigned int U[CIF_UHEIGHT][CIF_UWIDTH];
- unsigned int V[CIF_VHEIGHT][CIF_VWIDTH];
-};
-
-
-struct qcif8bit {
- unsigned char Y[QCIF_YHEIGHT][QCIF_YWIDTH];
- unsigned char U[QCIF_UHEIGHT][QCIF_UWIDTH];
- unsigned char V[QCIF_VHEIGHT][QCIF_VWIDTH];
-};
-
-struct cif8bit {
- unsigned char Y[CIF_YHEIGHT][CIF_YWIDTH];
- unsigned char U[CIF_UHEIGHT][CIF_UWIDTH];
- unsigned char V[CIF_VHEIGHT][CIF_VWIDTH];
-};
-
-
-/* Prototypes */
-int ReadQCIF(FILE *f, struct qcif *aq);
-int WriteQCIF(FILE *f, struct qcif *qc);
-int ReadCIF(FILE *f, struct cif *aq);
-int WriteCIF(FILE *f, struct cif *qc);
-void my_usleep(unsigned int microseconds);
-void ReadQCIFBuffer(const unsigned char* data, struct qcif *qc);
-void ReadBuffer(const unsigned char * src, unsigned int *dst, int width, int height);
-
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gst/r263/libr263/sim.h b/gst/r263/libr263/sim.h
deleted file mode 100644
index 2ab7e29..0000000
--- a/gst/r263/libr263/sim.h
+++ /dev/null
@@ -1,354 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
- /*****************************************************************
- * tmn (TMN encoder)
- * Copyright (C) 1995 Telenor R&D
- * Karl Olav Lillevold <kol@nta.no>
- *
- *
- *****************************************************************/
-
-/**********************************************************************
- *
- * Headerfile for TMN4 coder
- * Type definitions and declaration of functions
- * Date last modified: every now and then
- *
- **********************************************************************/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-#include "macros.h"
-
-#include "libr263.h"
-/* config parameters */
-
-#define YES 1
-#define NO 0
-#define DEF_UMV_MODE NO
-#define DEF_SAC_MODE NO
-#define DEF_ADV_MODE NO
-#define DEF_PBF_MODE NO
-#define DEF_ORIG_SKIP 0
-#define DEF_FRAMESKIP 2
-/* headerlength on concatenated 4:1:1 YUV input file */
-#define DEF_HEADERLENGTH 0
-
-/* insert sync after each DEF_INSERT_SYNC for increased error robustness
- * 0 means do not insert extra syncs */
-#define DEF_INSERT_SYNC 0
-
-
-
-
-/* Parameters from TMN */
-#define PREF_NULL_VEC 100
-#define PREF_16_VEC 200
-#define PREF_PBDELTA_NULL_VEC 50
-
-int headerlength; /* Global variables */
-int pels;
-int cpels;
-int uskip;
-int vskip;
-size_t sizeof_frame;
-int lines;
-int trace;
-int advanced;
-int pb_frames;
-int mv_outside_frame;
-int long_vectors;
-int mbr;
-int mbc;
-
-float target_framerate;
-FILE *tf;
-
-#ifdef PRINT_DEBUG
-FILE *debugf;
-#endif
-
-
-int search_p_frames; /* internal variable for exh/log search */
-FILE *mv_file;
-
-
-/****************************/
-
-#define PSC 1
-#define PSC_LENGTH 17
-
-#define ESCAPE 7167
-
-#define PCT_INTER 1
-#define PCT_INTRA 0
-#define ON 1
-#define OFF 0
-
-#define SF_SQCIF 1 /* 001 */
-#define SF_QCIF 2 /* 010 */
-#define SF_CIF 3 /* 011 */
-#define SF_4CIF 4 /* 100 */
-#define SF_16CIF 5 /* 101 */
-
-#define MODE_INTER 0
-#define MODE_INTER_Q 1
-#define MODE_INTER4V 2
-#define MODE_INTRA 3
-#define MODE_INTRA_Q 4
-#define MODE_SKIP 5 /* Created by Roalt */
-
-#define PBMODE_NORMAL 0
-#define PBMODE_MVDB 1
-#define PBMODE_CBPB_MVDB 2
-
-#define NO_VEC 999
-
-/* added by Roalt */
-#define DEF_SPIRAL_SEARCH 0
-#define DEF_LOGARITHMIC_SEARCH 1
-#define DEF_WRITE_TRACE NO
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-
-/* Global variable */
-#ifndef EXTERN_BUF
-WriteByte WriteByteFunction;
-#else
-char * stream_buffer;
-int stream_ptr;
-#endif
-
-/* Motionvector structure */
-
-typedef struct motionvector {
- int x; /* Horizontal comp. of mv */
- int y; /* Vertical comp. of mv */
- int x_half; /* Horizontal half-pel acc. */
- int y_half; /* Vertical half-pel acc. */
- int min_error; /* Min error for this vector */
- int Mode; /* Necessary for adv. pred. mode */
-} MotionVector;
-
-/* Point structure */
-
-typedef struct point {
- int x;
- int y;
-} Point;
-
-/* Structure with image data */
-
-typedef struct pict_image {
- unsigned int *lum; /* Luminance plane */
- unsigned int *Cr; /* Cr plane */
- unsigned int *Cb; /* Cb plane */
-} PictImage;
-
-/* Group of pictures structure. */
-
-/* Picture structure */
-
-typedef struct pict {
- int prev;
- int curr;
- int TR; /* Time reference */
- int source_format;
- int picture_coding_type;
- int spare;
- int unrestricted_mv_mode;
- int PB;
- int QUANT;
- int DQUANT;
- int MB;
- int seek_dist; /* Motion vector search window */
- int use_gobsync; /* flag for gob_sync */
- int MODB; /* B-frame mode */
- int BQUANT; /* which quantizer to use for B-MBs in PB-frame */
- int TRB; /* Time reference for B-picture */
- int frame_inc; /* buffer control frame_inc */
- float QP_mean; /* mean quantizer */
-} Pict;
-
-
-Pict *pic;
-
-/* Slice structure */
-
-typedef struct slice {
- unsigned int vert_pos; /* Vertical position of slice */
- unsigned int quant_scale; /* Quantization scale */
-} Slice;
-
-/* Macroblock structure */
-
-typedef struct macroblock {
- int mb_address; /* Macroblock address */
- int macroblock_type; /* Macroblock type */
- int skipped; /* 1 if skipped */
- MotionVector motion; /* Motion Vector */
-} Macroblock;
-
-/* Structure for macroblock data */
-
-typedef struct mb_structure {
- int lum[16][16];
- int Cr[8][8];
- int Cb[8][8];
-} MB_Structure;
-
-/* Structure for average results and virtal buffer data */
-
-typedef struct results {
- float SNR_l; /* SNR for luminance */
- float SNR_Cr; /* SNR for chrominance */
- float SNR_Cb;
- float QP_mean; /* Mean quantizer */
-} Results;
-
-/* Internal prototypes */
-
-/* stream.c prototypes */
-void mwinit(void);
-void mwcloseinit(void);
-
-/* mot_est.c prototypes */
-void FindMB(int x, int y, unsigned int *image, unsigned int MB[16][16]);
-void FullMotionEstimation(unsigned int *curr, unsigned int *prev_ipol,
- int seek_dist, MotionVector *current_MV, int x_curr,
- int y_curr);
-
-int SAD_HalfPixelMacroblock(unsigned int *ii,
- unsigned int *curr,
- int pixels_on_line, int Min_SAD);
-
-int SAD_HalfPixelMacroblock2(unsigned int *ii,
- unsigned int *curr,
- int pixels_on_line, int Min_SAD);
-unsigned int *LoadArea(unsigned int *im, int x, int y,
- int x_size, int y_size, int lx);
-
-/* pred.c prototypes */
-MB_Structure *Predict_P(unsigned int *curr_image, unsigned int *prev_image,
- unsigned int *prev_ipol, int x, int y,
- MotionVector *MV_ptr);
-
-void DoPredChrom_P(int x_curr, int y_curr, int dx, int dy,
- unsigned int *curr, unsigned int *prev,
- MB_Structure *pred_error);
-void FindPred(int x, int y, MotionVector *fr, unsigned int *prev,
- int *pred);
-
-MB_Structure *MB_Recon_P(unsigned int *prev_image, unsigned int *prev_ipol,
- MB_Structure *diff, int x_curr, int y_curr,
- MotionVector *MV_ptr);
-
-void ReconLumBlock_P(int x, int y, MotionVector *fr,
- unsigned int *prev, int *data);
-void ReconChromBlock_P(int x_curr, int y_curr, int dx, int dy,
- unsigned int *prev, MB_Structure *data);
-void FindChromBlock_P(int x_curr, int y_curr, int dx, int dy,
- unsigned int *prev, MB_Structure *data);
-int ChooseMode(unsigned int *curr, int x_pos, int y_pos, int min_SAD);
-
-
-/* countbit.c prototypes */
-void ZeroBits(Bits *bits);
-void ZeroRes(Results *res);
-int FindCBP(int *qcoeff, int Mode, int ncoeffs);
-void CountBitsVectors(MotionVector *MV_ptr, Bits *bits,
- int x, int y, int Mode, int newgob, Pict *pic);
-void FindPMV(MotionVector *MV_ptr, int x, int y,
- int *p0, int *p1, int block, int newgob, int half_pel);
-void CountBitsCoeff(int *qcoeff, int I, int CBP, Bits *bits, int ncoeffs);
-int CodeCoeff(int Mode, int *qcoeff, int block, int ncoeffs);
-int CountBitsPicture(Pict *pic);
-void AddBitsPicture(Bits *bits);
-void CountBitsMB(int Mode, int COD, int CBP, int CBPB, Pict *pic, Bits *bits);
-int CountBitsSlice(int slice, int quant);
-void ZeroVec(MotionVector *MV);
-void MarkVec(MotionVector *MV);
-void CopyVec(MotionVector *MV1, MotionVector *MV2);
-int EqualVec(MotionVector *MV2, MotionVector *MV1);
-
-/* coder.c prototypes */
-void ZeroMBlock(MB_Structure *data);
-void CodeIntraH263(CParam *params, Bits *bits);
-void CodeInterH263(CParam *params, Bits *bits);
-__inline__ void Clip(MB_Structure *data);
-int *MB_EncodeAndFindCBP(MB_Structure *mb_orig, int QP, int I, int *CBP);
-int MB_Decode(int *qcoeff, MB_Structure *mb_recon, int QP, int I);
-void FullMotionEstimatePicture(unsigned int *curr, unsigned int *prev,
- unsigned int *prev_ipol, int seek_dist,
- MotionVector *MV_ptr,
- int advanced_method,
- int *EncodeThisBlock);
-void ReconCopyImage(int i, int j, unsigned int *recon, unsigned int *prev_recon);
-void ReconImage (int i, int j, MB_Structure *data, unsigned int *recon);
-void InterpolateImage(unsigned int *image,
- unsigned int *ipol_image,
- int w, int h);
-void FillLumBlock( int x, int y, unsigned int *image, MB_Structure *data);
-void FillChromBlock(int x_curr, int y_curr, unsigned int *image,
- MB_Structure *data);
-
-
-/* quant.c prototypes */
-void Dequant(int *qcoeff, int *rcoeff, int QP, int I);
-int QuantAndFindCBP(int *coeff, int *qcoeff, int QP, int I, int CBP_Mask);
-
-/* dct.c prototypes */
-int Dct( int *block, int *coeff);
-int idct(int *coeff,int *block);
-
-#ifndef FASTIDCT
-/* global declarations for idctref */
-void init_idctref (void);
-void idctref (int *coeff, int *block);
-#endif
-
-#ifdef VERYFASTIDCT
-void init_idct(void);
-#endif
-
-/* Fix broken header-files on suns to avoid compiler warnings */
-/* #define BROKEN_SUN_HEADERS here or in Makefile */
-#ifdef BROKEN_SUN_HEADERS
-extern int printf();
-extern int fprintf();
-extern int time();
-extern int fclose();
-extern int rewind();
-extern int fseek();
-extern int fread();
-extern int fwrite();
-extern int fflush();
-extern int fscanf();
-extern int _flsbuf();
-extern int _filbuf();
-#endif
-
diff --git a/gst/r263/libr263/stream.c b/gst/r263/libr263/stream.c
deleted file mode 100644
index 47ce488..0000000
--- a/gst/r263/libr263/stream.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/************************************************************************/
-/* libr263: fast H.263 encoder library */
-/* */
-/* Copyright (C) 1996, 1997 by Roalt Aalmoes, Twente University */
-/* SPA multimedia group 'huygens' */
-/* */
-/* Based on Telenor TMN 1.6 encoder (Copyright (C) 1995, Telenor R&D) */
-/* created by Karl Lillevold */
-/* */
-/* Author : Roalt Aalmoes, <aalmoes@huygens.nl> */
-/* */
-/* Version : 0.1 */
-/* DISCLAIMER: See DISCLAIMER file also distributed with this package */
-/************************************************************************/
-
-/*************************************************************
-Copyright (C) 1990, 1991, 1993 Andy C. Hung, all rights reserved.
-PUBLIC DOMAIN LICENSE: Stanford University Portable Video Research
-Group. If you use this software, you agree to the following: This
-program package is purely experimental, and is licensed "as is".
-Permission is granted to use, modify, and distribute this program
-without charge for any purpose, provided this license/ disclaimer
-notice appears in the copies. No warranty or maintenance is given,
-either expressed or implied. In no event shall the author(s) be
-liable to you or a third party for any special, incidental,
-consequential, or other damages, arising out of the use or inability
-to use the program for any purpose (or the loss of data), even if we
-have been advised of such possibilities. Any public reference or
-advertisement of this source code should refer to it as the Portable
-Video Research Group (PVRG) code, and not by any author(s) (or
-Stanford University) name.
-*************************************************************/
-
-/*
-************************************************************
-stream.c
-
-This file handles all of the bit-level stream commands.
-
-************************************************************
-*/
-
-/*LABEL stream.c */
-
-#include"sim.h"
-
-extern char *BitPrint(int length, int val);
-static int current_write_byte;
-static int write_position;
-
-int bit_set_mask[] =
-{0x00000001,0x00000002,0x00000004,0x00000008,
-0x00000010,0x00000020,0x00000040,0x00000080,
-0x00000100,0x00000200,0x00000400,0x00000800,
-0x00001000,0x00002000,0x00004000,0x00008000,
-0x00010000,0x00020000,0x00040000,0x00080000,
-0x00100000,0x00200000,0x00400000,0x00800000,
-0x01000000,0x02000000,0x04000000,0x08000000,
-0x10000000,0x20000000,0x40000000,0x80000000};
-
-#ifndef EXTERN_BUF
-#define WRITEBYTE(x) WriteByteFunction(x)
-#else
-#define WRITEBYTE(x) ( stream_buffer[stream_ptr++] = (x) )
-#endif
-
-#define mput1()\
-{current_write_byte|=bit_set_mask[write_position--];\
- if (write_position<0) {WRITEBYTE(current_write_byte); write_position=7;current_write_byte=0;}}
-
-#define mput0()\
-{write_position--;if(write_position<0){WRITEBYTE(current_write_byte);write_position=7;current_write_byte=0;}}
-
-
-/*
-
-mwinit() initializes static variables for writing
-
-*/
-
-void mwinit()
-{
- current_write_byte=0;
- write_position=7;
-
-}
-
-
-/*
-
-mwcloseinit() closes the write bit-stream. It flushes the remaining byte
-with ones, consistent with -1 returned on EOF.
-
-*/
-
-void mwcloseinit()
-{
- while(write_position!=7)
- {
- mput1();
- }
-}
-
-
-/*
-
-zeroflush() flushes out the rest of the byte with 0's.
-returns number og bits written to bitstream (kol)
-
-*/
-
-int zeroflush()
-{
- int bits = 0;
- /* printf("WP: %d\n",write_position);*/
- while (write_position!=7)
- {
- mput0();
- bits++;
- }
- return bits;
-}
-
-/*
-
-mputb() puts a bit to the write stream.
-
-*/
-
-
-void mputb(int b)
-{
- char *bit;
- if (trace) {
- bit = BitPrint(1,b);
- fprintf(tf," wrote %s = %d\n", bit, b);
- free(bit);
- }
- if (b) {mput1();}
- else {mput0();}
-}
-
-/*
-
-mputv() puts a n bits to the stream from byte b.
-
-*/
-
-
-void mputv(int n,int b)
-{
- char *bit;
-
- if (trace) {
- bit = BitPrint(n, b);
- fprintf(tf,"wrote %s = %d\n", bit, b);
- free(bit);
- }
- while(n--)
- {
- if(b&bit_set_mask[n]) {mput1();}
- else {mput0();}
- }
-}
-
-