From a0d9309eab07239c01f1a316d57e818bb9046068 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev <dkovalev@google.com> Date: Mon, 15 Apr 2013 15:24:39 -0700 Subject: [PATCH] Removing TRUE and FALSE macro definitions. Using regular 0 and 1 constants now. Change-Id: Ie763503cbb727847cc8f1d6506cd6f2ee607f056 --- vp9/common/vp9_blockd.h | 3 -- vp9/common/vp9_common.h | 3 -- vp9/common/vp9_findnearmv.c | 2 +- vp9/common/vp9_mvref_common.c | 8 ++--- vp9/encoder/vp9_encodeframe.c | 6 ++-- vp9/encoder/vp9_firstpass.c | 32 +++++++++--------- vp9/encoder/vp9_onyx_if.c | 64 +++++++++++++++++------------------ vp9/encoder/vp9_rdopt.c | 2 +- 8 files changed, 57 insertions(+), 63 deletions(-) diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index b9716628aa..461e22f221 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -21,9 +21,6 @@ #include "vp9/common/vp9_common.h" #include "vp9/common/vp9_enums.h" -#define TRUE 1 -#define FALSE 0 - // #define MODE_STATS #define MB_FEATURE_TREE_PROBS 3 diff --git a/vp9/common/vp9_common.h b/vp9/common/vp9_common.h index 3ffa513eaa..dbfb9ed469 100644 --- a/vp9/common/vp9_common.h +++ b/vp9/common/vp9_common.h @@ -19,9 +19,6 @@ #include "vpx_mem/vpx_mem.h" #include "vpx/vpx_integer.h" -#define TRUE 1 -#define FALSE 0 - #define MIN(x, y) (((x) < (y)) ? (x) : (y)) #define MAX(x, y) (((x) > (y)) ? (x) : (y)) diff --git a/vp9/common/vp9_findnearmv.c b/vp9/common/vp9_findnearmv.c index 0538958406..bbbc2f62cc 100644 --- a/vp9/common/vp9_findnearmv.c +++ b/vp9/common/vp9_findnearmv.c @@ -141,7 +141,7 @@ void vp9_find_best_ref_mvs(MACROBLOCKD *xd, unsigned int sse; unsigned int ref_scores[MAX_MV_REF_CANDIDATES] = {0}; int_mv sorted_mvs[MAX_MV_REF_CANDIDATES]; - int zero_seen = FALSE; + int zero_seen = 0; if (ref_y_buffer) { diff --git a/vp9/common/vp9_mvref_common.c b/vp9/common/vp9_mvref_common.c index e1a12e411b..666197366c 100644 --- a/vp9/common/vp9_mvref_common.c +++ b/vp9/common/vp9_mvref_common.c @@ -158,7 +158,7 @@ static void addmv_and_shuffle( int i; int insert_point; - int duplicate_found = FALSE; + int duplicate_found = 0; // Check for duplicates. If there is one increase its score. // We only compare vs the current top candidates. @@ -171,7 +171,7 @@ static void addmv_and_shuffle( while (i > 0) { i--; if (candidate_mv.as_int == mv_list[i].as_int) { - duplicate_found = TRUE; + duplicate_found = 1; mv_scores[i] += weight; break; } @@ -251,7 +251,7 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, int split_count = 0; int (*mv_ref_search)[2]; int *ref_distance_weight; - int zero_seen = FALSE; + int zero_seen = 0; const int mb_col = (-xd->mb_to_left_edge) >> 7; // Blank the reference vector lists and other local structures. @@ -395,7 +395,7 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, // Scan for 0,0 case and clamp non zero choices for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) { if (candidate_mvs[i].as_int == 0) { - zero_seen = TRUE; + zero_seen = 1; } else { clamp_mv_ref(xd, &candidate_mvs[i]); } diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index b4ba8dc1f0..1396725532 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -386,7 +386,7 @@ static unsigned int pick_best_mv_ref(MACROBLOCK *x, int i; int best_index = 0; int cost, cost2; - int zero_seen = (mv_ref_list[0].as_int) ? FALSE : TRUE; + int zero_seen = (mv_ref_list[0].as_int) ? 0 : 1; MACROBLOCKD *xd = &x->e_mbd; int max_mv = MV_MAX; @@ -401,7 +401,7 @@ static unsigned int pick_best_mv_ref(MACROBLOCK *x, if (zero_seen) break; else - zero_seen = TRUE; + zero_seen = 1; } // Check for cases where the reference choice would give rise to an @@ -1158,7 +1158,7 @@ static void switch_lossless_mode(VP9_COMP *cpi, int lossless) { cpi->mb.e_mbd.inv_txm4x4 = vp9_short_iwalsh4x4; cpi->mb.optimize = 0; cpi->common.filter_level = 0; - cpi->zbin_mode_boost_enabled = FALSE; + cpi->zbin_mode_boost_enabled = 0; cpi->common.txfm_mode = ONLY_4X4; } else { cpi->mb.fwd_txm8x4 = vp9_short_fdct8x4; diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 1dd2a7dd8a..8ddcc9da74 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -1219,7 +1219,7 @@ static int detect_transition_to_still( int still_interval, double loop_decay_rate, double last_decay_rate) { - int 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 @@ -1248,7 +1248,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; @@ -1260,7 +1260,7 @@ static int detect_transition_to_still( static int detect_flash(VP9_COMP *cpi, int offset) { FIRSTPASS_STATS next_frame; - int flash_detected = FALSE; + int flash_detected = 0; // Read the frame data. // The return is FALSE (no flash detected) if not a valid frame @@ -1272,7 +1272,7 @@ static int detect_flash(VP9_COMP *cpi, int offset) { // comapred to pcnt_inter. if ((next_frame.pcnt_second_ref > next_frame.pcnt_inter) && (next_frame.pcnt_second_ref >= 0.5)) { - flash_detected = TRUE; + flash_detected = 1; } } @@ -1372,7 +1372,7 @@ static int calc_arf_boost( double mv_in_out_accumulator = 0.0; double abs_mv_in_out_accumulator = 0.0; int arf_boost; - int flash_detected = FALSE; + int flash_detected = 0; // Search forward from the proposed arf/next gf position for (i = 0; i < f_frames; i++) { @@ -1612,12 +1612,12 @@ void define_fixed_arf_period(VP9_COMP *cpi) { if (cpi->twopass.frames_to_key <= (FIXED_ARF_GROUP_SIZE + 8)) { // Setup a GF group close to the keyframe. - cpi->source_alt_ref_pending = FALSE; + cpi->source_alt_ref_pending = 0; cpi->baseline_gf_interval = cpi->twopass.frames_to_key; schedule_frames(cpi, 0, (cpi->baseline_gf_interval - 1), 2, 0, 0); } else { // Setup a fixed period ARF group. - cpi->source_alt_ref_pending = TRUE; + cpi->source_alt_ref_pending = 1; cpi->baseline_gf_interval = FIXED_ARF_GROUP_SIZE; schedule_frames(cpi, 0, -(cpi->baseline_gf_interval - 1), 2, 1, 0); } @@ -1762,7 +1762,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { // (for example a static image after a fade or other transition). if (detect_transition_to_still(cpi, i, 5, loop_decay_rate, last_loop_decay_rate)) { - allow_alt_ref = FALSE; + allow_alt_ref = 0; break; } } @@ -1840,7 +1840,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { (boost_score > 100)) { // Alternative boost calculation for alt ref cpi->gfu_boost = calc_arf_boost(cpi, 0, (i - 1), (i - 1), &f_boost, &b_boost); - cpi->source_alt_ref_pending = TRUE; + cpi->source_alt_ref_pending = 1; #if CONFIG_MULTIPLE_ARF // Set the ARF schedule. @@ -1850,7 +1850,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { #endif } else { cpi->gfu_boost = (int)boost_score; - cpi->source_alt_ref_pending = FALSE; + cpi->source_alt_ref_pending = 0; #if CONFIG_MULTIPLE_ARF // Set the GF schedule. if (cpi->multi_arf_enabled) { @@ -2333,7 +2333,7 @@ static int test_candidate_kf(VP9_COMP *cpi, FIRSTPASS_STATS *last_frame, FIRSTPASS_STATS *this_frame, FIRSTPASS_STATS *next_frame) { - int 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 @@ -2405,12 +2405,12 @@ static int test_candidate_kf(VP9_COMP *cpi, // If there is tolerable prediction for at least the next 3 frames then // break out else discard this potential key frame and move on if (boost_score > 30.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; } } @@ -2446,7 +2446,7 @@ static void find_next_key_frame(VP9_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; @@ -2554,9 +2554,9 @@ static void find_next_key_frame(VP9_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) { diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 87794b6788..48a08dff43 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -1460,11 +1460,11 @@ VP9_PTR vp9_create_compressor(VP9_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->refresh_alt_ref_frame = 0; #if CONFIG_MULTIPLE_ARF @@ -2249,10 +2249,10 @@ static void update_alt_ref_frame_stats(VP9_COMP *cpi) { if (!cpi->multi_arf_enabled) #endif // Clear the alternate reference update pending flag. - cpi->source_alt_ref_pending = FALSE; + cpi->source_alt_ref_pending = 0; // Set the alternate reference frame active flag - cpi->source_alt_ref_active = TRUE; + cpi->source_alt_ref_active = 1; } @@ -2289,12 +2289,12 @@ static void update_golden_frame_stats(VP9_COMP *cpi) { // If we are going to use the ALT reference for the next group of frames set a flag to say so. if (cpi->oxcf.fixed_q >= 0 && cpi->oxcf.play_alternate && !cpi->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) @@ -2413,7 +2413,7 @@ static double compute_edge_pixel_proportion(YV12_BUFFER_CONFIG *frame) { static int recode_loop_test(VP9_COMP *cpi, int high_limit, int low_limit, int q, int maxq, int minq) { - int force_recode = FALSE; + int force_recode = 0; VP9_COMMON *cm = &cpi->common; // Is frame recode allowed at all @@ -2427,19 +2427,19 @@ static int recode_loop_test(VP9_COMP *cpi, // General over and under shoot tests 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) { // Undershoot and below auto cq level if (q > cpi->cq_target_quality && cpi->projected_frame_size < ((cpi->this_frame_target * 7) >> 3)) { - force_recode = TRUE; + force_recode = 1; } else if (q > cpi->oxcf.cq_level && cpi->projected_frame_size < cpi->min_frame_bandwidth && cpi->active_best_quality > cpi->oxcf.cq_level) { // Severe undershoot and between auto and user cq level - force_recode = TRUE; + force_recode = 1; cpi->active_best_quality = cpi->oxcf.cq_level; } } @@ -2627,7 +2627,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, int frame_over_shoot_limit; int frame_under_shoot_limit; - int loop = FALSE; + int loop = 0; int loop_count; int q_low; @@ -2635,10 +2635,10 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, int top_index; int bottom_index; - 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; SPEED_FEATURES *sf = &cpi->sf; #if RESET_FOREACH_FILTER @@ -2698,9 +2698,9 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, cpi->zbin_mode_boost = 0; // if (cpi->oxcf.lossless) - cpi->zbin_mode_boost_enabled = FALSE; + cpi->zbin_mode_boost_enabled = 0; // else - // cpi->zbin_mode_boost_enabled = TRUE; + // cpi->zbin_mode_boost_enabled = 1; // Current default encoder behaviour for the altref sign bias cpi->common.ref_frame_sign_bias[ALTREF_FRAME] = cpi->source_alt_ref_active; @@ -2732,7 +2732,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, } // 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++) @@ -3074,7 +3074,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, if (frame_over_shoot_limit == 0) frame_over_shoot_limit = 1; - active_worst_qchanged = FALSE; + active_worst_qchanged = 0; // Special case handling for forced key frames if ((cm->frame_type == KEY_FRAME) && cpi->this_key_frame_forced) { @@ -3153,7 +3153,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, } } - overshoot_seen = TRUE; + overshoot_seen = 1; } else { // Frame is too small q_high = q > q_low ? q - 1 : q_low; @@ -3186,7 +3186,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, } } - undershoot_seen = TRUE; + undershoot_seen = 1; } // Clamp Q to upper and lower limits: @@ -3194,11 +3194,11 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, loop = q != last_q; } else { - loop = FALSE; + loop = 0; } if (cpi->is_src_frame_alt_ref) - loop = FALSE; + loop = 0; if (!loop && cm->frame_type != KEY_FRAME && sf->search_best_filter) { if (mcomp_filter_index < mcomp_filters) { @@ -3211,7 +3211,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, if (mcomp_filter_index < mcomp_filters) { cm->mcomp_filter_type = mcomp_filters_to_search[mcomp_filter_index]; loop_count = -1; - loop = TRUE; + loop = 1; } else { int f; int64_t best_cost = mcomp_filter_cost[0]; @@ -3224,7 +3224,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, } if (mcomp_best_filter != mcomp_filters_to_search[mcomp_filters - 1]) { loop_count = -1; - loop = TRUE; + loop = 1; cm->mcomp_filter_type = mcomp_best_filter; } /* @@ -3235,8 +3235,8 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, } #if RESET_FOREACH_FILTER if (loop) { - overshoot_seen = FALSE; - undershoot_seen = FALSE; + overshoot_seen = 0; + undershoot_seen = 0; q_low = q_low0; q_high = q_high0; q = Q0; @@ -3816,7 +3816,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags, #if CONFIG_MULTIPLE_ARF if (!cpi->multi_arf_enabled) #endif - cpi->source_alt_ref_pending = FALSE; // Clear Pending altf Ref flag. + cpi->source_alt_ref_pending = 0; // Clear Pending altf Ref flag. } } @@ -3829,11 +3829,11 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags, #if CONFIG_MULTIPLE_ARF // Is this frame the ARF overlay. - cpi->is_src_frame_alt_ref = FALSE; + cpi->is_src_frame_alt_ref = 0; for (i = 0; i < cpi->arf_buffered; ++i) { if (cpi->source == cpi->alt_ref_source[i]) { - cpi->is_src_frame_alt_ref = TRUE; - cpi->refresh_golden_frame = TRUE; + cpi->is_src_frame_alt_ref = 1; + cpi->refresh_golden_frame = 1; break; } } diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 8cf52f723f..711461aedd 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -2493,7 +2493,7 @@ static void mv_pred(VP9_COMP *cpi, MACROBLOCK *x, MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi; int_mv this_mv; int i; - int zero_seen = FALSE; + int zero_seen = 0; int best_index = 0; int best_sad = INT_MAX; int this_sad = INT_MAX; -- GitLab