Skip to content

Commit

Permalink
Initial WebM release
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoleszar committed May 18, 2010
0 parents commit 0ea50ce
Show file tree
Hide file tree
Showing 724 changed files with 210,094 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*.[chs] filter=fixtabswsp
*.[ch]pp filter=fixtabswsp
*.[ch]xx filter=fixtabswsp
*.asm filter=fixtabswsp
*.php filter=fixtabswsp
*.pl filter=fixtabswsp
*.sh filter=fixtabswsp
*.txt filter=fixwsp
[Mm]akefile filter=fixwsp
*.mk filter=fixwsp
*.rc -crlf
*.ds[pw] -crlf
*.bat -crlf
*.mmp -crlf
*.dpj -crlf
*.pjt -crlf
*.vcp -crlf
*.inf -crlf
4 changes: 4 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Names should be added to this file like so:
# Name or Organization <email address>

Google Inc.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
2010-05-18 v0.9.0
- Initial open source release. Welcome to WebM and VP8!

48 changes: 48 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Copyright (c) 2010, Google, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

- Neither the name of Google nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Subject to the terms and conditions of the above License, Google
hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this
section) patent license to make, have made, use, offer to sell, sell,
import, and otherwise transfer this implementation of VP8, where such
license applies only to those patent claims, both currently owned by
Google and acquired in the future, licensable by Google that are
necessarily infringed by this implementation of VP8. If You or your
agent or exclusive licensee institute or order or agree to the
institution of patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that this
implementation of VP8 or any code incorporated within this
implementation of VP8 constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any rights
granted to You under this License for this implementation of VP8
shall terminate as of the date such litigation is filed.
106 changes: 106 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
vpx Multi-Format Codec SDK
README - 19 May 2010

Welcome to the WebM VP8 Codec SDK!

COMPILING THE APPLICATIONS/LIBRARIES:
The build system used is similar to autotools. Building generally consists of
"configuring" with your desired build options, then using GNU make to build
the application.

1. Prerequisites

* All x86 targets require the Yasm[1] assembler be installed.
* All Windows builds require that Cygwin[2] be installed.
* Building the documentation requires PHP[3] and Doxygen[4]. If you do not
have these packages, you must pass --disable-install-docs to the
configure script.

[1]: http://www.tortall.net/projects/yasm
[2]: http://www.cygwin.com
[3]: http://php.net
[4]: http://www.doxygen.org

2. Out-of-tree builds
Out of tree builds are a supported method of building the application. For
an out of tree build, the source tree is kept separate from the object
files produced during compilation. For instance:

$ mkdir build
$ cd build
$ ../libvpx/configure <options>
$ make

3. Configuration options
The 'configure' script supports a number of options. The --help option can be
used to get a list of supported options:
$ ../libvpx/configure --help

4. Cross development
For cross development, the most notable option is the --target option. The
most up-to-date list of supported targets can be found at the bottom of the
--help output of the configure script. As of this writing, the list of
available targets is:

armv5te-linux-rvct
armv5te-linux-gcc
armv5te-symbian-gcc
armv5te-wince-vs8
armv6-darwin-gcc
armv6-linux-rvct
armv6-linux-gcc
armv6-symbian-gcc
armv6-wince-vs8
iwmmxt-linux-rvct
iwmmxt-linux-gcc
iwmmxt-wince-vs8
iwmmxt2-linux-rvct
iwmmxt2-linux-gcc
iwmmxt2-wince-vs8
armv7-linux-rvct
armv7-linux-gcc
mips32-linux-gcc
ppc32-darwin8-gcc
ppc32-darwin9-gcc
ppc64-darwin8-gcc
ppc64-darwin9-gcc
ppc64-linux-gcc
x86-darwin8-gcc
x86-darwin8-icc
x86-darwin9-gcc
x86-darwin9-icc
x86-linux-gcc
x86-linux-icc
x86-solaris-gcc
x86-win32-vs7
x86-win32-vs8
x86_64-darwin9-gcc
x86_64-linux-gcc
x86_64-solaris-gcc
x86_64-win64-vs8
universal-darwin8-gcc
universal-darwin9-gcc
generic-gnu

The generic-gnu target, in conjunction with the CROSS environment variable,
can be used to cross compile architectures that aren't explicitly listed, if
the toolchain is a cross GNU (gcc/binutils) toolchain. Other POSIX toolchains
will likely work as well. For instance, to build using the mipsel-linux-uclibc
toolchain, the following command could be used (note, POSIX SH syntax, adapt
to your shell as necessary):

$ CROSS=mipsel-linux-uclibc- ../libvpx/src/configure

In addition, the executables to be invoked can be overridden by specifying the
environment variables: CC, AR, LD, AS, STRIP, NM. Additional flags can be
passed to these executables with CFLAGS, LDFLAGS, and ASFLAGS.

5. Configuration errors
If the configuration step fails, the first step is to look in the error log.
This defaults to config.err. This should give a good indication of what went
wrong. If not, contact us for support.

SUPPORT
This library is an open source project supported by its community. Please
please email webm-users@webmproject.org for help.

