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

Side by Side Diff: source/libvpx/vp9/decoder/vp9_dthread.c

Issue 375983002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decoder.c ('k') | source/libvpx/vp9/decoder/vp9_thread.h » ('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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 sync_write(lf_sync, r, c, sb_cols); 118 sync_write(lf_sync, r, c, sb_cols);
119 } 119 }
120 } 120 }
121 } 121 }
122 122
123 // Row-based multi-threaded loopfilter hook 123 // Row-based multi-threaded loopfilter hook
124 static int loop_filter_row_worker(void *arg1, void *arg2) { 124 static int loop_filter_row_worker(void *arg1, void *arg2) {
125 TileWorkerData *const tile_data = (TileWorkerData*)arg1; 125 TileWorkerData *const tile_data = (TileWorkerData*)arg1;
126 LFWorkerData *const lf_data = &tile_data->lfdata; 126 LFWorkerData *const lf_data = &tile_data->lfdata;
127 127 (void) arg2;
128 loop_filter_rows_mt(lf_data->frame_buffer, lf_data->cm, lf_data->planes, 128 loop_filter_rows_mt(lf_data->frame_buffer, lf_data->cm, lf_data->planes,
129 lf_data->start, lf_data->stop, lf_data->y_only, 129 lf_data->start, lf_data->stop, lf_data->y_only,
130 lf_data->lf_sync, lf_data->num_lf_workers); 130 lf_data->lf_sync, lf_data->num_lf_workers);
131 return 1; 131 return 1;
132 } 132 }
133 133
134 // VP9 decoder: Implement multi-threaded loopfilter that uses the tile 134 // VP9 decoder: Implement multi-threaded loopfilter that uses the tile
135 // threads. 135 // threads.
136 void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, 136 void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame,
137 VP9Decoder *pbi, VP9_COMMON *cm, 137 VP9Decoder *pbi, VP9_COMMON *cm,
138 int frame_filter_level, 138 int frame_filter_level,
139 int y_only) { 139 int y_only) {
140 VP9LfSync *const lf_sync = &pbi->lf_row_sync; 140 VP9LfSync *const lf_sync = &pbi->lf_row_sync;
141 const VP9WorkerInterface *const winterface = vp9_get_worker_interface();
141 // Number of superblock rows and cols 142 // Number of superblock rows and cols
142 const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2; 143 const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2;
143 const int tile_cols = 1 << cm->log2_tile_cols; 144 const int tile_cols = 1 << cm->log2_tile_cols;
144 const int num_workers = MIN(pbi->max_threads & ~1, tile_cols); 145 const int num_workers = MIN(pbi->max_threads & ~1, tile_cols);
145 int i; 146 int i;
146 147
147 // Allocate memory used in thread synchronization. 148 // Allocate memory used in thread synchronization.
148 // This always needs to be done even if frame_filter_level is 0. 149 // This always needs to be done even if frame_filter_level is 0.
149 if (!cm->current_video_frame || cm->last_height != cm->height) { 150 if (!cm->current_video_frame || cm->last_height != cm->height) {
150 if (cm->last_height != cm->height) { 151 if (cm->last_height != cm->height) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 vp9_copy(lf_data->planes, pbi->mb.plane); 191 vp9_copy(lf_data->planes, pbi->mb.plane);
191 lf_data->start = i; 192 lf_data->start = i;
192 lf_data->stop = sb_rows; 193 lf_data->stop = sb_rows;
193 lf_data->y_only = y_only; // always do all planes in decoder 194 lf_data->y_only = y_only; // always do all planes in decoder
194 195
195 lf_data->lf_sync = lf_sync; 196 lf_data->lf_sync = lf_sync;
196 lf_data->num_lf_workers = num_workers; 197 lf_data->num_lf_workers = num_workers;
197 198
198 // Start loopfiltering 199 // Start loopfiltering
199 if (i == num_workers - 1) { 200 if (i == num_workers - 1) {
200 vp9_worker_execute(worker); 201 winterface->execute(worker);
201 } else { 202 } else {
202 vp9_worker_launch(worker); 203 winterface->launch(worker);
203 } 204 }
204 } 205 }
205 206
206 // Wait till all rows are finished 207 // Wait till all rows are finished
207 for (i = 0; i < num_workers; ++i) { 208 for (i = 0; i < num_workers; ++i) {
208 vp9_worker_sync(&pbi->tile_workers[i]); 209 winterface->sync(&pbi->tile_workers[i]);
209 } 210 }
210 } 211 }
211 212
212 // Set up nsync by width. 213 // Set up nsync by width.
213 static int get_sync_range(int width) { 214 static int get_sync_range(int width) {
214 // nsync numbers are picked by testing. For example, for 4k 215 // nsync numbers are picked by testing. For example, for 4k
215 // video, using 4 gives best performance. 216 // video, using 4 gives best performance.
216 if (width < 640) 217 if (width < 640)
217 return 1; 218 return 1;
218 else if (width <= 1280) 219 else if (width <= 1280)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 272 }
272 vpx_free(lf_sync->cond_); 273 vpx_free(lf_sync->cond_);
273 } 274 }
274 #endif // CONFIG_MULTITHREAD 275 #endif // CONFIG_MULTITHREAD
275 vpx_free(lf_sync->cur_sb_col); 276 vpx_free(lf_sync->cur_sb_col);
276 // clear the structure as the source of this call may be a resize in which 277 // clear the structure as the source of this call may be a resize in which
277 // case this call will be followed by an _alloc() which may fail. 278 // case this call will be followed by an _alloc() which may fail.
278 vp9_zero(*lf_sync); 279 vp9_zero(*lf_sync);
279 } 280 }
280 } 281 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/decoder/vp9_decoder.c ('k') | source/libvpx/vp9/decoder/vp9_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698