Merge "clean up unused files"
diff --git a/vp8/common/predictdc.c b/vp8/common/predictdc.c
deleted file mode 100644
index f315f50..0000000
--- a/vp8/common/predictdc.c
+++ /dev/null
@@ -1,44 +0,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 <stdlib.h>
-#include "blockd.h"
-
-
-void vp8_predict_dc(short *lastdc, short *thisdc, short quant, short *cons)
-{
-    int diff;
-    int sign;
-    int last_dc = *lastdc;
-    int this_dc = *thisdc;
-
-    if (*cons  > DCPREDCNTTHRESH)
-    {
-        this_dc += last_dc;
-    }
-
-    diff = abs(last_dc - this_dc);
-    sign  = (last_dc >> 31) ^(this_dc >> 31);
-    sign |= (!last_dc | !this_dc);
-
-    if (sign)
-    {
-        *cons = 0;
-    }
-    else
-    {
-        if (diff <= DCPREDSIMTHRESH * quant)
-            (*cons)++ ;
-    }
-
-    *thisdc = this_dc;
-    *lastdc = this_dc;
-}
diff --git a/vp8/common/predictdc.h b/vp8/common/predictdc.h
deleted file mode 100644
index fa85968..0000000
--- a/vp8/common/predictdc.h
+++ /dev/null
@@ -1,18 +0,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.
- */
-
-
-#ifndef __PREDICTDC_H
-#define __PREDICTDC_H
-
-void uvvp8_predict_dc(short *lastdc, short *thisdc, short quant, short *cons);
-void vp8_predict_dc(short *lastdc, short *thisdc, short quant, short *cons);
-
-#endif
diff --git a/vp8/common/recon.h b/vp8/common/recon.h
index 1e6e343..e7df90a 100644
--- a/vp8/common/recon.h
+++ b/vp8/common/recon.h
@@ -94,6 +94,5 @@
 #define RECON_INVOKE(ctx,fn) vp8_recon_##fn
 #endif
 
-void vp8_recon_intra4x4mb(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x);
 void vp8_recon_intra_mbuv(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x);
 #endif
diff --git a/vp8/common/reconintra4x4.c b/vp8/common/reconintra4x4.c
index db44fa1..cd70dca 100644
--- a/vp8/common/reconintra4x4.c
+++ b/vp8/common/reconintra4x4.c
@@ -313,89 +313,3 @@
 }
 
 
