ref: 16e069b8bb4d523007bf84be7c0a1bdde58539c4
parent: a6cc74b9872d3abaae92b422b9270c8f3f0db344
parent: b19f8b1607e56121b03c9e53127df5ed5d165ae5
author: James Zern <jzern@google.com>
date: Wed Jul 20 23:05:20 EDT 2016
Merge changes from topic 'clang-tidy' * changes: vp8/onyx_if.c: rework #if's to avoid dangling else's vp8/bitstream.c: rework #if to avoid dangling else
--- a/vp8/encoder/bitstream.c
+++ b/vp8/encoder/bitstream.c
@@ -1421,9 +1421,12 @@
#if CONFIG_MULTITHREAD
if (cpi->b_multi_threaded) {
pack_mb_row_tokens(cpi, &cpi->bc[1]);
- } else
-#endif // CONFIG_MULTITHREAD
+ } else {
vp8_pack_tokens(&cpi->bc[1], cpi->tok, cpi->tok_count);
+ }
+#else
+ vp8_pack_tokens(&cpi->bc[1], cpi->tok, cpi->tok_count);
+#endif // CONFIG_MULTITHREAD
vp8_stop_encode(&cpi->bc[1]);
--- 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;