shithub: libvpx

Download patch

ref: 6a80032280305c41f20403b07698ca969ec7edb2
parent: b6905e36d9a55589033723057b20a736844d1c17
parent: 3809d7bbd984a763cf7f288a51c9924667addf4a
author: John Koleszar <jkoleszar@google.com>
date: Mon Dec 13 19:05:04 EST 2010

Merge remote branch 'origin/master' into experimental

Change-Id: Ic88e9b2fcf1dcb2852a7205bcda3f181103f5612

--- a/vp8/common/preproc.h
+++ /dev/null
@@ -1,46 +1,0 @@
-/*
- *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/****************************************************************************
-*
-*   Module Title :     preproc.h
-*
-*   Description  :     simple preprocessor
-*
-****************************************************************************/
-
-#ifndef __INC_PREPROC_H
-#define __INC_PREPROC_H
-
-/****************************************************************************
-*  Types
-****************************************************************************/
-
-typedef struct
-{
-    unsigned char *frame_buffer;
-    int frame;
-    unsigned int *fixed_divide;
-
-    unsigned char *frame_buffer_alloc;
-    unsigned int *fixed_divide_alloc;
-} pre_proc_instance;
-
-/****************************************************************************
-*  Functions.
-****************************************************************************/
-void pre_proc_machine_specific_config(void);
-void delete_pre_proc(pre_proc_instance *ppi);
-int init_pre_proc(pre_proc_instance *ppi, int frame_size);
-extern void spatial_filter_c(pre_proc_instance *ppi, unsigned char *s, unsigned char *d, int width, int height, int pitch, int strength);
-extern void (*temp_filter)(pre_proc_instance *ppi, unsigned char *s, unsigned char *d, int bytes, int strength);
-
-#endif
--- a/vp8/common/preprocif.h
+++ /dev/null
@@ -1,76 +1,0 @@
-/*
- *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/****************************************************************************
-*
-*   Module Title :     preproc_if.h
-*
-*   Description  :     Pre-processor interface header file.
-*
-****************************************************************************/
-
-#ifndef __PREPROC_IF_H
-#define __PREPROC_IF_H
-
-/****************************************************************************
-*  Header Files
-****************************************************************************/
-#include "type_aliases.h"
-
-/****************************************************************************
-*  Types
-****************************************************************************/
-
-typedef struct
-{
-    UINT8 *Yuv0ptr;
-    UINT8 *Yuv1ptr;
-
-    UINT8   *frag_info;              // blocks coded : passed in
-    UINT32   frag_info_element_size;   // size of each element
-    UINT32   frag_info_coded_mask;     // mask to get at whether fragment is coded
-
-    UINT32 *region_index;            // Gives pixel index for top left of each block
-    UINT32 video_frame_height;
-    UINT32 video_frame_width;
-    UINT8 hfrag_pixels;
-    UINT8 vfrag_pixels;
-
-} SCAN_CONFIG_DATA;
-
-typedef enum
-{
-    SCP_FILTER_ON_OFF,
-    SCP_SET_SRF_OFFSET,
-    SCP_SET_EBO_ON_OFF,
-    SCP_SET_VCAP_LEVEL_OFFSET,
-    SCP_SET_SHOW_LOCAL
-
-} SCP_SETTINGS;
-
-typedef struct PP_INSTANCE *x_pp_inst;
-
-/****************************************************************************
-*  Module statics
-****************************************************************************/
-/* Controls whether Early break out is on or off in default case */
-#define EARLY_BREAKOUT_DEFAULT  TRUE
-
-/****************************************************************************
-*  Functions
-****************************************************************************/
-extern  void set_scan_param(x_pp_inst ppi, UINT32 param_id, INT32 param_value);
-extern  UINT32 yuvanalyse_frame(x_pp_inst ppi, UINT32 *KFIndicator);
-extern  x_pp_inst create_pp_instance(void);
-extern  void delete_pp_instance(x_pp_inst *);
-extern  BOOL scan_yuvinit(x_pp_inst,  SCAN_CONFIG_DATA *scan_config_ptr);
-
-#endif
--- a/vp8/encoder/ethreading.c
+++ b/vp8/encoder/ethreading.c
@@ -132,6 +132,7 @@
                         else
                             xd->mode_info_context->mbmi.segment_id = 0;         // Set to Segment 0 by default
 
