Commit 896b6a9b authored by John Koleszar's avatar John Koleszar

Merge snapshot 2 development history

Create a merge between the experimental development history and the
previously published snapshot.

Change-Id: If320df72a6bbefec53833626d08dbc9678be2d2d
parents 51dba57c a81baae7
......@@ -20,6 +20,7 @@ ifeq ($(target),)
all: .DEFAULT
clean:: .DEFAULT
install:: .DEFAULT
test:: .DEFAULT
# Note: md5sum is not installed on OS X, but openssl is. Openssl may not be
......@@ -78,12 +79,13 @@ qexec=$(if $(quiet),@)
%: %.o
%.asm:
%.a:
%: %.cc
#
# Common rules"
#
.PHONY: all-$(target)
all-$(target):
.PHONY: all
all:
.PHONY: clean
clean::
......@@ -94,6 +96,8 @@ clean::
dist:
.PHONY: install
install::
.PHONY: test
test::
$(BUILD_PFX)%.c.d: %.c
$(if $(quiet),@echo " [DEP] $@")
......@@ -104,6 +108,15 @@ $(BUILD_PFX)%.c.o: %.c
$(if $(quiet),@echo " [CC] $@")
$(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -c -o $@ $<
$(BUILD_PFX)%.cc.d: %.cc
$(if $(quiet),@echo " [DEP] $@")
$(qexec)mkdir -p $(dir $@)
$(qexec)g++ $(INTERNAL_CFLAGS) $(CFLAGS) -M $< | $(fmt_deps) > $@
$(BUILD_PFX)%.cc.o: %.cc
$(if $(quiet),@echo " [CXX] $@")
$(qexec)g++ $(INTERNAL_CFLAGS) $(CFLAGS) -c -o $@ $<
$(BUILD_PFX)%.asm.d: %.asm
$(if $(quiet),@echo " [DEP] $@")
$(qexec)mkdir -p $(dir $@)
......@@ -175,7 +188,7 @@ cond_enabled=$(if $(filter yes,$($(1))), $(call enabled,$(2)))
find_file1=$(word 1,$(wildcard $(subst //,/,$(addsuffix /$(1),$(2)))))
find_file=$(foreach f,$(1),$(call find_file1,$(strip $(f)),$(strip $(2))) )
obj_pats=.c=.c.o $(AS_SFX)=$(AS_SFX).o
obj_pats=.c=.c.o $(AS_SFX)=$(AS_SFX).o .cc=.cc.o
objs=$(addprefix $(BUILD_PFX),$(foreach p,$(obj_pats),$(filter %.o,$(1:$(p))) ))
install_map_templates=$(eval $(call install_map_template,$(1),$(2)))
......@@ -196,6 +209,12 @@ $(1):
$(if $(quiet),@echo " [LD] $$@")
$(qexec)$$(LD) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
endef
define linkerxx_template
$(1): $(filter-out -%,$(2))
$(1):
$(if $(quiet),@echo " [LD] $$@")
$(qexec)g++ $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
endef
# make-3.80 has a bug with expanding large input strings to the eval function,
# which was triggered in some cases by the following component of
# linker_template:
......@@ -359,6 +378,7 @@ ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
endif
BUILD_TARGETS += .docs .libs .bins
INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins
all-$(target): $(BUILD_TARGETS)
all: $(BUILD_TARGETS)
install:: $(INSTALL_TARGETS)
dist: $(INSTALL_TARGETS)
test::
......@@ -544,7 +544,7 @@ generate_vcproj() {
close_tag Configurations
open_tag Files
generate_filter srcs "Source Files" "c;def;odl;idl;hpj;bat;asm;asmx"
generate_filter srcs "Source Files" "c;cc;def;odl;idl;hpj;bat;asm;asmx"
generate_filter hdrs "Header Files" "h;hm;inl;inc;xsd"
generate_filter resrcs "Resource Files" "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
generate_filter resrcs "Build Files" "mk"
......
......@@ -22,6 +22,7 @@ show_help(){
Advanced options:
${toggle_libs} don't build libraries
${toggle_examples} don't build examples
${toggle_unit_tests} build unit tests
--libc=PATH path to alternate libc
--as={yasm|nasm|auto} use specified assembler [auto, yasm preferred]
${toggle_fast_unaligned} don't use unaligned accesses, even when
......@@ -223,6 +224,15 @@ EXPERIMENT_LIST="
high_precision_mv
sixteenth_subpel_uv
comp_intra_pred
newentropy
newupdate
superblocks
expanded_coef_context
int_8x8fdct
newintramodes
adaptive_entropy
pred_filter
lossless
"
CONFIG_LIST="
external_build
......@@ -263,7 +273,7 @@ CONFIG_LIST="
small
postproc_visualizer
os_support
unit_tests
experimental
${EXPERIMENT_LIST}
"
......@@ -304,6 +314,7 @@ CMDLINE_SELECT="
static
small
postproc_visualizer
unit_tests
experimental
"
......@@ -324,7 +335,7 @@ process_cmdline() {
process_common_cmdline $opt
fi
;;
*) process_common_cmdline $opt
*) process_common_cmdline "$opt"
;;
esac
done
......
This diff is collapsed.
......@@ -13,11 +13,13 @@ vpx.sln: $(wildcard *.vcproj)
@echo " [CREATE] $@"
$(SRC_PATH_BARE)/build/make/gen_msvs_sln.sh \
$(if $(filter %vpx.vcproj,$^),\
$(foreach vcp,$(filter-out %vpx.vcproj %obj_int_extract.vcproj,$^),\
--dep=$(vcp:.vcproj=):vpx)) \
--dep=vpx:obj_int_extract \
--ver=$(CONFIG_VS_VERSION)\
--out=$@ $^
$(foreach vcp,$(filter-out %vpx.vcproj %gtest.vcproj %obj_int_extract.vcproj,$^),\
--dep=$(vcp:.vcproj=):vpx) \
$(foreach vcp,$(filter %_test.vcproj,$^),\
--dep=$(vcp:.vcproj=):gtest)) \
--dep=vpx:obj_int_extract \
--ver=$(CONFIG_VS_VERSION)\
--out=$@ $^
vpx.sln.mk: vpx.sln
@true
......
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
* Copyright (c) 2012 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
......@@ -8,26 +8,30 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef LIBVPX_TEST_ACM_RANDOM_H_
#define LIBVPX_TEST_ACM_RANDOM_H_
#ifndef _littlend_h
#define _littlend_h
#include <stdlib.h>
#if defined(__cplusplus)
extern "C" {
#endif
#include "vpx/vpx_integer.h"
#define invert2(x) (x)
#define invert4(x) (x)
namespace libvpx_test {
#define low_byte(x) (unsigned char)x
#define mid1Byte(x) (unsigned char)(x >> 8)
#define mid2Byte(x) (unsigned char)(x >> 16)
#define high_byte(x) (unsigned char)(x >> 24)
class ACMRandom {
public:
explicit ACMRandom(int seed) { Reset(seed); }
#define SWAPENDS 0
void Reset(int seed) { srand(seed); }
#if defined(__cplusplus)
}
#endif
uint8_t Rand8(void) { return (rand() >> 8) & 0xff; }
#endif
int PseudoUniform(int range) { return (rand() >> 8) % range; }
int operator()(int n) { return PseudoUniform(n); }
static int DeterministicSeed(void) { return 0xbaba; }
};
} // namespace libvpx_test
#endif // LIBVPX_TEST_ACM_RANDOM_H_
/*
* Copyright (c) 2012 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 <math.h>
#include <stdlib.h>
#include <string.h>
#include "third_party/googletest/src/include/gtest/gtest.h"
extern "C" {
#include "vp8/encoder/boolhuff.h"
#include "vp8/decoder/dboolhuff.h"
}
#include "acm_random.h"
#include "vpx/vpx_integer.h"
using libvpx_test::ACMRandom;
namespace {
const int num_tests = 10;
} // namespace
TEST(VP8, TestBitIO) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
for (int n = 0; n < num_tests; ++n) {
for (int method = 0; method <= 7; ++method) { // we generate various proba
const int bits_to_test = 1000;
uint8_t probas[bits_to_test];
for (int i = 0; i < bits_to_test; ++i) {
const int parity = i & 1;
probas[i] =
(method == 0) ? 0 : (method == 1) ? 255 :
(method == 2) ? 128 :
(method == 3) ? rnd.Rand8() :
(method == 4) ? (parity ? 0 : 255) :
// alternate between low and high proba:
(method == 5) ? (parity ? rnd(128) : 255 - rnd(128)) :
(method == 6) ?
(parity ? rnd(64) : 255 - rnd(64)) :
(parity ? rnd(32) : 255 - rnd(32));
}
for (int bit_method = 0; bit_method <= 3; ++bit_method) {
const int random_seed = 6432;
const int buffer_size = 10000;
ACMRandom bit_rnd(random_seed);
BOOL_CODER bw;
uint8_t bw_buffer[buffer_size];
vp8_start_encode(&bw, bw_buffer);
int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0;
for (int i = 0; i < bits_to_test; ++i) {
if (bit_method == 2) {
bit = (i & 1);
} else if (bit_method == 3) {
bit = bit_rnd(2);
}
vp8_encode_bool(&bw, bit, static_cast<int>(probas[i]));
}
vp8_stop_encode(&bw);
BOOL_DECODER br;
vp8dx_start_decode(&br, bw_buffer, buffer_size);
bit_rnd.Reset(random_seed);
for (int i = 0; i < bits_to_test; ++i) {
if (bit_method == 2) {
bit = (i & 1);
} else if (bit_method == 3) {
bit = bit_rnd(2);
}
GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
<< "pos: "<< i << " / " << bits_to_test
<< " bit_method: " << bit_method
<< " method: " << method;
}
}
}
}
}
/*
* Copyright (c) 2012 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 <math.h>
#include <stdlib.h>
#include <string.h>
#include "third_party/googletest/src/include/gtest/gtest.h"
extern "C" {
#include "vp8/common/idct.h"
#include "vp8/encoder/dct.h"
}
#include "acm_random.h"
#include "vpx/vpx_integer.h"
using libvpx_test::ACMRandom;
namespace {
TEST(Vp8FdctTest, SignBiasCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
int16_t test_input_block[16];
int16_t test_output_block[16];
const int pitch = 8;
int count_sign_block[16][2];
const int count_test_block = 1000000;
memset(count_sign_block, 0, sizeof(count_sign_block));
for (int i = 0; i < count_test_block; ++i) {
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 16; ++j)
test_input_block[j] = rnd.Rand8() - rnd.Rand8();
// TODO(Yaowu): this should be converted to a parameterized test
// to test optimized versions of this function.
vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch);
for (int j = 0; j < 16; ++j) {
if (test_output_block[j] < 0)
++count_sign_block[j][0];
else if (test_output_block[j] > 0)
++count_sign_block[j][1];
}
}
for (int j = 0; j < 16; ++j) {
const bool bias_acceptable = (abs(count_sign_block[j][0] -
count_sign_block[j][1]) < 10000);
EXPECT_TRUE(bias_acceptable)
<< "Error: 4x4 FDCT has a sign bias > 1%"
<< " for input range [-255, 255] at index " << j;
}
memset(count_sign_block, 0, sizeof(count_sign_block));
for (int i = 0; i < count_test_block; ++i) {
// Initialize a test block with input range [-15, 15].
for (int j = 0; j < 16; ++j)
test_input_block[j] = (rnd.Rand8() >> 4) - (rnd.Rand8() >> 4);
// TODO(Yaowu): this should be converted to a parameterized test
// to test optimized versions of this function.
vp8_short_fdct4x4_c(test_input_block, test_output_block, pitch);
for (int j = 0; j < 16; ++j) {
if (test_output_block[j] < 0)
++count_sign_block[j][0];
else if (test_output_block[j] > 0)
++count_sign_block[j][1];
}
}
for (int j = 0; j < 16; ++j) {
const bool bias_acceptable = (abs(count_sign_block[j][0] -
count_sign_block[j][1]) < 100000);
EXPECT_TRUE(bias_acceptable)
<< "Error: 4x4 FDCT has a sign bias > 10%"
<< " for input range [-15, 15] at index " << j;
}
};
TEST(Vp8FdctTest, RoundTripErrorCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
int max_error = 0;
double total_error = 0;
const int count_test_block = 1000000;
for (int i = 0; i < count_test_block; ++i) {
int16_t test_input_block[16];
int16_t test_temp_block[16];
int16_t test_output_block[16];
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 16; ++j)
test_input_block[j] = rnd.Rand8() - rnd.Rand8();
// TODO(Yaowu): this should be converted to a parameterized test
// to test optimized versions of this function.
const int pitch = 8;
vp8_short_fdct4x4_c(test_input_block, test_temp_block, pitch);
// Because the bitstream is not frozen yet, use the idct in the codebase.
vp8_short_idct4x4llm_c(test_temp_block, test_output_block, pitch);
for (int j = 0; j < 16; ++j) {
const int diff = test_input_block[j] - test_output_block[j];
const int error = diff * diff;
if (max_error < error)
max_error = error;
total_error += error;
}
}
EXPECT_GE(1, max_error)
<< "Error: FDCT/IDCT has an individual roundtrip error > 1";
EXPECT_GE(count_test_block, total_error)
<< "Error: FDCT/IDCT has average roundtrip error > 1 per block";
};
} // namespace
/*
* Copyright (c) 2012 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 <math.h>
#include <stdlib.h>
#include <string.h>
#include "third_party/googletest/src/include/gtest/gtest.h"
extern "C" {
#include "vp8/encoder/dct.h"
#include "vp8/common/idct.h"
}
#include "acm_random.h"
#include "vpx/vpx_integer.h"
using libvpx_test::ACMRandom;
namespace {
TEST(VP8Fdct8x8Test, SignBiasCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
int16_t test_input_block[64];
int16_t test_output_block[64];
const int pitch = 16;
int count_sign_block[64][2];
const int count_test_block = 100000;
memset(count_sign_block, 0, sizeof(count_sign_block));
for (int i = 0; i < count_test_block; ++i) {
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 64; ++j)
test_input_block[j] = rnd.Rand8() - rnd.Rand8();
vp8_short_fdct8x8_c(test_input_block, test_output_block, pitch);
for (int j = 0; j < 64; ++j) {
if (test_output_block[j] < 0)
++count_sign_block[j][0];
else if (test_output_block[j] > 0)
++count_sign_block[j][1];
}
}
for (int j = 0; j < 64; ++j) {
const bool bias_acceptable = (abs(count_sign_block[j][0] -
count_sign_block[j][1]) < 1000);
EXPECT_TRUE(bias_acceptable)
<< "Error: 8x8 FDCT has a sign bias > 1%"
<< " for input range [-255, 255] at index " << j;
}
memset(count_sign_block, 0, sizeof(count_sign_block));
for (int i = 0; i < count_test_block; ++i) {
// Initialize a test block with input range [-15, 15].
for (int j = 0; j < 64; ++j)
test_input_block[j] = (rnd.Rand8() >> 4) - (rnd.Rand8() >> 4);
vp8_short_fdct8x8_c(test_input_block, test_output_block, pitch);
for (int j = 0; j < 64; ++j) {
if (test_output_block[j] < 0)
++count_sign_block[j][0];
else if (test_output_block[j] > 0)
++count_sign_block[j][1];
}
}
for (int j = 0; j < 64; ++j) {
const bool bias_acceptable = (abs(count_sign_block[j][0] -
count_sign_block[j][1]) < 10000);
EXPECT_TRUE(bias_acceptable)
<< "Error: 8x8 FDCT has a sign bias > 10%"
<< " for input range [-15, 15] at index " << j;
}
};
TEST(VP8Fdct8x8Test, RoundTripErrorCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
int max_error = 0;
double total_error = 0;
const int count_test_block = 100000;
for (int i = 0; i < count_test_block; ++i) {
int16_t test_input_block[64];
int16_t test_temp_block[64];
int16_t test_output_block[64];
// Initialize a test block with input range [-255, 255].
for (int j = 0; j < 64; ++j)
test_input_block[j] = rnd.Rand8() - rnd.Rand8();
const int pitch = 16;
vp8_short_fdct8x8_c(test_input_block, test_temp_block, pitch);
vp8_short_idct8x8_c(test_temp_block, test_output_block, pitch);
for (int j = 0; j < 64; ++j) {
const int diff = test_input_block[j] - test_output_block[j];
const int error = diff * diff;
if (max_error < error)
max_error = error;
total_error += error;
}
}
EXPECT_GE(1, max_error)
<< "Error: 8x8 FDCT/IDCT has an individual roundtrip error > 1";
EXPECT_GE(count_test_block, total_error)
<< "Error: 8x8 FDCT/IDCT has average roundtrip error > 1 per block";
};
TEST(VP8Fdct8x8Test, ExtremalCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
int max_error = 0;
double total_error = 0;
const int count_test_block = 100000;
for (int i = 0; i < count_test_block; ++i) {
int16_t test_input_block[64];
int16_t test_temp_block[64];
int16_t test_output_block[64];
// Initialize a test block with input range {-255, 255}.
for (int j = 0; j < 64; ++j)
test_input_block[j] = rnd.Rand8() % 2 ? 255 : -255;
const int pitch = 16;
vp8_short_fdct8x8_c(test_input_block, test_temp_block, pitch);
vp8_short_idct8x8_c(test_temp_block, test_output_block, pitch);