215 changes: 215 additions & 0 deletions args.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
/*
* Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license and patent
* grant that can be found in the LICENSE file in the root of the source
* tree. All contributing project authors may be found in the AUTHORS
* file in the root of the source tree.
*/


#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "args.h"

#ifdef _MSC_VER
#define snprintf _snprintf
#endif

#if defined(__GNUC__) && __GNUC__
extern void die(const char *fmt, ...) __attribute__((noreturn));
#else
extern void die(const char *fmt, ...);
#endif


struct arg arg_init(char **argv)
{
struct arg a;

a.argv = argv;
a.argv_step = 1;
a.name = NULL;
a.val = NULL;
a.def = NULL;
return a;
}

int arg_match(struct arg *arg_, const struct arg_def *def, char **argv)
{
struct arg arg;

if (!argv[0] || argv[0][0] != '-')
return 0;

arg = arg_init(argv);

if (def->short_name
&& strlen(arg.argv[0]) == strlen(def->short_name) + 1
&& !strcmp(arg.argv[0] + 1, def->short_name))
{

arg.name = arg.argv[0] + 1;
arg.val = def->has_val ? arg.argv[1] : NULL;
arg.argv_step = def->has_val ? 2 : 1;
}
else if (def->long_name)
{
int name_len = strlen(def->long_name);

if (strlen(arg.argv[0]) >= name_len + 2
&& arg.argv[0][1] == '-'
&& !strncmp(arg.argv[0] + 2, def->long_name, name_len)
&& (arg.argv[0][name_len+2] == '='
|| arg.argv[0][name_len+2] == '\0'))
{

arg.name = arg.argv[0] + 2;
arg.val = arg.name[name_len] == '=' ? arg.name + name_len + 1 : NULL;
arg.argv_step = 1;
}
}

if (arg.name && !arg.val && def->has_val)
die("Error: option %s requires argument.\n", arg.name);

if (arg.name && arg.val && !def->has_val)
die("Error: option %s requires no argument.\n", arg.name);

if (arg.name
&& (arg.val || !def->has_val))
{
arg.def = def;
*arg_ = arg;
return 1;
}

return 0;
}


const char *arg_next(struct arg *arg)
{
if (arg->argv[0])
arg->argv += arg->argv_step;

return *arg->argv;
}


char **argv_dup(int argc, const char **argv)
{
char **new_argv = malloc((argc + 1) * sizeof(*argv));

memcpy(new_argv, argv, argc * sizeof(*argv));
new_argv[argc] = NULL;
return new_argv;
}


void arg_show_usage(FILE *fp, const struct arg_def *const *defs)
{
char option_text[40] = {0};

for (; *defs; defs++)
{
const struct arg_def *def = *defs;
char *short_val = def->has_val ? " <arg>" : "";
char *long_val = def->has_val ? "=<arg>" : "";

if (def->short_name && def->long_name)
snprintf(option_text, 37, "-%s%s, --%s%s",
def->short_name, short_val,
def->long_name, long_val);
else if (def->short_name)
snprintf(option_text, 37, "-%s%s",
def->short_name, short_val);
else if (def->long_name)
snprintf(option_text, 37, " --%s%s",
def->long_name, long_val);

fprintf(fp, " %-37s\t%s\n", option_text, def->desc);
}
}


unsigned int arg_parse_uint(const struct arg *arg)
{
long int rawval;
char *endptr;

rawval = strtol(arg->val, &endptr, 10);

if (arg->val[0] != '\0' && endptr[0] == '\0')
{
if (rawval >= 0 && rawval <= UINT_MAX)
return rawval;

die("Option %s: Value %ld out of range for unsigned int\n",
arg->name, rawval);
}

die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
return 0;
}


int arg_parse_int(const struct arg *arg)
{
long int rawval;
char *endptr;

rawval = strtol(arg->val, &endptr, 10);

if (arg->val[0] != '\0' && endptr[0] == '\0')
{
if (rawval >= INT_MIN && rawval <= INT_MAX)
return rawval;

die("Option %s: Value %ld out of range for signed int\n",
arg->name, rawval);
}

die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
return 0;
}


struct vpx_rational
{
int num; /**< fraction numerator */
int den; /**< fraction denominator */
};
struct vpx_rational arg_parse_rational(const struct arg *arg)
{
long int rawval;
char *endptr;
struct vpx_rational rat;

/* parse numerator */
rawval = strtol(arg->val, &endptr, 10);

if (arg->val[0] != '\0' && endptr[0] == '/')
{
if (rawval >= INT_MIN && rawval <= INT_MAX)
rat.num = rawval;
else die("Option %s: Value %ld out of range for signed int\n",
arg->name, rawval);
}
else die("Option %s: Expected / at '%c'\n", arg->name, *endptr);

/* parse denominator */
rawval = strtol(endptr + 1, &endptr, 10);

if (arg->val[0] != '\0' && endptr[0] == '\0')
{
if (rawval >= INT_MIN && rawval <= INT_MAX)
rat.den = rawval;
else die("Option %s: Value %ld out of range for signed int\n",
arg->name, rawval);
}
else die("Option %s: Invalid character '%c'\n", arg->name, *endptr);

return rat;
}
Loading

0 comments on commit 0ea50ce

Please sign in to comment.