+                        x->active_ptr = cpi->active_map + seg_map_index + mb_col;
 
                         if (cm->frame_type == KEY_FRAME)
                         {
@@ -163,8 +164,28 @@
                             if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
                                 cpi->inter_zz_count ++;
 
-                        }
+                            // Special case code for cyclic refresh
+                            // If cyclic update enabled then copy xd->mbmi.segment_id; (which may have been updated based on mode
+                            // during vp8cx_encode_inter_macroblock()) back into the global sgmentation map
+                            if (cpi->cyclic_refresh_mode_enabled && xd->segmentation_enabled)
+                            {
+                                cpi->segmentation_map[seg_map_index+mb_col] = xd->mode_info_context->mbmi.segment_id;
 
+                                // If the block has been refreshed mark it as clean (the magnitude of the -ve influences how long it will be before we consider another refresh):
+                                // Else if it was coded (last frame 0,0) and has not already been refreshed then mark it as a candidate for cleanup next time (marked 0)
+                                // else mark it as dirty (1).
+                                if (xd->mode_info_context->mbmi.segment_id)
+                                    cpi->cyclic_refresh_map[seg_map_index+mb_col] = -1;
+                                else if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
+                                {
+                                    if (cpi->cyclic_refresh_map[seg_map_index+mb_col] == 1)
+                                        cpi->cyclic_refresh_map[seg_map_index+mb_col] = 0;
+                                }
+                                else
+                                    cpi->cyclic_refresh_map[seg_map_index+mb_col] = 1;
+
+                            }
+                        }
                         cpi->tplist[mb_row].stop = *tp;
 
                         x->gf_active_ptr++;      // Increment pointer into gf useage flags structure for next mb
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3882,7 +3882,6 @@
         if (cm->frame_type == KEY_FRAME)
         {
             vp8_de_noise(cpi->Source, cpi->Source, l , 1,  0, RTCD(postproc));
-            cpi->ppi.frame = 0;
         }
         else
         {
@@ -3894,10 +3893,6 @@
             {
                 src += cpi->Source->y_stride * (cpi->Source->y_height - 1);
             }
-
-            //temp_filter(&cpi->ppi,src,src,
-            //  cm->last_frame.y_width * cm->last_frame.y_height,
-            //  cpi->oxcf.noise_sensitivity);
         }
     }
 
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -18,7 +18,6 @@
 #include "treewriter.h"
 #include "tokenize.h"
 #include "onyxc_int.h"
-#include "preproc.h"
 #include "variance.h"
 #include "dct.h"
 #include "encodemb.h"
@@ -463,8 +462,6 @@
 
     unsigned char *output_partition2;
     size_t output_partition2size;
-
-    pre_proc_instance ppi;
 
     int frames_to_key;
     int gfu_boost;
