[xiph-commits] r9153 - in experimental/derf/theora-exp: . examples include include/theora lib

tterribe at motherfish-iii.xiph.org tterribe at motherfish-iii.xiph.org
Mon Apr 18 19:20:00 PDT 2005


Author: tterribe
Date: 2005-04-18 19:19:49 -0700 (Mon, 18 Apr 2005)
New Revision: 9153

Added:
   experimental/derf/theora-exp/Makefile.am
   experimental/derf/theora-exp/acinclude.m4
   experimental/derf/theora-exp/autogen.sh
   experimental/derf/theora-exp/configure.ac
   experimental/derf/theora-exp/examples/Makefile.am
   experimental/derf/theora-exp/include/Makefile.am
   experimental/derf/theora-exp/include/theora/Makefile.am
   experimental/derf/theora-exp/include/theora/codec.h
   experimental/derf/theora-exp/include/theora/theoradec.h
   experimental/derf/theora-exp/include/theora/theoraenc.h
   experimental/derf/theora-exp/lib/Makefile.am
   experimental/derf/theora-exp/theora-exp.pc.in
Removed:
   experimental/derf/theora-exp/include/theora/theora.h
Modified:
   experimental/derf/theora-exp/README
   experimental/derf/theora-exp/examples/dump_video.c
   experimental/derf/theora-exp/examples/encoder_example.c
   experimental/derf/theora-exp/examples/player_example.c
   experimental/derf/theora-exp/lib/decint.h
   experimental/derf/theora-exp/lib/dequant.h
   experimental/derf/theora-exp/lib/encint.h
   experimental/derf/theora-exp/lib/encode.c
   experimental/derf/theora-exp/lib/enquant.h
   experimental/derf/theora-exp/lib/huffdec.c
   experimental/derf/theora-exp/lib/huffman.h
   experimental/derf/theora-exp/lib/info.c
   experimental/derf/theora-exp/lib/internal.h
   experimental/derf/theora-exp/lib/quant.h
Log:
New autofoo build support thanks to acolwell.
This should work on both Unix and Cygwin.

Currently, this does not support ruik's MMX patches (even if -DOC_X86ASM is
 added to CFLAGS, the corresponding source files won't be built), nor the
 API documentation.

It also breaks include/theora/theora.h into three separate files:
 codec.h, theoradec.h, and theoraenc.h
This should allow a theora-exp installation to peacefully coexist with an
 alpha4 installation.


Added: experimental/derf/theora-exp/Makefile.am
===================================================================
--- experimental/derf/theora-exp/Makefile.am	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/Makefile.am	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,7 @@
+
+AUTOMAKE_OPTIONS = foreign 1.6 dist-zip dist-bzip2
+
+SUBDIRS = lib include examples
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = theora-exp.pc
\ No newline at end of file

Modified: experimental/derf/theora-exp/README
===================================================================
--- experimental/derf/theora-exp/README	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/README	2005-04-19 02:19:49 UTC (rev 9153)
@@ -15,15 +15,13 @@
 - Support for additional pixel foramts: 4:4:4 and 4:2:2 (in addition to the
    4:2:0 format supported by VP3).
 - Support for block-level qi values.
+- Striped decoding API (decoding is pipelined and clients receive decoded frame
+   data as soon as it is available).
 Currently missing features:
-- Advanced buffering API: Client-specified buffers and piplined (striped)
-   decode.
+- Advanced buffering API: Client-specified buffers.
   Clients could provide external buffers to decode into when out-of-loop
    post-processing is enabled (if it isn't enabled, a copy has to be done
    anyway).
-  Pipelined decode would combine the reconstruction, copy-back frags, loop
-   filtering and post-processing stages, and expose the decoded frame to
-   clients a super-block row at a time, minimizing cache footprint.
 
 Encoder:
 The encoder is highly experimental.
@@ -32,7 +30,19 @@
 There are still a few outstanding bugs, and the HVS model is very experimental.
 
 Building:
-A simple GNU Makefile and MSVC++ 6 project files are provided.
-Edit both to taste.
-The Windows workspaces are probably currently broken due to the move to
- Subversion and subsequent reorganization.
+On Unix or Cygwin, building through automake is now supported.
+You may wish to set the CFLAGS environment variable before beginning, e.g.:
+CFLAGS=-O3 -fforce-addr -fomit-frame-pointer
+On a fresh checkout, run:
+./autogen.sh
+From a distribution tarball, run:
+./configure
+Then run:
+make
+make install
+
+For Windows, MSVC++ 6 project files are provided.
+
+A simple GNU Makefile is also provided.
+Edit to taste.
+This will likely disappear in a future version.

