| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "vp9/encoder/vp9_encodeframe.h" | 11 #include "vp9/encoder/vp9_encodeframe.h" |
| 12 #include "vp9/encoder/vp9_encoder.h" | 12 #include "vp9/encoder/vp9_encoder.h" |
| 13 #include "vp9/encoder/vp9_ethread.h" | 13 #include "vp9/encoder/vp9_ethread.h" |
| 14 | 14 |
| 15 static void accumulate_frame_counts(VP9_COMMON *cm, ThreadData *td) { | |
| 16 int i, j, k, l, m; | |
| 17 | |
| 18 for (i = 0; i < BLOCK_SIZE_GROUPS; i++) | |
| 19 for (j = 0; j < INTRA_MODES; j++) | |
| 20 cm->counts.y_mode[i][j] += td->counts->y_mode[i][j]; | |
| 21 | |
| 22 for (i = 0; i < INTRA_MODES; i++) | |
| 23 for (j = 0; j < INTRA_MODES; j++) | |
| 24 cm->counts.uv_mode[i][j] += td->counts->uv_mode[i][j]; | |
| 25 | |
| 26 for (i = 0; i < PARTITION_CONTEXTS; i++) | |
| 27 for (j = 0; j < PARTITION_TYPES; j++) | |
| 28 cm->counts.partition[i][j] += td->counts->partition[i][j]; | |
| 29 | |
| 30 for (i = 0; i < TX_SIZES; i++) | |
| 31 for (j = 0; j < PLANE_TYPES; j++) | |
| 32 for (k = 0; k < REF_TYPES; k++) | |
| 33 for (l = 0; l < COEF_BANDS; l++) | |
| 34 for (m = 0; m < COEFF_CONTEXTS; m++) | |
| 35 cm->counts.eob_branch[i][j][k][l][m] += | |
| 36 td->counts->eob_branch[i][j][k][l][m]; | |
| 37 // cm->counts.coef is only updated at frame level, so not need | |
| 38 // to accumulate it here. | |
| 39 // for (n = 0; n < UNCONSTRAINED_NODES + 1; n++) | |
| 40 // cm->counts.coef[i][j][k][l][m][n] += | |
| 41 // td->counts->coef[i][j][k][l][m][n]; | |
| 42 | |
| 43 for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) | |
| 44 for (j = 0; j < SWITCHABLE_FILTERS; j++) | |
| 45 cm->counts.switchable_interp[i][j] += td->counts->switchable_interp[i][j]; | |
| 46 | |
| 47 for (i = 0; i < INTER_MODE_CONTEXTS; i++) | |
| 48 for (j = 0; j < INTER_MODES; j++) | |
| 49 cm->counts.inter_mode[i][j] += td->counts->inter_mode[i][j]; | |
| 50 | |
| 51 for (i = 0; i < INTRA_INTER_CONTEXTS; i++) | |
| 52 for (j = 0; j < 2; j++) | |
| 53 cm->counts.intra_inter[i][j] += td->counts->intra_inter[i][j]; | |
| 54 | |
| 55 for (i = 0; i < COMP_INTER_CONTEXTS; i++) | |
| 56 for (j = 0; j < 2; j++) | |
| 57 cm->counts.comp_inter[i][j] += td->counts->comp_inter[i][j]; | |
| 58 | |
| 59 for (i = 0; i < REF_CONTEXTS; i++) | |
| 60 for (j = 0; j < 2; j++) | |
| 61 for (k = 0; k < 2; k++) | |
| 62 cm->counts.single_ref[i][j][k] += td->counts->single_ref[i][j][k]; | |
| 63 | |
| 64 for (i = 0; i < REF_CONTEXTS; i++) | |
| 65 for (j = 0; j < 2; j++) | |
| 66 cm->counts.comp_ref[i][j] += td->counts->comp_ref[i][j]; | |
| 67 | |
| 68 for (i = 0; i < TX_SIZE_CONTEXTS; i++) { | |
| 69 for (j = 0; j < TX_SIZES; j++) | |
| 70 cm->counts.tx.p32x32[i][j] += td->counts->tx.p32x32[i][j]; | |
| 71 | |
| 72 for (j = 0; j < TX_SIZES - 1; j++) | |
| 73 cm->counts.tx.p16x16[i][j] += td->counts->tx.p16x16[i][j]; | |
| 74 | |
| 75 for (j = 0; j < TX_SIZES - 2; j++) | |
| 76 cm->counts.tx.p8x8[i][j] += td->counts->tx.p8x8[i][j]; | |
| 77 } | |
| 78 | |
| 79 for (i = 0; i < SKIP_CONTEXTS; i++) | |
| 80 for (j = 0; j < 2; j++) | |
| 81 cm->counts.skip[i][j] += td->counts->skip[i][j]; | |
| 82 | |
| 83 for (i = 0; i < MV_JOINTS; i++) | |
| 84 cm->counts.mv.joints[i] += td->counts->mv.joints[i]; | |
| 85 | |
| 86 for (k = 0; k < 2; k++) { | |
| 87 nmv_component_counts *comps = &cm->counts.mv.comps[k]; | |
| 88 nmv_component_counts *comps_t = &td->counts->mv.comps[k]; | |
| 89 | |
| 90 for (i = 0; i < 2; i++) { | |
| 91 comps->sign[i] += comps_t->sign[i]; | |
| 92 comps->class0_hp[i] += comps_t->class0_hp[i]; | |
| 93 comps->hp[i] += comps_t->hp[i]; | |
| 94 } | |
| 95 | |
| 96 for (i = 0; i < MV_CLASSES; i++) | |
| 97 comps->classes[i] += comps_t->classes[i]; | |
| 98 | |
| 99 for (i = 0; i < CLASS0_SIZE; i++) { | |
| 100 comps->class0[i] += comps_t->class0[i]; | |
| 101 for (j = 0; j < MV_FP_SIZE; j++) | |
| 102 comps->class0_fp[i][j] += comps_t->class0_fp[i][j]; | |
| 103 } | |
| 104 | |
| 105 for (i = 0; i < MV_OFFSET_BITS; i++) | |
| 106 for (j = 0; j < 2; j++) | |
| 107 comps->bits[i][j] += comps_t->bits[i][j]; | |
| 108 | |
| 109 for (i = 0; i < MV_FP_SIZE; i++) | |
| 110 comps->fp[i] += comps_t->fp[i]; | |
| 111 } | |
| 112 } | |
| 113 | |
| 114 static void accumulate_rd_opt(ThreadData *td, ThreadData *td_t) { | 15 static void accumulate_rd_opt(ThreadData *td, ThreadData *td_t) { |
| 115 int i, j, k, l, m, n; | 16 int i, j, k, l, m, n; |
| 116 | 17 |
| 117 for (i = 0; i < REFERENCE_MODES; i++) | 18 for (i = 0; i < REFERENCE_MODES; i++) |
| 118 td->rd_counts.comp_pred_diff[i] += td_t->rd_counts.comp_pred_diff[i]; | 19 td->rd_counts.comp_pred_diff[i] += td_t->rd_counts.comp_pred_diff[i]; |
| 119 | 20 |
| 120 for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) | 21 for (i = 0; i < SWITCHABLE_FILTER_CONTEXTS; i++) |
| 121 td->rd_counts.filter_diff[i] += td_t->rd_counts.filter_diff[i]; | 22 td->rd_counts.filter_diff[i] += td_t->rd_counts.filter_diff[i]; |
| 122 | 23 |
| 123 for (i = 0; i < TX_MODES; i++) | 24 for (i = 0; i < TX_MODES; i++) |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 VP9Worker *const worker = &cpi->workers[i]; | 161 VP9Worker *const worker = &cpi->workers[i]; |
| 261 winterface->sync(worker); | 162 winterface->sync(worker); |
| 262 } | 163 } |
| 263 | 164 |
| 264 for (i = 0; i < num_workers; i++) { | 165 for (i = 0; i < num_workers; i++) { |
| 265 VP9Worker *const worker = &cpi->workers[i]; | 166 VP9Worker *const worker = &cpi->workers[i]; |
| 266 EncWorkerData *const thread_data = (EncWorkerData*)worker->data1; | 167 EncWorkerData *const thread_data = (EncWorkerData*)worker->data1; |
| 267 | 168 |
| 268 // Accumulate counters. | 169 // Accumulate counters. |
| 269 if (i < num_workers - 1) { | 170 if (i < num_workers - 1) { |
| 270 accumulate_frame_counts(&cpi->common, thread_data->td); | 171 vp9_accumulate_frame_counts(cm, thread_data->td->counts, 0); |
| 271 accumulate_rd_opt(&cpi->td, thread_data->td); | 172 accumulate_rd_opt(&cpi->td, thread_data->td); |
| 272 } | 173 } |
| 273 } | 174 } |
| 274 } | 175 } |
| OLD | NEW |