--- a/vp8/encoder/preproc.c
+++ /dev/null
@@ -1,251 +1,0 @@
-/*
- *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-
-/****************************************************************************
-*
-*   Module Title :     preproc.c
-*
-*   Description  :     Simple pre-processor.
-*
-****************************************************************************/
-
-/****************************************************************************
-*  Header Files
-****************************************************************************/
-
-#include "memory.h"
-#include "preproc7.h"
-#include "vpx_mem/vpx_mem.h"
-
-/****************************************************************************
-*  Macros
-****************************************************************************/
-#define FRAMECOUNT 7
-#define ROUNDUP32(X) ( ( ( (unsigned long) X ) + 31 )&( 0xFFFFFFE0 ) )
-
-/****************************************************************************
-*  Imports
-****************************************************************************/
-extern void vp8_get_processor_flags(int *mmx_enabled, int *xmm_enabled, int *wmt_enabled);
-
-/****************************************************************************
-*  Exported Global Variables
-****************************************************************************/
-void (*temp_filter)(pre_proc_instance *ppi, unsigned char *s, unsigned char *d, int bytes, int strength);
-void temp_filter_mmx
-(
-    pre_proc_instance *ppi,
-    unsigned char *s,
-    unsigned char *d,
-    int bytes,
-    int strength
-);
-void temp_filter_wmt
-(
-    pre_proc_instance *ppi,
-    unsigned char *s,
-    unsigned char *d,
-    int bytes,
-    int strength
-);
-
-/****************************************************************************
- *
- *  ROUTINE       : temp_filter_c
- *
- *  INPUTS        : pre_proc_instance *ppi : Pointer to pre-processor instance.
- *                  unsigned char *s     : Pointer to source frame.
- *                  unsigned char *d     : Pointer to destination frame.
- *                  int bytes            : Number of bytes to filter.
- *                  int strength         : Strength of filter to apply.
- *
- *  OUTPUTS       : None.
- *
- *  RETURNS       : void
- *
- *  FUNCTION      : Performs a closesness adjusted temporarl blur
- *
- *  SPECIAL NOTES : Destination frame can be same as source frame.
- *
- ****************************************************************************/
-void temp_filter_c
-(
-    pre_proc_instance *ppi,
-    unsigned char *s,
-    unsigned char *d,
-    int bytes,
-    int strength
-)
-{
-    int byte = 0;
-    unsigned char *frameptr = ppi->frame_buffer;
-
-    if (ppi->frame == 0)
-    {
-        do
-        {
-            int frame = 0;
-
-            do
-            {
-                *frameptr = s[byte];
-                ++frameptr;
-                ++frame;
-            }
-            while (frame < FRAMECOUNT);
-
-            d[byte] = s[byte];
-
-            ++byte;
-        }
-        while (byte < bytes);
-    }
-    else
-    {
-        int modifier;
-        int offset = (ppi->frame % FRAMECOUNT);
-
-        do
-        {
-            int accumulator = 0;
-            int count = 0;
-            int frame = 0;
-
-            frameptr[offset] = s[byte];
-
-            do
-            {
-                int pixel_value = *frameptr;
-
-                modifier   = s[byte];
-                modifier  -= pixel_value;
-                modifier  *= modifier;
-                modifier >>= strength;
-                modifier  *= 3;
-
-                if (modifier > 16)
-                    modifier = 16;
-
-                modifier = 16 - modifier;
-
-                accumulator += modifier * pixel_value;
-
-                count += modifier;
-
-                frameptr++;
-
-                ++frame;
-            }
-            while (frame < FRAMECOUNT);
-
-            accumulator += (count >> 1);
-            accumulator *= ppi->fixed_divide[count];
-            accumulator >>= 16;
-
-            d[byte] = accumulator;
-
-            ++byte;
-        }
-        while (byte < bytes);
-    }
-
-    ++ppi->frame;
-}
-/****************************************************************************
- *
- *  ROUTINE       : delete_pre_proc
- *
- *  INPUTS        : pre_proc_instance *ppi : Pointer to pre-processor instance.
- *
- *  OUTPUTS       : None.
- *
- *  RETURNS       : void
- *
- *  FUNCTION      : Deletes a pre-processing instance.
- *
- *  SPECIAL NOTES : None.
- *
- ****************************************************************************/
-void delete_pre_proc(pre_proc_instance *ppi)
-{
-    if (ppi->frame_buffer_alloc)
-        vpx_free(ppi->frame_buffer_alloc);
-
-    ppi->frame_buffer_alloc = 0;
-    ppi->frame_buffer      = 0;
-
-    if (ppi->fixed_divide_alloc)
-        vpx_free(ppi->fixed_divide_alloc);
-
-    ppi->fixed_divide_alloc = 0;
-    ppi->fixed_divide      = 0;
-}
-
-/****************************************************************************
- *
- *  ROUTINE       : init_pre_proc
- *
- *  INPUTS        : pre_proc_instance *ppi : Pointer to pre-processor instance.
- *                  int frame_size        : Number of bytes in one frame.
- *
- *  OUTPUTS       : None.
- *
- *  RETURNS       : int: 1 if successful, 0 if failed.
- *
- *  FUNCTION      : Initializes prepprocessor instance.
- *
- *  SPECIAL NOTES : None.
- *
- ****************************************************************************/
-int init_pre_proc7(pre_proc_instance *ppi, int frame_size)
-{
-    int i;
-    int mmx_enabled;
-    int xmm_enabled;
-    int wmt_enabled;
-
-    vp8_get_processor_flags(&mmx_enabled, &xmm_enabled, &wmt_enabled);
-
-    if (wmt_enabled)
-        temp_filter = temp_filter_wmt;
-    else if (mmx_enabled)
-        temp_filter = temp_filter_mmx;
-    else
-        temp_filter = temp_filter_c;
-
-
-    delete_pre_proc(ppi);
-
-    ppi->frame_buffer_alloc = vpx_malloc(32 + frame_size * FRAMECOUNT * sizeof(unsigned char));
-
-    if (!ppi->frame_buffer_alloc)
-    {
-        delete_pre_proc(ppi);
-        return 0;
-    }
-
-    ppi->frame_buffer = (unsigned char *) ROUNDUP32(ppi->frame_buffer_alloc);
-
-    ppi->fixed_divide_alloc = vpx_malloc(32 + 255 * sizeof(unsigned int));
-
-    if (!ppi->fixed_divide_alloc)
-    {
-        delete_pre_proc(ppi);
-        return 0;
-    }
-
-    ppi->fixed_divide = (unsigned int *) ROUNDUP32(ppi->fixed_divide_alloc);
-
-    for (i = 1; i < 255; i++)
-        ppi->fixed_divide[i] = 0x10000 / i;
-
-    return 1;
-}
--- a/vp8/encoder/tokenize.c
+++ b/vp8/encoder/tokenize.c
@@ -131,9 +131,6 @@
 
         t->Token = x;
         t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