-void vp8_recon_intra4x4mb(const vp8_recon_rtcd_vtable_t *rtcd, MACROBLOCKD *x)
-{
-    int i;
-
-    vp8_intra_prediction_down_copy(x);
-
-#if ARCH_ARM
-    {
-        BLOCKD *b = &x->block[0];
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-        b += 1;
-
-        vp8_predict_intra4x4(b, b->bmi.mode, b->predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-    }
-#else
-    for (i = 0; i < 16; i++)
-    {
-        BLOCKD *b = &x->block[i];
-
-        vp8_predict_intra4x4(b, x->block[i].bmi.mode, x->block[i].predictor);
-        RECON_INVOKE(rtcd, recon)(b->predictor, b->diff, *(b->base_dst) + b->dst, b->dst_stride);
-    }
-#endif
-
-    vp8_recon_intra_mbuv(rtcd, x);
-
-}
diff --git a/vp8/decoder/arm/dequantize_arm.c b/vp8/decoder/arm/dequantize_arm.c
index b26af97..d88adb7 100644
--- a/vp8/decoder/arm/dequantize_arm.c
+++ b/vp8/decoder/arm/dequantize_arm.c
@@ -11,7 +11,6 @@
 
 #include "vpx_ports/config.h"
 #include "vp8/decoder/dequantize.h"
-#include "vp8/common/predictdc.h"
 #include "vp8/common/idct.h"
 #include "vpx_mem/vpx_mem.h"
 
diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
index 5769100..c454bbc 100644
--- a/vp8/decoder/decodframe.c
+++ b/vp8/decoder/decodframe.c
@@ -30,7 +30,6 @@
 #include "vpx_mem/vpx_mem.h"
 #include "vp8/common/idct.h"
 #include "dequantize.h"
-#include "vp8/common/predictdc.h"
 #include "vp8/common/threading.h"
 #include "decoderthreading.h"
 #include "dboolhuff.h"
diff --git a/vp8/decoder/dequantize.c b/vp8/decoder/dequantize.c
index 4e1a5e1..dd0c13b 100644
--- a/vp8/decoder/dequantize.c
+++ b/vp8/decoder/dequantize.c
@@ -11,7 +11,6 @@
 
 #include "vpx_ports/config.h"
 #include "dequantize.h"
-#include "vp8/common/predictdc.h"
 #include "vp8/common/idct.h"
 #include "vpx_mem/vpx_mem.h"
 
diff --git a/vp8/encoder/arm/quantize_arm.c b/vp8/encoder/arm/quantize_arm.c
index 75ec205..0e3334a 100644
--- a/vp8/encoder/arm/quantize_arm.c
+++ b/vp8/encoder/arm/quantize_arm.c
@@ -14,7 +14,6 @@
 
 #include "vp8/encoder/quantize.h"
 #include "vp8/common/entropy.h"
-#include "vp8/common/predictdc.h"
 
 DECLARE_ALIGNED(16, const short, vp8_rvsplus1_default_zig_zag1d[16]) =
 {
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 9728e76..f7c2c4a 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3050,21 +3050,27 @@
     VP8_COMMON *cm = &cpi->common;
     MACROBLOCKD *mbd = &cpi->mb.e_mbd;
     int update = 0;
-
-    update |= cm->base_qindex != Q;
+    int new_delta_q;
     cm->base_qindex = Q;
 
+    /* if any of the delta_q values are changing update flag has to be set */
+    /* currently only y2dc_delta_q may change */
+
     cm->y1dc_delta_q = 0;
-    cm->y2dc_delta_q = 0;
     cm->y2ac_delta_q = 0;
     cm->uvdc_delta_q = 0;
     cm->uvac_delta_q = 0;
 
-    if(Q<4)
+    if (Q < 4)
     {
-        update |= cm->y2dc_delta_q != 4-Q;
-        cm->y2dc_delta_q = 4-Q;
+        new_delta_q = 4-Q;
     }
+    else
+        new_delta_q = 0;
+
+    update |= cm->y2dc_delta_q != new_delta_q;
+    cm->y2dc_delta_q = new_delta_q;
+
 
     // Set Segment specific quatizers
     mbd->segment_feature_data[MB_LVL_ALT_Q][0] = cpi->segment_feature_data[MB_LVL_ALT_Q][0];
@@ -3072,6 +3078,7 @@
     mbd->segment_feature_data[MB_LVL_ALT_Q][2] = cpi->segment_feature_data[MB_LVL_ALT_Q][2];
     mbd->segment_feature_data[MB_LVL_ALT_Q][3] = cpi->segment_feature_data[MB_LVL_ALT_Q][3];
 
+    /* quantizer has to be reinitialized for any delta_q changes */
     if(update)
         vp8cx_init_quantizer(cpi);
 
@@ -4404,52 +4411,47 @@
     else
         cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx];
 
-    //#pragma omp parallel sections
+    if (cm->no_lpf)
     {
-
-        //#pragma omp section
-        {
-
-            struct vpx_usec_timer timer;
-
-            vpx_usec_timer_start(&timer);
-
-            if (cpi->sf.auto_filter == 0)
-                vp8cx_pick_filter_level_fast(cpi->Source, cpi);
-            else
-                vp8cx_pick_filter_level(cpi->Source, cpi);
-
-            vpx_usec_timer_mark(&timer);
-
-            cpi->time_pick_lpf +=  vpx_usec_timer_elapsed(&timer);
-
-            if (cm->no_lpf)
-                cm->filter_level = 0;
-
-            if (cm->filter_level > 0)
-            {
-                vp8cx_set_alt_lf_level(cpi, cm->filter_level);
-                vp8_loop_filter_frame(cm, &cpi->mb.e_mbd, cm->filter_level);
-                cm->last_filter_type = cm->filter_type;
-                cm->last_sharpness_level = cm->sharpness_level;
-            }
-            /* Move storing frame_type out of the above loop since it is also needed in motion search besides loopfilter */
-            cm->last_frame_type = cm->frame_type;
-
-            vp8_yv12_extend_frame_borders_ptr(cm->frame_to_show);
-
-            if (cpi->oxcf.error_resilient_mode == 1)
-            {
-                cm->refresh_entropy_probs = 0;
-            }
-
-        }
-//#pragma omp section
-        {
-            // build the bitstream
-            vp8_pack_bitstream(cpi, dest, size);
-        }
+        cm->filter_level = 0;
     }
+    else
+    {
+        struct vpx_usec_timer timer;
+
+        vpx_usec_timer_start(&timer);
+
+        if (cpi->sf.auto_filter == 0)
+            vp8cx_pick_filter_level_fast(cpi->Source, cpi);
+        else
+            vp8cx_pick_filter_level(cpi->Source, cpi);
+
+        vpx_usec_timer_mark(&timer);
+
+        cpi->time_pick_lpf +=  vpx_usec_timer_elapsed(&timer);
+    }
+
+    if (cm->filter_level > 0)
+    {
+        vp8cx_set_alt_lf_level(cpi, cm->filter_level);
+        vp8_loop_filter_frame(cm, &cpi->mb.e_mbd, cm->filter_level);
+        cm->last_filter_type = cm->filter_type;
+        cm->last_sharpness_level = cm->sharpness_level;
+    }
+
+    /* Move storing frame_type out of the above loop since it is also
+     * needed in motion search besides loopfilter */
+    cm->last_frame_type = cm->frame_type;
+
+    vp8_yv12_extend_frame_borders_ptr(cm->frame_to_show);
+
+    if (cpi->oxcf.error_resilient_mode == 1)
+    {
+        cm->refresh_entropy_probs = 0;
+    }
+
+    // build the bitstream
+    vp8_pack_bitstream(cpi, dest, size);
 
     {
         YV12_BUFFER_CONFIG *lst_yv12 = &cm->yv12_fb[cm->lst_fb_idx];
diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c
index 02b9d7b..803e3a5 100644
--- a/vp8/encoder/quantize.c
+++ b/vp8/encoder/quantize.c
@@ -14,7 +14,6 @@
 
 #include "quantize.h"
 #include "vp8/common/entropy.h"
-#include "vp8/common/predictdc.h"
 
 #define EXACT_QUANT
 
diff --git a/vp8/vp8_common.mk b/vp8/vp8_common.mk
index 00c1ade..4daadee 100644
--- a/vp8/vp8_common.mk
+++ b/vp8/vp8_common.mk
@@ -44,7 +44,6 @@
 VP8_COMMON_SRCS-yes += common/modecont.h
 VP8_COMMON_SRCS-yes += common/mv.h
 VP8_COMMON_SRCS-yes += common/onyxc_int.h
-VP8_COMMON_SRCS-yes += common/predictdc.h
 VP8_COMMON_SRCS-yes += common/quant_common.h
 VP8_COMMON_SRCS-yes += common/recon.h
 VP8_COMMON_SRCS-yes += common/reconinter.h
@@ -62,7 +61,6 @@
 VP8_COMMON_SRCS-yes += common/mbpitch.c
 VP8_COMMON_SRCS-yes += common/modecont.c
 VP8_COMMON_SRCS-yes += common/modecontext.c
-VP8_COMMON_SRCS-yes += common/predictdc.c
 VP8_COMMON_SRCS-yes += common/quant_common.c
 VP8_COMMON_SRCS-yes += common/recon.c
 VP8_COMMON_SRCS-yes += common/reconinter.c