summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--args.h8
-rw-r--r--md5_utils.h8
-rw-r--r--test/clear_system_state.h2
-rw-r--r--test/convolve_test.cc2
-rw-r--r--test/dct16x16_test.cc7
-rw-r--r--test/dct32x32_test.cc5
-rw-r--r--test/fdct4x4_test.cc7
-rw-r--r--test/fdct8x8_test.cc7
-rw-r--r--test/intrapred_test.cc3
-rw-r--r--test/md5_helper.h2
-rw-r--r--test/partial_idct_test.cc3
-rw-r--r--test/set_roi.cc4
-rw-r--r--test/subtract_test.cc2
-rw-r--r--test/test_libvpx.cc2
-rw-r--r--test/variance_test.cc6
-rw-r--r--test/vp8_boolcoder_test.cc2
-rw-r--r--test/vp9_boolcoder_test.cc2
-rw-r--r--test/vp9_subtract_test.cc2
-rw-r--r--test/y4m_video_source.h2
-rw-r--r--vp8/common/alloccommon.h8
-rw-r--r--vp8/common/arm/bilinearfilter_arm.h8
-rw-r--r--vp8/common/blockd.h8
-rw-r--r--vp8/common/coefupdateprobs.h8
-rw-r--r--vp8/common/common.h8
-rw-r--r--vp8/common/default_coef_probs.h8
-rw-r--r--vp8/common/entropy.h8
-rw-r--r--vp8/common/entropymode.h8
-rw-r--r--vp8/common/entropymv.h8
-rw-r--r--vp8/common/extend.h8
-rw-r--r--vp8/common/filter.h8
-rw-r--r--vp8/common/findnearmv.h8
-rw-r--r--vp8/common/header.h8
-rw-r--r--vp8/common/invtrans.h8
-rw-r--r--vp8/common/loopfilter.h8
-rw-r--r--vp8/common/modecont.h8
-rw-r--r--vp8/common/mv.h8
-rw-r--r--vp8/common/onyxc_int.h8
-rw-r--r--vp8/common/postproc.h8
-rw-r--r--vp8/common/ppflags.h8
-rw-r--r--vp8/common/pragmas.h8
-rw-r--r--vp8/common/quant_common.h8
-rw-r--r--vp8/common/reconinter.h8
-rw-r--r--vp8/common/reconintra4x4.h8
-rw-r--r--vp8/common/setupintrarecon.h8
-rw-r--r--vp8/common/swapyv12buffer.h8
-rw-r--r--vp8/common/systemdependent.h8
-rw-r--r--vp8/common/threading.h8
-rw-r--r--vp8/common/treecoder.h8
-rw-r--r--vp8/common/variance.h8
-rw-r--r--vp8/common/vp8_entropymodedata.h8
-rw-r--r--vp8/common/x86/filter_x86.h8
-rw-r--r--vp8/decoder/dboolhuff.h8
-rw-r--r--vp8/decoder/decodemv.h8
-rw-r--r--vp8/decoder/decoderthreading.h8
-rw-r--r--vp8/decoder/detokenize.h8
-rw-r--r--vp8/decoder/ec_types.h8
-rw-r--r--vp8/decoder/error_concealment.h8
-rw-r--r--vp8/decoder/onyxd_int.h8
-rw-r--r--vp8/decoder/treereader.h8
-rw-r--r--vp8/encoder/bitstream.h8
-rw-r--r--vp8/encoder/block.h8
-rw-r--r--vp8/encoder/boolhuff.h8
-rw-r--r--vp8/encoder/dct_value_cost.h8
-rw-r--r--vp8/encoder/dct_value_tokens.h8
-rw-r--r--vp8/encoder/defaultcoefcounts.h8
-rw-r--r--vp8/encoder/denoising.h8
-rw-r--r--vp8/encoder/encodeframe.h8
-rw-r--r--vp8/encoder/encodeintra.h8
-rw-r--r--vp8/encoder/encodemb.h8
-rw-r--r--vp8/encoder/encodemv.h8
-rw-r--r--vp8/encoder/firstpass.h8
-rw-r--r--vp8/encoder/lookahead.h8
-rw-r--r--vp8/encoder/mcomp.h8
-rw-r--r--vp8/encoder/modecosts.h8
-rw-r--r--vp8/encoder/mr_dissim.h8
-rw-r--r--vp8/encoder/onyx_int.h8
-rw-r--r--vp8/encoder/pickinter.h8
-rw-r--r--vp8/encoder/psnr.h8
-rw-r--r--vp8/encoder/quantize.h8
-rw-r--r--vp8/encoder/ratectrl.h8
-rw-r--r--vp8/encoder/rdopt.h8
-rw-r--r--vp8/encoder/segmentation.h8
-rw-r--r--vp8/encoder/tokenize.h8
-rw-r--r--vp8/encoder/treewriter.h8
-rw-r--r--vp9/common/arm/neon/vp9_reconintra_neon.asm97
-rw-r--r--vp9/common/mips/dspr2/vp9_common_dspr2.h8
-rw-r--r--vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h8
-rw-r--r--vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h8
-rw-r--r--vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h8
-rw-r--r--vp9/common/vp9_alloccommon.h8
-rw-r--r--vp9/common/vp9_blockd.h8
-rw-r--r--vp9/common/vp9_common.h8
-rw-r--r--vp9/common/vp9_common_data.h8
-rw-r--r--vp9/common/vp9_convolve.h8
-rw-r--r--vp9/common/vp9_entropy.h8
-rw-r--r--vp9/common/vp9_entropymode.h8
-rw-r--r--vp9/common/vp9_entropymv.h8
-rw-r--r--vp9/common/vp9_enums.h8
-rw-r--r--vp9/common/vp9_filter.h8
-rw-r--r--vp9/common/vp9_idct.h8
-rw-r--r--vp9/common/vp9_loopfilter.h8
-rw-r--r--vp9/common/vp9_mv.h8
-rw-r--r--vp9/common/vp9_mvref_common.h12
-rw-r--r--vp9/common/vp9_onyx.h11
-rw-r--r--vp9/common/vp9_onyxc_int.h8
-rw-r--r--vp9/common/vp9_postproc.h8
-rw-r--r--vp9/common/vp9_ppflags.h8
-rw-r--r--vp9/common/vp9_pragmas.h8
-rw-r--r--vp9/common/vp9_pred_common.h8
-rw-r--r--vp9/common/vp9_prob.h8
-rw-r--r--vp9/common/vp9_quant_common.h8
-rw-r--r--vp9/common/vp9_reconinter.h11
-rw-r--r--vp9/common/vp9_reconintra.h8
-rw-r--r--vp9/common/vp9_rtcd_defs.sh2
-rw-r--r--vp9/common/vp9_scale.h8
-rw-r--r--vp9/common/vp9_scan.h8
-rw-r--r--vp9/common/vp9_seg_common.h8
-rw-r--r--vp9/common/vp9_systemdependent.h8
-rw-r--r--vp9/common/vp9_textblit.h8
-rw-r--r--vp9/common/vp9_tile_common.h8
-rw-r--r--vp9/common/x86/vp9_postproc_x86.h8
-rw-r--r--vp9/decoder/vp9_decodeframe.c2
-rw-r--r--vp9/decoder/vp9_decodeframe.h8
-rw-r--r--vp9/decoder/vp9_decodemv.h8
-rw-r--r--vp9/decoder/vp9_detokenize.h8
-rw-r--r--vp9/decoder/vp9_dsubexp.h8
-rw-r--r--vp9/decoder/vp9_onyxd.h10
-rw-r--r--vp9/decoder/vp9_onyxd_int.h8
-rw-r--r--vp9/decoder/vp9_read_bit_buffer.h8
-rw-r--r--vp9/decoder/vp9_reader.h8
-rw-r--r--vp9/decoder/vp9_thread.h4
-rw-r--r--vp9/encoder/vp9_bitstream.h8
-rw-r--r--vp9/encoder/vp9_block.h8
-rw-r--r--vp9/encoder/vp9_dct.h8
-rw-r--r--vp9/encoder/vp9_encodeframe.h8
-rw-r--r--vp9/encoder/vp9_encodemb.c6
-rw-r--r--vp9/encoder/vp9_encodemb.h8
-rw-r--r--vp9/encoder/vp9_encodemv.h8
-rw-r--r--vp9/encoder/vp9_extend.h8
-rw-r--r--vp9/encoder/vp9_firstpass.c419
-rw-r--r--vp9/encoder/vp9_firstpass.h8
-rw-r--r--vp9/encoder/vp9_lookahead.h8
-rw-r--r--vp9/encoder/vp9_mbgraph.h8
-rw-r--r--vp9/encoder/vp9_mcomp.h8
-rw-r--r--vp9/encoder/vp9_onyx_int.h22
-rw-r--r--vp9/encoder/vp9_picklpf.h8
-rw-r--r--vp9/encoder/vp9_pickmode.c4
-rw-r--r--vp9/encoder/vp9_pickmode.h13
-rw-r--r--vp9/encoder/vp9_psnr.h8
-rw-r--r--vp9/encoder/vp9_quantize.h8
-rw-r--r--vp9/encoder/vp9_ratectrl.h8
-rw-r--r--vp9/encoder/vp9_rdopt.c26
-rw-r--r--vp9/encoder/vp9_rdopt.h11
-rw-r--r--vp9/encoder/vp9_segmentation.h8
-rw-r--r--vp9/encoder/vp9_subexp.h8
-rw-r--r--vp9/encoder/vp9_temporal_filter.h8
-rw-r--r--vp9/encoder/vp9_tokenize.h8
-rw-r--r--vp9/encoder/vp9_treewriter.h8
-rw-r--r--vp9/encoder/vp9_vaq.h8
-rw-r--r--vp9/encoder/vp9_variance.h9
-rw-r--r--vp9/encoder/vp9_write_bit_buffer.h8
-rw-r--r--vp9/encoder/vp9_writer.h8
-rw-r--r--vp9/encoder/x86/vp9_mcomp_x86.h8
-rw-r--r--vpx/internal/vpx_codec_internal.h8
-rw-r--r--vpx/vpx_image.h11
-rw-r--r--vpx_ports/arm.h8
-rw-r--r--vpx_ports/x86.h10
-rw-r--r--vpxdec.c60
-rw-r--r--vpxenc.h8
-rw-r--r--vpxstats.h8
-rw-r--r--warnings.h8
-rw-r--r--webmdec.h8
-rw-r--r--webmenc.h8
-rw-r--r--y4menc.h8
-rw-r--r--y4minput.h8
175 files changed, 1564 insertions, 348 deletions
diff --git a/args.h b/args.h
index ea909cb46..04e0acdf1 100644
--- a/args.h
+++ b/args.h
@@ -13,6 +13,10 @@
#define ARGS_H_
#include <stdio.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct arg {
char **argv;
const char *name;
@@ -48,4 +52,8 @@ unsigned int arg_parse_uint(const struct arg *arg);
int arg_parse_int(const struct arg *arg);
struct vpx_rational arg_parse_rational(const struct arg *arg);
int arg_parse_enum_or_int(const struct arg *arg);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // ARGS_H_
diff --git a/md5_utils.h b/md5_utils.h
index 9935eae6d..bd4991b3a 100644
--- a/md5_utils.h
+++ b/md5_utils.h
@@ -23,6 +23,10 @@
#ifndef MD5_UTILS_H_
#define MD5_UTILS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define md5byte unsigned char
#define UWORD32 unsigned int
@@ -38,4 +42,8 @@ void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
void MD5Final(unsigned char digest[16], struct MD5Context *context);
void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // MD5_UTILS_H_
diff --git a/test/clear_system_state.h b/test/clear_system_state.h
index 8f08a4cdb..5e7679744 100644
--- a/test/clear_system_state.h
+++ b/test/clear_system_state.h
@@ -11,11 +11,9 @@
#define TEST_CLEAR_SYSTEM_STATE_H_
#include "./vpx_config.h"
-extern "C" {
#if ARCH_X86 || ARCH_X86_64
# include "vpx_ports/x86.h"
#endif
-}
namespace libvpx_test {
diff --git a/test/convolve_test.cc b/test/convolve_test.cc
index 9ab60b1c3..e920de874 100644
--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -14,13 +14,11 @@
#include "test/util.h"
#include "third_party/googletest/src/include/gtest/gtest.h"
-extern "C" {
#include "./vpx_config.h"
#include "./vp9_rtcd.h"
#include "vp9/common/vp9_filter.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_ports/mem.h"
-}
namespace {
typedef void (*convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride,
diff --git a/test/dct16x16_test.cc b/test/dct16x16_test.cc
index 5496d0b62..ce0431860 100644
--- a/test/dct16x16_test.cc
+++ b/test/dct16x16_test.cc
@@ -18,12 +18,13 @@
#include "test/register_state_check.h"
#include "test/util.h"
-extern "C" {
-#include "vp9/common/vp9_entropy.h"
#include "./vp9_rtcd.h"
+#include "vp9/common/vp9_entropy.h"
+#include "vpx/vpx_integer.h"
+
+extern "C" {
void vp9_idct16x16_256_add_c(const int16_t *input, uint8_t *output, int pitch);
}
-#include "vpx/vpx_integer.h"
using libvpx_test::ACMRandom;
diff --git a/test/dct32x32_test.cc b/test/dct32x32_test.cc
index a1e472a0a..a2608acb5 100644
--- a/test/dct32x32_test.cc
+++ b/test/dct32x32_test.cc
@@ -18,12 +18,9 @@
#include "test/register_state_check.h"
#include "test/util.h"
-extern "C" {
#include "./vpx_config.h"
-#include "vp9/common/vp9_entropy.h"
#include "./vp9_rtcd.h"
-}
-
+#include "vp9/common/vp9_entropy.h"
#include "vpx/vpx_integer.h"
using libvpx_test::ACMRandom;
diff --git a/test/fdct4x4_test.cc b/test/fdct4x4_test.cc
index 67426eb74..5db5f5cae 100644
--- a/test/fdct4x4_test.cc
+++ b/test/fdct4x4_test.cc
@@ -18,12 +18,13 @@
#include "test/register_state_check.h"
#include "test/util.h"
-extern "C" {
-#include "vp9/common/vp9_entropy.h"
#include "./vp9_rtcd.h"
+#include "vp9/common/vp9_entropy.h"
+#include "vpx/vpx_integer.h"
+
+extern "C" {
void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *output, int pitch);
}
-#include "vpx/vpx_integer.h"
using libvpx_test::ACMRandom;
diff --git a/test/fdct8x8_test.cc b/test/fdct8x8_test.cc
index 19ffe26aa..beef98055 100644
--- a/test/fdct8x8_test.cc
+++ b/test/fdct8x8_test.cc
@@ -18,12 +18,13 @@
#include "test/register_state_check.h"
#include "test/util.h"
-extern "C" {
-#include "vp9/common/vp9_entropy.h"
#include "./vp9_rtcd.h"
+#include "vp9/common/vp9_entropy.h"
+#include "vpx/vpx_integer.h"
+
+extern "C" {
void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *output, int pitch);
}
-#include "vpx/vpx_integer.h"
using libvpx_test::ACMRandom;
diff --git a/test/intrapred_test.cc b/test/intrapred_test.cc
index 5fba70025..b28f5fbe6 100644
--- a/test/intrapred_test.cc
+++ b/test/intrapred_test.cc
@@ -14,12 +14,11 @@
#include "test/clear_system_state.h"
#include "test/register_state_check.h"
#include "third_party/googletest/src/include/gtest/gtest.h"
-extern "C" {
+
#include "./vpx_config.h"
#include "./vp8_rtcd.h"
#include "vp8/common/blockd.h"
#include "vpx_mem/vpx_mem.h"
-}
namespace {
diff --git a/test/md5_helper.h b/test/md5_helper.h
index 289f6089b..dd446f4f6 100644
--- a/test/md5_helper.h
+++ b/test/md5_helper.h
@@ -11,10 +11,8 @@
#ifndef TEST_MD5_HELPER_H_
#define TEST_MD5_HELPER_H_
-extern "C" {
#include "./md5_utils.h"
#include "vpx/vpx_decoder.h"
-}
namespace libvpx_test {
class MD5 {
diff --git a/test/partial_idct_test.cc b/test/partial_idct_test.cc
index a6569c0c3..2a32410f3 100644
--- a/test/partial_idct_test.cc
+++ b/test/partial_idct_test.cc
@@ -18,12 +18,9 @@
#include "test/register_state_check.h"
#include "test/util.h"
-extern "C" {
#include "./vp9_rtcd.h"
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_scan.h"
-}
-
#include "vpx/vpx_integer.h"
using libvpx_test::ACMRandom;
diff --git a/test/set_roi.cc b/test/set_roi.cc
index 9d2e7715f..e28f511be 100644
--- a/test/set_roi.cc
+++ b/test/set_roi.cc
@@ -18,11 +18,9 @@
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "test/acm_random.h"
+#include "vp8/encoder/onyx_int.h"
#include "vpx/vpx_integer.h"
#include "vpx_mem/vpx_mem.h"
-extern "C" {
-#include "vp8/encoder/onyx_int.h"
-}
using libvpx_test::ACMRandom;
diff --git a/test/subtract_test.cc b/test/subtract_test.cc
index d1f272972..3211c5c8a 100644
--- a/test/subtract_test.cc
+++ b/test/subtract_test.cc
@@ -12,13 +12,11 @@
#include "test/acm_random.h"
#include "test/clear_system_state.h"
#include "test/register_state_check.h"
-extern "C" {
#include "./vpx_config.h"
#include "./vp8_rtcd.h"
#include "vp8/common/blockd.h"
#include "vp8/encoder/block.h"
#include "vpx_mem/vpx_mem.h"
-}
typedef void (*subtract_b_fn_t)(BLOCK *be, BLOCKD *bd, int pitch);
diff --git a/test/test_libvpx.cc b/test/test_libvpx.cc
index bbcbcf9bc..fc035af8f 100644
--- a/test/test_libvpx.cc
+++ b/test/test_libvpx.cc
@@ -9,10 +9,10 @@
*/
#include <string>
#include "./vpx_config.h"
-extern "C" {
#if ARCH_X86 || ARCH_X86_64
#include "vpx_ports/x86.h"
#endif
+extern "C" {
#if CONFIG_VP8
extern void vp8_rtcd();
#endif
diff --git a/test/variance_test.cc b/test/variance_test.cc
index 3f5560170..b9144ffab 100644
--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -17,17 +17,15 @@
#include "vpx/vpx_integer.h"
#include "./vpx_config.h"
-extern "C" {
#include "vpx_mem/vpx_mem.h"
#if CONFIG_VP8_ENCODER
-# include "vp8/common/variance.h"
# include "./vp8_rtcd.h"
+# include "vp8/common/variance.h"
#endif
#if CONFIG_VP9_ENCODER
-# include "vp9/encoder/vp9_variance.h"
# include "./vp9_rtcd.h"
+# include "vp9/encoder/vp9_variance.h"
#endif
-}
#include "test/acm_random.h"
namespace {
diff --git a/test/vp8_boolcoder_test.cc b/test/vp8_boolcoder_test.cc
index 0383af207..fa7ee6e8c 100644
--- a/test/vp8_boolcoder_test.cc
+++ b/test/vp8_boolcoder_test.cc
@@ -20,10 +20,8 @@
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "vpx/vpx_integer.h"
-extern "C" {
#include "vp8/encoder/boolhuff.h"
#include "vp8/decoder/dboolhuff.h"
-}
namespace {
const int num_tests = 10;
diff --git a/test/vp9_boolcoder_test.cc b/test/vp9_boolcoder_test.cc
index 1593c0267..c579adeac 100644
--- a/test/vp9_boolcoder_test.cc
+++ b/test/vp9_boolcoder_test.cc
@@ -14,10 +14,8 @@
#include "third_party/googletest/src/include/gtest/gtest.h"
-extern "C" {
#include "vp9/decoder/vp9_reader.h"
#include "vp9/encoder/vp9_writer.h"
-}
#include "test/acm_random.h"
#include "vpx/vpx_integer.h"
diff --git a/test/vp9_subtract_test.cc b/test/vp9_subtract_test.cc
index e4c4cfeff..d7df2867d 100644
--- a/test/vp9_subtract_test.cc
+++ b/test/vp9_subtract_test.cc
@@ -12,12 +12,10 @@
#include "test/acm_random.h"
#include "test/clear_system_state.h"
#include "test/register_state_check.h"
-extern "C" {
#include "./vpx_config.h"
#include "./vp9_rtcd.h"
#include "vp9/common/vp9_blockd.h"
#include "vpx_mem/vpx_mem.h"
-}
typedef void (*subtract_fn_t)(int rows, int cols,
int16_t *diff_ptr, ptrdiff_t diff_stride,
diff --git a/test/y4m_video_source.h b/test/y4m_video_source.h
index bd86c2c04..20d2be02b 100644
--- a/test/y4m_video_source.h
+++ b/test/y4m_video_source.h
@@ -12,9 +12,7 @@
#include <string>
#include "test/video_source.h"
-extern "C" {
#include "./y4minput.h"
-}
namespace libvpx_test {
diff --git a/vp8/common/alloccommon.h b/vp8/common/alloccommon.h
index 38f89a0f1..93e99d76b 100644
--- a/vp8/common/alloccommon.h
+++ b/vp8/common/alloccommon.h
@@ -14,10 +14,18 @@
#include "onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp8_create_common(VP8_COMMON *oci);
void vp8_remove_common(VP8_COMMON *oci);
void vp8_de_alloc_frame_buffers(VP8_COMMON *oci);
int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height);
void vp8_setup_version(VP8_COMMON *oci);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_ALLOCCOMMON_H_
diff --git a/vp8/common/arm/bilinearfilter_arm.h b/vp8/common/arm/bilinearfilter_arm.h
index dd3ff14fb..6b84e6f3b 100644
--- a/vp8/common/arm/bilinearfilter_arm.h
+++ b/vp8/common/arm/bilinearfilter_arm.h
@@ -12,6 +12,10 @@
#ifndef VP8_COMMON_ARM_BILINEARFILTER_ARM_H_
#define VP8_COMMON_ARM_BILINEARFILTER_ARM_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void vp8_filter_block2d_bil_first_pass_armv6
(
const unsigned char *src_ptr,
@@ -32,4 +36,8 @@ extern void vp8_filter_block2d_bil_second_pass_armv6
const short *vp8_filter
);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_ARM_BILINEARFILTER_ARM_H_
diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h
index c3caee10e..ea1a6a4ad 100644
--- a/vp8/common/blockd.h
+++ b/vp8/common/blockd.h
@@ -20,6 +20,10 @@ void vpx_log(const char *format, ...);
#include "treecoder.h"
#include "vpx_ports/mem.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*#define DCPRED 1*/
#define DCPREDSIMTHRESH 0
#define DCPREDCNTTHRESH 3
@@ -297,4 +301,8 @@ typedef struct macroblockd
extern void vp8_build_block_doffsets(MACROBLOCKD *x);
extern void vp8_setup_block_dptrs(MACROBLOCKD *x);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_BLOCKD_H_
diff --git a/vp8/common/coefupdateprobs.h b/vp8/common/coefupdateprobs.h
index 90d290d6e..d96a19e74 100644
--- a/vp8/common/coefupdateprobs.h
+++ b/vp8/common/coefupdateprobs.h
@@ -11,6 +11,10 @@
#ifndef VP8_COMMON_COEFUPDATEPROBS_H_
#define VP8_COMMON_COEFUPDATEPROBS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Update probabilities for the nodes in the token entropy tree.
Generated file included by entropy.c */
@@ -186,4 +190,8 @@ const vp8_prob vp8_coef_update_probs [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTE
},
};
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_COEFUPDATEPROBS_H_
diff --git a/vp8/common/common.h b/vp8/common/common.h
index 9671da00f..ee5b58c75 100644
--- a/vp8/common/common.h
+++ b/vp8/common/common.h
@@ -18,6 +18,10 @@
#include "vpx_mem/vpx_mem.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Only need this for fixed-size arrays, for structs just assign. */
#define vp8_copy( Dest, Src) { \
@@ -37,4 +41,8 @@
#define vp8_zero_array( Dest, N) vpx_memset( Dest, 0, N * sizeof( *Dest));
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_COMMON_H_
diff --git a/vp8/common/default_coef_probs.h b/vp8/common/default_coef_probs.h
index 836854594..4d69e4be6 100644
--- a/vp8/common/default_coef_probs.h
+++ b/vp8/common/default_coef_probs.h
@@ -11,6 +11,10 @@
#ifndef VP8_COMMON_DEFAULT_COEF_PROBS_H_
#define VP8_COMMON_DEFAULT_COEF_PROBS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*Generated file, included by entropy.c*/
@@ -189,4 +193,8 @@ static const vp8_prob default_coef_probs [BLOCK_TYPES]
}
};
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_DEFAULT_COEF_PROBS_H_
diff --git a/vp8/common/entropy.h b/vp8/common/entropy.h
index 175fa9f61..a90bab4ba 100644
--- a/vp8/common/entropy.h
+++ b/vp8/common/entropy.h
@@ -15,6 +15,10 @@
#include "treecoder.h"
#include "blockd.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Coefficient token alphabet */
#define ZERO_TOKEN 0 /* 0 Extra Bits 0+0 */
@@ -98,4 +102,8 @@ extern DECLARE_ALIGNED(16, const short, vp8_default_zig_zag_mask[16]);
extern const int vp8_mb_feature_data_bits[MB_LVL_MAX];
void vp8_coef_tree_initialize(void);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_ENTROPY_H_
diff --git a/vp8/common/entropymode.h b/vp8/common/entropymode.h
index 18af8c0b8..81bdfc4b8 100644
--- a/vp8/common/entropymode.h
+++ b/vp8/common/entropymode.h
@@ -15,6 +15,10 @@
#include "onyxc_int.h"
#include "treecoder.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef enum
{
SUBMVREF_NORMAL,
@@ -77,4 +81,8 @@ void vp8_init_mbmode_probs(VP8_COMMON *x);
void vp8_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES-1]);
void vp8_kf_default_bmode_probs(vp8_prob dest [VP8_BINTRAMODES] [VP8_BINTRAMODES] [VP8_BINTRAMODES-1]);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_ENTROPYMODE_H_
diff --git a/vp8/common/entropymv.h b/vp8/common/entropymv.h
index 7d16b988f..42840d58a 100644
--- a/vp8/common/entropymv.h
+++ b/vp8/common/entropymv.h
@@ -14,6 +14,10 @@
#include "treecoder.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum
{
mv_max = 1023, /* max absolute value of a MV component */
@@ -41,4 +45,8 @@ typedef struct mv_context
extern const MV_CONTEXT vp8_mv_update_probs[2], vp8_default_mv_context[2];
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_ENTROPYMV_H_
diff --git a/vp8/common/extend.h b/vp8/common/extend.h
index b7e704079..068f4ac52 100644
--- a/vp8/common/extend.h
+++ b/vp8/common/extend.h
@@ -14,6 +14,10 @@
#include "vpx_scale/yv12config.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp8_extend_mb_row(YV12_BUFFER_CONFIG *ybf, unsigned char *YPtr, unsigned char *UPtr, unsigned char *VPtr);
void vp8_copy_and_extend_frame(YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst);
@@ -22,4 +26,8 @@ void vp8_copy_and_extend_frame_with_rect(YV12_BUFFER_CONFIG *src,
int srcy, int srcx,
int srch, int srcw);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_EXTEND_H_
diff --git a/vp8/common/filter.h b/vp8/common/filter.h
index c2048ee13..cfba775fc 100644
--- a/vp8/common/filter.h
+++ b/vp8/common/filter.h
@@ -14,6 +14,10 @@
#include "vpx_ports/mem.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define BLOCK_HEIGHT_WIDTH 4
#define VP8_FILTER_WEIGHT 128
#define VP8_FILTER_SHIFT 7
@@ -21,4 +25,8 @@
extern DECLARE_ALIGNED(16, const short, vp8_bilinear_filters[8][2]);
extern DECLARE_ALIGNED(16, const short, vp8_sub_pel_filters[8][6]);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_FILTER_H_
diff --git a/vp8/common/findnearmv.h b/vp8/common/findnearmv.h
index 1525db24f..3c8c0506f 100644
--- a/vp8/common/findnearmv.h
+++ b/vp8/common/findnearmv.h
@@ -17,6 +17,10 @@
#include "modecont.h"
#include "treecoder.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp,
const int *ref_frame_sign_bias)
@@ -179,4 +183,8 @@ static B_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb, int b, int mi
return (cur_mb->bmi + b - 4)->as_mode;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_FINDNEARMV_H_
diff --git a/vp8/common/header.h b/vp8/common/header.h
index 61a8f49bc..e27bca16b 100644
--- a/vp8/common/header.h
+++ b/vp8/common/header.h
@@ -12,6 +12,10 @@
#ifndef VP8_COMMON_HEADER_H_
#define VP8_COMMON_HEADER_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* 24 bits total */
typedef struct
{
@@ -40,4 +44,8 @@ typedef struct
#endif
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_HEADER_H_
diff --git a/vp8/common/invtrans.h b/vp8/common/invtrans.h
index 0186e6b3b..affe57e3d 100644
--- a/vp8/common/invtrans.h
+++ b/vp8/common/invtrans.h
@@ -21,6 +21,10 @@
#include "vpx_mem/vpx_mem.h"
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static void eob_adjust(char *eobs, short *diff)
{
/* eob adjust.... the idct can only skip if both the dc and eob are zero */
@@ -59,4 +63,8 @@ static void vp8_inverse_transform_mby(MACROBLOCKD *xd)
xd->dst.y_buffer,
xd->dst.y_stride, xd->eobs);
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_INVTRANS_H_
diff --git a/vp8/common/loopfilter.h b/vp8/common/loopfilter.h
index 51825efc1..20a6bd375 100644
--- a/vp8/common/loopfilter.h
+++ b/vp8/common/loopfilter.h
@@ -16,6 +16,10 @@
#include "vpx_config.h"
#include "vp8_rtcd.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MAX_LOOP_FILTER 63
/* fraction of total macroblock rows to be used in fast filter level picking */
/* has to be > 2 */
@@ -102,4 +106,8 @@ void vp8_loop_filter_row_simple(struct VP8Common *cm,
int mb_row, int post_ystride, int post_uvstride,
unsigned char *y_ptr, unsigned char *u_ptr,
unsigned char *v_ptr);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_LOOPFILTER_H_
diff --git a/vp8/common/modecont.h b/vp8/common/modecont.h
index 875bc2754..ff34c33c5 100644
--- a/vp8/common/modecont.h
+++ b/vp8/common/modecont.h
@@ -12,6 +12,14 @@
#ifndef VP8_COMMON_MODECONT_H_
#define VP8_COMMON_MODECONT_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern const int vp8_mode_contexts[6][4];
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_MODECONT_H_
diff --git a/vp8/common/mv.h b/vp8/common/mv.h
index 1e4b206a2..111ccd63c 100644
--- a/vp8/common/mv.h
+++ b/vp8/common/mv.h
@@ -13,6 +13,10 @@
#define VP8_COMMON_MV_H_
#include "vpx/vpx_integer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct
{
short row;
@@ -25,4 +29,8 @@ typedef union int_mv
MV as_mv;
} int_mv; /* facilitates faster equality tests and copies */
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_MV_H_
diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h
index 92eb7f99a..6d89865c6 100644
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -26,6 +26,10 @@
#include "header.h"
/*#endif*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MINQ 0
#define MAXQ 127
#define QINDEX_RANGE (MAXQ + 1)
@@ -174,4 +178,8 @@ typedef struct VP8Common
int cpu_caps;
} VP8_COMMON;
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_ONYXC_INT_H_
diff --git a/vp8/common/postproc.h b/vp8/common/postproc.h
index 10baf6ccf..33d0a7f02 100644
--- a/vp8/common/postproc.h
+++ b/vp8/common/postproc.h
@@ -26,6 +26,10 @@ struct postproc_state
};
#include "onyxc_int.h"
#include "ppflags.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
int vp8_post_proc_frame(struct VP8Common *oci, YV12_BUFFER_CONFIG *dest,
vp8_ppflags_t *flags);
@@ -47,4 +51,8 @@ void vp8_deblock(struct VP8Common *oci,
#define MFQE_PRECISION 4
void vp8_multiframe_quality_enhance(struct VP8Common *cm);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_POSTPROC_H_
diff --git a/vp8/common/ppflags.h b/vp8/common/ppflags.h
index 1fb37e17a..768224aad 100644
--- a/vp8/common/ppflags.h
+++ b/vp8/common/ppflags.h
@@ -11,6 +11,10 @@
#ifndef VP8_COMMON_PPFLAGS_H_
#define VP8_COMMON_PPFLAGS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
enum
{
VP8D_NOFILTERING = 0,
@@ -38,4 +42,8 @@ typedef struct
int display_mv_flag;
} vp8_ppflags_t;
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_PPFLAGS_H_
diff --git a/vp8/common/pragmas.h b/vp8/common/pragmas.h
index be10452d2..329cc8275 100644
--- a/vp8/common/pragmas.h
+++ b/vp8/common/pragmas.h
@@ -11,6 +11,10 @@
#ifndef VP8_COMMON_PRAGMAS_H_
#define VP8_COMMON_PRAGMAS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef __INTEL_COMPILER
#pragma warning(disable:997 1011 170)
#endif
@@ -18,4 +22,8 @@
#pragma warning(disable:4799)
#endif
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_PRAGMAS_H_
diff --git a/vp8/common/quant_common.h b/vp8/common/quant_common.h
index 4c7457f8d..700b5e6d7 100644
--- a/vp8/common/quant_common.h
+++ b/vp8/common/quant_common.h
@@ -16,6 +16,10 @@
#include "blockd.h"
#include "onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern int vp8_ac_yquant(int QIndex);
extern int vp8_dc_quant(int QIndex, int Delta);
extern int vp8_dc2quant(int QIndex, int Delta);
@@ -23,4 +27,8 @@ extern int vp8_ac2quant(int QIndex, int Delta);
extern int vp8_dc_uv_quant(int QIndex, int Delta);
extern int vp8_ac_uv_quant(int QIndex, int Delta);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_QUANT_COMMON_H_
diff --git a/vp8/common/reconinter.h b/vp8/common/reconinter.h
index 50ebedc00..ba979b966 100644
--- a/vp8/common/reconinter.h
+++ b/vp8/common/reconinter.h
@@ -12,6 +12,10 @@
#ifndef VP8_COMMON_RECONINTER_H_
#define VP8_COMMON_RECONINTER_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void vp8_build_inter_predictors_mb(MACROBLOCKD *x);
extern void vp8_build_inter16x16_predictors_mb(MACROBLOCKD *x,
unsigned char *dst_y,
@@ -32,4 +36,8 @@ extern void vp8_build_inter_predictors_b(BLOCKD *d, int pitch,
extern void vp8_build_inter16x16_predictors_mbuv(MACROBLOCKD *x);
extern void vp8_build_inter4x4_predictors_mbuv(MACROBLOCKD *x);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_RECONINTER_H_
diff --git a/vp8/common/reconintra4x4.h b/vp8/common/reconintra4x4.h
index cbb06ce78..ed59c9edd 100644
--- a/vp8/common/reconintra4x4.h
+++ b/vp8/common/reconintra4x4.h
@@ -13,6 +13,10 @@
#define VP8_COMMON_RECONINTRA4X4_H_
#include "vp8/common/blockd.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static void intra_prediction_down_copy(MACROBLOCKD *xd,
unsigned char *above_right_src)
{
@@ -29,4 +33,8 @@ static void intra_prediction_down_copy(MACROBLOCKD *xd,
*dst_ptr2 = *src_ptr;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_RECONINTRA4X4_H_
diff --git a/vp8/common/setupintrarecon.h b/vp8/common/setupintrarecon.h
index 3db507b88..608f4a9ac 100644
--- a/vp8/common/setupintrarecon.h
+++ b/vp8/common/setupintrarecon.h
@@ -12,6 +12,10 @@
#define VP8_COMMON_SETUPINTRARECON_H_
#include "vpx_scale/yv12config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
extern void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf);
extern void vp8_setup_intra_recon_top_line(YV12_BUFFER_CONFIG *ybf);
@@ -34,4 +38,8 @@ void setup_intra_recon_left(unsigned char *y_buffer,
v_buffer[uv_stride *i] = (unsigned char) 129;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_SETUPINTRARECON_H_
diff --git a/vp8/common/swapyv12buffer.h b/vp8/common/swapyv12buffer.h
index ea8977b10..1d66cd3d6 100644
--- a/vp8/common/swapyv12buffer.h
+++ b/vp8/common/swapyv12buffer.h
@@ -14,6 +14,14 @@
#include "vpx_scale/yv12config.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp8_swap_yv12_buffer(YV12_BUFFER_CONFIG *new_frame, YV12_BUFFER_CONFIG *last_frame);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_SWAPYV12BUFFER_H_
diff --git a/vp8/common/systemdependent.h b/vp8/common/systemdependent.h
index 966cc5d8b..3d44e37cf 100644
--- a/vp8/common/systemdependent.h
+++ b/vp8/common/systemdependent.h
@@ -13,7 +13,15 @@
#include "vpx_config.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct VP8Common;
void vp8_machine_specific_config(struct VP8Common *);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_SYSTEMDEPENDENT_H_
diff --git a/vp8/common/threading.h b/vp8/common/threading.h
index 8cf6d26bc..01c82dbb8 100644
--- a/vp8/common/threading.h
+++ b/vp8/common/threading.h
@@ -12,6 +12,10 @@
#ifndef VP8_COMMON_THREADING_H_
#define VP8_COMMON_THREADING_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if CONFIG_OS_SUPPORT && CONFIG_MULTITHREAD
/* Thread management macros */
@@ -183,4 +187,8 @@ static inline int sem_destroy(sem_t * sem)
#endif /* CONFIG_OS_SUPPORT && CONFIG_MULTITHREAD */
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_THREADING_H_
diff --git a/vp8/common/treecoder.h b/vp8/common/treecoder.h
index edb4b5775..d22b7c570 100644
--- a/vp8/common/treecoder.h
+++ b/vp8/common/treecoder.h
@@ -12,6 +12,10 @@
#ifndef VP8_COMMON_TREECODER_H_
#define VP8_COMMON_TREECODER_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef unsigned char vp8bc_index_t; /* probability index */
@@ -87,4 +91,8 @@ void vp8bc_tree_probs_from_distribution(
);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_TREECODER_H_
diff --git a/vp8/common/variance.h b/vp8/common/variance.h
index 12a03d0fb..89a32a722 100644
--- a/vp8/common/variance.h
+++ b/vp8/common/variance.h
@@ -14,6 +14,10 @@
#include "vpx_config.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef unsigned int(*vp8_sad_fn_t)(
const unsigned char *src_ptr,
int source_stride,
@@ -112,4 +116,8 @@ typedef struct variance_vtable
#endif
} vp8_variance_fn_ptr_t;
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_VARIANCE_H_
diff --git a/vp8/common/vp8_entropymodedata.h b/vp8/common/vp8_entropymodedata.h
index 988114804..c4aed4989 100644
--- a/vp8/common/vp8_entropymodedata.h
+++ b/vp8/common/vp8_entropymodedata.h
@@ -11,6 +11,10 @@
#ifndef VP8_COMMON_VP8_ENTROPYMODEDATA_H_
#define VP8_COMMON_VP8_ENTROPYMODEDATA_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*Generated file, included by entropymode.c*/
@@ -243,4 +247,8 @@ const vp8_prob vp8_kf_bmode_prob
}
};
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_VP8_ENTROPYMODEDATA_H_
diff --git a/vp8/common/x86/filter_x86.h b/vp8/common/x86/filter_x86.h
index 0d537d9df..d282841be 100644
--- a/vp8/common/x86/filter_x86.h
+++ b/vp8/common/x86/filter_x86.h
@@ -13,6 +13,10 @@
#include "vpx_ports/mem.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* x86 assembly specific copy of vp8/common/filter.c:vp8_bilinear_filters with
* duplicated values */
@@ -22,4 +26,8 @@ extern DECLARE_ALIGNED(16, const short, vp8_bilinear_filters_x86_4[8][8]);
/* duplicated 8x */
extern DECLARE_ALIGNED(16, const short, vp8_bilinear_filters_x86_8[8][16]);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_COMMON_X86_FILTER_X86_H_
diff --git a/vp8/decoder/dboolhuff.h b/vp8/decoder/dboolhuff.h
index 82de6b8c8..36af7eed5 100644
--- a/vp8/decoder/dboolhuff.h
+++ b/vp8/decoder/dboolhuff.h
@@ -19,6 +19,10 @@
#include "vpx_ports/mem.h"
#include "vpx/vpx_integer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef size_t VP8_BD_VALUE;
#define VP8_BD_VALUE_SIZE ((int)sizeof(VP8_BD_VALUE)*CHAR_BIT)
@@ -135,4 +139,8 @@ static int vp8dx_bool_error(BOOL_DECODER *br)
return 0;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_DECODER_DBOOLHUFF_H_
diff --git a/vp8/decoder/decodemv.h b/vp8/decoder/decodemv.h
index b5d750ce4..f33b07351 100644
--- a/vp8/decoder/decodemv.h
+++ b/vp8/decoder/decodemv.h
@@ -13,6 +13,14 @@
#include "onyxd_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp8_decode_mode_mvs(VP8D_COMP *);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_DECODER_DECODEMV_H_
diff --git a/vp8/decoder/decoderthreading.h b/vp8/decoder/decoderthreading.h
index 3a8277f4e..c563cf6e9 100644
--- a/vp8/decoder/decoderthreading.h
+++ b/vp8/decoder/decoderthreading.h
@@ -11,6 +11,10 @@
#ifndef VP8_DECODER_DECODERTHREADING_H_
#define VP8_DECODER_DECODERTHREADING_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if CONFIG_MULTITHREAD
void vp8mt_decode_mb_rows(VP8D_COMP *pbi, MACROBLOCKD *xd);
void vp8_decoder_remove_threads(VP8D_COMP *pbi);
@@ -19,4 +23,8 @@ void vp8mt_alloc_temp_buffers(VP8D_COMP *pbi, int width, int prev_mb_rows);
void vp8mt_de_alloc_temp_buffers(VP8D_COMP *pbi, int mb_rows);
#endif
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_DECODER_DECODERTHREADING_H_
diff --git a/vp8/decoder/detokenize.h b/vp8/decoder/detokenize.h
index f134df869..f0b125444 100644
--- a/vp8/decoder/detokenize.h
+++ b/vp8/decoder/detokenize.h
@@ -13,7 +13,15 @@
#include "onyxd_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp8_reset_mb_tokens_context(MACROBLOCKD *x);
int vp8_decode_mb_tokens(VP8D_COMP *, MACROBLOCKD *);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_DECODER_DETOKENIZE_H_
diff --git a/vp8/decoder/ec_types.h b/vp8/decoder/ec_types.h
index 0a3123a65..3af5ca86b 100644
--- a/vp8/decoder/ec_types.h
+++ b/vp8/decoder/ec_types.h
@@ -11,6 +11,10 @@
#ifndef VP8_DECODER_EC_TYPES_H_
#define VP8_DECODER_EC_TYPES_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MAX_OVERLAPS 16
@@ -47,4 +51,8 @@ typedef struct
MV_REFERENCE_FRAME ref_frame;
} EC_BLOCK;
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_DECODER_EC_TYPES_H_
diff --git a/vp8/decoder/error_concealment.h b/vp8/decoder/error_concealment.h
index 10bf870b7..9a1e02486 100644
--- a/vp8/decoder/error_concealment.h
+++ b/vp8/decoder/error_concealment.h
@@ -15,6 +15,10 @@
#include "onyxd_int.h"
#include "ec_types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Allocate memory for the overlap lists */
int vp8_alloc_overlap_lists(VP8D_COMP *pbi);
@@ -38,4 +42,8 @@ void vp8_interpolate_motion(MACROBLOCKD *mb,
*/
void vp8_conceal_corrupt_mb(MACROBLOCKD *xd);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_DECODER_ERROR_CONCEALMENT_H_
diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h
index 3728152b0..8ef489403 100644
--- a/vp8/decoder/onyxd_int.h
+++ b/vp8/decoder/onyxd_int.h
@@ -22,6 +22,10 @@
#include "ec_types.h"
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct
{
int ithread;
@@ -148,4 +152,8 @@ int vp8_remove_decoder_instances(struct frame_buffers *fb);
} while(0)
#endif
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_DECODER_ONYXD_INT_H_
diff --git a/vp8/decoder/treereader.h b/vp8/decoder/treereader.h
index 1d3f67207..35ee69600 100644
--- a/vp8/decoder/treereader.h
+++ b/vp8/decoder/treereader.h
@@ -15,6 +15,10 @@
#include "vp8/common/treecoder.h"
#include "dboolhuff.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef BOOL_DECODER vp8_reader;
#define vp8_read vp8dx_decode_bool
@@ -37,4 +41,8 @@ static int vp8_treed_read(
return -i;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_DECODER_TREEREADER_H_
diff --git a/vp8/encoder/bitstream.h b/vp8/encoder/bitstream.h
index 01aa808d0..eef2d79e0 100644
--- a/vp8/encoder/bitstream.h
+++ b/vp8/encoder/bitstream.h
@@ -12,6 +12,10 @@
#ifndef VP8_ENCODER_BITSTREAM_H_
#define VP8_ENCODER_BITSTREAM_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if HAVE_EDSP
void vp8cx_pack_tokens_armv5(vp8_writer *w, const TOKENEXTRA *p, int xcount,
const vp8_token *,
@@ -43,4 +47,8 @@ void vp8_pack_tokens_c(vp8_writer *w, const TOKENEXTRA *p, int xcount);
# define pack_mb_row_tokens(a,b) pack_mb_row_tokens_c(a,b)
#endif
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_BITSTREAM_H_
diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h
index 0dc0d8600..dd733e55a 100644
--- a/vp8/encoder/block.h
+++ b/vp8/encoder/block.h
@@ -18,6 +18,10 @@
#include "vp8/common/entropy.h"
#include "vpx_ports/mem.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MAX_MODES 20
#define MAX_ERROR_BINS 1024
@@ -160,4 +164,8 @@ typedef struct macroblock
} MACROBLOCK;
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_BLOCK_H_
diff --git a/vp8/encoder/boolhuff.h b/vp8/encoder/boolhuff.h
index 8f451b7f0..611421575 100644
--- a/vp8/encoder/boolhuff.h
+++ b/vp8/encoder/boolhuff.h
@@ -22,6 +22,10 @@
#include "vpx_ports/mem.h"
#include "vpx/internal/vpx_codec_internal.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct
{
unsigned int lowvalue;
@@ -125,4 +129,8 @@ static void vp8_encode_bool(BOOL_CODER *br, int bit, int probability)
br->range = range;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_BOOLHUFF_H_
diff --git a/vp8/encoder/dct_value_cost.h b/vp8/encoder/dct_value_cost.h
index f754e974e..1cd3eec84 100644
--- a/vp8/encoder/dct_value_cost.h
+++ b/vp8/encoder/dct_value_cost.h
@@ -11,6 +11,10 @@
#ifndef VP8_ENCODER_DCT_VALUE_COST_H_
#define VP8_ENCODER_DCT_VALUE_COST_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Generated file, included by tokenize.c */
/* Values generated by fill_value_tokens() */
@@ -360,4 +364,8 @@ static const short dct_value_cost[2048*2] =
8251, 8257, 8265, 8275
};
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_DCT_VALUE_COST_H_
diff --git a/vp8/encoder/dct_value_tokens.h b/vp8/encoder/dct_value_tokens.h
index e4132c62b..c2aadefca 100644
--- a/vp8/encoder/dct_value_tokens.h
+++ b/vp8/encoder/dct_value_tokens.h
@@ -11,6 +11,10 @@
#ifndef VP8_ENCODER_DCT_VALUE_TOKENS_H_
#define VP8_ENCODER_DCT_VALUE_TOKENS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Generated file, included by tokenize.c */
/* Values generated by fill_value_tokens() */
@@ -701,4 +705,8 @@ static const TOKENVALUE dct_value_tokens[2048*2] =
{10, 3954}, {10, 3956}, {10, 3958}, {10, 3960}
};
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_DCT_VALUE_TOKENS_H_
diff --git a/vp8/encoder/defaultcoefcounts.h b/vp8/encoder/defaultcoefcounts.h
index 3015a585e..1e8e80484 100644
--- a/vp8/encoder/defaultcoefcounts.h
+++ b/vp8/encoder/defaultcoefcounts.h
@@ -11,6 +11,10 @@
#ifndef VP8_ENCODER_DEFAULTCOEFCOUNTS_H_
#define VP8_ENCODER_DEFAULTCOEFCOUNTS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Generated file, included by entropy.c */
static const unsigned int default_coef_counts[BLOCK_TYPES]
@@ -225,4 +229,8 @@ static const unsigned int default_coef_counts[BLOCK_TYPES]
},
};
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_DEFAULTCOEFCOUNTS_H_
diff --git a/vp8/encoder/denoising.h b/vp8/encoder/denoising.h
index 83fb93a14..cc9913afa 100644
--- a/vp8/encoder/denoising.h
+++ b/vp8/encoder/denoising.h
@@ -13,6 +13,10 @@
#include "block.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define SUM_DIFF_THRESHOLD (16 * 16 * 2)
#define MOTION_MAGNITUDE_THRESHOLD (8*3)
@@ -39,4 +43,8 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
int recon_yoffset,
int recon_uvoffset);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_DENOISING_H_
diff --git a/vp8/encoder/encodeframe.h b/vp8/encoder/encodeframe.h
index 180596bf1..e185c1035 100644
--- a/vp8/encoder/encodeframe.h
+++ b/vp8/encoder/encodeframe.h
@@ -9,6 +9,10 @@
*/
#ifndef VP8_ENCODER_ENCODEFRAME_H_
#define VP8_ENCODER_ENCODEFRAME_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
extern void vp8_activity_masking(VP8_COMP *cpi, MACROBLOCK *x);
extern void vp8_build_block_offsets(MACROBLOCK *x);
@@ -24,4 +28,8 @@ extern int vp8cx_encode_inter_macroblock(VP8_COMP *cpi, MACROBLOCK *x,
extern int vp8cx_encode_intra_macroblock(VP8_COMP *cpi, MACROBLOCK *x,
TOKENEXTRA **t);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_ENCODEFRAME_H_
diff --git a/vp8/encoder/encodeintra.h b/vp8/encoder/encodeintra.h
index c6da43b8f..a8d0284d2 100644
--- a/vp8/encoder/encodeintra.h
+++ b/vp8/encoder/encodeintra.h
@@ -13,9 +13,17 @@
#define VP8_ENCODER_ENCODEINTRA_H_
#include "onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int vp8_encode_intra(VP8_COMP *cpi, MACROBLOCK *x, int use_dc_pred);
void vp8_encode_intra16x16mby(MACROBLOCK *x);
void vp8_encode_intra16x16mbuv(MACROBLOCK *x);
void vp8_encode_intra4x4mby(MACROBLOCK *mb);
void vp8_encode_intra4x4block(MACROBLOCK *x, int ib);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_ENCODEINTRA_H_
diff --git a/vp8/encoder/encodemb.h b/vp8/encoder/encodemb.h
index cbe62e9e5..0b3ec875e 100644
--- a/vp8/encoder/encodemb.h
+++ b/vp8/encoder/encodemb.h
@@ -13,6 +13,10 @@
#define VP8_ENCODER_ENCODEMB_H_
#include "onyx_int.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
void vp8_encode_inter16x16(MACROBLOCK *x);
void vp8_build_dcblock(MACROBLOCK *b);
@@ -23,4 +27,8 @@ void vp8_transform_intra_mby(MACROBLOCK *x);
void vp8_optimize_mby(MACROBLOCK *x);
void vp8_optimize_mbuv(MACROBLOCK *x);
void vp8_encode_inter16x16y(MACROBLOCK *x);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_ENCODEMB_H_
diff --git a/vp8/encoder/encodemv.h b/vp8/encoder/encodemv.h
index 65e7ac21a..722162ba2 100644
--- a/vp8/encoder/encodemv.h
+++ b/vp8/encoder/encodemv.h
@@ -14,8 +14,16 @@
#include "onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp8_write_mvprobs(VP8_COMP *);
void vp8_encode_motion_vector(vp8_writer *, const MV *, const MV_CONTEXT *);
void vp8_build_component_cost_table(int *mvcost[2], const MV_CONTEXT *mvc, int mvc_flag[2]);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_ENCODEMV_H_
diff --git a/vp8/encoder/firstpass.h b/vp8/encoder/firstpass.h
index cf686793c..c409ebca8 100644
--- a/vp8/encoder/firstpass.h
+++ b/vp8/encoder/firstpass.h
@@ -12,6 +12,10 @@
#ifndef VP8_ENCODER_FIRSTPASS_H_
#define VP8_ENCODER_FIRSTPASS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void vp8_init_first_pass(VP8_COMP *cpi);
extern void vp8_first_pass(VP8_COMP *cpi);
extern void vp8_end_first_pass(VP8_COMP *cpi);
@@ -21,4 +25,8 @@ extern void vp8_second_pass(VP8_COMP *cpi);
extern void vp8_end_second_pass(VP8_COMP *cpi);
extern size_t vp8_firstpass_stats_sz(unsigned int mb_count);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_FIRSTPASS_H_
diff --git a/vp8/encoder/lookahead.h b/vp8/encoder/lookahead.h
index d1904fa90..cad68e639 100644
--- a/vp8/encoder/lookahead.h
+++ b/vp8/encoder/lookahead.h
@@ -12,6 +12,10 @@
#include "vpx_scale/yv12config.h"
#include "vpx/vpx_integer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct lookahead_entry
{
YV12_BUFFER_CONFIG img;
@@ -106,4 +110,8 @@ unsigned int
vp8_lookahead_depth(struct lookahead_ctx *ctx);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_LOOKAHEAD_H_
diff --git a/vp8/encoder/mcomp.h b/vp8/encoder/mcomp.h
index 85bc7add8..f284f7c38 100644
--- a/vp8/encoder/mcomp.h
+++ b/vp8/encoder/mcomp.h
@@ -15,6 +15,10 @@
#include "block.h"
#include "vp8/common/variance.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef VP8_ENTROPY_STATS
extern void init_mv_ref_counts();
extern void accum_mv_refs(MB_PREDICTION_MODE, const int near_mv_ref_cts[4]);
@@ -104,4 +108,8 @@ typedef int (*vp8_diamond_search_fn_t)
int_mv *center_mv
);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_MCOMP_H_
diff --git a/vp8/encoder/modecosts.h b/vp8/encoder/modecosts.h
index 2df944643..9281551c8 100644
--- a/vp8/encoder/modecosts.h
+++ b/vp8/encoder/modecosts.h
@@ -12,6 +12,14 @@
#ifndef VP8_ENCODER_MODECOSTS_H_
#define VP8_ENCODER_MODECOSTS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp8_init_mode_costs(VP8_COMP *x);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_MODECOSTS_H_
diff --git a/vp8/encoder/mr_dissim.h b/vp8/encoder/mr_dissim.h
index 8b22566bb..5a59ce62a 100644
--- a/vp8/encoder/mr_dissim.h
+++ b/vp8/encoder/mr_dissim.h
@@ -13,8 +13,16 @@
#define VP8_ENCODER_MR_DISSIM_H_
#include "vpx_config.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void vp8_cal_low_res_mb_cols(VP8_COMP *cpi);
extern void vp8_cal_dissimilarity(VP8_COMP *cpi);
extern void vp8_store_drop_frame_info(VP8_COMP *cpi);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_MR_DISSIM_H_
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 2fa6a9337..6b371671d 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -33,6 +33,10 @@
#include "vp8/encoder/denoising.h"
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MIN_GF_INTERVAL 4
#define DEFAULT_GF_INTERVAL 7
@@ -721,4 +725,8 @@ void vp8_set_speed_features(VP8_COMP *cpi);
"Failed to allocate "#lval);\
} while(0)
#endif
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_ONYX_INT_H_
diff --git a/vp8/encoder/pickinter.h b/vp8/encoder/pickinter.h
index f74cf3df1..cf3b1f8d4 100644
--- a/vp8/encoder/pickinter.h
+++ b/vp8/encoder/pickinter.h
@@ -14,6 +14,10 @@
#include "vpx_config.h"
#include "vp8/common/onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
int recon_uvoffset, int *returnrate,
int *returndistortion, int *returnintra,
@@ -24,4 +28,8 @@ extern int vp8_get_inter_mbpred_error(MACROBLOCK *mb,
const vp8_variance_fn_ptr_t *vfp,
unsigned int *sse,
int_mv this_mv);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_PICKINTER_H_
diff --git a/vp8/encoder/psnr.h b/vp8/encoder/psnr.h
index b2106151b..0c6c088c4 100644
--- a/vp8/encoder/psnr.h
+++ b/vp8/encoder/psnr.h
@@ -12,6 +12,14 @@
#ifndef VP8_ENCODER_PSNR_H_
#define VP8_ENCODER_PSNR_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern double vp8_mse2psnr(double Samples, double Peak, double Mse);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_PSNR_H_
diff --git a/vp8/encoder/quantize.h b/vp8/encoder/quantize.h
index bbad8c7c3..c739b2627 100644
--- a/vp8/encoder/quantize.h
+++ b/vp8/encoder/quantize.h
@@ -12,6 +12,10 @@
#ifndef VP8_ENCODER_QUANTIZE_H_
#define VP8_ENCODER_QUANTIZE_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct VP8_COMP;
struct macroblock;
extern void vp8_set_quantizer(struct VP8_COMP *cpi, int Q);
@@ -20,4 +24,8 @@ extern void vp8_update_zbin_extra(struct VP8_COMP *cpi, struct macroblock *x);
extern void vp8cx_mb_init_quantizer(struct VP8_COMP *cpi, struct macroblock *x, int ok_to_skip);
extern void vp8cx_init_quantizer(struct VP8_COMP *cpi);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_QUANTIZE_H_
diff --git a/vp8/encoder/ratectrl.h b/vp8/encoder/ratectrl.h
index 88fe67899..829697f39 100644
--- a/vp8/encoder/ratectrl.h
+++ b/vp8/encoder/ratectrl.h
@@ -14,6 +14,10 @@
#include "onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void vp8_save_coding_context(VP8_COMP *cpi);
extern void vp8_restore_coding_context(VP8_COMP *cpi);
@@ -26,4 +30,8 @@ extern void vp8_compute_frame_size_bounds(VP8_COMP *cpi, int *frame_under_shoot_
/* return of 0 means drop frame */
extern int vp8_pick_frame_size(VP8_COMP *cpi);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_RATECTRL_H_
diff --git a/vp8/encoder/rdopt.h b/vp8/encoder/rdopt.h
index c28c37369..fe21b8e28 100644
--- a/vp8/encoder/rdopt.h
+++ b/vp8/encoder/rdopt.h
@@ -12,6 +12,10 @@
#ifndef VP8_ENCODER_RDOPT_H_
#define VP8_ENCODER_RDOPT_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define RDCOST(RM,DM,R,D) ( ((128+(R)*(RM)) >> 8) + (DM)*(D) )
static void insertsortmv(int arr[], int len)
@@ -130,4 +134,8 @@ extern void vp8_mv_pred
);
void vp8_cal_sad(VP8_COMP *cpi, MACROBLOCKD *xd, MACROBLOCK *x, int recon_yoffset, int near_sadidx[]);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_RDOPT_H_
diff --git a/vp8/encoder/segmentation.h b/vp8/encoder/segmentation.h
index 8811a8b62..6b5500594 100644
--- a/vp8/encoder/segmentation.h
+++ b/vp8/encoder/segmentation.h
@@ -15,6 +15,14 @@
#include "vp8/common/blockd.h"
#include "onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void vp8_update_gf_useage_maps(VP8_COMP *cpi, VP8_COMMON *cm, MACROBLOCK *x);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_SEGMENTATION_H_
diff --git a/vp8/encoder/tokenize.h b/vp8/encoder/tokenize.h
index f85f3c9b1..b73a9ee1c 100644
--- a/vp8/encoder/tokenize.h
+++ b/vp8/encoder/tokenize.h
@@ -15,6 +15,10 @@
#include "vp8/common/entropy.h"
#include "block.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp8_tokenize_initialize();
typedef struct
@@ -47,4 +51,8 @@ extern const short *const vp8_dct_value_cost_ptr;
*/
extern const TOKENVALUE *const vp8_dct_value_tokens_ptr;
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_TOKENIZE_H_
diff --git a/vp8/encoder/treewriter.h b/vp8/encoder/treewriter.h
index ba03f07e3..cfb2730ab 100644
--- a/vp8/encoder/treewriter.h
+++ b/vp8/encoder/treewriter.h
@@ -19,6 +19,10 @@
#include "boolhuff.h" /* for now */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef BOOL_CODER vp8_writer;
#define vp8_write vp8_encode_bool
@@ -123,4 +127,8 @@ void vp8_cost_tokens2(
int *Costs, const vp8_prob *, vp8_tree, int
);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP8_ENCODER_TREEWRITER_H_
diff --git a/vp9/common/arm/neon/vp9_reconintra_neon.asm b/vp9/common/arm/neon/vp9_reconintra_neon.asm
index 71bf24c9f..ba1aebf31 100644
--- a/vp9/common/arm/neon/vp9_reconintra_neon.asm
+++ b/vp9/common/arm/neon/vp9_reconintra_neon.asm
@@ -18,6 +18,7 @@
EXPORT |vp9_h_predictor_32x32_neon|
EXPORT |vp9_tm_predictor_4x4_neon|
EXPORT |vp9_tm_predictor_8x8_neon|
+ EXPORT |vp9_tm_predictor_16x16_neon|
ARM
REQUIRE8
PRESERVE8
@@ -403,4 +404,100 @@ loop_h
bx lr
ENDP ; |vp9_tm_predictor_8x8_neon|
+;void vp9_tm_predictor_16x16_neon (uint8_t *dst, ptrdiff_t y_stride,
+; const uint8_t *above,
+; const uint8_t *left)
+; r0 uint8_t *dst
+; r1 ptrdiff_t y_stride
+; r2 const uint8_t *above
+; r3 const uint8_t *left
+
+|vp9_tm_predictor_16x16_neon| PROC
+ ; Load ytop_left = above[-1];
+ sub r12, r2, #1
+ ldrb r12, [r12]
+ vdup.u8 q0, r12
+
+ ; Load above 8 pixels
+ vld1.8 q1, [r2]
+
+ ; preload 8 left into r12
+ vld1.8 d18, [r3]!
+
+ ; Compute above - ytop_left
+ vsubl.u8 q2, d2, d0
+ vsubl.u8 q3, d3, d1
+
+ vmovl.u8 q10, d18
+
+ ; Load left row by row and compute left + (above - ytop_left)
+ ; Process 8 rows in each single loop and loop 2 times to process 16 rows.
+ mov r2, #2
+
+loop_16x16_neon
+ ; Process two rows.
+ vdup.16 q0, d20[0]
+ vdup.16 q8, d20[1]
+ vadd.s16 q1, q0, q2
+ vadd.s16 q0, q0, q3
+ vadd.s16 q11, q8, q2
+ vadd.s16 q8, q8, q3
+ vqshrun.s16 d2, q1, #0
+ vqshrun.s16 d3, q0, #0
+ vqshrun.s16 d22, q11, #0
+ vqshrun.s16 d23, q8, #0
+ vdup.16 q0, d20[2] ; proload next 2 rows data
+ vdup.16 q8, d20[3]
+ vst1.64 {d2,d3}, [r0], r1
+ vst1.64 {d22,d23}, [r0], r1
+
+ ; Process two rows.
+ vadd.s16 q1, q0, q2
+ vadd.s16 q0, q0, q3
+ vadd.s16 q11, q8, q2
+ vadd.s16 q8, q8, q3
+ vqshrun.s16 d2, q1, #0
+ vqshrun.s16 d3, q0, #0
+ vqshrun.s16 d22, q11, #0
+ vqshrun.s16 d23, q8, #0
+ vdup.16 q0, d21[0] ; proload next 2 rows data
+ vdup.16 q8, d21[1]
+ vst1.64 {d2,d3}, [r0], r1
+ vst1.64 {d22,d23}, [r0], r1
+
+ vadd.s16 q1, q0, q2
+ vadd.s16 q0, q0, q3
+ vadd.s16 q11, q8, q2
+ vadd.s16 q8, q8, q3
+ vqshrun.s16 d2, q1, #0
+ vqshrun.s16 d3, q0, #0
+ vqshrun.s16 d22, q11, #0
+ vqshrun.s16 d23, q8, #0
+ vdup.16 q0, d21[2] ; proload next 2 rows data
+ vdup.16 q8, d21[3]
+ vst1.64 {d2,d3}, [r0], r1
+ vst1.64 {d22,d23}, [r0], r1
+
+
+ vadd.s16 q1, q0, q2
+ vadd.s16 q0, q0, q3
+ vadd.s16 q11, q8, q2
+ vadd.s16 q8, q8, q3
+ vqshrun.s16 d2, q1, #0
+ vqshrun.s16 d3, q0, #0
+ vqshrun.s16 d22, q11, #0
+ vqshrun.s16 d23, q8, #0
+ vdup.16 q0, d20[2]
+ vdup.16 q8, d20[3]
+ vld1.8 d18, [r3]! ; preload 8 left into r12
+ vmovl.u8 q10, d18
+ vst1.64 {d2,d3}, [r0], r1
+ vst1.64 {d22,d23}, [r0], r1
+
+ subs r2, r2, #1
+ bgt loop_16x16_neon
+
+ bx lr
+ ENDP ; |vp9_tm_predictor_16x16_neon|
+
END
diff --git a/vp9/common/mips/dspr2/vp9_common_dspr2.h b/vp9/common/mips/dspr2/vp9_common_dspr2.h
index e9c698119..991d3c2b3 100644
--- a/vp9/common/mips/dspr2/vp9_common_dspr2.h
+++ b/vp9/common/mips/dspr2/vp9_common_dspr2.h
@@ -17,6 +17,10 @@
#include "vpx/vpx_integer.h"
#include "vp9/common/vp9_common.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if HAVE_DSPR2
#define CROP_WIDTH 512
extern uint8_t *vp9_ff_cropTbl;
@@ -114,4 +118,8 @@ void vp9_convolve2_vert_dspr2(const uint8_t *src, ptrdiff_t src_stride,
int w, int h);
#endif // #if HAVE_DSPR2
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_MIPS_DSPR2_VP9_COMMON_DSPR2_H_
diff --git a/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h b/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h
index 98bfcfaf2..008cf8cac 100644
--- a/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h
+++ b/vp9/common/mips/dspr2/vp9_loopfilter_filters_dspr2.h
@@ -17,6 +17,10 @@
#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if HAVE_DSPR2
/* inputs & outputs are quad-byte vectors */
static INLINE void vp9_filter_dspr2(uint32_t mask, uint32_t hev,
@@ -752,4 +756,8 @@ static INLINE void vp9_wide_mbfilter_dspr2(uint32_t *op7, uint32_t *op6,
*oq6 = res_oq6;
}
#endif // #if HAVE_DSPR2
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_FILTERS_DSPR2_H_
diff --git a/vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h b/vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h
index 4cb2ebb46..ca01a6a10 100644
--- a/vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h
+++ b/vp9/common/mips/dspr2/vp9_loopfilter_macros_dspr2.h
@@ -17,6 +17,10 @@
#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if HAVE_DSPR2
#define STORE_F0() { \
__asm__ __volatile__ ( \
@@ -467,4 +471,8 @@
}
#endif // #if HAVE_DSPR2
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MACROS_DSPR2_H_
diff --git a/vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h b/vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h
index b9e0aca90..5b0d9cc9b 100644
--- a/vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h
+++ b/vp9/common/mips/dspr2/vp9_loopfilter_masks_dspr2.h
@@ -17,6 +17,10 @@
#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if HAVE_DSPR2
/* processing 4 pixels at the same time
* compute hev and mask in the same function */
@@ -362,4 +366,8 @@ static INLINE void vp9_flatmask5(uint32_t p4, uint32_t p3,
*flat2 = flat1;
}
#endif // #if HAVE_DSPR2
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MASKS_DSPR2_H_
diff --git a/vp9/common/vp9_alloccommon.h b/vp9/common/vp9_alloccommon.h
index cf8dca573..e3b5b95d8 100644
--- a/vp9/common/vp9_alloccommon.h
+++ b/vp9/common/vp9_alloccommon.h
@@ -14,6 +14,10 @@
#include "vp9/common/vp9_onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_initialize_common();
void vp9_update_mode_info_border(VP9_COMMON *cm, MODE_INFO *mi);
@@ -28,4 +32,8 @@ void vp9_free_frame_buffers(VP9_COMMON *cm);
void vp9_update_frame_size(VP9_COMMON *cm);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_ALLOCCOMMON_H_
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index ad78b0dc4..ad35c7ae0 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -25,6 +25,10 @@
#include "vp9/common/vp9_scale.h"
#include "vp9/common/vp9_seg_common.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define BLOCK_SIZE_GROUPS 4
#define MBSKIP_CONTEXTS 3
#define INTER_MODE_CONTEXTS 7
@@ -463,4 +467,8 @@ static int get_tx_eob(const struct segmentation *seg, int segment_id,
return vp9_segfeature_active(seg, segment_id, SEG_LVL_SKIP) ? 0 : eob_max;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_BLOCKD_H_
diff --git a/vp9/common/vp9_common.h b/vp9/common/vp9_common.h
index 36d1cdf14..69964dae8 100644
--- a/vp9/common/vp9_common.h
+++ b/vp9/common/vp9_common.h
@@ -19,6 +19,10 @@
#include "vpx_mem/vpx_mem.h"
#include "vpx/vpx_integer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
@@ -91,4 +95,8 @@ static int get_unsigned_bits(unsigned int num_values) {
#define VP9_FRAME_MARKER 0x2
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_COMMON_H_
diff --git a/vp9/common/vp9_common_data.h b/vp9/common/vp9_common_data.h
index 5222d29c1..f41962747 100644
--- a/vp9/common/vp9_common_data.h
+++ b/vp9/common/vp9_common_data.h
@@ -13,6 +13,10 @@
#include "vp9/common/vp9_enums.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern const int b_width_log2_lookup[BLOCK_SIZES];
extern const int b_height_log2_lookup[BLOCK_SIZES];
extern const int mi_width_log2_lookup[BLOCK_SIZES];
@@ -28,4 +32,8 @@ extern const TX_SIZE max_txsize_lookup[BLOCK_SIZES];
extern const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES];
extern const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2];
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_COMMON_DATA_H_
diff --git a/vp9/common/vp9_convolve.h b/vp9/common/vp9_convolve.h
index 29d499063..6bf71fc79 100644
--- a/vp9/common/vp9_convolve.h
+++ b/vp9/common/vp9_convolve.h
@@ -13,10 +13,18 @@
#include "./vpx_config.h"
#include "vpx/vpx_integer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef void (*convolve_fn_t)(const uint8_t *src, ptrdiff_t src_stride,
uint8_t *dst, ptrdiff_t dst_stride,
const int16_t *filter_x, int x_step_q4,
const int16_t *filter_y, int y_step_q4,
int w, int h);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_CONVOLVE_H_
diff --git a/vp9/common/vp9_entropy.h b/vp9/common/vp9_entropy.h
index ba162fd20..e030d92ec 100644
--- a/vp9/common/vp9_entropy.h
+++ b/vp9/common/vp9_entropy.h
@@ -18,6 +18,10 @@
#include "vp9/common/vp9_scan.h"
#include "vp9/common/vp9_entropymode.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define DIFF_UPDATE_PROB 252
// Coefficient token alphabet
@@ -184,4 +188,8 @@ static const scan_order *get_scan(const MACROBLOCKD *xd, TX_SIZE tx_size,
}
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_ENTROPY_H_
diff --git a/vp9/common/vp9_entropymode.h b/vp9/common/vp9_entropymode.h
index 5312553c7..edb03961c 100644
--- a/vp9/common/vp9_entropymode.h
+++ b/vp9/common/vp9_entropymode.h
@@ -13,6 +13,10 @@
#include "vp9/common/vp9_blockd.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define TX_SIZE_CONTEXTS 2
#define SWITCHABLE_FILTERS 3 // number of switchable filters
#define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
@@ -57,4 +61,8 @@ void tx_counts_to_branch_counts_16x16(const unsigned int *tx_count_16x16p,
void tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p,
unsigned int (*ct_8x8p)[2]);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_ENTROPYMODE_H_
diff --git a/vp9/common/vp9_entropymv.h b/vp9/common/vp9_entropymv.h
index 48cb82db1..7e1f1479b 100644
--- a/vp9/common/vp9_entropymv.h
+++ b/vp9/common/vp9_entropymv.h
@@ -15,6 +15,10 @@
#include "./vpx_config.h"
#include "vp9/common/vp9_blockd.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct VP9Common;
void vp9_init_mv_probs(struct VP9Common *cm);
@@ -121,4 +125,8 @@ typedef struct {
void vp9_inc_mv(const MV *mv, nmv_context_counts *mvctx);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_ENTROPYMV_H_
diff --git a/vp9/common/vp9_enums.h b/vp9/common/vp9_enums.h
index 34411a34f..e96e76947 100644
--- a/vp9/common/vp9_enums.h
+++ b/vp9/common/vp9_enums.h
@@ -13,6 +13,10 @@
#include "./vpx_config.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MI_SIZE_LOG2 3
#define MI_BLOCK_SIZE_LOG2 (6 - MI_SIZE_LOG2) // 64 = 2^6
@@ -90,4 +94,8 @@ typedef enum {
SRGB = 7 // RGB
} COLOR_SPACE;
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_ENUMS_H_
diff --git a/vp9/common/vp9_filter.h b/vp9/common/vp9_filter.h
index b1e7e6499..b02aaed9e 100644
--- a/vp9/common/vp9_filter.h
+++ b/vp9/common/vp9_filter.h
@@ -14,6 +14,10 @@
#include "./vpx_config.h"
#include "vpx/vpx_integer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define FILTER_BITS 7
#define SUBPEL_BITS 4
@@ -48,4 +52,8 @@ extern const subpel_kernel vp9_sub_pel_filters_8lp[SUBPEL_SHIFTS];
#define BILINEAR_FILTERS_2TAP(x) \
(vp9_bilinear_filters[(x)] + SUBPEL_TAPS/2 - 1)
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_FILTER_H_
diff --git a/vp9/common/vp9_idct.h b/vp9/common/vp9_idct.h
index 183c50abf..ceca7951b 100644
--- a/vp9/common/vp9_idct.h
+++ b/vp9/common/vp9_idct.h
@@ -18,6 +18,10 @@
#include "vp9/common/vp9_common.h"
#include "vp9/common/vp9_enums.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Constants and Macros used by all idct/dct functions
#define DCT_CONST_BITS 14
@@ -103,4 +107,8 @@ void vp9_iht16x16_add(TX_TYPE tx_type, const int16_t *input, uint8_t *dest,
int stride, int eob);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_IDCT_H_
diff --git a/vp9/common/vp9_loopfilter.h b/vp9/common/vp9_loopfilter.h
index 98fac96ff..43373f4b1 100644
--- a/vp9/common/vp9_loopfilter.h
+++ b/vp9/common/vp9_loopfilter.h
@@ -17,6 +17,10 @@
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_seg_common.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MAX_LOOP_FILTER 63
#define MAX_SHARPNESS 7
@@ -90,4 +94,8 @@ typedef struct LoopFilterWorkerData {
// Operates on the rows described by LFWorkerData passed as 'arg1'.
int vp9_loop_filter_worker(void *arg1, void *arg2);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_LOOPFILTER_H_
diff --git a/vp9/common/vp9_mv.h b/vp9/common/vp9_mv.h
index 155c3f12e..98fd1d82f 100644
--- a/vp9/common/vp9_mv.h
+++ b/vp9/common/vp9_mv.h
@@ -15,6 +15,10 @@
#include "vp9/common/vp9_common.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct mv {
int16_t row;
int16_t col;
@@ -36,4 +40,8 @@ static void clamp_mv(MV *mv, int min_col, int max_col,
mv->row = clamp(mv->row, min_row, max_row);
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_MV_H_
diff --git a/vp9/common/vp9_mvref_common.h b/vp9/common/vp9_mvref_common.h
index cd89390d5..0936abfcd 100644
--- a/vp9/common/vp9_mvref_common.h
+++ b/vp9/common/vp9_mvref_common.h
@@ -7,12 +7,16 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
+#ifndef VP9_COMMON_VP9_MVREF_COMMON_H_
+#define VP9_COMMON_VP9_MVREF_COMMON_H_
#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/common/vp9_blockd.h"
-#ifndef VP9_COMMON_VP9_MVREF_COMMON_H_
-#define VP9_COMMON_VP9_MVREF_COMMON_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_find_mv_refs_idx(const VP9_COMMON *cm, const MACROBLOCKD *xd,
const TileInfo *const tile,
@@ -56,4 +60,8 @@ void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
int block, int ref, int mi_row, int mi_col,
int_mv *nearest, int_mv *near);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_MVREF_COMMON_H_
diff --git a/vp9/common/vp9_onyx.h b/vp9/common/vp9_onyx.h
index 45d798482..9df76ded3 100644
--- a/vp9/common/vp9_onyx.h
+++ b/vp9/common/vp9_onyx.h
@@ -11,17 +11,16 @@
#ifndef VP9_COMMON_VP9_ONYX_H_
#define VP9_COMMON_VP9_ONYX_H_
-#ifdef __cplusplus
-extern "C"
-{ // NOLINT
-#endif
-
#include "./vpx_config.h"
#include "vpx/internal/vpx_codec_internal.h"
#include "vpx/vp8cx.h"
#include "vpx_scale/yv12config.h"
#include "vp9/common/vp9_ppflags.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MAX_SEGMENTS 8
typedef int *VP9_PTR;
@@ -237,7 +236,7 @@ extern "C"
int vp9_get_quantizer(VP9_PTR c);
#ifdef __cplusplus
-}
+} // extern "C"
#endif
#endif // VP9_COMMON_VP9_ONYX_H_
diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index f6fe4d3f1..364c2a93d 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -25,6 +25,10 @@
#include "vp9/common/vp9_postproc.h"
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define REFS_PER_FRAME 3
#define REF_FRAMES_LOG2 3
@@ -359,4 +363,8 @@ static INLINE int partition_plane_context(
return (left * 2 + above) + bsl * PARTITION_PLOFFSET;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_ONYXC_INT_H_
diff --git a/vp9/common/vp9_postproc.h b/vp9/common/vp9_postproc.h
index b8a456fdb..b07d5d045 100644
--- a/vp9/common/vp9_postproc.h
+++ b/vp9/common/vp9_postproc.h
@@ -15,6 +15,10 @@
#include "vpx_ports/mem.h"
#include "vp9/common/vp9_ppflags.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct postproc_state {
int last_q;
int last_noise;
@@ -33,4 +37,8 @@ void vp9_denoise(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
void vp9_deblock(const YV12_BUFFER_CONFIG *src, YV12_BUFFER_CONFIG *dst, int q);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_POSTPROC_H_
diff --git a/vp9/common/vp9_ppflags.h b/vp9/common/vp9_ppflags.h
index 561c93028..8168935fc 100644
--- a/vp9/common/vp9_ppflags.h
+++ b/vp9/common/vp9_ppflags.h
@@ -11,6 +11,10 @@
#ifndef VP9_COMMON_VP9_PPFLAGS_H_
#define VP9_COMMON_VP9_PPFLAGS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum {
VP9D_NOFILTERING = 0,
VP9D_DEBLOCK = 1 << 0,
@@ -35,4 +39,8 @@ typedef struct {
int display_mv_flag;
} vp9_ppflags_t;
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_PPFLAGS_H_
diff --git a/vp9/common/vp9_pragmas.h b/vp9/common/vp9_pragmas.h
index f079161d6..0efc713ca 100644
--- a/vp9/common/vp9_pragmas.h
+++ b/vp9/common/vp9_pragmas.h
@@ -11,6 +11,10 @@
#ifndef VP9_COMMON_VP9_PRAGMAS_H_
#define VP9_COMMON_VP9_PRAGMAS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef __INTEL_COMPILER
#pragma warning(disable:997 1011 170)
#endif
@@ -19,4 +23,8 @@
#pragma warning(disable:4799)
#endif
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_PRAGMAS_H_
diff --git a/vp9/common/vp9_pred_common.h b/vp9/common/vp9_pred_common.h
index 23722ba72..26edf7810 100644
--- a/vp9/common/vp9_pred_common.h
+++ b/vp9/common/vp9_pred_common.h
@@ -14,6 +14,10 @@
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static INLINE const MODE_INFO *get_above_mi(const MACROBLOCKD *const xd) {
return xd->up_available ? xd->mi_8x8[-xd->mode_info_stride] : NULL;
}
@@ -129,4 +133,8 @@ static unsigned int *get_tx_counts(TX_SIZE max_tx_size, int ctx,
}
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_PRED_COMMON_H_
diff --git a/vp9/common/vp9_prob.h b/vp9/common/vp9_prob.h
index 7a790c542..cc8d8ab38 100644
--- a/vp9/common/vp9_prob.h
+++ b/vp9/common/vp9_prob.h
@@ -18,6 +18,10 @@
#include "vp9/common/vp9_common.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef uint8_t vp9_prob;
#define MAX_PROB 255
@@ -109,4 +113,8 @@ static void tree_merge_probs(const vp9_tree_index *tree,
DECLARE_ALIGNED(16, extern const uint8_t, vp9_norm[256]);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_PROB_H_
diff --git a/vp9/common/vp9_quant_common.h b/vp9/common/vp9_quant_common.h
index 83f2fb655..af50e23cd 100644
--- a/vp9/common/vp9_quant_common.h
+++ b/vp9/common/vp9_quant_common.h
@@ -13,6 +13,10 @@
#include "vp9/common/vp9_blockd.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MINQ 0
#define MAXQ 255
#define QINDEX_RANGE (MAXQ - MINQ + 1)
@@ -25,4 +29,8 @@ int16_t vp9_ac_quant(int qindex, int delta);
int vp9_get_qindex(struct segmentation *seg, int segment_id, int base_qindex);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_QUANT_COMMON_H_
diff --git a/vp9/common/vp9_reconinter.h b/vp9/common/vp9_reconinter.h
index 3cc16d94e..58f4b417e 100644
--- a/vp9/common/vp9_reconinter.h
+++ b/vp9/common/vp9_reconinter.h
@@ -14,6 +14,10 @@
#include "vpx/vpx_integer.h"
#include "vp9/common/vp9_onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct subpix_fn_table;
void vp9_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
BLOCK_SIZE bsize);
@@ -90,10 +94,13 @@ static void setup_pre_planes(MACROBLOCKD *xd, int idx,
}
}
-static void set_scale_factors(VP9_COMMON *cm, MACROBLOCKD *xd,
- int ref0, int ref1) {
+static void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd, int ref0, int ref1) {
xd->block_refs[0] = &cm->frame_refs[ref0 >= 0 ? ref0 : 0];
xd->block_refs[1] = &cm->frame_refs[ref1 >= 0 ? ref1 : 0];
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_RECONINTER_H_
diff --git a/vp9/common/vp9_reconintra.h b/vp9/common/vp9_reconintra.h
index fc916fcf3..800736d30 100644
--- a/vp9/common/vp9_reconintra.h
+++ b/vp9/common/vp9_reconintra.h
@@ -14,9 +14,17 @@
#include "vpx/vpx_integer.h"
#include "vp9/common/vp9_blockd.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_predict_intra_block(const MACROBLOCKD *xd, int block_idx, int bwl_in,
TX_SIZE tx_size, int mode,
const uint8_t *ref, int ref_stride,
uint8_t *dst, int dst_stride,
int aoff, int loff, int plane);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_RECONINTRA_H_
diff --git a/vp9/common/vp9_rtcd_defs.sh b/vp9/common/vp9_rtcd_defs.sh
index caa6947b3..8fd6db8e9 100644
--- a/vp9/common/vp9_rtcd_defs.sh
+++ b/vp9/common/vp9_rtcd_defs.sh
@@ -135,7 +135,7 @@ prototype void vp9_v_predictor_16x16 "uint8_t *dst, ptrdiff_t y_stride, const ui
specialize vp9_v_predictor_16x16 $sse2_x86inc neon
prototype void vp9_tm_predictor_16x16 "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left"
-specialize vp9_tm_predictor_16x16 $sse2_x86inc
+specialize vp9_tm_predictor_16x16 $sse2_x86inc neon
prototype void vp9_dc_predictor_16x16 "uint8_t *dst, ptrdiff_t y_stride, const uint8_t *above, const uint8_t *left"
specialize vp9_dc_predictor_16x16 $sse2_x86inc dspr2
diff --git a/vp9/common/vp9_scale.h b/vp9/common/vp9_scale.h
index 55b4d8888..90b0d0bf9 100644
--- a/vp9/common/vp9_scale.h
+++ b/vp9/common/vp9_scale.h
@@ -14,6 +14,10 @@
#include "vp9/common/vp9_mv.h"
#include "vp9/common/vp9_convolve.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define REF_SCALE_SHIFT 14
#define REF_NO_SCALE (1 << REF_SCALE_SHIFT)
#define REF_INVALID_SCALE -1
@@ -46,4 +50,8 @@ static int vp9_is_scaled(const struct scale_factors *sf) {
sf->y_scale_fp != REF_NO_SCALE;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_SCALE_H_
diff --git a/vp9/common/vp9_scan.h b/vp9/common/vp9_scan.h
index efab48bfc..9613b675c 100644
--- a/vp9/common/vp9_scan.h
+++ b/vp9/common/vp9_scan.h
@@ -17,6 +17,10 @@
#include "vp9/common/vp9_enums.h"
#include "vp9/common/vp9_blockd.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MAX_NEIGHBORS 2
void vp9_init_neighbors();
@@ -36,4 +40,8 @@ static INLINE int get_coef_context(const int16_t *neighbors,
token_cache[neighbors[MAX_NEIGHBORS * c + 1]]) >> 1;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_SCAN_H_
diff --git a/vp9/common/vp9_seg_common.h b/vp9/common/vp9_seg_common.h
index 8ff54fb73..ff2d66a36 100644
--- a/vp9/common/vp9_seg_common.h
+++ b/vp9/common/vp9_seg_common.h
@@ -13,6 +13,10 @@
#include "vp9/common/vp9_prob.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define SEGMENT_DELTADATA 0
#define SEGMENT_ABSDATA 1
@@ -70,5 +74,9 @@ int vp9_get_segdata(const struct segmentation *seg,
extern const vp9_tree_index vp9_segment_tree[TREE_SIZE(MAX_SEGMENTS)];
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_SEG_COMMON_H_
diff --git a/vp9/common/vp9_systemdependent.h b/vp9/common/vp9_systemdependent.h
index 6f955ab56..ee9a4823b 100644
--- a/vp9/common/vp9_systemdependent.h
+++ b/vp9/common/vp9_systemdependent.h
@@ -11,6 +11,10 @@
#ifndef VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
#define VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef _MSC_VER
#include <math.h>
#define snprintf _snprintf
@@ -72,4 +76,8 @@ static INLINE int get_msb(unsigned int n) {
struct VP9Common;
void vp9_machine_specific_config(struct VP9Common *cm);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
diff --git a/vp9/common/vp9_textblit.h b/vp9/common/vp9_textblit.h
index c968628fe..158ec1b37 100644
--- a/vp9/common/vp9_textblit.h
+++ b/vp9/common/vp9_textblit.h
@@ -11,9 +11,17 @@
#ifndef VP9_COMMON_VP9_TEXTBLIT_H_
#define VP9_COMMON_VP9_TEXTBLIT_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_blit_text(const char *msg, unsigned char *address, int pitch);
void vp9_blit_line(int x0, int x1, int y0, int y1, unsigned char *image,
int pitch);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_TEXTBLIT_H_
diff --git a/vp9/common/vp9_tile_common.h b/vp9/common/vp9_tile_common.h
index a09876e4b..a97719e29 100644
--- a/vp9/common/vp9_tile_common.h
+++ b/vp9/common/vp9_tile_common.h
@@ -11,6 +11,10 @@
#ifndef VP9_COMMON_VP9_TILE_COMMON_H_
#define VP9_COMMON_VP9_TILE_COMMON_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct VP9Common;
typedef struct TileInfo {
@@ -26,4 +30,8 @@ void vp9_tile_init(TileInfo *tile, const struct VP9Common *cm,
void vp9_get_tile_n_bits(int mi_cols,
int *min_log2_tile_cols, int *max_log2_tile_cols);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_VP9_TILE_COMMON_H_
diff --git a/vp9/common/x86/vp9_postproc_x86.h b/vp9/common/x86/vp9_postproc_x86.h
index 8870215a2..cab9d34f2 100644
--- a/vp9/common/x86/vp9_postproc_x86.h
+++ b/vp9/common/x86/vp9_postproc_x86.h
@@ -12,6 +12,10 @@
#ifndef VP9_COMMON_X86_VP9_POSTPROC_X86_H_
#define VP9_COMMON_X86_VP9_POSTPROC_X86_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Note:
*
* This platform is commonly built for runtime CPU detection. If you modify
@@ -61,4 +65,8 @@ extern prototype_postproc_addnoise(vp9_plane_add_noise_wmt);
#endif
#endif
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_COMMON_X86_VP9_POSTPROC_X86_H_
diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c
index d66ee2730..fa680d983 100644
--- a/vp9/decoder/vp9_decodeframe.c
+++ b/vp9/decoder/vp9_decodeframe.c
@@ -743,7 +743,7 @@ static void setup_frame_size_with_refs(VP9D_COMP *pbi,
if (!found)
read_frame_size(rb, &width, &height);
- if (!width || !height)
+ if (width <= 0 || height <= 0)
vpx_internal_error(&cm->error, VPX_CODEC_CORRUPT_FRAME,
"Referenced frame with invalid size");
diff --git a/vp9/decoder/vp9_decodeframe.h b/vp9/decoder/vp9_decodeframe.h
index 7245a9845..4537bc824 100644
--- a/vp9/decoder/vp9_decodeframe.h
+++ b/vp9/decoder/vp9_decodeframe.h
@@ -12,10 +12,18 @@
#ifndef VP9_DECODER_VP9_DECODEFRAME_H_
#define VP9_DECODER_VP9_DECODEFRAME_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct VP9Common;
struct VP9Decompressor;
void vp9_init_dequantizer(struct VP9Common *cm);
int vp9_decode_frame(struct VP9Decompressor *cpi, const uint8_t **p_data_end);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_DECODER_VP9_DECODEFRAME_H_
diff --git a/vp9/decoder/vp9_decodemv.h b/vp9/decoder/vp9_decodemv.h
index 95272bfb3..539c9840e 100644
--- a/vp9/decoder/vp9_decodemv.h
+++ b/vp9/decoder/vp9_decodemv.h
@@ -14,10 +14,18 @@
#include "vp9/decoder/vp9_onyxd_int.h"
#include "vp9/decoder/vp9_reader.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct TileInfo;
void vp9_read_mode_info(VP9_COMMON *cm, MACROBLOCKD *xd,
const struct TileInfo *const tile,
int mi_row, int mi_col, vp9_reader *r);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_DECODER_VP9_DECODEMV_H_
diff --git a/vp9/decoder/vp9_detokenize.h b/vp9/decoder/vp9_detokenize.h
index 1780a0fb5..ce3d7653d 100644
--- a/vp9/decoder/vp9_detokenize.h
+++ b/vp9/decoder/vp9_detokenize.h
@@ -15,8 +15,16 @@
#include "vp9/decoder/vp9_onyxd_int.h"
#include "vp9/decoder/vp9_reader.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int vp9_decode_block_tokens(VP9_COMMON *cm, MACROBLOCKD *xd,
int plane, int block, BLOCK_SIZE plane_bsize,
int x, int y, TX_SIZE tx_size, vp9_reader *r);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_DECODER_VP9_DETOKENIZE_H_
diff --git a/vp9/decoder/vp9_dsubexp.h b/vp9/decoder/vp9_dsubexp.h
index 137f546b8..436f434fb 100644
--- a/vp9/decoder/vp9_dsubexp.h
+++ b/vp9/decoder/vp9_dsubexp.h
@@ -14,6 +14,14 @@
#include "vp9/decoder/vp9_reader.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_diff_update_prob(vp9_reader *r, vp9_prob* p);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_DECODER_VP9_DSUBEXP_H_
diff --git a/vp9/decoder/vp9_onyxd.h b/vp9/decoder/vp9_onyxd.h
index a4b9c24fc..0fc9d578b 100644
--- a/vp9/decoder/vp9_onyxd.h
+++ b/vp9/decoder/vp9_onyxd.h
@@ -11,14 +11,14 @@
#ifndef VP9_DECODER_VP9_ONYXD_H_
#define VP9_DECODER_VP9_ONYXD_H_
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include "vpx_scale/yv12config.h"
#include "vp9/common/vp9_ppflags.h"
#include "vpx/vpx_codec.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef void *VP9D_PTR;
typedef struct {
@@ -63,7 +63,7 @@ VP9D_PTR vp9_create_decompressor(VP9D_CONFIG *oxcf);
void vp9_remove_decompressor(VP9D_PTR comp);
#ifdef __cplusplus
-}
+} // extern "C"
#endif
#endif // VP9_DECODER_VP9_ONYXD_H_
diff --git a/vp9/decoder/vp9_onyxd_int.h b/vp9/decoder/vp9_onyxd_int.h
index e90f8923c..242c600cc 100644
--- a/vp9/decoder/vp9_onyxd_int.h
+++ b/vp9/decoder/vp9_onyxd_int.h
@@ -17,6 +17,10 @@
#include "vp9/decoder/vp9_onyxd.h"
#include "vp9/decoder/vp9_thread.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct VP9Decompressor {
DECLARE_ALIGNED(16, MACROBLOCKD, mb);
@@ -53,4 +57,8 @@ typedef struct VP9Decompressor {
PARTITION_CONTEXT *above_seg_context;
} VP9D_COMP;
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_DECODER_VP9_ONYXD_INT_H_
diff --git a/vp9/decoder/vp9_read_bit_buffer.h b/vp9/decoder/vp9_read_bit_buffer.h
index 41a686837..619e39f1e 100644
--- a/vp9/decoder/vp9_read_bit_buffer.h
+++ b/vp9/decoder/vp9_read_bit_buffer.h
@@ -15,6 +15,10 @@
#include "vpx/vpx_integer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef void (*vp9_rb_error_handler)(void *data, size_t bit_offset);
struct vp9_read_bit_buffer {
@@ -57,4 +61,8 @@ static int vp9_rb_read_signed_literal(struct vp9_read_bit_buffer *rb,
return vp9_rb_read_bit(rb) ? -value : value;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_DECODER_VP9_READ_BIT_BUFFER_H_
diff --git a/vp9/decoder/vp9_reader.h b/vp9/decoder/vp9_reader.h
index 38cf0f621..8fe6acbc2 100644
--- a/vp9/decoder/vp9_reader.h
+++ b/vp9/decoder/vp9_reader.h
@@ -20,6 +20,10 @@
#include "vp9/common/vp9_prob.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef size_t BD_VALUE;
#define BD_VALUE_SIZE ((int)sizeof(BD_VALUE) * CHAR_BIT)
@@ -100,4 +104,8 @@ static int vp9_read_tree(vp9_reader *r, const vp9_tree_index *tree,
return -i;
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_DECODER_VP9_READER_H_
diff --git a/vp9/decoder/vp9_thread.h b/vp9/decoder/vp9_thread.h
index a624f3c2a..bc69cfa1f 100644
--- a/vp9/decoder/vp9_thread.h
+++ b/vp9/decoder/vp9_thread.h
@@ -19,7 +19,7 @@
#include "./vpx_config.h"
-#if defined(__cplusplus) || defined(c_plusplus)
+#ifdef __cplusplus
extern "C" {
#endif
@@ -91,7 +91,7 @@ void vp9_worker_end(VP9Worker* const worker);
//------------------------------------------------------------------------------
-#if defined(__cplusplus) || defined(c_plusplus)
+#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/vp9/encoder/vp9_bitstream.h b/vp9/encoder/vp9_bitstream.h
index 52be50272..94bec8a43 100644
--- a/vp9/encoder/vp9_bitstream.h
+++ b/vp9/encoder/vp9_bitstream.h
@@ -12,6 +12,14 @@
#ifndef VP9_ENCODER_VP9_BITSTREAM_H_
#define VP9_ENCODER_VP9_BITSTREAM_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_update_skip_probs(VP9_COMMON *cm, vp9_writer *bc);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_BITSTREAM_H_
diff --git a/vp9/encoder/vp9_block.h b/vp9/encoder/vp9_block.h
index c1b95817f..29e68b1d7 100644
--- a/vp9/encoder/vp9_block.h
+++ b/vp9/encoder/vp9_block.h
@@ -17,6 +17,10 @@
#include "vpx_ports/mem.h"
#include "vp9/common/vp9_onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// motion search site
typedef struct {
MV mv;
@@ -254,4 +258,8 @@ struct rdcost_block_args {
const int16_t *scan, *nb;
};
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_BLOCK_H_
diff --git a/vp9/encoder/vp9_dct.h b/vp9/encoder/vp9_dct.h
index aaf976d93..cf5f001a9 100644
--- a/vp9/encoder/vp9_dct.h
+++ b/vp9/encoder/vp9_dct.h
@@ -12,6 +12,10 @@
#ifndef VP9_ENCODER_VP9_DCT_H_
#define VP9_ENCODER_VP9_DCT_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_fht4x4(TX_TYPE tx_type, const int16_t *input, int16_t *output,
int stride);
@@ -21,4 +25,8 @@ void vp9_fht8x8(TX_TYPE tx_type, const int16_t *input, int16_t *output,
void vp9_fht16x16(TX_TYPE tx_type, const int16_t *input, int16_t *output,
int stride);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_DCT_H_
diff --git a/vp9/encoder/vp9_encodeframe.h b/vp9/encoder/vp9_encodeframe.h
index 3e9f5381c..f7d17c301 100644
--- a/vp9/encoder/vp9_encodeframe.h
+++ b/vp9/encoder/vp9_encodeframe.h
@@ -12,6 +12,10 @@
#ifndef VP9_ENCODER_VP9_ENCODEFRAME_H_
#define VP9_ENCODER_VP9_ENCODEFRAME_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct macroblock;
struct yv12_buffer_config;
@@ -19,4 +23,8 @@ void vp9_setup_src_planes(struct macroblock *x,
const struct yv12_buffer_config *src,
int mi_row, int mi_col);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_ENCODEFRAME_H_
diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c
index 4bef67501..528f250a6 100644
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -31,11 +31,11 @@ void vp9_setup_interp_filters(MACROBLOCKD *xd,
if (xd->mi_8x8 && xd->mi_8x8[0]) {
MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi;
- set_scale_factors(cm, xd, mbmi->ref_frame[0] - LAST_FRAME,
- mbmi->ref_frame[1] - LAST_FRAME);
+ set_ref_ptrs(cm, xd, mbmi->ref_frame[0] - LAST_FRAME,
+ mbmi->ref_frame[1] - LAST_FRAME);
} else {
- set_scale_factors(cm, xd, -1, -1);
+ set_ref_ptrs(cm, xd, -1, -1);
}
xd->subpix.filter_x = xd->subpix.filter_y =
diff --git a/vp9/encoder/vp9_encodemb.h b/vp9/encoder/vp9_encodemb.h
index 207d573a5..6a06f0ae4 100644
--- a/vp9/encoder/vp9_encodemb.h
+++ b/vp9/encoder/vp9_encodemb.h
@@ -16,6 +16,10 @@
#include "vp9/encoder/vp9_onyx_int.h"
#include "vp9/common/vp9_onyxc_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct optimize_ctx {
ENTROPY_CONTEXT ta[MAX_MB_PLANE][16];
ENTROPY_CONTEXT tl[MAX_MB_PLANE][16];
@@ -47,4 +51,8 @@ int vp9_encode_intra(MACROBLOCK *x, int use_16x16_pred);
void vp9_setup_interp_filters(MACROBLOCKD *xd,
INTERPOLATION_TYPE mcomp_filter_type,
VP9_COMMON *cm);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_ENCODEMB_H_
diff --git a/vp9/encoder/vp9_encodemv.h b/vp9/encoder/vp9_encodemv.h
index 761278fd1..c57b01db4 100644
--- a/vp9/encoder/vp9_encodemv.h
+++ b/vp9/encoder/vp9_encodemv.h
@@ -14,6 +14,10 @@
#include "vp9/encoder/vp9_onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_entropy_mv_init();
void vp9_write_nmv_probs(VP9_COMMON *cm, int usehp, vp9_writer* const);
@@ -30,4 +34,8 @@ void vp9_build_nmv_cost_table(int *mvjoint,
void vp9_update_mv_count(VP9_COMP *cpi, MACROBLOCK *x, int_mv best_ref_mv[2]);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_ENCODEMV_H_
diff --git a/vp9/encoder/vp9_extend.h b/vp9/encoder/vp9_extend.h
index 9b95ee437..058fe09cf 100644
--- a/vp9/encoder/vp9_extend.h
+++ b/vp9/encoder/vp9_extend.h
@@ -14,6 +14,10 @@
#include "vpx_scale/yv12config.h"
#include "vpx/vpx_integer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_copy_and_extend_frame(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst);
@@ -22,4 +26,8 @@ void vp9_copy_and_extend_frame_with_rect(const YV12_BUFFER_CONFIG *src,
YV12_BUFFER_CONFIG *dst,
int srcy, int srcx,
int srch, int srcw);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_EXTEND_H_
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index 572f8c653..812c13148 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -55,8 +55,6 @@ static void swap_yv12(YV12_BUFFER_CONFIG *a, YV12_BUFFER_CONFIG *b) {
*b = temp;
}
-static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame);
-
static int select_cq_level(int qindex) {
int ret_val = QINDEX_RANGE - 1;
int i;
@@ -924,7 +922,7 @@ static int estimate_max_q(VP9_COMP *cpi,
FIRSTPASS_STATS *fpstats,
int section_target_bandwitdh) {
int q;
- int num_mbs = cpi->common.MBs;
+ const int num_mbs = cpi->common.MBs;
int target_norm_bits_per_mb;
RATE_CONTROL *const rc = &cpi->rc;
@@ -950,9 +948,8 @@ static int estimate_max_q(VP9_COMP *cpi,
}
// Restriction on active max q for constrained quality mode.
- if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY &&
- q < cpi->cq_target_quality)
- q = cpi->cq_target_quality;
+ if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY)
+ q = MAX(q, cpi->cq_target_quality);
return q;
}
@@ -1015,6 +1012,7 @@ void vp9_init_second_pass(VP9_COMP *cpi) {
FIRSTPASS_STATS this_frame;
FIRSTPASS_STATS *start_pos;
struct twopass_rc *const twopass = &cpi->twopass;
+ const VP9_CONFIG *const oxcf = &cpi->oxcf;
zero_stats(&twopass->total_stats);
zero_stats(&twopass->total_left_stats);
@@ -1033,9 +1031,9 @@ void vp9_init_second_pass(VP9_COMP *cpi) {
vp9_new_framerate(cpi, 10000000.0 * twopass->total_stats.count /
twopass->total_stats.duration);
- cpi->output_framerate = cpi->oxcf.framerate;
+ cpi->output_framerate = oxcf->framerate;
twopass->bits_left = (int64_t)(twopass->total_stats.duration *
- cpi->oxcf.target_bandwidth / 10000000.0);
+ oxcf->target_bandwidth / 10000000.0);
// Calculate a minimum intra value to be used in determining the IIratio
// scores used in the second pass. We have this minimum to make sure
@@ -1051,15 +1049,12 @@ void vp9_init_second_pass(VP9_COMP *cpi) {
// ratio for the sequence.
{
double sum_iiratio = 0.0;
- double IIRatio;
-
start_pos = twopass->stats_in; // Note the starting "file" position.
while (input_stats(twopass, &this_frame) != EOF) {
- IIRatio = this_frame.intra_error
- / DOUBLE_DIVIDE_CHECK(this_frame.coded_error);
- IIRatio = (IIRatio < 1.0) ? 1.0 : (IIRatio > 20.0) ? 20.0 : IIRatio;
- sum_iiratio += IIRatio;
+ const double iiratio = this_frame.intra_error /
+ DOUBLE_DIVIDE_CHECK(this_frame.coded_error);
+ sum_iiratio += fclamp(iiratio, 1.0, 20.0);
}
twopass->avg_iiratio = sum_iiratio /
@@ -1079,9 +1074,9 @@ void vp9_init_second_pass(VP9_COMP *cpi) {
twopass->modified_error_total = 0.0;
twopass->modified_error_min =
- (av_error * cpi->oxcf.two_pass_vbrmin_section) / 100;
+ (av_error * oxcf->two_pass_vbrmin_section) / 100;
twopass->modified_error_max =
- (av_error * cpi->oxcf.two_pass_vbrmax_section) / 100;
+ (av_error * oxcf->two_pass_vbrmax_section) / 100;
while (input_stats(twopass, &this_frame) != EOF) {
twopass->modified_error_total +=
@@ -1185,9 +1180,6 @@ static void accumulate_frame_motion_stats(
double *mv_in_out_accumulator,
double *abs_mv_in_out_accumulator,
double *mv_ratio_accumulator) {
- // double this_frame_mv_in_out;
- double this_frame_mvr_ratio;
- double this_frame_mvc_ratio;
double motion_pct;
// Accumulate motion stats.
@@ -1202,29 +1194,25 @@ static void accumulate_frame_motion_stats(
// Accumulate a measure of how uniform (or conversely how random)
// the motion field is. (A ratio of absmv / mv)
if (motion_pct > 0.05) {
- this_frame_mvr_ratio = fabs(this_frame->mvr_abs) /
+ double this_frame_mvr_ratio = fabs(this_frame->mvr_abs) /
DOUBLE_DIVIDE_CHECK(fabs(this_frame->MVr));
- this_frame_mvc_ratio = fabs(this_frame->mvc_abs) /
+ double this_frame_mvc_ratio = fabs(this_frame->mvc_abs) /
DOUBLE_DIVIDE_CHECK(fabs(this_frame->MVc));
- *mv_ratio_accumulator +=
- (this_frame_mvr_ratio < this_frame->mvr_abs)
+ *mv_ratio_accumulator += (this_frame_mvr_ratio < this_frame->mvr_abs)
? (this_frame_mvr_ratio * motion_pct)
: this_frame->mvr_abs * motion_pct;
- *mv_ratio_accumulator +=
- (this_frame_mvc_ratio < this_frame->mvc_abs)
+ *mv_ratio_accumulator += (this_frame_mvc_ratio < this_frame->mvc_abs)
? (this_frame_mvc_ratio * motion_pct)
: this_frame->mvc_abs * motion_pct;
}
}
// Calculate a baseline boost number for the current frame.
-static double calc_frame_boost(
- VP9_COMP *cpi,
- FIRSTPASS_STATS *this_frame,
- double this_frame_mv_in_out) {
+static double calc_frame_boost(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame,
+ double this_frame_mv_in_out) {
double frame_boost;
// Underlying boost factor is based on inter intra error ratio
@@ -1245,11 +1233,7 @@ static double calc_frame_boost(
else
frame_boost += frame_boost * (this_frame_mv_in_out / 2.0);
- // Clip to maximum
- if (frame_boost > GF_RMAX)
- frame_boost = GF_RMAX;
-
- return frame_boost;
+ return MIN(frame_boost, GF_RMAX);
}
static int calc_arf_boost(VP9_COMP *cpi, int offset,
@@ -1924,186 +1908,6 @@ static int test_for_kf_one_pass(VP9_COMP *cpi) {
return 0;
}
-void vp9_get_svc_params(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- if ((cm->current_video_frame == 0) ||
- (cm->frame_flags & FRAMEFLAGS_KEY) ||
- (cpi->oxcf.auto_key && (cpi->rc.frames_since_key %
- cpi->key_frame_frequency == 0))) {
- cm->frame_type = KEY_FRAME;
- } else {
- cm->frame_type = INTER_FRAME;
- }
- cpi->rc.frames_till_gf_update_due = INT_MAX;
- cpi->rc.baseline_gf_interval = INT_MAX;
-}
-
-void vp9_get_one_pass_params(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- if (!cpi->refresh_alt_ref_frame &&
- (cm->current_video_frame == 0 ||
- cm->frame_flags & FRAMEFLAGS_KEY ||
- cpi->rc.frames_to_key == 0 ||
- (cpi->oxcf.auto_key && test_for_kf_one_pass(cpi)))) {
- cm->frame_type = KEY_FRAME;
- cpi->rc.this_key_frame_forced = cm->current_video_frame != 0 &&
- cpi->rc.frames_to_key == 0;
- cpi->rc.frames_to_key = cpi->key_frame_frequency;
- cpi->rc.kf_boost = 300;
- } else {
- cm->frame_type = INTER_FRAME;
- }
- if (cpi->rc.frames_till_gf_update_due == 0) {
- cpi->rc.frames_till_gf_update_due = cpi->rc.baseline_gf_interval;
- cpi->refresh_golden_frame = 1;
- }
-}
-
-void vp9_get_one_pass_cbr_params(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- if ((cm->current_video_frame == 0 ||
- cm->frame_flags & FRAMEFLAGS_KEY ||
- cpi->rc.frames_to_key == 0 ||
- (cpi->oxcf.auto_key && test_for_kf_one_pass(cpi)))) {
- cm->frame_type = KEY_FRAME;
- cpi->rc.this_key_frame_forced = cm->current_video_frame != 0 &&
- cpi->rc.frames_to_key == 0;
- cpi->rc.frames_to_key = cpi->key_frame_frequency;
- cpi->rc.kf_boost = 300;
- } else {
- cm->frame_type = INTER_FRAME;
- }
- // Don't use gf_update by default in CBR mode.
- cpi->rc.frames_till_gf_update_due = INT_MAX;
- cpi->rc.baseline_gf_interval = INT_MAX;
-}
-
-void vp9_get_first_pass_params(VP9_COMP *cpi) {
- VP9_COMMON *const cm = &cpi->common;
- if (!cpi->refresh_alt_ref_frame &&
- (cm->current_video_frame == 0 ||
- cm->frame_flags & FRAMEFLAGS_KEY)) {
- cm->frame_type = KEY_FRAME;
- } else {
- cm->frame_type = INTER_FRAME;
- }
- // Do not use periodic key frames
- cpi->rc.frames_to_key = INT_MAX;
-}
-
-void vp9_get_second_pass_params(VP9_COMP *cpi) {
- int tmp_q;
- int frames_left = (int)(cpi->twopass.total_stats.count -
- cpi->common.current_video_frame);
-
- FIRSTPASS_STATS this_frame;
- FIRSTPASS_STATS this_frame_copy;
- RATE_CONTROL *rc = &cpi->rc;
-
- double this_frame_intra_error;
- double this_frame_coded_error;
-
- if (cpi->refresh_alt_ref_frame) {
- cpi->common.frame_type = INTER_FRAME;
- return;
- }
- if (!cpi->twopass.stats_in)
- return;
-
- vp9_clear_system_state();
-
- if (cpi->oxcf.end_usage == USAGE_CONSTANT_QUALITY) {
- rc->active_worst_quality = cpi->oxcf.cq_level;
- } else if (cpi->common.current_video_frame == 0) {
- // Special case code for first frame.
- int section_target_bandwidth =
- (int)(cpi->twopass.bits_left / frames_left);
-
- tmp_q = estimate_max_q(cpi, &cpi->twopass.total_left_stats,
- section_target_bandwidth);
-
- rc->active_worst_quality = tmp_q;
- rc->ni_av_qi = tmp_q;
- rc->avg_q = vp9_convert_qindex_to_q(tmp_q);
-
- // Limit the maxq value returned subsequently.
- // This increases the risk of overspend or underspend if the initial
- // estimate for the clip is bad, but helps prevent excessive
- // variation in Q, especially near the end of a clip
- // where for example a small overspend may cause Q to crash
- // adjust_maxq_qrange(cpi);
- }
- vp9_zero(this_frame);
- if (EOF == input_stats(&cpi->twopass, &this_frame))
- return;
-
- this_frame_intra_error = this_frame.intra_error;
- this_frame_coded_error = this_frame.coded_error;
-
- // keyframe and section processing !
- if (rc->frames_to_key == 0 ||
- (cpi->common.frame_flags & FRAMEFLAGS_KEY)) {
- // Define next KF group and assign bits to it
- this_frame_copy = this_frame;
- find_next_key_frame(cpi, &this_frame_copy);
- } else {
- cpi->common.frame_type = INTER_FRAME;
- }
-
- // Is this a GF / ARF (Note that a KF is always also a GF)
- if (rc->frames_till_gf_update_due == 0) {
- // Define next gf group and assign bits to it
- this_frame_copy = this_frame;
-
-#if CONFIG_MULTIPLE_ARF
- if (cpi->multi_arf_enabled) {
- define_fixed_arf_period(cpi);
- } else {
-#endif
- define_gf_group(cpi, &this_frame_copy);
-#if CONFIG_MULTIPLE_ARF
- }
-#endif
-
- if (cpi->twopass.gf_zeromotion_pct > 995) {
- // As long as max_thresh for encode breakout is small enough, it is ok
- // to enable it for no-show frame, i.e. set enable_encode_breakout to 2.
- if (!cpi->common.show_frame)
- cpi->enable_encode_breakout = 0;
- else
- cpi->enable_encode_breakout = 2;
- }
-
- rc->frames_till_gf_update_due = rc->baseline_gf_interval;
- cpi->refresh_golden_frame = 1;
- } else {
- // Otherwise this is an ordinary frame
- // Assign bits from those allocated to the GF group
- this_frame_copy = this_frame;
- assign_std_frame_bits(cpi, &this_frame_copy);
- }
-
- // Keep a globally available copy of this and the next frame's iiratio.
- cpi->twopass.this_iiratio = (int)(this_frame_intra_error /
- DOUBLE_DIVIDE_CHECK(this_frame_coded_error));
- {
- FIRSTPASS_STATS next_frame;
- if (lookup_next_frame_stats(&cpi->twopass, &next_frame) != EOF) {
- cpi->twopass.next_iiratio = (int)(next_frame.intra_error /
- DOUBLE_DIVIDE_CHECK(next_frame.coded_error));
- }
- }
-
- // Set nominal per second bandwidth for this frame
- cpi->target_bandwidth = (int)(rc->per_frame_bandwidth *
- cpi->output_framerate);
- if (cpi->target_bandwidth < 0)
- cpi->target_bandwidth = 0;
-
- // Update the total stats remaining structure
- subtract_stats(&cpi->twopass.total_left_stats, &this_frame);
-}
-
static int test_candidate_kf(VP9_COMP *cpi,
FIRSTPASS_STATS *last_frame,
FIRSTPASS_STATS *this_frame,
@@ -2134,7 +1938,6 @@ static int test_candidate_kf(VP9_COMP *cpi,
double boost_score = 0.0;
double old_boost_score = 0.0;
double decay_accumulator = 1.0;
- double next_iiratio;
local_next_frame = *next_frame;
@@ -2143,8 +1946,8 @@ static int test_candidate_kf(VP9_COMP *cpi,
// Examine how well the key frame predicts subsequent frames
for (i = 0; i < 16; i++) {
- next_iiratio = (IIKFACTOR1 * local_next_frame.intra_error /
- DOUBLE_DIVIDE_CHECK(local_next_frame.coded_error));
+ double next_iiratio = (IIKFACTOR1 * local_next_frame.intra_error /
+ DOUBLE_DIVIDE_CHECK(local_next_frame.coded_error));
if (next_iiratio > RMAX)
next_iiratio = RMAX;
@@ -2402,7 +2205,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
// How fast is prediction quality decaying
if (!detect_flash(cpi, 0)) {
loop_decay_rate = get_prediction_decay_rate(cpi, &next_frame);
- decay_accumulator = decay_accumulator * loop_decay_rate;
+ decay_accumulator *= loop_decay_rate;
decay_accumulator = decay_accumulator < MIN_DECAY_FACTOR
? MIN_DECAY_FACTOR : decay_accumulator;
}
@@ -2523,6 +2326,186 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
twopass->modified_error_left -= kf_group_err;
}
+void vp9_get_svc_params(VP9_COMP *cpi) {
+ VP9_COMMON *const cm = &cpi->common;
+ if ((cm->current_video_frame == 0) ||
+ (cm->frame_flags & FRAMEFLAGS_KEY) ||
+ (cpi->oxcf.auto_key && (cpi->rc.frames_since_key %
+ cpi->key_frame_frequency == 0))) {
+ cm->frame_type = KEY_FRAME;
+ } else {
+ cm->frame_type = INTER_FRAME;
+ }
+ cpi->rc.frames_till_gf_update_due = INT_MAX;
+ cpi->rc.baseline_gf_interval = INT_MAX;
+}
+
+void vp9_get_one_pass_params(VP9_COMP *cpi) {
+ VP9_COMMON *const cm = &cpi->common;
+ if (!cpi->refresh_alt_ref_frame &&
+ (cm->current_video_frame == 0 ||
+ cm->frame_flags & FRAMEFLAGS_KEY ||
+ cpi->rc.frames_to_key == 0 ||
+ (cpi->oxcf.auto_key && test_for_kf_one_pass(cpi)))) {
+ cm->frame_type = KEY_FRAME;
+ cpi->rc.this_key_frame_forced = cm->current_video_frame != 0 &&
+ cpi->rc.frames_to_key == 0;
+ cpi->rc.frames_to_key = cpi->key_frame_frequency;
+ cpi->rc.kf_boost = 300;
+ } else {
+ cm->frame_type = INTER_FRAME;
+ }
+ if (cpi->rc.frames_till_gf_update_due == 0) {
+ cpi->rc.frames_till_gf_update_due = cpi->rc.baseline_gf_interval;
+ cpi->refresh_golden_frame = 1;
+ }
+}
+
+void vp9_get_one_pass_cbr_params(VP9_COMP *cpi) {
+ VP9_COMMON *const cm = &cpi->common;
+ if ((cm->current_video_frame == 0 ||
+ cm->frame_flags & FRAMEFLAGS_KEY ||
+ cpi->rc.frames_to_key == 0 ||
+ (cpi->oxcf.auto_key && test_for_kf_one_pass(cpi)))) {
+ cm->frame_type = KEY_FRAME;
+ cpi->rc.this_key_frame_forced = cm->current_video_frame != 0 &&
+ cpi->rc.frames_to_key == 0;
+ cpi->rc.frames_to_key = cpi->key_frame_frequency;
+ cpi->rc.kf_boost = 300;
+ } else {
+ cm->frame_type = INTER_FRAME;
+ }
+ // Don't use gf_update by default in CBR mode.
+ cpi->rc.frames_till_gf_update_due = INT_MAX;
+ cpi->rc.baseline_gf_interval = INT_MAX;
+}
+
+void vp9_get_first_pass_params(VP9_COMP *cpi) {
+ VP9_COMMON *const cm = &cpi->common;
+ if (!cpi->refresh_alt_ref_frame &&
+ (cm->current_video_frame == 0 ||
+ cm->frame_flags & FRAMEFLAGS_KEY)) {
+ cm->frame_type = KEY_FRAME;
+ } else {
+ cm->frame_type = INTER_FRAME;
+ }
+ // Do not use periodic key frames
+ cpi->rc.frames_to_key = INT_MAX;
+}
+
+void vp9_get_second_pass_params(VP9_COMP *cpi) {
+ int tmp_q;
+ int frames_left = (int)(cpi->twopass.total_stats.count -
+ cpi->common.current_video_frame);
+
+ FIRSTPASS_STATS this_frame;
+ FIRSTPASS_STATS this_frame_copy;
+ RATE_CONTROL *rc = &cpi->rc;
+
+ double this_frame_intra_error;
+ double this_frame_coded_error;
+
+ if (cpi->refresh_alt_ref_frame) {
+ cpi->common.frame_type = INTER_FRAME;
+ return;
+ }
+ if (!cpi->twopass.stats_in)
+ return;
+
+ vp9_clear_system_state();
+
+ if (cpi->oxcf.end_usage == USAGE_CONSTANT_QUALITY) {
+ rc->active_worst_quality = cpi->oxcf.cq_level;
+ } else if (cpi->common.current_video_frame == 0) {
+ // Special case code for first frame.
+ int section_target_bandwidth =
+ (int)(cpi->twopass.bits_left / frames_left);
+
+ tmp_q = estimate_max_q(cpi, &cpi->twopass.total_left_stats,
+ section_target_bandwidth);
+
+ rc->active_worst_quality = tmp_q;
+ rc->ni_av_qi = tmp_q;
+ rc->avg_q = vp9_convert_qindex_to_q(tmp_q);
+
+ // Limit the maxq value returned subsequently.
+ // This increases the risk of overspend or underspend if the initial
+ // estimate for the clip is bad, but helps prevent excessive
+ // variation in Q, especially near the end of a clip
+ // where for example a small overspend may cause Q to crash
+ // adjust_maxq_qrange(cpi);
+ }
+ vp9_zero(this_frame);
+ if (EOF == input_stats(&cpi->twopass, &this_frame))
+ return;
+
+ this_frame_intra_error = this_frame.intra_error;
+ this_frame_coded_error = this_frame.coded_error;
+
+ // keyframe and section processing !
+ if (rc->frames_to_key == 0 ||
+ (cpi->common.frame_flags & FRAMEFLAGS_KEY)) {
+ // Define next KF group and assign bits to it
+ this_frame_copy = this_frame;
+ find_next_key_frame(cpi, &this_frame_copy);
+ } else {
+ cpi->common.frame_type = INTER_FRAME;
+ }
+
+ // Is this a GF / ARF (Note that a KF is always also a GF)
+ if (rc->frames_till_gf_update_due == 0) {
+ // Define next gf group and assign bits to it
+ this_frame_copy = this_frame;
+
+#if CONFIG_MULTIPLE_ARF
+ if (cpi->multi_arf_enabled) {
+ define_fixed_arf_period(cpi);
+ } else {
+#endif
+ define_gf_group(cpi, &this_frame_copy);
+#if CONFIG_MULTIPLE_ARF
+ }
+#endif
+
+ if (cpi->twopass.gf_zeromotion_pct > 995) {
+ // As long as max_thresh for encode breakout is small enough, it is ok
+ // to enable it for no-show frame, i.e. set enable_encode_breakout to 2.
+ if (!cpi->common.show_frame)
+ cpi->enable_encode_breakout = 0;
+ else
+ cpi->enable_encode_breakout = 2;
+ }
+
+ rc->frames_till_gf_update_due = rc->baseline_gf_interval;
+ cpi->refresh_golden_frame = 1;
+ } else {
+ // Otherwise this is an ordinary frame
+ // Assign bits from those allocated to the GF group
+ this_frame_copy = this_frame;
+ assign_std_frame_bits(cpi, &this_frame_copy);
+ }
+
+ // Keep a globally available copy of this and the next frame's iiratio.
+ cpi->twopass.this_iiratio = (int)(this_frame_intra_error /
+ DOUBLE_DIVIDE_CHECK(this_frame_coded_error));
+ {
+ FIRSTPASS_STATS next_frame;
+ if (lookup_next_frame_stats(&cpi->twopass, &next_frame) != EOF) {
+ cpi->twopass.next_iiratio = (int)(next_frame.intra_error /
+ DOUBLE_DIVIDE_CHECK(next_frame.coded_error));
+ }
+ }
+
+ // Set nominal per second bandwidth for this frame
+ cpi->target_bandwidth = (int)(rc->per_frame_bandwidth *
+ cpi->output_framerate);
+ if (cpi->target_bandwidth < 0)
+ cpi->target_bandwidth = 0;
+
+ // Update the total stats remaining structure
+ subtract_stats(&cpi->twopass.total_left_stats, &this_frame);
+}
+
void vp9_twopass_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
#ifdef DISABLE_RC_LONG_TERM_MEM
cpi->twopass.bits_left -= cpi->rc.this_frame_target;
diff --git a/vp9/encoder/vp9_firstpass.h b/vp9/encoder/vp9_firstpass.h
index f89e4cb1c..ca5b10080 100644
--- a/vp9/encoder/vp9_firstpass.h
+++ b/vp9/encoder/vp9_firstpass.h
@@ -12,6 +12,10 @@
#define VP9_ENCODER_VP9_FIRSTPASS_H_
#include "vp9/encoder/vp9_onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_init_first_pass(VP9_COMP *cpi);
void vp9_first_pass(VP9_COMP *cpi);
void vp9_end_first_pass(VP9_COMP *cpi);
@@ -25,4 +29,8 @@ void vp9_get_one_pass_params(VP9_COMP *cpi);
void vp9_get_one_pass_cbr_params(VP9_COMP *cpi);
void vp9_get_svc_params(VP9_COMP *cpi);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_FIRSTPASS_H_
diff --git a/vp9/encoder/vp9_lookahead.h b/vp9/encoder/vp9_lookahead.h
index c773f8fcc..1c00c462d 100644
--- a/vp9/encoder/vp9_lookahead.h
+++ b/vp9/encoder/vp9_lookahead.h
@@ -14,6 +14,10 @@
#include "vpx_scale/yv12config.h"
#include "vpx/vpx_integer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MAX_LAG_BUFFERS 25
struct lookahead_entry {
@@ -94,4 +98,8 @@ struct lookahead_entry *vp9_lookahead_peek(struct lookahead_ctx *ctx,
*/
unsigned int vp9_lookahead_depth(struct lookahead_ctx *ctx);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_LOOKAHEAD_H_
diff --git a/vp9/encoder/vp9_mbgraph.h b/vp9/encoder/vp9_mbgraph.h
index c5bca4d01..79dd2bc95 100644
--- a/vp9/encoder/vp9_mbgraph.h
+++ b/vp9/encoder/vp9_mbgraph.h
@@ -11,6 +11,14 @@
#ifndef VP9_ENCODER_VP9_MBGRAPH_H_
#define VP9_ENCODER_VP9_MBGRAPH_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_update_mbgraph_stats(VP9_COMP *cpi);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_MBGRAPH_H_
diff --git a/vp9/encoder/vp9_mcomp.h b/vp9/encoder/vp9_mcomp.h
index 74035842f..5cd9fd170 100644
--- a/vp9/encoder/vp9_mcomp.h
+++ b/vp9/encoder/vp9_mcomp.h
@@ -15,6 +15,10 @@
#include "vp9/encoder/vp9_block.h"
#include "vp9/encoder/vp9_variance.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// The maximum number of steps in a step search given the largest
// allowed initial step
#define MAX_MVSEARCH_STEPS 11
@@ -129,4 +133,8 @@ int vp9_refining_search_8p_c(const MACROBLOCK *x,
int *mvjcost, int *mvcost[2],
const MV *center_mv, const uint8_t *second_pred,
int w, int h);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_MCOMP_H_
diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h
index a665bf859..35f8fac69 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -28,6 +28,10 @@
#include "vp9/encoder/vp9_mcomp.h"
#include "vp9/encoder/vp9_lookahead.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define DISABLE_RC_LONG_TERM_MEM 0
// #define MODE_TEST_HIT_STATS
@@ -780,7 +784,8 @@ typedef struct VP9_COMP {
PARTITION_CONTEXT left_seg_context[8];
} VP9_COMP;
-static int get_ref_frame_idx(VP9_COMP *cpi, MV_REFERENCE_FRAME ref_frame) {
+static int get_ref_frame_idx(const VP9_COMP *cpi,
+ MV_REFERENCE_FRAME ref_frame) {
if (ref_frame == LAST_FRAME) {
return cpi->lst_fb_idx;
} else if (ref_frame == GOLDEN_FRAME) {
@@ -790,17 +795,6 @@ static int get_ref_frame_idx(VP9_COMP *cpi, MV_REFERENCE_FRAME ref_frame) {
}
}
-static int get_scale_ref_frame_idx(VP9_COMP *cpi,
- MV_REFERENCE_FRAME ref_frame) {
- if (ref_frame == LAST_FRAME) {
- return 0;
- } else if (ref_frame == GOLDEN_FRAME) {
- return 1;
- } else {
- return 2;
- }
-}
-
static YV12_BUFFER_CONFIG *get_ref_frame_buffer(VP9_COMP *cpi,
MV_REFERENCE_FRAME ref_frame) {
VP9_COMMON *const cm = &cpi->common;
@@ -825,4 +819,8 @@ static int get_token_alloc(int mb_rows, int mb_cols) {
return mb_rows * mb_cols * (48 * 16 + 4);
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_ONYX_INT_H_
diff --git a/vp9/encoder/vp9_picklpf.h b/vp9/encoder/vp9_picklpf.h
index 9de4cf849..f9cb14c27 100644
--- a/vp9/encoder/vp9_picklpf.h
+++ b/vp9/encoder/vp9_picklpf.h
@@ -12,6 +12,10 @@
#ifndef VP9_ENCODER_VP9_PICKLPF_H_
#define VP9_ENCODER_VP9_PICKLPF_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct yv12_buffer_config;
struct VP9_COMP;
@@ -19,4 +23,8 @@ void vp9_set_alt_lf_level(struct VP9_COMP *cpi, int filt_val);
void vp9_pick_filter_level(struct yv12_buffer_config *sd,
struct VP9_COMP *cpi, int partial);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_PICKLPF_H_
diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c
index f317f2a0d..210d15f0d 100644
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -60,8 +60,8 @@ static int full_pixel_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
int buf_offset;
int stride = xd->plane[0].pre[0].stride;
- YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi, ref);
-
+ const YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi,
+ ref);
if (scaled_ref_frame) {
int i;
// Swap out the reference frame for a version that's been scaled to
diff --git a/vp9/encoder/vp9_pickmode.h b/vp9/encoder/vp9_pickmode.h
index 32750fa69..82904ae8a 100644
--- a/vp9/encoder/vp9_pickmode.h
+++ b/vp9/encoder/vp9_pickmode.h
@@ -8,8 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#ifndef VP9_ENCODER_VP9_PICKMODE_H_
+#define VP9_ENCODER_VP9_PICKMODE_H_
+
#include "vp9/encoder/vp9_onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
const struct TileInfo *const tile,
int mi_row, int mi_col,
@@ -17,3 +24,9 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
int64_t *returndistortion,
BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // VP9_ENCODER_VP9_PICKMODE_H_
diff --git a/vp9/encoder/vp9_psnr.h b/vp9/encoder/vp9_psnr.h
index 15dd8366b..ffe00ed2c 100644
--- a/vp9/encoder/vp9_psnr.h
+++ b/vp9/encoder/vp9_psnr.h
@@ -12,6 +12,14 @@
#ifndef VP9_ENCODER_VP9_PSNR_H_
#define VP9_ENCODER_VP9_PSNR_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
double vp9_mse2psnr(double samples, double peak, double mse);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_PSNR_H_
diff --git a/vp9/encoder/vp9_quantize.h b/vp9/encoder/vp9_quantize.h
index 41cfa5283..680cf4aec 100644
--- a/vp9/encoder/vp9_quantize.h
+++ b/vp9/encoder/vp9_quantize.h
@@ -13,6 +13,10 @@
#include "vp9/encoder/vp9_block.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_regular_quantize_b_4x4(MACROBLOCK *x, int plane, int block,
const int16_t *scan, const int16_t *iscan);
@@ -28,4 +32,8 @@ void vp9_mb_init_quantizer(struct VP9_COMP *cpi, MACROBLOCK *x);
void vp9_init_quantizer(struct VP9_COMP *cpi);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_QUANTIZE_H_
diff --git a/vp9/encoder/vp9_ratectrl.h b/vp9/encoder/vp9_ratectrl.h
index 086755af8..65ddead11 100644
--- a/vp9/encoder/vp9_ratectrl.h
+++ b/vp9/encoder/vp9_ratectrl.h
@@ -14,6 +14,10 @@
#include "vp9/encoder/vp9_onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define FRAME_OVERHEAD_BITS 200
void vp9_save_coding_context(VP9_COMP *cpi);
@@ -69,4 +73,8 @@ int vp9_drop_frame(VP9_COMP *cpi);
// Update the buffer level.
void vp9_update_buffer_level(VP9_COMP *cpi, int encoded_frame_size);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_RATECTRL_H_
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 242aa8710..5f2f8a819 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2304,13 +2304,12 @@ void vp9_setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
ref_frame, block_size);
}
-YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(VP9_COMP *cpi, int ref_frame) {
- YV12_BUFFER_CONFIG *scaled_ref_frame = NULL;
- int fb = get_ref_frame_idx(cpi, ref_frame);
- int fb_scale = get_scale_ref_frame_idx(cpi, ref_frame);
- if (cpi->scaled_ref_idx[fb_scale] != cpi->common.ref_frame_map[fb])
- scaled_ref_frame = &cpi->common.yv12_fb[cpi->scaled_ref_idx[fb_scale]];
- return scaled_ref_frame;
+const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi,
+ int ref_frame) {
+ const VP9_COMMON *const cm = &cpi->common;
+ const int ref_idx = cm->ref_frame_map[get_ref_frame_idx(cpi, ref_frame)];
+ const int scaled_idx = cpi->scaled_ref_idx[ref_frame - 1];
+ return (scaled_idx != ref_idx) ? &cm->yv12_fb[scaled_idx] : NULL;
}
static INLINE int get_switchable_rate(const MACROBLOCK *x) {
@@ -2342,7 +2341,8 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
int tmp_row_min = x->mv_row_min;
int tmp_row_max = x->mv_row_max;
- YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi, ref);
+ const YV12_BUFFER_CONFIG *scaled_ref_frame = vp9_get_scaled_ref_frame(cpi,
+ ref);
int_mv pred_mv[3];
pred_mv[0] = mbmi->ref_mvs[ref][0];
@@ -2489,7 +2489,7 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
struct buf_2d backup_yv12[2][MAX_MB_PLANE];
struct buf_2d scaled_first_yv12 = xd->plane[0].pre[0];
int last_besterr[2] = {INT_MAX, INT_MAX};
- YV12_BUFFER_CONFIG *const scaled_ref_frame[2] = {
+ const YV12_BUFFER_CONFIG *const scaled_ref_frame[2] = {
vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[0]),
vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[1])
};
@@ -3277,7 +3277,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
continue;
}
- set_scale_factors(cm, xd, ref_frame - 1, second_ref_frame - 1);
+ set_ref_ptrs(cm, xd, ref_frame - 1, second_ref_frame - 1);
mbmi->uv_mode = DC_PRED;
// Evaluate all sub-pel filters irrespective of whether we can use
@@ -3709,7 +3709,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
vp9_zero(best_tx_diff);
}
- set_scale_factors(cm, xd, mbmi->ref_frame[0] - 1, mbmi->ref_frame[1] - 1);
+ set_ref_ptrs(cm, xd, mbmi->ref_frame[0] - 1, mbmi->ref_frame[1] - 1);
store_coding_context(x, ctx, best_mode_index,
&mbmi->ref_mvs[mbmi->ref_frame[0]][0],
&mbmi->ref_mvs[mbmi->ref_frame[1] < 0 ? 0 :
@@ -3902,7 +3902,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
vp9_is_scaled(&cm->frame_refs[second_ref_frame - 1].sf))
continue;
- set_scale_factors(cm, xd, ref_frame - 1, second_ref_frame - 1);
+ set_ref_ptrs(cm, xd, ref_frame - 1, second_ref_frame - 1);
mbmi->uv_mode = DC_PRED;
// Evaluate all sub-pel filters irrespective of whether we can use
@@ -4442,7 +4442,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
vp9_zero(best_tx_diff);
}
- set_scale_factors(cm, xd, mbmi->ref_frame[0] - 1, mbmi->ref_frame[1] - 1);
+ set_ref_ptrs(cm, xd, mbmi->ref_frame[0] - 1, mbmi->ref_frame[1] - 1);
store_coding_context(x, ctx, best_mode_index,
&mbmi->ref_mvs[mbmi->ref_frame[0]][0],
&mbmi->ref_mvs[mbmi->ref_frame[1] < 0 ? 0 :
diff --git a/vp9/encoder/vp9_rdopt.h b/vp9/encoder/vp9_rdopt.h
index 9ac1f5404..96cea4216 100644
--- a/vp9/encoder/vp9_rdopt.h
+++ b/vp9/encoder/vp9_rdopt.h
@@ -13,6 +13,10 @@
#include "vp9/encoder/vp9_onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define RDDIV_BITS 7
#define RDCOST(RM, DM, R, D) \
@@ -46,7 +50,8 @@ void vp9_setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
int_mv frame_near_mv[MAX_REF_FRAMES],
struct buf_2d yv12_mb[4][MAX_MB_PLANE]);
-YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(VP9_COMP *cpi, int ref_frame);
+const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi,
+ int ref_frame);
void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
int *r, int64_t *d, BLOCK_SIZE bsize,
@@ -80,4 +85,8 @@ void vp9_get_entropy_contexts(TX_SIZE tx_size,
const ENTROPY_CONTEXT *above, const ENTROPY_CONTEXT *left,
int num_4x4_w, int num_4x4_h);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_RDOPT_H_
diff --git a/vp9/encoder/vp9_segmentation.h b/vp9/encoder/vp9_segmentation.h
index 3c6eb7038..8238892e2 100644
--- a/vp9/encoder/vp9_segmentation.h
+++ b/vp9/encoder/vp9_segmentation.h
@@ -15,6 +15,10 @@
#include "vp9/common/vp9_blockd.h"
#include "vp9/encoder/vp9_onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_enable_segmentation(VP9_PTR ptr);
void vp9_disable_segmentation(VP9_PTR ptr);
@@ -45,4 +49,8 @@ void vp9_choose_segmap_coding_method(VP9_COMP *cpi);
void vp9_reset_segment_features(struct segmentation *seg);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_SEGMENTATION_H_
diff --git a/vp9/encoder/vp9_subexp.h b/vp9/encoder/vp9_subexp.h
index 1cafd8775..ab5659bf7 100644
--- a/vp9/encoder/vp9_subexp.h
+++ b/vp9/encoder/vp9_subexp.h
@@ -12,6 +12,10 @@
#ifndef VP9_ENCODER_VP9_SUBEXP_H_
#define VP9_ENCODER_VP9_SUBEXP_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_compute_update_table();
@@ -32,4 +36,8 @@ int vp9_prob_diff_update_savings_search_model(const unsigned int *ct,
vp9_prob upd,
int b, int r);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_SUBEXP_H_
diff --git a/vp9/encoder/vp9_temporal_filter.h b/vp9/encoder/vp9_temporal_filter.h
index c5f3b467e..eea2f1018 100644
--- a/vp9/encoder/vp9_temporal_filter.h
+++ b/vp9/encoder/vp9_temporal_filter.h
@@ -11,8 +11,16 @@
#ifndef VP9_ENCODER_VP9_TEMPORAL_FILTER_H_
#define VP9_ENCODER_VP9_TEMPORAL_FILTER_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_temporal_filter_prepare(VP9_COMP *cpi, int distance);
void configure_arnr_filter(VP9_COMP *cpi, const unsigned int this_frame,
const int group_boost);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_TEMPORAL_FILTER_H_
diff --git a/vp9/encoder/vp9_tokenize.h b/vp9/encoder/vp9_tokenize.h
index 67e6c9d3d..ea86240be 100644
--- a/vp9/encoder/vp9_tokenize.h
+++ b/vp9/encoder/vp9_tokenize.h
@@ -16,6 +16,10 @@
#include "vp9/encoder/vp9_block.h"
#include "vp9/encoder/vp9_treewriter.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void vp9_tokenize_initialize();
#define EOSB_TOKEN 127 // Not signalled, encoder only
@@ -50,4 +54,8 @@ extern const int *vp9_dct_value_cost_ptr;
*/
extern const TOKENVALUE *vp9_dct_value_tokens_ptr;
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_TOKENIZE_H_
diff --git a/vp9/encoder/vp9_treewriter.h b/vp9/encoder/vp9_treewriter.h
index 09f80b0ba..fedfbe937 100644
--- a/vp9/encoder/vp9_treewriter.h
+++ b/vp9/encoder/vp9_treewriter.h
@@ -13,6 +13,10 @@
#include "vp9/encoder/vp9_writer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define vp9_cost_zero(prob) (vp9_prob_cost[prob])
#define vp9_cost_one(prob) vp9_cost_zero(vp9_complement(prob))
@@ -69,4 +73,8 @@ static INLINE void vp9_write_token(vp9_writer *w, const vp9_tree_index *tree,
vp9_write_tree(w, tree, probs, token->value, token->len, 0);
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_TREEWRITER_H_
diff --git a/vp9/encoder/vp9_vaq.h b/vp9/encoder/vp9_vaq.h
index c45c479de..c73114aeb 100644
--- a/vp9/encoder/vp9_vaq.h
+++ b/vp9/encoder/vp9_vaq.h
@@ -14,6 +14,10 @@
#include "vp9/encoder/vp9_onyx_int.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
unsigned int vp9_vaq_segment_id(int energy);
double vp9_vaq_rdmult_ratio(int energy);
double vp9_vaq_inv_q_ratio(int energy);
@@ -23,4 +27,8 @@ void vp9_vaq_frame_setup(VP9_COMP *cpi);
int vp9_block_energy(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bs);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_VAQ_H_
diff --git a/vp9/encoder/vp9_variance.h b/vp9/encoder/vp9_variance.h
index 2ded97c55..3bc2091f8 100644
--- a/vp9/encoder/vp9_variance.h
+++ b/vp9/encoder/vp9_variance.h
@@ -12,7 +12,10 @@
#define VP9_ENCODER_VP9_VARIANCE_H_
#include "vpx/vpx_integer.h"
-// #include "./vpx_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
void variance(const uint8_t *src_ptr,
int source_stride,
@@ -112,4 +115,8 @@ static void comp_avg_pred(uint8_t *comp_pred, const uint8_t *pred, int width,
ref += ref_stride;
}
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_VARIANCE_H_
diff --git a/vp9/encoder/vp9_write_bit_buffer.h b/vp9/encoder/vp9_write_bit_buffer.h
index dfed90370..5958b4806 100644
--- a/vp9/encoder/vp9_write_bit_buffer.h
+++ b/vp9/encoder/vp9_write_bit_buffer.h
@@ -15,6 +15,10 @@
#include "vpx/vpx_integer.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct vp9_write_bit_buffer {
uint8_t *bit_buffer;
size_t bit_offset;
@@ -45,4 +49,8 @@ static void vp9_wb_write_literal(struct vp9_write_bit_buffer *wb,
}
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_WRITE_BIT_BUFFER_H_
diff --git a/vp9/encoder/vp9_writer.h b/vp9/encoder/vp9_writer.h
index 9cac7a84f..62f555c99 100644
--- a/vp9/encoder/vp9_writer.h
+++ b/vp9/encoder/vp9_writer.h
@@ -15,6 +15,10 @@
#include "vp9/common/vp9_prob.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct {
unsigned int lowvalue;
unsigned int range;
@@ -105,4 +109,8 @@ static void vp9_write_literal(vp9_writer *w, int data, int bits) {
#define vp9_write_prob(w, v) vp9_write_literal((w), (v), 8)
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_VP9_WRITER_H_
diff --git a/vp9/encoder/x86/vp9_mcomp_x86.h b/vp9/encoder/x86/vp9_mcomp_x86.h
index e1fcf40f2..c15039ad8 100644
--- a/vp9/encoder/x86/vp9_mcomp_x86.h
+++ b/vp9/encoder/x86/vp9_mcomp_x86.h
@@ -12,6 +12,10 @@
#ifndef VP9_ENCODER_X86_VP9_MCOMP_X86_H_
#define VP9_ENCODER_X86_VP9_MCOMP_X86_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if HAVE_SSE3
#if !CONFIG_RUNTIME_CPU_DETECT
@@ -36,5 +40,9 @@
#endif
#endif
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VP9_ENCODER_X86_VP9_MCOMP_X86_H_
diff --git a/vpx/internal/vpx_codec_internal.h b/vpx/internal/vpx_codec_internal.h
index 6c644f045..9f9da5c28 100644
--- a/vpx/internal/vpx_codec_internal.h
+++ b/vpx/internal/vpx_codec_internal.h
@@ -47,6 +47,9 @@
#include "../vpx_encoder.h"
#include <stdarg.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
/*!\brief Current ABI version number
*
@@ -476,6 +479,7 @@ vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
#include <stdio.h>
#include <setjmp.h>
+
struct vpx_internal_error_info {
vpx_codec_err_t error_code;
int has_detail;
@@ -532,4 +536,8 @@ vpx_codec_err_t vpx_validate_mmaps(const vpx_codec_stream_info_t *si,
const vpx_codec_mmap_t *mmaps,
const mem_req_t *mem_reqs, int nreqs,
vpx_codec_flags_t init_flags);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VPX_INTERNAL_VPX_CODEC_INTERNAL_H_
diff --git a/vpx/vpx_image.h b/vpx/vpx_image.h
index 79e11aa01..d27325cad 100644
--- a/vpx/vpx_image.h
+++ b/vpx/vpx_image.h
@@ -13,13 +13,13 @@
* \brief Describes the vpx image descriptor and associated operations
*
*/
+#ifndef VPX_VPX_IMAGE_H_
+#define VPX_VPX_IMAGE_H_
+
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef VPX_VPX_IMAGE_H_
-#define VPX_VPX_IMAGE_H_
-
/*!\brief Current ABI version number
*
* \internal
@@ -237,7 +237,8 @@ extern "C" {
*/
void vpx_img_free(vpx_image_t *img);
-#endif
#ifdef __cplusplus
-}
+} // extern "C"
+#endif
+
#endif // VPX_VPX_IMAGE_H_
diff --git a/vpx_ports/arm.h b/vpx_ports/arm.h
index 2562d9c1d..1e4a8e288 100644
--- a/vpx_ports/arm.h
+++ b/vpx_ports/arm.h
@@ -14,6 +14,10 @@
#include <stdlib.h>
#include "vpx_config.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*ARMv5TE "Enhanced DSP" instructions.*/
#define HAS_EDSP 0x01
/*ARMv6 "Parallel" or "Media" instructions.*/
@@ -23,5 +27,9 @@
int arm_cpu_caps(void);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VPX_PORTS_ARM_H_
diff --git a/vpx_ports/x86.h b/vpx_ports/x86.h
index a9d51a3bc..603e2b66c 100644
--- a/vpx_ports/x86.h
+++ b/vpx_ports/x86.h
@@ -14,6 +14,10 @@
#include <stdlib.h>
#include "vpx_config.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef enum {
VPX_CPU_UNKNOWN = -1,
VPX_CPU_AMD,
@@ -256,5 +260,9 @@ x87_set_double_precision(void) {
extern void vpx_reset_mmx_state(void);
-#endif // VPX_PORTS_X86_H_
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // VPX_PORTS_X86_H_
diff --git a/vpxdec.c b/vpxdec.c
index fc344a162..cd50b0521 100644
--- a/vpxdec.c
+++ b/vpxdec.c
@@ -839,13 +839,12 @@ int main_loop(int argc, const char **argv_) {
if (progress)
show_progress(frame_in, frame_out, dx_time);
- if (!noblit) {
- if (frame_out == 1 && img && single_file && !do_md5 && use_y4m)
- y4m_write_file_header(outfile,
- vpx_input_ctx.width, vpx_input_ctx.height,
- &vpx_input_ctx.framerate, img->fmt);
+ if (!noblit && img) {
+ const int PLANES_YUV[] = {VPX_PLANE_Y, VPX_PLANE_U, VPX_PLANE_V};
+ const int PLANES_YVU[] = {VPX_PLANE_Y, VPX_PLANE_V, VPX_PLANE_U};
+ const int *planes = flipuv ? PLANES_YVU : PLANES_YUV;
- if (img && do_scale) {
+ if (do_scale) {
if (frame_out == 1) {
// If the output frames are to be scaled to a fixed display size then
// use the width and height specified in the container. If either of
@@ -876,33 +875,32 @@ int main_loop(int argc, const char **argv_) {
}
}
- if (img) {
- const int PLANES_YUV[] = {VPX_PLANE_Y, VPX_PLANE_U, VPX_PLANE_V};
- const int PLANES_YVU[] = {VPX_PLANE_Y, VPX_PLANE_V, VPX_PLANE_U};
-
- const int *planes = flipuv ? PLANES_YVU : PLANES_YUV;
-
- if (!single_file) {
- generate_filename(outfile_pattern, outfile_name, PATH_MAX,
- img->d_w, img->d_h, frame_in);
- if (do_md5) {
- MD5Init(&md5_ctx);
- update_image_md5(img, planes, &md5_ctx);
- MD5Final(md5_digest, &md5_ctx);
- print_md5(md5_digest, outfile_name);
- } else {
- outfile = open_outfile(outfile_name);
- write_image_file(img, planes, outfile);
- fclose(outfile);
- }
+ if (single_file) {
+ if (do_md5) {
+ update_image_md5(img, planes, &md5_ctx);
} else {
- if (do_md5) {
- update_image_md5(img, planes, &md5_ctx);
- } else {
- if (use_y4m)
- y4m_write_frame_header(outfile);
- write_image_file(img, planes, outfile);
+ if (use_y4m) {
+ if (frame_out == 1) {
+ y4m_write_file_header(outfile,
+ vpx_input_ctx.width, vpx_input_ctx.height,
+ &vpx_input_ctx.framerate, img->fmt);
+ }
+ y4m_write_frame_header(outfile);
}
+ write_image_file(img, planes, outfile);
+ }
+ } else {
+ generate_filename(outfile_pattern, outfile_name, PATH_MAX,
+ img->d_w, img->d_h, frame_in);
+ if (do_md5) {
+ MD5Init(&md5_ctx);
+ update_image_md5(img, planes, &md5_ctx);
+ MD5Final(md5_digest, &md5_ctx);
+ print_md5(md5_digest, outfile_name);
+ } else {
+ outfile = open_outfile(outfile_name);
+ write_image_file(img, planes, outfile);
+ fclose(outfile);
}
}
}
diff --git a/vpxenc.h b/vpxenc.h
index 5cb3f853a..5103ee65a 100644
--- a/vpxenc.h
+++ b/vpxenc.h
@@ -12,6 +12,10 @@
#include "vpx/vpx_encoder.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum TestDecodeFatality {
TEST_DECODE_OFF,
TEST_DECODE_FATAL,
@@ -42,4 +46,8 @@ struct VpxEncoderConfig {
int disable_warning_prompt;
};
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VPXENC_H_
diff --git a/vpxstats.h b/vpxstats.h
index 18b3acdc0..9ce9c5320 100644
--- a/vpxstats.h
+++ b/vpxstats.h
@@ -15,6 +15,10 @@
#include "vpx/vpx_encoder.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* This structure is used to abstract the different ways of handling
* first pass statistics
*/
@@ -34,4 +38,8 @@ vpx_fixed_buf_t stats_get(stats_io_t *stats);
double vp8_mse2psnr(double samples, double peak, double mse);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // VPXSTATS_H_
diff --git a/warnings.h b/warnings.h
index ac3a4b63e..6b8ae6796 100644
--- a/warnings.h
+++ b/warnings.h
@@ -10,6 +10,10 @@
#ifndef WARNINGS_H_
#define WARNINGS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct vpx_codec_enc_cfg;
struct VpxEncoderConfig;
@@ -22,4 +26,8 @@ void check_encoder_config(int disable_prompt,
const struct VpxEncoderConfig *global_config,
const struct vpx_codec_enc_cfg *stream_config);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // WARNINGS_H_
diff --git a/webmdec.h b/webmdec.h
index 002fbe645..fa5a52eaf 100644
--- a/webmdec.h
+++ b/webmdec.h
@@ -12,6 +12,10 @@
#include "./tools_common.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct nestegg;
struct nestegg_packet;
struct VpxInputContext;
@@ -37,4 +41,8 @@ int webm_guess_framerate(struct WebmInputContext *webm_ctx,
void webm_free(struct WebmInputContext *webm_ctx);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // WEBMDEC_H_
diff --git a/webmenc.h b/webmenc.h
index f3bc3ecd2..362aa895f 100644
--- a/webmenc.h
+++ b/webmenc.h
@@ -23,6 +23,10 @@ typedef __int64 off_t;
#include "tools_common.h"
#include "vpx/vpx_encoder.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef off_t EbmlLoc;
struct cue_entry {
@@ -84,4 +88,8 @@ void write_webm_block(struct EbmlGlobal *glob,
void write_webm_file_footer(struct EbmlGlobal *glob, int hash);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // WEBMENC_H_
diff --git a/y4menc.h b/y4menc.h
index e5f7978a7..95f7909b1 100644
--- a/y4menc.h
+++ b/y4menc.h
@@ -17,6 +17,10 @@
#include "vpx/vpx_decoder.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void y4m_write_file_header(FILE *file, int width, int height,
const struct VpxRational *framerate,
vpx_img_fmt_t fmt);
@@ -24,4 +28,8 @@ void y4m_write_file_header(FILE *file, int width, int height,
void y4m_write_frame_header(FILE *file);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // Y4MENC_H_
diff --git a/y4minput.h b/y4minput.h
index 615debe61..d53eb651b 100644
--- a/y4minput.h
+++ b/y4minput.h
@@ -17,6 +17,10 @@
# include <stdio.h>
# include "vpx/vpx_image.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct y4m_input y4m_input;
@@ -62,4 +66,8 @@ int y4m_input_open(y4m_input *_y4m, FILE *_fin, char *_skip, int _nskip,
void y4m_input_close(y4m_input *_y4m);
int y4m_input_fetch_frame(y4m_input *_y4m, FILE *_fin, vpx_image_t *img);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // Y4MINPUT_H_