-
-        t->section = frametype * BLOCK_TYPES * 2 + 2 * type + (c == 0);
-
         t->skip_eob_node = pt == 0 && ((band > 0 && type > 0) || (band > 1 && type == 0));
 
         ++cpi->coef_counts       [type] [band] [pt] [x];
@@ -184,8 +181,6 @@
 
         t->Token = x;
         t->context_tree = cpi->common.fc.coef_probs [type] [band] [pt];
-
-        t->section = frametype * BLOCK_TYPES * 2 + 2 * type + (c == 0);
         t->skip_eob_node = pt == 0 && ((band > 0 && type > 0) || (band > 1 && type == 0));
 
         ++cpi->coef_counts       [type] [band] [pt] [x];
@@ -434,7 +429,6 @@
 
     t->Token = DCT_EOB_TOKEN;
     t->context_tree = cpi->common.fc.coef_probs [1] [0] [pt];
-    t->section = 11;
     t->skip_eob_node = 0;
     ++cpi->coef_counts       [1] [0] [pt] [DCT_EOB_TOKEN];
     ++t;
@@ -465,7 +459,6 @@
 
     t->Token = DCT_EOB_TOKEN;
     t->context_tree = cpi->common.fc.coef_probs [0] [1] [pt];
-    t->section = 8;
     t->skip_eob_node = 0;
     ++cpi->coef_counts       [0] [1] [pt] [DCT_EOB_TOKEN];
     ++t;
@@ -495,7 +488,6 @@
 
     t->Token = DCT_EOB_TOKEN;
     t->context_tree = cpi->common.fc.coef_probs [2] [0] [pt];
-    t->section = 13;
     t->skip_eob_node = 0;
     ++cpi->coef_counts[2] [0] [pt] [DCT_EOB_TOKEN];
     ++t;
--- a/vp8/encoder/tokenize.h
+++ b/vp8/encoder/tokenize.h
@@ -25,11 +25,10 @@
 
 typedef struct
 {
-    int Token;
-    int Extra;
     const vp8_prob *context_tree;
-    int skip_eob_node;
-    int section;
+    char            skip_eob_node;
+    char            Token;
+    short           Extra;
 } TOKENEXTRA;
 
 int rd_cost_mby(MACROBLOCKD *);
