Merge "Change bitreader to use a larger window."
diff --git a/AUTHORS b/AUTHORS
index 4ab6881..9715f00 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,7 +1,24 @@
-# Names should be added to this file like so:
-# Name or Organization <email address>
+# This file is automatically generated from the git commit history
+# by tools/gen_authors.sh.
 
+Alex Converse <alex.converse@gmail.com>
+Andres Mejia <mcitadel@gmail.com>
+Fabio Pedretti <fabio.ped@libero.it>
+Frank Galligan <fgalligan@google.com>
+Guillermo Ballester Valor <gbvalor@gmail.com>
+James Zern <jzern@google.com>
+John Koleszar <jkoleszar@google.com>
+Justin Clift <justin@salasaga.org>
+Luca Barbato <lu_zero@gentoo.org>
+Makoto Kato <makoto.kt@gmail.com>
+Paul Wilkins <paulwilkins@google.com>
+Pavol Rusnak <stick@gk2.sk>
+Philip Jägenstedt <philipj@opera.com>
+Scott LaVarnway <slavarnway@google.com>
+Timothy B. Terriberry <tterribe@xiph.org>
+Tom Finegan <tomfinegan@google.com>
+Yaowu Xu <yaowu@google.com>
+Yunqing Wang <yunqingwang@google.com>
 Google Inc.
 The Mozilla Foundation
-Timothy B. Terriberry <tterriberry@mozilla.com>
 The Xiph.Org Foundation
diff --git a/CHANGELOG b/CHANGELOG
index d6c8ce8..c445a52 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,18 @@
+2010-06-17 v0.9.1
+  - Enhancements:
+      * ivfenc/ivfdec now support YUV4MPEG2 input and pipe I/O
+      * Speed optimizations
+  - Bugfixes:
+      * Rate control
+      * Prevent out-of-bounds accesses on invalid data
+  - Build system updates:
+      * Detect toolchain to be used automatically for native builds
+      * Support building shared libraries
+      * Better autotools emulation (--prefix, --libdir, DESTDIR)
+  - Updated LICENSE
+      * http://webmproject.blogspot.com/2010/06/changes-to-webm-open-source-license.html
+
+
 2010-05-18 v0.9.0
   - Initial open source release. Welcome to WebM and VP8!
 
diff --git a/ivfenc.c b/ivfenc.c
index e9a49cd..11f2a8f 100644
--- a/ivfenc.c
+++ b/ivfenc.c
@@ -299,12 +299,11 @@
 }
 
 
