Commit a9c7597a authored by John Koleszar's avatar John Koleszar
Browse files

support building vp8 and vp9 into a single lib

Change-Id: Ib8f8a66c9fd31e508cdc9caa662192f38433aa3d
parent b72373de
......@@ -14,7 +14,7 @@
#include <limits.h>
#include <assert.h>
#include "vpx_config.h"
#include "vpx_rtcd.h"
#include "vp8_rtcd.h"
#include "vp8/common/pragmas.h"
#include "tokenize.h"
#include "treewriter.h"
......
......@@ -12,7 +12,7 @@
#include "vp8/common/reconinter.h"
#include "vpx/vpx_integer.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_rtcd.h"
#include "vp8_rtcd.h"
#include <emmintrin.h>
......
......@@ -10,7 +10,7 @@
#include "vpx_config.h"
#include "vpx_rtcd.h"
#include "vp8_rtcd.h"
#include "vpx_ports/x86.h"
#include "vp8/encoder/block.h"
......
......@@ -10,7 +10,7 @@
#include "vpx_config.h"
#include "vpx_rtcd.h"
#include "vp8_rtcd.h"
#include "vpx_ports/x86.h"
#include "vp8/encoder/block.h"
......
......@@ -194,3 +194,5 @@ VP8_COMMON_SRCS-$(HAVE_NEON) += common/arm/neon/vp8_subpixelvariance16x16s_neon
$(eval $(call asm_offsets_template,\
vp8_asm_com_offsets.asm, $(VP8_PREFIX)common/asm_com_offsets.c))
$(eval $(call rtcd_h_template,vp8_rtcd,vp8/common/rtcd_defs.sh))
......@@ -9,7 +9,7 @@
*/
#include "vpx_rtcd.h"
#include "vp8_rtcd.h"
#include "vpx/vpx_codec.h"
#include "vpx/internal/vpx_codec_internal.h"
#include "vpx_version.h"
......@@ -582,7 +582,7 @@ static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx,
struct VP8_COMP *optr;
vpx_rtcd();
vp8_rtcd();
if (!ctx->priv)
{
......
......@@ -11,7 +11,7 @@
#include <stdlib.h>
#include <string.h>
#include "vpx_rtcd.h"
#include "vp8_rtcd.h"
#include "vpx/vpx_decoder.h"
#include "vpx/vp8dx.h"
#include "vpx/internal/vpx_codec_internal.h"
......@@ -194,7 +194,7 @@ static vpx_codec_err_t vp8_init(vpx_codec_ctx_t *ctx,
vpx_codec_err_t res = VPX_CODEC_OK;
(void) data;
vpx_rtcd();
vp8_rtcd();
/* This function only allocates space for the vpx_codec_alg_priv_t
* structure. More memory may be required at the time the stream
......
......@@ -12,7 +12,7 @@
#include <stdlib.h>
#include "filter.h"
#include "vpx_ports/mem.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
DECLARE_ALIGNED(16, const short, vp9_bilinear_filters[SUBPEL_SHIFTS][2]) = {
{ 128, 0 },
......
......@@ -10,7 +10,7 @@
#include "vpx_ports/config.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#include "vp9/common/subpixel.h"
#include "vp9/common/loopfilter.h"
#include "vp9/common/idct.h"
......@@ -84,5 +84,5 @@ void vp9_machine_specific_config(VP9_COMMON *ctx) {
vp9_arch_arm_common_init(ctx);
#endif
vpx_rtcd();
vp9_rtcd();
}
......@@ -14,7 +14,7 @@
#include "vpx_config.h"
#include "vpx/internal/vpx_codec_internal.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#include "loopfilter.h"
#include "entropymv.h"
#include "entropy.h"
......
......@@ -10,7 +10,7 @@
#include "vpx_ports/config.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#include "blockd.h"
void vp9_recon_b_c
......
......@@ -10,7 +10,7 @@
#include <stdio.h>
#include "vpx_ports/config.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#include "reconintra.h"
#include "vpx_mem/vpx_mem.h"
......
......@@ -12,7 +12,7 @@
#include "vpx_ports/config.h"
#include "vpx_mem/vpx_mem.h"
#include "reconintra.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#if CONFIG_NEWBINTRAMODES
static int find_grad_measure(unsigned char *x, int stride, int n, int t,
......
......@@ -9,97 +9,13 @@
*/
#include "vpx_config.h"
#define RTCD_C
#include "vpx_rtcd.h"
#if CONFIG_MULTITHREAD && defined(_WIN32)
#include <windows.h>
#include <stdlib.h>
static void once(void (*func)(void))
{
static CRITICAL_SECTION *lock;
static LONG waiters;
static int done;
void *lock_ptr = &lock;
/* If the initialization is complete, return early. This isn't just an
* optimization, it prevents races on the destruction of the global
* lock.
*/
if(done)
return;
InterlockedIncrement(&waiters);
/* Get a lock. We create one and try to make it the one-true-lock,
* throwing it away if we lost the race.
*/
{
/* Scope to protect access to new_lock */
CRITICAL_SECTION *new_lock = malloc(sizeof(CRITICAL_SECTION));
InitializeCriticalSection(new_lock);
if (InterlockedCompareExchangePointer(lock_ptr, new_lock, NULL) != NULL)
{
DeleteCriticalSection(new_lock);
free(new_lock);
}
}
/* At this point, we have a lock that can be synchronized on. We don't
* care which thread actually performed the allocation.
*/
EnterCriticalSection(lock);
if (!done)
{
func();
done = 1;
}
LeaveCriticalSection(lock);
/* Last one out should free resources. The destructed objects are
* protected by checking if(done) above.
*/
if(!InterlockedDecrement(&waiters))
{
DeleteCriticalSection(lock);
free(lock);
lock = NULL;
}
}
#elif CONFIG_MULTITHREAD && HAVE_PTHREAD_H
#include <pthread.h>
static void once(void (*func)(void))
{
static pthread_once_t lock = PTHREAD_ONCE_INIT;
pthread_once(&lock, func);
}
#else
/* No-op version that performs no synchronization. vpx_rtcd() is idempotent,
* so as long as your platform provides atomic loads/stores of pointers
* no synchronization is strictly necessary.
*/
static void once(void (*func)(void))
{
static int done;
if(!done)
{
func();
done = 1;
}
}
#endif
#include "vp9_rtcd.h"
#include "vpx_ports/vpx_once.h"
extern void vpx_scale_rtcd(void);
void vpx_rtcd()
void vp9_rtcd()
{
vpx_scale_rtcd();
once(setup_rtcd_internal);
}
common_forward_decls() {
vp9_common_forward_decls() {
cat <<EOF
/*
* VP9
*/
struct loop_filter_info;
struct blockd;
......@@ -12,14 +15,11 @@ struct macroblock;
struct variance_vtable;
#define DEC_MVCOSTS int *mvjcost, int *mvcost[2]
/* Encoder forward decls */
struct variance_vtable;
union int_mv;
struct yv12_buffer_config;
EOF
}
forward_decls common_forward_decls
forward_decls vp9_common_forward_decls
prototype void vp9_filter_block2d_4x4_8 "const unsigned char *src_ptr, const unsigned int src_stride, const short *HFilter_aligned16, const short *VFilter_aligned16, unsigned char *dst_ptr, unsigned int dst_stride"
prototype void vp9_filter_block2d_8x4_8 "const unsigned char *src_ptr, const unsigned int src_stride, const short *HFilter_aligned16, const short *VFilter_aligned16, unsigned char *dst_ptr, unsigned int dst_stride"
......@@ -94,9 +94,6 @@ vp9_copy_mem8x8_dspr2=vp9_copy_mem8x8_dspr2
prototype void vp9_copy_mem8x4 "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch"
specialize vp9_copy_mem8x4 mmx
prototype void vp9_intra4x4_predict "unsigned char *Above, unsigned char *yleft, int left_stride, B_PREDICTION_MODE b_mode, unsigned char *dst, int dst_stride, unsigned char top_left"
specialize vp9_intra4x4_predict
prototype void vp9_avg_mem16x16 "unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch"
specialize vp9_avg_mem16x16
......
......@@ -12,7 +12,7 @@
#include <emmintrin.h> // SSE2
#include "vp9/common/filter.h"
#include "vpx_ports/mem.h" // for DECLARE_ALIGNED
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
// TODO(cd): After cleanup, commit faster versions for non 4x4 size. This is
// just a quick partial snapshot so that other can already use some
......
......@@ -12,7 +12,7 @@
#include <smmintrin.h> // SSE4.1
#include "vp9/common/filter.h"
#include "vpx_ports/mem.h" // for DECLARE_ALIGNED
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
// TODO(cd): After cleanup, commit faster versions for non 4x4 size. This is
// just a quick partial snapshot so that other can already use some
......
......@@ -10,7 +10,7 @@
#include <emmintrin.h> // SSE2
#include "./vpx_config.h"
#include "./vpx_rtcd.h"
#include "./vp9_rtcd.h"
#if HAVE_SSE2
......
......@@ -32,7 +32,7 @@
#include "vp9/common/seg_common.h"
#include "vp9/common/entropy.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#include <assert.h>
#include <stdio.h>
......
......@@ -9,7 +9,7 @@
*/
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#include "dequantize.h"
#include "vp9/common/idct.h"
#include "vpx_mem/vpx_mem.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment