Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_ethread.c

Issue 1302353004: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_encoder.c ('k') | source/libvpx/vp9/encoder/vp9_extend.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 vp9_get_tile_n_bits(mi_cols, &min_log2_tile_cols, &max_log2_tile_cols); 60 vp9_get_tile_n_bits(mi_cols, &min_log2_tile_cols, &max_log2_tile_cols);
61 log2_tile_cols = clamp(cpi->oxcf.tile_columns, 61 log2_tile_cols = clamp(cpi->oxcf.tile_columns,
62 min_log2_tile_cols, max_log2_tile_cols); 62 min_log2_tile_cols, max_log2_tile_cols);
63 return (1 << log2_tile_cols); 63 return (1 << log2_tile_cols);
64 } 64 }
65 65
66 void vp9_encode_tiles_mt(VP9_COMP *cpi) { 66 void vp9_encode_tiles_mt(VP9_COMP *cpi) {
67 VP9_COMMON *const cm = &cpi->common; 67 VP9_COMMON *const cm = &cpi->common;
68 const int tile_cols = 1 << cm->log2_tile_cols; 68 const int tile_cols = 1 << cm->log2_tile_cols;
69 const VPxWorkerInterface *const winterface = vpx_get_worker_interface(); 69 const VPxWorkerInterface *const winterface = vpx_get_worker_interface();
70 const int num_workers = MIN(cpi->oxcf.max_threads, tile_cols); 70 const int num_workers = VPXMIN(cpi->oxcf.max_threads, tile_cols);
71 int i; 71 int i;
72 72
73 vp9_init_tile_data(cpi); 73 vp9_init_tile_data(cpi);
74 74
75 // Only run once to create threads and allocate thread data. 75 // Only run once to create threads and allocate thread data.
76 if (cpi->num_workers == 0) { 76 if (cpi->num_workers == 0) {
77 int allocated_workers = num_workers; 77 int allocated_workers = num_workers;
78 78
79 // While using SVC, we need to allocate threads according to the highest 79 // While using SVC, we need to allocate threads according to the highest
80 // resolution. 80 // resolution.
81 if (cpi->use_svc) { 81 if (cpi->use_svc) {
82 int max_tile_cols = get_max_tile_cols(cpi); 82 int max_tile_cols = get_max_tile_cols(cpi);
83 allocated_workers = MIN(cpi->oxcf.max_threads, max_tile_cols); 83 allocated_workers = VPXMIN(cpi->oxcf.max_threads, max_tile_cols);
84 } 84 }
85 85
86 CHECK_MEM_ERROR(cm, cpi->workers, 86 CHECK_MEM_ERROR(cm, cpi->workers,
87 vpx_malloc(allocated_workers * sizeof(*cpi->workers))); 87 vpx_malloc(allocated_workers * sizeof(*cpi->workers)));
88 88
89 CHECK_MEM_ERROR(cm, cpi->tile_thr_data, 89 CHECK_MEM_ERROR(cm, cpi->tile_thr_data,
90 vpx_calloc(allocated_workers, 90 vpx_calloc(allocated_workers,
91 sizeof(*cpi->tile_thr_data))); 91 sizeof(*cpi->tile_thr_data)));
92 92
93 for (i = 0; i < allocated_workers; i++) { 93 for (i = 0; i < allocated_workers; i++) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 VPxWorker *const worker = &cpi->workers[i]; 189 VPxWorker *const worker = &cpi->workers[i];
190 EncWorkerData *const thread_data = (EncWorkerData*)worker->data1; 190 EncWorkerData *const thread_data = (EncWorkerData*)worker->data1;
191 191
192 // Accumulate counters. 192 // Accumulate counters.
193 if (i < cpi->num_workers - 1) { 193 if (i < cpi->num_workers - 1) {
194 vp9_accumulate_frame_counts(cm, thread_data->td->counts, 0); 194 vp9_accumulate_frame_counts(cm, thread_data->td->counts, 0);
195 accumulate_rd_opt(&cpi->td, thread_data->td); 195 accumulate_rd_opt(&cpi->td, thread_data->td);
196 } 196 }
197 } 197 }
198 } 198 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_encoder.c ('k') | source/libvpx/vp9/encoder/vp9_extend.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698