diff options
44 files changed, 452 insertions, 1180 deletions
@@ -57,7 +57,7 @@ int arg_match(struct arg *arg_, const struct arg_def *def, char **argv) } else if (def->long_name) { - int name_len = strlen(def->long_name); + const size_t name_len = strlen(def->long_name); if (strlen(arg.argv[0]) >= name_len + 2 && arg.argv[0][1] == '-' diff --git a/examples.mk b/examples.mk index 1f7dcc171..f6c904588 100644 --- a/examples.mk +++ b/examples.mk @@ -102,6 +102,7 @@ vp8_multi_resolution_encoder.SRCS \ += third_party/libyuv/include/libyuv/basic_types.h \ third_party/libyuv/include/libyuv/cpu_id.h \ third_party/libyuv/include/libyuv/scale.h \ + third_party/libyuv/source/row.h \ third_party/libyuv/source/scale.c \ third_party/libyuv/source/cpu_id.c vp8_multi_resolution_encoder.GUID = 04f8738e-63c8-423b-90fa-7c2703a374de diff --git a/vp8/common/arm/arm_systemdependent.c b/vp8/common/arm/arm_systemdependent.c index 1e2467411..89a2be825 100644 --- a/vp8/common/arm/arm_systemdependent.c +++ b/vp8/common/arm/arm_systemdependent.c @@ -11,7 +11,6 @@ #include "vpx_config.h" #include "vpx_ports/arm.h" -#include "vp8/common/g_common.h" #include "vp8/common/pragmas.h" #include "vp8/common/subpixel.h" #include "vp8/common/loopfilter.h" diff --git a/vp8/common/bigend.h b/vp8/common/bigend.h deleted file mode 100644 index 6ac3f8b5a..000000000 --- a/vp8/common/bigend.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#ifndef _bigend_h -#define _bigend_h - -#if defined(__cplusplus) -extern "C" { -#endif - -#define invert2(x) ( (((x)>>8)&0x00ff) | (((x)<<8)&0xff00) ) -#define invert4(x) ( ((invert2(x)&0x0000ffff)<<16) | (invert2((x>>16))&0x0000ffff) ) - -#define high_byte(x) (unsigned char)x -#define mid2Byte(x) (unsigned char)(x >> 8) -#define mid1Byte(x) (unsigned char)(x >> 16) -#define low_byte(x) (unsigned char)(x >> 24) - -#define SWAPENDS 1 - -#if defined(__cplusplus) -} -#endif -#endif diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h index 91e90e2a6..99b731c78 100644 --- a/vp8/common/blockd.h +++ b/vp8/common/blockd.h @@ -21,9 +21,6 @@ void vpx_log(const char *format, ...); #include "subpixel.h" #include "vpx_ports/mem.h" -#define TRUE 1 -#define FALSE 0 - /*#define DCPRED 1*/ #define DCPREDSIMTHRESH 0 #define DCPREDCNTTHRESH 3 diff --git a/vp8/common/common.h b/vp8/common/common.h index 9a93da991..2cc1c544c 100644 --- a/vp8/common/common.h +++ b/vp8/common/common.h @@ -18,8 +18,6 @@ #include "vpx_mem/vpx_mem.h" -#include "common_types.h" - /* Only need this for fixed-size arrays, for structs just assign. */ #define vp8_copy( Dest, Src) { \ diff --git a/vp8/common/common_types.h b/vp8/common/common_types.h deleted file mode 100644 index 4e6248697..000000000 --- a/vp8/common/common_types.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#ifndef __INC_COMMON_TYPES -#define __INC_COMMON_TYPES - -#define TRUE 1 -#define FALSE 0 - -#endif diff --git a/vp8/common/dma_desc.h b/vp8/common/dma_desc.h deleted file mode 100644 index b923da6e0..000000000 --- a/vp8/common/dma_desc.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#ifndef _dma_desc_h -#define _dma_desc_h - -#if defined(__cplusplus) -extern "C" { -#endif - - -#define NDSIZE_LG 0x00000900 // Next Descriptor Size -#define NDSIZE_SM 0x00000800 // Next Descriptor Size -#define NDSIZE_7 0x00000700 // Next Descriptor Size -#define NDSIZE_6 0x00000600 // Next Descriptor Size -#define NDSIZE_5 0x00000500 // Next Descriptor Size -#define NDSIZE_4 0x00000400 // Next Descriptor Size -#define NDSIZE_3 0x00000300 // Next Descriptor Size -#define NDSIZE_2 0x00000200 // Next Descriptor Size -#define NDSIZE_1 0x00000100 // Next Descriptor Size - -#define FLOW_STOP 0x0000 -#define FLOW_AUTO 0x1000 -#define FLOW_DESC_AR 0x4000 -#define FLOW_DESC_SM 0x6000 -#define FLOW_DESC_LG 0x7000 - - typedef struct - { - unsigned int ndp; - //unsigned short ndpl; - //unsigned short ndph; - unsigned int sa; - //unsigned short sal; - //unsigned short sah; - - unsigned short dmacfg; - unsigned short xcnt; - unsigned short xmod; - unsigned short ycnt; - unsigned short ymod; - - } LARGE_DESC; - - typedef struct - { - unsigned short ndpl; - unsigned short sal; - unsigned short sah; - unsigned short dmacfg; - unsigned short xcnt; - unsigned short xmod; - unsigned short ycnt; - unsigned short ymod; - } SMALL_DESC; - - typedef struct - { - unsigned short sal; - unsigned short sah; - unsigned short dmacfg; - unsigned short xcnt; - unsigned short xmod; - unsigned short ycnt; - unsigned short ymod; - } ARRAY_DESC_7; - - typedef struct - { - unsigned short sal; - unsigned short sah; - unsigned short dmacfg; - unsigned short xcnt; - unsigned short xmod; - unsigned short ycnt; - } ARRAY_DESC_6; - - typedef struct - { - unsigned short sal; - unsigned short sah; - unsigned short dmacfg; - unsigned short xcnt; - unsigned short xmod; - } ARRAY_DESC_5; - - typedef struct - { - unsigned short sal; - unsigned short sah; - unsigned short dmacfg; - unsigned short xcnt; - } ARRAY_DESC_4; - - typedef struct - { - unsigned short sal; - unsigned short sah; - unsigned short dmacfg; - } ARRAY_DESC_3; - - typedef struct - { - unsigned short sal; - unsigned short sah; - } ARRAY_DESC_2; - - typedef struct - { - unsigned short sal; - } ARRAY_DESC_1; - -#if defined(__cplusplus) -} -#endif - -#endif //_dma_desc_h diff --git a/vp8/common/duck_io.h b/vp8/common/duck_io.h deleted file mode 100644 index 43daa65bc..000000000 --- a/vp8/common/duck_io.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#ifndef _duck_io_h -#define _duck_io_h - -#if defined(__cplusplus) -extern "C" { -#endif - -#if defined (_WIN32) - typedef __int64 int64_t; -#elif defined(__MWERKS__) - typedef long long int64_t; -#elif defined(__APPLE__) || defined(__POWERPC) -#include <ppc/types.h> -#else - typedef long long int64_t; -#endif - - typedef struct - { - int64_t offset; // offset to start from - int blocking; // non-zero for blocking - } re_open_t; - - - typedef enum - { - SAL_ERR_MAX = -10, - SAL_ERROR = -11, // Default error - SAL_ERR_WSASTARTUP = -12, - SAL_ERR_SOCKET_CREATE = -13, - SAL_ERR_RESOLVING_HOSTNAME = -14, - SAL_ERR_SERVER_CONNECTION = -15, - SAL_ERR_SENDING_DATA = -16, - SAL_ERR_RECEIVING_DATA = -17, - SAL_ERR_404_FILE_NOT_FOUND = -18, - SAL_ERR_PARSING_HTTP_HEADER = -19, - SAL_ERR_PARSING_CONTENT_LEN = -20, - SAL_ERR_CONNECTION_TIMEOUT = -21, - SAL_ERR_FILE_OPEN_FAILED = -22, - SAL_ERR_MIN = -23 - } SAL_ERR; /* EMH 1-15-03 */ - - - typedef struct sal_err_map_temp - { - SAL_ERR code; - const char *decode; - - } sal_err_map_t; - - - static char *sal_err_text(SAL_ERR e) - { - int t; - const sal_err_map_t g_sal_err_map[] = - { - { SAL_ERR_WSASTARTUP, "Error with WSAStartup" }, - { SAL_ERR_SOCKET_CREATE, "Error creating socket" }, - { SAL_ERR_RESOLVING_HOSTNAME, "Error resolving hostname" }, - { SAL_ERR_SERVER_CONNECTION, "Error connecting to server" }, - { SAL_ERR_SENDING_DATA, "Error sending data" }, - { SAL_ERR_RECEIVING_DATA, "Error receiving data" }, - { SAL_ERR_404_FILE_NOT_FOUND, "Error file not found " }, - { SAL_ERR_PARSING_HTTP_HEADER, "Error parsing http header" }, - { SAL_ERR_PARSING_CONTENT_LEN, "Error parsing content length" }, - { SAL_ERR_CONNECTION_TIMEOUT, "Error Connection timed out" }, - { SAL_ERR_FILE_OPEN_FAILED, "Error opening file" } - }; - - for (t = 0; t < sizeof(g_sal_err_map) / sizeof(sal_err_map_t); t++) - { - if (e == g_sal_err_map[t].code) - return (char *) g_sal_err_map[t].decode; - } - - return 0; - } - - - - - - - - int duck_open(const char *fname, unsigned long user_data); - - void duck_close(int ghndl); - - int duck_read(int ghndl, unsigned char *buf, int nbytes); - - int64_t duck_seek(int g_hndl, int64_t offs, int origin); - - int duck_read_finished(int han, int flag); /* FWG 7-9-99 */ - - int duck_name(int handle, char name[], size_t max_len); /* EMH 9-23-03 */ - - int duck_read_blocking(int handle, unsigned char *buffer, int bytes); /* EMH 9-23-03 */ - - int64_t duck_available_data(int handle); /* EMH 10-23-03 */ - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/vp8/common/findnearmv.h b/vp8/common/findnearmv.h index 01909b937..a3443d765 100644 --- a/vp8/common/findnearmv.h +++ b/vp8/common/findnearmv.h @@ -60,10 +60,10 @@ static unsigned int vp8_check_mv_bounds(int_mv *mv, int mb_to_left_edge, int mb_to_bottom_edge) { unsigned int need_to_clamp; - need_to_clamp = (mv->as_mv.col < mb_to_left_edge) ? 1 : 0; - need_to_clamp |= (mv->as_mv.col > mb_to_right_edge) ? 1 : 0; - need_to_clamp |= (mv->as_mv.row < mb_to_top_edge) ? 1 : 0; - need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge) ? 1 : 0; + need_to_clamp = (mv->as_mv.col < mb_to_left_edge); + need_to_clamp |= (mv->as_mv.col > mb_to_right_edge); + need_to_clamp |= (mv->as_mv.row < mb_to_top_edge); + need_to_clamp |= (mv->as_mv.row > mb_to_bottom_edge); return need_to_clamp; } diff --git a/vp8/common/g_common.h b/vp8/common/g_common.h deleted file mode 100644 index 5f523980b..000000000 --- a/vp8/common/g_common.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -extern void (*vp8_clear_system_state)(void); -extern void (*vp8_plane_add_noise)(unsigned char *Start, unsigned int Width, unsigned int Height, int Pitch, int DPitch, int q); -extern void (*de_interlace) -( - unsigned char *src_ptr, - unsigned char *dst_ptr, - int Width, - int Height, - int Stride -); diff --git a/vp8/common/generic/systemdependent.c b/vp8/common/generic/systemdependent.c index dbf8d6504..01d76206d 100644 --- a/vp8/common/generic/systemdependent.c +++ b/vp8/common/generic/systemdependent.c @@ -10,7 +10,6 @@ #include "vpx_config.h" -#include "vp8/common/g_common.h" #include "vp8/common/subpixel.h" #include "vp8/common/loopfilter.h" #include "vp8/common/recon.h" diff --git a/vp8/common/invtrans.h b/vp8/common/invtrans.h index 7eec58e26..2bcbeeccf 100644 --- a/vp8/common/invtrans.h +++ b/vp8/common/invtrans.h @@ -17,6 +17,10 @@ #include "blockd.h" #include "onyxc_int.h" +#if CONFIG_MULTITHREAD +#include "vpx_mem/vpx_mem.h" +#endif + static void eob_adjust(char *eobs, short *diff) { /* eob adjust.... the idct can only skip if both the dc and eob are zero */ @@ -36,6 +40,10 @@ static void vp8_inverse_transform_mby(MACROBLOCKD *xd, /* save the dc dequant constant in case it is overridden */ short dc_dequant_temp = DQC[0]; +#if CONFIG_MULTITHREAD + DECLARE_ALIGNED(16, short, local_dequant[16]); +#endif + if (xd->mode_info_context->mbmi.mode != SPLITMV) { /* do 2nd order transform on the dc block */ @@ -51,11 +59,18 @@ static void vp8_inverse_transform_mby(MACROBLOCKD *xd, } eob_adjust(xd->eobs, xd->qcoeff); +#if CONFIG_MULTITHREAD + DQC = local_dequant; + + vpx_memcpy(DQC, xd->block[0].dequant, + sizeof(local_dequant)); +#endif + /* override the dc dequant constant */ DQC[0] = 1; } DEQUANT_INVOKE (&rtcd->dequant, idct_add_y_block) - (xd->qcoeff, xd->block[0].dequant, + (xd->qcoeff, DQC, xd->dst.y_buffer, xd->dst.y_stride, xd->eobs); diff --git a/vp8/common/littlend.h b/vp8/common/littlend.h deleted file mode 100644 index 99df1164c..000000000 --- a/vp8/common/littlend.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -#ifndef _littlend_h -#define _littlend_h - -#if defined(__cplusplus) -extern "C" { -#endif - -#define invert2(x) (x) -#define invert4(x) (x) - -#define low_byte(x) (unsigned char)x -#define mid1Byte(x) (unsigned char)(x >> 8) -#define mid2Byte(x) (unsigned char)(x >> 16) -#define high_byte(x) (unsigned char)(x >> 24) - -#define SWAPENDS 0 - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/vp8/common/onyx.h b/vp8/common/onyx.h index 37fa5a0cd..d17a32b82 100644 --- a/vp8/common/onyx.h +++ b/vp8/common/onyx.h @@ -22,9 +22,9 @@ extern "C" #include "vpx/vp8cx.h" #include "vpx/vpx_encoder.h" #include "vpx_scale/yv12config.h" -#include "type_aliases.h" #include "ppflags.h" - typedef int *VP8_PTR; + + struct VP8_COMP; /* Create/destroy static data structures. */ @@ -226,27 +226,27 @@ extern "C" void vp8_initialize(); - VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf); - void vp8_remove_compressor(VP8_PTR *comp); + struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf); + void vp8_remove_compressor(struct VP8_COMP* *comp); - void vp8_init_config(VP8_PTR onyx, VP8_CONFIG *oxcf); - void vp8_change_config(VP8_PTR onyx, VP8_CONFIG *oxcf); + void vp8_init_config(struct VP8_COMP* onyx, VP8_CONFIG *oxcf); + void vp8_change_config(struct VP8_COMP* onyx, VP8_CONFIG *oxcf); // receive a frames worth of data caller can assume that a copy of this frame is made // and not just a copy of the pointer.. - int vp8_receive_raw_frame(VP8_PTR comp, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time_stamp); - int vp8_get_compressed_data(VP8_PTR comp, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, unsigned char *dest_end, int64_t *time_stamp, int64_t *time_end, int flush); - int vp8_get_preview_raw_frame(VP8_PTR comp, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *flags); - - int vp8_use_as_reference(VP8_PTR comp, int ref_frame_flags); - int vp8_update_reference(VP8_PTR comp, int ref_frame_flags); - int vp8_get_reference(VP8_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); - int vp8_set_reference(VP8_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); - int vp8_update_entropy(VP8_PTR comp, int update); - int vp8_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4]); - int vp8_set_active_map(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols); - int vp8_set_internal_size(VP8_PTR comp, VPX_SCALING horiz_mode, VPX_SCALING vert_mode); - int vp8_get_quantizer(VP8_PTR c); + int vp8_receive_raw_frame(struct VP8_COMP* comp, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time_stamp); + int vp8_get_compressed_data(struct VP8_COMP* comp, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, unsigned char *dest_end, int64_t *time_stamp, int64_t *time_end, int flush); + int vp8_get_preview_raw_frame(struct VP8_COMP* comp, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *flags); + + int vp8_use_as_reference(struct VP8_COMP* comp, int ref_frame_flags); + int vp8_update_reference(struct VP8_COMP* comp, int ref_frame_flags); + int vp8_get_reference(struct VP8_COMP* comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); + int vp8_set_reference(struct VP8_COMP* comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); + int vp8_update_entropy(struct VP8_COMP* comp, int update); + int vp8_set_roimap(struct VP8_COMP* comp, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4]); + int vp8_set_active_map(struct VP8_COMP* comp, unsigned char *map, unsigned int rows, unsigned int cols); + int vp8_set_internal_size(struct VP8_COMP* comp, VPX_SCALING horiz_mode, VPX_SCALING vert_mode); + int vp8_get_quantizer(struct VP8_COMP* c); #ifdef __cplusplus } diff --git a/vp8/common/onyxd.h b/vp8/common/onyxd.h index 43fa00bd3..35a8b6e55 100644 --- a/vp8/common/onyxd.h +++ b/vp8/common/onyxd.h @@ -18,13 +18,13 @@ extern "C" { #endif -#include "type_aliases.h" #include "vpx_scale/yv12config.h" #include "ppflags.h" #include "vpx_ports/mem.h" #include "vpx/vpx_codec.h" - typedef void *VP8D_PTR; + struct VP8D_COMP; + typedef struct { int Width; @@ -49,19 +49,19 @@ extern "C" void vp8dx_initialize(void); - void vp8dx_set_setting(VP8D_PTR comp, VP8D_SETTING oxst, int x); + void vp8dx_set_setting(struct VP8D_COMP* comp, VP8D_SETTING oxst, int x); - int vp8dx_get_setting(VP8D_PTR comp, VP8D_SETTING oxst); + int vp8dx_get_setting(struct VP8D_COMP* comp, VP8D_SETTING oxst); - int vp8dx_receive_compressed_data(VP8D_PTR comp, unsigned long size, const unsigned char *dest, int64_t time_stamp); - int vp8dx_get_raw_frame(VP8D_PTR comp, YV12_BUFFER_CONFIG *sd, int64_t *time_stamp, int64_t *time_end_stamp, vp8_ppflags_t *flags); + int vp8dx_receive_compressed_data(struct VP8D_COMP* comp, unsigned long size, const unsigned char *dest, int64_t time_stamp); + int vp8dx_get_raw_frame(struct VP8D_COMP* comp, YV12_BUFFER_CONFIG *sd, int64_t *time_stamp, int64_t *time_end_stamp, vp8_ppflags_t *flags); - vpx_codec_err_t vp8dx_get_reference(VP8D_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); - vpx_codec_err_t vp8dx_set_reference(VP8D_PTR comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); + vpx_codec_err_t vp8dx_get_reference(struct VP8D_COMP* comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); + vpx_codec_err_t vp8dx_set_reference(struct VP8D_COMP* comp, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd); - VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf); + struct VP8D_COMP* vp8dx_create_decompressor(VP8D_CONFIG *oxcf); - void vp8dx_remove_decompressor(VP8D_PTR comp); + void vp8dx_remove_decompressor(struct VP8D_COMP* comp); #ifdef __cplusplus } diff --git a/vp8/common/ppc/systemdependent.c b/vp8/common/ppc/systemdependent.c index 1f5d79068..7046a63e8 100644 --- a/vp8/common/ppc/systemdependent.c +++ b/vp8/common/ppc/systemdependent.c @@ -9,7 +9,6 @@ */ -#include "g_common.h" #include "subpixel.h" #include "loopfilter.h" #include "recon.h" diff --git a/vp8/common/type_aliases.h b/vp8/common/type_aliases.h deleted file mode 100644 index 22b531a76..000000000 --- a/vp8/common/type_aliases.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - -/**************************************************************************** -* -* Module Title : type_aliases.h -* -* Description : Standard type aliases -* -****************************************************************************/ -#ifndef __INC_TYPE_ALIASES_H -#define __INC_TYPE_ALIASES_H - -/**************************************************************************** -* Macros -****************************************************************************/ -#define EXPORT -#define IMPORT extern /* Used to declare imported data & routines */ -#define PRIVATE static /* Used to declare & define module-local data */ -#define LOCAL static /* Used to define all persistent routine-local data */ -#define STD_IN_PATH 0 /* Standard input path */ -#define STD_OUT_PATH 1 /* Standard output path */ -#define STD_ERR_PATH 2 /* Standard error path */ -#define STD_IN_FILE stdin /* Standard input file pointer */ -#define STD_OUT_FILE stdout /* Standard output file pointer */ -#define STD_ERR_FILE stderr /* Standard error file pointer */ -#define max_int 0x7FFFFFFF - -#define __export -#define _export - -#define CCONV - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -/**************************************************************************** -* Typedefs -****************************************************************************/ -#ifndef TYPE_INT8 -#define TYPE_INT8 -typedef signed char INT8; -#endif - -#ifndef TYPE_INT16 -/*#define TYPE_INT16*/ -typedef signed short INT16; -#endif - -#ifndef TYPE_INT32 -/*#define TYPE_INT32*/ -typedef signed int INT32; -#endif - -#ifndef TYPE_UINT8 -/*#define TYPE_UINT8*/ -typedef unsigned char UINT8; -#endif - -#ifndef TYPE_UINT32 -/*#define TYPE_UINT32*/ -typedef unsigned int UINT32; -#endif - -#ifndef TYPE_UINT16 -/*#define TYPE_UINT16*/ -typedef unsigned short UINT16; -#endif - -#ifndef TYPE_BOOL -/*#define TYPE_BOOL*/ -typedef int BOOL; -#endif - -typedef unsigned char BOOLEAN; - -#ifdef _MSC_VER -typedef __int64 INT64; -#else - -#ifndef TYPE_INT64 -#ifdef _TMS320C6X -/* for now we only have 40bits */ -typedef long INT64; -#else -typedef long long INT64; -#endif -#endif - -#endif - -/* Floating point */ -typedef double FLOAT64; -typedef float FLOAT32; - -#endif diff --git a/vp8/common/x86/x86_systemdependent.c b/vp8/common/x86/x86_systemdependent.c index ad3a1f76b..7b831de5a 100644 --- a/vp8/common/x86/x86_systemdependent.c +++ b/vp8/common/x86/x86_systemdependent.c @@ -11,7 +11,6 @@ #include "vpx_config.h" #include "vpx_ports/x86.h" -#include "vp8/common/g_common.h" #include "vp8/common/subpixel.h" #include "vp8/common/loopfilter.h" #include "vp8/common/recon.h" diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index 003babbbc..11d0e38f5 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -484,7 +484,8 @@ static void setup_token_decoder(VP8D_COMP *pbi, const unsigned char* token_part_sizes) { vp8_reader *bool_decoder = &pbi->bc2; - int fragment_idx, partition_idx; + unsigned int partition_idx; + int fragment_idx; int num_token_partitions; const unsigned char *first_fragment_end = pbi->fragments[0] + pbi->fragment_sizes[0]; diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c index 1d4568593..ba94c58bb 100644 --- a/vp8/decoder/detokenize.c +++ b/vp8/decoder/detokenize.c @@ -15,7 +15,7 @@ #include "vpx_ports/mem.h" #include "detokenize.h" -#define BOOL_DATA UINT8 +#define BOOL_DATA unsigned char #define OCB_X PREV_COEF_CONTEXTS * ENTROPY_NODES DECLARE_ALIGNED(16, static const unsigned char, coef_bands_x[16]) = @@ -157,10 +157,10 @@ DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]); DECODE_AND_APPLYSIGN(val) \ Prob = coef_probs + (ENTROPY_NODES*2); \ if(c < 15){\ - qcoeff_ptr [ scan[c] ] = (INT16) v; \ + qcoeff_ptr [ scan[c] ] = (int16_t) v; \ ++c; \ goto DO_WHILE; }\ - qcoeff_ptr [ 15 ] = (INT16) v; \ + qcoeff_ptr [ 15 ] = (int16_t) v; \ goto BLOCK_FINISHED; @@ -172,7 +172,7 @@ DECLARE_ALIGNED(16, extern const unsigned char, vp8_norm[256]); {\ range = range-split;\ value = value-bigsplit;\ - val += ((UINT16)1<<bits_count);\ + val += ((uint16_t)1<<bits_count);\ }\ else\ {\ @@ -340,12 +340,12 @@ ONE_CONTEXT_NODE_0_: if (c < 15) { - qcoeff_ptr [ scan[c] ] = (INT16) v; + qcoeff_ptr [ scan[c] ] = (int16_t) v; ++c; goto DO_WHILE; } - qcoeff_ptr [ 15 ] = (INT16) v; + qcoeff_ptr [ 15 ] = (int16_t) v; BLOCK_FINISHED: eobs[i] = c; eobtotal += c; diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c index cf525f4a9..80648d39f 100644 --- a/vp8/decoder/onyxd_if.c +++ b/vp8/decoder/onyxd_if.c @@ -20,7 +20,6 @@ #include "vpx_scale/yv12extend.h" #include "vp8/common/loopfilter.h" #include "vp8/common/swapyv12buffer.h" -#include "vp8/common/g_common.h" #include "vp8/common/threading.h" #include "decoderthreading.h" #include <stdio.h> @@ -57,7 +56,7 @@ void vp8dx_initialize() } -VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf) +struct VP8D_COMP * vp8dx_create_decompressor(VP8D_CONFIG *oxcf) { VP8D_COMP *pbi = vpx_memalign(32, sizeof(VP8D_COMP)); @@ -117,14 +116,12 @@ VP8D_PTR vp8dx_create_decompressor(VP8D_CONFIG *oxcf) */ pbi->independent_partitions = 0; - return (VP8D_PTR) pbi; + return pbi; } -void vp8dx_remove_decompressor(VP8D_PTR ptr) +void vp8dx_remove_decompressor(VP8D_COMP *pbi) { - VP8D_COMP *pbi = (VP8D_COMP *) ptr; - if (!pbi) return; @@ -142,9 +139,8 @@ void vp8dx_remove_decompressor(VP8D_PTR ptr) } -vpx_codec_err_t vp8dx_get_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) +vpx_codec_err_t vp8dx_get_reference(VP8D_COMP *pbi, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) { - VP8D_COMP *pbi = (VP8D_COMP *) ptr; VP8_COMMON *cm = &pbi->common; int ref_fb_idx; @@ -174,9 +170,8 @@ vpx_codec_err_t vp8dx_get_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, Y } -vpx_codec_err_t vp8dx_set_reference(VP8D_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) +vpx_codec_err_t vp8dx_set_reference(VP8D_COMP *pbi, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) { - VP8D_COMP *pbi = (VP8D_COMP *) ptr; VP8_COMMON *cm = &pbi->common; int *ref_fb_ptr = NULL; int free_fb; @@ -301,19 +296,18 @@ static int swap_frame_buffers (VP8_COMMON *cm) return err; } -int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsigned char *source, int64_t time_stamp) +int vp8dx_receive_compressed_data(VP8D_COMP *pbi, unsigned long size, const unsigned char *source, int64_t time_stamp) { #if HAVE_ARMV7 int64_t dx_store_reg[8]; #endif - VP8D_COMP *pbi = (VP8D_COMP *) ptr; VP8_COMMON *cm = &pbi->common; int retcode = 0; /*if(pbi->ready_for_new_data == 0) return -1;*/ - if (ptr == 0) + if (pbi == 0) { return -1; } @@ -575,10 +569,9 @@ int vp8dx_receive_compressed_data(VP8D_PTR ptr, unsigned long size, const unsign pbi->common.error.setjmp = 0; return retcode; } -int vp8dx_get_raw_frame(VP8D_PTR ptr, YV12_BUFFER_CONFIG *sd, int64_t *time_stamp, int64_t *time_end_stamp, vp8_ppflags_t *flags) +int vp8dx_get_raw_frame(VP8D_COMP *pbi, YV12_BUFFER_CONFIG *sd, int64_t *time_stamp, int64_t *time_end_stamp, vp8_ppflags_t *flags) { int ret = -1; - VP8D_COMP *pbi = (VP8D_COMP *) ptr; if (pbi->ready_for_new_data == 1) return ret; diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h index f48f5173b..cb2593b2c 100644 --- a/vp8/decoder/onyxd_int.h +++ b/vp8/decoder/onyxd_int.h @@ -44,7 +44,7 @@ typedef struct } DATARATE; -typedef struct VP8Decompressor +typedef struct VP8D_COMP { DECLARE_ALIGNED(16, MACROBLOCKD, mb); diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c index 2a5502f88..669bfad9a 100644 --- a/vp8/encoder/bitstream.c +++ b/vp8/encoder/bitstream.c @@ -1206,7 +1206,7 @@ static void sum_probs_over_prev_coef_context( { for (j=0; j < PREV_COEF_CONTEXTS; ++j) { - const int tmp = out[i]; + const unsigned int tmp = out[i]; out[i] += probs[j][i]; /* check for wrap */ if (out[i] < tmp) @@ -1644,20 +1644,20 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned char * dest // Signal whether or not Segmentation is enabled - vp8_write_bit(bc, (xd->segmentation_enabled) ? 1 : 0); + vp8_write_bit(bc, xd->segmentation_enabled); // Indicate which features are enabled if (xd->segmentation_enabled) { // Signal whether or not the segmentation map is being updated. - vp8_write_bit(bc, (xd->update_mb_segmentation_map) ? 1 : 0); - vp8_write_bit(bc, (xd->update_mb_segmentation_data) ? 1 : 0); + vp8_write_bit(bc, xd->update_mb_segmentation_map); + vp8_write_bit(bc, xd->update_mb_segmentation_data); if (xd->update_mb_segmentation_data) { signed char Data; - vp8_write_bit(bc, (xd->mb_segement_abs_delta) ? 1 : 0); + vp8_write_bit(bc, xd->mb_segement_abs_delta); // For each segmentation feature (Quant and loop filter level) for (i = 0; i < MB_LVL_MAX; i++) @@ -1714,7 +1714,7 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned char * dest vp8_write_literal(bc, pc->sharpness_level, 3); // Write out loop filter deltas applied at the MB level based on mode or ref frame (if they are enabled). - vp8_write_bit(bc, (xd->mode_ref_lf_delta_enabled) ? 1 : 0); + vp8_write_bit(bc, xd->mode_ref_lf_delta_enabled); if (xd->mode_ref_lf_delta_enabled) { diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h index 5e5a60db7..0a74ca46d 100644 --- a/vp8/encoder/block.h +++ b/vp8/encoder/block.h @@ -45,10 +45,6 @@ typedef struct unsigned char **base_src; int src; int src_stride; - -// MV enc_mv; - int force_empty; - } BLOCK; typedef struct @@ -107,7 +103,6 @@ typedef struct int mv_row_min; int mv_row_max; - int vector_range; // Used to monitor limiting range of recent vectors to guide search. int skip; int encode_breakout; diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index 88868d684..6a9ba291d 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -595,8 +595,6 @@ void init_encode_frame_mb_context(VP8_COMP *cpi) // Activity map pointer x->mb_activity_ptr = cpi->mb_activity_map; - x->vector_range = 32; - x->act_zbin_adj = 0; x->partition_info = x->pi; diff --git a/vp8/encoder/encodeintra.c b/vp8/encoder/encodeintra.c index 4378b634e..16393a1ff 100644 --- a/vp8/encoder/encodeintra.c +++ b/vp8/encoder/encodeintra.c @@ -18,7 +18,6 @@ #include "vp8/common/invtrans.h" #include "vp8/common/recon.h" #include "dct.h" -#include "vp8/common/g_common.h" #include "encodeintra.h" diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c index 8c496686a..69655989d 100644 --- a/vp8/encoder/ethreading.c +++ b/vp8/encoder/ethreading.c @@ -38,7 +38,7 @@ static THREAD_FUNCTION loopfilter_thread(void *p_data) if (sem_wait(&cpi->h_event_start_lpf) == 0) { - if (cpi->b_multi_threaded == FALSE) // we're shutting down + if (cpi->b_multi_threaded == 0) // we're shutting down break; loopfilter_frame(cpi, cm); @@ -78,7 +78,7 @@ THREAD_FUNCTION thread_encoding_proc(void *p_data) int *segment_counts = mbri->segment_counts; int *totalrate = &mbri->totalrate; - if (cpi->b_multi_threaded == FALSE) // we're shutting down + if (cpi->b_multi_threaded == 0) // we're shutting down break; for (mb_row = ithread + 1; mb_row < cm->mb_rows; mb_row += (cpi->encoding_thread_count + 1)) @@ -302,7 +302,6 @@ static void setup_mbby_copy(MACROBLOCK *mbdst, MACROBLOCK *mbsrc) z->mv_col_max = x->mv_col_max; z->mv_row_min = x->mv_row_min; z->mv_row_max = x->mv_row_max; - z->vector_range = x->vector_range ; */ z->vp8_short_fdct4x4 = x->vp8_short_fdct4x4; @@ -350,8 +349,6 @@ static void setup_mbby_copy(MACROBLOCK *mbdst, MACROBLOCK *mbsrc) z->block[i].src = x->block[i].src; */ z->block[i].src_stride = x->block[i].src_stride; - z->block[i].force_empty = x->block[i].force_empty; - } { @@ -421,8 +418,6 @@ void vp8cx_init_mbrthread_data(VP8_COMP *cpi, #endif mb->gf_active_ptr = x->gf_active_ptr; - mb->vector_range = 32; - vpx_memset(mbr_ei[i].segment_counts, 0, sizeof(mbr_ei[i].segment_counts)); mbr_ei[i].totalrate = 0; diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c index 74bcb1569..346c06f32 100644 --- a/vp8/encoder/firstpass.c +++ b/vp8/encoder/firstpass.c @@ -861,7 +861,7 @@ double bitcost( double prob ) { return -(log( prob ) / log( 2.0 )); } -static long long estimate_modemvcost(VP8_COMP *cpi, +static int64_t estimate_modemvcost(VP8_COMP *cpi, FIRSTPASS_STATS * fpstats) { int mv_cost; @@ -1376,7 +1376,7 @@ static int detect_transition_to_still( double loop_decay_rate, double decay_accumulator ) { - BOOL trans_to_still = FALSE; + int trans_to_still = 0; // Break clause to detect very still sections after motion // For example a static image after a fade or other transition @@ -1406,7 +1406,7 @@ static int detect_transition_to_still( // Only if it does do we signal a transition to still if ( j == still_interval ) - trans_to_still = TRUE; + trans_to_still = 1; } return trans_to_still; @@ -1415,14 +1415,14 @@ static int detect_transition_to_still( // This function detects a flash through the high relative pcnt_second_ref // score in the frame following a flash frame. The offset passed in should // reflect this -static BOOL detect_flash( VP8_COMP *cpi, int offset ) +static int detect_flash( VP8_COMP *cpi, int offset ) { FIRSTPASS_STATS next_frame; - BOOL flash_detected = FALSE; + int flash_detected = 0; // Read the frame data. - // The return is FALSE (no flash detected) if not a valid frame + // The return is 0 (no flash detected) if not a valid frame if ( read_frame_stats(cpi, &next_frame, offset) != EOF ) { // What we are looking for here is a situation where there is a @@ -1433,7 +1433,7 @@ static BOOL detect_flash( VP8_COMP *cpi, int offset ) if ( (next_frame.pcnt_second_ref > next_frame.pcnt_inter) && (next_frame.pcnt_second_ref >= 0.5 ) ) { - flash_detected = TRUE; + flash_detected = 1; /*if (1) { @@ -1548,7 +1548,7 @@ static int calc_arf_boost( double mv_in_out_accumulator = 0.0; double abs_mv_in_out_accumulator = 0.0; double r; - BOOL flash_detected = FALSE; + int flash_detected = 0; // Search forward from the proposed arf/next gf position for ( i = 0; i < f_frames; i++ ) @@ -1677,7 +1677,7 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) int alt_boost = 0; int f_boost = 0; int b_boost = 0; - BOOL flash_detected; + int flash_detected; cpi->twopass.gf_group_bits = 0; cpi->twopass.gf_decay_rate = 0; @@ -1751,7 +1751,7 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) loop_decay_rate, decay_accumulator ) ) { - allow_alt_ref = FALSE; + allow_alt_ref = 0; boost_score = old_boost_score; break; } @@ -1923,7 +1923,7 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) int frames_bwd = cpi->oxcf.arnr_max_frames - 1; int frames_fwd = cpi->oxcf.arnr_max_frames - 1; - cpi->source_alt_ref_pending = TRUE; + cpi->source_alt_ref_pending = 1; // For alt ref frames the error score for the end frame of the // group (the alt ref frame) should not contribute to the group @@ -1989,13 +1989,13 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) } else { - cpi->source_alt_ref_pending = FALSE; + cpi->source_alt_ref_pending = 0; cpi->baseline_gf_interval = i; } } else { - cpi->source_alt_ref_pending = FALSE; + cpi->source_alt_ref_pending = 0; cpi->baseline_gf_interval = i; } @@ -2341,7 +2341,7 @@ void vp8_second_pass(VP8_COMP *cpi) cpi->twopass.gf_group_error_left = cpi->twopass.kf_group_error_left; cpi->baseline_gf_interval = cpi->twopass.frames_to_key; cpi->frames_till_gf_update_due = cpi->baseline_gf_interval; - cpi->source_alt_ref_pending = FALSE; + cpi->source_alt_ref_pending = 0; } } @@ -2493,9 +2493,9 @@ void vp8_second_pass(VP8_COMP *cpi) } -static BOOL test_candidate_kf(VP8_COMP *cpi, FIRSTPASS_STATS *last_frame, FIRSTPASS_STATS *this_frame, FIRSTPASS_STATS *next_frame) +static int test_candidate_kf(VP8_COMP *cpi, FIRSTPASS_STATS *last_frame, FIRSTPASS_STATS *this_frame, FIRSTPASS_STATS *next_frame) { - BOOL is_viable_kf = FALSE; + int is_viable_kf = 0; // Does the frame satisfy the primary criteria of a key frame // If so, then examine how well it predicts subsequent frames @@ -2569,13 +2569,13 @@ static BOOL test_candidate_kf(VP8_COMP *cpi, FIRSTPASS_STATS *last_frame, FIRST // If there is tolerable prediction for at least the next 3 frames then break out else discard this pottential key frame and move on if (boost_score > 5.0 && (i > 3)) - is_viable_kf = TRUE; + is_viable_kf = 1; else { // Reset the file position reset_fpf_position(cpi, start_pos); - is_viable_kf = FALSE; + is_viable_kf = 0; } } @@ -2611,7 +2611,7 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) cpi->this_key_frame_forced = cpi->next_key_frame_forced; // Clear the alt ref active flag as this can never be active on a key frame - cpi->source_alt_ref_active = FALSE; + cpi->source_alt_ref_active = 0; // Kf is always a gf so clear frames till next gf counter cpi->frames_till_gf_update_due = 0; @@ -2727,10 +2727,10 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) // Reset to the start of the group reset_fpf_position(cpi, current_pos); - cpi->next_key_frame_forced = TRUE; + cpi->next_key_frame_forced = 1; } else - cpi->next_key_frame_forced = FALSE; + cpi->next_key_frame_forced = 0; // Special case for the last frame of the file if (cpi->twopass.stats_in >= cpi->twopass.stats_in_end) @@ -3034,8 +3034,8 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) if (cpi->oxcf.allow_spatial_resampling) { - int resample_trigger = FALSE; - int last_kf_resampled = FALSE; + int resample_trigger = 0; + int last_kf_resampled = 0; int kf_q; int scale_val = 0; int hr, hs, vr, vs; @@ -3053,7 +3053,7 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) double effective_size_ratio; if ((cpi->common.Width != cpi->oxcf.Width) || (cpi->common.Height != cpi->oxcf.Height)) - last_kf_resampled = TRUE; + last_kf_resampled = 1; // Set back to unscaled by defaults cpi->common.horiz_scale = NORMAL; @@ -3117,9 +3117,9 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) (last_kf_resampled && (projected_buffer_level < (cpi->oxcf.resample_up_water_mark * cpi->oxcf.optimal_buffer_level / 100)))) //( ((cpi->buffer_level < (cpi->oxcf.resample_down_water_mark * cpi->oxcf.optimal_buffer_level / 100))) && // ((projected_buffer_level < (cpi->oxcf.resample_up_water_mark * cpi->oxcf.optimal_buffer_level / 100))) )) - resample_trigger = TRUE; + resample_trigger = 1; else - resample_trigger = FALSE; + resample_trigger = 0; } else { @@ -3129,9 +3129,9 @@ static void find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) if ((last_kf_resampled && (kf_q > cpi->worst_quality)) || // If triggered last time the threshold for triggering again is reduced ((kf_q > cpi->worst_quality) && // Projected Q higher than allowed and ... (over_spend > clip_bits / 20))) // ... Overspend > 5% of total bits - resample_trigger = TRUE; + resample_trigger = 1; else - resample_trigger = FALSE; + resample_trigger = 0; } diff --git a/vp8/encoder/lookahead.c b/vp8/encoder/lookahead.c index b92e82bdf..3e582e369 100644 --- a/vp8/encoder/lookahead.c +++ b/vp8/encoder/lookahead.c @@ -48,7 +48,7 @@ vp8_lookahead_destroy(struct lookahead_ctx *ctx) { if(ctx->buf) { - int i; + unsigned int i; for(i = 0; i < ctx->max_sz; i++) vp8_yv12_de_alloc_frame_buffer(&ctx->buf[i].img); @@ -65,7 +65,7 @@ vp8_lookahead_init(unsigned int width, unsigned int depth) { struct lookahead_ctx *ctx = NULL; - int i; + unsigned int i; /* Clamp the lookahead queue depth */ if(depth < 1) @@ -188,7 +188,7 @@ vp8_lookahead_pop(struct lookahead_ctx *ctx, struct lookahead_entry* vp8_lookahead_peek(struct lookahead_ctx *ctx, - int index) + unsigned int index) { struct lookahead_entry* buf = NULL; diff --git a/vp8/encoder/lookahead.h b/vp8/encoder/lookahead.h index afb3fd4a9..32bafcd63 100644 --- a/vp8/encoder/lookahead.h +++ b/vp8/encoder/lookahead.h @@ -92,7 +92,7 @@ vp8_lookahead_pop(struct lookahead_ctx *ctx, */ struct lookahead_entry* vp8_lookahead_peek(struct lookahead_ctx *ctx, - int index); + unsigned int index); /**\brief Get the number of frames currently in the lookahead queue diff --git a/vp8/encoder/mcomp.c b/vp8/encoder/mcomp.c index 9d963832a..735af95ca 100644 --- a/vp8/encoder/mcomp.c +++ b/vp8/encoder/mcomp.c @@ -1156,7 +1156,7 @@ int vp8_diamond_search_sadx4 int tot_steps; int_mv this_mv; - int bestsad = INT_MAX; + unsigned int bestsad = UINT_MAX; int best_site = 0; int last_site = 0; @@ -1397,7 +1397,7 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, unsigned char *bestaddress; int_mv *best_mv = &d->bmi.mv; int_mv this_mv; - int bestsad = INT_MAX; + unsigned int bestsad = UINT_MAX; int r, c; unsigned char *check_here; @@ -1527,7 +1527,7 @@ int vp8_full_search_sadx8(MACROBLOCK *x, BLOCK *b, BLOCKD *d, int_mv *ref_mv, unsigned char *bestaddress; int_mv *best_mv = &d->bmi.mv; int_mv this_mv; - int bestsad = INT_MAX; + unsigned int bestsad = UINT_MAX; int r, c; unsigned char *check_here; diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index 33b961877..e3f951925 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -23,7 +23,6 @@ #include "ratectrl.h" #include "vp8/common/quant_common.h" #include "segmentation.h" -#include "vp8/common/g_common.h" #include "vpx_scale/yv12extend.h" #if CONFIG_POSTPROC #include "vp8/common/postproc.h" @@ -383,29 +382,23 @@ static void dealloc_compressor_data(VP8_COMP *cpi) cpi->mb.pip = 0; } -static void enable_segmentation(VP8_PTR ptr) +static void enable_segmentation(VP8_COMP *cpi) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); - // Set the appropriate feature bit cpi->mb.e_mbd.segmentation_enabled = 1; cpi->mb.e_mbd.update_mb_segmentation_map = 1; cpi->mb.e_mbd.update_mb_segmentation_data = 1; } -static void disable_segmentation(VP8_PTR ptr) +static void disable_segmentation(VP8_COMP *cpi) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); - // Clear the appropriate feature bit cpi->mb.e_mbd.segmentation_enabled = 0; } // Valid values for a segment are 0 to 3 // Segmentation map is arrange as [Rows][Columns] -static void set_segmentation_map(VP8_PTR ptr, unsigned char *segmentation_map) +static void set_segmentation_map(VP8_COMP *cpi, unsigned char *segmentation_map) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); - // Copy in the new segmentation map vpx_memcpy(cpi->segmentation_map, segmentation_map, (cpi->common.mb_rows * cpi->common.mb_cols)); @@ -422,19 +415,15 @@ static void set_segmentation_map(VP8_PTR ptr, unsigned char *segmentation_map) // abs_delta = SEGMENT_DELTADATA (deltas) abs_delta = SEGMENT_ABSDATA (use the absolute values given). // // -static void set_segment_data(VP8_PTR ptr, signed char *feature_data, unsigned char abs_delta) +static void set_segment_data(VP8_COMP *cpi, signed char *feature_data, unsigned char abs_delta) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); - cpi->mb.e_mbd.mb_segement_abs_delta = abs_delta; vpx_memcpy(cpi->segment_feature_data, feature_data, sizeof(cpi->segment_feature_data)); } -static void segmentation_test_function(VP8_PTR ptr) +static void segmentation_test_function(VP8_COMP *cpi) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); - unsigned char *seg_map; signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; @@ -462,10 +451,10 @@ static void segmentation_test_function(VP8_PTR ptr) }*/ // Set the segmentation Map - set_segmentation_map(ptr, seg_map); + set_segmentation_map(cpi, seg_map); // Activate segmentation. - enable_segmentation(ptr); + enable_segmentation(cpi); // Set up the quant segment data feature_data[MB_LVL_ALT_Q][0] = 0; @@ -480,7 +469,7 @@ static void segmentation_test_function(VP8_PTR ptr) // Initialise the feature data structure // SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1 - set_segment_data(ptr, &feature_data[0][0], SEGMENT_DELTADATA); + set_segment_data(cpi, &feature_data[0][0], SEGMENT_DELTADATA); // Delete sementation map vpx_free(seg_map); @@ -554,10 +543,10 @@ static void cyclic_background_refresh(VP8_COMP *cpi, int Q, int lf_adjustment) } // Set the segmentation Map - set_segmentation_map((VP8_PTR)cpi, seg_map); + set_segmentation_map(cpi, seg_map); // Activate segmentation. - enable_segmentation((VP8_PTR)cpi); + enable_segmentation(cpi); // Set up the quant segment data feature_data[MB_LVL_ALT_Q][0] = 0; @@ -573,7 +562,7 @@ static void cyclic_background_refresh(VP8_COMP *cpi, int Q, int lf_adjustment) // Initialise the feature data structure // SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1 - set_segment_data((VP8_PTR)cpi, &feature_data[0][0], SEGMENT_DELTADATA); + set_segment_data(cpi, &feature_data[0][0], SEGMENT_DELTADATA); // Delete sementation map vpx_free(seg_map); @@ -602,6 +591,93 @@ static void set_default_lf_deltas(VP8_COMP *cpi) cpi->mb.e_mbd.mode_lf_deltas[3] = 4; // Split mv } +/* Convenience macros for mapping speed and mode into a continuous + * range + */ +#define GOOD(x) (x+1) +#define RT(x) (x+7) + +static int speed_map(int speed, int *map) +{ + int res; + + do + { + res = *map++; + } while(speed >= *map++); + return res; +} + +static int thresh_mult_map_znn[] = { + /* map common to zero, nearest, and near */ + 0, GOOD(2), 1500, GOOD(3), 2000, RT(0), 1000, RT(2), 2000, INT_MAX +}; + +static int thresh_mult_map_vhpred[] = { + 1000, GOOD(2), 1500, GOOD(3), 2000, RT(0), 1000, RT(1), 2000, + RT(7), INT_MAX, INT_MAX +}; + +static int thresh_mult_map_bpred[] = { + 2000, GOOD(0), 2500, GOOD(2), 5000, GOOD(3), 7500, RT(0), 2500, RT(1), 5000, + RT(6), INT_MAX, INT_MAX +}; + +static int thresh_mult_map_tm[] = { + 1000, GOOD(2), 1500, GOOD(3), 2000, RT(0), 0, RT(1), 1000, RT(2), 2000, + RT(7), INT_MAX, INT_MAX +}; + +static int thresh_mult_map_new1[] = { + 1000, GOOD(2), 2000, RT(0), 2000, INT_MAX +}; + +static int thresh_mult_map_new2[] = { + 1000, GOOD(2), 2000, GOOD(3), 2500, GOOD(5), 4000, RT(0), 2000, RT(2), 2500, + RT(5), 4000, INT_MAX +}; + +static int thresh_mult_map_split1[] = { + 2500, GOOD(0), 1700, GOOD(2), 10000, GOOD(3), 25000, GOOD(4), INT_MAX, + RT(0), 5000, RT(1), 10000, RT(2), 25000, RT(3), INT_MAX, INT_MAX +}; + +static int thresh_mult_map_split2[] = { + 5000, GOOD(0), 4500, GOOD(2), 20000, GOOD(3), 50000, GOOD(4), INT_MAX, + RT(0), 10000, RT(1), 20000, RT(2), 50000, RT(3), INT_MAX, INT_MAX +}; + +static int mode_check_freq_map_zn2[] = { + /* {zero,nearest}{2,3} */ + 0, RT(10), 1<<1, RT(11), 1<<2, RT(12), 1<<3, INT_MAX +}; + +static int mode_check_freq_map_vhbpred[] = { + 0, GOOD(5), 2, RT(0), 0, RT(3), 2, RT(5), 4, INT_MAX +}; + +static int mode_check_freq_map_near2[] = { + 0, GOOD(5), 2, RT(0), 0, RT(3), 2, RT(10), 1<<2, RT(11), 1<<3, RT(12), 1<<4, + INT_MAX +}; + +static int mode_check_freq_map_new1[] = { + 0, RT(10), 1<<1, RT(11), 1<<2, RT(12), 1<<3, INT_MAX +}; + +static int mode_check_freq_map_new2[] = { + 0, GOOD(5), 4, RT(0), 0, RT(3), 4, RT(10), 1<<3, RT(11), 1<<4, RT(12), 1<<5, + INT_MAX +}; + +static int mode_check_freq_map_split1[] = { + 0, GOOD(2), 2, GOOD(3), 7, RT(1), 2, RT(2), 7, INT_MAX +}; + +static int mode_check_freq_map_split2[] = { + 0, GOOD(1), 2, GOOD(2), 4, GOOD(3), 15, RT(1), 4, RT(2), 15, INT_MAX +}; + void vp8_set_speed_features(VP8_COMP *cpi) { SPEED_FEATURES *sf = &cpi->sf; @@ -653,93 +729,81 @@ void vp8_set_speed_features(VP8_COMP *cpi) if (cpi->ref_frame_flags & VP8_ALT_FLAG) ref_frames++; + /* Convert speed to continuous range, with clamping */ + if (Mode == 0) + Speed = 0; + else if (Mode == 2) + Speed = RT(Speed); + else + { + if (Speed > 5) + Speed = 5; + Speed = GOOD(Speed); + } + + sf->thresh_mult[THR_ZERO1] = + sf->thresh_mult[THR_NEAREST1] = + sf->thresh_mult[THR_NEAR1] = + sf->thresh_mult[THR_DC] = 0; /* always */ + + sf->thresh_mult[THR_ZERO2] = + sf->thresh_mult[THR_ZERO3] = + sf->thresh_mult[THR_NEAREST2] = + sf->thresh_mult[THR_NEAREST3] = + sf->thresh_mult[THR_NEAR2] = + sf->thresh_mult[THR_NEAR3] = speed_map(Speed, thresh_mult_map_znn); + + sf->thresh_mult[THR_V_PRED] = + sf->thresh_mult[THR_H_PRED] = speed_map(Speed, thresh_mult_map_vhpred); + sf->thresh_mult[THR_B_PRED] = speed_map(Speed, thresh_mult_map_bpred); + sf->thresh_mult[THR_TM] = speed_map(Speed, thresh_mult_map_tm); + sf->thresh_mult[THR_NEW1] = speed_map(Speed, thresh_mult_map_new1); + sf->thresh_mult[THR_NEW2] = + sf->thresh_mult[THR_NEW3] = speed_map(Speed, thresh_mult_map_new2); + sf->thresh_mult[THR_SPLIT1] = speed_map(Speed, thresh_mult_map_split1); + sf->thresh_mult[THR_SPLIT2] = + sf->thresh_mult[THR_SPLIT3] = speed_map(Speed, thresh_mult_map_split2); + + cpi->mode_check_freq[THR_ZERO1] = + cpi->mode_check_freq[THR_NEAREST1] = + cpi->mode_check_freq[THR_NEAR1] = + cpi->mode_check_freq[THR_TM] = + cpi->mode_check_freq[THR_DC] = 0; /* always */ + + cpi->mode_check_freq[THR_ZERO2] = + cpi->mode_check_freq[THR_ZERO3] = + cpi->mode_check_freq[THR_NEAREST2] = + cpi->mode_check_freq[THR_NEAREST3] = speed_map(Speed, + mode_check_freq_map_zn2); + + cpi->mode_check_freq[THR_NEAR2] = + cpi->mode_check_freq[THR_NEAR3] = speed_map(Speed, + mode_check_freq_map_near2); + + cpi->mode_check_freq[THR_V_PRED] = + cpi->mode_check_freq[THR_H_PRED] = + cpi->mode_check_freq[THR_B_PRED] = speed_map(Speed, + mode_check_freq_map_vhbpred); + cpi->mode_check_freq[THR_NEW1] = speed_map(Speed, + mode_check_freq_map_new1); + cpi->mode_check_freq[THR_NEW2] = + cpi->mode_check_freq[THR_NEW3] = speed_map(Speed, + mode_check_freq_map_new2); + cpi->mode_check_freq[THR_SPLIT1] = speed_map(Speed, + mode_check_freq_map_split1); + cpi->mode_check_freq[THR_SPLIT2] = + cpi->mode_check_freq[THR_SPLIT3] = speed_map(Speed, + mode_check_freq_map_split2); + Speed = cpi->Speed; switch (Mode) { #if !(CONFIG_REALTIME_ONLY) case 0: // best quality mode - sf->thresh_mult[THR_ZERO1 ] = 0; - sf->thresh_mult[THR_ZERO2 ] = 0; - sf->thresh_mult[THR_ZERO3 ] = 0; - sf->thresh_mult[THR_NEAREST1 ] = 0; - sf->thresh_mult[THR_NEAREST2 ] = 0; - sf->thresh_mult[THR_NEAREST3 ] = 0; - sf->thresh_mult[THR_NEAR1 ] = 0; - sf->thresh_mult[THR_NEAR2 ] = 0; - sf->thresh_mult[THR_NEAR3 ] = 0; - - sf->thresh_mult[THR_DC ] = 0; - - sf->thresh_mult[THR_V_PRED ] = 1000; - sf->thresh_mult[THR_H_PRED ] = 1000; - sf->thresh_mult[THR_B_PRED ] = 2000; - sf->thresh_mult[THR_TM ] = 1000; - - sf->thresh_mult[THR_NEW1 ] = 1000; - sf->thresh_mult[THR_NEW2 ] = 1000; - sf->thresh_mult[THR_NEW3 ] = 1000; - - sf->thresh_mult[THR_SPLIT1 ] = 2500; - sf->thresh_mult[THR_SPLIT2 ] = 5000; - sf->thresh_mult[THR_SPLIT3 ] = 5000; - - sf->first_step = 0; sf->max_step_search_steps = MAX_MVSEARCH_STEPS; break; case 1: case 3: - sf->thresh_mult[THR_NEAREST1 ] = 0; - sf->thresh_mult[THR_ZERO1 ] = 0; - sf->thresh_mult[THR_DC ] = 0; - sf->thresh_mult[THR_NEAR1 ] = 0; - sf->thresh_mult[THR_V_PRED ] = 1000; - sf->thresh_mult[THR_H_PRED ] = 1000; - sf->thresh_mult[THR_B_PRED ] = 2500; - sf->thresh_mult[THR_TM ] = 1000; - - sf->thresh_mult[THR_NEAREST2 ] = 1000; - sf->thresh_mult[THR_NEAREST3 ] = 1000; - - sf->thresh_mult[THR_ZERO2 ] = 1000; - sf->thresh_mult[THR_ZERO3 ] = 1000; - sf->thresh_mult[THR_NEAR2 ] = 1000; - sf->thresh_mult[THR_NEAR3 ] = 1000; - -#if 1 - sf->thresh_mult[THR_ZERO1 ] = 0; - sf->thresh_mult[THR_ZERO2 ] = 0; - sf->thresh_mult[THR_ZERO3 ] = 0; - sf->thresh_mult[THR_NEAREST1 ] = 0; - sf->thresh_mult[THR_NEAREST2 ] = 0; - sf->thresh_mult[THR_NEAREST3 ] = 0; - sf->thresh_mult[THR_NEAR1 ] = 0; - sf->thresh_mult[THR_NEAR2 ] = 0; - sf->thresh_mult[THR_NEAR3 ] = 0; - -// sf->thresh_mult[THR_DC ] = 0; - -// sf->thresh_mult[THR_V_PRED ] = 1000; -// sf->thresh_mult[THR_H_PRED ] = 1000; -// sf->thresh_mult[THR_B_PRED ] = 2000; -// sf->thresh_mult[THR_TM ] = 1000; - - sf->thresh_mult[THR_NEW1 ] = 1000; - sf->thresh_mult[THR_NEW2 ] = 1000; - sf->thresh_mult[THR_NEW3 ] = 1000; - - sf->thresh_mult[THR_SPLIT1 ] = 1700; - sf->thresh_mult[THR_SPLIT2 ] = 4500; - sf->thresh_mult[THR_SPLIT3 ] = 4500; -#else - sf->thresh_mult[THR_NEW1 ] = 1500; - sf->thresh_mult[THR_NEW2 ] = 1500; - sf->thresh_mult[THR_NEW3 ] = 1500; - - sf->thresh_mult[THR_SPLIT1 ] = 5000; - sf->thresh_mult[THR_SPLIT2 ] = 10000; - sf->thresh_mult[THR_SPLIT3 ] = 10000; -#endif - if (Speed > 0) { /* Disable coefficient optimization above speed 0 */ @@ -748,83 +812,10 @@ void vp8_set_speed_features(VP8_COMP *cpi) sf->no_skip_block4x4_search = 0; sf->first_step = 1; - - cpi->mode_check_freq[THR_SPLIT2] = 2; - cpi->mode_check_freq[THR_SPLIT3] = 2; - cpi->mode_check_freq[THR_SPLIT1 ] = 0; - } - - if (Speed > 1) - { - cpi->mode_check_freq[THR_SPLIT2] = 4; - cpi->mode_check_freq[THR_SPLIT3] = 4; - cpi->mode_check_freq[THR_SPLIT1 ] = 2; - - sf->thresh_mult[THR_TM ] = 1500; - sf->thresh_mult[THR_V_PRED ] = 1500; - sf->thresh_mult[THR_H_PRED ] = 1500; - sf->thresh_mult[THR_B_PRED ] = 5000; - - if (ref_frames > 1) - { - sf->thresh_mult[THR_NEW1 ] = 2000; - sf->thresh_mult[THR_SPLIT1 ] = 10000; - } - - if (ref_frames > 2) - { - sf->thresh_mult[THR_NEAREST2 ] = 1500; - sf->thresh_mult[THR_ZERO2 ] = 1500; - sf->thresh_mult[THR_NEAR2 ] = 1500; - sf->thresh_mult[THR_NEW2 ] = 2000; - sf->thresh_mult[THR_SPLIT2 ] = 20000; - } - - if (ref_frames > 3) - { - sf->thresh_mult[THR_NEAREST3 ] = 1500; - sf->thresh_mult[THR_ZERO3 ] = 1500; - sf->thresh_mult[THR_NEAR3 ] = 1500; - sf->thresh_mult[THR_NEW3 ] = 2000; - sf->thresh_mult[THR_SPLIT3 ] = 20000; - } } if (Speed > 2) { - cpi->mode_check_freq[THR_SPLIT2] = 15; - cpi->mode_check_freq[THR_SPLIT3] = 15; - cpi->mode_check_freq[THR_SPLIT1 ] = 7; - - sf->thresh_mult[THR_TM ] = 2000; - sf->thresh_mult[THR_V_PRED ] = 2000; - sf->thresh_mult[THR_H_PRED ] = 2000; - sf->thresh_mult[THR_B_PRED ] = 7500; - - if (ref_frames > 1) - { - sf->thresh_mult[THR_NEW1 ] = 2000; - sf->thresh_mult[THR_SPLIT1 ] = 25000; - } - - if (ref_frames > 2) - { - sf->thresh_mult[THR_NEAREST2 ] = 2000; - sf->thresh_mult[THR_ZERO2 ] = 2000; - sf->thresh_mult[THR_NEAR2 ] = 2000; - sf->thresh_mult[THR_NEW2 ] = 2500; - sf->thresh_mult[THR_SPLIT2 ] = 50000; - } - - if (ref_frames > 3) - { - sf->thresh_mult[THR_NEAREST3 ] = 2000; - sf->thresh_mult[THR_ZERO3 ] = 2000; - sf->thresh_mult[THR_NEAR3 ] = 2000; - sf->thresh_mult[THR_NEW3 ] = 2500; - sf->thresh_mult[THR_SPLIT3 ] = 50000; - } - sf->improved_quant = 0; sf->improved_dct = 0; @@ -836,18 +827,6 @@ void vp8_set_speed_features(VP8_COMP *cpi) if (Speed > 3) { - sf->thresh_mult[THR_SPLIT3 ] = INT_MAX; - sf->thresh_mult[THR_SPLIT2 ] = INT_MAX; - sf->thresh_mult[THR_SPLIT1 ] = INT_MAX; - - cpi->mode_check_freq[THR_V_PRED] = 0; - cpi->mode_check_freq[THR_H_PRED] = 0; - cpi->mode_check_freq[THR_B_PRED] = 0; - cpi->mode_check_freq[THR_NEAR2] = 0; - cpi->mode_check_freq[THR_NEW2] = 0; - cpi->mode_check_freq[THR_NEAR3] = 0; - cpi->mode_check_freq[THR_NEW3] = 0; - sf->auto_filter = 1; sf->recode_loop = 0; // recode loop off sf->RD = 0; // Turn rd off @@ -857,38 +836,6 @@ void vp8_set_speed_features(VP8_COMP *cpi) if (Speed > 4) { sf->auto_filter = 0; // Faster selection of loop filter - - cpi->mode_check_freq[THR_V_PRED] = 2; - cpi->mode_check_freq[THR_H_PRED] = 2; - cpi->mode_check_freq[THR_B_PRED] = 2; - - if (ref_frames > 2) - { - cpi->mode_check_freq[THR_NEAR2] = 2; - cpi->mode_check_freq[THR_NEW2] = 4; - } - - if (ref_frames > 3) - { - cpi->mode_check_freq[THR_NEAR3] = 2; - cpi->mode_check_freq[THR_NEW3] = 4; - } - - if (ref_frames > 2) - { - sf->thresh_mult[THR_NEAREST2 ] = 2000; - sf->thresh_mult[THR_ZERO2 ] = 2000; - sf->thresh_mult[THR_NEAR2 ] = 2000; - sf->thresh_mult[THR_NEW2 ] = 4000; - } - - if (ref_frames > 3) - { - sf->thresh_mult[THR_NEAREST3 ] = 2000; - sf->thresh_mult[THR_ZERO3 ] = 2000; - sf->thresh_mult[THR_NEAR3 ] = 2000; - sf->thresh_mult[THR_NEW3 ] = 4000; - } } break; @@ -898,67 +845,10 @@ void vp8_set_speed_features(VP8_COMP *cpi) sf->recode_loop = 0; sf->auto_filter = 1; sf->iterative_sub_pixel = 1; - sf->thresh_mult[THR_NEAREST1 ] = 0; - sf->thresh_mult[THR_ZERO1 ] = 0; - sf->thresh_mult[THR_DC ] = 0; - sf->thresh_mult[THR_TM ] = 0; - sf->thresh_mult[THR_NEAR1 ] = 0; - sf->thresh_mult[THR_V_PRED ] = 1000; - sf->thresh_mult[THR_H_PRED ] = 1000; - sf->thresh_mult[THR_B_PRED ] = 2500; - sf->thresh_mult[THR_NEAREST2 ] = 1000; - sf->thresh_mult[THR_ZERO2 ] = 1000; - sf->thresh_mult[THR_NEAR2 ] = 1000; - sf->thresh_mult[THR_NEAREST3 ] = 1000; - sf->thresh_mult[THR_ZERO3 ] = 1000; - sf->thresh_mult[THR_NEAR3 ] = 1000; - sf->thresh_mult[THR_NEW1 ] = 2000; - sf->thresh_mult[THR_NEW2 ] = 2000; - sf->thresh_mult[THR_NEW3 ] = 2000; - sf->thresh_mult[THR_SPLIT1 ] = 5000; - sf->thresh_mult[THR_SPLIT2 ] = 10000; - sf->thresh_mult[THR_SPLIT3 ] = 10000; sf->search_method = NSTEP; if (Speed > 0) { - cpi->mode_check_freq[THR_SPLIT2] = 4; - cpi->mode_check_freq[THR_SPLIT3] = 4; - cpi->mode_check_freq[THR_SPLIT1 ] = 2; - - sf->thresh_mult[THR_DC ] = 0; - sf->thresh_mult[THR_TM ] = 1000; - sf->thresh_mult[THR_V_PRED ] = 2000; - sf->thresh_mult[THR_H_PRED ] = 2000; - sf->thresh_mult[THR_B_PRED ] = 5000; - - if (ref_frames > 1) - { - sf->thresh_mult[THR_NEAREST1 ] = 0; - sf->thresh_mult[THR_ZERO1 ] = 0; - sf->thresh_mult[THR_NEAR1 ] = 0; - sf->thresh_mult[THR_NEW1 ] = 2000; - sf->thresh_mult[THR_SPLIT1 ] = 10000; - } - - if (ref_frames > 2) - { - sf->thresh_mult[THR_NEAREST2 ] = 1000; - sf->thresh_mult[THR_ZERO2 ] = 1000; - sf->thresh_mult[THR_NEAR2 ] = 1000; - sf->thresh_mult[THR_NEW2 ] = 2000; - sf->thresh_mult[THR_SPLIT2 ] = 20000; - } - - if (ref_frames > 3) - { - sf->thresh_mult[THR_NEAREST3 ] = 1000; - sf->thresh_mult[THR_ZERO3 ] = 1000; - sf->thresh_mult[THR_NEAR3 ] = 1000; - sf->thresh_mult[THR_NEW3 ] = 2000; - sf->thresh_mult[THR_SPLIT3 ] = 20000; - } - sf->improved_quant = 0; sf->improved_dct = 0; @@ -967,133 +857,28 @@ void vp8_set_speed_features(VP8_COMP *cpi) sf->first_step = 1; } - if (Speed > 1) - { - cpi->mode_check_freq[THR_SPLIT1 ] = 7; - cpi->mode_check_freq[THR_SPLIT2] = 15; - cpi->mode_check_freq[THR_SPLIT3] = 15; - - sf->thresh_mult[THR_TM ] = 2000; - sf->thresh_mult[THR_V_PRED ] = 2000; - sf->thresh_mult[THR_H_PRED ] = 2000; - sf->thresh_mult[THR_B_PRED ] = 5000; - - if (ref_frames > 1) - { - sf->thresh_mult[THR_NEW1 ] = 2000; - sf->thresh_mult[THR_SPLIT1 ] = 25000; - } - - if (ref_frames > 2) - { - sf->thresh_mult[THR_NEAREST2 ] = 2000; - sf->thresh_mult[THR_ZERO2 ] = 2000; - sf->thresh_mult[THR_NEAR2 ] = 2000; - sf->thresh_mult[THR_NEW2 ] = 2500; - sf->thresh_mult[THR_SPLIT2 ] = 50000; - } - - if (ref_frames > 3) - { - sf->thresh_mult[THR_NEAREST3 ] = 2000; - sf->thresh_mult[THR_ZERO3 ] = 2000; - sf->thresh_mult[THR_NEAR3 ] = 2000; - sf->thresh_mult[THR_NEW3 ] = 2500; - sf->thresh_mult[THR_SPLIT3 ] = 50000; - } - - } - if (Speed > 2) - { sf->auto_filter = 0; // Faster selection of loop filter - cpi->mode_check_freq[THR_V_PRED] = 2; - cpi->mode_check_freq[THR_H_PRED] = 2; - cpi->mode_check_freq[THR_B_PRED] = 2; - - if (ref_frames > 2) - { - cpi->mode_check_freq[THR_NEAR2] = 2; - cpi->mode_check_freq[THR_NEW2] = 4; - } - - if (ref_frames > 3) - { - cpi->mode_check_freq[THR_NEAR3] = 2; - cpi->mode_check_freq[THR_NEW3] = 4; - } - - sf->thresh_mult[THR_SPLIT1 ] = INT_MAX; - sf->thresh_mult[THR_SPLIT2 ] = INT_MAX; - sf->thresh_mult[THR_SPLIT3 ] = INT_MAX; - - } - if (Speed > 3) { sf->RD = 0; - sf->auto_filter = 1; } if (Speed > 4) { sf->auto_filter = 0; // Faster selection of loop filter - sf->search_method = HEX; - //sf->search_method = DIAMOND; - sf->iterative_sub_pixel = 0; - - cpi->mode_check_freq[THR_V_PRED] = 4; - cpi->mode_check_freq[THR_H_PRED] = 4; - cpi->mode_check_freq[THR_B_PRED] = 4; - - if (cpi->ref_frame_flags & VP8_GOLD_FLAG) - { - cpi->mode_check_freq[THR_NEAR2] = 2; - cpi->mode_check_freq[THR_NEW2] = 4; - } - - if (cpi->ref_frame_flags & VP8_ALT_FLAG) - { - cpi->mode_check_freq[THR_NEAR3] = 2; - cpi->mode_check_freq[THR_NEW3] = 4; - } - - sf->thresh_mult[THR_TM ] = 2000; - sf->thresh_mult[THR_B_PRED ] = 5000; - - if (cpi->ref_frame_flags & VP8_GOLD_FLAG) - { - sf->thresh_mult[THR_NEAREST2 ] = 2000; - sf->thresh_mult[THR_ZERO2 ] = 2000; - sf->thresh_mult[THR_NEAR2 ] = 2000; - sf->thresh_mult[THR_NEW2 ] = 4000; - } - - if (cpi->ref_frame_flags & VP8_ALT_FLAG) - { - sf->thresh_mult[THR_NEAREST3 ] = 2000; - sf->thresh_mult[THR_ZERO3 ] = 2000; - sf->thresh_mult[THR_NEAR3 ] = 2000; - sf->thresh_mult[THR_NEW3 ] = 4000; - } - } - - if (Speed > 5) - { - // Disable split MB intra prediction mode - sf->thresh_mult[THR_B_PRED] = INT_MAX; } if (Speed > 6) { - unsigned int i, sum = 0; + unsigned int sum = 0; unsigned int total_mbs = cm->MBs; - int thresh; - int total_skip; + int i, thresh; + unsigned int total_skip; int min = 2000; @@ -1146,44 +931,11 @@ void vp8_set_speed_features(VP8_COMP *cpi) sf->thresh_mult[THR_NEAR3 ] = thresh; } - // Disable other intra prediction modes - sf->thresh_mult[THR_TM] = INT_MAX; - sf->thresh_mult[THR_V_PRED] = INT_MAX; - sf->thresh_mult[THR_H_PRED] = INT_MAX; - sf->improved_mv_pred = 0; } if (Speed > 8) - { sf->quarter_pixel_search = 0; - } - - if (Speed > 9) - { - int Tmp = cpi->Speed - 8; - - if (Tmp > 4) - Tmp = 4; - - if (cpi->ref_frame_flags & VP8_GOLD_FLAG) - { - cpi->mode_check_freq[THR_ZERO2] = 1 << (Tmp - 1); - cpi->mode_check_freq[THR_NEAREST2] = 1 << (Tmp - 1); - cpi->mode_check_freq[THR_NEAR2] = 1 << Tmp; - cpi->mode_check_freq[THR_NEW2] = 1 << (Tmp + 1); - } - - if (cpi->ref_frame_flags & VP8_ALT_FLAG) - { - cpi->mode_check_freq[THR_ZERO3] = 1 << (Tmp - 1); - cpi->mode_check_freq[THR_NEAREST3] = 1 << (Tmp - 1); - cpi->mode_check_freq[THR_NEAR3] = 1 << Tmp; - cpi->mode_check_freq[THR_NEW3] = 1 << (Tmp + 1); - } - - cpi->mode_check_freq[THR_NEW1 ] = 1 << (Tmp - 1); - } if(cm->version == 0) { @@ -1197,10 +949,9 @@ void vp8_set_speed_features(VP8_COMP *cpi) cm->filter_type = SIMPLE_LOOPFILTER; } + // This has a big hit on quality. Last resort if (Speed >= 15) - { - sf->half_pixel_search = 0; // This has a big hit on quality. Last resort - } + sf->half_pixel_search = 0; vpx_memset(cpi->error_bins, 0, sizeof(cpi->error_bins)); @@ -1287,6 +1038,9 @@ void vp8_set_speed_features(VP8_COMP *cpi) frames_at_speed[cpi->Speed]++; #endif } +#undef GOOD +#undef RT + static void alloc_raw_frame_buffers(VP8_COMP *cpi) { int width = (cpi->oxcf.Width + 15) & ~15; @@ -1475,9 +1229,8 @@ rescale(int val, int num, int denom) } -static void init_config(VP8_PTR ptr, VP8_CONFIG *oxcf) +static void init_config(VP8_COMP *cpi, VP8_CONFIG *oxcf) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); VP8_COMMON *cm = &cpi->common; cpi->oxcf = *oxcf; @@ -1502,7 +1255,7 @@ static void init_config(VP8_PTR ptr, VP8_CONFIG *oxcf) cpi->frame_rate = 30; // change includes all joint functionality - vp8_change_config(ptr, oxcf); + vp8_change_config(cpi, oxcf); // Initialize active best and worst q and average q values. cpi->active_worst_quality = cpi->oxcf.worst_allowed_q; @@ -1524,8 +1277,8 @@ static void init_config(VP8_PTR ptr, VP8_CONFIG *oxcf) // Temporal scalabilty if (cpi->oxcf.number_of_layers > 1) { - int i; - int prev_layer_frame_rate=0; + unsigned int i; + double prev_layer_frame_rate=0; for (i=0; i<cpi->oxcf.number_of_layers; i++) { @@ -1593,9 +1346,8 @@ static void init_config(VP8_PTR ptr, VP8_CONFIG *oxcf) } -void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf) +void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); VP8_COMMON *cm = &cpi->common; if (!cpi) @@ -1787,7 +1539,7 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf) cpi->active_best_quality = cpi->oxcf.worst_allowed_q; } - cpi->buffered_mode = (cpi->oxcf.optimal_buffer_level > 0) ? TRUE : FALSE; + cpi->buffered_mode = cpi->oxcf.optimal_buffer_level > 0; cpi->cq_target_quality = cpi->oxcf.cq_level; @@ -1886,19 +1638,14 @@ static void cal_mvsadcosts(int *mvsadcost[2]) while (++i <= mvfp_max); } -VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf) +struct VP8_COMP* vp8_create_compressor(VP8_CONFIG *oxcf) { int i; - volatile union - { - VP8_COMP *cpi; - VP8_PTR ptr; - } ctx; VP8_COMP *cpi; VP8_COMMON *cm; - cpi = ctx.cpi = vpx_memalign(32, sizeof(VP8_COMP)); + cpi = vpx_memalign(32, sizeof(VP8_COMP)); // Check that the CPI instance is valid if (!cpi) return 0; @@ -1909,10 +1656,8 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf) if (setjmp(cm->error.jmp)) { - VP8_PTR ptr = ctx.ptr; - - ctx.cpi->common.error.setjmp = 0; - vp8_remove_compressor(&ptr); + cpi->common.error.setjmp = 0; + vp8_remove_compressor(&cpi); return 0; } @@ -1923,7 +1668,7 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf) vp8_create_common(&cpi->common); vp8_cmachine_specific_config(cpi); - init_config((VP8_PTR)cpi, oxcf); + init_config(cpi, oxcf); memcpy(cpi->base_skip_false_prob, vp8cx_base_skip_false_prob, sizeof(vp8cx_base_skip_false_prob)); cpi->common.current_video_frame = 0; @@ -2002,7 +1747,7 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf) cpi->cyclic_refresh_map = (signed char *) NULL; // Test function for segmentation - //segmentation_test_function((VP8_PTR) cpi); + //segmentation_test_function( cpi); #ifdef ENTROPY_STATS init_context_counters(); @@ -2013,11 +1758,11 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf) cpi->frames_since_key = 8; // Give a sensible default for the first frame. cpi->key_frame_frequency = cpi->oxcf.key_freq; - cpi->this_key_frame_forced = FALSE; - cpi->next_key_frame_forced = FALSE; + cpi->this_key_frame_forced = 0; + cpi->next_key_frame_forced = 0; - cpi->source_alt_ref_pending = FALSE; - cpi->source_alt_ref_active = FALSE; + cpi->source_alt_ref_pending = 0; + cpi->source_alt_ref_active = 0; cpi->common.refresh_alt_ref_frame = 0; cpi->b_calculate_psnr = CONFIG_INTERNAL_STATS; @@ -2222,14 +1967,14 @@ VP8_PTR vp8_create_compressor(VP8_CONFIG *oxcf) vp8_cal_low_res_mb_cols(cpi); #endif - return (VP8_PTR) cpi; + return cpi; } -void vp8_remove_compressor(VP8_PTR *ptr) +void vp8_remove_compressor(VP8_COMP **ptr) { - VP8_COMP *cpi = (VP8_COMP *)(*ptr); + VP8_COMP *cpi = *ptr; if (!cpi) return; @@ -2640,20 +2385,16 @@ static void generate_psnr_packet(VP8_COMP *cpi) } -int vp8_use_as_reference(VP8_PTR ptr, int ref_frame_flags) +int vp8_use_as_reference(VP8_COMP *cpi, int ref_frame_flags) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); - if (ref_frame_flags > 7) return -1 ; cpi->ref_frame_flags = ref_frame_flags; return 0; } -int vp8_update_reference(VP8_PTR ptr, int ref_frame_flags) +int vp8_update_reference(VP8_COMP *cpi, int ref_frame_flags) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); - if (ref_frame_flags > 7) return -1 ; @@ -2673,9 +2414,8 @@ int vp8_update_reference(VP8_PTR ptr, int ref_frame_flags) return 0; } -int vp8_get_reference(VP8_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) +int vp8_get_reference(VP8_COMP *cpi, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); VP8_COMMON *cm = &cpi->common; int ref_fb_idx; @@ -2692,9 +2432,8 @@ int vp8_get_reference(VP8_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONF return 0; } -int vp8_set_reference(VP8_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) +int vp8_set_reference(VP8_COMP *cpi, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONFIG *sd) { - VP8_COMP *cpi = (VP8_COMP *)(ptr); VP8_COMMON *cm = &cpi->common; int ref_fb_idx; @@ -2712,9 +2451,8 @@ int vp8_set_reference(VP8_PTR ptr, VP8_REFFRAME ref_frame_flag, YV12_BUFFER_CONF return 0; } -int vp8_update_entropy(VP8_PTR comp, int update) +int vp8_update_entropy(VP8_COMP *cpi, int update) { - VP8_COMP *cpi = (VP8_COMP *) comp; VP8_COMMON *cm = &cpi->common; cm->refresh_entropy_probs = update; @@ -2870,10 +2608,10 @@ static void update_alt_ref_frame_stats(VP8_COMP *cpi) cpi->common.frames_since_golden = 0; // Clear the alternate reference update pending flag. - cpi->source_alt_ref_pending = FALSE; + cpi->source_alt_ref_pending = 0; // Set the alternate refernce frame active flag - cpi->source_alt_ref_active = TRUE; + cpi->source_alt_ref_active = 1; } @@ -2936,12 +2674,12 @@ static void update_golden_frame_stats(VP8_COMP *cpi) if (cpi->oxcf.fixed_q >= 0 && cpi->oxcf.play_alternate && !cpi->common.refresh_alt_ref_frame) { - cpi->source_alt_ref_pending = TRUE; + cpi->source_alt_ref_pending = 1; cpi->frames_till_gf_update_due = cpi->baseline_gf_interval; } if (!cpi->source_alt_ref_pending) - cpi->source_alt_ref_active = FALSE; + cpi->source_alt_ref_active = 0; // Decrement count down till next gf if (cpi->frames_till_gf_update_due > 0) @@ -3028,12 +2766,12 @@ static int decide_key_frame(VP8_COMP *cpi) { VP8_COMMON *cm = &cpi->common; - int code_key_frame = FALSE; + int code_key_frame = 0; cpi->kf_boost = 0; if (cpi->Speed > 11) - return FALSE; + return 0; // Clear down mmx registers vp8_clear_system_state(); //__asm emms; @@ -3075,10 +2813,10 @@ static int decide_key_frame(VP8_COMP *cpi) && (change > .25 || change2 > .25)) { /*(change > 1.4 || change < .75)&& cpi->this_frame_percent_intra > cpi->last_frame_percent_intra + 3*/ - return TRUE; + return 1; } - return FALSE; + return 0; } @@ -3088,7 +2826,7 @@ static int decide_key_frame(VP8_COMP *cpi) ((cpi->this_frame_percent_intra > 95) && (cpi->this_frame_percent_intra >= (cpi->last_frame_percent_intra + 5)))) { - code_key_frame = TRUE; + code_key_frame = 1; } // in addition if the following are true and this is not a golden frame then code a key frame // Note that on golden frames there often seems to be a pop in intra useage anyway hence this @@ -3101,7 +2839,7 @@ static int decide_key_frame(VP8_COMP *cpi) (cpi->this_frame_percent_intra > (cpi->last_frame_percent_intra + 10)))) { if (!cm->refresh_golden_frame) - code_key_frame = TRUE; + code_key_frame = 1; } return code_key_frame; @@ -3157,11 +2895,11 @@ void write_cx_frame_to_file(YV12_BUFFER_CONFIG *frame, int this_frame) // Function to test for conditions that indeicate we should loop // back and recode a frame. -static BOOL recode_loop_test( VP8_COMP *cpi, +static int recode_loop_test( VP8_COMP *cpi, int high_limit, int low_limit, int q, int maxq, int minq ) { - BOOL force_recode = FALSE; + int force_recode = 0; VP8_COMMON *cm = &cpi->common; // Is frame recode allowed at all @@ -3177,7 +2915,7 @@ static BOOL recode_loop_test( VP8_COMP *cpi, if ( ((cpi->projected_frame_size > high_limit) && (q < maxq)) || ((cpi->projected_frame_size < low_limit) && (q > minq)) ) { - force_recode = TRUE; + force_recode = 1; } // Special Constrained quality tests else if (cpi->oxcf.end_usage == USAGE_CONSTRAINED_QUALITY) @@ -3187,14 +2925,14 @@ static BOOL recode_loop_test( VP8_COMP *cpi, (cpi->projected_frame_size < ((cpi->this_frame_target * 7) >> 3))) { - force_recode = TRUE; + force_recode = 1; } // Severe undershoot and between auto and user cq level else if ( (q > cpi->oxcf.cq_level) && (cpi->projected_frame_size < cpi->min_frame_bandwidth) && (cpi->active_best_quality > cpi->oxcf.cq_level)) { - force_recode = TRUE; + force_recode = 1; cpi->active_best_quality = cpi->oxcf.cq_level; } } @@ -3345,7 +3083,7 @@ static void encode_frame_to_data_rate int frame_over_shoot_limit; int frame_under_shoot_limit; - int Loop = FALSE; + int Loop = 0; int loop_count; int this_q; int last_zbin_oq; @@ -3357,10 +3095,10 @@ static void encode_frame_to_data_rate int top_index; int bottom_index; VP8_COMMON *cm = &cpi->common; - int active_worst_qchanged = FALSE; + int active_worst_qchanged = 0; - int overshoot_seen = FALSE; - int undershoot_seen = FALSE; + int overshoot_seen = 0; + int undershoot_seen = 0; int drop_mark = cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100; int drop_mark75 = drop_mark * 2 / 3; int drop_mark50 = drop_mark / 4; @@ -3371,7 +3109,7 @@ static void encode_frame_to_data_rate vp8_clear_system_state(); // Test code for segmentation of gf/arf (0,0) - //segmentation_test_function((VP8_PTR) cpi); + //segmentation_test_function( cpi); if (cpi->compressor_speed == 2) { @@ -3411,12 +3149,12 @@ static void encode_frame_to_data_rate // Enable or disable mode based tweaking of the zbin // For 2 Pass Only used where GF/ARF prediction quality // is above a threshold - cpi->zbin_mode_boost_enabled = TRUE; + cpi->zbin_mode_boost_enabled = 1; if (cpi->pass == 2) { if ( cpi->gfu_boost <= 400 ) { - cpi->zbin_mode_boost_enabled = FALSE; + cpi->zbin_mode_boost_enabled = 0; } } @@ -3457,7 +3195,7 @@ static void encode_frame_to_data_rate } // The alternate reference frame cannot be active for a key frame - cpi->source_alt_ref_active = FALSE; + cpi->source_alt_ref_active = 0; // Reset the RD threshold multipliers to default of * 1 (128) for (i = 0; i < MAX_MODES; i++) @@ -3469,9 +3207,9 @@ static void encode_frame_to_data_rate // Test code for segmentation //if ( (cm->frame_type == KEY_FRAME) || ((cm->current_video_frame % 2) == 0)) //if ( (cm->current_video_frame % 2) == 0 ) - // enable_segmentation((VP8_PTR)cpi); + // enable_segmentation(cpi); //else - // disable_segmentation((VP8_PTR)cpi); + // disable_segmentation(cpi); #if 0 // Experimental code for lagged compress and one pass @@ -3565,7 +3303,7 @@ static void encode_frame_to_data_rate if (cpi->oxcf.number_of_layers > 1) { - int i; + unsigned int i; // Propagate bits saved by dropping the frame to higher layers for (i=cpi->current_layer+1; i<cpi->oxcf.number_of_layers; i++) @@ -3969,7 +3707,7 @@ static void encode_frame_to_data_rate vp8_pick_frame_size(cpi); // Clear the Alt reference frame active flag when we have a key frame - cpi->source_alt_ref_active = FALSE; + cpi->source_alt_ref_active = 0; // Reset the loop filter deltas and segmentation map setup_features(cpi); @@ -3994,7 +3732,7 @@ static void encode_frame_to_data_rate q_high = cpi->active_worst_quality; loop_count++; - Loop = TRUE; + Loop = 1; continue; } @@ -4022,10 +3760,10 @@ static void encode_frame_to_data_rate } // If we have updated the active max Q do not call vp8_update_rate_correction_factors() this loop. - active_worst_qchanged = TRUE; + active_worst_qchanged = 1; } else - active_worst_qchanged = FALSE; + active_worst_qchanged = 0; #if !(CONFIG_REALTIME_ONLY) // Special case handling for forced key frames @@ -4061,7 +3799,7 @@ static void encode_frame_to_data_rate else if (Q < q_low) Q = q_low; - Loop = ((Q != last_q)) ? TRUE : FALSE; + Loop = Q != last_q; } // Is the projected frame size out of range and are we allowed to attempt to recode. @@ -4118,7 +3856,7 @@ static void encode_frame_to_data_rate } } - overshoot_seen = TRUE; + overshoot_seen = 1; } // Frame is too small else @@ -4168,7 +3906,7 @@ static void encode_frame_to_data_rate } } - undershoot_seen = TRUE; + undershoot_seen = 1; } // Clamp Q to upper and lower limits: @@ -4180,18 +3918,18 @@ static void encode_frame_to_data_rate // Clamp cpi->zbin_over_quant cpi->zbin_over_quant = (cpi->zbin_over_quant < zbin_oq_low) ? zbin_oq_low : (cpi->zbin_over_quant > zbin_oq_high) ? zbin_oq_high : cpi->zbin_over_quant; - //Loop = ((Q != last_q) || (last_zbin_oq != cpi->zbin_over_quant)) ? TRUE : FALSE; - Loop = ((Q != last_q)) ? TRUE : FALSE; + //Loop = (Q != last_q) || (last_zbin_oq != cpi->zbin_over_quant); + Loop = Q != last_q; last_zbin_oq = cpi->zbin_over_quant; } else #endif - Loop = FALSE; + Loop = 0; if (cpi->is_src_frame_alt_ref) - Loop = FALSE; + Loop = 0; - if (Loop == TRUE) + if (Loop == 1) { vp8_restore_coding_context(cpi); loop_count++; @@ -4200,7 +3938,7 @@ static void encode_frame_to_data_rate #endif } } - while (Loop == TRUE); + while (Loop == 1); #if 0 // Experimental code for lagged and one pass @@ -4342,7 +4080,7 @@ static void encode_frame_to_data_rate if (cpi->oxcf.number_of_layers > 1) { - int i; + unsigned int i; for (i=cpi->current_layer+1; i<cpi->oxcf.number_of_layers; i++) cpi->layer_context[i].total_byte_count += (*size); } @@ -4409,7 +4147,7 @@ static void encode_frame_to_data_rate (cpi->buffer_level < cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100) && (cpi->projected_frame_size > (4 * cpi->this_frame_target))) { - cpi->drop_frame = TRUE; + cpi->drop_frame = 1; } #endif @@ -4453,7 +4191,7 @@ static void encode_frame_to_data_rate // Propagate values to higher temporal layers if (cpi->oxcf.number_of_layers > 1) { - int i; + unsigned int i; for (i=cpi->current_layer+1; i<cpi->oxcf.number_of_layers; i++) { @@ -4768,12 +4506,11 @@ extern void vp8_pop_neon(int64_t *store); #endif -int vp8_receive_raw_frame(VP8_PTR ptr, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time) +int vp8_receive_raw_frame(VP8_COMP *cpi, unsigned int frame_flags, YV12_BUFFER_CONFIG *sd, int64_t time_stamp, int64_t end_time) { #if HAVE_ARMV7 int64_t store_reg[8]; #endif - VP8_COMP *cpi = (VP8_COMP *) ptr; VP8_COMMON *cm = &cpi->common; struct vpx_usec_timer timer; int res = 0; @@ -4822,12 +4559,11 @@ static int frame_is_reference(const VP8_COMP *cpi) } -int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, unsigned char *dest_end, int64_t *time_stamp, int64_t *time_end, int flush) +int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned long *size, unsigned char *dest, unsigned char *dest_end, int64_t *time_stamp, int64_t *time_end, int flush) { #if HAVE_ARMV7 int64_t store_reg[8]; #endif - VP8_COMP *cpi = (VP8_COMP *) ptr; VP8_COMMON *cm; struct vpx_usec_timer tsctimer; struct vpx_usec_timer ticktimer; @@ -4881,7 +4617,7 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon cm->refresh_golden_frame = 0; cm->refresh_last_frame = 0; cm->show_frame = 0; - cpi->source_alt_ref_pending = FALSE; // Clear Pending alt Ref flag. + cpi->source_alt_ref_pending = 0; // Clear Pending alt Ref flag. cpi->is_src_frame_alt_ref = 0; } } @@ -5313,10 +5049,8 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon return 0; } -int vp8_get_preview_raw_frame(VP8_PTR comp, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *flags) +int vp8_get_preview_raw_frame(VP8_COMP *cpi, YV12_BUFFER_CONFIG *dest, vp8_ppflags_t *flags) { - VP8_COMP *cpi = (VP8_COMP *) comp; - if (cpi->common.refresh_alt_ref_frame) return -1; else @@ -5345,9 +5079,8 @@ int vp8_get_preview_raw_frame(VP8_PTR comp, YV12_BUFFER_CONFIG *dest, vp8_ppflag } } -int vp8_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4]) +int vp8_set_roimap(VP8_COMP *cpi, unsigned char *map, unsigned int rows, unsigned int cols, int delta_q[4], int delta_lf[4], unsigned int threshold[4]) { - VP8_COMP *cpi = (VP8_COMP *) comp; signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS]; if (cpi->common.mb_rows != rows || cpi->common.mb_cols != cols) @@ -5355,15 +5088,15 @@ int vp8_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned if (!map) { - disable_segmentation((VP8_PTR)cpi); + disable_segmentation(cpi); return 0; } // Set the segmentation Map - set_segmentation_map((VP8_PTR)cpi, map); + set_segmentation_map(cpi, map); // Activate segmentation. - enable_segmentation((VP8_PTR)cpi); + enable_segmentation(cpi); // Set up the quant segment data feature_data[MB_LVL_ALT_Q][0] = delta_q[0]; @@ -5384,15 +5117,13 @@ int vp8_set_roimap(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned // Initialise the feature data structure // SEGMENT_DELTADATA 0, SEGMENT_ABSDATA 1 - set_segment_data((VP8_PTR)cpi, &feature_data[0][0], SEGMENT_DELTADATA); + set_segment_data(cpi, &feature_data[0][0], SEGMENT_DELTADATA); return 0; } -int vp8_set_active_map(VP8_PTR comp, unsigned char *map, unsigned int rows, unsigned int cols) +int vp8_set_active_map(VP8_COMP *cpi, unsigned char *map, unsigned int rows, unsigned int cols) { - VP8_COMP *cpi = (VP8_COMP *) comp; - if (rows == cpi->common.mb_rows && cols == cpi->common.mb_cols) { if (map) @@ -5412,10 +5143,8 @@ int vp8_set_active_map(VP8_PTR comp, unsigned char *map, unsigned int rows, unsi } } -int vp8_set_internal_size(VP8_PTR comp, VPX_SCALING horiz_mode, VPX_SCALING vert_mode) +int vp8_set_internal_size(VP8_COMP *cpi, VPX_SCALING horiz_mode, VPX_SCALING vert_mode) { - VP8_COMP *cpi = (VP8_COMP *) comp; - if (horiz_mode <= ONETWO) cpi->common.horiz_scale = horiz_mode; else @@ -5457,8 +5186,7 @@ int vp8_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, const } -int vp8_get_quantizer(VP8_PTR c) +int vp8_get_quantizer(VP8_COMP *cpi) { - VP8_COMP *cpi = (VP8_COMP *) c; return cpi->common.base_qindex; } diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index 07292f7f5..46951e3b9 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -259,7 +259,7 @@ typedef struct int buffer_level; int bits_off_target; - long long total_actual_bits; + int64_t total_actual_bits; int total_target_vs_actual; int worst_quality; @@ -279,7 +279,7 @@ typedef struct int zbin_over_quant; int inter_frame_target; - INT64 total_byte_count; + int64_t total_byte_count; int filter_level; @@ -673,8 +673,8 @@ typedef struct VP8_COMP unsigned int current_layer; LAYER_CONTEXT layer_context[MAX_LAYERS]; - long long frames_in_layer[MAX_LAYERS]; - long long bytes_in_layer[MAX_LAYERS]; + int64_t frames_in_layer[MAX_LAYERS]; + int64_t bytes_in_layer[MAX_LAYERS]; double sum_psnr[MAX_LAYERS]; double sum_psnr_p[MAX_LAYERS]; double total_error2[MAX_LAYERS]; diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c index 2f58a4cef..46f53a18d 100644 --- a/vp8/encoder/pickinter.c +++ b/vp8/encoder/pickinter.c @@ -21,7 +21,6 @@ #include "vp8/common/reconinter.h" #include "vp8/common/reconintra.h" #include "vp8/common/reconintra4x4.h" -#include "vp8/common/g_common.h" #include "variance.h" #include "mcomp.h" #include "rdopt.h" @@ -760,10 +759,8 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int sadpb = x->sadperbit16; int_mv mvp_full; - int col_min = (best_ref_mv.as_mv.col>>3) - - MAX_FULL_PEL_VAL + ((best_ref_mv.as_mv.col & 7)?1:0); - int row_min = (best_ref_mv.as_mv.row>>3) - - MAX_FULL_PEL_VAL + ((best_ref_mv.as_mv.row & 7)?1:0); + int col_min = ((best_ref_mv.as_mv.col+7)>>3) - MAX_FULL_PEL_VAL; + int row_min = ((best_ref_mv.as_mv.row+7)>>3) - MAX_FULL_PEL_VAL; int col_max = (best_ref_mv.as_mv.col>>3) + MAX_FULL_PEL_VAL; int row_max = (best_ref_mv.as_mv.row>>3) @@ -1067,7 +1064,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, x->e_mbd.mode_info_context->mbmi.mv.as_int = 0; x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED; x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = - (cpi->common.mb_no_coeff_skip) ? 1 : 0; + (cpi->common.mb_no_coeff_skip); x->e_mbd.mode_info_context->mbmi.partitioning = 0; return; diff --git a/vp8/encoder/picklpf.c b/vp8/encoder/picklpf.c index 530e27b6a..2449ae540 100644 --- a/vp8/encoder/picklpf.c +++ b/vp8/encoder/picklpf.c @@ -186,7 +186,7 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) best_err = calc_partial_ssl_err(sd, cm->frame_to_show, IF_RTCD(&cpi->rtcd.variance)); - filt_val -= (1 + ((filt_val > 10) ? 1 : 0)); + filt_val -= 1 + (filt_val > 10); // Search lower filter levels while (filt_val >= min_filter_level) @@ -209,11 +209,11 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) break; // Adjust filter level - filt_val -= (1 + ((filt_val > 10) ? 1 : 0)); + filt_val -= 1 + (filt_val > 10); } // Search up (note that we have already done filt_val = cm->filter_level) - filt_val = cm->filter_level + (1 + ((filt_val > 10) ? 1 : 0)); + filt_val = cm->filter_level + 1 + (filt_val > 10); if (best_filt_val == cm->filter_level) { @@ -243,7 +243,7 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) break; // Adjust filter level - filt_val += (1 + ((filt_val > 10) ? 1 : 0)); + filt_val += 1 + (filt_val > 10); } } diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index 3ca8758ef..ce04212e6 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -436,7 +436,8 @@ void vp8cx_init_quantizer(VP8_COMP *cpi) int quant_val; int Q; - int zbin_boost[16] = {0, 0, 8, 10, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 44, 44}; + int zbin_boost[16] = {0, 0, 8, 10, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, + 44, 44}; for (Q = 0; Q < QINDEX_RANGE; Q++) { @@ -469,36 +470,61 @@ void vp8cx_init_quantizer(VP8_COMP *cpi) cpi->zrun_zbin_boost_uv[Q][0] = (quant_val * zbin_boost[0]) >> 7; // all the ac values = ; - for (i = 1; i < 16; i++) + quant_val = vp8_ac_yquant(Q); + cpi->Y1quant_fast[Q][1] = (1 << 16) / quant_val; + invert_quant(cpi->sf.improved_quant, cpi->Y1quant[Q] + 1, + cpi->Y1quant_shift[Q] + 1, quant_val); + cpi->Y1zbin[Q][1] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; + cpi->Y1round[Q][1] = (qrounding_factors[Q] * quant_val) >> 7; + cpi->common.Y1dequant[Q][1] = quant_val; + cpi->zrun_zbin_boost_y1[Q][1] = (quant_val * zbin_boost[1]) >> 7; + + quant_val = vp8_ac2quant(Q, cpi->common.y2ac_delta_q); + cpi->Y2quant_fast[Q][1] = (1 << 16) / quant_val; + invert_quant(cpi->sf.improved_quant, cpi->Y2quant[Q] + 1, + cpi->Y2quant_shift[Q] + 1, quant_val); + cpi->Y2zbin[Q][1] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7; + cpi->Y2round[Q][1] = (qrounding_factors_y2[Q] * quant_val) >> 7; + cpi->common.Y2dequant[Q][1] = quant_val; + cpi->zrun_zbin_boost_y2[Q][1] = (quant_val * zbin_boost[1]) >> 7; + + quant_val = vp8_ac_uv_quant(Q, cpi->common.uvac_delta_q); + cpi->UVquant_fast[Q][1] = (1 << 16) / quant_val; + invert_quant(cpi->sf.improved_quant, cpi->UVquant[Q] + 1, + cpi->UVquant_shift[Q] + 1, quant_val); + cpi->UVzbin[Q][1] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; + cpi->UVround[Q][1] = (qrounding_factors[Q] * quant_val) >> 7; + cpi->common.UVdequant[Q][1] = quant_val; + cpi->zrun_zbin_boost_uv[Q][1] = (quant_val * zbin_boost[1]) >> 7; + + for (i = 2; i < 16; i++) { - int rc = vp8_default_zig_zag1d[i]; - - quant_val = vp8_ac_yquant(Q); - cpi->Y1quant_fast[Q][rc] = (1 << 16) / quant_val; - invert_quant(cpi->sf.improved_quant, cpi->Y1quant[Q] + rc, - cpi->Y1quant_shift[Q] + rc, quant_val); - cpi->Y1zbin[Q][rc] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; - cpi->Y1round[Q][rc] = (qrounding_factors[Q] * quant_val) >> 7; - cpi->common.Y1dequant[Q][rc] = quant_val; - cpi->zrun_zbin_boost_y1[Q][i] = (quant_val * zbin_boost[i]) >> 7; - - quant_val = vp8_ac2quant(Q, cpi->common.y2ac_delta_q); - cpi->Y2quant_fast[Q][rc] = (1 << 16) / quant_val; - invert_quant(cpi->sf.improved_quant, cpi->Y2quant[Q] + rc, - cpi->Y2quant_shift[Q] + rc, quant_val); - cpi->Y2zbin[Q][rc] = ((qzbin_factors_y2[Q] * quant_val) + 64) >> 7; - cpi->Y2round[Q][rc] = (qrounding_factors_y2[Q] * quant_val) >> 7; - cpi->common.Y2dequant[Q][rc] = quant_val; - cpi->zrun_zbin_boost_y2[Q][i] = (quant_val * zbin_boost[i]) >> 7; - - quant_val = vp8_ac_uv_quant(Q, cpi->common.uvac_delta_q); - cpi->UVquant_fast[Q][rc] = (1 << 16) / quant_val; - invert_quant(cpi->sf.improved_quant, cpi->UVquant[Q] + rc, - cpi->UVquant_shift[Q] + rc, quant_val); - cpi->UVzbin[Q][rc] = ((qzbin_factors[Q] * quant_val) + 64) >> 7; - cpi->UVround[Q][rc] = (qrounding_factors[Q] * quant_val) >> 7; - cpi->common.UVdequant[Q][rc] = quant_val; - cpi->zrun_zbin_boost_uv[Q][i] = (quant_val * zbin_boost[i]) >> 7; + cpi->Y1quant_fast[Q][i] = cpi->Y1quant_fast[Q][1]; + cpi->Y1quant[Q][i] = cpi->Y1quant[Q][1]; + cpi->Y1quant_shift[Q][i] = cpi->Y1quant_shift[Q][1]; + cpi->Y1zbin[Q][i] = cpi->Y1zbin[Q][1]; + cpi->Y1round[Q][i] = cpi->Y1round[Q][1]; + cpi->common.Y1dequant[Q][i] = cpi->common.Y1dequant[Q][1]; + cpi->zrun_zbin_boost_y1[Q][i] = (cpi->common.Y1dequant[Q][1] * + zbin_boost[i]) >> 7; + + cpi->Y2quant_fast[Q][i] = cpi->Y2quant_fast[Q][1]; + cpi->Y2quant[Q][i] = cpi->Y2quant[Q][1]; + cpi->Y2quant_shift[Q][i] = cpi->Y2quant_shift[Q][1]; + cpi->Y2zbin[Q][i] = cpi->Y2zbin[Q][1]; + cpi->Y2round[Q][i] = cpi->Y2round[Q][1]; + cpi->common.Y2dequant[Q][i] = cpi->common.Y2dequant[Q][1]; + cpi->zrun_zbin_boost_y2[Q][i] = (cpi->common.Y2dequant[Q][1] * + zbin_boost[i]) >> 7; + + cpi->UVquant_fast[Q][i] = cpi->UVquant_fast[Q][1]; + cpi->UVquant[Q][i] = cpi->UVquant[Q][1]; + cpi->UVquant_shift[Q][i] = cpi->UVquant_shift[Q][1]; + cpi->UVzbin[Q][i] = cpi->UVzbin[Q][1]; + cpi->UVround[Q][i] = cpi->UVround[Q][1]; + cpi->common.UVdequant[Q][i] = cpi->common.UVdequant[Q][1]; + cpi->zrun_zbin_boost_uv[Q][i] = (cpi->common.UVdequant[Q][1] * + zbin_boost[i]) >> 7; } } } diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index 2c993ca72..1c43c1171 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -332,8 +332,8 @@ void vp8_setup_key_frame(VP8_COMP *cpi) else cpi->frames_till_gf_update_due = cpi->goldfreq; - cpi->common.refresh_golden_frame = TRUE; - cpi->common.refresh_alt_ref_frame = TRUE; + cpi->common.refresh_golden_frame = 1; + cpi->common.refresh_alt_ref_frame = 1; } @@ -471,7 +471,7 @@ static void calc_gf_params(VP8_COMP *cpi) if (cpi->pass != 2) { // Single Pass lagged mode: TBD - if (FALSE) + if (0) { } @@ -598,14 +598,14 @@ static void calc_gf_params(VP8_COMP *cpi) if (cpi->pass != 2) { // For now Alt ref is not allowed except in 2 pass modes. - cpi->source_alt_ref_pending = FALSE; + cpi->source_alt_ref_pending = 0; /*if ( cpi->oxcf.fixed_q == -1) { if ( cpi->oxcf.play_alternate && (cpi->last_boost > (100 + (AF_THRESH*cpi->frames_till_gf_update_due)) ) ) - cpi->source_alt_ref_pending = TRUE; + cpi->source_alt_ref_pending = 1; else - cpi->source_alt_ref_pending = FALSE; + cpi->source_alt_ref_pending = 0; }*/ } } @@ -982,7 +982,7 @@ static void calc_pframe_target_size(VP8_COMP *cpi) #endif //vpx_log("Decoder: Drop frame due to bandwidth: %d \n",cpi->buffer_level, cpi->av_per_frame_bandwidth); - cpi->drop_frame = TRUE; + cpi->drop_frame = 1; } #if 0 @@ -990,7 +990,7 @@ static void calc_pframe_target_size(VP8_COMP *cpi) else if ((cpi->buffer_level < cpi->oxcf.drop_frames_water_mark * cpi->oxcf.optimal_buffer_level / 100) && (cpi->drop_count < cpi->max_drop_count) && (cpi->pass == 0)) { - cpi->drop_frame = TRUE; + cpi->drop_frame = 1; } #endif @@ -1036,11 +1036,11 @@ static void calc_pframe_target_size(VP8_COMP *cpi) { // For one pass throw a GF if recent frame intra useage is low or the GF useage is high if ((cpi->pass == 0) && (cpi->this_frame_percent_intra < 15 || gf_frame_useage >= 5)) - cpi->common.refresh_golden_frame = TRUE; + cpi->common.refresh_golden_frame = 1; // Two pass GF descision else if (cpi->pass == 2) - cpi->common.refresh_golden_frame = TRUE; + cpi->common.refresh_golden_frame = 1; } #if 0 @@ -1058,7 +1058,7 @@ static void calc_pframe_target_size(VP8_COMP *cpi) #endif - if (cpi->common.refresh_golden_frame == TRUE) + if (cpi->common.refresh_golden_frame == 1) { #if 0 @@ -1543,7 +1543,7 @@ int vp8_pick_frame_size(VP8_COMP *cpi) // Check if we're dropping the frame: if (cpi->drop_frame) { - cpi->drop_frame = FALSE; + cpi->drop_frame = 0; cpi->drop_count++; return 0; } diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c index 9b9003495..ce979619a 100644 --- a/vp8/encoder/rdopt.c +++ b/vp8/encoder/rdopt.c @@ -28,7 +28,6 @@ #include "encodemb.h" #include "quantize.h" #include "vp8/common/idct.h" -#include "vp8/common/g_common.h" #include "variance.h" #include "mcomp.h" #include "rdopt.h" @@ -1385,8 +1384,8 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, if (bsi.segment_rd < best_rd) { - int col_min = (best_ref_mv->as_mv.col>>3) - MAX_FULL_PEL_VAL + ((best_ref_mv->as_mv.col & 7)?1:0); - int row_min = (best_ref_mv->as_mv.row>>3) - MAX_FULL_PEL_VAL + ((best_ref_mv->as_mv.row & 7)?1:0); + int col_min = ((best_ref_mv->as_mv.col+7)>>3) - MAX_FULL_PEL_VAL; + int row_min = ((best_ref_mv->as_mv.row+7)>>3) - MAX_FULL_PEL_VAL; int col_max = (best_ref_mv->as_mv.col>>3) + MAX_FULL_PEL_VAL; int row_max = (best_ref_mv->as_mv.row>>3) + MAX_FULL_PEL_VAL; @@ -2016,8 +2015,8 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int sadpb = x->sadperbit16; int_mv mvp_full; - int col_min = (best_ref_mv.as_mv.col>>3) - MAX_FULL_PEL_VAL + ((best_ref_mv.as_mv.col & 7)?1:0); - int row_min = (best_ref_mv.as_mv.row>>3) - MAX_FULL_PEL_VAL + ((best_ref_mv.as_mv.row & 7)?1:0); + int col_min = ((best_ref_mv.as_mv.col+7)>>3) - MAX_FULL_PEL_VAL; + int row_min = ((best_ref_mv.as_mv.row+7)>>3) - MAX_FULL_PEL_VAL; int col_max = (best_ref_mv.as_mv.col>>3) + MAX_FULL_PEL_VAL; int row_max = (best_ref_mv.as_mv.row>>3) + MAX_FULL_PEL_VAL; @@ -2386,7 +2385,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, x->e_mbd.mode_info_context->mbmi.mv.as_int = 0; x->e_mbd.mode_info_context->mbmi.uv_mode = DC_PRED; x->e_mbd.mode_info_context->mbmi.mb_skip_coeff = - (cpi->common.mb_no_coeff_skip) ? 1 : 0; + (cpi->common.mb_no_coeff_skip); x->e_mbd.mode_info_context->mbmi.partitioning = 0; return; diff --git a/vp8/encoder/temporal_filter.c b/vp8/encoder/temporal_filter.c index b9ade1c6c..545e4f205 100644 --- a/vp8/encoder/temporal_filter.c +++ b/vp8/encoder/temporal_filter.c @@ -22,7 +22,6 @@ #include "ratectrl.h" #include "vp8/common/quant_common.h" #include "segmentation.h" -#include "vp8/common/g_common.h" #include "vpx_scale/yv12extend.h" #include "vpx_mem/vpx_mem.h" #include "vp8/common/swapyv12buffer.h" @@ -98,7 +97,7 @@ void vp8_temporal_filter_apply_c unsigned short *count ) { - int i, j, k; + unsigned int i, j, k; int modifier; int byte = 0; @@ -186,7 +185,7 @@ static int vp8_temporal_filter_find_matching_mb_c if (cpi->Speed < 8) { step_param = cpi->sf.first_step + - ((cpi->Speed > 5) ? 1 : 0); + (cpi->Speed > 5); further_steps = (cpi->sf.max_step_search_steps - 1)-step_param; } diff --git a/vp8/vp8_common.mk b/vp8/vp8_common.mk index 8b7f0fd45..0e564320f 100644 --- a/vp8/vp8_common.mk +++ b/vp8/vp8_common.mk @@ -9,7 +9,6 @@ ## VP8_COMMON_SRCS-yes += vp8_common.mk -VP8_COMMON_SRCS-yes += common/type_aliases.h VP8_COMMON_SRCS-yes += common/pragmas.h VP8_COMMON_SRCS-yes += common/ppflags.h VP8_COMMON_SRCS-yes += common/onyx.h @@ -35,13 +34,11 @@ VP8_COMMON_SRCS-yes += common/idctllm.c VP8_COMMON_SRCS-yes += common/alloccommon.h VP8_COMMON_SRCS-yes += common/blockd.h VP8_COMMON_SRCS-yes += common/common.h -VP8_COMMON_SRCS-yes += common/common_types.h VP8_COMMON_SRCS-yes += common/entropy.h VP8_COMMON_SRCS-yes += common/entropymode.h VP8_COMMON_SRCS-yes += common/entropymv.h VP8_COMMON_SRCS-yes += common/extend.h VP8_COMMON_SRCS-yes += common/findnearmv.h -VP8_COMMON_SRCS-yes += common/g_common.h VP8_COMMON_SRCS-yes += common/header.h VP8_COMMON_SRCS-yes += common/idct.h VP8_COMMON_SRCS-yes += common/invtrans.h diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index a467daa9e..6181ee8ee 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -83,7 +83,7 @@ struct vpx_codec_alg_priv vpx_codec_enc_cfg_t cfg; struct vp8_extracfg vp8_cfg; VP8_CONFIG oxcf; - VP8_PTR cpi; + struct VP8_COMP *cpi; unsigned char *cx_data; unsigned int cx_data_sz; vpx_image_t preview_img; @@ -556,7 +556,7 @@ static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx, vpx_codec_enc_cfg_t *cfg; unsigned int i; - VP8_PTR optr; + struct VP8_COMP *optr; if (!ctx->priv) { diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c index 54bdb8568..fbe58171c 100644 --- a/vp8/vp8_dx_iface.c +++ b/vp8/vp8_dx_iface.c @@ -57,7 +57,7 @@ struct vpx_codec_alg_priv vp8_stream_info_t si; int defer_alloc; int decoder_init; - VP8D_PTR pbi; + struct VP8D_COMP *pbi; int postproc_cfg_set; vp8_postproc_cfg_t postproc_cfg; #if CONFIG_POSTPROC_VISUALIZER @@ -389,7 +389,7 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx, if (!res) { VP8D_CONFIG oxcf; - VP8D_PTR optr; + struct VP8D_COMP* optr; vp8dx_initialize(); @@ -807,7 +807,7 @@ write_webm_file_footer(EbmlGlobal *glob, long hash) { EbmlLoc start; - int i; + unsigned int i; glob->cue_pos = ftello(glob->stream); Ebml_StartSubElement(glob, &start, Cues); |