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
......@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#include "vp9/common/idct.h"
void vp9_dequant_dc_idct_add_y_block_c(short *q, short *dq,
......
......@@ -9,7 +9,7 @@
*/
#include "vpx_config.h"
#include "./vpx_rtcd.h"
#include "./vp9_rtcd.h"
#if HAVE_ARMV6
......
......@@ -29,7 +29,7 @@
#include "vp9/common/reconintra.h"
#include "vp9/common/seg_common.h"
#include "vp9/encoder/tokenize.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#include <stdio.h>
#include <math.h>
#include <limits.h>
......
......@@ -9,7 +9,7 @@
*/
#include "vpx_ports/config.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#include "vp9/common/idct.h"
#include "quantize.h"
#include "vp9/common/reconintra.h"
......
......@@ -18,7 +18,7 @@
#include "vpx_mem/vpx_mem.h"
#include "rdopt.h"
#include "vp9/common/systemdependent.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#if CONFIG_RUNTIME_CPU_DETECT
#define IF_RTCD(x) (x)
......
......@@ -40,7 +40,7 @@
#include "vp9/common/seg_common.h"
#include "vp9/common/pred_common.h"
#include "vp9/common/entropy.h"
#include "vpx_rtcd.h"
#include "vp9_rtcd.h"
#include "vp9/common/mvref_common.h"
#if CONFIG_RUNTIME_CPU_DETECT
......
......@@ -10,7 +10,7 @@
#include <stdlib.h>
#include "vpx_ports/mem.h"
#include "./vpx_rtcd.h"
#include "./vp9_rtcd.h"
unsigned int vp9_satd16x16_c(const unsigned char *src_ptr,
int src_stride,
const unsigned char *ref_ptr,
......
data vpx_codec_vp8_dx_algo
text vpx_codec_vp8_dx
data vpx_codec_vp9_dx_algo
text vpx_codec_vp9_dx
data vpx_codec_vp8_cx_algo
text vpx_codec_vp8_cx
data vpx_codec_vp8x_cx_algo
text vpx_codec_vp8x_cx
data vpx_codec_vp9_cx_algo
text vpx_codec_vp9_cx
data vpx_codec_vp9x_cx_algo
text vpx_codec_vp9x_cx
......@@ -182,3 +182,5 @@ VP9_COMMON_SRCS-$(HAVE_ARMV7) += common/arm/neon/recon_neon.c
$(eval $(call asm_offsets_template,\
vp9_asm_com_offsets.asm, $(VP9_PREFIX)common/asm_com_offsets.c))
$(eval $(call rtcd_h_template,vp9_rtcd,vp9/common/rtcd_defs.sh))
......@@ -1083,8 +1083,8 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] = {
#ifndef VERSION_STRING
#define VERSION_STRING
#endif
CODEC_INTERFACE(vpx_codec_vp8_cx) = {
"WebM Project VP8 Encoder" VERSION_STRING,
CODEC_INTERFACE(vpx_codec_vp9_cx) = {
"WebM Project VP9 Encoder" VERSION_STRING,
VPX_CODEC_INTERNAL_ABI_VERSION,
VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR |
VPX_CODEC_CAP_OUTPUT_PARTITION,
......@@ -1113,7 +1113,7 @@ CODEC_INTERFACE(vpx_codec_vp8_cx) = {
#if CONFIG_EXPERIMENTAL
CODEC_INTERFACE(vpx_codec_vp8x_cx) = {
CODEC_INTERFACE(vpx_codec_vp9x_cx) = {
"VP8 Experimental Encoder" VERSION_STRING,
VPX_CODEC_INTERNAL_ABI_VERSION,
VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR,
......
......@@ -659,8 +659,8 @@ static vpx_codec_ctrl_fn_map_t ctf_maps[] = {
#ifndef VERSION_STRING
#define VERSION_STRING
#endif
CODEC_INTERFACE(vpx_codec_vp8_dx) = {
"WebM Project VP8 Decoder" VERSION_STRING,
CODEC_INTERFACE(vpx_codec_vp9_dx) = {
"WebM Project VP9 Decoder" VERSION_STRING,
VPX_CODEC_INTERNAL_ABI_VERSION,
VPX_CODEC_CAP_DECODER | VP8_CAP_POSTPROC,
/* vpx_codec_caps_t caps; */
......
......@@ -34,8 +34,10 @@ extern vpx_codec_iface_t vpx_codec_vp8_cx_algo;
extern vpx_codec_iface_t *vpx_codec_vp8_cx(void);
/* TODO(jkoleszar): These move to VP9 in a later patch set. */
extern vpx_codec_iface_t vpx_codec_vp8x_cx_algo;
extern vpx_codec_iface_t *vpx_codec_vp8x_cx(void);
extern vpx_codec_iface_t vpx_codec_vp9_cx_algo;
extern vpx_codec_iface_t *vpx_codec_vp9_cx(void);
extern vpx_codec_iface_t vpx_codec_vp9x_cx_algo;
extern vpx_codec_iface_t *vpx_codec_vp9x_cx(void);
/*!@} - end algorithm interface member group*/
......
......@@ -32,6 +32,10 @@
*/
extern vpx_codec_iface_t vpx_codec_vp8_dx_algo;
extern vpx_codec_iface_t *vpx_codec_vp8_dx(void);
/* TODO(jkoleszar): These move to VP9 in a later patch set. */
extern vpx_codec_iface_t vpx_codec_vp9_dx_algo;
extern vpx_codec_iface_t *vpx_codec_vp9_dx(void);
/*!@} - end algorithm interface member group*/
/* Include controls common to both the encoder and decoder */
......
/*
* Copyright (c) 2011 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vpx_config.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. vp8_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
......@@ -20,7 +20,7 @@
/****************************************************************************
* Header Files
****************************************************************************/
#include "./vpx_rtcd.h"
#include "./vpx_scale_rtcd.h"
#include "vpx_mem/vpx_mem.h"
#include "vpx_scale/yv12config.h"
#include "vpx_scale/scale_mode.h"
......
/*
* Copyright (c) 2011 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vpx_config.h"
#define RTCD_C
#include "vpx_scale_rtcd.h"
#include "vpx_ports/vpx_once.h"
void vpx_scale_rtcd()
{
once(setup_rtcd_internal);
}
......@@ -6,6 +6,7 @@ SCALE_SRCS-yes += generic/vpxscale.c
SCALE_SRCS-yes += generic/yv12config.c
SCALE_SRCS-yes += generic/yv12extend.c
SCALE_SRCS-$(CONFIG_SPATIAL_RESAMPLING) += generic/gen_scalers.c
SCALE_SRCS-yes += rtcd.c
#neon
SCALE_SRCS-$(HAVE_NEON) += arm/neon/vp8_vpxyv12_copyframe_func_neon$(ASM)
......@@ -15,3 +16,5 @@ SCALE_SRCS-$(HAVE_NEON) += arm/neon/vp8_vpxyv12_extendframeborders_neon$(ASM)
SCALE_SRCS-$(HAVE_NEON) += arm/neon/yv12extend_arm.c
SCALE_SRCS-no += $(SCALE_SRCS_REMOVE-yes)
$(eval $(call rtcd_h_template,vpx_scale_rtcd,vpx_scale/vpx_scale_rtcd.sh))
vpx_scale_forward_decls() {
cat <<EOF
struct yv12_buffer_config;
EOF
}
forward_decls vpx_scale_forward_decls
# Scaler functions
if [ "CONFIG_SPATIAL_RESAMPLING" != "yes" ]; then
prototype void vp8_horizontal_line_4_5_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_4_5_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_last_vertical_band_4_5_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_2_3_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_2_3_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_last_vertical_band_2_3_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_3_5_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_3_5_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_last_vertical_band_3_5_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_3_4_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_3_4_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_last_vertical_band_3_4_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_1_2_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_1_2_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_last_vertical_band_1_2_scale "unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_5_4_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_5_4_scale "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_5_3_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_5_3_scale "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_horizontal_line_2_1_scale "const unsigned char *source, unsigned int source_width, unsigned char *dest, unsigned int dest_width"
prototype void vp8_vertical_band_2_1_scale "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
prototype void vp8_vertical_band_2_1_scale_i "unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width"
fi
prototype void vp8_yv12_extend_frame_borders "struct yv12_buffer_config *ybf"
specialize vp8_yv12_extend_frame_borders neon
prototype void vp8_yv12_copy_frame "struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc"
specialize vp8_yv12_copy_frame neon
prototype void vp8_yv12_copy_y "struct yv12_buffer_config *src_ybc, struct yv12_buffer_config *dst_ybc"
specialize vp8_yv12_copy_y neon
......@@ -49,6 +49,7 @@
static const char *exec_name;
#define VP8_FOURCC (0x00385056)
#define VP9_FOURCC (0x00395056)
static const struct {
char const *name;
const vpx_codec_iface_t *(*iface)(void);
......@@ -59,7 +60,7 @@ static const struct {
{"vp8", vpx_codec_vp8_dx, VP8_FOURCC, 0x00FFFFFF},
#endif
#if CONFIG_VP9_DECODER
{"vp9", vpx_codec_vp8_dx, VP8_FOURCC, 0x00FFFFFF},
{"vp9", vpx_codec_vp9_dx, VP9_FOURCC, 0x00FFFFFF},
#endif
};
......@@ -109,7 +110,7 @@ static const arg_def_t *all_args[] = {
NULL
};
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
#if CONFIG_VP8_DECODER
static const arg_def_t addnoise_level = ARG_DEF(NULL, "noise-level", 1,
"Enable VP8 postproc add noise");
static const arg_def_t deblock = ARG_DEF(NULL, "deblock", 0,
......@@ -142,7 +143,7 @@ static void usage_exit() {
fprintf(stderr, "Usage: %s <options> filename\n\n"
"Options:\n", exec_name);
arg_show_usage(stderr, all_args);
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
#if CONFIG_VP8_DECODER
fprintf(stderr, "\nVP8 Postprocessing Options:\n");
arg_show_usage(stderr, vp8_pp_args);
#endif
......@@ -692,7 +693,7 @@ int main(int argc, const char **argv_) {
unsigned int fps_num;
void *out = NULL;
vpx_codec_dec_cfg_t cfg = {0};
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
#if CONFIG_VP8_DECODER
vp8_postproc_cfg_t vp8_pp_cfg = {0};
int vp8_dbg_color_ref_frame = 0;
int vp8_dbg_color_mb_modes = 0;
......@@ -752,7 +753,7 @@ int main(int argc, const char **argv_) {
else if (arg_match(&arg, &verbosearg, argi))
quiet = 0;
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
#if CONFIG_VP8_DECODER
else if (arg_match(&arg, &addnoise_level, argi)) {
postproc = 1;
vp8_pp_cfg.post_proc_flag |= VP8_ADDNOISE;
......@@ -924,7 +925,7 @@ int main(int argc, const char **argv_) {
if (!quiet)
fprintf(stderr, "%s\n", decoder.name);
#if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
#if CONFIG_VP8_DECODER
if (vp8_pp_cfg.post_proc_flag
&& vpx_codec_control(&decoder, VP8_SET_POSTPROC, &vp8_pp_cfg)) {
......
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