diff options
author | John Koleszar <jkoleszar@google.com> | 2012-05-21 14:30:56 -0700 |
---|---|---|
committer | John Koleszar <jkoleszar@google.com> | 2012-06-11 15:14:58 -0700 |
commit | 0164a1cc5b13909407587109effabea92e487986 (patch) | |
tree | f490d9a5859ff362be0e9b074d078112ef573a84 /vp8/encoder/picklpf.c | |
parent | 30fb976e3e42b6bc8f9360437033d8ae22c5a2f4 (diff) | |
download | libvpx-0164a1cc5b13909407587109effabea92e487986.tar libvpx-0164a1cc5b13909407587109effabea92e487986.tar.gz libvpx-0164a1cc5b13909407587109effabea92e487986.tar.bz2 libvpx-0164a1cc5b13909407587109effabea92e487986.zip |
Fix pedantic compiler warnings
Allows building the library with the gcc -pedantic option, for improved
portabilty. In particular, this commit removes usage of C99/C++ style
single-line comments and dynamic struct initializers. This is a
continuation of the work done in commit 97b766a46, which removed most
of these warnings for decode only builds.
Change-Id: Id453d9c1d9f44cc0381b10c3869fabb0184d5966
Diffstat (limited to 'vp8/encoder/picklpf.c')
-rw-r--r-- | vp8/encoder/picklpf.c | 84 |
1 files changed, 49 insertions, 35 deletions
diff --git a/vp8/encoder/picklpf.c b/vp8/encoder/picklpf.c index 21af45a0f..4121349a9 100644 --- a/vp8/encoder/picklpf.c +++ b/vp8/encoder/picklpf.c @@ -74,7 +74,9 @@ static int calc_partial_ssl_err(YV12_BUFFER_CONFIG *source, src += srcoffset; dst += dstoffset; - // Loop through the Y plane raw and reconstruction data summing (square differences) + /* Loop through the Y plane raw and reconstruction data summing + * (square differences) + */ for (i = 0; i < linestocopy; i += 16) { for (j = 0; j < source->y_width; j += 16) @@ -92,7 +94,7 @@ static int calc_partial_ssl_err(YV12_BUFFER_CONFIG *source, return Total; } -// Enforce a minimum filter level based upon baseline Q +/* Enforce a minimum filter level based upon baseline Q */ static int get_min_filter_level(VP8_COMP *cpi, int base_qindex) { int min_filter_level; @@ -113,14 +115,15 @@ static int get_min_filter_level(VP8_COMP *cpi, int base_qindex) return min_filter_level; } -// Enforce a maximum filter level based upon baseline Q +/* Enforce a maximum filter level based upon baseline Q */ static int get_max_filter_level(VP8_COMP *cpi, int base_qindex) { - // PGW August 2006: Highest filter values almost always a bad idea + /* PGW August 2006: Highest filter values almost always a bad idea */ - // jbb chg: 20100118 - not so any more with this overquant stuff allow high values - // with lots of intra coming in. - int max_filter_level = MAX_LOOP_FILTER ;//* 3 / 4; + /* jbb chg: 20100118 - not so any more with this overquant stuff allow + * high values with lots of intra coming in. + */ + int max_filter_level = MAX_LOOP_FILTER; (void)base_qindex; if (cpi->twopass.section_intra_rating > 8) @@ -155,7 +158,9 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) cm->last_sharpness_level = cm->sharpness_level; } - // Start the search at the previous frame filter level unless it is now out of range. + /* Start the search at the previous frame filter level unless it is + * now out of range. + */ if (cm->filter_level < min_filter_level) cm->filter_level = min_filter_level; else if (cm->filter_level > max_filter_level) @@ -164,7 +169,7 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) filt_val = cm->filter_level; best_filt_val = filt_val; - // Get the err using the previous frame's filter value. + /* Get the err using the previous frame's filter value. */ /* Copy the unfiltered / processed recon buffer to the new buffer */ vp8_yv12_copy_partial_frame(saved_frame, cm->frame_to_show); @@ -174,17 +179,17 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) filt_val -= 1 + (filt_val > 10); - // Search lower filter levels + /* Search lower filter levels */ while (filt_val >= min_filter_level) { - // Apply the loop filter + /* Apply the loop filter */ vp8_yv12_copy_partial_frame(saved_frame, cm->frame_to_show); vp8_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val); - // Get the err for filtered frame + /* Get the err for filtered frame */ filt_err = calc_partial_ssl_err(sd, cm->frame_to_show); - // Update the best case record or exit loop. + /* Update the best case record or exit loop. */ if (filt_err < best_err) { best_err = filt_err; @@ -193,32 +198,34 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) else break; - // Adjust filter level + /* Adjust filter level */ filt_val -= 1 + (filt_val > 10); } - // Search up (note that we have already done filt_val = cm->filter_level) + /* Search up (note that we have already done filt_val = cm->filter_level) */ filt_val = cm->filter_level + 1 + (filt_val > 10); if (best_filt_val == cm->filter_level) { - // Resist raising filter level for very small gains + /* Resist raising filter level for very small gains */ best_err -= (best_err >> 10); while (filt_val < max_filter_level) { - // Apply the loop filter + /* Apply the loop filter */ vp8_yv12_copy_partial_frame(saved_frame, cm->frame_to_show); vp8_loop_filter_partial_frame(cm, &cpi->mb.e_mbd, filt_val); - // Get the err for filtered frame + /* Get the err for filtered frame */ filt_err = calc_partial_ssl_err(sd, cm->frame_to_show); - // Update the best case record or exit loop. + /* Update the best case record or exit loop. */ if (filt_err < best_err) { - // Do not raise filter level if improvement is < 1 part in 4096 + /* Do not raise filter level if improvement is < 1 part + * in 4096 + */ best_err = filt_err - (filt_err >> 10); best_filt_val = filt_val; @@ -226,7 +233,7 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) else break; - // Adjust filter level + /* Adjust filter level */ filt_val += 1 + (filt_val > 10); } } @@ -243,7 +250,7 @@ void vp8cx_pick_filter_level_fast(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) cm->frame_to_show = saved_frame; } -// Stub function for now Alt LF not used +/* Stub function for now Alt LF not used */ void vp8cx_set_alt_lf_level(VP8_COMP *cpi, int filt_val) { MACROBLOCKD *mbd = &cpi->mb.e_mbd; @@ -266,12 +273,14 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) int filter_step; int filt_high = 0; - int filt_mid = cm->filter_level; // Start search at previous frame filter level + /* Start search at previous frame filter level */ + int filt_mid = cm->filter_level; int filt_low = 0; int filt_best; int filt_direction = 0; - int Bias = 0; // Bias against raising loop filter and in favor of lowering it + /* Bias against raising loop filter and in favor of lowering it */ + int Bias = 0; int ss_err[MAX_LOOP_FILTER + 1]; @@ -287,7 +296,9 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) else cm->sharpness_level = cpi->oxcf.Sharpness; - // Start the search at the previous frame filter level unless it is now out of range. + /* Start the search at the previous frame filter level unless it is + * now out of range. + */ filt_mid = cm->filter_level; if (filt_mid < min_filter_level) @@ -295,10 +306,10 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) else if (filt_mid > max_filter_level) filt_mid = max_filter_level; - // Define the initial step size + /* Define the initial step size */ filter_step = (filt_mid < 16) ? 4 : filt_mid / 4; - // Get baseline error score + /* Get baseline error score */ /* Copy the unfiltered / processed recon buffer to the new buffer */ vp8_yv12_copy_y(saved_frame, cm->frame_to_show); @@ -314,9 +325,8 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) while (filter_step > 0) { - Bias = (best_err >> (15 - (filt_mid / 8))) * filter_step; //PGW change 12/12/06 for small images + Bias = (best_err >> (15 - (filt_mid / 8))) * filter_step; - // jbb chg: 20100118 - in sections with lots of new material coming in don't bias as much to a low filter value if (cpi->twopass.section_intra_rating < 20) Bias = Bias * cpi->twopass.section_intra_rating / 20; @@ -327,7 +337,7 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) { if(ss_err[filt_low] == 0) { - // Get Low filter error score + /* Get Low filter error score */ vp8_yv12_copy_y(saved_frame, cm->frame_to_show); vp8cx_set_alt_lf_level(cpi, filt_low); vp8_loop_filter_frame_yonly(cm, &cpi->mb.e_mbd, filt_low); @@ -338,10 +348,12 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) else filt_err = ss_err[filt_low]; - // If value is close to the best so far then bias towards a lower loop filter value. + /* If value is close to the best so far then bias towards a + * lower loop filter value. + */ if ((filt_err - Bias) < best_err) { - // Was it actually better than the previous best? + /* Was it actually better than the previous best? */ if (filt_err < best_err) best_err = filt_err; @@ -349,7 +361,7 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) } } - // Now look at filt_high + /* Now look at filt_high */ if ((filt_direction >= 0) && (filt_high != filt_mid)) { if(ss_err[filt_high] == 0) @@ -364,7 +376,7 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) else filt_err = ss_err[filt_high]; - // Was it better than the previous best? + /* Was it better than the previous best? */ if (filt_err < (best_err - Bias)) { best_err = filt_err; @@ -372,7 +384,9 @@ void vp8cx_pick_filter_level(YV12_BUFFER_CONFIG *sd, VP8_COMP *cpi) } } - // Half the step distance if the best filter value was the same as last time + /* Half the step distance if the best filter value was the same + * as last time + */ if (filt_best == filt_mid) { filter_step = filter_step / 2; |