ref: b19f8b1607e56121b03c9e53127df5ed5d165ae5
parent: 77a31eb3c51582cae8597d8b3e1f76ed1dfa405b
author: James Zern <jzern@google.com>
date: Tue Jul 19 19:03:45 EDT 2016
vp8/onyx_if.c: rework #if's to avoid dangling else's Change-Id: Ieda8958a3da1000424fcff91a1315d0049612202
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -3273,24 +3273,27 @@
cpi->force_next_frame_intra = 0;
}
-/* For an alt ref frame in 2 pass we skip the call to the second pass
- * function that sets the target bandwidth
- */
+ /* For an alt ref frame in 2 pass we skip the call to the second pass
+ * function that sets the target bandwidth
+ */
+ switch (cpi->pass) {
#if !CONFIG_REALTIME_ONLY
+ case 2:
+ if (cpi->common.refresh_alt_ref_frame) {
+ /* Per frame bit target for the alt ref frame */
+ cpi->per_frame_bandwidth = cpi->twopass.gf_bits;
+ /* per second target bitrate */
+ cpi->target_bandwidth =
+ (int)(cpi->twopass.gf_bits * cpi->output_framerate);
+ }
+ break;
+#endif // !CONFIG_REALTIME_ONLY
+ default:
+ cpi->per_frame_bandwidth =
+ (int)(cpi->target_bandwidth / cpi->output_framerate);
+ break;
+ }
- if (cpi->pass == 2) {
- if (cpi->common.refresh_alt_ref_frame) {
- /* Per frame bit target for the alt ref frame */
- cpi->per_frame_bandwidth = cpi->twopass.gf_bits;
- /* per second target bitrate */
- cpi->target_bandwidth =
- (int)(cpi->twopass.gf_bits * cpi->output_framerate);
- }
- } else
-#endif
- cpi->per_frame_bandwidth =
- (int)(cpi->target_bandwidth / cpi->output_framerate);
-
/* Default turn off buffer to buffer copying */
cm->copy_buffer_to_gf = 0;
cm->copy_buffer_to_arf = 0;
@@ -4057,7 +4060,9 @@
active_worst_qchanged = 0;
}
-#if !CONFIG_REALTIME_ONLY
+#if CONFIG_REALTIME_ONLY
+ Loop = 0;
+#else
/* Special case handling for forced key frames */
if ((cm->frame_type == KEY_FRAME) && cpi->this_key_frame_forced) {
int last_q = Q;
@@ -4232,9 +4237,10 @@
: cpi->mb.zbin_over_quant;
Loop = Q != last_q;
- } else
-#endif
+ } else {
Loop = 0;
+ }
+#endif // CONFIG_REALTIME_ONLY
if (cpi->is_src_frame_alt_ref) Loop = 0;
@@ -5066,15 +5072,15 @@
assert(i < NUM_YV12_BUFFERS);
}
+ switch (cpi->pass) {
#if !CONFIG_REALTIME_ONLY
-
- if (cpi->pass == 1) {
- Pass1Encode(cpi, size, dest, frame_flags);
- } else if (cpi->pass == 2) {
- Pass2Encode(cpi, size, dest, dest_end, frame_flags);
- } else
-#endif
- encode_frame_to_data_rate(cpi, size, dest, dest_end, frame_flags);
+ case 1: Pass1Encode(cpi, size, dest, frame_flags); break;
+ case 2: Pass2Encode(cpi, size, dest, dest_end, frame_flags); break;
+#endif // !CONFIG_REALTIME_ONLY
+ default:
+ encode_frame_to_data_rate(cpi, size, dest, dest_end, frame_flags);
+ break;
+ }
if (cpi->compressor_speed == 2) {
unsigned int duration, duration2;