-unsigned int file_is_y4m(FILE *infile,
+unsigned int file_is_y4m(FILE      *infile,
                          y4m_input *y4m,
                          char       detect[4])
 {
-    if(memcmp(detect, "YUV4", 4) == 0 &&
-        y4m_input_open(y4m, infile, detect, 4) >= 0)
+    if(memcmp(detect, "YUV4", 4) == 0)
     {
         return 1;
     }
@@ -875,18 +874,26 @@
 
         if (file_is_y4m(infile, &y4m, detect.buf))
         {
-            file_type = FILE_TYPE_Y4M;
-            cfg.g_w = y4m.pic_w;
-            cfg.g_h = y4m.pic_h;
-            /* Use the frame rate from the file only if none was specified on the
-             *  command-line.
-             */
-            if (!arg_have_timebase)
+            if (y4m_input_open(&y4m, infile, detect.buf, 4) >= 0)
             {
-                cfg.g_timebase.num = y4m.fps_d;
-                cfg.g_timebase.den = y4m.fps_n;
+                file_type = FILE_TYPE_Y4M;
+                cfg.g_w = y4m.pic_w;
+                cfg.g_h = y4m.pic_h;
+                /* Use the frame rate from the file only if none was specified
+                 * on the command-line.
+                 */
+                if (!arg_have_timebase)
+                {
+                    cfg.g_timebase.num = y4m.fps_d;
+                    cfg.g_timebase.den = y4m.fps_n;
+                }
+                arg_use_i420 = 0;
             }
-            arg_use_i420 = 0;
+            else
+            {
+                fprintf(stderr, "Unsupported Y4M stream.\n");
+                return EXIT_FAILURE;
+            }
         }
         else if (file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, detect.buf))
         {
diff --git a/tools/gen_authors.sh b/tools/gen_authors.sh
new file mode 100755
index 0000000..e1246f0
--- /dev/null
+++ b/tools/gen_authors.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Add organization names manually.
+
+cat <<EOF
+# This file is automatically generated from the git commit history
+# by tools/gen_authors.sh.
+
+$(git log --pretty=format:"%aN <%aE>" | sort | uniq)
+Google Inc.
+The Mozilla Foundation
+The Xiph.Org Foundation
+EOF
diff --git a/vp8/common/x86/subpixel_sse2.asm b/vp8/common/x86/subpixel_sse2.asm
index b71a2f9..ee383ad 100644
--- a/vp8/common/x86/subpixel_sse2.asm
+++ b/vp8/common/x86/subpixel_sse2.asm
@@ -428,6 +428,7 @@
     push        rbp
     mov         rbp, rsp
     SHADOW_ARGS_TO_STACK 8
+    SAVE_XMM
     GET_GOT     rbx
     push        rsi
     push        rdi
@@ -537,6 +538,7 @@
     push        rbp
     mov         rbp, rsp
     SHADOW_ARGS_TO_STACK 6
+    SAVE_XMM
     GET_GOT     rbx
     push        rsi
     push        rdi
@@ -628,6 +630,7 @@
     pop rdi
     pop rsi
     RESTORE_GOT
+    RESTORE_XMM
     UNSHADOW_ARGS
     pop         rbp
     ret
@@ -792,6 +795,7 @@
     pop rdi
     pop rsi
     RESTORE_GOT
+    RESTORE_XMM
     UNSHADOW_ARGS
     pop         rbp
     ret
@@ -812,6 +816,7 @@
     push        rbp
     mov         rbp, rsp
     SHADOW_ARGS_TO_STACK 6
+    SAVE_XMM
     GET_GOT     rbx
     push        rsi
     push        rdi
@@ -903,7 +908,7 @@
     push        rbp
     mov         rbp, rsp
     SHADOW_ARGS_TO_STACK 5
-    SAVE_XMM
+    ;SAVE_XMM                          ;xmm6, xmm7 are not used here.
     GET_GOT     rbx
     push        rsi
     push        rdi
@@ -943,7 +948,7 @@
     pop rdi
     pop rsi
     RESTORE_GOT
-    RESTORE_XMM
+    ;RESTORE_XMM
     UNSHADOW_ARGS
     pop         rbp
     ret
@@ -1212,6 +1217,7 @@
     pop rdi
     pop rsi
     RESTORE_GOT
+    RESTORE_XMM
     UNSHADOW_ARGS
     pop         rbp
     ret
@@ -1232,6 +1238,7 @@
     push        rbp
     mov         rbp, rsp
     SHADOW_ARGS_TO_STACK 6
+    SAVE_XMM
     GET_GOT     rbx
     push        rsi
     push        rdi
@@ -1355,6 +1362,7 @@
     pop rdi
     pop rsi
     RESTORE_GOT
+    RESTORE_XMM
     UNSHADOW_ARGS
     pop         rbp
     ret
diff --git a/vpx_scale/generic/gen_scalers.c b/vpx_scale/generic/gen_scalers.c
index 948e3d7..ff841f3 100644
--- a/vpx_scale/generic/gen_scalers.c
+++ b/vpx_scale/generic/gen_scalers.c
@@ -937,12 +937,13 @@
 
 void vp8cx_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
 {
-    unsigned int i;
+    int i;
     int temp;
+    int width = dest_width;
 
     (void) dest_pitch;
 
-    for (i = 0; i < dest_width; i++)
+    for (i = 0; i < width; i++)
     {
         temp = 8;
         temp += source[i-(int)src_pitch] * 3;