Commit d48ea5a2 authored by John Koleszar's avatar John Koleszar Committed by Gerrit Code Review
Browse files

Merge "Remove legacy integer types"

parents adb10c47 f56918ba
......@@ -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
......
......@@ -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) { \
......
/*
* 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
......@@ -22,7 +22,6 @@ extern "C"
#include "vpx/vp8cx.h"
#include "vpx/vpx_encoder.h"
#include "vpx_scale/yv12config.h"
#include "type_aliases.h"
#include "ppflags.h"
struct VP8_COMP;
......
......@@ -18,7 +18,6 @@
extern "C"
{
#endif
#include "type_aliases.h"
#include "vpx_scale/yv12config.h"
#include "ppflags.h"
#include "vpx_ports/mem.h"
......
/*
* 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
......@@ -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;
......
......@@ -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))
......
......@@ -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;
}
......
......@@ -1540,7 +1540,7 @@ void vp8_change_config(VP8_COMP *cpi, 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) ? 1 : 0;
cpi->cq_target_quality = cpi->oxcf.cq_level;
......@@ -1759,11 +1759,11 @@ struct VP8_COMP* 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;
......@@ -2609,10 +2609,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;
}
......@@ -2675,12 +2675,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)
......@@ -2767,12 +2767,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;
......@@ -2814,10 +2814,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;
}
......@@ -2827,7 +2827,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
......@@ -2840,7 +2840,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;
......@@ -2896,11 +2896,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
......@@ -2916,7 +2916,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)
......@@ -2926,14 +2926,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;
}
}
......@@ -3084,7 +3084,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;
......@@ -3096,10 +3096,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;
......@@ -3150,12 +3150,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;
}
}
......@@ -3196,7 +3196,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++)
......@@ -3708,7 +3708,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);
......@@ -3733,7 +3733,7 @@ static void encode_frame_to_data_rate
q_high = cpi->active_worst_quality;
loop_count++;
Loop = TRUE;
Loop = 1;