From f56918ba9c8c964a7532ddac925fc5af8d330355 Mon Sep 17 00:00:00 2001 From: John Koleszar Date: Wed, 21 Dec 2011 14:21:29 -0800 Subject: [PATCH] Remove legacy integer types Remove BOOL, INTn, UINTn, etc, in favor of C99-style fixed width types. Change-Id: I396636212fb5edd6b347d43cc940186d8cd1e7b5 --- vp8/common/blockd.h | 3 - vp8/common/common.h | 2 - vp8/common/common_types.h | 18 ------ vp8/common/onyx.h | 1 - vp8/common/onyxd.h | 1 - vp8/common/type_aliases.h | 117 -------------------------------------- vp8/decoder/detokenize.c | 12 ++-- vp8/encoder/ethreading.c | 4 +- vp8/encoder/firstpass.c | 56 +++++++++--------- vp8/encoder/onyx_if.c | 84 +++++++++++++-------------- vp8/encoder/onyx_int.h | 8 +-- vp8/encoder/ratectrl.c | 24 ++++---- vp8/vp8_common.mk | 2 - 13 files changed, 94 insertions(+), 238 deletions(-) delete mode 100644 vp8/common/common_types.h delete mode 100644 vp8/common/type_aliases.h 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/onyx.h b/vp8/common/onyx.h index 7b99693a1..d17a32b82 100644 --- a/vp8/common/onyx.h +++ b/vp8/common/onyx.h @@ -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; diff --git a/vp8/common/onyxd.h b/vp8/common/onyxd.h index 43fa00bd3..58bf8f111 100644 --- a/vp8/common/onyxd.h +++ b/vp8/common/onyxd.h @@ -18,7 +18,6 @@ extern "C" { #endif -#include "type_aliases.h" #include "vpx_scale/yv12config.h" #include "ppflags.h" #include "vpx_ports/mem.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/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<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)) 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/onyx_if.c b/vp8/encoder/onyx_if.c index 32f0a250b..4faaf2bd9 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -1775,7 +1775,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; @@ -1994,11 +1994,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; @@ -2844,10 +2844,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; } @@ -2910,12 +2910,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) @@ -3002,12 +3002,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; @@ -3049,10 +3049,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; } @@ -3062,7 +3062,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 @@ -3075,7 +3075,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; @@ -3131,11 +3131,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 @@ -3151,7 +3151,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) @@ -3161,14 +3161,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; } } @@ -3319,7 +3319,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; @@ -3331,10 +3331,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; @@ -3385,12 +3385,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; } } @@ -3431,7 +3431,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++) @@ -3943,7 +3943,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); @@ -3968,7 +3968,7 @@ static void encode_frame_to_data_rate q_high = cpi->active_worst_quality; loop_count++; - Loop = TRUE; + Loop = 1; continue; } @@ -3996,10 +3996,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 @@ -4035,7 +4035,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)) ? 1 : 0; } // Is the projected frame size out of range and are we allowed to attempt to recode. @@ -4092,7 +4092,7 @@ static void encode_frame_to_data_rate } } - overshoot_seen = TRUE; + overshoot_seen = 1; } // Frame is too small else @@ -4142,7 +4142,7 @@ static void encode_frame_to_data_rate } } - undershoot_seen = TRUE; + undershoot_seen = 1; } // Clamp Q to upper and lower limits: @@ -4154,18 +4154,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)) ? 1 : 0; + Loop = ((Q != last_q)) ? 1 : 0; 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++; @@ -4174,7 +4174,7 @@ static void encode_frame_to_data_rate #endif } } - while (Loop == TRUE); + while (Loop == 1); #if 0 // Experimental code for lagged and one pass @@ -4383,7 +4383,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 @@ -4853,7 +4853,7 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l 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; } } 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/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/vp8_common.mk b/vp8/vp8_common.mk index 8b7f0fd45..eb483d235 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,7 +34,6 @@ 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