--- a/vp8/encoder/x86/preproc_mmx.c
+++ /dev/null
@@ -1,298 +1,0 @@
-/*
- *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-
-#include "memory.h"
-#include "preproc.h"
-#include "pragmas.h"
-
-/****************************************************************************
-*  Macros
-****************************************************************************/
-#define FRAMECOUNT 7
-#define ROUNDUP32(X) ( ( ( (unsigned long) X ) + 31 )&( 0xFFFFFFE0 ) )
-
-/****************************************************************************
-*  Imports
-****************************************************************************/
-extern void vpx_get_processor_flags(int *mmx_enabled, int *xmm_enabled, int *wmt_enabled);
-
-/****************************************************************************
-*  Exported Global Variables
-****************************************************************************/
-void (*temp_filter)(pre_proc_instance *ppi, unsigned char *s, unsigned char *d, int bytes, int strength);
-
-/****************************************************************************
- *
- *  ROUTINE       : temp_filter_wmt
- *
- *  INPUTS        : pre_proc_instance *ppi : Pointer to pre-processor instance.
- *                  unsigned char *s     : Pointer to source frame.
- *                  unsigned char *d     : Pointer to destination frame.
- *                  int bytes            : Number of bytes to filter.
- *                  int strength         : Strength of filter to apply.
- *
- *  OUTPUTS       : None.
- *
- *  RETURNS       : void
- *
- *  FUNCTION      : Performs a closesness adjusted temporarl blur
- *
- *  SPECIAL NOTES : Destination frame can be same as source frame.
- *
- ****************************************************************************/
-void temp_filter_wmt
-(
-    pre_proc_instance *ppi,
-    unsigned char *s,
-    unsigned char *d,
-    int bytes,
-    int strength
-)
-{
-    int byte = 0;
-    unsigned char *frameptr = ppi->frame_buffer;
-
-    __declspec(align(16)) unsigned short threes[]  = { 3, 3, 3, 3, 3, 3, 3, 3};
-    __declspec(align(16)) unsigned short sixteens[] = {16, 16, 16, 16, 16, 16, 16, 16};
-
-    if (ppi->frame == 0)
-    {
-        do
-        {
-            int i;
-            int frame = 0;
-
-            do
-            {
-                for (i = 0; i < 8; i++)
-                {
-                    *frameptr = s[byte+i];
-                    ++frameptr;
-                }
-
-                ++frame;
-            }
-            while (frame < FRAMECOUNT);
-
-            for (i = 0; i < 8; i++)
-                d[byte+i] = s[byte+i];
-
-            byte += 8;
-
-        }
-        while (byte < bytes);
-    }
-    else
-    {
-        int i;
-        int offset2 = (ppi->frame % FRAMECOUNT);
-
-        do
-        {
-            __declspec(align(16)) unsigned short counts[8];
-            __declspec(align(16)) unsigned short sums[8];
-            __asm
-            {
-                mov         eax, offset2
-                mov         edi, s                  // source pixels
-                pxor        xmm1, xmm1              // accumulator
-
-                pxor        xmm7, xmm7
-
-                mov         esi, frameptr           // accumulator
-                pxor        xmm2, xmm2              // count
-
-                movq        xmm3, QWORD PTR [edi]
-
-                movq        QWORD PTR [esi+8*eax], xmm3
-
-                punpcklbw   xmm3, xmm2              // xmm3 source pixels
-                mov         ecx,  FRAMECOUNT
-
-                next_frame:
-                movq        xmm4, QWORD PTR [esi]   // get frame buffer values
-                punpcklbw   xmm4, xmm7              // xmm4 frame buffer pixels
-                movdqa      xmm6, xmm4              // save the pixel values
-                psubsw      xmm4, xmm3              // subtracted pixel values
-                pmullw      xmm4, xmm4              // square xmm4
-                movd        xmm5, strength
-                psrlw       xmm4, xmm5              // should be strength
-                pmullw      xmm4, threes            // 3 * modifier
-                movdqa      xmm5, sixteens          // 16s
-                psubusw     xmm5, xmm4              // 16 - modifiers
-                movdqa      xmm4, xmm5              // save the modifiers
-                pmullw      xmm4, xmm6              // multiplier values
-                paddusw     xmm1, xmm4              // accumulator
-                paddusw     xmm2, xmm5              // count
-                add         esi, 8                  // next frame
-                dec         ecx                     // next set of eight pixels
-                jnz         next_frame
-
-                movdqa      counts, xmm2
-                psrlw       xmm2, 1                 // divide count by 2 for rounding
-                paddusw     xmm1, xmm2              // rounding added in
-
-                mov         frameptr, esi
-
-                movdqa      sums, xmm1
-            }
-
-            for (i = 0; i < 8; i++)
-            {
-                int blurvalue = sums[i] * ppi->fixed_divide[counts[i]];
-                blurvalue >>= 16;
-                d[i] = blurvalue;
-            }
-
-            s += 8;
-            d += 8;
-            byte += 8;
-        }
-        while (byte < bytes);
-    }
-
-    ++ppi->frame;
-    __asm emms
-}
-
-/****************************************************************************
- *
- *  ROUTINE       : temp_filter_mmx
- *
- *  INPUTS        : pre_proc_instance *ppi : Pointer to pre-processor instance.
- *                  unsigned char *s     : Pointer to source frame.
- *                  unsigned char *d     : Pointer to destination frame.
- *                  int bytes            : Number of bytes to filter.
- *                  int strength         : Strength of filter to apply.
- *
- *  OUTPUTS       : None.
- *
- *  RETURNS       : void
- *
- *  FUNCTION      : Performs a closesness adjusted temporarl blur
- *
- *  SPECIAL NOTES : Destination frame can be same as source frame.
- *
- ****************************************************************************/
-void temp_filter_mmx
-(
-    pre_proc_instance *ppi,
-    unsigned char *s,
-    unsigned char *d,
-    int bytes,
-    int strength
-)
-{
-    int byte = 0;
-    unsigned char *frameptr = ppi->frame_buffer;
-
-    __declspec(align(16)) unsigned short threes[]  = { 3, 3, 3, 3};
-    __declspec(align(16)) unsigned short sixteens[] = {16, 16, 16, 16};
-
-    if (ppi->frame == 0)
-    {
-        do
-        {
-            int i;
-            int frame = 0;
-
-            do
-            {
-                for (i = 0; i < 4; i++)
-                {
-                    *frameptr = s[byte+i];
-                    ++frameptr;
-                }
-
-                ++frame;
-            }
-            while (frame < FRAMECOUNT);
-
-            for (i = 0; i < 4; i++)
-                d[byte+i] = s[byte+i];
-
-            byte += 4;
-
-        }
-        while (byte < bytes);
-    }
-    else
-    {
-        int i;
-        int offset2 = (ppi->frame % FRAMECOUNT);
-
-        do
-        {
-            __declspec(align(16)) unsigned short counts[8];
-            __declspec(align(16)) unsigned short sums[8];
-            __asm
-            {
-
-                mov         eax, offset2
-                mov         edi, s                  // source pixels
-                pxor        mm1, mm1                // accumulator
-                pxor        mm7, mm7
-
-                mov         esi, frameptr           // accumulator
-                pxor        mm2, mm2                // count
-
-                movd        mm3, DWORD PTR [edi]
-                movd        DWORD PTR [esi+4*eax], mm3
-
-                punpcklbw   mm3, mm2                // mm3 source pixels
-                mov         ecx,  FRAMECOUNT
-
-                next_frame:
-                movd        mm4, DWORD PTR [esi]    // get frame buffer values
-                punpcklbw   mm4, mm7                // mm4 frame buffer pixels
-                movq        mm6, mm4                // save the pixel values
-                psubsw      mm4, mm3                // subtracted pixel values
-                pmullw      mm4, mm4                // square mm4
-                movd        mm5, strength
-                psrlw       mm4, mm5                // should be strength
-                pmullw      mm4, threes             // 3 * modifier
-                movq        mm5, sixteens           // 16s
-                psubusw     mm5, mm4                // 16 - modifiers
-                movq        mm4, mm5                // save the modifiers
-                pmullw      mm4, mm6                // multiplier values
-                paddusw     mm1, mm4                // accumulator
-                paddusw     mm2, mm5                // count
-                add         esi, 4                  // next frame
-                dec         ecx                     // next set of eight pixels
-                jnz         next_frame
-
-                movq        counts, mm2
-                psrlw       mm2, 1                  // divide count by 2 for rounding
-                paddusw     mm1, mm2                // rounding added in
-
-                mov         frameptr, esi
-
-                movq        sums, mm1
-
-            }
-
-            for (i = 0; i < 4; i++)
-            {
-                int blurvalue = sums[i] * ppi->fixed_divide[counts[i]];
-                blurvalue >>= 16;
-                d[i] = blurvalue;
-            }
-
-            s += 4;
-            d += 4;
-            byte += 4;
-        }
-        while (byte < bytes);
-    }
-
-    ++ppi->frame;
-    __asm emms
-}
--- a/vp8/vp8_common.mk
+++ b/vp8/vp8_common.mk
@@ -17,7 +17,6 @@
 VP8_COMMON_SRCS-yes += common/pragmas.h
 
 CFLAGS+=-I$(SRC_PATH_BARE)/$(VP8_PREFIX)common
-VP8_COMMON_SRCS-yes += common/preproc.h
 VP8_COMMON_SRCS-yes += common/vpxerrors.h
 
 CFLAGS+=-I$(SRC_PATH_BARE)/$(VP8_PREFIX)common
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -347,12 +347,12 @@
                          unsigned int *fourcc,
                          unsigned int *width,
                          unsigned int *height,
-                         char          detect[4])
+                         struct detect_buffer *detect)
 {
     char raw_hdr[IVF_FILE_HDR_SZ];
     int is_ivf = 0;
 
-    if(memcmp(detect, "DKIF", 4) != 0)
+    if(memcmp(detect->buf, "DKIF", 4) != 0)
         return 0;
 
     /* See write_ivf_file_header() for more documentation on the file header
@@ -376,6 +376,7 @@
     {
         *width = mem_get_le16(raw_hdr + 12);
         *height = mem_get_le16(raw_hdr + 14);
+        detect->position = 4;
     }
 
     return is_ivf;
@@ -1390,7 +1391,7 @@
             }
         }
         else if (detect.buf_read == 4 &&
-                 file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, detect.buf))
+                 file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, &detect))
         {
             file_type = FILE_TYPE_IVF;
             switch (fourcc)