summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vp8/common/alloccommon.c14
-rw-r--r--vp8/common/filter.c432
-rw-r--r--vp8/common/filter.h8
-rw-r--r--vp8/common/reconinter.c17
-rw-r--r--vp8/encoder/arm/arm_csystemdependent.c4
-rw-r--r--vp8/encoder/arm/variance_arm.h3
-rw-r--r--vp8/encoder/encodeframe.c192
-rw-r--r--vp8/encoder/firstpass.c8
-rw-r--r--vp8/encoder/generic/csystemdependent.c2
-rw-r--r--vp8/encoder/onyx_if.c1250
-rw-r--r--vp8/encoder/onyx_int.h7
-rw-r--r--vp8/encoder/pickinter.c1001
-rw-r--r--vp8/encoder/pickinter.h19
-rw-r--r--vp8/encoder/ppc/csystemdependent.c4
-rw-r--r--vp8/encoder/ratectrl.c604
-rw-r--r--vp8/encoder/variance.h7
-rw-r--r--vp8/encoder/x86/variance_x86.h4
-rw-r--r--vp8/encoder/x86/x86_csystemdependent.c4
-rw-r--r--vp8/vp8cx.mk2
19 files changed, 560 insertions, 3022 deletions
diff --git a/vp8/common/alloccommon.c b/vp8/common/alloccommon.c
index 37e99fbd6..0f5c48d91 100644
--- a/vp8/common/alloccommon.c
+++ b/vp8/common/alloccommon.c
@@ -186,17 +186,19 @@ void vp8_setup_version(VP8_COMMON *cm)
cm->full_pixel = 0;
break;
case 2:
+ case 3:
cm->no_lpf = 1;
cm->filter_type = NORMAL_LOOPFILTER;
cm->use_bilinear_mc_filter = 1;
cm->full_pixel = 0;
break;
- case 3:
- cm->no_lpf = 1;
- cm->filter_type = SIMPLE_LOOPFILTER;
- cm->use_bilinear_mc_filter = 1;
- cm->full_pixel = 1;
- break;
+ // Full pel only code deprecated in experimental code base
+ //case 3:
+ // cm->no_lpf = 1;
+ // cm->filter_type = SIMPLE_LOOPFILTER;
+ // cm->use_bilinear_mc_filter = 1;
+ // cm->full_pixel = 1;
+ // break;
}
}
void vp8_create_common(VP8_COMMON *oci)
diff --git a/vp8/common/filter.c b/vp8/common/filter.c
index dc585045d..62f8b79d7 100644
--- a/vp8/common/filter.c
+++ b/vp8/common/filter.c
@@ -26,26 +26,37 @@ DECLARE_ALIGNED(16, const short, vp8_bilinear_filters[8][2]) =
};
#if CONFIG_ENHANCED_INTERP
-#define FILTER_ALPHA 90
+#define FILTER_ALPHA 875
DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters[8][2*INTERP_EXTEND]) =
{
/* Generated using MATLAB:
- * alpha = 0.9;
+ * alpha = 0.875;
* b=intfilt(8,4,alpha);
* bi=round(128*b);
* ba=flipud(reshape([bi 0], 8, 8));
+ * % Now normalize the powers of the polyphase components
* disp(num2str(ba, '%d,'))
*/
#if FILTER_ALPHA == 90
- /* alpha = 0.90 */
+ /* alpha = 0.9 */
{ 0, 0, 0, 128, 0, 0, 0, 0},
- {-3, 6, -13, 125, 18, -8, 5, -2},
- {-5, 11, -21, 115, 39, -15, 9, -5},
- {-7, 14, -25, 100, 61, -21, 13, -7},
- {-7, 14, -25, 82, 82, -25, 14, -7},
- {-7, 13, -21, 61, 100, -25, 14, -7},
- {-5, 9, -15, 39, 115, -21, 11, -5},
- {-2, 5, -8, 18, 125, -13, 6, -3}
+ {-3, 6, -13, 126, 18, -8, 5, -3},
+ {-6, 11, -22, 118, 39, -16, 9, -5},
+ {-8, 14, -27, 104, 62, -23, 13, -7},
+ {-8, 14, -27, 85, 85, -27, 14, -8},
+ {-7, 13, -23, 62, 104, -27, 14, -8},
+ {-5, 9, -16, 39, 118, -22, 11, -6},
+ {-3, 5, -8, 18, 126, -13, 6, -3}
+#elif FILTER_ALPHA == 875
+ /* alpha = 0.875 */
+ { 0, 0, 0, 128, 0, 0, 0, 0},
+ {-3, 6, -13, 126, 18, -8, 4, -2},
+ {-5, 10, -22, 118, 39, -16, 9, -5},
+ {-7, 13, -26, 104, 62, -23, 12, -7},
+ {-7, 13, -27, 85, 85, -27, 13, -7},
+ {-7, 12, -23, 62, 104, -26, 13, -7},
+ {-5, 9, -16, 39, 118, -22, 10, -5},
+ {-2, 4, -8, 18, 126, -13, 6, -3}
#elif FILTER_ALPHA == 85
/* alpha = 0.85 */
{ 0, 0, 0, 128, 0, 0, 0, 0},
@@ -56,19 +67,154 @@ DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters[8][2*INTERP_EXTEND]) =
{-5, 11, -21, 60, 100, -24, 12, -5},
{-4, 8, -15, 39, 114, -20, 10, -4},
{-2, 4, -7, 18, 124, -12, 5, -2}
-#elif FILTER_ALPHA == 75
- /* alpha = 0.75 */
- { 0, 0, 0, 128, 0, 0, 0, 0},
- {-1, 4, -11, 123, 18, -7, 3, -1},
- {-2, 7, -19, 113, 38, -14, 6, -2},
- {-3, 9, -22, 98, 59, -19, 8, -3},
- {-3, 9, -22, 80, 80, -22, 9, -3},
- {-3, 8, -19, 59, 98, -22, 9, -3},
- {-2, 6, -14, 38, 113, -19, 7, -2},
- {-1, 3, -7, 18, 123, -11, 4, -1}
#endif
};
-#else
+
+#if EDGE_PIXEL_FILTER > 0
+
+#define EDGE_SIMPLE_THRESH 128
+#define EDGE_GRAD_THRESH 128
+#define EDGE_GRADS2X2_THRESH 4
+/* TODO: Refine these filters */
+DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters_ns[64][4*EDGE_PIXEL_FILTER_EXTEND*EDGE_PIXEL_FILTER_EXTEND]) =
+{
+#if EDGE_PIXEL_FILTER_EXTEND == 4
+ {0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, -8, 124, 13, -1, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, -11, 112, 30, -3, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, -11, 94, 51, -6, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, -9, 73, 73, -9, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, -6, 51, 94, -11, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, -3, 30, 112, -11, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, -1, 13, 124, -8, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, -8, 0, 0, 0, 124, 0, 0, 0, 13, 0, 0, 0, -1, 0, 0},
+ {0, -8, -1, 0, -7, 120, 12, 0, -1, 12, 1, 0, 0, 0, 0, 0},
+ {1, -7, -2, 0, -11, 108, 29, -3, -1, 11, 3, 0, 0, 0, 0, 0},
+ {0, -6, -3, 0, -10, 91, 49, -6, -1, 9, 5, 0, 0, 0, 0, 0},
+ {0, -4, -4, 0, -8, 70, 70, -8, -1, 7, 7, -1, 0, 0, 0, 0},
+ {0, -3, -6, 0, -6, 49, 91, -10, 0, 5, 9, -1, 0, 0, 0, 0},
+ {0, -2, -7, 1, -3, 29, 108, -11, 0, 3, 11, -1, 0, 0, 0, 0},
+ {0, -1, -8, 0, 0, 12, 120, -7, 0, 1, 12, -1, 0, 0, 0, 0},
+ {0, -11, 0, 0, 0, 112, 0, 0, 0, 30, 0, 0, 0, -3, 0, 0},
+ {1, -11, -1, 0, -7, 108, 11, 0, -2, 29, 3, 0, 0, -3, 0, 0},
+ {1, -10, -2, 0, -10, 98, 26, -3, -2, 26, 7, 0, 0, -3, 0, 0},
+ {1, -8, -4, 0, -10, 82, 44, -5, -2, 22, 12, -1, 0, -2, -1, 0},
+ {0, -6, -6, 0, -7, 64, 64, -7, -2, 17, 17, -2, 0, -2, -2, 0},
+ {0, -4, -8, 1, -5, 44, 82, -10, -1, 12, 22, -2, 0, -1, -2, 0},
+ {0, -2, -10, 1, -3, 26, 98, -10, 0, 7, 26, -2, 0, 0, -3, 0},
+ {0, -1, -11, 1, 0, 11, 108, -7, 0, 3, 29, -2, 0, 0, -3, 0},
+ {0, -11, 0, 0, 0, 94, 0, 0, 0, 51, 0, 0, 0, -6, 0, 0},
+ {0, -10, -1, 0, -6, 91, 9, 0, -3, 49, 5, 0, 0, -6, 0, 0},
+ {1, -10, -2, 0, -8, 82, 22, -2, -4, 44, 12, -1, 0, -5, -1, 0},
+ {0, -8, -4, 0, -8, 70, 37, -4, -4, 37, 20, -2, 0, -4, -2, 0},
+ {0, -6, -6, 0, -6, 54, 54, -6, -3, 28, 28, -3, 0, -3, -3, 0},
+ {0, -4, -8, 0, -4, 37, 70, -8, -2, 20, 37, -4, 0, -2, -4, 0},
+ {0, -2, -10, 1, -2, 22, 82, -8, -1, 12, 44, -4, 0, -1, -5, 0},
+ {0, -1, -10, 0, 0, 9, 91, -6, 0, 5, 49, -3, 0, 0, -6, 0},
+ {0, -9, 0, 0, 0, 73, 0, 0, 0, 73, 0, 0, 0, -9, 0, 0},
+ {0, -8, -1, 0, -4, 70, 7, 0, -4, 70, 7, 0, 0, -8, -1, 0},
+ {0, -7, -2, 0, -6, 64, 17, -2, -6, 64, 17, -2, 0, -7, -2, 0},
+ {0, -6, -3, 0, -6, 54, 28, -3, -6, 54, 28, -3, 0, -6, -3, 0},
+ {0, -5, -5, 0, -5, 42, 42, -5, -5, 42, 42, -5, 0, -5, -5, 0},
+ {0, -3, -6, 0, -3, 28, 54, -6, -3, 28, 54, -6, 0, -3, -6, 0},
+ {0, -2, -7, 0, -2, 17, 64, -6, -2, 17, 64, -6, 0, -2, -7, 0},
+ {0, -1, -8, 0, 0, 7, 70, -4, 0, 7, 70, -4, 0, -1, -8, 0},
+ {0, -6, 0, 0, 0, 51, 0, 0, 0, 94, 0, 0, 0, -11, 0, 0},
+ {0, -6, 0, 0, -3, 49, 5, 0, -6, 91, 9, 0, 0, -10, -1, 0},
+ {0, -5, -1, 0, -4, 44, 12, -1, -8, 82, 22, -2, 1, -10, -2, 0},
+ {0, -4, -2, 0, -4, 37, 20, -2, -8, 70, 37, -4, 0, -8, -4, 0},
+ {0, -3, -3, 0, -3, 28, 28, -3, -6, 54, 54, -6, 0, -6, -6, 0},
+ {0, -2, -4, 0, -2, 20, 37, -4, -4, 37, 70, -8, 0, -4, -8, 0},
+ {0, -1, -5, 0, -1, 12, 44, -4, -2, 22, 82, -8, 0, -2, -10, 1},
+ {0, 0, -6, 0, 0, 5, 49, -3, 0, 9, 91, -6, 0, -1, -10, 0},
+ {0, -3, 0, 0, 0, 30, 0, 0, 0, 112, 0, 0, 0, -11, 0, 0},
+ {0, -3, 0, 0, -2, 29, 3, 0, -7, 108, 11, 0, 1, -11, -1, 0},
+ {0, -3, 0, 0, -2, 26, 7, 0, -10, 98, 26, -3, 1, -10, -2, 0},
+ {0, -2, -1, 0, -2, 22, 12, -1, -10, 82, 44, -5, 1, -8, -4, 0},
+ {0, -2, -2, 0, -2, 17, 17, -2, -7, 64, 64, -7, 0, -6, -6, 0},
+ {0, -1, -2, 0, -1, 12, 22, -2, -5, 44, 82, -10, 0, -4, -8, 1},
+ {0, 0, -3, 0, 0, 7, 26, -2, -3, 26, 98, -10, 0, -2, -10, 1},
+ {0, 0, -3, 0, 0, 3, 29, -2, 0, 11, 108, -7, 0, -1, -11, 1},
+ {0, -1, 0, 0, 0, 13, 0, 0, 0, 124, 0, 0, 0, -8, 0, 0},
+ {0, 0, 0, 0, -1, 12, 1, 0, -8, 120, 12, 0, 0, -7, -1, 0},
+ {0, 0, 0, 0, -1, 11, 3, 0, -11, 108, 29, -3, 1, -7, -2, 0},
+ {0, 0, 0, 0, -1, 9, 5, 0, -10, 91, 49, -6, 0, -6, -3, 0},
+ {0, 0, 0, 0, -1, 7, 7, -1, -8, 70, 70, -8, 0, -4, -4, 0},
+ {0, 0, 0, 0, 0, 5, 9, -1, -6, 49, 91, -10, 0, -3, -6, 0},
+ {0, 0, 0, 0, 0, 3, 11, -1, -3, 29, 108, -11, 0, -2, -7, 1},
+ {0, 0, 0, 0, 0, 1, 12, -1, 0, 12, 120, -8, 0, -1, -7, 0}
+#elif EDGE_PIXEL_FILTER_EXTEND == 6
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -11, 124, 15, -4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, -17, 114, 34, -9, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, -19, 98, 56, -14, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, -18, 78, 78, -18, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -14, 56, 98, -19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -9, 34, 114, -17, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -4, 15, 124, -11, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 3, 0, 0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 1, 0, 0, 0},
+ {0, 0, 3, 0, 0, 0, 0, 1, -11, -1, 0, 0, 3, -11, 121, 15, -4, 0, 0, -1, 15, 2, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 3, 1, 0, 0, 0, 1, -10, -3, 1, 0, 4, -17, 111, 34, -9, 2, 0, -2, 14, 4, -1, 0, 0, 0, -4, -1, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 2, 1, 0, 0, 0, 2, -8, -5, 1, 0, 4, -18, 95, 54, -13, 3, 0, -2, 12, 7, -2, 0, 0, 0, -3, -2, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 2, 2, 0, 0, 0, 1, -7, -7, 1, 0, 4, -17, 76, 76, -17, 4, 0, -2, 9, 9, -2, 0, 0, 0, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 1, 2, 0, 0, 0, 1, -5, -8, 2, 0, 3, -13, 54, 95, -18, 4, 0, -2, 7, 12, -2, 0, 0, 0, -2, -3, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 1, 3, 0, 0, 0, 1, -3, -10, 1, 0, 2, -9, 34, 111, -17, 4, 0, -1, 4, 14, -2, 0, 0, 0, -1, -4, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 0, 3, 0, 0, 0, 0, -1, -11, 1, 0, 0, -4, 15, 121, -11, 3, 0, 0, 2, 15, -1, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 0, 0, 0},
+ {0, 0, 4, 0, 0, 0, 0, 0, -17, 0, 0, 0, 0, 0, 114, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, -9, 0, 0, 0, 0, 0, 2, 0, 0, 0},
+ {0, 0, 4, 0, 0, 0, 0, 1, -17, -2, 0, 0, 3, -10, 111, 14, -4, 0, 1, -3, 34, 4, -1, 0, 0, 1, -9, -1, 0, 0, 0, 0, 2, 0, 0, 0},
+ {0, 0, 4, 1, 0, 0, -1, 2, -15, -5, 1, 0, 4, -15, 101, 31, -8, 1, 1, -5, 31, 9, -2, 0, 0, 1, -8, -2, 1, 0, 0, 0, 1, 0, 0, 0},
+ {0, -1, 3, 2, 0, 0, -1, 2, -13, -7, 2, 0, 4, -17, 87, 50, -12, 2, 1, -5, 26, 15, -4, 1, 0, 1, -7, -4, 1, 0, 0, 0, 1, 1, 0, 0},
+ {0, -1, 3, 3, -1, 0, 0, 2, -10, -10, 2, 0, 3, -16, 69, 69, -16, 3, 1, -5, 21, 21, -5, 1, 0, 1, -5, -5, 1, 0, 0, 0, 1, 1, 0, 0},
+ {0, 0, 2, 3, -1, 0, 0, 2, -7, -13, 2, -1, 2, -12, 50, 87, -17, 4, 1, -4, 15, 26, -5, 1, 0, 1, -4, -7, 1, 0, 0, 0, 1, 1, 0, 0},
+ {0, 0, 1, 4, 0, 0, 0, 1, -5, -15, 2, -1, 1, -8, 31, 101, -15, 4, 0, -2, 9, 31, -5, 1, 0, 1, -2, -8, 1, 0, 0, 0, 0, 1, 0, 0},
+ {0, 0, 0, 4, 0, 0, 0, 0, -2, -17, 1, 0, 0, -4, 14, 111, -10, 3, 0, -1, 4, 34, -3, 1, 0, 0, -1, -9, 1, 0, 0, 0, 0, 2, 0, 0},
+ {0, 0, 4, 0, 0, 0, 0, 0, -19, 0, 0, 0, 0, 0, 98, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, -14, 0, 0, 0, 0, 0, 3, 0, 0, 0},
+ {0, 0, 4, 0, 0, 0, 0, 2, -18, -2, 0, 0, 2, -8, 95, 12, -3, 0, 1, -5, 54, 7, -2, 0, 0, 1, -13, -2, 0, 0, 0, 0, 3, 0, 0, 0},
+ {0, -1, 4, 1, 0, 0, -1, 2, -17, -5, 1, 0, 3, -13, 87, 26, -7, 1, 2, -7, 50, 15, -4, 1, 0, 2, -12, -4, 1, 0, 0, 0, 2, 1, 0, 0},
+ {0, -1, 3, 2, 0, 0, -1, 3, -15, -8, 2, 0, 3, -15, 75, 43, -11, 2, 2, -8, 43, 24, -6, 1, 0, 2, -10, -6, 1, 0, 0, 0, 2, 1, 0, 0},
+ {0, -1, 3, 3, -1, 0, -1, 2, -12, -12, 2, -1, 3, -13, 59, 59, -13, 3, 2, -8, 34, 34, -8, 2, 0, 2, -8, -8, 2, 0, 0, 0, 2, 2, 0, 0},
+ {0, 0, 2, 3, -1, 0, 0, 2, -8, -15, 3, -1, 2, -11, 43, 75, -15, 3, 1, -6, 24, 43, -8, 2, 0, 1, -6, -10, 2, 0, 0, 0, 1, 2, 0, 0},
+ {0, 0, 1, 4, -1, 0, 0, 1, -5, -17, 2, -1, 1, -7, 26, 87, -13, 3, 1, -4, 15, 50, -7, 2, 0, 1, -4, -12, 2, 0, 0, 0, 1, 2, 0, 0},
+ {0, 0, 0, 4, 0, 0, 0, 0, -2, -18, 2, 0, 0, -3, 12, 95, -8, 2, 0, -2, 7, 54, -5, 1, 0, 0, -2, -13, 1, 0, 0, 0, 0, 3, 0, 0},
+ {0, 0, 4, 0, 0, 0, 0, 0, -18, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, -18, 0, 0, 0, 0, 0, 4, 0, 0, 0},
+ {0, 0, 4, 0, 0, 0, 0, 1, -17, -2, 0, 0, 2, -7, 76, 9, -2, 0, 2, -7, 76, 9, -2, 0, 0, 1, -17, -2, 0, 0, 0, 0, 4, 0, 0, 0},
+ {0, 0, 3, 1, 0, 0, -1, 2, -16, -5, 1, 0, 3, -10, 69, 21, -5, 1, 3, -10, 69, 21, -5, 1, -1, 2, -16, -5, 1, 0, 0, 0, 3, 1, 0, 0},
+ {0, -1, 3, 2, 0, 0, -1, 2, -13, -8, 2, 0, 3, -12, 59, 34, -8, 2, 3, -12, 59, 34, -8, 2, -1, 2, -13, -8, 2, 0, 0, -1, 3, 2, 0, 0},
+ {0, 0, 2, 2, 0, 0, 0, 2, -10, -10, 2, 0, 2, -10, 47, 47, -10, 2, 2, -11, 47, 47, -11, 2, 0, 2, -11, -11, 2, 0, 0, 0, 2, 2, 0, 0},
+ {0, 0, 2, 3, -1, 0, 0, 2, -8, -13, 2, -1, 2, -8, 34, 59, -12, 3, 2, -8, 34, 59, -12, 3, 0, 2, -8, -13, 2, -1, 0, 0, 2, 3, -1, 0},
+ {0, 0, 1, 3, 0, 0, 0, 1, -5, -16, 2, -1, 1, -5, 21, 69, -10, 3, 1, -5, 21, 69, -10, 3, 0, 1, -5, -16, 2, -1, 0, 0, 1, 3, 0, 0},
+ {0, 0, 0, 4, 0, 0, 0, 0, -2, -17, 1, 0, 0, -2, 9, 76, -7, 2, 0, -2, 9, 76, -7, 2, 0, 0, -2, -17, 1, 0, 0, 0, 0, 4, 0, 0},
+ {0, 0, 3, 0, 0, 0, 0, 0, -14, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 98, 0, 0, 0, 0, 0, -19, 0, 0, 0, 0, 0, 4, 0, 0, 0},
+ {0, 0, 3, 0, 0, 0, 0, 1, -13, -2, 0, 0, 1, -5, 54, 7, -2, 0, 2, -8, 95, 12, -3, 0, 0, 2, -18, -2, 0, 0, 0, 0, 4, 0, 0, 0},
+ {0, 0, 2, 1, 0, 0, 0, 2, -12, -4, 1, 0, 2, -7, 50, 15, -4, 1, 3, -13, 87, 26, -7, 1, -1, 2, -17, -5, 1, 0, 0, -1, 4, 1, 0, 0},
+ {0, 0, 2, 1, 0, 0, 0, 2, -11, -6, 1, 0, 2, -8, 43, 24, -6, 1, 3, -15, 75, 43, -10, 2, -1, 3, -15, -8, 2, 0, 0, -1, 3, 2, 0, 0},
+ {0, 0, 2, 2, 0, 0, 0, 2, -8, -8, 2, 0, 2, -8, 34, 34, -8, 2, 3, -13, 59, 59, -13, 3, -1, 2, -12, -12, 2, -1, 0, -1, 3, 3, -1, 0},
+ {0, 0, 1, 2, 0, 0, 0, 1, -6, -11, 2, 0, 1, -6, 24, 43, -8, 2, 2, -10, 43, 75, -15, 3, 0, 2, -8, -15, 3, -1, 0, 0, 2, 3, -1, 0},
+ {0, 0, 1, 2, 0, 0, 0, 1, -4, -12, 2, 0, 1, -4, 15, 50, -7, 2, 1, -7, 26, 87, -13, 3, 0, 1, -5, -17, 2, -1, 0, 0, 1, 4, -1, 0},
+ {0, 0, 0, 3, 0, 0, 0, 0, -2, -13, 1, 0, 0, -2, 7, 54, -5, 1, 0, -3, 12, 95, -8, 2, 0, 0, -2, -18, 2, 0, 0, 0, 0, 4, 0, 0},
+ {0, 0, 2, 0, 0, 0, 0, 0, -9, 0, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0, 114, 0, 0, 0, 0, 0, -17, 0, 0, 0, 0, 0, 4, 0, 0, 0},
+ {0, 0, 2, 0, 0, 0, 0, 1, -9, -1, 0, 0, 1, -3, 34, 4, -1, 0, 3, -10, 111, 14, -4, 0, 0, 1, -17, -2, 0, 0, 0, 0, 4, 0, 0, 0},
+ {0, 0, 1, 0, 0, 0, 0, 1, -8, -2, 1, 0, 1, -5, 31, 9, -2, 0, 4, -15, 101, 31, -8, 1, 0, 2, -15, -5, 1, 0, 0, -1, 4, 1, 0, 0},
+ {0, 0, 1, 1, 0, 0, 0, 1, -7, -4, 1, 0, 1, -5, 26, 15, -4, 1, 4, -17, 87, 50, -12, 2, -1, 2, -13, -7, 2, 0, 0, -1, 3, 2, 0, 0},
+ {0, 0, 1, 1, 0, 0, 0, 1, -5, -5, 1, 0, 1, -5, 21, 21, -5, 1, 3, -16, 69, 69, -16, 3, 0, 2, -10, -10, 2, 0, 0, -1, 3, 3, -1, 0},
+ {0, 0, 1, 1, 0, 0, 0, 1, -4, -7, 1, 0, 1, -4, 15, 26, -5, 1, 2, -12, 50, 87, -17, 4, 0, 2, -7, -13, 2, -1, 0, 0, 2, 3, -1, 0},
+ {0, 0, 0, 1, 0, 0, 0, 1, -2, -8, 1, 0, 0, -2, 9, 31, -5, 1, 1, -8, 31, 101, -15, 4, 0, 1, -5, -15, 2, 0, 0, 0, 1, 4, -1, 0},
+ {0, 0, 0, 2, 0, 0, 0, 0, -1, -9, 1, 0, 0, -1, 4, 34, -3, 1, 0, -4, 14, 111, -10, 3, 0, 0, -2, -17, 1, 0, 0, 0, 0, 4, 0, 0},
+ {0, 0, 1, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, -11, 0, 0, 0, 0, 0, 3, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, -1, 15, 2, 0, 0, 3, -11, 121, 15, -4, 0, 0, 1, -11, -1, 0, 0, 0, 0, 3, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, -4, -1, 0, 0, 0, -2, 14, 4, -1, 0, 4, -17, 111, 34, -9, 2, 0, 1, -10, -3, 1, 0, 0, 0, 3, 1, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, -3, -2, 0, 0, 0, -2, 12, 7, -2, 0, 4, -18, 95, 54, -13, 3, 0, 2, -8, -5, 1, 0, 0, 0, 2, 1, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, -2, -2, 0, 0, 0, -2, 9, 9, -2, 0, 4, -17, 76, 76, -17, 4, 0, 1, -7, -7, 1, 0, 0, 0, 2, 2, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, -2, -3, 0, 0, 0, -2, 7, 12, -2, 0, 3, -13, 54, 95, -18, 4, 0, 1, -5, -8, 2, 0, 0, 0, 1, 2, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, -1, -4, 0, 0, 0, -1, 4, 14, -2, 0, 2, -9, 34, 111, -17, 4, 0, 1, -3, -10, 1, 0, 0, 0, 1, 3, 0, 0},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0, 0, 0, 0, 2, 15, -1, 0, 0, -4, 15, 121, -11, 3, 0, 0, -1, -11, 1, 0, 0, 0, 0, 3, 0, 0}
+#endif
+};
+
+#endif // EDGE_PIXEL_FILTER
+
+#else // CONFIG_ENHANCED_INTERP
+
DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters[8][6]) =
{
@@ -81,7 +227,7 @@ DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters[8][6]) =
{ 1, -8, 36, 108, -11, 2 }, /* New 1/4 pel 6 tap filter */
{ 0, -1, 12, 123, -6, 0 },
};
-#endif
+#endif // CONFIG_ENHANCED_INTERP
static void filter_block2d_first_pass
(
@@ -221,6 +367,224 @@ static void filter_block2d_second_pass
}
}
+#if EDGE_PIXEL_FILTER > 0
+static void filter_non_separable
+(
+
+ unsigned char *src_ptr,
+ unsigned char *output_ptr,
+ unsigned int src_pixels_per_line,
+ unsigned int pixel_step,
+ const short *vp8_filter
+)
+{
+ int Temp;
+#if EDGE_PIXEL_FILTER_EXTEND == 2
+ /* This code computes non-separable filtering of a pixel
+ * using a 4x4 neighborhood as shown where F is the pixel
+ * that src_ptr points to:
+ *
+ * A B C D
+ * E F G H
+ * I J K L
+ * M N O P
+ *
+ * The 16 filter coefficients are in row by row order
+ * */
+ Temp = ((int)src_ptr[-1 * (int)src_pixels_per_line - 1 * (int)pixel_step] * vp8_filter[0]) +
+ ((int)src_ptr[-1 * (int)src_pixels_per_line + 0 * (int)pixel_step] * vp8_filter[1]) +
+ ((int)src_ptr[-1 * (int)src_pixels_per_line + 1 * (int)pixel_step] * vp8_filter[2]) +
+ ((int)src_ptr[-1 * (int)src_pixels_per_line + 2 * (int)pixel_step] * vp8_filter[3]) +
+ ((int)src_ptr[ 0 * (int)src_pixels_per_line - 1 * (int)pixel_step] * vp8_filter[4]) +
+ ((int)src_ptr[ 0 * (int)src_pixels_per_line + 0 * (int)pixel_step] * vp8_filter[5]) +
+ ((int)src_ptr[ 0 * (int)src_pixels_per_line + 1 * (int)pixel_step] * vp8_filter[6]) +
+ ((int)src_ptr[ 0 * (int)src_pixels_per_line + 2 * (int)pixel_step] * vp8_filter[7]) +
+ ((int)src_ptr[ 1 * (int)src_pixels_per_line - 1 * (int)pixel_step] * vp8_filter[8]) +
+ ((int)src_ptr[ 1 * (int)src_pixels_per_line + 0 * (int)pixel_step] * vp8_filter[9]) +
+ ((int)src_ptr[ 1 * (int)src_pixels_per_line + 1 * (int)pixel_step] * vp8_filter[10]) +
+ ((int)src_ptr[ 1 * (int)src_pixels_per_line + 2 * (int)pixel_step] * vp8_filter[11]) +
+ ((int)src_ptr[ 2 * (int)src_pixels_per_line - 1 * (int)pixel_step] * vp8_filter[12]) +
+ ((int)src_ptr[ 2 * (int)src_pixels_per_line + 0 * (int)pixel_step] * vp8_filter[13]) +
+ ((int)src_ptr[ 2 * (int)src_pixels_per_line + 1 * (int)pixel_step] * vp8_filter[14]) +
+ ((int)src_ptr[ 2 * (int)src_pixels_per_line + 2 * (int)pixel_step] * vp8_filter[15]) +
+ (VP8_FILTER_WEIGHT >> 1); /* Rounding */
+#elif EDGE_PIXEL_FILTER_EXTEND == 3
+ /* This code computes non-separable filtering of a pixel
+ * using a 6x6 neighborhood as shown where O is the pixel
+ * that src_ptr points to:
+ *
+ * A B C D E F
+ * G H I J K L
+ * M N O P Q R
+ * S T U V W X
+ * Y Z a b c d
+ * e f g h i j
+ *
+ * The 36 filter coefficients are in row by row order
+ * */
+ Temp = ((int)src_ptr[-2 * (int)src_pixels_per_line - 2 * (int)pixel_step] * vp8_filter[0]) +
+ ((int)src_ptr[-2 * (int)src_pixels_per_line - 1 * (int)pixel_step] * vp8_filter[1]) +
+ ((int)src_ptr[-2 * (int)src_pixels_per_line + 0 * (int)pixel_step] * vp8_filter[2]) +
+ ((int)src_ptr[-2 * (int)src_pixels_per_line + 1 * (int)pixel_step] * vp8_filter[3]) +
+ ((int)src_ptr[-2 * (int)src_pixels_per_line + 2 * (int)pixel_step] * vp8_filter[4]) +
+ ((int)src_ptr[-2 * (int)src_pixels_per_line + 3 * (int)pixel_step] * vp8_filter[5]) +
+ ((int)src_ptr[-1 * (int)src_pixels_per_line - 2 * (int)pixel_step] * vp8_filter[6]) +
+ ((int)src_ptr[-1 * (int)src_pixels_per_line - 1 * (int)pixel_step] * vp8_filter[7]) +
+ ((int)src_ptr[-1 * (int)src_pixels_per_line + 0 * (int)pixel_step] * vp8_filter[8]) +
+ ((int)src_ptr[-1 * (int)src_pixels_per_line + 1 * (int)pixel_step] * vp8_filter[9]) +
+ ((int)src_ptr[-1 * (int)src_pixels_per_line + 2 * (int)pixel_step] * vp8_filter[10]) +
+ ((int)src_ptr[-1 * (int)src_pixels_per_line + 3 * (int)pixel_step] * vp8_filter[11]) +
+ ((int)src_ptr[ 0 * (int)src_pixels_per_line - 2 * (int)pixel_step] * vp8_filter[12]) +
+ ((int)src_ptr[ 0 * (int)src_pixels_per_line - 1 * (int)pixel_step] * vp8_filter[13]) +
+ ((int)src_ptr[ 0 * (int)src_pixels_per_line + 0 * (int)pixel_step] * vp8_filter[14]) +
+ ((int)src_ptr[ 0 * (int)src_pixels_per_line + 1 * (int)pixel_step] * vp8_filter[15]) +
+ ((int)src_ptr[ 0 * (int)src_pixels_per_line + 2 * (int)pixel_step] * vp8_filter[16]) +
+ ((int)src_ptr[ 0 * (int)src_pixels_per_line + 3 * (int)pixel_step] * vp8_filter[17]) +
+ ((int)src_ptr[ 1 * (int)src_pixels_per_line - 2 * (int)pixel_step] * vp8_filter[18]) +
+ ((int)src_ptr[ 1 * (int)src_pixels_per_line - 1 * (int)pixel_step] * vp8_filter[19]) +
+ ((int)src_ptr[ 1 * (int)src_pixels_per_line + 0 * (int)pixel_step] * vp8_filter[20]) +
+ ((int)src_ptr[ 1 * (int)src_pixels_per_line + 1 * (int)pixel_step] * vp8_filter[21]) +
+ ((int)src_ptr[ 1 * (int)src_pixels_per_line + 2 * (int)pixel_step] * vp8_filter[22]) +
+ ((int)src_ptr[ 1 * (int)src_pixels_per_line + 3 * (int)pixel_step] * vp8_filter[23]) +
+ ((int)src_ptr[ 2 * (int)src_pixels_per_line - 2 * (int)pixel_step] * vp8_filter[24]) +
+ ((int)src_ptr[ 2 * (int)src_pixels_per_line - 1 * (int)pixel_step] * vp8_filter[25]) +
+ ((int)src_ptr[ 2 * (int)src_pixels_per_line + 0 * (int)pixel_step] * vp8_filter[26]) +
+ ((int)src_ptr[ 2 * (int)src_pixels_per_line + 1 * (int)pixel_step] * vp8_filter[27]) +
+ ((int)src_ptr[ 2 * (int)src_pixels_per_line + 2 * (int)pixel_step] * vp8_filter[28]) +
+ ((int)src_ptr[ 2 * (int)src_pixels_per_line + 3 * (int)pixel_step] * vp8_filter[29]) +
+ ((int)src_ptr[ 3 * (int)src_pixels_per_line - 2 * (int)pixel_step] * vp8_filter[30]) +
+ ((int)src_ptr[ 3 * (int)src_pixels_per_line - 1 * (int)pixel_step] * vp8_filter[31]) +
+ ((int)src_ptr[ 3 * (int)src_pixels_per_line + 0 * (int)pixel_step] * vp8_filter[32]) +
+ ((int)src_ptr[ 3 * (int)src_pixels_per_line + 1 * (int)pixel_step] * vp8_filter[33]) +
+ ((int)src_ptr[ 3 * (int)src_pixels_per_line + 2 * (int)pixel_step] * vp8_filter[34]) +
+ ((int)src_ptr[ 3 * (int)src_pixels_per_line + 3 * (int)pixel_step] * vp8_filter[35]) +
+ (VP8_FILTER_WEIGHT >> 1); /* Rounding */
+#endif
+ Temp = Temp >> VP8_FILTER_SHIFT;
+
+ if (Temp < 0)
+ Temp = 0;
+ else if (Temp > 255)
+ Temp = 255;
+
+ *output_ptr = Temp;
+}
+
+static void filter_edge_pixel
+(
+ unsigned char *src_ptr,
+ unsigned char *output_ptr,
+ unsigned int src_pixels_per_line,
+ unsigned int pixel_step,
+ int xoffset,
+ int yoffset
+)
+{
+ const short *vp8_filter=vp8_sub_pel_filters_ns[xoffset+8*yoffset];
+ filter_non_separable(src_ptr, output_ptr, src_pixels_per_line, pixel_step, vp8_filter);
+}
+
+static void get_sobel_grads(unsigned char *src_ptr, int width, int height,
+ unsigned int src_pixels_per_line,
+ unsigned int *sum_g)
+{
+ /* Assume that the block always has extension of at least 1 */
+ int i, j;
+ int gx, gy, gd, ga;
+ unsigned char *prev = src_ptr-src_pixels_per_line;
+ unsigned char *prev2 = src_ptr-2*src_pixels_per_line;
+ unsigned char *curr = src_ptr;
+ unsigned char *next = src_ptr+src_pixels_per_line;
+ unsigned char *next2 = src_ptr+2*src_pixels_per_line;
+ sum_g[0] = sum_g[1] = sum_g[2] = sum_g[3] = 0;
+ for (i=0; i<height; ++i)
+ {
+ for (j=0; j<width; ++j)
+ {
+ gx = abs((prev[1]-prev[-1])+((curr[1]-curr[-1])*2)+(next[1]-next[-1]));
+ gy = abs((prev[-1]-next[-1])+((prev[0]-next[0])*2)+(prev[1]-next[1]));
+ gd = abs((curr[2]-prev2[0])+((next[1]-prev[-1])*2)+(next2[0]-curr[-2]));
+ ga = abs((curr[2]-next2[0])+((prev[1]-next[-1])*2)+(prev2[0]-curr[-2]));
+ sum_g[0] += (gx>EDGE_GRAD_THRESH*4);
+ sum_g[1] += (gy>EDGE_GRAD_THRESH*4);
+ sum_g[2] += (gd>EDGE_GRAD_THRESH*4);
+ sum_g[3] += (ga>EDGE_GRAD_THRESH*4);
+ prev++;
+ prev2++;
+ curr++;
+ next++;
+ next2++;
+ }
+ prev += src_pixels_per_line-width;
+ curr += src_pixels_per_line-width;
+ next += src_pixels_per_line-width;
+ prev2 += src_pixels_per_line-width;
+ next2 += src_pixels_per_line-width;
+ }
+}
+
+static int edge_pixel_detected(unsigned char *src_ptr, int src_pitch)
+{
+ unsigned int ng[4];
+ get_sobel_grads(src_ptr, 2, 2, src_pitch, ng);
+ return (ng[0] + ng[1] + ng[2] + ng[3] > EDGE_GRADS2X2_THRESH);
+}
+
+static int edge_pixel_detected_simple(unsigned char *src_ptr, int src_pitch)
+{
+ int gmax, gmin, gmax2, gmin2;
+ if (src_ptr[0]>src_ptr[1])
+ {
+ gmax=src_ptr[0];
+ gmin=src_ptr[1];
+ }
+ else
+ {
+ gmax=src_ptr[1];
+ gmin=src_ptr[0];
+ }
+ src_ptr += src_pitch;
+ if (src_ptr[0]>src_ptr[1])
+ {
+ gmax2=src_ptr[0];
+ gmin2=src_ptr[1];
+ }
+ else
+ {
+ gmax2=src_ptr[1];
+ gmin2=src_ptr[0];
+ }
+ if (gmax2>gmax) gmax=gmax2;
+ if (gmin2<gmin) gmin=gmin2;
+ return (gmax - gmin > EDGE_SIMPLE_THRESH);
+}
+
+void vp8_edge_pixel_interpolation
+(
+ unsigned char *src_ptr,
+ int src_pixels_per_line,
+ int width,
+ int height,
+ int xoffset,
+ int yoffset,
+ unsigned char *dst_ptr,
+ int dst_pitch
+)
+{
+ unsigned char *sp = src_ptr;
+ unsigned char *dp = dst_ptr;
+ int i, j;
+ for (i = 0; i < height; ++i, sp+=src_pixels_per_line-width, dp+=dst_pitch-width)
+ for (j = 0; j < width; ++j, ++sp, ++dp)
+ {
+ if (edge_pixel_detected(sp, src_pixels_per_line))
+ {
+ filter_edge_pixel(sp, dp, src_pixels_per_line, 1, xoffset, yoffset);
+ }
+ }
+}
+#endif // EDGE_PIXEL_FILTER
+
/*
* The only functional difference between filter_block2d_second_pass()
* and this function is that filter_block2d_second_pass() does a sixtap
@@ -337,6 +701,10 @@ void vp8_sixtap_predict_c
VFilter = vp8_sub_pel_filters[yoffset]; /* 6 tap */
filter_block2d(src_ptr, dst_ptr, src_pixels_per_line, dst_pitch, HFilter, VFilter);
+#if CONFIG_ENHANCED_INTERP && EDGE_PIXEL_FILTER > 0
+ vp8_edge_pixel_interpolation(src_ptr, src_pixels_per_line, 4, 4,
+ xoffset, yoffset, dst_ptr, dst_pitch);
+#endif
}
void vp8_sixtap_predict8x8_c
(
@@ -364,6 +732,10 @@ void vp8_sixtap_predict8x8_c
/* then filter verticaly... */
filter_block2d_second_pass(FData + 8*(INTERP_EXTEND-1), dst_ptr, dst_pitch, 8, 8, 8, 8, VFilter);
+#if CONFIG_ENHANCED_INTERP && EDGE_PIXEL_FILTER > 0
+ vp8_edge_pixel_interpolation(src_ptr, src_pixels_per_line, 8, 8,
+ xoffset, yoffset, dst_ptr, dst_pitch);
+#endif
}
void vp8_sixtap_predict_avg8x8_c
@@ -390,6 +762,10 @@ void vp8_sixtap_predict_avg8x8_c
/* then filter verticaly... */
filter_block2d_second_pass_avg(FData + 8*(INTERP_EXTEND-1), dst_ptr, dst_pitch, 8, 8, 8, 8, VFilter);
+#if CONFIG_ENHANCED_INTERP && EDGE_PIXEL_FILTER > 0
+ vp8_edge_pixel_interpolation(src_ptr, src_pixels_per_line, 8, 8,
+ xoffset, yoffset, dst_ptr, dst_pitch);
+#endif
}
void vp8_sixtap_predict8x4_c
@@ -418,6 +794,10 @@ void vp8_sixtap_predict8x4_c
/* then filter verticaly... */
filter_block2d_second_pass(FData + 8*(INTERP_EXTEND-1), dst_ptr, dst_pitch, 8, 8, 4, 8, VFilter);
+#if CONFIG_ENHANCED_INTERP && EDGE_PIXEL_FILTER > 0
+ vp8_edge_pixel_interpolation(src_ptr, src_pixels_per_line, 8, 4,
+ xoffset, yoffset, dst_ptr, dst_pitch);
+#endif
}
void vp8_sixtap_predict16x16_c
@@ -446,6 +826,10 @@ void vp8_sixtap_predict16x16_c
/* then filter verticaly... */
filter_block2d_second_pass(FData + 16*(INTERP_EXTEND-1), dst_ptr, dst_pitch, 16, 16, 16, 16, VFilter);
+#if CONFIG_ENHANCED_INTERP && EDGE_PIXEL_FILTER > 0
+ vp8_edge_pixel_interpolation(src_ptr, src_pixels_per_line, 16, 16,
+ xoffset, yoffset, dst_ptr, dst_pitch);
+#endif
}
void vp8_sixtap_predict_avg16x16_c
@@ -473,6 +857,10 @@ void vp8_sixtap_predict_avg16x16_c
/* then filter verticaly... */
filter_block2d_second_pass_avg(FData + 16*(INTERP_EXTEND-1), dst_ptr, dst_pitch,
16, 16, 16, 16, VFilter);
+#if CONFIG_ENHANCED_INTERP && EDGE_PIXEL_FILTER > 0
+ vp8_edge_pixel_interpolation(src_ptr, src_pixels_per_line, 16, 16,
+ xoffset, yoffset, dst_ptr, dst_pitch);
+#endif
}
/****************************************************************************
diff --git a/vp8/common/filter.h b/vp8/common/filter.h
index 1a4738975..6c54285df 100644
--- a/vp8/common/filter.h
+++ b/vp8/common/filter.h
@@ -18,7 +18,15 @@
#define VP8_FILTER_WEIGHT 128
#define VP8_FILTER_SHIFT 7
+/* whether to use a special filter for edge pixels */
+#define EDGE_PIXEL_FILTER 0
+
extern const short vp8_bilinear_filters[8][2];
extern const short vp8_sub_pel_filters[8][INTERP_EXTEND*2];
+#if EDGE_PIXEL_FILTER > 0
+#define EDGE_PIXEL_FILTER_EXTEND 2
+extern const short vp8_sub_pel_filters_ns[64][4*EDGE_PIXEL_FILTER_EXTEND*EDGE_PIXEL_FILTER_EXTEND];
+#endif
+
#endif //FILTER_H
diff --git a/vp8/common/reconinter.c b/vp8/common/reconinter.c
index 19198f5bd..42502ad67 100644
--- a/vp8/common/reconinter.c
+++ b/vp8/common/reconinter.c
@@ -380,28 +380,28 @@ static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
* filtering. The bottom and right edges use 16 pixels plus 2 pixels
* left of the central pixel when filtering.
*/
- if (mv->col < (xd->mb_to_left_edge - (19 << 3)))
+ if (mv->col < (xd->mb_to_left_edge - ((16+INTERP_EXTEND) << 3)))
mv->col = xd->mb_to_left_edge - (16 << 3);
- else if (mv->col > xd->mb_to_right_edge + (18 << 3))
+ else if (mv->col > xd->mb_to_right_edge + ((15+INTERP_EXTEND) << 3))
mv->col = xd->mb_to_right_edge + (16 << 3);
- if (mv->row < (xd->mb_to_top_edge - (19 << 3)))
+ if (mv->row < (xd->mb_to_top_edge - ((16+INTERP_EXTEND) << 3)))
mv->row = xd->mb_to_top_edge - (16 << 3);
- else if (mv->row > xd->mb_to_bottom_edge + (18 << 3))
+ else if (mv->row > xd->mb_to_bottom_edge + ((15+INTERP_EXTEND) << 3))
mv->row = xd->mb_to_bottom_edge + (16 << 3);
}
/* A version of the above function for chroma block MVs.*/
static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
{
- mv->col = (2*mv->col < (xd->mb_to_left_edge - (19 << 3))) ?
+ mv->col = (2*mv->col < (xd->mb_to_left_edge - ((16+INTERP_EXTEND) << 3))) ?
(xd->mb_to_left_edge - (16 << 3)) >> 1 : mv->col;
- mv->col = (2*mv->col > xd->mb_to_right_edge + (18 << 3)) ?
+ mv->col = (2*mv->col > xd->mb_to_right_edge + ((15+INTERP_EXTEND) << 3)) ?
(xd->mb_to_right_edge + (16 << 3)) >> 1 : mv->col;
- mv->row = (2*mv->row < (xd->mb_to_top_edge - (19 << 3))) ?
+ mv->row = (2*mv->row < (xd->mb_to_top_edge - ((16+INTERP_EXTEND) << 3))) ?
(xd->mb_to_top_edge - (16 << 3)) >> 1 : mv->row;
- mv->row = (2*mv->row > xd->mb_to_bottom_edge + (18 << 3)) ?
+ mv->row = (2*mv->row > xd->mb_to_bottom_edge + ((15+INTERP_EXTEND) << 3)) ?
(xd->mb_to_bottom_edge + (16 << 3)) >> 1 : mv->row;
}
@@ -682,4 +682,3 @@ void vp8_build_inter_predictors_mb(MACROBLOCKD *x)
build_inter4x4_predictors_mb(x);
}
}
-
diff --git a/vp8/encoder/arm/arm_csystemdependent.c b/vp8/encoder/arm/arm_csystemdependent.c
index 081775bfd..e66835ae0 100644
--- a/vp8/encoder/arm/arm_csystemdependent.c
+++ b/vp8/encoder/arm/arm_csystemdependent.c
@@ -56,8 +56,6 @@ void vp8_arch_arm_encoder_init(VP8_COMP *cpi)
cpi->rtcd.variance.mse16x16 = vp8_mse16x16_armv6;
/*cpi->rtcd.variance.getmbss = vp8_get_mb_ss_c;*/
- /*cpi->rtcd.variance.get4x4sse_cs = vp8_get4x4sse_cs_c;*/
-
cpi->rtcd.fdct.short4x4 = vp8_short_fdct4x4_armv6;
cpi->rtcd.fdct.short8x4 = vp8_short_fdct8x4_armv6;
cpi->rtcd.fdct.fast4x4 = vp8_short_fdct4x4_armv6;
@@ -103,8 +101,6 @@ void vp8_arch_arm_encoder_init(VP8_COMP *cpi)
cpi->rtcd.variance.mse16x16 = vp8_mse16x16_neon;
/*cpi->rtcd.variance.getmbss = vp8_get_mb_ss_c;*/
- cpi->rtcd.variance.get4x4sse_cs = vp8_get4x4sse_cs_neon;
-
cpi->rtcd.fdct.short4x4 = vp8_short_fdct4x4_neon;
cpi->rtcd.fdct.short8x4 = vp8_short_fdct8x4_neon;
cpi->rtcd.fdct.fast4x4 = vp8_short_fdct4x4_neon;
diff --git a/vp8/encoder/arm/variance_arm.h b/vp8/encoder/arm/variance_arm.h
index f2f761f9e..fdb7289b1 100644
--- a/vp8/encoder/arm/variance_arm.h
+++ b/vp8/encoder/arm/variance_arm.h
@@ -83,7 +83,6 @@ extern prototype_variance(vp8_variance_halfpixvar16x16_hv_neon);
//extern prototype_getmbss(vp8_get_mb_ss_c);
extern prototype_variance(vp8_mse16x16_neon);
-extern prototype_get16x16prederror(vp8_get4x4sse_cs_neon);
#if !CONFIG_RUNTIME_CPU_DETECT
#undef vp8_variance_sad4x4
@@ -146,8 +145,6 @@ extern prototype_get16x16prederror(vp8_get4x4sse_cs_neon);
#undef vp8_variance_mse16x16
#define vp8_variance_mse16x16 vp8_mse16x16_neon
-#undef vp8_variance_get4x4sse_cs
-#define vp8_variance_get4x4sse_cs vp8_get4x4sse_cs_neon
#endif
#endif
diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
index 62366964f..bf88cdb6a 100644
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -22,7 +22,6 @@
#include "encodeintra.h"
#include "vp8/common/reconinter.h"
#include "rdopt.h"
-#include "pickinter.h"
#include "vp8/common/findnearmv.h"
#include "vp8/common/reconintra.h"
#include "vp8/common/seg_common.h"
@@ -734,41 +733,6 @@ void encode_sb_row (VP8_COMP *cpi,
if ((xd->mode_info_context->mbmi.mode == ZEROMV) &&
(xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
cpi->inter_zz_count ++;
-
- // Actions required if segmentation enabled
- if ( xd->segmentation_enabled )
- {
- // 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
- // segmentation map
- if (cpi->cyclic_refresh_mode_enabled)
- {
- cpi->segmentation_map[map_index] =
- 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[map_index] = -1;
-
- else if ((xd->mode_info_context->mbmi.mode == ZEROMV) &&
- (xd->mode_info_context->mbmi.ref_frame ==
- LAST_FRAME))
- {
- if (cpi->cyclic_refresh_map[map_index] == 1)
- cpi->cyclic_refresh_map[map_index] = 0;
- }
- else
- cpi->cyclic_refresh_map[map_index] = 1;
- }
- }
}
// TODO Make sure partitioning works with this new scheme
@@ -949,41 +913,6 @@ void encode_mb_row(VP8_COMP *cpi,
// Count of last ref frame 0,0 usage
if ((xd->mode_info_context->mbmi.mode == ZEROMV) && (xd->mode_info_context->mbmi.ref_frame == LAST_FRAME))
cpi->inter_zz_count ++;
-
- // Actions required if segmentation enabled
- if ( xd->segmentation_enabled )
- {
- // 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
- // segmentation map
- if (cpi->cyclic_refresh_mode_enabled)
- {
- cpi->segmentation_map[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[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[map_index+mb_col] == 1)
- cpi->cyclic_refresh_map[map_index+mb_col] = 0;
- }
- else
- cpi->cyclic_refresh_map[map_index+mb_col] = 1;
- }
- }
}
cpi->tplist[mb_row].stop = *tp;
@@ -1161,14 +1090,6 @@ static void encode_frame_internal(VP8_COMP *cpi)
totalrate = 0;
- if (cpi->compressor_speed == 2)
- {
- if (cpi->oxcf.cpu_used < 0)
- cpi->Speed = -(cpi->oxcf.cpu_used);
- else
- vp8_auto_select_speed(cpi);
- }
-
// Functions setup for all frame types so we can use MC in AltRef
if (cm->mcomp_filter_type == SIXTAP)
{
@@ -1395,23 +1316,7 @@ void vp8_encode_frame(VP8_COMP *cpi)
cpi->rd_prediction_type_threshes[frame_type][2] += hybrid_diff;
cpi->rd_prediction_type_threshes[frame_type][2] >>= 1;
- /* FIXME make "100" (the threshold at which to re-encode the
- * current frame) a commandline option. */
- if (cpi->common.dual_pred_mode == SINGLE_PREDICTION_ONLY &&
- (dual_diff >= 100 || hybrid_diff >= 100))
- {
- redo = 1;
- cpi->common.dual_pred_mode = cpi->rd_dual_diff > cpi->rd_hybrid_diff ?
- DUAL_PREDICTION_ONLY : HYBRID_PREDICTION;
- }
- else if (cpi->common.dual_pred_mode == DUAL_PREDICTION_ONLY &&
- (single_diff >= 100 || hybrid_diff >= 100))
- {
- redo = 1;
- cpi->common.dual_pred_mode = cpi->rd_single_diff > cpi->rd_hybrid_diff ?
- SINGLE_PREDICTION_ONLY : HYBRID_PREDICTION;
- }
- else if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
+ if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
{
int single_count_zero = 0;
int dual_count_zero = 0;
@@ -1431,39 +1336,6 @@ void vp8_encode_frame(VP8_COMP *cpi)
{
cpi->common.dual_pred_mode = DUAL_PREDICTION_ONLY;
}
- else if (single_diff >= 100 || dual_diff >= 100)
- {
- redo = 1;
- cpi->common.dual_pred_mode = cpi->rd_single_diff > cpi->rd_dual_diff ?
- SINGLE_PREDICTION_ONLY : DUAL_PREDICTION_ONLY;
- }
- }
-
- if (redo)
- {
- encode_frame_internal(cpi);
-
- if (cpi->common.dual_pred_mode == HYBRID_PREDICTION)
- {
- int single_count_zero = 0;
- int dual_count_zero = 0;
- int i;
-
- for ( i = 0; i < DUAL_PRED_CONTEXTS; i++ )
- {
- single_count_zero += cpi->single_pred_count[i];
- dual_count_zero += cpi->dual_pred_count[i];
- }
-
- if (dual_count_zero == 0)
- {
- cpi->common.dual_pred_mode = SINGLE_PREDICTION_ONLY;
- }
- else if (single_count_zero == 0)
- {
- cpi->common.dual_pred_mode = DUAL_PREDICTION_ONLY;
- }
- }
}
}
else
@@ -1628,10 +1500,11 @@ int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t)
{
int rate;
- if (cpi->sf.RD && cpi->compressor_speed != 2)
- vp8_rd_pick_intra_mode(cpi, x, &rate);
- else
- vp8_pick_intra_mode(cpi, x, &rate);
+ // Non rd path deprecated in test code base
+ //if (cpi->sf.RD && cpi->compressor_speed != 2)
+ vp8_rd_pick_intra_mode(cpi, x, &rate);
+ //else
+ // vp8_pick_intra_mode(cpi, x, &rate);
if(cpi->oxcf.tuning == VP8_TUNE_SSIM)
{
@@ -1700,7 +1573,8 @@ int vp8cx_encode_inter_macroblock
else
x->encode_breakout = cpi->oxcf.encode_breakout;
- if (cpi->sf.RD)
+ //if (cpi->sf.RD)
+ // For now this codebase is limited to a single rd encode path
{
int zbin_mode_boost_enabled = cpi->zbin_mode_boost_enabled;
int single, dual, hybrid;
@@ -1764,9 +1638,10 @@ int vp8cx_encode_inter_macroblock
cpi->zbin_mode_boost_enabled = zbin_mode_boost_enabled;
}
- else
- vp8_pick_inter_mode(cpi, x, recon_yoffset, recon_uvoffset, &rate,
- &distortion, &intra_error);
+ //else
+ // The non rd encode path has been deleted from this code base
+ // to simplify development
+ // vp8_pick_inter_mode
cpi->prediction_error += distortion;
cpi->intra_error += intra_error;
@@ -1777,49 +1652,6 @@ int vp8cx_encode_inter_macroblock
adjust_act_zbin( cpi, x );
}
-#if 0
- // Experimental RD code
- cpi->frame_distortion += distortion;
- cpi->last_mb_distortion = distortion;
-#endif
-
- // MB level adjutment to quantizer setup
- if (xd->segmentation_enabled)
- {
- // If cyclic update enabled
- if (cpi->cyclic_refresh_mode_enabled)
- {
- // Clear segment_id back to 0 if not coded (last frame 0,0)
- if ( (*segment_id == 1) &&
- ( (xd->mode_info_context->mbmi.ref_frame != LAST_FRAME) ||
- (xd->mode_info_context->mbmi.mode != ZEROMV) ) )
- {
- *segment_id = 0;
-
- /* segment_id changed, so update */
- vp8cx_mb_init_quantizer(cpi, x);
- }
- }
- else
- {
- //segfeature_test_function(cpi, xd);
-#if DBG_PRNT_SEGMAP
- // Debug output
- {
- FILE *statsfile;
- statsfile = fopen("segmap2.stt", "a");
-
- fprintf(statsfile, "%2d%2d%2d ",
- *segment_id,
- xd->mode_info_context->mbmi.ref_frame,
- xd->mode_info_context->mbmi.mode );
-
- fclose(statsfile);
- }
-#endif
- }
- }
-
{
// Experimental code. Special case for gf and arf zeromv modes.
// Increase zbin size to supress noise
diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
index 19ae70684..5c944ee1d 100644
--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -1002,7 +1002,7 @@ static int estimate_max_q(VP8_COMP *cpi,
// Corrections for higher compression speed settings
// (reduced compression expected)
- if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
+ if (cpi->compressor_speed == 1)
{
if (cpi->oxcf.cpu_used <= 5)
speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
@@ -1105,7 +1105,7 @@ static int estimate_cq( VP8_COMP *cpi,
// Corrections for higher compression speed settings
// (reduced compression expected)
- if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
+ if (cpi->compressor_speed == 1)
{
if (cpi->oxcf.cpu_used <= 5)
speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
@@ -1173,7 +1173,7 @@ static int estimate_q(VP8_COMP *cpi, double section_err, int section_target_band
target_norm_bits_per_mb = (section_target_bandwitdh < (1 << 20)) ? (512 * section_target_bandwitdh) / num_mbs : 512 * (section_target_bandwitdh / num_mbs);
// Corrections for higher compression speed settings (reduced compression expected)
- if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
+ if (cpi->compressor_speed == 1)
{
if (cpi->oxcf.cpu_used <= 5)
speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
@@ -1246,7 +1246,7 @@ static int estimate_kf_group_q(VP8_COMP *cpi, double section_err, int section_ta
iiratio_correction_factor = 0.5;
// Corrections for higher compression speed settings (reduced compression expected)
- if ((cpi->compressor_speed == 3) || (cpi->compressor_speed == 1))
+ if (cpi->compressor_speed == 1)
{
if (cpi->oxcf.cpu_used <= 5)
speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04);
diff --git a/vp8/encoder/generic/csystemdependent.c b/vp8/encoder/generic/csystemdependent.c
index 349a028d6..b6fc0dc9b 100644
--- a/vp8/encoder/generic/csystemdependent.c
+++ b/vp8/encoder/generic/csystemdependent.c
@@ -69,8 +69,6 @@ void vp8_cmachine_specific_config(VP8_COMP *cpi)
cpi->rtcd.variance.mse16x16 = vp8_mse16x16_c;
cpi->rtcd.variance.getmbss = vp8_get_mb_ss_c;
- cpi->rtcd.variance.get4x4sse_cs = vp8_get4x4sse_cs_c;
-
#if CONFIG_T8X8
cpi->rtcd.fdct.short8x8 = vp8_short_fdct8x8_c;
cpi->rtcd.fdct.haar_short2x2 = vp8_short_fhaar2x2_c;
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index c2f7e92e7..8a2fb8448 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -369,68 +369,6 @@ static void dealloc_compressor_data(VP8_COMP *cpi)
cpi->twopass.this_frame_stats = 0;
}
-static void segmentation_test_function(VP8_PTR ptr)
-{
- VP8_COMP *cpi = (VP8_COMP *)(ptr);
- unsigned char *seg_map;
- signed char feature_data[SEG_LVL_MAX][MAX_MB_SEGMENTS];
- MACROBLOCKD *xd = &cpi->mb.e_mbd;
-
- CHECK_MEM_ERROR(seg_map, vpx_calloc((cpi->common.mb_rows * cpi->common.mb_cols), 1));
-
- // Create a temporary map for segmentation data.
-
- // MB loop to set local segmentation map
- /*for ( i = 0; i < cpi->common.mb_rows; i++ )
- {
- for ( j = 0; j < cpi->common.mb_cols; j++ )
- {
- //seg_map[(i*cpi->common.mb_cols) + j] = (j % 2) + ((i%2)* 2);
- //if ( j < cpi->common.mb_cols/2 )
-
- // Segment 1 around the edge else 0
- if ( (i == 0) || (j == 0) || (i == (cpi->common.mb_rows-1)) || (j == (cpi->common.mb_cols-1)) )
- seg_map[(i*cpi->common.mb_cols) + j] = 1;
- //else if ( (i < 2) || (j < 2) || (i > (cpi->common.mb_rows-3)) || (j > (cpi->common.mb_cols-3)) )
- // seg_map[(i*cpi->common.mb_cols) + j] = 2;
- //else if ( (i < 5) || (j < 5) || (i > (cpi->common.mb_rows-6)) || (j > (cpi->common.mb_cols-6)) )
- // seg_map[(i*cpi->common.mb_cols) + j] = 3;
- else
- seg_map[(i*cpi->common.mb_cols) + j] = 0;
- }
- }*/
-
- // Set the segmentation Map
- vp8_set_segmentation_map(ptr, seg_map);
-
- // Activate segmentation.
- vp8_enable_segmentation(ptr);
-
- // Set up the quant segment data
- feature_data[SEG_LVL_ALT_Q][0] = 0;
- feature_data[SEG_LVL_ALT_Q][1] = 4;
- feature_data[SEG_LVL_ALT_Q][2] = 0;
- feature_data[SEG_LVL_ALT_Q][3] = 0;
- // Set up the loop segment data
- feature_data[SEG_LVL_ALT_LF][0] = 0;
- feature_data[SEG_LVL_ALT_LF][1] = 0;
- feature_data[SEG_LVL_ALT_LF][2] = 0;
- feature_data[SEG_LVL_ALT_LF][3] = 0;
-
- // Enable features as required
- enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
-
- // Initialise the feature data structure
- // SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1
- vp8_set_segment_data(ptr, &feature_data[0][0], SEGMENT_DELTADATA);
-
- // Delete sementation map
- vpx_free(seg_map);
-
- seg_map = 0;
-
-}
-
// Computes a q delta (in "q index" terms) to get from a starting q value
// to a target value
// target q value
@@ -468,15 +406,6 @@ static void init_seg_features(VP8_COMP *cpi)
int high_q = (int)(cpi->avg_q > 48.0);
int qi_delta;
- // For now at least dont enable seg features alongside cyclic refresh.
- if ( cpi->cyclic_refresh_mode_enabled ||
- (cpi->pass != 2) )
- {
- vp8_disable_segmentation((VP8_PTR)cpi);
- vpx_memset( cpi->segmentation_map, 0, (cm->mb_rows * cm->mb_cols));
- return;
- }
-
// Disable and clear down for KF
if ( cm->frame_type == KEY_FRAME )
{
@@ -665,104 +594,6 @@ static void print_seg_map(VP8_COMP *cpi)
fclose(statsfile);
}
-// A simple function to cyclically refresh the background at a lower Q
-static void cyclic_background_refresh(VP8_COMP *cpi, int Q, int lf_adjustment)
-{
- unsigned char *seg_map;
- signed char feature_data[SEG_LVL_MAX][MAX_MB_SEGMENTS];
- int i;
- int block_count = cpi->cyclic_refresh_mode_max_mbs_perframe;
- int mbs_in_frame = cpi->common.mb_rows * cpi->common.mb_cols;
- MACROBLOCKD *xd = &cpi->mb.e_mbd;
-
- // Create a temporary map for segmentation data.
- CHECK_MEM_ERROR(seg_map, vpx_calloc((cpi->common.mb_rows * cpi->common.mb_cols), 1));
-
- cpi->cyclic_refresh_q = Q;
-
- for (i = Q; i > 0; i--)
- {
- if ( vp8_bits_per_mb(cpi->common.frame_type, i) >=
- ((vp8_bits_per_mb(cpi->common.frame_type, Q)*(Q + 128)) / 64))
- {
- break;
- }
- }
-
- cpi->cyclic_refresh_q = i;
-
- // Only update for inter frames
- if (cpi->common.frame_type != KEY_FRAME)
- {
- // Cycle through the macro_block rows
- // MB loop to set local segmentation map
- for (i = cpi->cyclic_refresh_mode_index; i < mbs_in_frame; i++)
- {
- // If the MB is as a candidate for clean up then mark it for possible boost/refresh (segment 1)
- // The segment id may get reset to 0 later if the MB gets coded anything other than last frame 0,0
- // as only (last frame 0,0) MBs are eligable for refresh : that is to say Mbs likely to be background blocks.
- if (cpi->cyclic_refresh_map[i] == 0)
- {
- seg_map[i] = 1;
- }
- else
- {
- seg_map[i] = 0;
-
- // Skip blocks that have been refreshed recently anyway.
- if (cpi->cyclic_refresh_map[i] < 0)
- //cpi->cyclic_refresh_map[i] = cpi->cyclic_refresh_map[i] / 16;
- cpi->cyclic_refresh_map[i]++;
- }
-
-
- if (block_count > 0)
- block_count--;
- else
- break;
-
- }
-
- // If we have gone through the frame reset to the start
- cpi->cyclic_refresh_mode_index = i;
-
- if (cpi->cyclic_refresh_mode_index >= mbs_in_frame)
- cpi->cyclic_refresh_mode_index = 0;
- }
-
- // Set the segmentation Map
- vp8_set_segmentation_map((VP8_PTR)cpi, seg_map);
-
- // Activate segmentation.
- vp8_enable_segmentation((VP8_PTR)cpi);
-
- // Set up the quant segment data
- feature_data[SEG_LVL_ALT_Q][0] = 0;
- feature_data[SEG_LVL_ALT_Q][1] = (cpi->cyclic_refresh_q - Q);
- feature_data[SEG_LVL_ALT_Q][2] = 0;
- feature_data[SEG_LVL_ALT_Q][3] = 0;
-
- // Set up the loop segment data
- feature_data[SEG_LVL_ALT_LF][0] = 0;
- feature_data[SEG_LVL_ALT_LF][1] = lf_adjustment;
- feature_data[SEG_LVL_ALT_LF][2] = 0;
- feature_data[SEG_LVL_ALT_LF][3] = 0;
-
- // Enable the loop and quant changes in the feature mask
- enable_segfeature(xd, 1, SEG_LVL_ALT_Q);
- enable_segfeature(xd, 1, SEG_LVL_ALT_LF);
-
- // Initialise the feature data structure
- // SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1
- vp8_set_segment_data((VP8_PTR)cpi, &feature_data[0][0], SEGMENT_DELTADATA);
-
- // Delete sementation map
- vpx_free(seg_map);
-
- seg_map = 0;
-
-}
-
static void set_default_lf_deltas(VP8_COMP *cpi)
{
cpi->mb.e_mbd.mode_ref_lf_delta_enabled = 1;
@@ -792,6 +623,10 @@ void vp8_set_speed_features(VP8_COMP *cpi)
VP8_COMMON *cm = &cpi->common;
int last_improved_quant = sf->improved_quant;
+ // Only modes 0 and 1 supported for now in experimental code basae
+ if ( Mode > 1 )
+ Mode = 1;
+
// Initialise default mode frequency sampling variables
for (i = 0; i < MAX_MODES; i ++)
{
@@ -871,7 +706,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->max_step_search_steps = MAX_MVSEARCH_STEPS;
break;
case 1:
- case 3:
sf->thresh_mult[THR_NEARESTMV] = 0;
sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_DC ] = 0;
@@ -890,7 +724,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_NEARG ] = 1000;
sf->thresh_mult[THR_NEARA ] = 1000;
-#if 1
sf->thresh_mult[THR_ZEROMV ] = 0;
sf->thresh_mult[THR_ZEROG ] = 0;
sf->thresh_mult[THR_ZEROA ] = 0;
@@ -901,13 +734,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_NEARG ] = 0;
sf->thresh_mult[THR_NEARA ] = 0;
-// sf->thresh_mult[THR_DC ] = 0;
-
-// sf->thresh_mult[THR_V_PRED ] = 1000;
-// sf->thresh_mult[THR_H_PRED ] = 1000;
-// sf->thresh_mult[THR_B_PRED ] = 2000;
-// sf->thresh_mult[THR_TM ] = 1000;
-
sf->thresh_mult[THR_NEWMV ] = 1000;
sf->thresh_mult[THR_NEWG ] = 1000;
sf->thresh_mult[THR_NEWA ] = 1000;
@@ -929,15 +755,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
sf->thresh_mult[THR_DUAL_NEWLG ] = 1000;
sf->thresh_mult[THR_DUAL_NEWLA ] = 1000;
sf->thresh_mult[THR_DUAL_NEWGA ] = 1000;
-#else
- sf->thresh_mult[THR_NEWMV ] = 1500;
- sf->thresh_mult[THR_NEWG ] = 1500;
- sf->thresh_mult[THR_NEWA ] = 1500;
-
- sf->thresh_mult[THR_SPLITMV ] = 5000;
- sf->thresh_mult[THR_SPLITG ] = 10000;
- sf->thresh_mult[THR_SPLITA ] = 10000;
-#endif
if (Speed > 0)
{
@@ -1063,453 +880,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
}
- if (Speed > 3)
- {
- sf->thresh_mult[THR_SPLITA ] = INT_MAX;
- sf->thresh_mult[THR_SPLITG ] = INT_MAX;
- sf->thresh_mult[THR_SPLITMV ] = INT_MAX;
-
- cpi->mode_check_freq[THR_V_PRED] = 0;
- cpi->mode_check_freq[THR_H_PRED] = 0;
- cpi->mode_check_freq[THR_B_PRED] = 0;
- cpi->mode_check_freq[THR_I8X8_PRED] = 0;
- cpi->mode_check_freq[THR_NEARG] = 0;
- cpi->mode_check_freq[THR_NEWG] = 0;
- cpi->mode_check_freq[THR_NEARA] = 0;
- cpi->mode_check_freq[THR_NEWA] = 0;
-
- sf->auto_filter = 1;
- sf->recode_loop = 0; // recode loop off
- sf->RD = 0; // Turn rd off
-
- }
-
- if (Speed > 4)
- {
- sf->auto_filter = 0; // Faster selection of loop filter
-
- cpi->mode_check_freq[THR_V_PRED] = 2;
- cpi->mode_check_freq[THR_H_PRED] = 2;
- cpi->mode_check_freq[THR_B_PRED] = 2;
- cpi->mode_check_freq[THR_I8X8_PRED]=2;
-
- if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
- {
- cpi->mode_check_freq[THR_NEARG] = 2;
- cpi->mode_check_freq[THR_NEWG] = 4;
- }
-
- if (cpi->ref_frame_flags & VP8_ALT_FLAG)
- {
- cpi->mode_check_freq[THR_NEARA] = 2;
- cpi->mode_check_freq[THR_NEWA] = 4;
- }
-
- cpi->mode_check_freq[THR_DUAL_NEARLG ] = 2;
- cpi->mode_check_freq[THR_DUAL_NEARLA ] = 2;
- cpi->mode_check_freq[THR_DUAL_NEARGA ] = 2;
- cpi->mode_check_freq[THR_DUAL_NEWLG ] = 4;
- cpi->mode_check_freq[THR_DUAL_NEWLA ] = 4;
- cpi->mode_check_freq[THR_DUAL_NEWGA ] = 4;
-
- if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
- {
- sf->thresh_mult[THR_NEARESTG ] = 2000;
- sf->thresh_mult[THR_ZEROG ] = 2000;
- sf->thresh_mult[THR_NEARG ] = 2000;
- sf->thresh_mult[THR_NEWG ] = 4000;
- }
-
- if (cpi->ref_frame_flags & VP8_ALT_FLAG)
- {
- sf->thresh_mult[THR_NEARESTA ] = 2000;
- sf->thresh_mult[THR_ZEROA ] = 2000;
- sf->thresh_mult[THR_NEARA ] = 2000;
- sf->thresh_mult[THR_NEWA ] = 4000;
- }
-
- sf->thresh_mult[THR_DUAL_NEWLG ] = 4000;
- sf->thresh_mult[THR_DUAL_NEWLA ] = 4000;
- sf->thresh_mult[THR_DUAL_NEWGA ] = 4000;
- }
-
break;
- case 2:
- sf->optimize_coefficients = 0;
- sf->recode_loop = 0;
- sf->auto_filter = 1;
- sf->iterative_sub_pixel = 1;
- sf->thresh_mult[THR_NEARESTMV] = 0;
- sf->thresh_mult[THR_ZEROMV ] = 0;
- sf->thresh_mult[THR_DC ] = 0;
- sf->thresh_mult[THR_TM ] = 0;
- sf->thresh_mult[THR_NEARMV ] = 0;
- sf->thresh_mult[THR_V_PRED ] = 1000;
- sf->thresh_mult[THR_H_PRED ] = 1000;
- sf->thresh_mult[THR_B_PRED ] = 2500;
- sf->thresh_mult[THR_I8X8_PRED] = 2500;
- sf->thresh_mult[THR_NEARESTG ] = 1000;
- sf->thresh_mult[THR_ZEROG ] = 1000;
- sf->thresh_mult[THR_NEARG ] = 1000;
- sf->thresh_mult[THR_NEARESTA ] = 1000;
- sf->thresh_mult[THR_ZEROA ] = 1000;
- sf->thresh_mult[THR_NEARA ] = 1000;
- sf->thresh_mult[THR_NEWMV ] = 2000;
- sf->thresh_mult[THR_NEWG ] = 2000;
- sf->thresh_mult[THR_NEWA ] = 2000;
- sf->thresh_mult[THR_SPLITMV ] = 5000;
- sf->thresh_mult[THR_SPLITG ] = 10000;
- sf->thresh_mult[THR_SPLITA ] = 10000;
- sf->search_method = NSTEP;
-
- sf->thresh_mult[THR_DUAL_ZEROLG ] = 1000;
- sf->thresh_mult[THR_DUAL_NEARESTLG] = 1000;
- sf->thresh_mult[THR_DUAL_NEARLG ] = 1000;
- sf->thresh_mult[THR_DUAL_ZEROLA ] = 1000;
- sf->thresh_mult[THR_DUAL_NEARESTLA] = 1000;
- sf->thresh_mult[THR_DUAL_NEARLA ] = 1000;
- sf->thresh_mult[THR_DUAL_ZEROGA ] = 1000;
- sf->thresh_mult[THR_DUAL_NEARESTGA] = 1000;
- sf->thresh_mult[THR_DUAL_NEARGA ] = 1000;
-
- sf->thresh_mult[THR_DUAL_NEWLG ] = 2000;
- sf->thresh_mult[THR_DUAL_NEWLA ] = 2000;
- sf->thresh_mult[THR_DUAL_NEWGA ] = 2000;
-
- if (Speed > 0)
- {
- cpi->mode_check_freq[THR_SPLITG] = 4;
- cpi->mode_check_freq[THR_SPLITA] = 4;
- cpi->mode_check_freq[THR_SPLITMV] = 2;
-
- sf->thresh_mult[THR_DC ] = 0;
- sf->thresh_mult[THR_TM ] = 1000;
- sf->thresh_mult[THR_V_PRED ] = 2000;
- sf->thresh_mult[THR_H_PRED ] = 2000;
- sf->thresh_mult[THR_B_PRED ] = 5000;
- sf->thresh_mult[THR_I8X8_PRED] = 5000;
-
- if (cpi->ref_frame_flags & VP8_LAST_FLAG)
- {
- sf->thresh_mult[THR_NEARESTMV] = 0;
- sf->thresh_mult[THR_ZEROMV ] = 0;
- sf->thresh_mult[THR_NEARMV ] = 0;
- sf->thresh_mult[THR_NEWMV ] = 2000;
- sf->thresh_mult[THR_SPLITMV ] = 10000;
- }
-
- if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
- {
- sf->thresh_mult[THR_NEARESTG ] = 1000;
- sf->thresh_mult[THR_ZEROG ] = 1000;
- sf->thresh_mult[THR_NEARG ] = 1000;
- sf->thresh_mult[THR_NEWG ] = 2000;
- sf->thresh_mult[THR_SPLITG ] = 20000;
- }
-
- if (cpi->ref_frame_flags & VP8_ALT_FLAG)
- {
- sf->thresh_mult[THR_NEARESTA ] = 1000;
- sf->thresh_mult[THR_ZEROA ] = 1000;
- sf->thresh_mult[THR_NEARA ] = 1000;
- sf->thresh_mult[THR_NEWA ] = 2000;
- sf->thresh_mult[THR_SPLITA ] = 20000;
- }
-
- sf->improved_quant = 0;
- sf->improved_dct = 0;
-
- sf->use_fastquant_for_pick = 1;
- sf->no_skip_block4x4_search = 0;
- sf->first_step = 1;
- }
-
- if (Speed > 1)
- {
- cpi->mode_check_freq[THR_SPLITMV] = 7;
- cpi->mode_check_freq[THR_SPLITG] = 15;
- cpi->mode_check_freq[THR_SPLITA] = 15;
-
- sf->thresh_mult[THR_TM ] = 2000;
- sf->thresh_mult[THR_V_PRED ] = 2000;
- sf->thresh_mult[THR_H_PRED ] = 2000;
- sf->thresh_mult[THR_B_PRED ] = 5000;
- sf->thresh_mult[THR_I8X8_PRED] = 5000;
-
- if (cpi->ref_frame_flags & VP8_LAST_FLAG)
- {
- sf->thresh_mult[THR_NEWMV ] = 2000;
- sf->thresh_mult[THR_SPLITMV ] = 25000;
- }
-
- if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
- {
- sf->thresh_mult[THR_NEARESTG ] = 2000;
- sf->thresh_mult[THR_ZEROG ] = 2000;
- sf->thresh_mult[THR_NEARG ] = 2000;
- sf->thresh_mult[THR_NEWG ] = 2500;
- sf->thresh_mult[THR_SPLITG ] = 50000;
- }
-
- if (cpi->ref_frame_flags & VP8_ALT_FLAG)
- {
- sf->thresh_mult[THR_NEARESTA ] = 2000;
- sf->thresh_mult[THR_ZEROA ] = 2000;
- sf->thresh_mult[THR_NEARA ] = 2000;
- sf->thresh_mult[THR_NEWA ] = 2500;
- sf->thresh_mult[THR_SPLITA ] = 50000;
- }
-
- sf->thresh_mult[THR_DUAL_ZEROLG ] = 2000;
- sf->thresh_mult[THR_DUAL_NEARESTLG] = 2000;
- sf->thresh_mult[THR_DUAL_NEARLG ] = 2000;
- sf->thresh_mult[THR_DUAL_ZEROLA ] = 2000;
- sf->thresh_mult[THR_DUAL_NEARESTLA] = 2000;
- sf->thresh_mult[THR_DUAL_NEARLA ] = 2000;
- sf->thresh_mult[THR_DUAL_ZEROGA ] = 2000;
- sf->thresh_mult[THR_DUAL_NEARESTGA] = 2000;
- sf->thresh_mult[THR_DUAL_NEARGA ] = 2000;
-
- sf->thresh_mult[THR_DUAL_NEWLG ] = 2500;
- sf->thresh_mult[THR_DUAL_NEWLA ] = 2500;
- sf->thresh_mult[THR_DUAL_NEWGA ] = 2500;
- }
-
- if (Speed > 2)
- {
- sf->auto_filter = 0; // Faster selection of loop filter
-
- cpi->mode_check_freq[THR_V_PRED] = 2;
- cpi->mode_check_freq[THR_H_PRED] = 2;
- cpi->mode_check_freq[THR_B_PRED] = 2;
- cpi->mode_check_freq[THR_I8X8_PRED]=2;
-
- if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
- {
- cpi->mode_check_freq[THR_NEARG] = 2;
- cpi->mode_check_freq[THR_NEWG] = 4;
- }
-
- if (cpi->ref_frame_flags & VP8_ALT_FLAG)
- {
- cpi->mode_check_freq[THR_NEARA] = 2;
- cpi->mode_check_freq[THR_NEWA] = 4;
- }
-
- cpi->mode_check_freq[THR_DUAL_NEARLG ] = 2;
- cpi->mode_check_freq[THR_DUAL_NEARLA ] = 2;
- cpi->mode_check_freq[THR_DUAL_NEARGA ] = 2;
- cpi->mode_check_freq[THR_DUAL_NEWLG ] = 4;
- cpi->mode_check_freq[THR_DUAL_NEWLA ] = 4;
- cpi->mode_check_freq[THR_DUAL_NEWGA ] = 4;
-
- sf->thresh_mult[THR_SPLITMV ] = INT_MAX;
- sf->thresh_mult[THR_SPLITG ] = INT_MAX;
- sf->thresh_mult[THR_SPLITA ] = INT_MAX;
-
- }
-
- if (Speed > 3)
- {
- sf->RD = 0;
-
- sf->auto_filter = 1;
- }
-
- if (Speed > 4)
- {
- sf->auto_filter = 0; // Faster selection of loop filter
-
- sf->search_method = HEX;
- //sf->search_method = DIAMOND;
-
- sf->iterative_sub_pixel = 0;
-
- cpi->mode_check_freq[THR_V_PRED] = 4;
- cpi->mode_check_freq[THR_H_PRED] = 4;
- cpi->mode_check_freq[THR_B_PRED] = 4;
- cpi->mode_check_freq[THR_I8X8_PRED]=4;
-
- if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
- {
- cpi->mode_check_freq[THR_NEARG] = 2;
- cpi->mode_check_freq[THR_NEWG] = 4;
- }
-
- if (cpi->ref_frame_flags & VP8_ALT_FLAG)
- {
- cpi->mode_check_freq[THR_NEARA] = 2;
- cpi->mode_check_freq[THR_NEWA] = 4;
- }
-
- sf->thresh_mult[THR_TM ] = 2000;
- sf->thresh_mult[THR_B_PRED ] = 5000;
- sf->thresh_mult[THR_I8X8_PRED] = 5000;
-
- if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
- {
- sf->thresh_mult[THR_NEARESTG ] = 2000;
- sf->thresh_mult[THR_ZEROG ] = 2000;
- sf->thresh_mult[THR_NEARG ] = 2000;
- sf->thresh_mult[THR_NEWG ] = 4000;
- }
-
- if (cpi->ref_frame_flags & VP8_ALT_FLAG)
- {
- sf->thresh_mult[THR_NEARESTA ] = 2000;
- sf->thresh_mult[THR_ZEROA ] = 2000;
- sf->thresh_mult[THR_NEARA ] = 2000;
- sf->thresh_mult[THR_NEWA ] = 4000;
- }
-
- sf->thresh_mult[THR_DUAL_NEWLG ] = 4000;
- sf->thresh_mult[THR_DUAL_NEWLA ] = 4000;
- sf->thresh_mult[THR_DUAL_NEWGA ] = 4000;
- }
-
- if (Speed > 5)
- {
- // Disable split MB intra prediction mode
- sf->thresh_mult[THR_B_PRED] = INT_MAX;
- sf->thresh_mult[THR_I8X8_PRED] = INT_MAX;
- }
-
- if (Speed > 6)
- {
- unsigned int i, sum = 0;
- unsigned int total_mbs = cm->MBs;
- int thresh;
- int total_skip;
-
- int min = 2000;
-
- if (cpi->oxcf.encode_breakout > 2000)
- min = cpi->oxcf.encode_breakout;
-
- min >>= 7;
-
- for (i = 0; i < min; i++)
- {
- sum += cpi->error_bins[i];
- }
-
- total_skip = sum;
- sum = 0;
-
- // i starts from 2 to make sure thresh started from 2048
- for (; i < 1024; i++)
- {
- sum += cpi->error_bins[i];
-
- if (10 * sum >= (unsigned int)(cpi->Speed - 6)*(total_mbs - total_skip))
- break;
- }
-
- i--;
- thresh = (i << 7);
-
- if (thresh < 2000)
- thresh = 2000;
-
- if (cpi->ref_frame_flags & VP8_LAST_FLAG)
- {
- sf->thresh_mult[THR_NEWMV] = thresh;
- sf->thresh_mult[THR_NEARESTMV ] = thresh >> 1;
- sf->thresh_mult[THR_NEARMV ] = thresh >> 1;
- }
-
- if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
- {
- sf->thresh_mult[THR_NEWG] = thresh << 1;
- sf->thresh_mult[THR_NEARESTG ] = thresh;
- sf->thresh_mult[THR_NEARG ] = thresh;
- }
-
- if (cpi->ref_frame_flags & VP8_ALT_FLAG)
- {
- sf->thresh_mult[THR_NEWA] = thresh << 1;
- sf->thresh_mult[THR_NEARESTA ] = thresh;
- sf->thresh_mult[THR_NEARA ] = thresh;
- }
-
- sf->thresh_mult[THR_DUAL_ZEROLG ] = thresh;
- sf->thresh_mult[THR_DUAL_NEARESTLG] = thresh;
- sf->thresh_mult[THR_DUAL_NEARLG ] = thresh;
- sf->thresh_mult[THR_DUAL_ZEROLA ] = thresh;
- sf->thresh_mult[THR_DUAL_NEARESTLA] = thresh;
- sf->thresh_mult[THR_DUAL_NEARLA ] = thresh;
- sf->thresh_mult[THR_DUAL_ZEROGA ] = thresh;
- sf->thresh_mult[THR_DUAL_NEARESTGA] = thresh;
- sf->thresh_mult[THR_DUAL_NEARGA ] = thresh;
-
- sf->thresh_mult[THR_DUAL_NEWLG ] = thresh << 1;
- sf->thresh_mult[THR_DUAL_NEWLA ] = thresh << 1;
- sf->thresh_mult[THR_DUAL_NEWGA ] = thresh << 1;
-
- // Disable other intra prediction modes
- sf->thresh_mult[THR_TM] = INT_MAX;
- sf->thresh_mult[THR_V_PRED] = INT_MAX;
- sf->thresh_mult[THR_H_PRED] = INT_MAX;
-
- sf->improved_mv_pred = 0;
- }
-
- if (Speed > 8)
- {
- sf->quarter_pixel_search = 0;
- }
-
- if (Speed > 9)
- {
- int Tmp = cpi->Speed - 8;
-
- if (Tmp > 4)
- Tmp = 4;
-
- if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
- {
- cpi->mode_check_freq[THR_ZEROG] = 1 << (Tmp - 1);
- cpi->mode_check_freq[THR_NEARESTG] = 1 << (Tmp - 1);
- cpi->mode_check_freq[THR_NEARG] = 1 << Tmp;
- cpi->mode_check_freq[THR_NEWG] = 1 << (Tmp + 1);
- }
-
- if (cpi->ref_frame_flags & VP8_ALT_FLAG)
- {
- cpi->mode_check_freq[THR_ZEROA] = 1 << (Tmp - 1);
- cpi->mode_check_freq[THR_NEARESTA] = 1 << (Tmp - 1);
- cpi->mode_check_freq[THR_NEARA] = 1 << Tmp;
- cpi->mode_check_freq[THR_NEWA] = 1 << (Tmp + 1);
- }
-
- cpi->mode_check_freq[THR_DUAL_ZEROLG ] = 1 << (Tmp - 1);
- cpi->mode_check_freq[THR_DUAL_NEARESTLG] = 1 << (Tmp - 1);
- cpi->mode_check_freq[THR_DUAL_NEARLG ] = 1 << Tmp;
- cpi->mode_check_freq[THR_DUAL_ZEROLA ] = 1 << (Tmp - 1);
- cpi->mode_check_freq[THR_DUAL_NEARESTLA] = 1 << (Tmp - 1);
- cpi->mode_check_freq[THR_DUAL_NEARLA ] = 1 << Tmp;
- cpi->mode_check_freq[THR_DUAL_ZEROGA ] = 1 << (Tmp - 1);
- cpi->mode_check_freq[THR_DUAL_NEARESTGA] = 1 << (Tmp - 1);
- cpi->mode_check_freq[THR_DUAL_NEARGA ] = 1 << Tmp;
-
- cpi->mode_check_freq[THR_DUAL_NEWLG ] = 1 << (Tmp + 1);
- cpi->mode_check_freq[THR_DUAL_NEWLA ] = 1 << (Tmp + 1);
- cpi->mode_check_freq[THR_DUAL_NEWGA ] = 1 << (Tmp + 1);
-
- cpi->mode_check_freq[THR_NEWMV] = 1 << (Tmp - 1);
- }
-
- cm->filter_type = NORMAL_LOOPFILTER;
-
- if (Speed >= 14)
- cm->filter_type = SIMPLE_LOOPFILTER;
-
- if (Speed >= 15)
- {
- sf->half_pixel_search = 0; // This has a big hit on quality. Last resort
- }
-
- vpx_memset(cpi->error_bins, 0, sizeof(cpi->error_bins));
}; /* switch */
@@ -1646,19 +1017,12 @@ void vp8_set_speed_features(VP8_COMP *cpi)
{
cpi->find_fractional_mv_step = vp8_find_best_half_pixel_step;
}
- else
- {
- cpi->find_fractional_mv_step = vp8_skip_fractional_mv_step;
- }
if (cpi->sf.optimize_coefficients == 1 && cpi->pass!=1)
cpi->mb.optimize = 1;
else
cpi->mb.optimize = 0;
- if (cpi->common.full_pixel)
- cpi->find_fractional_mv_step = vp8_skip_fractional_mv_step;
-
#ifdef SPEEDSTATS
frames_at_speed[cpi->Speed]++;
#endif
@@ -1930,44 +1294,12 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
switch (cpi->oxcf.Mode)
{
-
- case MODE_REALTIME:
- cpi->pass = 0;
- cpi->compressor_speed = 2;
-
- if (cpi->oxcf.cpu_used < -16)
- {
- cpi->oxcf.cpu_used = -16;
- }
-
- if (cpi->oxcf.cpu_used > 16)
- cpi->oxcf.cpu_used = 16;
-
- break;
-
- case MODE_GOODQUALITY:
- cpi->pass = 0;
- cpi->compressor_speed = 1;
-
- if (cpi->oxcf.cpu_used < -5)
- {
- cpi->oxcf.cpu_used = -5;
- }
-
- if (cpi->oxcf.cpu_used > 5)
- cpi->oxcf.cpu_used = 5;
-
- break;
-
- case MODE_BESTQUALITY:
- cpi->pass = 0;
- cpi->compressor_speed = 0;
- break;
-
+ // Real time and one pass deprecated in test code base
case MODE_FIRSTPASS:
cpi->pass = 1;
cpi->compressor_speed = 1;
break;
+
case MODE_SECONDPASS:
cpi->pass = 2;
cpi->compressor_speed = 1;
@@ -1981,14 +1313,13 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
cpi->oxcf.cpu_used = 5;
break;
+
case MODE_SECONDPASS_BEST:
cpi->pass = 2;
cpi->compressor_speed = 0;
break;
}
- if (cpi->pass == 0)
- cpi->auto_worst_q = 1;
cpi->oxcf.worst_allowed_q = q_trans[oxcf->worst_allowed_q];
cpi->oxcf.best_allowed_q = q_trans[oxcf->best_allowed_q];
@@ -2288,29 +1619,6 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
vpx_memset(cpi->active_map , 1, (cpi->common.mb_rows * cpi->common.mb_cols));
cpi->active_map_enabled = 0;
-#if 0
- // Experimental code for lagged and one pass
- // Initialise one_pass GF frames stats
- // Update stats used for GF selection
- if (cpi->pass == 0)
- {
- cpi->one_pass_frame_index = 0;
-
- for (i = 0; i < MAX_LAG_BUFFERS; i++)
- {
- cpi->one_pass_frame_stats[i].frames_so_far = 0;
- cpi->one_pass_frame_stats[i].frame_intra_error = 0.0;
- cpi->one_pass_frame_stats[i].frame_coded_error = 0.0;
- cpi->one_pass_frame_stats[i].frame_pcnt_inter = 0.0;
- cpi->one_pass_frame_stats[i].frame_pcnt_motion = 0.0;
- cpi->one_pass_frame_stats[i].frame_mvr = 0.0;
- cpi->one_pass_frame_stats[i].frame_mvr_abs = 0.0;
- cpi->one_pass_frame_stats[i].frame_mvc = 0.0;
- cpi->one_pass_frame_stats[i].frame_mvc_abs = 0.0;
- }
- }
-#endif
-
for (i = 0; i < ( sizeof(cpi->mbgraph_stats) /
sizeof(cpi->mbgraph_stats[0]) ); i++)
{
@@ -2320,22 +1628,6 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
1));
}
- // Should we use the cyclic refresh method.
- // Currently this is tied to error resilliant mode
- cpi->cyclic_refresh_mode_enabled = cpi->oxcf.error_resilient_mode;
- cpi->cyclic_refresh_mode_max_mbs_perframe = (cpi->common.mb_rows * cpi->common.mb_cols) / 40;
- cpi->cyclic_refresh_mode_index = 0;
- cpi->cyclic_refresh_q = 32;
-
- if (cpi->cyclic_refresh_mode_enabled)
- CHECK_MEM_ERROR(cpi->cyclic_refresh_map, vpx_calloc((cpi->common.mb_rows * cpi->common.mb_cols), 1));
- else
- cpi->cyclic_refresh_map = (signed char *) NULL;
-
- // Test function for segmentation
-
- //segmentation_test_function((VP8_PTR) cpi);
-
#ifdef ENTROPY_STATS
init_context_counters();
#endif
@@ -2453,13 +1745,6 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf)
vp8_init_second_pass(cpi);
}
- if (cpi->compressor_speed == 2)
- {
- cpi->cpu_freq = 0; //vp8_get_processor_freq();
- cpi->avg_encode_time = 0;
- cpi->avg_pick_mode_time = 0;
- }
-
vp8_set_speed_features(cpi);
// Set starting values of RD threshold multipliers (128 = *1)
@@ -2621,31 +1906,6 @@ void vp8_remove_compressor(VP8_PTR *ptr)
}
fclose(f);
-#if 0
- f = fopen("qskip.stt", "a");
- fprintf(f, "minq:%d -maxq:%d skipture:skipfalse = %d:%d\n", cpi->oxcf.best_allowed_q, cpi->oxcf.worst_allowed_q, skiptruecount, skipfalsecount);
- fclose(f);
-#endif
-
- }
-
-#endif
-
-
-#ifdef SPEEDSTATS
-
- if (cpi->compressor_speed == 2)
- {
- int i;
- FILE *f = fopen("cxspeed.stt", "a");
- cnt_pm /= cpi->common.MBs;
-
- for (i = 0; i < 16; i++)
- fprintf(f, "%5d", frames_at_speed[i]);
-
- fprintf(f, "\n");
- //fprintf(f, "%10d PM %10d %10d %10d EF %10d %10d %10d\n", cpi->Speed, cpi->avg_pick_mode_time, (tot_pm/cnt_pm), cnt_pm, cpi->avg_encode_time, 0, 0);
- fclose(f);
}
#endif
@@ -2789,7 +2049,6 @@ void vp8_remove_compressor(VP8_PTR *ptr)
dealloc_compressor_data(cpi);
vpx_free(cpi->mb.ss);
vpx_free(cpi->tok);
- vpx_free(cpi->cyclic_refresh_map);
for (i = 0; i < sizeof(cpi->mbgraph_stats) / sizeof(cpi->mbgraph_stats[0]); i++)
{
@@ -3176,19 +2435,6 @@ static void update_alt_ref_frame_stats(VP8_COMP *cpi)
if (!cpi->auto_gold)
cpi->frames_till_gf_update_due = cpi->goldfreq;
- if ((cpi->pass != 2) && cpi->frames_till_gf_update_due)
- {
- cpi->current_gf_interval = cpi->frames_till_gf_update_due;
-
- // Set the bits per frame that we should try and recover in subsequent inter frames
- // to account for the extra GF spend... note that his does not apply for GF updates
- // that occur coincident with a key frame as the extra cost of key frames is dealt
- // with elsewhere.
-
- cpi->gf_overspend_bits += cpi->projected_frame_size;
- cpi->non_gf_bitrate_adjustment = cpi->gf_overspend_bits / cpi->frames_till_gf_update_due;
- }
-
// Update data structure that monitors level of reference to last GF
vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
@@ -3215,25 +2461,6 @@ static void update_golden_frame_stats(VP8_COMP *cpi)
if (!cpi->auto_gold)
cpi->frames_till_gf_update_due = cpi->goldfreq;
- if ((cpi->pass != 2) && (cpi->frames_till_gf_update_due > 0))
- {
- cpi->current_gf_interval = cpi->frames_till_gf_update_due;
-
- // Set the bits per frame that we should try and recover in subsequent inter frames
- // to account for the extra GF spend... note that his does not apply for GF updates
- // that occur coincident with a key frame as the extra cost of key frames is dealt
- // with elsewhere.
- if ((cm->frame_type != KEY_FRAME) && !cpi->source_alt_ref_active)
- {
- // Calcluate GF bits to be recovered
- // Projected size - av frame bits available for inter frames for clip as a whole
- cpi->gf_overspend_bits += (cpi->projected_frame_size - cpi->inter_frame_target);
- }
-
- cpi->non_gf_bitrate_adjustment = cpi->gf_overspend_bits / cpi->frames_till_gf_update_due;
-
- }
-
// Update data structure that monitors level of reference to last GF
vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
@@ -3311,50 +2538,6 @@ static int decide_key_frame(VP8_COMP *cpi)
// Clear down mmx registers
vp8_clear_system_state(); //__asm emms;
- if ((cpi->compressor_speed == 2) && (cpi->Speed >= 5) && (cpi->sf.RD == 0))
- {
- double change = 1.0 * abs((int)(cpi->intra_error - cpi->last_intra_error)) / (1 + cpi->last_intra_error);
- double change2 = 1.0 * abs((int)(cpi->prediction_error - cpi->last_prediction_error)) / (1 + cpi->last_prediction_error);
- double minerror = cm->MBs * 256;
-
-#if 0
-
- if (10 * cpi->intra_error / (1 + cpi->prediction_error) < 15
- && cpi->prediction_error > minerror
- && (change > .25 || change2 > .25))
- {
- FILE *f = fopen("intra_inter.stt", "a");
-
- if (cpi->prediction_error <= 0)
- cpi->prediction_error = 1;
-
- fprintf(f, "%d %d %d %d %14.4f\n",
- cm->current_video_frame,
- (int) cpi->prediction_error,
- (int) cpi->intra_error,
- (int)((10 * cpi->intra_error) / cpi->prediction_error),
- change);
-
- fclose(f);
- }
-
-#endif
-
- cpi->last_intra_error = cpi->intra_error;
- cpi->last_prediction_error = cpi->prediction_error;
-
- if (10 * cpi->intra_error / (1 + cpi->prediction_error) < 15
- && cpi->prediction_error > minerror
- && (change > .25 || change2 > .25))
- {
- /*(change > 1.4 || change < .75)&& cpi->this_frame_percent_intra > cpi->last_frame_percent_intra + 3*/
- return TRUE;
- }
-
- return FALSE;
-
- }
-
// If the following are true we might as well code a key frame
if (((cpi->this_frame_percent_intra == 100) &&
(cpi->this_frame_percent_intra > (cpi->last_frame_percent_intra + 2))) ||
@@ -3759,29 +2942,13 @@ static void encode_frame_to_data_rate
// Clear down mmx registers to allow floating point in what follows
vp8_clear_system_state();
- if (cpi->compressor_speed == 2)
- {
- if(cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME)
- {
- if(cpi->force_next_frame_intra)
- {
- cm->frame_type = KEY_FRAME; /* delayed intra frame */
- }
- }
- cpi->force_next_frame_intra = 0;
- }
-
- // For an alt ref frame in 2 pass we skip the call to the second pass function that sets the target bandwidth
- if (cpi->pass == 2)
+ // For an alt ref frame in 2 pass we skip the call to the second
+ // pass function that sets the target bandwidth so must set it here
+ if (cpi->common.refresh_alt_ref_frame)
{
- if (cpi->common.refresh_alt_ref_frame)
- {
- cpi->per_frame_bandwidth = cpi->twopass.gf_bits; // Per frame bit target for the alt ref frame
- cpi->target_bandwidth = cpi->twopass.gf_bits * cpi->output_frame_rate; // per second target bitrate
- }
+ cpi->per_frame_bandwidth = cpi->twopass.gf_bits; // Per frame bit target for the alt ref frame
+ cpi->target_bandwidth = cpi->twopass.gf_bits * cpi->output_frame_rate; // per second target bitrate
}
- else
- cpi->per_frame_bandwidth = (int)(cpi->target_bandwidth / cpi->output_frame_rate);
// Default turn off buffer to buffer copying
cm->copy_buffer_to_gf = 0;
@@ -3796,12 +2963,9 @@ static void encode_frame_to_data_rate
// is above a threshold
cpi->zbin_mode_boost = 0;
cpi->zbin_mode_boost_enabled = TRUE;
- if (cpi->pass == 2)
+ if ( cpi->gfu_boost <= 400 )
{
- if ( cpi->gfu_boost <= 400 )
- {
- cpi->zbin_mode_boost_enabled = FALSE;
- }
+ cpi->zbin_mode_boost_enabled = FALSE;
}
// Current default encoder behaviour for the altref sign bias
@@ -3848,33 +3012,6 @@ static void encode_frame_to_data_rate
}
}
- // Test code for segmentation
- //if ( (cm->frame_type == KEY_FRAME) || ((cm->current_video_frame % 2) == 0))
- //if ( (cm->current_video_frame % 2) == 0 )
- // vp8_enable_segmentation((VP8_PTR)cpi);
- //else
- // vp8_disable_segmentation((VP8_PTR)cpi);
-
-#if 0
- // Experimental code for lagged compress and one pass
- // Initialise one_pass GF frames stats
- // Update stats used for GF selection
- //if ( cpi->pass == 0 )
- {
- cpi->one_pass_frame_index = cm->current_video_frame % MAX_LAG_BUFFERS;
-
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frames_so_far = 0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_intra_error = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_coded_error = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_pcnt_inter = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_pcnt_motion = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_mvr = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_mvr_abs = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_mvc = 0.0;
- cpi->one_pass_frame_stats[cpi->one_pass_frame_index ].frame_mvc_abs = 0.0;
- }
-#endif
-
//#if !CONFIG_COMPRED
// This function has been deprecated for now but we may want to do
// something here at a late date
@@ -3998,131 +3135,101 @@ static void encode_frame_to_data_rate
}
}
+ vp8_clear_system_state();
+
// Set an active best quality and if necessary active worst quality
- // There is some odd behaviour for one pass here that needs attention.
- if ( (cpi->pass == 2) || (cpi->ni_frames > 150))
- {
- vp8_clear_system_state();
+ Q = cpi->active_worst_quality;
- Q = cpi->active_worst_quality;
+ if ( cm->frame_type == KEY_FRAME )
+ {
+ if (cpi->gfu_boost > 600)
+ cpi->active_best_quality = kf_low_motion_minq[Q];
+ else
+ cpi->active_best_quality = kf_high_motion_minq[Q];
- if ( cm->frame_type == KEY_FRAME )
+ // Special case for key frames forced because we have reached
+ // the maximum key frame interval. Here force the Q to a range
+ // based on the ambient Q to reduce the risk of popping
+ if ( cpi->this_key_frame_forced )
{
- if ( cpi->pass == 2 )
- {
- if (cpi->gfu_boost > 600)
- cpi->active_best_quality = kf_low_motion_minq[Q];
- else
- cpi->active_best_quality = kf_high_motion_minq[Q];
-
- // Special case for key frames forced because we have reached
- // the maximum key frame interval. Here force the Q to a range
- // based on the ambient Q to reduce the risk of popping
- if ( cpi->this_key_frame_forced )
- {
- int delta_qindex;
- int qindex = cpi->last_boosted_qindex;
+ int delta_qindex;
+ int qindex = cpi->last_boosted_qindex;
- delta_qindex = compute_qdelta( cpi, qindex,
- (qindex * 0.75) );
+ delta_qindex = compute_qdelta( cpi, qindex,
+ (qindex * 0.75) );
- cpi->active_best_quality = qindex + delta_qindex;
- if (cpi->active_best_quality < cpi->best_quality)
- cpi->active_best_quality = cpi->best_quality;
- }
- }
- // One pass more conservative
- else
- cpi->active_best_quality = kf_high_motion_minq[Q];
+ cpi->active_best_quality = qindex + delta_qindex;
+ if (cpi->active_best_quality < cpi->best_quality)
+ cpi->active_best_quality = cpi->best_quality;
}
+ }
- else if (cm->refresh_golden_frame || cpi->common.refresh_alt_ref_frame)
- {
- // Use the lower of cpi->active_worst_quality and recent
- // average Q as basis for GF/ARF Q limit unless last frame was
- // a key frame.
- if ( (cpi->frames_since_key > 1) &&
- (cpi->avg_frame_qindex < cpi->active_worst_quality) )
- {
- Q = cpi->avg_frame_qindex;
- }
-
- // For constrained quality dont allow Q less than the cq level
- if ( (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
- (Q < cpi->cq_target_quality) )
- {
- Q = cpi->cq_target_quality;
- }
-
- if ( cpi->pass == 2 )
- {
- if ( cpi->gfu_boost > 1000 )
- cpi->active_best_quality = gf_low_motion_minq[Q];
- else if ( cpi->gfu_boost < 400 )
- cpi->active_best_quality = gf_high_motion_minq[Q];
- else
- cpi->active_best_quality = gf_mid_motion_minq[Q];
-
- // Constrained quality use slightly lower active best.
- if ( cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY )
- {
- cpi->active_best_quality =
- cpi->active_best_quality * 15/16;
- }
- }
- // One pass more conservative
- else
- cpi->active_best_quality = gf_high_motion_minq[Q];
- }
- else
+ else if (cm->refresh_golden_frame || cpi->common.refresh_alt_ref_frame)
+ {
+ // Use the lower of cpi->active_worst_quality and recent
+ // average Q as basis for GF/ARF Q limit unless last frame was
+ // a key frame.
+ if ( (cpi->frames_since_key > 1) &&
+ (cpi->avg_frame_qindex < cpi->active_worst_quality) )
{
- cpi->active_best_quality = inter_minq[Q];
-
- // For the constant/constrained quality mode we dont want
- // q to fall below the cq level.
- if ((cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
- (cpi->active_best_quality < cpi->cq_target_quality) )
- {
- // If we are strongly undershooting the target rate in the last
- // frames then use the user passed in cq value not the auto
- // cq value.
- if ( cpi->rolling_actual_bits < cpi->min_frame_bandwidth )
- cpi->active_best_quality = cpi->oxcf.cq_level;
- else
- cpi->active_best_quality = cpi->cq_target_quality;
- }
+ Q = cpi->avg_frame_qindex;
}
- // If CBR and the buffer is as full then it is reasonable to allow
- // higher quality on the frames to prevent bits just going to waste.
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
+ // For constrained quality dont allow Q less than the cq level
+ if ( (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
+ (Q < cpi->cq_target_quality) )
{
- // Note that the use of >= here elliminates the risk of a devide
- // by 0 error in the else if clause
- if (cpi->buffer_level >= cpi->oxcf.maximum_buffer_size)
- cpi->active_best_quality = cpi->best_quality;
+ Q = cpi->cq_target_quality;
+ }
- else if (cpi->buffer_level > cpi->oxcf.optimal_buffer_level)
- {
- int Fraction = ((cpi->buffer_level - cpi->oxcf.optimal_buffer_level) * 128) / (cpi->oxcf.maximum_buffer_size - cpi->oxcf.optimal_buffer_level);
- int min_qadjustment = ((cpi->active_best_quality - cpi->best_quality) * Fraction) / 128;
+ if ( cpi->gfu_boost > 1000 )
+ cpi->active_best_quality = gf_low_motion_minq[Q];
+ else if ( cpi->gfu_boost < 400 )
+ cpi->active_best_quality = gf_high_motion_minq[Q];
+ else
+ cpi->active_best_quality = gf_mid_motion_minq[Q];
- cpi->active_best_quality -= min_qadjustment;
- }
+ // Constrained quality use slightly lower active best.
+ if ( cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY )
+ {
+ cpi->active_best_quality =
+ cpi->active_best_quality * 15/16;
}
}
- // Make sure constrained quality mode limits are adhered to for the first
- // few frames of one pass encodes
- else if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY)
+ else
{
- if ( (cm->frame_type == KEY_FRAME) ||
- cm->refresh_golden_frame || cpi->common.refresh_alt_ref_frame )
+ cpi->active_best_quality = inter_minq[Q];
+
+ // For the constant/constrained quality mode we dont want
+ // q to fall below the cq level.
+ if ((cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) &&
+ (cpi->active_best_quality < cpi->cq_target_quality) )
{
- cpi->active_best_quality = cpi->best_quality;
+ // If we are strongly undershooting the target rate in the last
+ // frames then use the user passed in cq value not the auto
+ // cq value.
+ if ( cpi->rolling_actual_bits < cpi->min_frame_bandwidth )
+ cpi->active_best_quality = cpi->oxcf.cq_level;
+ else
+ cpi->active_best_quality = cpi->cq_target_quality;
}
- else if (cpi->active_best_quality < cpi->cq_target_quality)
+ }
+
+ // If CBR and the buffer is as full then it is reasonable to allow
+ // higher quality on the frames to prevent bits just going to waste.
+ if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
+ {
+ // Note that the use of >= here elliminates the risk of a devide
+ // by 0 error in the else if clause
+ if (cpi->buffer_level >= cpi->oxcf.maximum_buffer_size)
+ cpi->active_best_quality = cpi->best_quality;
+
+ else if (cpi->buffer_level > cpi->oxcf.optimal_buffer_level)
{
- cpi->active_best_quality = cpi->cq_target_quality;
+ int Fraction = ((cpi->buffer_level - cpi->oxcf.optimal_buffer_level) * 128) / (cpi->oxcf.maximum_buffer_size - cpi->oxcf.optimal_buffer_level);
+ int min_qadjustment = ((cpi->active_best_quality - cpi->best_quality) * Fraction) / 128;
+
+ cpi->active_best_quality -= min_qadjustment;
}
}
@@ -4159,10 +3266,6 @@ static void encode_frame_to_data_rate
else
zbin_oq_high = ZBIN_OQ_MAX;
- // Setup background Q adjustment for error resilliant mode
- if (cpi->cyclic_refresh_mode_enabled)
- cyclic_background_refresh(cpi, Q, 0);
-
vp8_compute_frame_size_bounds(cpi, &frame_under_shoot_limit, &frame_over_shoot_limit);
// Limit Q range for the adaptive loop.
@@ -4294,18 +3397,6 @@ static void encode_frame_to_data_rate
}
-
-#if 0
-
- if (cpi->pass != 1)
- {
- FILE *f = fopen("skip.stt", "a");
- fprintf(f, "%d, %d, %4d ", cpi->common.refresh_golden_frame, cpi->common.refresh_alt_ref_frame, cpi->prob_skip_false);
- fclose(f);
- }
-
-#endif
-
}
if (cm->frame_type == KEY_FRAME)
@@ -4328,76 +3419,12 @@ static void encode_frame_to_data_rate
vp8_clear_system_state(); //__asm emms;
-#if 0
- if (cpi->pass != 1)
- {
- FILE *f = fopen("q_used.stt", "a");
- fprintf(f, "%4d, %4d, %8d\n", cpi->common.current_video_frame,
- cpi->common.base_qindex, cpi->projected_frame_size);
- fclose(f);
- }
-#endif
-
-
- // Test to see if the stats generated for this frame indicate that we should have coded a key frame
- // (assuming that we didn't)!
- if (cpi->pass != 2 && cpi->oxcf.auto_key && cm->frame_type != KEY_FRAME)
- {
- int key_frame_decision = decide_key_frame(cpi);
-
- if (cpi->compressor_speed == 2)
- {
- /* we don't do re-encoding in realtime mode
- * if key frame is decided than we force it on next frame */
- cpi->force_next_frame_intra = key_frame_decision;
- }
- else if (key_frame_decision)
- {
- // Reset all our sizing numbers and recode
- cm->frame_type = KEY_FRAME;
-
- vp8_pick_frame_size(cpi);
-
- // Clear the Alt reference frame active flag when we have a key frame
- cpi->source_alt_ref_active = FALSE;
-
- // Reset the loop filter deltas and segmentation map
- setup_features(cpi);
-
- // If segmentation is enabled force a map update for key frames
- if (xd->segmentation_enabled)
- {
- xd->update_mb_segmentation_map = 1;
- xd->update_mb_segmentation_data = 1;
- }
-
- vp8_restore_coding_context(cpi);
-
- Q = vp8_regulate_q(cpi, cpi->this_frame_target);
-
- vp8_compute_frame_size_bounds(cpi, &frame_under_shoot_limit, &frame_over_shoot_limit);
-
- // Limit Q range for the adaptive loop.
- bottom_index = cpi->active_best_quality;
- top_index = cpi->active_worst_quality;
- q_low = cpi->active_best_quality;
- q_high = cpi->active_worst_quality;
-
- loop_count++;
- Loop = TRUE;
-
- continue;
- }
- }
-
- vp8_clear_system_state();
-
if (frame_over_shoot_limit == 0)
frame_over_shoot_limit = 1;
// Are we are overshooting and up against the limit of active max Q.
- if (((cpi->pass != 2) || (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)) &&
- (Q == cpi->active_worst_quality) &&
+ if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
+ (Q == cpi->active_worst_quality) &&
(cpi->active_worst_quality < cpi->worst_quality) &&
(cpi->projected_frame_size > frame_over_shoot_limit))
{
@@ -4767,36 +3794,8 @@ static void encode_frame_to_data_rate
// Calculate the average Q for normal inter frames (not key or GFU
// frames).
- if ( cpi->pass == 2 )
- {
- cpi->ni_tot_qi += Q;
- cpi->ni_av_qi = (cpi->ni_tot_qi / cpi->ni_frames);
- }
- else
- {
- // Damp value for first few frames
- if (cpi->ni_frames > 150 )
- {
- cpi->ni_tot_qi += Q;
- cpi->ni_av_qi = (cpi->ni_tot_qi / cpi->ni_frames);
- }
- // For one pass, early in the clip ... average the current frame Q
- // value with the worstq entered by the user as a dampening measure
- else
- {
- cpi->ni_tot_qi += Q;
- cpi->ni_av_qi = ((cpi->ni_tot_qi / cpi->ni_frames) + cpi->worst_quality + 1) / 2;
- }
-
- // If the average Q is higher than what was used in the last frame
- // (after going through the recode loop to keep the frame size within range)
- // then use the last frame value - 1.
- // The -1 is designed to stop Q and hence the data rate, from progressively
- // falling away during difficult sections, but at the same time reduce the number of
- // itterations around the recode loop.
- if (Q > cpi->ni_av_qi)
- cpi->ni_av_qi = Q - 1;
- }
+ cpi->ni_tot_qi += Q;
+ cpi->ni_av_qi = (cpi->ni_tot_qi / cpi->ni_frames);
}
#if 0
@@ -5374,13 +4373,6 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon
cpi->last_end_time_stamp_seen = cpi->source->ts_end;
}
- if (cpi->compressor_speed == 2)
- {
- check_gf_quality(cpi);
- vpx_usec_timer_start(&tsctimer);
- vpx_usec_timer_start(&ticktimer);
- }
-
// start with a 0 size frame
*size = 0;
@@ -5430,39 +4422,6 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon
else
encode_frame_to_data_rate(cpi, size, dest, frame_flags);
- if (cpi->compressor_speed == 2)
- {
- unsigned int duration, duration2;
- vpx_usec_timer_mark(&tsctimer);
- vpx_usec_timer_mark(&ticktimer);
-
- duration = vpx_usec_timer_elapsed(&ticktimer);
- duration2 = (unsigned int)((double)duration / 2);
-
- if (cm->frame_type != KEY_FRAME)
- {
- if (cpi->avg_encode_time == 0)
- cpi->avg_encode_time = duration;
- else
- cpi->avg_encode_time = (7 * cpi->avg_encode_time + duration) >> 3;
- }
-
- if (duration2)
- {
- //if(*frame_flags!=1)
- {
-
- if (cpi->avg_pick_mode_time == 0)
- cpi->avg_pick_mode_time = duration2;
- else
- cpi->avg_pick_mode_time = (7 * cpi->avg_pick_mode_time + duration2) >> 3;
- }
- }
-
- }
-
-
-
if(cm->refresh_entropy_probs)
{
if(cm->refresh_alt_ref_frame)
@@ -5598,29 +4557,6 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon
}
}
-#if 0
-
- if (cpi->common.frame_type != 0 && cpi->common.base_qindex == cpi->oxcf.worst_allowed_q)
- {
- skiptruecount += cpi->skip_true_count;
- skipfalsecount += cpi->skip_false_count;
- }
-
-#endif
-#if 0
-
- if (cpi->pass != 1)
- {
- FILE *f = fopen("skip.stt", "a");
- fprintf(f, "frame:%4d flags:%4x Q:%4d P:%4d Size:%5d\n", cpi->common.current_video_frame, *frame_flags, cpi->common.base_qindex, cpi->prob_skip_false, *size);
-
- if (cpi->is_src_frame_alt_ref == 1)
- fprintf(f, "skipcount: %4d framesize: %d\n", cpi->skip_true_count , *size);
-
- fclose(f);
- }
-
-#endif
#endif
#if HAVE_ARMV7
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index b107ca716..5e507ac42 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -532,13 +532,6 @@ typedef struct VP8_COMP
unsigned char *active_map;
unsigned int active_map_enabled;
- // Video conferencing cyclic refresh mode flags etc
- // This is a mode designed to clean up the background over time in live encoding scenarious. It uses segmentation
- int cyclic_refresh_mode_enabled;
- int cyclic_refresh_mode_max_mbs_perframe;
- int cyclic_refresh_mode_index;
- int cyclic_refresh_q;
- signed char *cyclic_refresh_map;
TOKENLIST *tplist;
unsigned int partition_sz[MAX_PARTITIONS];
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
deleted file mode 100644
index 6efd688e1..000000000
--- a/vp8/encoder/pickinter.c
+++ /dev/null
@@ -1,1001 +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 <limits.h>
-#include "vpx_ports/config.h"
-#include "onyx_int.h"
-#include "modecosts.h"
-#include "encodeintra.h"
-#include "vp8/common/entropymode.h"
-#include "pickinter.h"
-#include "vp8/common/findnearmv.h"
-#include "encodemb.h"
-#include "vp8/common/reconinter.h"
-#include "vp8/common/reconintra.h"
-#include "vp8/common/reconintra4x4.h"
-#include "vp8/common/g_common.h"
-#include "variance.h"
-#include "mcomp.h"
-#include "rdopt.h"
-#include "vpx_mem/vpx_mem.h"
-
-#include "vp8/common/seg_common.h"
-
-#if CONFIG_RUNTIME_CPU_DETECT
-#define IF_RTCD(x) (x)
-#else
-#define IF_RTCD(x) NULL
-#endif
-
-extern int VP8_UVSSE(MACROBLOCK *x, const vp8_variance_rtcd_vtable_t *rtcd);
-
-#ifdef SPEEDSTATS
-extern unsigned int cnt_pm;
-#endif
-
-extern const MV_REFERENCE_FRAME vp8_ref_frame_order[MAX_MODES];
-extern const MB_PREDICTION_MODE vp8_mode_order[MAX_MODES];
-extern const MV_REFERENCE_FRAME vp8_second_ref_frame_order[MAX_MODES];
-
-extern unsigned int (*vp8_get4x4sse_cs)(unsigned char *src_ptr, int source_stride, unsigned char *ref_ptr, int recon_stride);
-extern int vp8_cost_mv_ref(VP8_COMMON *pc,
- MB_PREDICTION_MODE m, const int near_mv_ref_ct[4]);
-
-
-int vp8_skip_fractional_mv_step(MACROBLOCK *mb, BLOCK *b, BLOCKD *d,
- int_mv *bestmv, int_mv *ref_mv,
- int error_per_bit,
- const vp8_variance_fn_ptr_t *vfp,
- int *mvcost[2], int *distortion,
- unsigned int *sse)
-{
- (void) b;
- (void) d;
- (void) ref_mv;
- (void) error_per_bit;
- (void) vfp;
- (void) mvcost;
- (void) distortion;
- (void) sse;
- bestmv->as_mv.row <<= 3;
- bestmv->as_mv.col <<= 3;
- return 0;
-}
-
-
-static int get_inter_mbpred_error(MACROBLOCK *mb,
- const vp8_variance_fn_ptr_t *vfp,
- unsigned int *sse,
- int_mv this_mv)
-{
-
- BLOCK *b = &mb->block[0];
- BLOCKD *d = &mb->e_mbd.block[0];
- unsigned char *what = (*(b->base_src) + b->src);
- int what_stride = b->src_stride;
- unsigned char *in_what = *(d->base_pre) + d->pre ;
- int in_what_stride = d->pre_stride;
- int xoffset = this_mv.as_mv.col & 7;
- int yoffset = this_mv.as_mv.row & 7;
-
- in_what += (this_mv.as_mv.row >> 3) * d->pre_stride + (this_mv.as_mv.col >> 3);
-
- if (xoffset | yoffset)
- {
- return vfp->svf(in_what, in_what_stride, xoffset, yoffset, what, what_stride, sse);
- }
- else
- {
- return vfp->vf(what, what_stride, in_what, in_what_stride, sse);
- }
-
-}
-
-
-unsigned int vp8_get4x4sse_cs_c
-(
- const unsigned char *src_ptr,
- int source_stride,
- const unsigned char *ref_ptr,
- int recon_stride
-)
-{
- int distortion = 0;
- int r, c;
-
- for (r = 0; r < 4; r++)
- {
- for (c = 0; c < 4; c++)
- {
- int diff = src_ptr[c] - ref_ptr[c];
- distortion += diff * diff;
- }
-
- src_ptr += source_stride;
- ref_ptr += recon_stride;
- }
-
- return distortion;
-}
-
-static int get_prediction_error(BLOCK *be, BLOCKD *b, const vp8_variance_rtcd_vtable_t *rtcd)
-{
- unsigned char *sptr;
- unsigned char *dptr;
- sptr = (*(be->base_src) + be->src);
- dptr = b->predictor;
-
- return VARIANCE_INVOKE(rtcd, get4x4sse_cs)(sptr, be->src_stride, dptr, 16);
-
-}
-
-static int pick_intra4x4block(
- const VP8_ENCODER_RTCD *rtcd,
- MACROBLOCK *x,
- int ib,
- B_PREDICTION_MODE *best_mode,
- unsigned int *mode_costs,
-
- int *bestrate,
- int *bestdistortion)
-{
-
- BLOCKD *b = &x->e_mbd.block[ib];
- BLOCK *be = &x->block[ib];
- B_PREDICTION_MODE mode;
- int best_rd = INT_MAX; // 1<<30
- int rate;
- int distortion;
-
- for (mode = B_DC_PRED; mode <= B_HE_PRED /*B_HU_PRED*/; mode++)
- {
- int this_rd;
-
-#if CONFIG_SUPERBLOCKS
- // Pre-empt mode range being restored to B_HU_PRED in the loop above:
- // Ignore modes that need the above-right data
- if (mode==B_LD_PRED || mode==B_VL_PRED)
- continue;
-#endif
-
- rate = mode_costs[mode];
- RECON_INVOKE(&rtcd->common->recon, intra4x4_predict)
- (b, mode, b->predictor);
- distortion = get_prediction_error(be, b, &rtcd->variance);
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
-
- if (this_rd < best_rd)
- {
- *bestrate = rate;
- *bestdistortion = distortion;
- best_rd = this_rd;
- *best_mode = mode;
- }
- }
-
- b->bmi.as_mode = (B_PREDICTION_MODE)(*best_mode);
- vp8_encode_intra4x4block(rtcd, x, ib);
- return best_rd;
-}
-
-
-static int pick_intra4x4mby_modes
-(
- const VP8_ENCODER_RTCD *rtcd,
- MACROBLOCK *mb,
- int *Rate,
- int *best_dist
-)
-{
- MACROBLOCKD *const xd = &mb->e_mbd;
- int i;
- int cost = mb->mbmode_cost [xd->frame_type] [B_PRED];
- int error;
- int distortion = 0;
- unsigned int *bmode_costs;
-
-#if !CONFIG_SUPERBLOCKS
- vp8_intra_prediction_down_copy(xd);
-#endif
-
- bmode_costs = mb->inter_bmode_costs;
-
- for (i = 0; i < 16; i++)
- {
- MODE_INFO *const mic = xd->mode_info_context;
- const int mis = xd->mode_info_stride;
-
- B_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
- int UNINITIALIZED_IS_SAFE(r), UNINITIALIZED_IS_SAFE(d);
-
- if (mb->e_mbd.frame_type == KEY_FRAME)
- {
- const B_PREDICTION_MODE A = above_block_mode(mic, i, mis);
- const B_PREDICTION_MODE L = left_block_mode(mic, i);
-
- bmode_costs = mb->bmode_costs[A][L];
- }
-
-
- pick_intra4x4block(rtcd, mb, i, &best_mode, bmode_costs, &r, &d);
-
- cost += r;
- distortion += d;
- mic->bmi[i].as_mode = best_mode;
-
- // Break out case where we have already exceeded best so far value
- // that was passed in
- if (distortion > *best_dist)
- break;
- }
-
- *Rate = cost;
-
- if (i == 16)
- {
- *best_dist = distortion;
- error = RDCOST(mb->rdmult, mb->rddiv, cost, distortion);
- }
- else
- {
- *best_dist = INT_MAX;
- error = INT_MAX;
- }
-
- return error;
-}
-
-static void pick_intra_mbuv_mode(MACROBLOCK *mb)
-{
-
- MACROBLOCKD *x = &mb->e_mbd;
- unsigned char *uabove_row = x->dst.u_buffer - x->dst.uv_stride;
- unsigned char *vabove_row = x->dst.v_buffer - x->dst.uv_stride;
- unsigned char *usrc_ptr = (mb->block[16].src + *mb->block[16].base_src);
- unsigned char *vsrc_ptr = (mb->block[20].src + *mb->block[20].base_src);
- int uvsrc_stride = mb->block[16].src_stride;
- unsigned char uleft_col[8];
- unsigned char vleft_col[8];
- unsigned char utop_left = uabove_row[-1];
- unsigned char vtop_left = vabove_row[-1];
- int i, j;
- int expected_udc;
- int expected_vdc;
- int shift;
- int Uaverage = 0;
- int Vaverage = 0;
- int diff;
- int pred_error[4] = {0, 0, 0, 0}, best_error = INT_MAX;
- MB_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
-
-
- for (i = 0; i < 8; i++)
- {
- uleft_col[i] = x->dst.u_buffer [i* x->dst.uv_stride -1];
- vleft_col[i] = x->dst.v_buffer [i* x->dst.uv_stride -1];
- }
-
- if (!x->up_available && !x->left_available)
- {
- expected_udc = 128;
- expected_vdc = 128;
- }
- else
- {
- shift = 2;
-
- if (x->up_available)
- {
-
- for (i = 0; i < 8; i++)
- {
- Uaverage += uabove_row[i];
- Vaverage += vabove_row[i];
- }
-
- shift ++;
-
- }
-
- if (x->left_available)
- {
- for (i = 0; i < 8; i++)
- {
- Uaverage += uleft_col[i];
- Vaverage += vleft_col[i];
- }
-
- shift ++;
-
- }
-
- expected_udc = (Uaverage + (1 << (shift - 1))) >> shift;
- expected_vdc = (Vaverage + (1 << (shift - 1))) >> shift;
- }
-
-
- for (i = 0; i < 8; i++)
- {
- for (j = 0; j < 8; j++)
- {
-
- int predu = uleft_col[i] + uabove_row[j] - utop_left;
- int predv = vleft_col[i] + vabove_row[j] - vtop_left;
- int u_p, v_p;
-
- u_p = usrc_ptr[j];
- v_p = vsrc_ptr[j];
-
- if (predu < 0)
- predu = 0;
-
- if (predu > 255)
- predu = 255;
-
- if (predv < 0)
- predv = 0;
-
- if (predv > 255)
- predv = 255;
-
-
- diff = u_p - expected_udc;
- pred_error[DC_PRED] += diff * diff;
- diff = v_p - expected_vdc;
- pred_error[DC_PRED] += diff * diff;
-
-
- diff = u_p - uabove_row[j];
- pred_error[V_PRED] += diff * diff;
- diff = v_p - vabove_row[j];
- pred_error[V_PRED] += diff * diff;
-
-
- diff = u_p - uleft_col[i];
- pred_error[H_PRED] += diff * diff;
- diff = v_p - vleft_col[i];
- pred_error[H_PRED] += diff * diff;
-
-
- diff = u_p - predu;
- pred_error[TM_PRED] += diff * diff;
- diff = v_p - predv;
- pred_error[TM_PRED] += diff * diff;
-
-
- }
-
- usrc_ptr += uvsrc_stride;
- vsrc_ptr += uvsrc_stride;
-
- if (i == 3)
- {
- usrc_ptr = (mb->block[18].src + *mb->block[18].base_src);
- vsrc_ptr = (mb->block[22].src + *mb->block[22].base_src);
- }
-
-
-
- }
-
-
- for (i = DC_PRED; i <= TM_PRED; i++)
- {
- if (best_error > pred_error[i])
- {
- best_error = pred_error[i];
- best_mode = (MB_PREDICTION_MODE)i;
- }
- }
-
-
- mb->e_mbd.mode_info_context->mbmi.uv_mode = best_mode;
-
-}
-
-static void update_mvcount(VP8_COMP *cpi, MACROBLOCKD *xd, int_mv *best_ref_mv)
-{
- /* Split MV modes currently not supported when RD is nopt enabled,
- * therefore, only need to modify MVcount in NEWMV mode. */
- if (xd->mode_info_context->mbmi.mode == NEWMV)
- {
- cpi->MVcount[0][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.row -
- best_ref_mv->as_mv.row) >> 1)]++;
- cpi->MVcount[1][mv_max+((xd->mode_info_context->mbmi.mv.as_mv.col -
- best_ref_mv->as_mv.col) >> 1)]++;
- }
-}
-
-void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
- int recon_uvoffset, int *returnrate,
- int *returndistortion, int *returnintra)
-{
- BLOCK *b = &x->block[0];
- BLOCKD *d = &x->e_mbd.block[0];
- MACROBLOCKD *xd = &x->e_mbd;
- MB_MODE_INFO best_mbmode;
- VP8_COMMON *cm = & cpi->common;
-
- int_mv best_ref_mv;
- int_mv mode_mv[MB_MODE_COUNT];
- MB_PREDICTION_MODE this_mode;
- int num00;
- int mdcounts[4];
- int best_rd = INT_MAX; // 1 << 30;
- int best_intra_rd = INT_MAX;
- int mode_index;
- int rate;
- int rate2;
- int distortion2;
- int bestsme;
- //int all_rds[MAX_MODES]; // Experimental debug code.
- int best_mode_index = 0;
- unsigned char segment_id = xd->mode_info_context->mbmi.segment_id;
-
- unsigned int sse = INT_MAX, best_sse = INT_MAX;
-
- int_mv mvp;
- int near_sadidx[8] = {0, 1, 2, 3, 4, 5, 6, 7};
- int saddone=0;
- int sr=0; //search range got from mv_pred(). It uses step_param levels. (0-7)
-
- int_mv nearest_mv[4];
- int_mv near_mv[4];
- int_mv frame_best_ref_mv[4];
- int MDCounts[4][4];
- unsigned char *y_buffer[4];
- unsigned char *u_buffer[4];
- unsigned char *v_buffer[4];
-
- int skip_mode[4] = {0, 0, 0, 0};
-
- int have_subp_search = cpi->sf.half_pixel_search; /* In real-time mode, when Speed >= 15, no sub-pixel search. */
-
- vpx_memset(mode_mv, 0, sizeof(mode_mv));
- vpx_memset(nearest_mv, 0, sizeof(nearest_mv));
- vpx_memset(near_mv, 0, sizeof(near_mv));
- vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
-
-
- // set up all the refframe dependent pointers.
- if (cpi->ref_frame_flags & VP8_LAST_FLAG)
- {
- YV12_BUFFER_CONFIG *lst_yv12 = &cpi->common.yv12_fb[cpi->common.lst_fb_idx];
-
- vp8_find_near_mvs(&x->e_mbd, x->e_mbd.mode_info_context,
- x->e_mbd.prev_mode_info_context,
- &nearest_mv[LAST_FRAME], &near_mv[LAST_FRAME],
- &frame_best_ref_mv[LAST_FRAME], MDCounts[LAST_FRAME], LAST_FRAME, cpi->common.ref_frame_sign_bias);
-
- y_buffer[LAST_FRAME] = lst_yv12->y_buffer + recon_yoffset;
- u_buffer[LAST_FRAME] = lst_yv12->u_buffer + recon_uvoffset;
- v_buffer[LAST_FRAME] = lst_yv12->v_buffer + recon_uvoffset;
- }
- else
- skip_mode[LAST_FRAME] = 1;
-
- if (cpi->ref_frame_flags & VP8_GOLD_FLAG)
- {
- YV12_BUFFER_CONFIG *gld_yv12 = &cpi->common.yv12_fb[cpi->common.gld_fb_idx];
-
- vp8_find_near_mvs(&x->e_mbd, x->e_mbd.mode_info_context,
- x->e_mbd.prev_mode_info_context,
- &nearest_mv[GOLDEN_FRAME], &near_mv[GOLDEN_FRAME],
- &frame_best_ref_mv[GOLDEN_FRAME], MDCounts[GOLDEN_FRAME], GOLDEN_FRAME, cpi->common.ref_frame_sign_bias);
-
- y_buffer[GOLDEN_FRAME] = gld_yv12->y_buffer + recon_yoffset;
- u_buffer[GOLDEN_FRAME] = gld_yv12->u_buffer + recon_uvoffset;
- v_buffer[GOLDEN_FRAME] = gld_yv12->v_buffer + recon_uvoffset;
- }
- else
- skip_mode[GOLDEN_FRAME] = 1;
-
- if (cpi->ref_frame_flags & VP8_ALT_FLAG && cpi->source_alt_ref_active)
- {
- YV12_BUFFER_CONFIG *alt_yv12 = &cpi->common.yv12_fb[cpi->common.alt_fb_idx];
-
- vp8_find_near_mvs(&x->e_mbd, x->e_mbd.mode_info_context,
- x->e_mbd.prev_mode_info_context,
- &nearest_mv[ALTREF_FRAME], &near_mv[ALTREF_FRAME],
- &frame_best_ref_mv[ALTREF_FRAME], MDCounts[ALTREF_FRAME], ALTREF_FRAME, cpi->common.ref_frame_sign_bias);
-
- y_buffer[ALTREF_FRAME] = alt_yv12->y_buffer + recon_yoffset;
- u_buffer[ALTREF_FRAME] = alt_yv12->u_buffer + recon_uvoffset;
- v_buffer[ALTREF_FRAME] = alt_yv12->v_buffer + recon_uvoffset;
- }
- else
- skip_mode[ALTREF_FRAME] = 1;
-
- cpi->mbs_tested_so_far++; // Count of the number of MBs tested so far this frame
-
- *returnintra = INT_MAX;
- x->skip = 0;
-
- x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
-
- // if we encode a new mv this is important
- // find the best new motion vector
- for (mode_index = 0; mode_index < MAX_MODES; mode_index++)
- {
- int frame_cost;
- int this_rd = INT_MAX;
-
- if (best_rd <= cpi->rd_threshes[mode_index])
- continue;
-
- if (vp8_second_ref_frame_order[mode_index])
- continue;
-
- x->e_mbd.mode_info_context->mbmi.ref_frame = vp8_ref_frame_order[mode_index];
-
- if (skip_mode[x->e_mbd.mode_info_context->mbmi.ref_frame])
- continue;
-
- this_mode = vp8_mode_order[mode_index];
-
- // If the segment reference frame feature is enabled....
- // then do nothing if the current ref frame is not allowed..
- if ( segfeature_active( xd, segment_id, SEG_LVL_REF_FRAME ) &&
- !check_segref( xd, segment_id,
- xd->mode_info_context->mbmi.ref_frame ) )
- {
- continue;
- }
- // If the segment mode feature is enabled....
- // then do nothing if the current mode is not allowed..
- else if ( segfeature_active( xd, segment_id, SEG_LVL_MODE ) &&
- ( this_mode !=
- get_segdata( xd, segment_id, SEG_LVL_MODE ) ) )
- {
- continue;
- }
-#if CONFIG_T8X8
- // No 4x4 modes if segment flagged as 8x8
- else if ( ( get_seg_tx_type( xd, segment_id ) == TX_8X8 ) &&
- ( (this_mode == B_PRED) || (this_mode == SPLITMV) ) )
- {
- continue;
- }
-#endif
- // Disable this drop out case if either the mode or ref frame
- // segment level feature is enabled for this segment. This is to
- // prevent the possibility that the we end up unable to pick any mode.
- else if ( !segfeature_active( xd, segment_id, SEG_LVL_REF_FRAME ) &&
- !segfeature_active( xd, segment_id, SEG_LVL_MODE ) )
- {
- // Only consider ZEROMV/ALTREF_FRAME for alt ref frame,
- // unless ARNR filtering is enabled in which case we want
- // an unfiltered alternative
- if (cpi->is_src_frame_alt_ref && (cpi->oxcf.arnr_max_frames == 0))
- {
- if (this_mode != ZEROMV ||
- x->e_mbd.mode_info_context->mbmi.ref_frame != ALTREF_FRAME)
- continue;
- }
- }
-
- // We have now reached the point where we are going to test the current mode so increment the counter for the number of times it has been tested
- cpi->mode_test_hit_counts[mode_index] ++;
-
- rate2 = 0;
- distortion2 = 0;
-
- // Experimental debug code.
- //all_rds[mode_index] = -1;
-
- x->e_mbd.mode_info_context->mbmi.mode = this_mode;
- x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
-
-
-// #if CONFIG_COMPRED
-// TODO... this will need changing for new reference frame coding model
-// #endif
- // Work out the cost assosciated with selecting the reference frame
- frame_cost =
- x->e_mbd.ref_frame_cost[x->e_mbd.mode_info_context->mbmi.ref_frame];
- rate2 += frame_cost;
-
- // everything but intra
- if (x->e_mbd.mode_info_context->mbmi.ref_frame)
- {
- x->e_mbd.pre.y_buffer = y_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame];
- x->e_mbd.pre.u_buffer = u_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame];
- x->e_mbd.pre.v_buffer = v_buffer[x->e_mbd.mode_info_context->mbmi.ref_frame];
- mode_mv[NEARESTMV] = nearest_mv[x->e_mbd.mode_info_context->mbmi.ref_frame];
- mode_mv[NEARMV] = near_mv[x->e_mbd.mode_info_context->mbmi.ref_frame];
- best_ref_mv = frame_best_ref_mv[x->e_mbd.mode_info_context->mbmi.ref_frame];
- memcpy(mdcounts, MDCounts[x->e_mbd.mode_info_context->mbmi.ref_frame], sizeof(mdcounts));
- }
-
- switch (this_mode)
- {
- case B_PRED:
- // Pass best so far to pick_intra4x4mby_modes to use as breakout
- distortion2 = best_sse;
- pick_intra4x4mby_modes(IF_RTCD(&cpi->rtcd), x, &rate, &distortion2);
-
- if (distortion2 == INT_MAX)
- {
- this_rd = INT_MAX;
- }
- else
- {
- rate2 += rate;
- distortion2 = VARIANCE_INVOKE
- (&cpi->rtcd.variance, var16x16)(
- *(b->base_src), b->src_stride,
- x->e_mbd.predictor, 16, &sse);
- this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
-
- if (this_rd < best_intra_rd)
- {
- best_intra_rd = this_rd;
- *returnintra = distortion2;
- }
- }
-
- break;
-
- case SPLITMV:
-
- // Split MV modes currently not supported when RD is nopt enabled.
- break;
-
- case DC_PRED:
- case V_PRED:
- case H_PRED:
- case TM_PRED:
- RECON_INVOKE(&cpi->common.rtcd.recon, build_intra_predictors_mby)
- (&x->e_mbd);
- distortion2 = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16)
- (*(b->base_src), b->src_stride,
- x->e_mbd.predictor, 16, &sse);
- rate2 += x->mbmode_cost[x->e_mbd.frame_type][x->e_mbd.mode_info_context->mbmi.mode];
- this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
-
- if (this_rd < best_intra_rd)
- {
- best_intra_rd = this_rd;
- *returnintra = distortion2;
- }
- break;
-
- case NEWMV:
- {
- int thissme;
- int step_param;
- int further_steps;
- int n = 0;
- int sadpb = x->sadperbit16;
- int_mv mvp_full;
-
- int col_min = (best_ref_mv.as_mv.col>>3) - MAX_FULL_PEL_VAL + ((best_ref_mv.as_mv.col & 7)?1:0);
- int row_min = (best_ref_mv.as_mv.row>>3) - MAX_FULL_PEL_VAL + ((best_ref_mv.as_mv.row & 7)?1:0);
- int col_max = (best_ref_mv.as_mv.col>>3) + MAX_FULL_PEL_VAL;
- int row_max = (best_ref_mv.as_mv.row>>3) + MAX_FULL_PEL_VAL;
-
- int tmp_col_min = x->mv_col_min;
- int tmp_col_max = x->mv_col_max;
- int tmp_row_min = x->mv_row_min;
- int tmp_row_max = x->mv_row_max;
-
- int speed_adjust = (cpi->Speed > 5) ? ((cpi->Speed >= 8)? 3 : 2) : 1;
-
- // Further step/diamond searches as necessary
- step_param = cpi->sf.first_step + speed_adjust;
-
- if(cpi->sf.improved_mv_pred)
- {
- if(!saddone)
- {
- vp8_cal_sad(cpi,xd,x, recon_yoffset ,&near_sadidx[0] );
- saddone = 1;
- }
-
- vp8_mv_pred(cpi, &x->e_mbd, x->e_mbd.mode_info_context, &mvp,
- x->e_mbd.mode_info_context->mbmi.ref_frame, cpi->common.ref_frame_sign_bias, &sr, &near_sadidx[0]);
-
- sr += speed_adjust;
- //adjust search range according to sr from mv prediction
- if(sr > step_param)
- step_param = sr;
-
- mvp_full.as_mv.col = mvp.as_mv.col>>3;
- mvp_full.as_mv.row = mvp.as_mv.row>>3;
-
- }else
- {
- mvp.as_int = best_ref_mv.as_int;
- mvp_full.as_mv.col = best_ref_mv.as_mv.col>>3;
- mvp_full.as_mv.row = best_ref_mv.as_mv.row>>3;
- }
-
- // Get intersection of UMV window and valid MV window to reduce # of checks in diamond search.
- if (x->mv_col_min < col_min )
- x->mv_col_min = col_min;
- if (x->mv_col_max > col_max )
- x->mv_col_max = col_max;
- if (x->mv_row_min < row_min )
- x->mv_row_min = row_min;
- if (x->mv_row_max > row_max )
- x->mv_row_max = row_max;
-
- further_steps = (cpi->Speed >= 8)? 0: (cpi->sf.max_step_search_steps - 1 - step_param);
-
- if (cpi->sf.search_method == HEX)
- {
- bestsme = vp8_hex_search(x, b, d, &mvp_full, &d->bmi.mv, step_param,
- sadpb, &cpi->fn_ptr[BLOCK_16X16],
- x->mvsadcost, x->mvcost, &best_ref_mv);
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
- }
- else
- {
- bestsme = cpi->diamond_search_sad(x, b, d, &mvp_full, &d->bmi.mv,
- step_param, sadpb, &num00,
- &cpi->fn_ptr[BLOCK_16X16],
- x->mvcost, &best_ref_mv);
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
-
- // Further step/diamond searches as necessary
- n = 0;
- //further_steps = (cpi->sf.max_step_search_steps - 1) - step_param;
-
- n = num00;
- num00 = 0;
-
- while (n < further_steps)
- {
- n++;
-
- if (num00)
- num00--;
- else
- {
- thissme =
- cpi->diamond_search_sad(x, b, d, &mvp_full,
- &d->bmi.mv,
- step_param + n,
- sadpb, &num00,
- &cpi->fn_ptr[BLOCK_16X16],
- x->mvcost, &best_ref_mv);
- if (thissme < bestsme)
- {
- bestsme = thissme;
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
- }
- else
- {
- d->bmi.mv.as_int = mode_mv[NEWMV].as_int;
- }
- }
- }
- }
-
- x->mv_col_min = tmp_col_min;
- x->mv_col_max = tmp_col_max;
- x->mv_row_min = tmp_row_min;
- x->mv_row_max = tmp_row_max;
-
- if (bestsme < INT_MAX)
- cpi->find_fractional_mv_step(x, b, d, &d->bmi.mv, &best_ref_mv,
- x->errorperbit,
- &cpi->fn_ptr[BLOCK_16X16],
- cpi->mb.mvcost,
- &distortion2,&sse);
-
- mode_mv[NEWMV].as_int = d->bmi.mv.as_int;
-
- // mv cost;
- rate2 += vp8_mv_bit_cost(&mode_mv[NEWMV], &best_ref_mv, cpi->mb.mvcost, 128);
- }
-
- case NEARESTMV:
- case NEARMV:
-
- if (mode_mv[this_mode].as_int == 0)
- continue;
-
- case ZEROMV:
-
- // Trap vectors that reach beyond the UMV borders
- // Note that ALL New MV, Nearest MV Near MV and Zero MV code drops through to this point
- // because of the lack of break statements in the previous two cases.
- if (((mode_mv[this_mode].as_mv.row >> 3) < x->mv_row_min) || ((mode_mv[this_mode].as_mv.row >> 3) > x->mv_row_max) ||
- ((mode_mv[this_mode].as_mv.col >> 3) < x->mv_col_min) || ((mode_mv[this_mode].as_mv.col >> 3) > x->mv_col_max))
- continue;
-
- rate2 += vp8_cost_mv_ref(&cpi->common, this_mode, mdcounts);
- x->e_mbd.mode_info_context->mbmi.mv.as_int =
- mode_mv[this_mode].as_int;
-
- /* Exit early and don't compute the distortion if this macroblock is marked inactive. */
- if (cpi->active_map_enabled && x->active_ptr[0] == 0)
- {
- sse = 0;
- distortion2 = 0;
- x->skip = 1;
- break;
- }
-
- if((this_mode != NEWMV) ||
- !(have_subp_search) || cpi->common.full_pixel==1)
- distortion2 = get_inter_mbpred_error(x,
- &cpi->fn_ptr[BLOCK_16X16],
- &sse, mode_mv[this_mode]);
-
- this_rd = RDCOST(x->rdmult, x->rddiv, rate2, distortion2);
-
- if (sse < x->encode_breakout)
- {
- // Check u and v to make sure skip is ok
- int sse2 = 0;
-
- sse2 = VP8_UVSSE(x, IF_RTCD(&cpi->rtcd.variance));
-
- if (sse2 * 2 < x->encode_breakout)
- x->skip = 1;
- else
- x->skip = 0;
- }
-
- break;
- default:
- break;
- }
-
- // Experimental debug code.
- //all_rds[mode_index] = this_rd;
-
- if (this_rd < best_rd || x->skip)
- {
- // Note index of best mode
- best_mode_index = mode_index;
-
- *returnrate = rate2;
- *returndistortion = distortion2;
- best_sse = sse;
- best_rd = this_rd;
- vpx_memcpy(&best_mbmode, &x->e_mbd.mode_info_context->mbmi, sizeof(MB_MODE_INFO));
-
- // Testing this mode gave rise to an improvement in best error score. Lower threshold a bit for next time
- cpi->rd_thresh_mult[mode_index] = (cpi->rd_thresh_mult[mode_index] >= (MIN_THRESHMULT + 2)) ? cpi->rd_thresh_mult[mode_index] - 2 : MIN_THRESHMULT;
- cpi->rd_threshes[mode_index] = (cpi->rd_baseline_thresh[mode_index] >> 7) * cpi->rd_thresh_mult[mode_index];
- }
-
- // If the mode did not help improve the best error case then raise the threshold for testing that mode next time around.
- else
- {
- cpi->rd_thresh_mult[mode_index] += 4;
-
- if (cpi->rd_thresh_mult[mode_index] > MAX_THRESHMULT)
- cpi->rd_thresh_mult[mode_index] = MAX_THRESHMULT;
-
- cpi->rd_threshes[mode_index] = (cpi->rd_baseline_thresh[mode_index] >> 7) * cpi->rd_thresh_mult[mode_index];
- }
-
- if (x->skip)
- break;
- }
-
- // Reduce the activation RD thresholds for the best choice mode
- if ((cpi->rd_baseline_thresh[best_mode_index] > 0) && (cpi->rd_baseline_thresh[best_mode_index] < (INT_MAX >> 2)))
- {
- int best_adjustment = (cpi->rd_thresh_mult[best_mode_index] >> 3);
-
- cpi->rd_thresh_mult[best_mode_index] = (cpi->rd_thresh_mult[best_mode_index] >= (MIN_THRESHMULT + best_adjustment)) ? cpi->rd_thresh_mult[best_mode_index] - best_adjustment : MIN_THRESHMULT;
- cpi->rd_threshes[best_mode_index] = (cpi->rd_baseline_thresh[best_mode_index] >> 7) * cpi->rd_thresh_mult[best_mode_index];
- }
-
-
- {
- int this_rdbin = (*returndistortion >> 7);
-
- if (this_rdbin >= 1024)
- {
- this_rdbin = 1023;
- }
-
- cpi->error_bins[this_rdbin] ++;
- }
-
- // This code force Altref,0,0 and skip for the frame that overlays a
- // an alrtef unless Altref is filtered. However, this is unsafe if
- // segment level coding of ref frame or mode is enabled for this
- // segment.
- if (!segfeature_active( xd, segment_id, SEG_LVL_REF_FRAME ) &&
- !segfeature_active( xd, segment_id, SEG_LVL_MODE ) &&
- cpi->is_src_frame_alt_ref &&
- (cpi->oxcf.arnr_max_frames == 0) &&
- (best_mbmode.mode != ZEROMV || best_mbmode.ref_frame != ALTREF_FRAME))
- {
- x->e_mbd.mode_info_context->mbmi.mode = ZEROMV;
- x->e_mbd.mode_info_context->mbmi.ref_frame = ALTREF_FRAME;
- x->e_mbd.mode_info_context->mbmi.mv.as_int = 0;
- x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED;
- x->e_mbd.mode_info_context->mbmi.mb_skip_coeff =
- (cpi->common.mb_no_coeff_skip) ? 1 : 0;
- x->e_mbd.mode_info_context->mbmi.partitioning = 0;
-
- return;
- }
-
- /* set to the best mb mode */
- vpx_memcpy(&x->e_mbd.mode_info_context->mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
-
- if (best_mbmode.mode <= B_PRED)
- {
- /* set mode_info_context->mbmi.uv_mode */
- pick_intra_mbuv_mode(x);
- }
-
- update_mvcount(cpi, &x->e_mbd, &frame_best_ref_mv[xd->mode_info_context->mbmi.ref_frame]);
-}
-
-
-void vp8_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate_)
-{
- MACROBLOCKD *xd = &x->e_mbd;
- int error4x4, error16x16 = INT_MAX;
- int rate, best_rate = 0, distortion, best_sse;
- MB_PREDICTION_MODE mode, best_mode = DC_PRED;
- int this_rd;
- unsigned int sse;
- BLOCK *b = &x->block[0];
-
- x->e_mbd.mode_info_context->mbmi.ref_frame = INTRA_FRAME;
-
- pick_intra_mbuv_mode(x);
-
- for (mode = DC_PRED; mode <= TM_PRED; mode ++)
- {
- x->e_mbd.mode_info_context->mbmi.mode = mode;
- RECON_INVOKE(&cpi->common.rtcd.recon, build_intra_predictors_mby)
- (&x->e_mbd);
- distortion = VARIANCE_INVOKE(&cpi->rtcd.variance, var16x16)
- (*(b->base_src), b->src_stride, x->e_mbd.predictor, 16, &sse);
- rate = x->mbmode_cost[x->e_mbd.frame_type][mode];
- this_rd = RDCOST(x->rdmult, x->rddiv, rate, distortion);
-
- if (error16x16 > this_rd)
- {
- error16x16 = this_rd;
- best_mode = mode;
- best_sse = sse;
- best_rate = rate;
- }
- }
- x->e_mbd.mode_info_context->mbmi.mode = best_mode;
-
-#if CONFIG_T8X8
- if ( get_seg_tx_type( xd,
- xd->mode_info_context->mbmi.segment_id ) == TX_4X4 )
- {
- error4x4 = pick_intra4x4mby_modes(IF_RTCD(&cpi->rtcd), x, &rate,
- &best_sse);
- }
- else
- {
- error4x4 = INT_MAX;
- }
-#else
- error4x4 = pick_intra4x4mby_modes(IF_RTCD(&cpi->rtcd), x, &rate,
- &best_sse);
-#endif
-
- if (error4x4 < error16x16)
- {
- x->e_mbd.mode_info_context->mbmi.mode = B_PRED;
- best_rate = rate;
- }
-
- *rate_ = best_rate;
-}
diff --git a/vp8/encoder/pickinter.h b/vp8/encoder/pickinter.h
deleted file mode 100644
index a0103d165..000000000
--- a/vp8/encoder/pickinter.h
+++ /dev/null
@@ -1,19 +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 __INC_PICKINTER_H
-#define __INC_PICKINTER_H
-#include "vpx_ports/config.h"
-#include "vp8/common/onyxc_int.h"
-
-extern void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int recon_uvoffset, int *returnrate, int *returndistortion, int *returnintra);
-extern void vp8_pick_intra_mode(VP8_COMP *cpi, MACROBLOCK *x, int *rate);
-#endif
diff --git a/vp8/encoder/ppc/csystemdependent.c b/vp8/encoder/ppc/csystemdependent.c
index 63f235784..49b1dd6a9 100644
--- a/vp8/encoder/ppc/csystemdependent.c
+++ b/vp8/encoder/ppc/csystemdependent.c
@@ -48,8 +48,6 @@ void (*vp8_subtract_mby)(short *diff, unsigned char *src, unsigned char *pred, i
void (*vp8_subtract_mbuv)(short *diff, unsigned char *usrc, unsigned char *vsrc, unsigned char *pred, int stride);
void (*vp8_fast_quantize_b)(BLOCK *b, BLOCKD *d);
-unsigned int (*vp8_get4x4sse_cs)(unsigned char *src_ptr, int source_stride, unsigned char *ref_ptr, int recon_stride);
-
// c imports
extern int block_error_c(short *coeff, short *dqcoeff);
extern int vp8_mbblock_error_c(MACROBLOCK *mb, int dc);
@@ -85,7 +83,6 @@ extern sub_pixel_variance_function sub_pixel_variance16x8_c;
extern sub_pixel_variance_function sub_pixel_variance16x16_c;
extern unsigned int vp8_get_mb_ss_c(short *);
-extern unsigned int vp8_get4x4sse_cs_c(unsigned char *src_ptr, int source_stride, unsigned char *ref_ptr, int recon_stride);
// ppc
extern int vp8_block_error_ppc(short *coeff, short *dqcoeff);
@@ -143,7 +140,6 @@ void vp8_cmachine_specific_config(void)
vp8_sub_pixel_variance16x16 = vp8_sub_pixel_variance16x16_ppc;
vp8_get_mb_ss = vp8_get_mb_ss_c;
- vp8_get4x4sse_cs = vp8_get4x4sse_cs_c;
vp8_sad16x16 = vp8_sad16x16_ppc;
vp8_sad16x8 = vp8_sad16x8_ppc;
diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c
index 5d4121fac..eb04f2bd7 100644
--- a/vp8/encoder/ratectrl.c
+++ b/vp8/encoder/ratectrl.c
@@ -315,46 +315,11 @@ static void calc_iframe_target_size(VP8_COMP *cpi)
target = estimate_bits_at_q(INTRA_FRAME, Q, cpi->common.MBs,
cpi->key_frame_rate_correction_factor);
}
- else if (cpi->pass == 2)
+ else
{
// New Two pass RC
target = cpi->per_frame_bandwidth;
}
- // First Frame is a special case
- else if (cpi->common.current_video_frame == 0)
- {
- /* 1 Pass there is no information on which to base size so use
- * bandwidth per second * fraction of the initial buffer
- * level
- */
- target = cpi->oxcf.starting_buffer_level / 2;
-
- if(target > cpi->oxcf.target_bandwidth * 3 / 2)
- target = cpi->oxcf.target_bandwidth * 3 / 2;
- }
- else
- {
- // if this keyframe was forced, use a more recent Q estimate
- int Q = (cpi->common.frame_flags & FRAMEFLAGS_KEY)
- ? cpi->avg_frame_qindex : cpi->ni_av_qi;
-
- // Boost depends somewhat on frame rate
- kf_boost = (int)(2 * cpi->output_frame_rate - 16);
-
- // adjustment up based on q
- kf_boost = kf_boost * kfboost_qadjust(Q) / 100;
-
- // frame separation adjustment ( down)
- if (cpi->frames_since_key < cpi->output_frame_rate / 2)
- kf_boost = (int)(kf_boost
- * cpi->frames_since_key / (cpi->output_frame_rate / 2));
-
- if (kf_boost < 16)
- kf_boost = 16;
-
- target = ((16 + kf_boost) * cpi->per_frame_bandwidth) >> 4;
- }
-
if (cpi->oxcf.rc_max_intra_bitrate_pct)
{
@@ -367,15 +332,12 @@ static void calc_iframe_target_size(VP8_COMP *cpi)
cpi->this_frame_target = target;
- // TODO: if we separate rate targeting from Q targetting, move this.
- // Reset the active worst quality to the baseline value for key frames.
- if (cpi->pass != 2)
- cpi->active_worst_quality = cpi->worst_quality;
-
}
-// Do the best we can to define the parameteres for the next GF based on what information we have available.
+// Do the best we can to define the parameteres for the next GF based
+// on what information we have available.
+// In this experimental code only two pass is supported.
static void calc_gf_params(VP8_COMP *cpi)
{
int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.fixed_q;
@@ -398,150 +360,8 @@ static void calc_gf_params(VP8_COMP *cpi)
if (pct_gf_active > gf_frame_useage)
gf_frame_useage = pct_gf_active;
- // Not two pass
- if (cpi->pass != 2)
- {
- // Single Pass lagged mode: TBD
- if (FALSE)
- {
- }
-
- // Single Pass compression: Has to use current and historical data
- else
- {
-#if 0
- // Experimental code
- int index = cpi->one_pass_frame_index;
- int frames_to_scan = (cpi->max_gf_interval <= MAX_LAG_BUFFERS) ? cpi->max_gf_interval : MAX_LAG_BUFFERS;
-
- /*
- // *************** Experimental code - incomplete
- double decay_val = 1.0;
- double IIAccumulator = 0.0;
- double last_iiaccumulator = 0.0;
- double IIRatio;
-
- cpi->one_pass_frame_index = cpi->common.current_video_frame%MAX_LAG_BUFFERS;
-
- for ( i = 0; i < (frames_to_scan - 1); i++ )
- {
- if ( index < 0 )
- index = MAX_LAG_BUFFERS;
- index --;
-
- if ( cpi->one_pass_frame_stats[index].frame_coded_error > 0.0 )
- {
- IIRatio = cpi->one_pass_frame_stats[index].frame_intra_error / cpi->one_pass_frame_stats[index].frame_coded_error;
-
- if ( IIRatio > 30.0 )
- IIRatio = 30.0;
- }
- else
- IIRatio = 30.0;
-
- IIAccumulator += IIRatio * decay_val;
-
- decay_val = decay_val * cpi->one_pass_frame_stats[index].frame_pcnt_inter;
-
- if ( (i > MIN_GF_INTERVAL) &&
- ((IIAccumulator - last_iiaccumulator) < 2.0) )
- {
- break;
- }
- last_iiaccumulator = IIAccumulator;
- }
-
- Boost = IIAccumulator*100.0/16.0;
- cpi->baseline_gf_interval = i;
-
- */
-#else
-
- /*************************************************************/
- // OLD code
-
- // Adjust boost based upon ambient Q
- Boost = vp8_gfboost_qadjust(Q);
-
- // Adjust based upon most recently measure intra useage
- Boost = Boost * gf_intra_usage_adjustment[(cpi->this_frame_percent_intra < 15) ? cpi->this_frame_percent_intra : 14] / 100;
-
- // Adjust gf boost based upon GF usage since last GF
- Boost = Boost * gf_adjust_table[gf_frame_useage] / 100;
-#endif
- }
-
- // golden frame boost without recode loop often goes awry. be safe by keeping numbers down.
- if (!cpi->sf.recode_loop)
- {
- if (cpi->compressor_speed == 2)
- Boost = Boost / 2;
- }
-
- // Apply an upper limit based on Q for 1 pass encodes
- // TODO.
- // This is a temporay measure oas one pass not really supported yet in
- // the experimental branch
- if (Boost > 600 && (cpi->pass == 0))
- Boost = 600;
-
- // Apply lower limits to boost.
- else if (Boost < 110)
- Boost = 110;
-
- // Note the boost used
- cpi->last_boost = Boost;
-
- }
-
- // Estimate next interval
- // This is updated once the real frame size/boost is known.
- if (cpi->oxcf.fixed_q == -1)
- {
- if (cpi->pass == 2) // 2 Pass
- {
- cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
- }
- else // 1 Pass
- {
- cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
-
- if (cpi->last_boost > 750)
- cpi->frames_till_gf_update_due++;
-
- if (cpi->last_boost > 1000)
- cpi->frames_till_gf_update_due++;
-
- if (cpi->last_boost > 1250)
- cpi->frames_till_gf_update_due++;
-
- if (cpi->last_boost >= 1500)
- cpi->frames_till_gf_update_due ++;
-
- if (gf_interval_table[gf_frame_useage] > cpi->frames_till_gf_update_due)
- cpi->frames_till_gf_update_due = gf_interval_table[gf_frame_useage];
-
- if (cpi->frames_till_gf_update_due > cpi->max_gf_interval)
- cpi->frames_till_gf_update_due = cpi->max_gf_interval;
- }
- }
- else
- cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
-
- // ARF on or off
- if (cpi->pass != 2)
- {
- // For now Alt ref is not allowed except in 2 pass modes.
- cpi->source_alt_ref_pending = FALSE;
-
- /*if ( cpi->oxcf.fixed_q == -1)
- {
- if ( cpi->oxcf.play_alternate && (cpi->last_boost > (100 + (AF_THRESH*cpi->frames_till_gf_update_due)) ) )
- cpi->source_alt_ref_pending = TRUE;
- else
- cpi->source_alt_ref_pending = FALSE;
- }*/
- }
+ // Set the gf interval
+ cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
}
@@ -552,155 +372,24 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
min_frame_target = 0;
- if (cpi->pass == 2)
- {
- min_frame_target = cpi->min_frame_bandwidth;
+ min_frame_target = cpi->min_frame_bandwidth;
- if (min_frame_target < (cpi->av_per_frame_bandwidth >> 5))
- min_frame_target = cpi->av_per_frame_bandwidth >> 5;
- }
- else if (min_frame_target < cpi->per_frame_bandwidth / 4)
- min_frame_target = cpi->per_frame_bandwidth / 4;
+ if (min_frame_target < (cpi->av_per_frame_bandwidth >> 5))
+ min_frame_target = cpi->av_per_frame_bandwidth >> 5;
// Special alt reference frame case
if (cpi->common.refresh_alt_ref_frame)
{
- if (cpi->pass == 2)
- {
- cpi->per_frame_bandwidth = cpi->twopass.gf_bits; // Per frame bit target for the alt ref frame
- cpi->this_frame_target = cpi->per_frame_bandwidth;
- }
-
- /* One Pass ??? TBD */
- /*else
- {
- int frames_in_section;
- int allocation_chunks;
- int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.fixed_q;
- int alt_boost;
- int max_arf_rate;
-
- alt_boost = (cpi->gfu_boost * 3 * vp8_gfboost_qadjust(Q)) / (2 * 100);
- alt_boost += (cpi->frames_till_gf_update_due * 50);
-
- // If alt ref is not currently active then we have a pottential double hit with GF and ARF so reduce the boost a bit.
- // A similar thing is done on GFs that preceed a arf update.
- if ( !cpi->source_alt_ref_active )
- alt_boost = alt_boost * 3 / 4;
-
- frames_in_section = cpi->frames_till_gf_update_due+1; // Standard frames + GF
- allocation_chunks = (frames_in_section * 100) + alt_boost;
-
- // Normalize Altboost and allocations chunck down to prevent overflow
- while ( alt_boost > 1000 )
- {
- alt_boost /= 2;
- allocation_chunks /= 2;
- }
-
- else
- {
- int bits_in_section;
-
- if ( cpi->kf_overspend_bits > 0 )
- {
- Adjustment = (cpi->kf_bitrate_adjustment <= cpi->kf_overspend_bits) ? cpi->kf_bitrate_adjustment : cpi->kf_overspend_bits;
-
- if ( Adjustment > (cpi->per_frame_bandwidth - min_frame_target) )
- Adjustment = (cpi->per_frame_bandwidth - min_frame_target);
-
- cpi->kf_overspend_bits -= Adjustment;
-
- // Calculate an inter frame bandwidth target for the next few frames designed to recover
- // any extra bits spent on the key frame.
- cpi->inter_frame_target = cpi->per_frame_bandwidth - Adjustment;
- if ( cpi->inter_frame_target < min_frame_target )
- cpi->inter_frame_target = min_frame_target;
- }
- else
- cpi->inter_frame_target = cpi->per_frame_bandwidth;
-
- bits_in_section = cpi->inter_frame_target * frames_in_section;
-
- // Avoid loss of precision but avoid overflow
- if ( (bits_in_section>>7) > allocation_chunks )
- cpi->this_frame_target = alt_boost * (bits_in_section / allocation_chunks);
- else
- cpi->this_frame_target = (alt_boost * bits_in_section) / allocation_chunks;
- }
- }
- */
+ // Per frame bit target for the alt ref frame
+ cpi->per_frame_bandwidth = cpi->twopass.gf_bits;
+ cpi->this_frame_target = cpi->per_frame_bandwidth;
}
// Normal frames (gf,and inter)
else
{
- // 2 pass
- if (cpi->pass == 2)
- {
- cpi->this_frame_target = cpi->per_frame_bandwidth;
- }
- // 1 pass
- else
- {
- // Make rate adjustment to recover bits spent in key frame
- // Test to see if the key frame inter data rate correction should still be in force
- if (cpi->kf_overspend_bits > 0)
- {
- Adjustment = (cpi->kf_bitrate_adjustment <= cpi->kf_overspend_bits) ? cpi->kf_bitrate_adjustment : cpi->kf_overspend_bits;
-
- if (Adjustment > (cpi->per_frame_bandwidth - min_frame_target))
- Adjustment = (cpi->per_frame_bandwidth - min_frame_target);
-
- cpi->kf_overspend_bits -= Adjustment;
-
- // Calculate an inter frame bandwidth target for the next few frames designed to recover
- // any extra bits spent on the key frame.
- cpi->this_frame_target = cpi->per_frame_bandwidth - Adjustment;
-
- if (cpi->this_frame_target < min_frame_target)
- cpi->this_frame_target = min_frame_target;
- }
- else
- cpi->this_frame_target = cpi->per_frame_bandwidth;
-
- // If appropriate make an adjustment to recover bits spent on a recent GF
- if ((cpi->gf_overspend_bits > 0) && (cpi->this_frame_target > min_frame_target))
- {
- int Adjustment = (cpi->non_gf_bitrate_adjustment <= cpi->gf_overspend_bits) ? cpi->non_gf_bitrate_adjustment : cpi->gf_overspend_bits;
-
- if (Adjustment > (cpi->this_frame_target - min_frame_target))
- Adjustment = (cpi->this_frame_target - min_frame_target);
-
- cpi->gf_overspend_bits -= Adjustment;
- cpi->this_frame_target -= Adjustment;
- }
-
- // Apply small + and - boosts for non gf frames
- if ((cpi->last_boost > 150) && (cpi->frames_till_gf_update_due > 0) &&
- (cpi->current_gf_interval >= (MIN_GF_INTERVAL << 1)))
- {
- // % Adjustment limited to the range 1% to 10%
- Adjustment = (cpi->last_boost - 100) >> 5;
-
- if (Adjustment < 1)
- Adjustment = 1;
- else if (Adjustment > 10)
- Adjustment = 10;
-
- // Convert to bits
- Adjustment = (cpi->this_frame_target * Adjustment) / 100;
-
- if (Adjustment > (cpi->this_frame_target - min_frame_target))
- Adjustment = (cpi->this_frame_target - min_frame_target);
-
- if (cpi->common.frames_since_golden == (cpi->current_gf_interval >> 1))
- cpi->this_frame_target += ((cpi->current_gf_interval - 1) * Adjustment);
- else
- cpi->this_frame_target -= Adjustment;
- }
- }
+ cpi->this_frame_target = cpi->per_frame_bandwidth;
}
// Sanity check that the total sum of adjustments is not above the maximum allowed
@@ -715,178 +404,6 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
// Note the baseline target data rate for this inter frame.
cpi->inter_frame_target = cpi->this_frame_target;
- // One Pass specific code
- if (cpi->pass == 0)
- {
- // Adapt target frame size with respect to any buffering constraints:
- if (cpi->buffered_mode)
- {
- int one_percent_bits = 1 + cpi->oxcf.optimal_buffer_level / 100;
-
- if ((cpi->buffer_level < cpi->oxcf.optimal_buffer_level) ||
- (cpi->bits_off_target < cpi->oxcf.optimal_buffer_level))
- {
- int percent_low = 0;
-
- // Decide whether or not we need to adjust the frame data rate target.
- //
- // If we are are below the optimal buffer fullness level and adherence
- // to buffering contraints is important to the end useage then adjust
- // the per frame target.
- if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) &&
- (cpi->buffer_level < cpi->oxcf.optimal_buffer_level))
- {
- percent_low =
- (cpi->oxcf.optimal_buffer_level - cpi->buffer_level) /
- one_percent_bits;
- }
- // Are we overshooting the long term clip data rate...
- else if (cpi->bits_off_target < 0)
- {
- // Adjust per frame data target downwards to compensate.
- percent_low = (int)(100 * -cpi->bits_off_target /
- (cpi->total_byte_count * 8));
- }
-
- if (percent_low > cpi->oxcf.under_shoot_pct)
- percent_low = cpi->oxcf.under_shoot_pct;
- else if (percent_low < 0)
- percent_low = 0;
-
- // lower the target bandwidth for this frame.
- cpi->this_frame_target -= (cpi->this_frame_target * percent_low)
- / 200;
-
- // Are we using allowing control of active_worst_allowed_q
- // according to buffer level.
- if (cpi->auto_worst_q)
- {
- int critical_buffer_level;
-
- // For streaming applications the most important factor is
- // cpi->buffer_level as this takes into account the
- // specified short term buffering constraints. However,
- // hitting the long term clip data rate target is also
- // important.
- if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- {
- // Take the smaller of cpi->buffer_level and
- // cpi->bits_off_target
- critical_buffer_level =
- (cpi->buffer_level < cpi->bits_off_target)
- ? cpi->buffer_level : cpi->bits_off_target;
- }
- // For local file playback short term buffering contraints
- // are less of an issue
- else
- {
- // Consider only how we are doing for the clip as a
- // whole
- critical_buffer_level = cpi->bits_off_target;
- }
-
- // Set the active worst quality based upon the selected
- // buffer fullness number.
- if (critical_buffer_level < cpi->oxcf.optimal_buffer_level)
- {
- if ( critical_buffer_level >
- (cpi->oxcf.optimal_buffer_level >> 2) )
- {
- int64_t qadjustment_range =
- cpi->worst_quality - cpi->ni_av_qi;
- int64_t above_base =
- (critical_buffer_level -
- (cpi->oxcf.optimal_buffer_level >> 2));
-
- // Step active worst quality down from
- // cpi->ni_av_qi when (critical_buffer_level ==
- // cpi->optimal_buffer_level) to
- // cpi->worst_quality when
- // (critical_buffer_level ==
- // cpi->optimal_buffer_level >> 2)
- cpi->active_worst_quality =
- cpi->worst_quality -
- ((qadjustment_range * above_base) /
- (cpi->oxcf.optimal_buffer_level*3>>2));
- }
- else
- {
- cpi->active_worst_quality = cpi->worst_quality;
- }
- }
- else
- {
- cpi->active_worst_quality = cpi->ni_av_qi;
- }
- }
- else
- {
- cpi->active_worst_quality = cpi->worst_quality;
- }
- }
- else
- {
- int percent_high = 0;
-
- if ((cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER)
- && (cpi->buffer_level > cpi->oxcf.optimal_buffer_level))
- {
- percent_high = (cpi->buffer_level
- - cpi->oxcf.optimal_buffer_level)
- / one_percent_bits;
- }
- else if (cpi->bits_off_target > cpi->oxcf.optimal_buffer_level)
- {
- percent_high = (int)((100 * cpi->bits_off_target)
- / (cpi->total_byte_count * 8));
- }
-
- if (percent_high > cpi->oxcf.over_shoot_pct)
- percent_high = cpi->oxcf.over_shoot_pct;
- else if (percent_high < 0)
- percent_high = 0;
-
- cpi->this_frame_target += (cpi->this_frame_target *
- percent_high) / 200;
-
-
- // Are we allowing control of active_worst_allowed_q according to bufferl level.
- if (cpi->auto_worst_q)
- {
- // When using the relaxed buffer model stick to the user specified value
- cpi->active_worst_quality = cpi->ni_av_qi;
- }
- else
- {
- cpi->active_worst_quality = cpi->worst_quality;
- }
- }
-
- // Set active_best_quality to prevent quality rising too high
- cpi->active_best_quality = cpi->best_quality;
-
- // Worst quality obviously must not be better than best quality
- if (cpi->active_worst_quality <= cpi->active_best_quality)
- cpi->active_worst_quality = cpi->active_best_quality + 1;
-
- }
- // Unbuffered mode (eg. video conferencing)
- else
- {
- // Set the active worst quality
- cpi->active_worst_quality = cpi->worst_quality;
- }
-
- // Special trap for constrained quality mode
- // "active_worst_quality" may never drop below cq level
- // for any frame type.
- if ( cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY &&
- cpi->active_worst_quality < cpi->cq_target_quality)
- {
- cpi->active_worst_quality = cpi->cq_target_quality;
- }
- }
-
// Test to see if we have to drop a frame
// The auto-drop frame code is only used in buffered mode.
// In unbufferd mode (eg vide conferencing) the descision to
@@ -912,16 +429,6 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
cpi->drop_frame = TRUE;
}
-#if 0
- // Check for other drop frame crtieria (Note 2 pass cbr uses decimation on whole KF sections)
- else if ((cpi->buffer_level < cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100) &&
- (cpi->drop_count < cpi->max_drop_count) && (cpi->pass == 0))
- {
- cpi->drop_frame = TRUE;
- }
-
-#endif
-
if (cpi->drop_frame)
{
// Update the buffer level variable.
@@ -964,45 +471,11 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
// Is a fixed manual GF frequency being used
if (cpi->auto_gold)
{
- // For one pass throw a GF if recent frame intra useage is low or the GF useage is high
- if ((cpi->pass == 0) && (cpi->this_frame_percent_intra < 15 || gf_frame_useage >= 5))
- cpi->common.refresh_golden_frame = TRUE;
-
- // Two pass GF descision
- else if (cpi->pass == 2)
- cpi->common.refresh_golden_frame = TRUE;
+ cpi->common.refresh_golden_frame = TRUE;
}
-#if 0
-
- // Debug stats
- if (0)
- {
- FILE *f;
-
- f = fopen("gf_useaget.stt", "a");
- fprintf(f, " %8ld %10ld %10ld %10ld %10ld\n",
- cpi->common.current_video_frame, cpi->gfu_boost, vp8_gfboost_qadjust(Q), cpi->gfu_boost, gf_frame_useage);
- fclose(f);
- }
-
-#endif
-
if (cpi->common.refresh_golden_frame == TRUE)
{
-#if 0
-
- if (0) // p_gw
- {
- FILE *f;
-
- f = fopen("GFexit.stt", "a");
- fprintf(f, "%8ld GF coded\n", cpi->common.current_video_frame);
- fclose(f);
- }
-
-#endif
-
if (cpi->auto_adjust_gold_quantizer)
{
calc_gf_params(cpi);
@@ -1015,30 +488,9 @@ static void calc_pframe_target_size(VP8_COMP *cpi)
{
if (cpi->oxcf.fixed_q < 0)
{
- if (cpi->pass == 2)
- {
- cpi->this_frame_target = cpi->per_frame_bandwidth; // The spend on the GF is defined in the two pass code for two pass encodes
- }
- else
- {
- int Boost = cpi->last_boost;
- int frames_in_section = cpi->frames_till_gf_update_due + 1;
- int allocation_chunks = (frames_in_section * 100) + (Boost - 100);
- int bits_in_section = cpi->inter_frame_target * frames_in_section;
-
- // Normalize Altboost and allocations chunck down to prevent overflow
- while (Boost > 1000)
- {
- Boost /= 2;
- allocation_chunks /= 2;
- }
-
- // Avoid loss of precision but avoid overflow
- if ((bits_in_section >> 7) > allocation_chunks)
- cpi->this_frame_target = Boost * (bits_in_section / allocation_chunks);
- else
- cpi->this_frame_target = (Boost * bits_in_section) / allocation_chunks;
- }
+ // The spend on the GF is defined in the two pass code
+ // for two pass encodes
+ cpi->this_frame_target = cpi->per_frame_bandwidth;
}
else
cpi->this_frame_target =
@@ -1358,28 +810,6 @@ void vp8_adjust_key_frame_context(VP8_COMP *cpi)
// Clear down mmx registers to allow floating point in what follows
vp8_clear_system_state();
- // Do we have any key frame overspend to recover?
- // Two-pass overspend handled elsewhere.
- if ((cpi->pass != 2)
- && (cpi->projected_frame_size > cpi->per_frame_bandwidth))
- {
- int overspend;
-
- /* Update the count of key frame overspend to be recovered in
- * subsequent frames. A portion of the KF overspend is treated as gf
- * overspend (and hence recovered more quickly) as the kf is also a
- * gf. Otherwise the few frames following each kf tend to get more
- * bits allocated than those following other gfs.
- */
- overspend = (cpi->projected_frame_size - cpi->per_frame_bandwidth);
- cpi->kf_overspend_bits += overspend * 7 / 8;
- cpi->gf_overspend_bits += overspend * 1 / 8;
-
- /* Work out how much to try and recover per frame. */
- cpi->kf_bitrate_adjustment = cpi->kf_overspend_bits
- / estimate_keyframe_frequency(cpi);
- }
-
cpi->frames_since_key = 0;
cpi->key_frame_count++;
}
diff --git a/vp8/encoder/variance.h b/vp8/encoder/variance.h
index 711e81406..fde8ade09 100644
--- a/vp8/encoder/variance.h
+++ b/vp8/encoder/variance.h
@@ -315,11 +315,6 @@ extern prototype_getmbss(vp8_variance_getmbss);
#endif
extern prototype_variance(vp8_variance_mse16x16);
-#ifndef vp8_variance_get4x4sse_cs
-#define vp8_variance_get4x4sse_cs vp8_get4x4sse_cs_c
-#endif
-extern prototype_get16x16prederror(vp8_variance_get4x4sse_cs);
-
#ifndef vp8_ssimpf_8x8
#define vp8_ssimpf_8x8 vp8_ssim_parms_8x8_c
#endif
@@ -373,8 +368,6 @@ typedef struct
vp8_getmbss_fn_t getmbss;
vp8_variance_fn_t mse16x16;
- vp8_get16x16prederror_fn_t get4x4sse_cs;
-
vp8_sad_multi_fn_t sad16x16x3;
vp8_sad_multi_fn_t sad16x8x3;
vp8_sad_multi_fn_t sad8x16x3;
diff --git a/vp8/encoder/x86/variance_x86.h b/vp8/encoder/x86/variance_x86.h
index 4b41b5436..0971f11b0 100644
--- a/vp8/encoder/x86/variance_x86.h
+++ b/vp8/encoder/x86/variance_x86.h
@@ -42,7 +42,6 @@ extern prototype_subpixvariance(vp8_sub_pixel_mse16x16_mmx);
extern prototype_getmbss(vp8_get_mb_ss_mmx);
extern prototype_variance(vp8_mse16x16_mmx);
extern prototype_variance2(vp8_get8x8var_mmx);
-extern prototype_get16x16prederror(vp8_get4x4sse_cs_mmx);
#if !CONFIG_RUNTIME_CPU_DETECT
#undef vp8_variance_sad4x4
@@ -108,9 +107,6 @@ extern prototype_get16x16prederror(vp8_get4x4sse_cs_mmx);
#undef vp8_variance_mse16x16
#define vp8_variance_mse16x16 vp8_mse16x16_mmx
-#undef vp8_variance_get4x4sse_cs
-#define vp8_variance_get4x4sse_cs vp8_get4x4sse_cs_mmx
-
#endif
#endif
diff --git a/vp8/encoder/x86/x86_csystemdependent.c b/vp8/encoder/x86/x86_csystemdependent.c
index 9dc7dafb3..0c30e3707 100644
--- a/vp8/encoder/x86/x86_csystemdependent.c
+++ b/vp8/encoder/x86/x86_csystemdependent.c
@@ -152,8 +152,6 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi)
cpi->rtcd.variance.mse16x16 = vp8_mse16x16_mmx;
cpi->rtcd.variance.getmbss = vp8_get_mb_ss_mmx;
- cpi->rtcd.variance.get4x4sse_cs = vp8_get4x4sse_cs_mmx;
-
cpi->rtcd.fdct.short4x4 = vp8_short_fdct4x4_mmx;
cpi->rtcd.fdct.short8x4 = vp8_short_fdct8x4_mmx;
cpi->rtcd.fdct.fast4x4 = vp8_short_fdct4x4_mmx;
@@ -201,8 +199,6 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi)
cpi->rtcd.variance.mse16x16 = vp8_mse16x16_wmt;
cpi->rtcd.variance.getmbss = vp8_get_mb_ss_sse2;
- /* cpi->rtcd.variance.get4x4sse_cs not implemented for wmt */;
-
cpi->rtcd.fdct.short4x4 = vp8_short_fdct4x4_sse2;
cpi->rtcd.fdct.short8x4 = vp8_short_fdct8x4_sse2;
cpi->rtcd.fdct.fast4x4 = vp8_short_fdct4x4_sse2;
diff --git a/vp8/vp8cx.mk b/vp8/vp8cx.mk
index cd4c5a08a..0a0732e6e 100644
--- a/vp8/vp8cx.mk
+++ b/vp8/vp8cx.mk
@@ -57,7 +57,6 @@ VP8_CX_SRCS-yes += encoder/lookahead.h
VP8_CX_SRCS-yes += encoder/mcomp.h
VP8_CX_SRCS-yes += encoder/modecosts.h
VP8_CX_SRCS-yes += encoder/onyx_int.h
-VP8_CX_SRCS-yes += encoder/pickinter.h
VP8_CX_SRCS-yes += encoder/psnr.h
VP8_CX_SRCS-yes += encoder/quantize.h
VP8_CX_SRCS-yes += encoder/ratectrl.h
@@ -68,7 +67,6 @@ VP8_CX_SRCS-yes += encoder/variance.h
VP8_CX_SRCS-yes += encoder/mcomp.c
VP8_CX_SRCS-yes += encoder/modecosts.c
VP8_CX_SRCS-yes += encoder/onyx_if.c
-VP8_CX_SRCS-yes += encoder/pickinter.c
VP8_CX_SRCS-yes += encoder/picklpf.c
VP8_CX_SRCS-yes += encoder/psnr.c
VP8_CX_SRCS-yes += encoder/quantize.c