Added: experimental/derf/theora-exp/acinclude.m4
===================================================================
--- experimental/derf/theora-exp/acinclude.m4	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/acinclude.m4	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,399 @@
+# Configure paths for libogg
+# Jack Moffitt <jack at icecast.org> 10-21-2000
+# Shamelessly stolen from Owen Taylor and Manish Singh
+
+dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
+dnl
+AC_DEFUN([XIPH_PATH_OGG],
+[dnl 
+dnl Get the cflags and libraries
+dnl
+AC_ARG_WITH(ogg,[  --with-ogg=PFX   Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
+AC_ARG_WITH(ogg-libraries,[  --with-ogg-libraries=DIR   Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="")
+AC_ARG_WITH(ogg-includes,[  --with-ogg-includes=DIR   Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="")
+AC_ARG_ENABLE(oggtest, [  --disable-oggtest       Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
+
+  if test "x$ogg_libraries" != "x" ; then
+    OGG_LIBS="-L$ogg_libraries"
+  elif test "x$ogg_prefix" != "x" ; then
+    OGG_LIBS="-L$ogg_prefix/lib"
+  elif test "x$prefix" != "xNONE" ; then
+    OGG_LIBS="-L$prefix/lib"
+  fi
+
+  OGG_LIBS="$OGG_LIBS -logg"
+
+  if test "x$ogg_includes" != "x" ; then
+    OGG_CFLAGS="-I$ogg_includes"
+  elif test "x$ogg_prefix" != "x" ; then
+    OGG_CFLAGS="-I$ogg_prefix/include"
+  elif test "x$prefix" != "xNONE"; then
+    OGG_CFLAGS="-I$prefix/include"
+  fi
+
+  AC_MSG_CHECKING(for Ogg)
+  no_ogg=""
+
+
+  if test "x$enable_oggtest" = "xyes" ; then
+    ac_save_CFLAGS="$CFLAGS"
+    ac_save_LIBS="$LIBS"
+    CFLAGS="$CFLAGS $OGG_CFLAGS"
+    LIBS="$LIBS $OGG_LIBS"
+dnl
+dnl Now check if the installed Ogg is sufficiently new.
+dnl
+      rm -f conf.oggtest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ogg/ogg.h>
+
+int main ()
+{
+  system("touch conf.oggtest");
+  return 0;
+}
+
+],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+  fi
+
+  if test "x$no_ogg" = "x" ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$1], , :, [$1])     
+  else
+     AC_MSG_RESULT(no)
+     if test -f conf.oggtest ; then
+       :
+     else
+       echo "*** Could not run Ogg test program, checking why..."
+       CFLAGS="$CFLAGS $OGG_CFLAGS"
+       LIBS="$LIBS $OGG_LIBS"
+       AC_TRY_LINK([
+#include <stdio.h>
+#include <ogg/ogg.h>
+],     [ return 0; ],
+       [ echo "*** The test program compiled, but did not run. This usually means"
+       echo "*** that the run-time linker is not finding Ogg or finding the wrong"
+       echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your"
+       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+       echo "*** is required on your system"
+       echo "***"
+       echo "*** If you have an old version installed, it is best to remove it, although"
+       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+       [ echo "*** The test program failed to compile or link. See the file config.log for the"
+       echo "*** exact error that occured. This usually means Ogg was incorrectly installed"
+       echo "*** or that you have moved Ogg since it was installed." ])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+     OGG_CFLAGS=""
+     OGG_LIBS=""
+     ifelse([$2], , :, [$2])
+  fi
+  AC_SUBST(OGG_CFLAGS)
+  AC_SUBST(OGG_LIBS)
+  rm -f conf.oggtest
+])
+# Configure paths for libvorbis
+# Jack Moffitt <jack at icecast.org> 10-21-2000
+# Shamelessly stolen from Owen Taylor and Manish Singh
+# thomasvs added check for vorbis_bitrate_addblock which is new in rc3
+
+dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
+dnl
+AC_DEFUN([XIPH_PATH_VORBIS],
+[dnl 
+dnl Get the cflags and libraries
+dnl
+AC_ARG_WITH(vorbis,[  --with-vorbis=PFX   Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
+AC_ARG_WITH(vorbis-libraries,[  --with-vorbis-libraries=DIR   Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
+AC_ARG_WITH(vorbis-includes,[  --with-vorbis-includes=DIR   Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="")
+AC_ARG_ENABLE(vorbistest, [  --disable-vorbistest       Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
+
+  if test "x$vorbis_libraries" != "x" ; then
+    VORBIS_LIBS="-L$vorbis_libraries"
+  elif test "x$vorbis_prefix" != "x" ; then
+    VORBIS_LIBS="-L$vorbis_prefix/lib"
+  elif test "x$prefix" != "xNONE"; then
+    VORBIS_LIBS="-L$prefix/lib"
+  fi
+
+  VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
+  VORBISFILE_LIBS="-lvorbisfile"
+  VORBISENC_LIBS="-lvorbisenc"
+
+  if test "x$vorbis_includes" != "x" ; then
+    VORBIS_CFLAGS="-I$vorbis_includes"
+  elif test "x$vorbis_prefix" != "x" ; then
+    VORBIS_CFLAGS="-I$vorbis_prefix/include"
+  elif test "x$prefix" != "xNONE"; then
+    VORBIS_CFLAGS="-I$prefix/include"
+  fi
+
+
+  AC_MSG_CHECKING(for Vorbis)
+  no_vorbis=""
+
+
+  if test "x$enable_vorbistest" = "xyes" ; then
+    ac_save_CFLAGS="$CFLAGS"
+    ac_save_LIBS="$LIBS"
+    CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
+    LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
+dnl
+dnl Now check if the installed Vorbis is sufficiently new.
+dnl
+      rm -f conf.vorbistest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <vorbis/codec.h>
+#include <vorbis/vorbisenc.h>
+
+int main ()
+{
+    vorbis_block 	vb;
+    vorbis_dsp_state	vd;
+    vorbis_info		vi;
+
+    vorbis_info_init (&vi);
+    vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
+    vorbis_analysis_init (&vd, &vi);
+    vorbis_block_init (&vd, &vb);
+    /* this function was added in 1.0rc3, so this is what we're testing for */
+    vorbis_bitrate_addblock (&vb);
+
+    system("touch conf.vorbistest");
+    return 0;
+}
+
+],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+  fi
+
+  if test "x$no_vorbis" = "x" ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$1], , :, [$1])     
+  else
+     AC_MSG_RESULT(no)
+     if test -f conf.vorbistest ; then
+       :
+     else
+       echo "*** Could not run Vorbis test program, checking why..."
+       CFLAGS="$CFLAGS $VORBIS_CFLAGS"
+       LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
+       AC_TRY_LINK([
+#include <stdio.h>
+#include <vorbis/codec.h>
+],     [ return 0; ],
+       [ echo "*** The test program compiled, but did not run. This usually means"
+       echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
+       echo "*** version of Vorbis. If it is not finding Vorbis, you'll need to set your"
+       echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+       echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+       echo "*** is required on your system"
+       echo "***"
+       echo "*** If you have an old version installed, it is best to remove it, although"
+       echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+       [ echo "*** The test program failed to compile or link. See the file config.log for the"
+       echo "*** exact error that occured. This usually means Vorbis was incorrectly installed"
+       echo "*** or that you have moved Vorbis since it was installed." ])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+     VORBIS_CFLAGS=""
+     VORBIS_LIBS=""
+     VORBISFILE_LIBS=""
+     VORBISENC_LIBS=""
+     ifelse([$2], , :, [$2])
+  fi
+  AC_SUBST(VORBIS_CFLAGS)
+  AC_SUBST(VORBIS_LIBS)
+  AC_SUBST(VORBISFILE_LIBS)
+  AC_SUBST(VORBISENC_LIBS)
+  rm -f conf.vorbistest
+])
+# Configure paths for SDL
+# Sam Lantinga 9/21/99
+# stolen from Manish Singh
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
+dnl
+AC_DEFUN([AM_PATH_SDL],
+[dnl 
+dnl Get the cflags and libraries from the sdl-config script
+dnl
+AC_ARG_WITH(sdl-prefix,[  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)],
+            sdl_prefix="$withval", sdl_prefix="")
+AC_ARG_WITH(sdl-exec-prefix,[  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
+            sdl_exec_prefix="$withval", sdl_exec_prefix="")
+AC_ARG_ENABLE(sdltest, [  --disable-sdltest       Do not try to compile and run a test SDL program],
+		    , enable_sdltest=yes)
+
+  if test x$sdl_exec_prefix != x ; then
+     sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
+     if test x${SDL_CONFIG+set} != xset ; then
+        SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
+     fi
+  fi
+  if test x$sdl_prefix != x ; then
+     sdl_args="$sdl_args --prefix=$sdl_prefix"
+     if test x${SDL_CONFIG+set} != xset ; then
+        SDL_CONFIG=$sdl_prefix/bin/sdl-config
+     fi
+  fi
+
+  AC_REQUIRE([AC_CANONICAL_TARGET])
+  PATH="$prefix/bin:$prefix/usr/bin:$PATH"
+  AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
+  min_sdl_version=ifelse([$1], ,0.11.0,$1)
+  AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
+  no_sdl=""
+  if test "$SDL_CONFIG" = "no" ; then
+    no_sdl=yes
+  else
+    SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
+    SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
+
+    sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_sdltest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $SDL_CFLAGS"
+      LIBS="$LIBS $SDL_LIBS"
+dnl
+dnl Now check if the installed SDL is sufficiently new. (Also sanity
+dnl checks the results of sdl-config to some extent
+dnl
+      rm -f conf.sdltest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "SDL.h"
+
+char*
+my_strdup (char *str)
+{
+  char *new_str;
+  
+  if (str)
+    {
+      new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
+      strcpy (new_str, str);
+    }
+  else
+    new_str = NULL;
+  
+  return new_str;
+}
+
+int main (int argc, char *argv[])
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  /* This hangs on some systems (?)
+  system ("touch conf.sdltest");
+  */
+  { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = my_strdup("$min_sdl_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_sdl_version");
+     exit(1);
+   }
+
+   if (($sdl_major_version > major) ||
+      (($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
+      (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
+    {
+      return 0;
+    }
+  else
+    {
+      printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
+      printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
+      printf("*** best to upgrade to the required version.\n");
+      printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
+      printf("*** to point to the correct copy of sdl-config, and remove the file\n");
+      printf("*** config.cache before re-running configure\n");
+      return 1;
+    }
+}
+
+],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_sdl" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$SDL_CONFIG" = "no" ; then
+       echo "*** The sdl-config script installed by SDL could not be found"
+       echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the SDL_CONFIG environment variable to the"
+       echo "*** full path to sdl-config."
+     else
+       if test -f conf.sdltest ; then
+        :
+       else
+          echo "*** Could not run SDL test program, checking why..."
+          CFLAGS="$CFLAGS $SDL_CFLAGS"
+          LIBS="$LIBS $SDL_LIBS"
+          AC_TRY_LINK([
+#include <stdio.h>
+#include "SDL.h"
+
+int main(int argc, char *argv[])
+{ return 0; }
+#undef  main
+#define main K_and_R_C_main
+],      [ return 0; ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding SDL or finding the wrong"
+          echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+	  echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means SDL was incorrectly installed"
+          echo "*** or that you have moved SDL since it was installed. In the latter case, you"
+          echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     SDL_CFLAGS=""
+     SDL_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(SDL_CFLAGS)
+  AC_SUBST(SDL_LIBS)
+  rm -f conf.sdltest
+])

Added: experimental/derf/theora-exp/autogen.sh
===================================================================
--- experimental/derf/theora-exp/autogen.sh	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/autogen.sh	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,116 @@
+#!/bin/sh
+# Run this to set up the build system: configure, makefiles, etc.
+# (based on the version in enlightenment's cvs)
+
+package="theora-exp"
+
+olddir=`pwd`
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+cd "$srcdir"
+DIE=0
+
+echo "checking for autoconf... "
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+        echo
+        echo "You must have autoconf installed to compile $package."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+        DIE=1
+}
+
+VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
+VERSIONMKINT="sed -e s/[^0-9]//"
+                                                                                
+# do we need automake?
+if test -r Makefile.am; then
+  AM_NEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $VERSIONGREP`
+  if test -z $AM_NEEDED; then
+    echo -n "checking for automake... "
+    AUTOMAKE=automake
+    ACLOCAL=aclocal
+    if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
+      echo "no"
+      AUTOMAKE=
+    else
+      echo "yes"
+    fi
+  else
+    echo -n "checking for automake $AM_NEEDED or later... "
+    for am in automake-$AM_NEEDED automake$AM_NEEDED automake; do
+      ($am --version < /dev/null > /dev/null 2>&1) || continue
+      ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
+      verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
+      if test $ver -ge $verneeded; then
+        AUTOMAKE=$am
+        echo $AUTOMAKE
+        break
+      fi
+    done
+    test -z $AUTOMAKE &&  echo "no"
+    echo -n "checking for aclocal $AM_NEEDED or later... "
+    for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal; do
+      ($ac --version < /dev/null > /dev/null 2>&1) || continue
+      ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
+      verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
+      if test $ver -ge $verneeded; then
+        ACLOCAL=$ac
+        echo $ACLOCAL
+        break
+      fi
+    done
+    test -z $ACLOCAL && echo "no"
+  fi
+  test -z $AUTOMAKE || test -z $ACLOCAL && {
+        echo
+        echo "You must have automake installed to compile $package."
+        echo "Download the appropriate package for your distribution,"
+        echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+        exit 1
+  }
+fi
+
+echo -n "checking for libtool... "
+for LIBTOOLIZE in libtoolize glibtoolize nope; do
+  ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
+done
+if test x$LIBTOOLIZE = xnope; then
+  echo "nope."
+  LIBTOOLIZE=libtoolize
+else
+  echo $LIBTOOLIZE
+fi
+($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
+	echo
+	echo "You must have libtool installed to compile $package."
+	echo "Download the appropriate package for your system,"
+	echo "or get the source from one of the GNU ftp sites"
+	echo "listed in http://www.gnu.org/order/ftp.html"
+	DIE=1
+}
+
+if test "$DIE" -eq 1; then
+        exit 1
+fi
+
+if test -z "$*"; then
+        echo "I am going to run ./configure with no arguments - if you wish "
+        echo "to pass any to it, please specify them on the $0 command line."
+fi
+
+echo "Generating configuration files for $package, please wait...."
+
+echo "  $ACLOCAL $ACLOCAL_FLAGS"
+$ACLOCAL $ACLOCAL_FLAGS || exit 1
+echo "  autoheader"
+autoheader || exit 1
+echo "  $LIBTOOLIZE --automake"
+$LIBTOOLIZE --automake || exit 1
+echo "  $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
+$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
+echo "  autoconf"
+autoconf || exit 1
+
+cd $olddir
+$srcdir/configure "$@" && echo


Property changes on: experimental/derf/theora-exp/autogen.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: experimental/derf/theora-exp/configure.ac
===================================================================
--- experimental/derf/theora-exp/configure.ac	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/configure.ac	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,130 @@
+dnl Process this file with autoconf to produce a configure script
+AC_INIT(theora-exp, [0.1], [theora-dev at xiph.org])
+
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+
+AM_CONFIG_HEADER([config.h])
+AM_INIT_AUTOMAKE
+
+V_LIB_CURRENT=0
+V_LIB_REVISION=1
+V_LIB_AGE=0
+AC_SUBST(V_LIB_CURRENT)
+AC_SUBST(V_LIB_REVISION)
+AC_SUBST(V_LIB_AGE)
+
+dnl --------------------------------------------------  
+dnl Check for programs
+dnl --------------------------------------------------  
+
+dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
+dnl if $CFLAGS is blank
+cflags_save="$CFLAGS"
+AC_PROG_CC
+AC_PROG_CPP
+CFLAGS="$cflags_save"
+
+AM_PROG_LIBTOOL
+
+dnl Check for sdl-config
+AC_CHECK_PROG(HAVE_SDL_CONFIG, sdl-config, true, false)
+AM_CONDITIONAL(HAVE_SDL_CONFIG,$HAVE_SDL_CONFIG)
+
+dnl check for Ogg
+HAVE_OGG=no
+
+dnl first check through pkg-config since it's more flexible
+
+dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
+AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
+if test "x$HAVE_PKG_CONFIG" = "xyes"
+then
+  PKG_CHECK_MODULES(OGG, ogg >= 1.1, HAVE_OGG=yes, HAVE_OGG=no)
+fi
+if test "x$HAVE_OGG" = "xno"
+then
+  dnl fall back to the old school test
+  XIPH_PATH_OGG(, AC_MSG_ERROR([
+    libogg is required to build this package!
+    please see http://www.xiph.org/ for how to
+    obtain a copy.
+  ]))
+  cflags_save=$CFLAGS
+  libs_save=$LIBS
+  CFLAGS="$CFLAGS $OGG_CFLAGS"
+  LIBS="$LIBS $OGG_LIBS"
+  AC_CHECK_FUNC(oggpackB_read, , [
+    AC_MSG_ERROR([newer libogg version (>1.0) required])
+  ])
+  CFLAGS=$cflags_save
+  LIBS=$libs_save
+fi
+
+dnl check for Vorbis
+HAVE_VORBIS=no
+
+dnl first check through pkg-config since it's more flexible
+
+if test "x$HAVE_PKG_CONFIG" = "xyes"
+then
+  PKG_CHECK_MODULES(VORBIS, vorbis >= 1.0.1, HAVE_VORBIS=yes, HAVE_VORBIS=no)
+  dnl also set VORBISENC_LIBS since an examples needs it
+  dnl the old .m4 sets this to a value to use on top of VORBIS_LIBS,
+  dnl so we do the same here.
+  VORBISENC_LIBS="-lvorbisenc"
+  AC_SUBST(VORBISENC_LIBS)
+fi
+if test "x$HAVE_VORBIS" = "xno"
+then
+  dnl fall back to the old school test
+  XIPH_PATH_VORBIS(HAVE_VORBIS=yes, HAVE_VORBIS=no)
+fi
+
+AM_PATH_SDL(,[
+	HAVE_SDL=yes
+	SDL_LIBS=`$SDL_CONFIG --libs`
+],AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***]))
+
+AM_PATH_SDL(,[
+	HAVE_SDL=yes
+	SDL_LIBS=`$SDL_CONFIG --libs`
+],AC_MSG_WARN([*** Unable to find SDL -- Not compiling example players ***]))
+
+
+AC_CHECK_HEADERS([sys/soundcard.h soundcard.h machine/soundcard.h],[
+  HAVE_OSS=yes
+  break
+])
+if test x$HAVE_OSS != xyes; then
+  AC_MSG_WARN([OSS audio support not found -- not compiling player_example])
+fi
+
+if test x$HAVE_SDL = xyes -a x$HAVE_OSS = xyes; then
+  BUILDABLE_EXAMPLES="$BUILDABLE_EXAMPLES player_example"
+fi
+AC_SUBST(BUILDABLE_EXAMPLES)
+
+dnl Checks for libraries.
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+
+dnl Checks for library functions.
+AC_PROG_GCC_TRADITIONAL
+AC_FUNC_MEMCMP
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS(gettimeofday select strstr)
+
+AC_OUTPUT([
+  Makefile lib/Makefile 
+  include/Makefile include/theora/Makefile
+  examples/Makefile
+  theora-exp.pc
+])

Added: experimental/derf/theora-exp/examples/Makefile.am
===================================================================
--- experimental/derf/theora-exp/examples/Makefile.am	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/examples/Makefile.am	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,18 @@
+INCLUDES = -I $(top_srcdir)/include
+
+AM_CFLAGS = $(SDL_CFLAGS) $(OGG_CFLAGS)
+
+LDADD = ../lib/libtheoradec.la ../lib/libtheoraenc.la ../lib/libtheorabase.la -lm $(OGG_LIBS)
+
+bin_PROGRAMS = dump_video encoder_example $(BUILDABLE_EXAMPLES)
+
+EXTRA_PROGRAMS = encoder_example player_example
+
+dump_video_SOURCES = dump_video.c
+dump_video_LDFLAGS = $(OGG_LIBS)
+
+encoder_example_SOURCES = encoder_example.c
+encoder_example_LDADD = $(LDADD) $(VORBIS_LIBS) $(VORBISENC_LIBS)
+
+player_example_SOURCES = player_example.c
+player_example_LDADD = $(LDADD) $(SDL_LIBS) $(VORBIS_LIBS)

Modified: experimental/derf/theora-exp/examples/dump_video.c
===================================================================
--- experimental/derf/theora-exp/examples/dump_video.c	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/examples/dump_video.c	2005-04-19 02:19:49 UTC (rev 9153)
@@ -38,7 +38,7 @@
 #include <math.h>
 #include <signal.h>
 #include "getopt.h"
-#include "theora/theora.h"
+#include "theora/theoradec.h"
 
 
 

Modified: experimental/derf/theora-exp/examples/encoder_example.c
===================================================================
--- experimental/derf/theora-exp/examples/encoder_example.c	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/examples/encoder_example.c	2005-04-19 02:19:49 UTC (rev 9153)
@@ -31,7 +31,7 @@
 #include <getopt.h>
 #include <time.h>
 #include <math.h>
-#include "theora/theora.h"
+#include "theora/theoraenc.h"
 #include "vorbis/codec.h"
 #include "vorbis/vorbisenc.h"
 

Modified: experimental/derf/theora-exp/examples/player_example.c
===================================================================
--- experimental/derf/theora-exp/examples/player_example.c	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/examples/player_example.c	2005-04-19 02:19:49 UTC (rev 9153)
@@ -48,7 +48,7 @@
 #include <fcntl.h>
 #include <math.h>
 #include <signal.h>
-#include "theora/theora.h"
+#include "theora/theoradec.h"
 #include "vorbis/codec.h"
 #include <SDL.h>
 

Added: experimental/derf/theora-exp/include/Makefile.am
===================================================================
--- experimental/derf/theora-exp/include/Makefile.am	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/include/Makefile.am	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,3 @@
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS = theora

Added: experimental/derf/theora-exp/include/theora/Makefile.am
===================================================================
--- experimental/derf/theora-exp/include/theora/Makefile.am	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/include/theora/Makefile.am	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,6 @@
+## Process this file with automake to produce Makefile.in
+
+theoraincludedir = $(includedir)/theora
+
+theorainclude_HEADERS = codec.h theoradec.h theoraenc.h
+

Copied: experimental/derf/theora-exp/include/theora/codec.h (from rev 9152, experimental/derf/theora-exp/include/theora/theora.h)
===================================================================
--- experimental/derf/theora-exp/include/theora/theora.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/include/theora/codec.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,544 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2003                *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function:
+  last mod: $Id: theora.h,v 1.8 2004/03/15 22:17:32 derf Exp $
+
+ ********************************************************************/
+
+/**\mainpage
+ * 
+ * \section intro Introduction
+ *
+ * This is the documentation for the <tt>libtheora</tt> C API.
+ * <tt>libtheora</tt> is the reference implementation for
+ *  <a href="http://www.theora.org/">Theora</a>, a free video codec.
+ * Theora is derived from On2's VP3 codec with additional features and
+ *  integration for Ogg multimedia formats by
+ *  <a href="http://www.xiph.org/">the Xiph.Org Foundation</a>.
+ * Complete documentation of the format itself is available in
+ * <a href="http://www.theora.org/doc/Theora_I_spec.pdf">the Theora
+ *  specification</a>.
+ *
+ * \subsection Organization
+ *
+ * <tt>libtheora</tt> is actually subdivided into three separate libraries:
+ * - <tt>libtheoraenc</tt>, containing routines exclusive to the encoder.
+ *   You must link to this if you use any of the functions listed in
+ *    \ref encfuncs.
+ * - <tt>libtheoradec</tt>, containing routines exclusive to the decoder.
+ *   You must link to this if you use any of the functions listed in
+ *    \ref decfuncs.
+ * - <tt>libtheorabase</tt>, containing routines shared by the encoder and the
+ *    decoder.
+ *   You must link to this if you use any of the functions in this API, not
+ *    not just those listed in \ref basefuncs.*/
+
+/**\file
+ * The shared <tt>libtheora</tt> C API.*/
+
+#if !defined(_O_THEORA_CODEC_H_)
+# define _O_THEORA_CODEC_H_ (1)
+# include <ogg/ogg.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+
+
+/**\name Error codes*/
+/*@{*/
+/**An invalid pointer was provided.*/
+#define OC_FAULT     (-1)
+/**An invalid argument was provided.*/
+#define OC_EINVAL    (-10)
+/**The contents of the header were incomplete, invalid, or unexpected.*/
+#define OC_BADHEADER (-20)
+/**The header does not belong to a Theora stream.*/
+#define OC_NOTFORMAT (-21)
+/**The bitstream version is too high.*/
+#define OC_VERSION   (-22)
+/**The specified function is not implemented.*/
+#define OC_IMPL      (-23)
+/**There were errors in the video data packet.*/
+#define OC_BADPACKET (-24)
+/*@}*/
+
+/**The currently defined color space tags.
+ * See <a href="http://www.theora.org/doc/Theora_I_spec.pdf">the Theora
+ *  specification</a>, Chapter 4, for exact details on the meaning of each of
+ *  these color spaces.*/
+typedef enum{
+  /**The color space was not specified at the encoder.
+      It may be conveyed by an external means.*/
+  OC_CS_UNSPECIFIED,
+  /**A color space designed for NTSC content.*/
+  OC_CS_ITU_REC_470M,
+  /**A color space designed for PAL/SECAM content.*/
+  OC_CS_ITU_REC_470BG,
+  /**The total number of currently defined color spaces.*/
+  OC_CS_NSPACES
+}theora_colorspace;
+
+/**The currently defined pixel format tags.
+ * See <a href="http://www.theora.org/doc/Theora_I_spec.pdf">the Theora
+ *  specification</a>, Section 4.4, for details on the precise sample
+ *  locations.*/
+typedef enum{
+  /**Chroma decimation by 2 in both the X and Y directions (4:2:0).*/
+  OC_PF_420,
+  /**Currently reserved.*/
+  OC_PF_RSVD,
+  /**Chroma decimation by 2 in the X direction (4:2:2).*/
+  OC_PF_422,
+  /**No chroma decimation (4:4:4).*/
+  OC_PF_444,
+  /**The total number of currently defined pixel formats.*/
+  OC_PF_NFORMATS
+}theora_pixel_fmt;
+
+
+
+/**A buffer for a single color plane in an uncompressed image.
+ * This contains the image data in a left-to-right, top-down format.
+ * Each row of pixels is stored contiguously in memory, but successive rows
+ *  need not be.
+ * Use \a ystride to compute the offset of the next row.
+ * The encoder accepts both positive \a ystride values (top-down) and negative
+ *  (bottom-up).
+ * The decoder currently always generates images with positive strides.
+ */
+typedef struct{
+  /**The width of this plane.*/
+  int            width;
+  /**The height of this plane.*/
+  int            height;
+  /**The offset in bytes between successive rows.*/
+  int            ystride;
+  /**A pointer to the first row.*/
+  unsigned char *data;
+}theora_img_plane;
+
+/**A complete image buffer for an uncompressed frame.
+ * The chroma planes may be decimated by a factor of two in either direction,
+ *  as indicated by theora_info#pixel_fmt.
+ * The width and height of the Y' plane must be multiples of 16.
+ * They may need to be cropped for display, using the rectangle specified by
+ *  theora_info#pic_x, theora_info#pic_y, theora_info#pic_width, and
+ *  theora_info#pic_height.
+ * All samples are 8 bits.
+ * \note The term YUV often used to describe a colorspace is ambiguous.
+ * The exact parameters of the RGB to YUV conversion process aside, in many
+ *  contexts the U and V channels actually have opposite meanings.
+ * To avoid this confusion, we are explicit: the name of the color channels is
+ *  Y'CbCr, and they appear in that order, always.
+ * The prime symbol denotes that the Y channel is non-linear.
+ * Cb and Cr stand for "Chroma blue" and "Chroma red" respectively.*/
+typedef theora_img_plane theora_ycbcr_buffer[3];
+
+/**Theora bitstream information.
+ * This contains the basic playback parameters for a stream, and corresponds to 
+ *  the initial 'info' header packet.
+ * To initialize an encoder, the application fills in this structure and
+ *  passes it to theora_encode_alloc().
+ * On decode, it is filled in by theora_decode_headerin(), and then passed to
+ *  theora_decode_alloc().
+ * 
+ * Encoded Theora frames must be a multiple of 16 in size;
+ *  this is what the #frame_width and #frame_height members represent.
+ * To handle arbitrary picture sizes, a crop rectangle is specified in the
+ *  #pic_x, #pic_y, #pic_width and #pic_height members.
+ *
+ * All frame buffers contain pointers to the full, padded frame.
+ * However, the current encoder <em>will not</em> reference pixels outside of
+ *  the cropped picture region, and the application does not need to fill them
+ *  in.
+ * The decoder <em>will</em> allocate storage for a full frame, but the
+ *  application <em>should not</em> rely on the padding containing sensible
+ *  data.
+ *
+ * It is also generally recommended that the offsets and sizes should still be
+ *  multiples of 2 to avoid chroma sampling shifts.
+ * See <a href="http://www.theora.org/doc/Theora_I_spec.pdf">the Theora
+ *  specification</a>, Section 4.4, for more details.
+ *
+ * Frame rate, in frames per second, is stored as a rational fraction, as is
+ *  the pixel aspect ratio.
+ * Note that this refers to the aspect ratio of the individual pixels, not of
+ *  the overall frame itself.
+ * The frame aspect ratio can be computed from pixel aspect ratio using the
+ *  image dimensions.
+ */
+typedef struct{
+  /**\name Theora version
+   * Bitstream version information.*/
+  /*@{*/
+  unsigned char      version_major;
+  unsigned char      version_minor;
+  unsigned char      version_subminor;
+  /*@}*/
+  /**The encoded frame width.
+   * This must be a multiple of 16, and less than 1048576.*/
+  ogg_uint32_t       frame_width;
+  /**The encoded frame height.
+   * This must be a multiple of 16, and less than 1048576.*/
+  ogg_uint32_t       frame_height;
+  /**The displayed picture width.
+   * This must be no larger than width.*/
+  ogg_uint32_t       pic_width;
+  /**The displayed picture height.
+   * This must be no larger than height.*/
+  ogg_uint32_t       pic_height;
+  /**The X offset of the displayed picture.
+   * This must be no larger than #frame_width-#pic_width or 255, whichever is
+   *  smaller.*/
+  ogg_uint32_t       pic_x;
+  /**The Y offset of the displayed picture.
+   * This must be no larger than #frame_height-#pic_height, and
+   *  #frame_height-#pic_height-#pic_y must be no larger than 255.
+   * This offset is specified from the top of the image, as this API uses the
+   *  standard graphics left-handed coordinate system.*/
+  ogg_uint32_t       pic_y;
+  /**\name Frame rate
+   * The frame rate, as a fraction.
+   * If either is 0, the frame rate is undefined.*/
+  /*@{*/
+  ogg_uint32_t       fps_numerator;
+  ogg_uint32_t       fps_denominator;
+  /*@}*/
+  /**\name Aspect ratio
+   * The aspect ratio of the pixels.
+   * If either value is zero, the aspect ratio is undefined.
+   * If not specified by any external means, 1:1 should be assumed.*/
+  /*@{*/
+  ogg_uint32_t       aspect_numerator;
+  ogg_uint32_t       aspect_denominator;
+  /*@}*/
+  /**The color space.*/
+  theora_colorspace  colorspace;
+  /**The pixel format.*/
+  theora_pixel_fmt   pixel_fmt;
+  /**The target bit-rate in bits per second. */
+  /*TODO: Current encoder does not support CBR mode, or anything like it.
+    We also don't really know what nominal rate each quality level
+     corresponds to yet.*/
+  int                target_bitrate;
+  /**The target quality level.*/
+  /*Currently this is set so that a qi of 0 corresponds to distortions of 24
+     times the JND, and each increase by 16 halves that value.
+    This gives us fine discrimination at low qualities, yet effective rate
+     control at high qualities.
+    The qi value 63 is special, however.
+    For this, the highest quality, we use one half of a JND for our threshold.
+    Due to the lower bounds placed on allowable quantizers in Theora, we will
+     not actually be able to achieve quality this good, but this should
+     provide as close to visually lossless quality as Theora is capable of.
+    We could lift the quantizer restrictions without breaking VP3.1
+     compatibility, but this would result in quantized coefficients that are
+     too large for the current bitstream to be able to store.
+    We'd have to redesign the token syntax to store these large coefficients,
+     which would make transcoding complex.*/
+  int                quality;
+  /**The amount to shift to extract the last keyframe number from the granule
+   *  position.
+   * This can be at most 31.
+   * The maximum distance between key frames is
+   *  <tt>1<<#keyframe_granule_shift</tt>.
+   * If you leave this at zero and do not set the keyframe frequency with
+   *  #OC_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE, every frame will be encoded as a
+   *  keyframe.*/
+  int                keyframe_granule_shift;
+}theora_info;
+
+/**The comment information.
+ *
+ * This structure holds the in-stream metadata corresponding to
+ *  the 'comment' header packet.
+ * The comment header is meant to be used much like someone jotting a quick
+ *  note on the label of a video.
+ * It should be a short, to the point text note that can be more than a couple
+ *  words, but not more than a short paragraph.
+ *
+ * The metadata is stored as a series of (tag, value) pairs, in
+ *  length-encoded string vectors.
+ * The first occurrence of the '=' character delimits the tag and value.
+ * A particular tag may occur more than once, and order is significant.
+ * The character set encoding for the strings is always UTF-8, but the tag
+ *  names are limited to ASCII, and treated as case-insensitive.
+ * See <a href="http://www.theora.org/doc/Theora_I_spec.pdf">the Theora
+ *  specification</a>, Section 6.3.3 for details.
+ *
+ * In filling in this structure, theora_decode_header() will null-terminate
+ *  the user_comment strings for safety.
+ * However, the bitstream format itself treats them as 8-bit clean vectors,
+ *  possibly containing null characters, and so the length array should be
+ *  treated as their authoritative length.
+ */
+typedef struct theora_comment{
+  /**The array of comment string vectors.*/
+  char **user_comments;
+  /**An array of the corresponding length of each vector, in bytes.*/
+  int   *comment_lengths;
+  /**The total number of comment strings.*/
+  int    comments;
+  /**The null-terminated vendor string.
+     This identifies the software used to encode the stream.*/
+  char  *vendor;
+}theora_comment;
+
+
+
+/**A single base matrix.*/
+typedef unsigned char theora_quant_base[64];
+
+/**A set of \a qi ranges.*/
+typedef struct{
+  /**The number of ranges in the set.*/
+  int                      nranges;
+  /**The size of each of the #nranges ranges.
+     These must sum to 63.*/
+  const int               *sizes;
+  /**#nranges <tt>+1</tt> base matrices.
+     Matrices \a i and <tt>\a i +1</tt> form the endpoints of range \a i.*/
+  const theora_quant_base *base_matrices;
+}theora_quant_ranges;
+
+/**A complete set of quantization parameters.
+   The quantizer for each coefficient is calculated as:
+   \code
+    Q=MAX(MIN(qmin[qti][ci!=0],scale[ci!=0][qi]*base[qti][pli][qi][ci]/100),
+     1024).
+   \endcode
+
+   \a qti is the quantization type index: 0 for intra, 1 for inter.
+   <tt>\a ci !=0</tt> is 0 for the DC coefficient and 1 for the AC coefficient.
+   \a qi is the quality index, ranging between 0 (low quality) and 63 (high
+    quality).
+   \a pli is the color plane index: 0 for Y', 1 for Cb, 2 for Cr.
+   \a ci is the DCT coefficient index.
+   Coefficient indices correspond to the normal 2D DCT block
+    ordering--row-major with low frequencies first--\em not zig-zag order.
+
+   Minimum quantizers are constant, and are given by:
+   \code
+   qmin[2][2]={{4,2},{8,4}}.
+   \endcode
+
+   Parameters that can be stored in the bitstream are as follows:
+    - The two scale matrices ac_scale and dc_scale.
+      \code 
+      scale={dc_scale,ac_scale}.
+      \endcode
+    - The base matrices for each \a qi, \a qti and \a pli (up to 384 in all).
+      In order to avoid storing a full 384 base matrices, only a sparse set of
+       matrices is stored, and the rest are linearly interpolated.
+      This is done as follows.
+      For each \a qti and \a pli, a series of \a n \a qi ranges is defined.
+      The size of each \a qi range can vary arbitrarily, but they must sum to
+       63.
+      Then, <tt>\a n +1</tt> matrices are specified, one for each endpoint of
+       the ranges.
+      For interpolation purposes, each range's endpoints are the first \a qi
+       value it contains and one past the last \a qi value it contains.
+      Fractional values are rounded to the nearest integer, with ties rounded
+       away from zero.
+
+      Base matrices are stored by reference, so if the same matrices are used
+       multiple times, they will only appear once in the bitstream.
+      The bitstream is also capable of omitting an entire set of ranges and
+       its associated matrices if they are the same as either the previous
+       set (indexed in row-major order) or if the inter set is the same as the
+       inter set.
+
+    - Loop filter limit values.
+      The same limits are used for the loop filter in all color planes, despite
+       potentially differing levels of quantization in each.
+
+   For the current encoder, <tt>scale[ci!=0][qi]</tt> must be no greater
+    than <tt>scale[ci!=0][qi-1]</tt> and <tt>base[qti][pli][qi][ci]</tt> must
+    be no greater than <tt>base[qti][pli][qi-1][ci]</tt>.
+   These two conditions ensure that the actual quantizer for a given \a qti,
+    \a pli, and \a ci does not increase as \a qi increases.
+   This is not required by the decoder.*/
+typedef struct{
+  /**The DC scaling factors.*/
+  ogg_uint16_t        dc_scale[64];
+  /**The AC scaling factors.*/
+  ogg_uint16_t        ac_scale[64];
+  /**The loop filter limit values.*/
+  unsigned char       loop_filter_limits[64];
+  /**The \a qi ranges for each \a ci and \a pli.*/
+  theora_quant_ranges qi_ranges[2][3];
+}theora_quant_info;
+
+
+
+/**The number of Huffman tables used by Theora.*/
+#define OC_NHUFFMAN_TABLES (80)
+/**The number of DCT token values in each table.*/
+#define OC_NDCT_TOKENS     (32)
+
+/**A Huffman code for a Theora DCT token.
+ * Each set of Huffman codes in a given table must form a complete, prefix-free
+ *  code.
+ * There is no requirement that all the tokens in a table have a valid code,
+ *  but the current encoder is not optimized to take advantage of this.
+ * If there is not at least one table with a code for every token in each of
+ *  the five groups of 16 tables, then the encoder may fail to encode certain
+ *  frames.
+ * The complete table in the first group of 16 does not have to be in the same
+ *  place as the complete table in the other groups, but the complete tables in
+ *  the remaining four groups must all be in the same place.*/
+typedef struct{
+  /**The bit pattern for the code, with the LSbit of the pattern aligned in
+   *   the LSbit of the word.*/
+  ogg_uint32_t pattern;
+  /**The number of bits in the code.
+   * This must be between 0 and 32, inclusive.*/
+  int          nbits;
+}theora_huff_code;
+
+
+
+/**\defgroup basefuncs Functions Shared by Encode and Decode*/
+/*@{*/
+/**\name Basic shared functions*/
+/*@{*/
+/**Retrieves a human-readable string to identify the library vendor and
+ *  version.
+ * \return the version string.*/
+extern const char *theora_version_string(void);
+/**Retrieves the library version number.
+ * This is the highest bitstream version that the encoder library will produce,
+ *  or that the decoder library can decode.
+ * This number is composed of a 16-bit major version, 8-bit minor version
+ * and 8 bit sub-version, composed as follows:
+ * \code
+ * (VERSION_MAJOR<<16)+(VERSION_MINOR<<8)+(VERSION_SUBMINOR)
+ * \endcode
+ * \return the version number.*/
+extern ogg_uint32_t theora_version_number(void);
+/**Converts a granule position to an absolute frame number.
+ * The granule position is interpreted in the context of a given
+ *  #theora_enc_ctx or #theora_dec_ctx handle (either will suffice).
+ * \param _encdec  A previously allocated #theora_enc_ctx or #theora_dec_ctx
+ *                  handle.
+ * \param _granpos The granule position to convert.
+ * \returns The absolute frame number corresponding to \a _granpos.
+ * \retval -1 The given granule position was invalid (i.e. negative).*/
+extern ogg_int64_t theora_granule_frame(void *_encdec,ogg_int64_t _granpos);
+/**Converts a granule position to an absolute time in seconds.
+ * The granule position is interpreted in the context of a given
+ *  #theora_enc_ctx or #theora_dec_ctx handle (either will suffice).
+ * \param _encdec  A previously allocated #theora_enc_ctx or #theora_dec_ctx
+ *                  handle.
+ * \param _granpos The granule position to convert.
+ * \return The absolute time in seconds corresponding to \a _granpos.
+ * \retval -1 The given granule position was invalid (i.e. negative).*/
+extern double theora_granule_time(void *_encdec,ogg_int64_t _granpos);
+/**Determines whether a Theora packet is a header or not.
+ * This function does no verification beyond checking the packet type bit, so
+ *  it should not be used for bitstream identification; use
+ *  theora_decode_headerin() for that.
+ * \param _op An <tt>ogg_packet</tt> containing encoded Theora data.
+ * \retval 1 The packet is a header packet
+ * \retval 0 The packet is a video data packet.*/
+extern int theora_packet_isheader(ogg_packet *_op);
+/**Determines whether a theora packet is a key frame or not.
+ * This function does no verification beyond checking the packet type and
+ *  key frame bits, so it should not be used for bitstream identification; use
+ *  theora_decode_headerin() for that.
+ * \param _op An <tt>ogg_packet</tt> containing encoded Theora data.
+ * \retval 1  The packet contains a key frame.
+ * \retval 0  The packet contains a delta frame.
+ * \retval -1 The packet is not a video data packet.*/
+extern int theora_packet_iskeyframe(ogg_packet *_op);
+/*@}*/
+
+
+/**\name Functions for manipulating header data*/
+/*@{*/
+/**Initializes a theora_info structure.
+ * This should be called on a freshly allocated #theora_info structure before
+ *  attempting to use it.
+ * \param _info The #theora_info struct to initialize.*/
+extern void theora_info_init(theora_info *_info);
+/**Clears a #theora_info structure.
+ * This should be called on a #theora_info structure after it is no longer
+ *  needed.
+ * \param _info The #theora_info struct to clear.*/
+extern void theora_info_clear(theora_info *_info);
+
+/**Initialize a #theora_comment structure.
+ * This should be called on a freshly allocated #theora_comment structure
+ *  before attempting to use it.
+ * \param _tc The #theora_comment struct to initialize.*/
+extern void theora_comment_init(theora_comment *_tc);
+/**Add a comment to an initialized #theora_comment structure.
+ * \note Neither theora_comment_add() nor theora_comment_add_tag() support
+ *  comments containing null values, although the bitstream format does
+ *  support them.
+ * To add such comments you will need to manipulate the #theora_comment
+ *  structure directly.
+ * \param _tc      The #theora_comment struct to add the comment to.
+ * \param _comment Must be a null-terminated UTF-8 string containing the
+ *                  comment in "TAG=the value" form.*/
+extern void theora_comment_add(theora_comment *_tc, char *_comment);
+/**Add a comment to an initialized #theora_comment structure.
+ * \note Neither theora_comment_add() nor theora_comment_add_tag() support
+ *  comments containing null values, although the bitstream format does
+ *  support them.
+ * To add such comments you will need to manipulate the #theora_comment
+ *  structure directly.
+ * \param _tc  The #theora_comment struct to add the comment to.
+ * \param _tag A null-terminated string containing the tag  associated with
+ *              the comment.
+ * \param _val The corresponding value as a null-terminated string.*/
+extern void theora_comment_add_tag(theora_comment *_tc,char *_tag,char *_val);
+/**Look up a comment value by its tag.
+ * \param _tc    An initialized #theora_comment structure.
+ * \param _tag   The tag to look up.
+ * \param _count The instance of the tag.
+ *               The same tag can appear  multiple times, each with a distinct
+ *                value, so an index is required to retrieve them all.
+ *               The order these values appear in is significant and should be
+ *                preserved.
+ *               Use theora_comment_query_count() to get the legal range for
+ *                the \a _count parameter.
+ * \return A pointer to the queried tag's value.
+ * \retval NULL If no matching tag is found.*/
+extern char *theora_comment_query(theora_comment *_tc,char *_tag,int _count);
+/**Look up the number of instances of a tag.
+ * Call this first when querying for a specific tag and then iterate over the
+ *  number of instances with separate calls to theora_comment_query() to
+ *   retrieve all instances in order.
+ * \param _tc    An initialized #theora_comment structure.
+ * \param _tag   The tag to look up.
+ * \return The number on instances of this particular tag.*/
+extern int theora_comment_query_count(theora_comment *_tc,char *_tag);
+/**Clears a #theora_comment structure.
+ * This should be called on a #theora_comment structure after it is no longer
+ *  needed.
+ * It will free all memory used by the structure members.
+ * \param _tc The #theora_comment struct to clear.*/
+extern void theora_comment_clear(theora_comment *_tc);
+/*@}*/
+/*@}*/
+
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif

Deleted: experimental/derf/theora-exp/include/theora/theora.h
===================================================================
--- experimental/derf/theora-exp/include/theora/theora.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/include/theora/theora.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -1,938 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
- * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
- * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
- * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
- *                                                                  *
- * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2003                *
- * by the Xiph.Org Foundation http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
-  function:
-  last mod: $Id: theora.h,v 1.8 2004/03/15 22:17:32 derf Exp $
-
- ********************************************************************/
-
-/**\mainpage
- * 
- * \section intro Introduction
- *
- * This is the documentation for the <tt>libtheora</tt> C API.
- * <tt>libtheora</tt> is the reference implementation for
- *  <a href="http://www.theora.org/">Theora</a>, a free video codec.
- * Theora is derived from On2's VP3 codec with additional features and
- *  integration for Ogg multimedia formats by
- *  <a href="http://www.xiph.org/">the Xiph.Org Foundation</a>.
- * Complete documentation of the format itself is available in
- * <a href="http://www.theora.org/doc/Theora_I_spec.pdf">the Theora
- *  specification</a>.
- *
- * \subsection Organization
- *
- * <tt>libtheora</tt> is actually subdivided into three separate libraries:
- * - <tt>libtheoraenc</tt>, containing routines exclusive to the encoder.
- *   You must link to this if you use any of the functions listed in
- *    \ref encfuncs.
- * - <tt>libtheoradec</tt>, containing routines exclusive to the decoder.
- *   You must link to this if you use any of the functions listed in
- *    \ref decfuncs.
- * - <tt>libtheorabase</tt>, containing routines shared by the encoder and the
- *    decoder.
- *   You must link to this if you use any of the functions in this API, not
- *    not just those listed in \ref basefuncs.*/
-
-/**\file
- * The <tt>libtheora</tt> C API.*/
-
-#if !defined(_O_THEORA_H_)
-# define _O_THEORA_H_ (1)
-# include <ogg/ogg.h>
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-
-
-/**\name Error codes*/
-/*@{*/
-/**An invalid pointer was provided.*/
-#define OC_FAULT     (-1)
-/**An invalid argument was provided.*/
-#define OC_EINVAL    (-10)
-/**The contents of the header were incomplete, invalid, or unexpected.*/
-#define OC_BADHEADER (-20)
-/**The header does not belong to a Theora stream.*/
-#define OC_NOTFORMAT (-21)
-/**The bitstream version is too high.*/
-#define OC_VERSION   (-22)
-/**The specified function is not implemented.*/
-#define OC_IMPL      (-23)
-/**There were errors in the video data packet.*/
-#define OC_BADPACKET (-24)
-/*@}*/
-
-/**The currently defined color space tags.
- * See <a href="http://www.theora.org/doc/Theora_I_spec.pdf">the Theora
- *  specification</a>, Chapter 4, for exact details on the meaning of each of
- *  these color spaces.*/
-typedef enum{
-  /**The color space was not specified at the encoder.
-      It may be conveyed by an external means.*/
-  OC_CS_UNSPECIFIED,
-  /**A color space designed for NTSC content.*/
-  OC_CS_ITU_REC_470M,
-  /**A color space designed for PAL/SECAM content.*/
-  OC_CS_ITU_REC_470BG,
-  /**The total number of currently defined color spaces.*/
-  OC_CS_NSPACES
-}theora_colorspace;
-
-/**The currently defined pixel format tags.
- * See <a href="http://www.theora.org/doc/Theora_I_spec.pdf">the Theora
- *  specification</a>, Section 4.4, for details on the precise sample
- *  locations.*/
-typedef enum{
-  /**Chroma decimation by 2 in both the X and Y directions (4:2:0).*/
-  OC_PF_420,
-  /**Currently reserved.*/
-  OC_PF_RSVD,
-  /**Chroma decimation by 2 in the X direction (4:2:2).*/
-  OC_PF_422,
-  /**No chroma decimation (4:4:4).*/
-  OC_PF_444,
-  /**The total number of currently defined pixel formats.*/
-  OC_PF_NFORMATS
-}theora_pixel_fmt;
-
-/**\name theora_encode_ctl() codes
- * \anchor encctlcodes
- * These are the available request codes for theora_encode_ctl().
- * By convention, these are even, to distinguish them from the
- *  \ref decctlcodes "decoder control codes".
- * Keep any experimental or vendor-specific values above \c 0x8000.*/
-/*@{*/
-/**Sets the Huffman tables to use.
- * The tables are copied, not of stored by reference, so they can be freed
- *  after this call.
- * <tt>NULL</tt> may be specified to revert to the default tables.
- *
- * \param[in] _buf <tt>theora_huff_code[#OC_NHUFFMAN_TABLES][#OC_NDCT_TOKENS]</tt>
- * \retval OC_FAULT  \a _enc_ctx is <tt>NULL</tt>.
- * \retval OC_EINVAL Encoding has already begun or one or more of the given
- *                     tables is not full or prefix-free, \a _buf is
- *                     <tt>NULL</tt> and \a _buf_sz is not zero, or \a _buf is
- *                     non-<tt>NULL</tt> and \a _buf_sz is not
- *                     <tt>sizeof(#theora_huff_code)*#OC_NHUFFMAN_TABLES*#OC_NDCT_TOKENS</tt>.
- * \retval OC_IMPL   Not supported by this implementation.*/
-#define OC_ENCCTL_SET_HUFFMAN_CODES (0)
-/**Sets the quantization parameters to use.
- * The parameters are copied, not stored by reference, so they can be freed
- *  after this call.
- * <tt>NULL</tt> may be specified to revert to the default parameters.
- * For the current encoder, <tt>scale[ci!=0][qi]</tt> must be no greater than
- *  <tt>scale[ci!=0][qi-1]</tt> and <tt>base[qti][pli][qi][ci]</tt> must be no
- *  greater than <tt>base[qti][pli][qi-1][ci]</tt>.
- * These two conditions ensure that the actual quantizer for a given \a qti,
- *  \a pli, and \a ci does not increase as \a qi increases.
- *
- * \param[in] _buf #theora_quant_info
- * \retval OC_FAULT  \a _enc_ctx is <tt>NULL</tt>.
- * \retval OC_EINVAL Encoding has already begun, the quantization parameters
- *                    do not meet one of the above stated conditions, \a _buf
- *                    is <tt>NULL</tt> and \a _buf_sz is not zero, or \a _buf
- *                    is non-<tt>NULL</tt> and \a _buf_sz is not
- *                    <tt>sizeof(#theora_quant_info)</tt>.
- * \retval OC_IMPL   Not supported by this implementation.*/
-#define OC_ENCCTL_SET_QUANT_PARAMS (2)
-/**Sets the maximum distance between key frames.
- * This can be changed during an encode, but will be bounded by
- *  <tt>1<<theora_info#keyframe_granule_shift</tt>.
- * If it is set before encoding begins, theora_info#keyframe_granule_shift will
- *  be enlarged appropriately.
- *
- * \param[in]  _buf <tt>ogg_uint32_t</tt>: The maximum distance between key
- *                   frames.
- * \param[out] _buf <tt>ogg_uint32_t</tt>: The actual maximum distance set.
- * \retval OC_FAULT  \a _enc_ctx or \a _buf is <tt>NULL</tt>.
- * \retval OC_EINVAL \a _buf_sz is not <tt>sizeof(ogg_uint32_t)</tt>.
- * \retval OC_IMPL   Not supported by this implementation.*/
-#define OC_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE (4)
-/*@}*/
-
-/**\name theora_decode_ctl() codes
- * \anchor decctlcodes
- * These are the available request codes for theora_decode_ctl().
- * By convention, these are odd, to distinguish them from the
- *  \ref encctlcodes "encoder control codes".
- * Keep any experimental or vendor-specific values above \c 0x8000.*/
-/*@{*/
-/**Gets the maximum post-processing level.
- *
- * \param[out] _buf int: The maximum post-processing level.
- * \retval OC_FAULT  \a _dec_ctx or \a _buf is <tt>NULL</tt>.
- * \retval OC_EINVAL \a _buf_sz is not <tt>sizeof(int)</tt>.
- * \retval OC_IMPL   Not supported by this implementation.*/
-#define OC_DECCTL_GET_PPLEVEL_MAX (1)
-/**Sets the post-processing level.
- * By default, post-processing is disabled.
- *
- * \param[in] _buf int: The new post-processing level.
- *                      0 to disable; larger values use more CPU.
- * \retval OC_FAULT  \a _dec_ctx or \a _buf is <tt>NULL</tt>.
- * \retval OC_EINVAL \a _buf_sz is not <tt>sizeof(int)</tt>, or the
- *                    post-processing level is out of bounds.
- *                   The maximum post-processing level may be
- *                    implementation-specific, and can be obtained via
- *                    #OC_DECCTL_GET_PPLEVEL_MAX.
- * \retval OC_IMPL   Not supported by this implementation.*/
-#define OC_DECCTL_SET_PPLEVEL (3)
-/**Sets the granule position.
- * Call this after a seek, before decoding the first frame, to ensure that the
- *  proper granule position is returned for all subsequent frames.
- *
- * \param[in] _buf <tt>ogg_int64_t</tt>: The granule position of the next
- *                  frame.
- * \retval OC_FAULT  \a _dec_ctx or \a _buf is <tt>NULL</tt>.
- * \retval OC_EINVAL \a _buf_sz is not <tt>sizeof(ogg_int64_t)</tt>, or the
- *                    granule position is negative.*/
-#define OC_DECCTL_SET_GRANPOS (5)
-/**Sets the striped decode callback function.
- * If set, this function will be called as each piece of a frame is fully
- *  decoded in theora_decode_packetin().
- * You can pass in a #theora_stripe_callback with
- *  theora_stripe_callback#stripe_decoded set to <tt>NULL</tt> to disable the
- *  callbacks at any point.
- *
- * \param[in]  _buf #theora_stripe_callback: The callback parameters.
- * \retval OC_FAULT  \a _dec_ctx or \a _buf is <tt>NULL</tt>.
- * \retval OC_EINVAL \a _buf_sz is not
- *                    <tt>sizeof(theora_stripe_callback)</tt>.*/
-#define OC_DECCTL_SET_STRIPE_CB (7)
-/*@}*/
-
-
-
-/**A buffer for a single color plane in an uncompressed image.
- * This contains the image data in a left-to-right, top-down format.
- * Each row of pixels is stored contiguously in memory, but successive rows
- *  need not be.
- * Use \a ystride to compute the offset of the next row.
- * The encoder accepts both positive \a ystride values (top-down) and negative
- *  (bottom-up).
- * The decoder currently always generates images with positive strides.
- */
-typedef struct{
-  /**The width of this plane.*/
-  int            width;
-  /**The height of this plane.*/
-  int            height;
-  /**The offset in bytes between successive rows.*/
-  int            ystride;
-  /**A pointer to the first row.*/
-  unsigned char *data;
-}theora_img_plane;
-
-/**A complete image buffer for an uncompressed frame.
- * The chroma planes may be decimated by a factor of two in either direction,
- *  as indicated by theora_info#pixel_fmt.
- * The width and height of the Y' plane must be multiples of 16.
- * They may need to be cropped for display, using the rectangle specified by
- *  theora_info#pic_x, theora_info#pic_y, theora_info#pic_width, and
- *  theora_info#pic_height.
- * All samples are 8 bits.
- * \note The term YUV often used to describe a colorspace is ambiguous.
- * The exact parameters of the RGB to YUV conversion process aside, in many
- *  contexts the U and V channels actually have opposite meanings.
- * To avoid this confusion, we are explicit: the name of the color channels is
- *  Y'CbCr, and they appear in that order, always.
- * The prime symbol denotes that the Y channel is non-linear.
- * Cb and Cr stand for "Chroma blue" and "Chroma red" respectively.*/
-typedef theora_img_plane theora_ycbcr_buffer[3];
-
-/**A callback function for striped decode.
- * This is a function pointer to an application-provided function that will be
- *  called each time a section of the image is fully decoded in
- *  theora_decode_packetin().
- * This allows the application to process the section immediately, while it is
- *  still in cache.
- * Note that the frame is decoded bottom to top, so \a _yfrag0 will steadily
- *  decrease with each call until it reaches 0, at which point the full frame
- *  is decoded.
- * The number of fragment rows made available in each call depends on the pixel
- *  format and the number of post-processing filters enabled, and may not even
- *  be constant for the entire frame.
- * If a non-<tt>NULL</tt> \a _granpos pointer is passed to
- *  theora_decode_packetin(), the granule position for the frame will be stored
- *  in it before the first callback is made.
- * If an entire frame is dropped (a 0-byte packet), then no callbacks will be
- *  made at all for that frame.
- * \param _ctx       An application-provided context pointer.
- * \param _buf       The image buffer for the decoded frame.
- * \param _yfrag0    The Y coordinate of the first row of 8x8 fragments
- *                    decoded.
- *                   Multiply this by 8 to obtain the pixel row number in the
- *                    luma plane.
- *                   If the chroma planes are subsampled in the Y direction,
- *                    this will always be divisible by two.
- * \param _yfrag_end The Y coordinate of the first row of 8x8 fragments past
- *                    the newly decoded section.
- *                   If the chroma planes are subsampled in the Y direction,
- *                    this will always be divisible by two.
- *                   I.e., this section contains fragment rows
- *                    <tt>\a _yfrag0 ...\a _yfrag_end -1</tt>.*/
-typedef void (*theora_stripe_decoded_func)(void *_ctx,theora_ycbcr_buffer _buf,
- int _yfrag0,int _yfrag_end);
-
-/**The striped decode callback data to pass to #OC_DECCTL_SET_STRIPE_CB.*/
-typedef struct{
-  /**An application-provided context pointer.
-   * This will be passed back verbatim to the application.*/
-  void                       *ctx;
-  /**The callback function pointer.*/
-  theora_stripe_decoded_func  stripe_decoded;
-}theora_stripe_callback;
-
-/**Theora bitstream information.
- * This contains the basic playback parameters for a stream, and corresponds to 
- *  the initial 'info' header packet.
- * To initialize an encoder, the application fills in this structure and
- *  passes it to theora_encode_alloc().
- * On decode, it is filled in by theora_decode_headerin(), and then passed to
- *  theora_decode_alloc().
- * 
- * Encoded Theora frames must be a multiple of 16 in size;
- *  this is what the #frame_width and #frame_height members represent.
- * To handle arbitrary picture sizes, a crop rectangle is specified in the
- *  #pic_x, #pic_y, #pic_width and #pic_height members.
- *
- * All frame buffers contain pointers to the full, padded frame.
- * However, the current encoder <em>will not</em> reference pixels outside of
- *  the cropped picture region, and the application does not need to fill them
- *  in.
- * The decoder <em>will</em> allocate storage for a full frame, but the
- *  application <em>should not</em> rely on the padding containing sensible
- *  data.
- *
- * It is also generally recommended that the offsets and sizes should still be
- *  multiples of 2 to avoid chroma sampling shifts.
- * See <a href="http://www.theora.org/doc/Theora_I_spec.pdf">the Theora
- *  specification</a>, Section 4.4, for more details.
- *
- * Frame rate, in frames per second, is stored as a rational fraction, as is
- *  the pixel aspect ratio.
- * Note that this refers to the aspect ratio of the individual pixels, not of
- *  the overall frame itself.
- * The frame aspect ratio can be computed from pixel aspect ratio using the
- *  image dimensions.
- */
-typedef struct{
-  /**\name Theora version
-   * Bitstream version information.*/
-  /*@{*/
-  unsigned char      version_major;
-  unsigned char      version_minor;
-  unsigned char      version_subminor;
-  /*@}*/
-  /**The encoded frame width.
-   * This must be a multiple of 16, and less than 1048576.*/
-  ogg_uint32_t       frame_width;
-  /**The encoded frame height.
-   * This must be a multiple of 16, and less than 1048576.*/
-  ogg_uint32_t       frame_height;
-  /**The displayed picture width.
-   * This must be no larger than width.*/
-  ogg_uint32_t       pic_width;
-  /**The displayed picture height.
-   * This must be no larger than height.*/
-  ogg_uint32_t       pic_height;
-  /**The X offset of the displayed picture.
-   * This must be no larger than #frame_width-#pic_width or 255, whichever is
-   *  smaller.*/
-  ogg_uint32_t       pic_x;
-  /**The Y offset of the displayed picture.
-   * This must be no larger than #frame_height-#pic_height, and
-   *  #frame_height-#pic_height-#pic_y must be no larger than 255.
-   * This offset is specified from the top of the image, as this API uses the
-   *  standard graphics left-handed coordinate system.*/
-  ogg_uint32_t       pic_y;
-  /**\name Frame rate
-   * The frame rate, as a fraction.
-   * If either is 0, the frame rate is undefined.*/
-  /*@{*/
-  ogg_uint32_t       fps_numerator;
-  ogg_uint32_t       fps_denominator;
-  /*@}*/
-  /**\name Aspect ratio
-   * The aspect ratio of the pixels.
-   * If either value is zero, the aspect ratio is undefined.
-   * If not specified by any external means, 1:1 should be assumed.*/
-  /*@{*/
-  ogg_uint32_t       aspect_numerator;
-  ogg_uint32_t       aspect_denominator;
-  /*@}*/
-  /**The color space.*/
-  theora_colorspace  colorspace;
-  /**The pixel format.*/
-  theora_pixel_fmt   pixel_fmt;
-  /**The target bit-rate in bits per second. */
-  /*TODO: Current encoder does not support CBR mode, or anything like it.
-    We also don't really know what nominal rate each quality level
-     corresponds to yet.*/
-  int                target_bitrate;
-  /**The target quality level.*/
-  /*Currently this is set so that a qi of 0 corresponds to distortions of 24
-     times the JND, and each increase by 16 halves that value.
-    This gives us fine discrimination at low qualities, yet effective rate
-     control at high qualities.
-    The qi value 63 is special, however.
-    For this, the highest quality, we use one half of a JND for our threshold.
-    Due to the lower bounds placed on allowable quantizers in Theora, we will
-     not actually be able to achieve quality this good, but this should
-     provide as close to visually lossless quality as Theora is capable of.
-    We could lift the quantizer restrictions without breaking VP3.1
-     compatibility, but this would result in quantized coefficients that are
-     too large for the current bitstream to be able to store.
-    We'd have to redesign the token syntax to store these large coefficients,
-     which would make transcoding complex.*/
-  int                quality;
-  /**The amount to shift to extract the last keyframe number from the granule
-   *  position.
-   * This can be at most 31.
-   * The maximum distance between key frames is
-   *  <tt>1<<#keyframe_granule_shift</tt>.
-   * If you leave this at zero and do not set the keyframe frequency with
-   *  #OC_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE, every frame will be encoded as a
-   *  keyframe.*/
-  int                keyframe_granule_shift;
-}theora_info;
-
-/**The comment information.
- *
- * This structure holds the in-stream metadata corresponding to
- *  the 'comment' header packet.
- * The comment header is meant to be used much like someone jotting a quick
- *  note on the label of a video.
- * It should be a short, to the point text note that can be more than a couple
- *  words, but not more than a short paragraph.
- *
- * The metadata is stored as a series of (tag, value) pairs, in
- *  length-encoded string vectors.
- * The first occurrence of the '=' character delimits the tag and value.
- * A particular tag may occur more than once, and order is significant.
- * The character set encoding for the strings is always UTF-8, but the tag
- *  names are limited to ASCII, and treated as case-insensitive.
- * See <a href="http://www.theora.org/doc/Theora_I_spec.pdf">the Theora
- *  specification</a>, Section 6.3.3 for details.
- *
- * In filling in this structure, theora_decode_header() will null-terminate
- *  the user_comment strings for safety.
- * However, the bitstream format itself treats them as 8-bit clean vectors,
- *  possibly containing null characters, and so the length array should be
- *  treated as their authoritative length.
- */
-typedef struct theora_comment{
-  /**The array of comment string vectors.*/
-  char **user_comments;
-  /**An array of the corresponding length of each vector, in bytes.*/
-  int   *comment_lengths;
-  /**The total number of comment strings.*/
-  int    comments;
-  /**The null-terminated vendor string.
-     This identifies the software used to encode the stream.*/
-  char  *vendor;
-}theora_comment;
-
-/**A single base matrix.*/
-typedef unsigned char theora_quant_base[64];
-
-/**A set of \a qi ranges.*/
-typedef struct{
-  /**The number of ranges in the set.*/
-  int                      nranges;
-  /**The size of each of the #nranges ranges.
-     These must sum to 63.*/
-  const int               *sizes;
-  /**#nranges <tt>+1</tt> base matrices.
-     Matrices \a i and <tt>\a i +1</tt> form the endpoints of range \a i.*/
-  const theora_quant_base *base_matrices;
-}theora_quant_ranges;
-
-/**A complete set of quantization parameters.
-   The quantizer for each coefficient is calculated as:
-   \code
-    Q=MAX(MIN(qmin[qti][ci!=0],scale[ci!=0][qi]*base[qti][pli][qi][ci]/100),
-     1024).
-   \endcode
-
-   \a qti is the quantization type index: 0 for intra, 1 for inter.
-   <tt>\a ci !=0</tt> is 0 for the DC coefficient and 1 for the AC coefficient.
-   \a qi is the quality index, ranging between 0 (low quality) and 63 (high
-    quality).
-   \a pli is the color plane index: 0 for Y', 1 for Cb, 2 for Cr.
-   \a ci is the DCT coefficient index.
-   Coefficient indices correspond to the normal 2D DCT block
-    ordering--row-major with low frequencies first--\em not zig-zag order.
-
-   Minimum quantizers are constant, and are given by:
-   \code
-   qmin[2][2]={{4,2},{8,4}}.
-   \endcode
-
-   Parameters that can be stored in the bitstream are as follows:
-    - The two scale matrices ac_scale and dc_scale.
-      \code 
-      scale={dc_scale,ac_scale}.
-      \endcode
-    - The base matrices for each \a qi, \a qti and \a pli (up to 384 in all).
-      In order to avoid storing a full 384 base matrices, only a sparse set of
-       matrices is stored, and the rest are linearly interpolated.
-      This is done as follows.
-      For each \a qti and \a pli, a series of \a n \a qi ranges is defined.
-      The size of each \a qi range can vary arbitrarily, but they must sum to
-       63.
-      Then, <tt>\a n +1</tt> matrices are specified, one for each endpoint of
-       the ranges.
-      For interpolation purposes, each range's endpoints are the first \a qi
-       value it contains and one past the last \a qi value it contains.
-      Fractional values are rounded to the nearest integer, with ties rounded
-       away from zero.
-
-      Base matrices are stored by reference, so if the same matrices are used
-       multiple times, they will only appear once in the bitstream.
-      The bitstream is also capable of omitting an entire set of ranges and
-       its associated matrices if they are the same as either the previous
-       set (indexed in row-major order) or if the inter set is the same as the
-       inter set.
-
-    - Loop filter limit values.
-      The same limits are used for the loop filter in all color planes, despite
-       potentially differing levels of quantization in each.
-
-   For the current encoder, <tt>scale[ci!=0][qi]</tt> must be no greater
-    than <tt>scale[ci!=0][qi-1]</tt> and <tt>base[qti][pli][qi][ci]</tt> must
-    be no greater than <tt>base[qti][pli][qi-1][ci]</tt>.
-   These two conditions ensure that the actual quantizer for a given \a qti,
-    \a pli, and \a ci does not increase as \a qi increases.
-   This is not required by the decoder.*/
-typedef struct{
-  /**The DC scaling factors.*/
-  ogg_uint16_t        dc_scale[64];
-  /**The AC scaling factors.*/
-  ogg_uint16_t        ac_scale[64];
-  /**The loop filter limit values.*/
-  unsigned char       loop_filter_limits[64];
-  /**The \a qi ranges for each \a ci and \a pli.*/
-  theora_quant_ranges qi_ranges[2][3];
-}theora_quant_info;
-
-/**The quantization parameters used by VP3.*/
-extern const theora_quant_info OC_VP31_QUANT_INFO;
-
-/**The number of Huffman tables used by Theora.*/
-#define OC_NHUFFMAN_TABLES (80)
-/**The number of DCT token values in each table.*/
-#define OC_NDCT_TOKENS     (32)
-
-/**A Huffman code for a Theora DCT token.
- * Each set of Huffman codes in a given table must form a complete, prefix-free
- *  code.
- * There is no requirement that all the tokens in a table have a valid code,
- *  but the current encoder is not optimized to take advantage of this.
- * If there is not at least one table with a code for every token in each of
- *  the five groups of 16 tables, then the encoder may fail to encode certain
- *  frames.
- * The complete table in the first group of 16 does not have to be in the same
- *  place as the complete table in the other groups, but the complete tables in
- *  the remaining four groups must all be in the same place.*/
-typedef struct{
-  /**The bit pattern for the code, with the LSbit of the pattern aligned in
-   *   the LSbit of the word.*/
-  ogg_uint32_t pattern;
-  /**The number of bits in the code.
-   * This must be between 0 and 32, inclusive.*/
-  int          nbits;
-}theora_huff_code;
-
-/**The Huffman tables used by VP3.*/
-extern const theora_huff_code
- OC_VP31_HUFF_CODES[OC_NHUFFMAN_TABLES][OC_NDCT_TOKENS];
-
-
-
-/**\name Encoder and decoder state
-   The following data structures are opaque, and their contents are not
-    publicly defined by this API.
-   Referring to their internals directly is unsupported, and may break without
-    warning.*/
-/*@{*/
-/**The encoder context.*/
-typedef struct theora_enc_ctx    theora_enc_ctx;
-/**The decoder context.*/
-typedef struct theora_dec_ctx    theora_dec_ctx;
-/**Setup information.
-   This contains auxiliary information (Huffman tables and quantization
-    parameters) decoded from the setup header by theora_decode_headerin() to be
-    passed to theora_decode_alloc().
-   It can be re-used to initialize any number of decoders, and can be freed
-    via theora_setup_free() at any time.*/
-typedef struct theora_setup_info theora_setup_info;
-/*@}*/
-
-
-
-/**\defgroup encfuncs Functions for Encoding*/
-/*@{*/
-/**\name Functions for encoding
- * You must link to <tt>libtheorabase</tt> and <tt>libtheoraenc</tt> if you use
- *  any of the functions in this section.
- *
- * The functions are listed in the order they are used in a typical encode.
- * The basic steps are:
- * - Fill in a #theora_info structure with details on the format of the video
- *    you wish to encode.
- * - Allocate a #theora_enc_ctx handle with theora_encode_alloc().
- * - Perform any additional encoder configuration required with
- *    theora_encode_ctl().
- * - Repeatedly call theora_encode_flushheader() to retrieve all the header
- *    packets.
- * - For each uncompressed frame:
- *   - Submit the uncompressed frame via theora_encode_ycbcr_in()
- *   - Repeatedly call theora_encode_packetout() to retrieve any video data
- *      packets that are ready.
- * - Call theora_encode_free() to release all encoder memory.*/
-/*@{*/
-/**Allocates an encoder instance.
- * \param _info A #theora_info struct filled with the desired encoding
- *               parameters.
- * \return The initialized #theora_enc_ctx handle.
- * \retval NULL If the encoding parameters were invalid.*/
-extern theora_enc_ctx *theora_encode_alloc(const theora_info *_info);
-/**Encoder control function.
- * This is used to provide advanced control the encoding process.
- * \param _enc    A #theora_enc_ctx handle.
- * \param _req    The control code to process.
- *                See \ref encctlcodes "the list of available control codes"
- *                 for details.
- * \param _buf    The parameters for this control code.
- * \param _buf_sz The size of the parameter buffer.*/
-extern int theora_encode_ctl(theora_enc_ctx *_enc,int _req,void *_buf,
- size_t _buf_sz);
-/**Outputs the next header packet.
- * This should be called repeatedly after encoder initialization until it
- *  returns 0 to get all of the header packets, in order, before encoding
- *  actual video data.
- * \param _enc      A #theora_enc_ctx handle.
- * \param _comments The metadata to place in the comment header, when it is
- *                   encoded.
- * \param _op       An <tt>ogg_packet</tt> structure to fill.
- *                  All of the elements of this structure will be set,
- *                   including a pointer to the header data.
- *                  The memory for the header data is owned by
- *                   <tt>libtheora</tt>.
- * \return A positive value indicates that a header packet was successfully
- *          produced.
- * \retval 0        No packet was produced, and no more header packets remain.
- * \retval OC_FAULT \a _enc, \a _comments, or \a _op was <tt>NULL</tt>.*/
-extern int theora_encode_flushheader(theora_enc_ctx *_enc,
- theora_comment *_comments,ogg_packet *_op);
-/**Submits an uncompressed frame to the encoder.
- * \param _enc   A #theora_enc_ctx handle.
- * \param _ycbcr A buffer of Y'CbCr data to encode.
- * \retval 0         Success.
- * \retval OC_FAULT  \a _enc or \a _ycbcr is <tt>NULL</tt>.
- * \retval OC_EINVAL The buffer size does not match the frame size the encoder
- *                    was initialized with, or encoding has already completed.
- */
-extern int theora_encode_ycbcr_in(theora_enc_ctx *_enc,
- theora_ycbcr_buffer _ycbcr);
-/**Retrieves encoded video data packets.
- * This should be called repeatedly after each frame is submitted to flush any
- *  encoded packets, until it returns 0.
- * The encoder will not buffer these packets as subsequent frames are
- *  compressed, so a failure to do so function will result in lost video data.
- * \note Currently the encoder operates in a one-frame-in, one-packet-out
- *        manner.
- *       However, this may be changed in the future.
- * \param _enc  A #theora_enc_ctx handle.
- * \param _last Set this flag to a non-zero value if no more uncompressed
- *               frames will be submitted.
- *              This ensures that a proper EOS flag is set on the last packet.
- * \param _op   An <tt>ogg_packet</tt> structure to fill.
- *              All of the elements of this structure will be set, including a
- *               pointer to the video data.
- *              The memory for the video data is owned by <tt>libtheora</tt>.
- * \return A positive value indicates that a video data packet was successfully
- *          produced.
- * \retval 0        No packet was produced, and no more encoded video data
- *                   remains.
- * \retval OC_FAULT \a _enc or \a _op was <tt>NULL</tt>.*/
-extern int theora_encode_packetout(theora_enc_ctx *_enc,int _last,
- ogg_packet *_op);
-/**Frees an allocated encoder instance.
- * \param _enc A #theora_enc_ctx handle.*/
-extern void theora_encode_free(theora_enc_ctx *_enc);
-/*@}*/
-/*@}*/
-
-
-/**\defgroup decfuncs Functions for Decoding*/
-/*@{*/
-/**\name Functions for decoding
- * You must link to <tt>libtheorabase</tt> and <tt>libtheoradec</tt> if you use
- *  any of the functions in this section.
- *
- * The functions are listed in the order they are used in a typical decode.
- * The basic steps are:
- * - Parse the header packets by repeatedly calling theora_decode_headerin().
- * - Allocate a #theora_dec_ctx handle with theora_decode_alloc().
- * - Call theora_setup_free() to free any memory used for codec setup
- *    information.
- * - Perform any additional decoder configuration with theora_decode_ctl().
- * - For each video data packet:
- *   - Submit the packet to the decoder via theora_decode_packetin().
- *   - Retrieve the uncompressed video data via theora_decode_ycbcr_out().
- * - Call theora_decode_free() to release all decoder memory.*/
-/*@{*/
-/**Decodes the header packets of a Theora stream.
- * This should be called on the initial packets of the stream, in succession,
- *  until it returns <tt>0</tt>, indicating that all headers have been
- *  processed, or an error is encountered.
- * At least three header packets are required, and additional optional header
- *  packets may follow.
- * This can be used on the first packet of any logical stream to determine if
- *  that stream is a Theora stream.
- * \param _info  A #theora_info structure to fill in.
- *               This must have been previously initialized with
- *                theora_info_init().
- *               The application may immediately begin using the contents of
- *                this structure after the first header is decoded, though it
- *                must continue to be passed in on all subsequent calls.
- * \param _tc    A #theora_comment structure to fill in.
- *               The application may immediately begin using the contents of
- *                this structure after the second header is decoded, though it
- *                must continue to be passed in on all subsequent calls.
- * \param _setup Returns a pointer to additional, private setup information
- *                needed by the decoder.
- *               The contents of this pointer must be initialized to
- *                <tt>NULL</tt> on the first call, and the returned value must
- *                continue to be passed in on all subsequent calls.
- * \param _op    An <tt>ogg_packet</tt> structure which contains one of the
- *                initial packets of an Ogg logical stream.
- * \return A positive value indicates that a Theora header was successfully
- *          processed.
- * \retval 0            The first video data packet was encountered after all
- *                       required header packets were parsed.
- *                      The packet just passed in on this call should be saved
- *                       and fed to theora_decode_packetin() to begin decoding
- *                       video data.
- * \retval OC_FAULT     One of \a _info, \a _tc, or \a _setup was
- *                       <tt>NULL</tt>.
- * \retval OC_BADHEADER \a _op was <tt>NULL</tt>, the packet was not the next
- *                       header packet in the expected sequence, or the format
- *                       of the header data was invalid.
- * \retval OC_VERSION   The packet data was a Theora info header, but for a
- *                       bitstream version not decodable with this version of
- *                       <tt>libtheora</tt>.
- * \retval OC_NOTFORMAT The packet was not a Theora header.
- */
-extern int theora_decode_headerin(theora_info *_info,theora_comment *_tc,
- theora_setup_info **_setup,ogg_packet *_op);
-/**Allocates a decoder instance.
- * \param _info  A #theora_info struct filled via theora_decode_headerin().
- * \param _setup A #theora_setup_info handle returned via
- *                theora_decode_headerin().
- * \return The initialized #theora_dec_ctx handle.
- * \retval NULL If the decoding parameters were invalid.*/
-extern theora_dec_ctx *theora_decode_alloc(const theora_info *_info,
- const theora_setup_info *_setup);
-/**Releases all storage used for the decoder setup information.
- * This should be called after you no longer want to create any decoders for
- *  a stream whose headers you have parsed with theora_decode_headerin().
- * \param _setup The setup information to free.
- *               This can safely be <tt>NULL</tt>.*/
-extern void theora_setup_free(theora_setup_info *_setup);
-/**Encoder control function.
- * This is used to provide advanced control the decoding process.
- * \param _dec    A #theora_dec_ctx handle.
- * \param _req    The control code to process.
- *                See \ref decctlcodes "the list of available control codes"
- *                 for details.
- * \param _buf    The parameters for this control code.
- * \param _buf_sz The size of the parameter buffer.*/
-extern int theora_decode_ctl(theora_dec_ctx *_dec,int _req,void *_buf,
- size_t _buf_sz);
-/**Submits a packet containing encoded video data to the decoder.
- * \param _dec     A #theora_dec_ctx handle.
- * \param _op      An <tt>ogg_packet</tt> containing encoded video data.
- * \param _granpos Returns the granule position of the decoded packet.
- *                 If non-<tt>NULL</tt>, the granule position for this specific
- *                  packet is stored in this location.
- *                 This is computed incrementally from previously decoded
- *                  packets.
- *                 After a seek, the correct granule position must be set via
- *                  #OC_DECCTL_SET_GRANPOS for this to work properly.
- * \retval 0            Success.
- * \retval OC_FAULT     \a _dec or _op was <tt>NULL</tt>.
- * \retval OC_BADPACKET \a _op does not contain encoded video data.
- * \retval OC_IMPL      The video data uses bitstream features which this
- *                       library does not support.*/
-extern int theora_decode_packetin(theora_dec_ctx *_dec,const ogg_packet *_op,
- ogg_int64_t *_granpos);
-/**Outputs the next available frame of decoded Y'CbCr data.
- * If a striped decode callback has been set with #OC_DECCTL_SET_STRIPE_CB,
- *  then the application does not need to call this function.
- * \param _dec   A #theora_dec_ctx handle.
- * \param _ycbcr A video buffer structure to fill in.
- *               <tt>libtheora</tt> will fill in all the members of this
- *                structure, including the pointers to the uncompressed video
- *                data.
- *               The memory for this video data is owned by
- *                <tt>libtheora</tt>.
- *               It may be freed or overwritten without notification when
- *                subsequent frames are decoded.
- * \retval 0 Success
- */
-extern int theora_decode_ycbcr_out(theora_dec_ctx *_dec,
- theora_ycbcr_buffer _ycbcr);
-/**Frees an allocated decoder instance.
- * \param _dec A #theora_dec_ctx handle.*/
-extern void theora_decode_free(theora_dec_ctx *_dec);
-/*@}*/
-/*@}*/
-
-
-/**\defgroup basefuncs Functions Shared by Encode and Decode*/
-/*@{*/
-/**\name Basic shared functions*/
-/*@{*/
-/**Retrieves a human-readable string to identify the library vendor and
- *  version.
- * \return the version string.*/
-extern const char *theora_version_string(void);
-/**Retrieves the library version number.
- * This is the highest bitstream version that the encoder library will produce,
- *  or that the decoder library can decode.
- * This number is composed of a 16-bit major version, 8-bit minor version
- * and 8 bit sub-version, composed as follows:
- * \code
- * (VERSION_MAJOR<<16)+(VERSION_MINOR<<8)+(VERSION_SUBMINOR)
- * \endcode
- * \return the version number.*/
-extern ogg_uint32_t theora_version_number(void);
-/**Converts a granule position to an absolute frame number.
- * The granule position is interpreted in the context of a given
- *  #theora_enc_ctx or #theora_dec_ctx handle (either will suffice).
- * \param _encdec  A previously allocated #theora_enc_ctx or #theora_dec_ctx
- *                  handle.
- * \param _granpos The granule position to convert.
- * \returns The absolute frame number corresponding to \a _granpos.
- * \retval -1 The given granule position was invalid (i.e. negative).*/
-extern ogg_int64_t theora_granule_frame(void *_encdec,ogg_int64_t _granpos);
-/**Converts a granule position to an absolute time in seconds.
- * The granule position is interpreted in the context of a given
- *  #theora_enc_ctx or #theora_dec_ctx handle (either will suffice).
- * \param _encdec  A previously allocated #theora_enc_ctx or #theora_dec_ctx
- *                  handle.
- * \param _granpos The granule position to convert.
- * \return The absolute time in seconds corresponding to \a _granpos.
- * \retval -1 The given granule position was invalid (i.e. negative).*/
-extern double theora_granule_time(void *_encdec,ogg_int64_t _granpos);
-/**Determines whether a Theora packet is a header or not.
- * This function does no verification beyond checking the packet type bit, so
- *  it should not be used for bitstream identification; use
- *  theora_decode_headerin() for that.
- * \param _op An <tt>ogg_packet</tt> containing encoded Theora data.
- * \retval 1 The packet is a header packet
- * \retval 0 The packet is a video data packet.*/
-extern int theora_packet_isheader(ogg_packet *_op);
-/**Determines whether a theora packet is a key frame or not.
- * This function does no verification beyond checking the packet type and
- *  key frame bits, so it should not be used for bitstream identification; use
- *  theora_decode_headerin() for that.
- * \param _op An <tt>ogg_packet</tt> containing encoded Theora data.
- * \retval 1  The packet contains a key frame.
- * \retval 0  The packet contains a delta frame.
- * \retval -1 The packet is not a video data packet.*/
-extern int theora_packet_iskeyframe(ogg_packet *_op);
-/*@}*/
-
-
-/**\name Functions for manipulating header data*/
-/*@{*/
-/**Initializes a theora_info structure.
- * This should be called on a freshly allocated #theora_info structure before
- *  attempting to use it.
- * \param _info The #theora_info struct to initialize.*/
-extern void theora_info_init(theora_info *_info);
-/**Clears a #theora_info structure.
- * This should be called on a #theora_info structure after it is no longer
- *  needed.
- * \param _info The #theora_info struct to clear.*/
-extern void theora_info_clear(theora_info *_info);
-
-/**Initialize a #theora_comment structure.
- * This should be called on a freshly allocated #theora_comment structure
- *  before attempting to use it.
- * \param _tc The #theora_comment struct to initialize.*/
-extern void theora_comment_init(theora_comment *_tc);
-/**Add a comment to an initialized #theora_comment structure.
- * \note Neither theora_comment_add() nor theora_comment_add_tag() support
- *  comments containing null values, although the bitstream format does
- *  support them.
- * To add such comments you will need to manipulate the #theora_comment
- *  structure directly.
- * \param _tc      The #theora_comment struct to add the comment to.
- * \param _comment Must be a null-terminated UTF-8 string containing the
- *                  comment in "TAG=the value" form.*/
-extern void theora_comment_add(theora_comment *_tc, char *_comment);
-/**Add a comment to an initialized #theora_comment structure.
- * \note Neither theora_comment_add() nor theora_comment_add_tag() support
- *  comments containing null values, although the bitstream format does
- *  support them.
- * To add such comments you will need to manipulate the #theora_comment
- *  structure directly.
- * \param _tc  The #theora_comment struct to add the comment to.
- * \param _tag A null-terminated string containing the tag  associated with
- *              the comment.
- * \param _val The corresponding value as a null-terminated string.*/
-extern void theora_comment_add_tag(theora_comment *_tc,char *_tag,char *_val);
-/**Look up a comment value by its tag.
- * \param _tc    An initialized #theora_comment structure.
- * \param _tag   The tag to look up.
- * \param _count The instance of the tag.
- *               The same tag can appear  multiple times, each with a distinct
- *                value, so an index is required to retrieve them all.
- *               The order these values appear in is significant and should be
- *                preserved.
- *               Use theora_comment_query_count() to get the legal range for
- *                the \a _count parameter.
- * \return A pointer to the queried tag's value.
- * \retval NULL If no matching tag is found.*/
-extern char *theora_comment_query(theora_comment *_tc,char *_tag,int _count);
-/**Look up the number of instances of a tag.
- * Call this first when querying for a specific tag and then iterate over the
- *  number of instances with separate calls to theora_comment_query() to
- *   retrieve all instances in order.
- * \param _tc    An initialized #theora_comment structure.
- * \param _tag   The tag to look up.
- * \return The number on instances of this particular tag.*/
-extern int theora_comment_query_count(theora_comment *_tc,char *_tag);
-/**Clears a #theora_comment structure.
- * This should be called on a #theora_comment structure after it is no longer
- *  needed.
- * It will free all memory used by the structure members.
- * \param _tc The #theora_comment struct to clear.*/
-extern void theora_comment_clear(theora_comment *_tc);
-/*@}*/
-/*@}*/
-
-
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif

Copied: experimental/derf/theora-exp/include/theora/theoradec.h (from rev 9152, experimental/derf/theora-exp/include/theora/theora.h)
===================================================================
--- experimental/derf/theora-exp/include/theora/theora.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/include/theora/theoradec.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,280 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2003                *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function:
+  last mod: $Id: theora.h,v 1.8 2004/03/15 22:17:32 derf Exp $
+
+ ********************************************************************/
+
+/**\file
+ * The <tt>libtheora</tt> C decoding API.*/
+
+#if !defined(_O_THEORA_THEORADEC_H_)
+# define _O_THEORA_THEORADEC_H_ (1)
+# include <ogg/ogg.h>
+# include "codec.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+
+
+/**\name theora_decode_ctl() codes
+ * \anchor decctlcodes
+ * These are the available request codes for theora_decode_ctl().
+ * By convention, these are odd, to distinguish them from the
+ *  \ref encctlcodes "encoder control codes".
+ * Keep any experimental or vendor-specific values above \c 0x8000.*/
+/*@{*/
+/**Gets the maximum post-processing level.
+ *
+ * \param[out] _buf int: The maximum post-processing level.
+ * \retval OC_FAULT  \a _dec_ctx or \a _buf is <tt>NULL</tt>.
+ * \retval OC_EINVAL \a _buf_sz is not <tt>sizeof(int)</tt>.
+ * \retval OC_IMPL   Not supported by this implementation.*/
+#define OC_DECCTL_GET_PPLEVEL_MAX (1)
+/**Sets the post-processing level.
+ * By default, post-processing is disabled.
+ *
+ * \param[in] _buf int: The new post-processing level.
+ *                      0 to disable; larger values use more CPU.
+ * \retval OC_FAULT  \a _dec_ctx or \a _buf is <tt>NULL</tt>.
+ * \retval OC_EINVAL \a _buf_sz is not <tt>sizeof(int)</tt>, or the
+ *                    post-processing level is out of bounds.
+ *                   The maximum post-processing level may be
+ *                    implementation-specific, and can be obtained via
+ *                    #OC_DECCTL_GET_PPLEVEL_MAX.
+ * \retval OC_IMPL   Not supported by this implementation.*/
+#define OC_DECCTL_SET_PPLEVEL (3)
+/**Sets the granule position.
+ * Call this after a seek, before decoding the first frame, to ensure that the
+ *  proper granule position is returned for all subsequent frames.
+ *
+ * \param[in] _buf <tt>ogg_int64_t</tt>: The granule position of the next
+ *                  frame.
+ * \retval OC_FAULT  \a _dec_ctx or \a _buf is <tt>NULL</tt>.
+ * \retval OC_EINVAL \a _buf_sz is not <tt>sizeof(ogg_int64_t)</tt>, or the
+ *                    granule position is negative.*/
+#define OC_DECCTL_SET_GRANPOS (5)
+/**Sets the striped decode callback function.
+ * If set, this function will be called as each piece of a frame is fully
+ *  decoded in theora_decode_packetin().
+ * You can pass in a #theora_stripe_callback with
+ *  theora_stripe_callback#stripe_decoded set to <tt>NULL</tt> to disable the
+ *  callbacks at any point.
+ *
+ * \param[in]  _buf #theora_stripe_callback: The callback parameters.
+ * \retval OC_FAULT  \a _dec_ctx or \a _buf is <tt>NULL</tt>.
+ * \retval OC_EINVAL \a _buf_sz is not
+ *                    <tt>sizeof(theora_stripe_callback)</tt>.*/
+#define OC_DECCTL_SET_STRIPE_CB (7)
+/*@}*/
+
+
+
+/**A callback function for striped decode.
+ * This is a function pointer to an application-provided function that will be
+ *  called each time a section of the image is fully decoded in
+ *  theora_decode_packetin().
+ * This allows the application to process the section immediately, while it is
+ *  still in cache.
+ * Note that the frame is decoded bottom to top, so \a _yfrag0 will steadily
+ *  decrease with each call until it reaches 0, at which point the full frame
+ *  is decoded.
+ * The number of fragment rows made available in each call depends on the pixel
+ *  format and the number of post-processing filters enabled, and may not even
+ *  be constant for the entire frame.
+ * If a non-<tt>NULL</tt> \a _granpos pointer is passed to
+ *  theora_decode_packetin(), the granule position for the frame will be stored
+ *  in it before the first callback is made.
+ * If an entire frame is dropped (a 0-byte packet), then no callbacks will be
+ *  made at all for that frame.
+ * \param _ctx       An application-provided context pointer.
+ * \param _buf       The image buffer for the decoded frame.
+ * \param _yfrag0    The Y coordinate of the first row of 8x8 fragments
+ *                    decoded.
+ *                   Multiply this by 8 to obtain the pixel row number in the
+ *                    luma plane.
+ *                   If the chroma planes are subsampled in the Y direction,
+ *                    this will always be divisible by two.
+ * \param _yfrag_end The Y coordinate of the first row of 8x8 fragments past
+ *                    the newly decoded section.
+ *                   If the chroma planes are subsampled in the Y direction,
+ *                    this will always be divisible by two.
+ *                   I.e., this section contains fragment rows
+ *                    <tt>\a _yfrag0 ...\a _yfrag_end -1</tt>.*/
+typedef void (*theora_stripe_decoded_func)(void *_ctx,theora_ycbcr_buffer _buf,
+ int _yfrag0,int _yfrag_end);
+
+/**The striped decode callback data to pass to #OC_DECCTL_SET_STRIPE_CB.*/
+typedef struct{
+  /**An application-provided context pointer.
+   * This will be passed back verbatim to the application.*/
+  void                       *ctx;
+  /**The callback function pointer.*/
+  theora_stripe_decoded_func  stripe_decoded;
+}theora_stripe_callback;
+
+
+
+/**\name Decoder state
+   The following data structures are opaque, and their contents are not
+    publicly defined by this API.
+   Referring to their internals directly is unsupported, and may break without
+    warning.*/
+/*@{*/
+/**The decoder context.*/
+typedef struct theora_dec_ctx    theora_dec_ctx;
+/**Setup information.
+   This contains auxiliary information (Huffman tables and quantization
+    parameters) decoded from the setup header by theora_decode_headerin() to be
+    passed to theora_decode_alloc().
+   It can be re-used to initialize any number of decoders, and can be freed
+    via theora_setup_free() at any time.*/
+typedef struct theora_setup_info theora_setup_info;
+/*@}*/
+
+
+
+/**\defgroup decfuncs Functions for Decoding*/
+/*@{*/
+/**\name Functions for decoding
+ * You must link to <tt>libtheorabase</tt> and <tt>libtheoradec</tt> if you use
+ *  any of the functions in this section.
+ *
+ * The functions are listed in the order they are used in a typical decode.
+ * The basic steps are:
+ * - Parse the header packets by repeatedly calling theora_decode_headerin().
+ * - Allocate a #theora_dec_ctx handle with theora_decode_alloc().
+ * - Call theora_setup_free() to free any memory used for codec setup
+ *    information.
+ * - Perform any additional decoder configuration with theora_decode_ctl().
+ * - For each video data packet:
+ *   - Submit the packet to the decoder via theora_decode_packetin().
+ *   - Retrieve the uncompressed video data via theora_decode_ycbcr_out().
+ * - Call theora_decode_free() to release all decoder memory.*/
+/*@{*/
+/**Decodes the header packets of a Theora stream.
+ * This should be called on the initial packets of the stream, in succession,
+ *  until it returns <tt>0</tt>, indicating that all headers have been
+ *  processed, or an error is encountered.
+ * At least three header packets are required, and additional optional header
+ *  packets may follow.
+ * This can be used on the first packet of any logical stream to determine if
+ *  that stream is a Theora stream.
+ * \param _info  A #theora_info structure to fill in.
+ *               This must have been previously initialized with
+ *                theora_info_init().
+ *               The application may immediately begin using the contents of
+ *                this structure after the first header is decoded, though it
+ *                must continue to be passed in on all subsequent calls.
+ * \param _tc    A #theora_comment structure to fill in.
+ *               The application may immediately begin using the contents of
+ *                this structure after the second header is decoded, though it
+ *                must continue to be passed in on all subsequent calls.
+ * \param _setup Returns a pointer to additional, private setup information
+ *                needed by the decoder.
+ *               The contents of this pointer must be initialized to
+ *                <tt>NULL</tt> on the first call, and the returned value must
+ *                continue to be passed in on all subsequent calls.
+ * \param _op    An <tt>ogg_packet</tt> structure which contains one of the
+ *                initial packets of an Ogg logical stream.
+ * \return A positive value indicates that a Theora header was successfully
+ *          processed.
+ * \retval 0            The first video data packet was encountered after all
+ *                       required header packets were parsed.
+ *                      The packet just passed in on this call should be saved
+ *                       and fed to theora_decode_packetin() to begin decoding
+ *                       video data.
+ * \retval OC_FAULT     One of \a _info, \a _tc, or \a _setup was
+ *                       <tt>NULL</tt>.
+ * \retval OC_BADHEADER \a _op was <tt>NULL</tt>, the packet was not the next
+ *                       header packet in the expected sequence, or the format
+ *                       of the header data was invalid.
+ * \retval OC_VERSION   The packet data was a Theora info header, but for a
+ *                       bitstream version not decodable with this version of
+ *                       <tt>libtheora</tt>.
+ * \retval OC_NOTFORMAT The packet was not a Theora header.
+ */
+extern int theora_decode_headerin(theora_info *_info,theora_comment *_tc,
+ theora_setup_info **_setup,ogg_packet *_op);
+/**Allocates a decoder instance.
+ * \param _info  A #theora_info struct filled via theora_decode_headerin().
+ * \param _setup A #theora_setup_info handle returned via
+ *                theora_decode_headerin().
+ * \return The initialized #theora_dec_ctx handle.
+ * \retval NULL If the decoding parameters were invalid.*/
+extern theora_dec_ctx *theora_decode_alloc(const theora_info *_info,
+ const theora_setup_info *_setup);
+/**Releases all storage used for the decoder setup information.
+ * This should be called after you no longer want to create any decoders for
+ *  a stream whose headers you have parsed with theora_decode_headerin().
+ * \param _setup The setup information to free.
+ *               This can safely be <tt>NULL</tt>.*/
+extern void theora_setup_free(theora_setup_info *_setup);
+/**Encoder control function.
+ * This is used to provide advanced control the decoding process.
+ * \param _dec    A #theora_dec_ctx handle.
+ * \param _req    The control code to process.
+ *                See \ref decctlcodes "the list of available control codes"
+ *                 for details.
+ * \param _buf    The parameters for this control code.
+ * \param _buf_sz The size of the parameter buffer.*/
+extern int theora_decode_ctl(theora_dec_ctx *_dec,int _req,void *_buf,
+ size_t _buf_sz);
+/**Submits a packet containing encoded video data to the decoder.
+ * \param _dec     A #theora_dec_ctx handle.
+ * \param _op      An <tt>ogg_packet</tt> containing encoded video data.
+ * \param _granpos Returns the granule position of the decoded packet.
+ *                 If non-<tt>NULL</tt>, the granule position for this specific
+ *                  packet is stored in this location.
+ *                 This is computed incrementally from previously decoded
+ *                  packets.
+ *                 After a seek, the correct granule position must be set via
+ *                  #OC_DECCTL_SET_GRANPOS for this to work properly.
+ * \retval 0            Success.
+ * \retval OC_FAULT     \a _dec or _op was <tt>NULL</tt>.
+ * \retval OC_BADPACKET \a _op does not contain encoded video data.
+ * \retval OC_IMPL      The video data uses bitstream features which this
+ *                       library does not support.*/
+extern int theora_decode_packetin(theora_dec_ctx *_dec,const ogg_packet *_op,
+ ogg_int64_t *_granpos);
+/**Outputs the next available frame of decoded Y'CbCr data.
+ * If a striped decode callback has been set with #OC_DECCTL_SET_STRIPE_CB,
+ *  then the application does not need to call this function.
+ * \param _dec   A #theora_dec_ctx handle.
+ * \param _ycbcr A video buffer structure to fill in.
+ *               <tt>libtheora</tt> will fill in all the members of this
+ *                structure, including the pointers to the uncompressed video
+ *                data.
+ *               The memory for this video data is owned by
+ *                <tt>libtheora</tt>.
+ *               It may be freed or overwritten without notification when
+ *                subsequent frames are decoded.
+ * \retval 0 Success
+ */
+extern int theora_decode_ycbcr_out(theora_dec_ctx *_dec,
+ theora_ycbcr_buffer _ycbcr);
+/**Frees an allocated decoder instance.
+ * \param _dec A #theora_dec_ctx handle.*/
+extern void theora_decode_free(theora_dec_ctx *_dec);
+/*@}*/
+/*@}*/
+
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif

Copied: experimental/derf/theora-exp/include/theora/theoraenc.h (from rev 9152, experimental/derf/theora-exp/include/theora/theora.h)
===================================================================
--- experimental/derf/theora-exp/include/theora/theora.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/include/theora/theoraenc.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,210 @@
+/********************************************************************
+ *                                                                  *
+ * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
+ *                                                                  *
+ * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2003                *
+ * by the Xiph.Org Foundation http://www.xiph.org/                  *
+ *                                                                  *
+ ********************************************************************
+
+  function:
+  last mod: $Id: theora.h,v 1.8 2004/03/15 22:17:32 derf Exp $
+
+ ********************************************************************/
+
+/**\file
+ * The <tt>libtheora</tt> C encoding API.*/
+
+#if !defined(_O_THEORA_THEORAENC_H_)
+# define _O_THEORA_THEORAENC_H_ (1)
+# include <ogg/ogg.h>
+# include "codec.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+
+
+/**\name theora_encode_ctl() codes
+ * \anchor encctlcodes
+ * These are the available request codes for theora_encode_ctl().
+ * By convention, these are even, to distinguish them from the
+ *  \ref decctlcodes "decoder control codes".
+ * Keep any experimental or vendor-specific values above \c 0x8000.*/
+/*@{*/
+/**Sets the Huffman tables to use.
+ * The tables are copied, not of stored by reference, so they can be freed
+ *  after this call.
+ * <tt>NULL</tt> may be specified to revert to the default tables.
+ *
+ * \param[in] _buf <tt>theora_huff_code[#OC_NHUFFMAN_TABLES][#OC_NDCT_TOKENS]</tt>
+ * \retval OC_FAULT  \a _enc_ctx is <tt>NULL</tt>.
+ * \retval OC_EINVAL Encoding has already begun or one or more of the given
+ *                     tables is not full or prefix-free, \a _buf is
+ *                     <tt>NULL</tt> and \a _buf_sz is not zero, or \a _buf is
+ *                     non-<tt>NULL</tt> and \a _buf_sz is not
+ *                     <tt>sizeof(#theora_huff_code)*#OC_NHUFFMAN_TABLES*#OC_NDCT_TOKENS</tt>.
+ * \retval OC_IMPL   Not supported by this implementation.*/
+#define OC_ENCCTL_SET_HUFFMAN_CODES (0)
+/**Sets the quantization parameters to use.
+ * The parameters are copied, not stored by reference, so they can be freed
+ *  after this call.
+ * <tt>NULL</tt> may be specified to revert to the default parameters.
+ * For the current encoder, <tt>scale[ci!=0][qi]</tt> must be no greater than
+ *  <tt>scale[ci!=0][qi-1]</tt> and <tt>base[qti][pli][qi][ci]</tt> must be no
+ *  greater than <tt>base[qti][pli][qi-1][ci]</tt>.
+ * These two conditions ensure that the actual quantizer for a given \a qti,
+ *  \a pli, and \a ci does not increase as \a qi increases.
+ *
+ * \param[in] _buf #theora_quant_info
+ * \retval OC_FAULT  \a _enc_ctx is <tt>NULL</tt>.
+ * \retval OC_EINVAL Encoding has already begun, the quantization parameters
+ *                    do not meet one of the above stated conditions, \a _buf
+ *                    is <tt>NULL</tt> and \a _buf_sz is not zero, or \a _buf
+ *                    is non-<tt>NULL</tt> and \a _buf_sz is not
+ *                    <tt>sizeof(#theora_quant_info)</tt>.
+ * \retval OC_IMPL   Not supported by this implementation.*/
+#define OC_ENCCTL_SET_QUANT_PARAMS (2)
+/**Sets the maximum distance between key frames.
+ * This can be changed during an encode, but will be bounded by
+ *  <tt>1<<theora_info#keyframe_granule_shift</tt>.
+ * If it is set before encoding begins, theora_info#keyframe_granule_shift will
+ *  be enlarged appropriately.
+ *
+ * \param[in]  _buf <tt>ogg_uint32_t</tt>: The maximum distance between key
+ *                   frames.
+ * \param[out] _buf <tt>ogg_uint32_t</tt>: The actual maximum distance set.
+ * \retval OC_FAULT  \a _enc_ctx or \a _buf is <tt>NULL</tt>.
+ * \retval OC_EINVAL \a _buf_sz is not <tt>sizeof(ogg_uint32_t)</tt>.
+ * \retval OC_IMPL   Not supported by this implementation.*/
+#define OC_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE (4)
+/*@}*/
+
+
+
+/**The quantization parameters used by VP3.*/
+extern const theora_quant_info OC_VP31_QUANT_INFO;
+
+/**The Huffman tables used by VP3.*/
+extern const theora_huff_code
+ OC_VP31_HUFF_CODES[OC_NHUFFMAN_TABLES][OC_NDCT_TOKENS];
+
+
+
+/**\name Encoder state
+   The following data structure is opaque, and its contents are not publicly
+    defined by this API.
+   Referring to its internals directly is unsupported, and may break without
+    warning.*/
+/*@{*/
+/**The encoder context.*/
+typedef struct theora_enc_ctx    theora_enc_ctx;
+/*@}*/
+
+
+
+/**\defgroup encfuncs Functions for Encoding*/
+/*@{*/
+/**\name Functions for encoding
+ * You must link to <tt>libtheorabase</tt> and <tt>libtheoraenc</tt> if you use
+ *  any of the functions in this section.
+ *
+ * The functions are listed in the order they are used in a typical encode.
+ * The basic steps are:
+ * - Fill in a #theora_info structure with details on the format of the video
+ *    you wish to encode.
+ * - Allocate a #theora_enc_ctx handle with theora_encode_alloc().
+ * - Perform any additional encoder configuration required with
+ *    theora_encode_ctl().
+ * - Repeatedly call theora_encode_flushheader() to retrieve all the header
+ *    packets.
+ * - For each uncompressed frame:
+ *   - Submit the uncompressed frame via theora_encode_ycbcr_in()
+ *   - Repeatedly call theora_encode_packetout() to retrieve any video data
+ *      packets that are ready.
+ * - Call theora_encode_free() to release all encoder memory.*/
+/*@{*/
+/**Allocates an encoder instance.
+ * \param _info A #theora_info struct filled with the desired encoding
+ *               parameters.
+ * \return The initialized #theora_enc_ctx handle.
+ * \retval NULL If the encoding parameters were invalid.*/
+extern theora_enc_ctx *theora_encode_alloc(const theora_info *_info);
+/**Encoder control function.
+ * This is used to provide advanced control the encoding process.
+ * \param _enc    A #theora_enc_ctx handle.
+ * \param _req    The control code to process.
+ *                See \ref encctlcodes "the list of available control codes"
+ *                 for details.
+ * \param _buf    The parameters for this control code.
+ * \param _buf_sz The size of the parameter buffer.*/
+extern int theora_encode_ctl(theora_enc_ctx *_enc,int _req,void *_buf,
+ size_t _buf_sz);
+/**Outputs the next header packet.
+ * This should be called repeatedly after encoder initialization until it
+ *  returns 0 to get all of the header packets, in order, before encoding
+ *  actual video data.
+ * \param _enc      A #theora_enc_ctx handle.
+ * \param _comments The metadata to place in the comment header, when it is
+ *                   encoded.
+ * \param _op       An <tt>ogg_packet</tt> structure to fill.
+ *                  All of the elements of this structure will be set,
+ *                   including a pointer to the header data.
+ *                  The memory for the header data is owned by
+ *                   <tt>libtheora</tt>.
+ * \return A positive value indicates that a header packet was successfully
+ *          produced.
+ * \retval 0        No packet was produced, and no more header packets remain.
+ * \retval OC_FAULT \a _enc, \a _comments, or \a _op was <tt>NULL</tt>.*/
+extern int theora_encode_flushheader(theora_enc_ctx *_enc,
+ theora_comment *_comments,ogg_packet *_op);
+/**Submits an uncompressed frame to the encoder.
+ * \param _enc   A #theora_enc_ctx handle.
+ * \param _ycbcr A buffer of Y'CbCr data to encode.
+ * \retval 0         Success.
+ * \retval OC_FAULT  \a _enc or \a _ycbcr is <tt>NULL</tt>.
+ * \retval OC_EINVAL The buffer size does not match the frame size the encoder
+ *                    was initialized with, or encoding has already completed.
+ */
+extern int theora_encode_ycbcr_in(theora_enc_ctx *_enc,
+ theora_ycbcr_buffer _ycbcr);
+/**Retrieves encoded video data packets.
+ * This should be called repeatedly after each frame is submitted to flush any
+ *  encoded packets, until it returns 0.
+ * The encoder will not buffer these packets as subsequent frames are
+ *  compressed, so a failure to do so function will result in lost video data.
+ * \note Currently the encoder operates in a one-frame-in, one-packet-out
+ *        manner.
+ *       However, this may be changed in the future.
+ * \param _enc  A #theora_enc_ctx handle.
+ * \param _last Set this flag to a non-zero value if no more uncompressed
+ *               frames will be submitted.
+ *              This ensures that a proper EOS flag is set on the last packet.
+ * \param _op   An <tt>ogg_packet</tt> structure to fill.
+ *              All of the elements of this structure will be set, including a
+ *               pointer to the video data.
+ *              The memory for the video data is owned by <tt>libtheora</tt>.
+ * \return A positive value indicates that a video data packet was successfully
+ *          produced.
+ * \retval 0        No packet was produced, and no more encoded video data
+ *                   remains.
+ * \retval OC_FAULT \a _enc or \a _op was <tt>NULL</tt>.*/
+extern int theora_encode_packetout(theora_enc_ctx *_enc,int _last,
+ ogg_packet *_op);
+/**Frees an allocated encoder instance.
+ * \param _enc A #theora_enc_ctx handle.*/
+extern void theora_encode_free(theora_enc_ctx *_enc);
+/*@}*/
+/*@}*/
+
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif

Added: experimental/derf/theora-exp/lib/Makefile.am
===================================================================
--- experimental/derf/theora-exp/lib/Makefile.am	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/Makefile.am	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,35 @@
+lib_LTLIBRARIES = libtheorabase.la libtheoraenc.la libtheoradec.la
+
+INCLUDES = -I $(top_srcdir)/include
+AM_CFLAGS = $(OGG_CFLAGS)
+
+libtheorabase_la_SOURCES = \
+	fragment.c \
+	idct.c \
+	info.c \
+	internal.c \
+	quant.c \
+	state.c
+
+libtheorabase_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
+
+libtheoraenc_la_SOURCES = \
+	bitrate.c \
+	encinfo.c \
+	encode.c \
+	enquant.c \
+	fdct.c \
+	huffenc.c \
+	impmap.c \
+	mcenc.c \
+	psych.c
+
+libtheoraenc_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
+
+libtheoradec_la_SOURCES = \
+	decinfo.c \
+	decode.c \
+	dequant.c \
+	huffdec.c
+
+libtheoradec_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@

Modified: experimental/derf/theora-exp/lib/decint.h
===================================================================
--- experimental/derf/theora-exp/lib/decint.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/decint.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -1,7 +1,7 @@
 #include <limits.h>
 #if !defined(_decint_H)
 # define _decint_H (1)
-# include "theora/theora.h"
+# include "theora/theoradec.h"
 # include "internal.h"
 
 typedef struct theora_setup_info oc_setup_info;

Modified: experimental/derf/theora-exp/lib/dequant.h
===================================================================
--- experimental/derf/theora-exp/lib/dequant.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/dequant.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -1,6 +1,5 @@
 #if !defined(_dequant_H)
 # define _dequant_H (1)
-# include "theora/theora.h"
 # include "quant.h"
 
 int oc_quant_params_unpack(oggpack_buffer *_opb,

Modified: experimental/derf/theora-exp/lib/encint.h
===================================================================
--- experimental/derf/theora-exp/lib/encint.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/encint.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -1,7 +1,7 @@
 #include <limits.h>
 #if !defined(_encint_H)
 # define _encint_H (1)
-# include "theora/theora.h"
+# include "theora/theoraenc.h"
 # include "internal.h"
 
 typedef struct oc_fragment_enc_info   oc_fragment_enc_info;

Modified: experimental/derf/theora-exp/lib/encode.c
===================================================================
--- experimental/derf/theora-exp/lib/encode.c	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/encode.c	2005-04-19 02:19:49 UTC (rev 9153)
@@ -475,7 +475,7 @@
   This may only be called before the setup header is written.
   If it is called multiple times, only the last call has any effect.
   _qinfo: The quantization parameters.
-          These are described in more detail in theora.h.
+          These are described in more detail in theoraenc.h.
           This can be NULL, in which case the default quantization parameters
            will be used.*
   Return: 0 on success, or a negative value on error.

Modified: experimental/derf/theora-exp/lib/enquant.h
===================================================================
--- experimental/derf/theora-exp/lib/enquant.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/enquant.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -1,6 +1,5 @@
 #if !defined(_enquant_H)
 # define _enquant_H (1)
-# include "theora/theora.h"
 # include "quant.h"
 
 /*The amount to scale the forward quantizer value by.*/

Modified: experimental/derf/theora-exp/lib/huffdec.c
===================================================================
--- experimental/derf/theora-exp/lib/huffdec.c	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/huffdec.c	2005-04-19 02:19:49 UTC (rev 9153)
@@ -1,6 +1,5 @@
 #include <stdlib.h>
 #include <ogg/ogg.h>
-#include "theora/theora.h"
 #include "huffdec.h"
 #include "decint.h"
 

Modified: experimental/derf/theora-exp/lib/huffman.h
===================================================================
--- experimental/derf/theora-exp/lib/huffman.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/huffman.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -1,6 +1,6 @@
 #if !defined(_huffman_H)
 # define _hufffman_H (1)
-# include "theora/theora.h"
+# include "theora/codec.h"
 # include "ocintrin.h"
 
 /*The range of valid quantized DCT coefficient values.

Modified: experimental/derf/theora-exp/lib/info.c
===================================================================
--- experimental/derf/theora-exp/lib/info.c	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/info.c	2005-04-19 02:19:49 UTC (rev 9153)
@@ -1,7 +1,6 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <string.h>
-#include "theora/theora.h"
 #include "internal.h"
 
 

Modified: experimental/derf/theora-exp/lib/internal.h
===================================================================
--- experimental/derf/theora-exp/lib/internal.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/internal.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -1,7 +1,7 @@
 #if !defined(_internal_H)
 # define _internal_H (1)
 # include <stdlib.h>
-# include "theora/theora.h"
+# include "theora/codec.h"
 # include "ocintrin.h"
 # include "huffman.h"
 # include "quant.h"

Modified: experimental/derf/theora-exp/lib/quant.h
===================================================================
--- experimental/derf/theora-exp/lib/quant.h	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/lib/quant.h	2005-04-19 02:19:49 UTC (rev 9153)
@@ -1,6 +1,6 @@
 #if !defined(_quant_H)
 # define _quant_H (1)
-# include "theora/theora.h"
+# include "theora/codec.h"
 # include "ocintrin.h"
 
 typedef ogg_uint16_t   oc_quant_table[64];

Added: experimental/derf/theora-exp/theora-exp.pc.in
===================================================================
--- experimental/derf/theora-exp/theora-exp.pc.in	2005-04-18 14:32:26 UTC (rev 9152)
+++ experimental/derf/theora-exp/theora-exp.pc.in	2005-04-19 02:19:49 UTC (rev 9153)
@@ -0,0 +1,14 @@
+# theora installed pkg-config file
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: theora-exp
+Description: Theora experimental video codec
+Version: @VERSION@
+Requires: ogg >= 1.1.1
+Conflicts:
+Libs: -L${libdir} -ltheorabase -ltheoraenc -ltheoraadec
+Cflags: -I${includedir}



More information about the commits mailing list