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 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 LFWorkerData *const lf_data = &tile_data->lfdata; | 125 LFWorkerData *const lf_data = &tile_data->lfdata; |
126 | 126 |
127 loop_filter_rows_mt(lf_data->frame_buffer, lf_data->cm, &lf_data->xd, | 127 loop_filter_rows_mt(lf_data->frame_buffer, lf_data->cm, &lf_data->xd, |
128 lf_data->start, lf_data->stop, lf_data->y_only, | 128 lf_data->start, lf_data->stop, lf_data->y_only, |
129 lf_data->lf_sync, lf_data->num_lf_workers); | 129 lf_data->lf_sync, lf_data->num_lf_workers); |
130 return 1; | 130 return 1; |
131 } | 131 } |
132 | 132 |
133 // VP9 decoder: Implement multi-threaded loopfilter that uses the tile | 133 // VP9 decoder: Implement multi-threaded loopfilter that uses the tile |
134 // threads. | 134 // threads. |
135 void vp9_loop_filter_frame_mt(VP9Decoder *pbi, | 135 void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, |
136 VP9_COMMON *cm, | 136 VP9Decoder *pbi, VP9_COMMON *cm, |
137 int frame_filter_level, | 137 int frame_filter_level, |
138 int y_only, int partial_frame) { | 138 int y_only) { |
139 VP9LfSync *const lf_sync = &pbi->lf_row_sync; | 139 VP9LfSync *const lf_sync = &pbi->lf_row_sync; |
140 // Number of superblock rows and cols | 140 // Number of superblock rows and cols |
141 const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2; | 141 const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2; |
142 const int tile_cols = 1 << cm->log2_tile_cols; | 142 const int tile_cols = 1 << cm->log2_tile_cols; |
143 const int num_workers = MIN(pbi->oxcf.max_threads & ~1, tile_cols); | 143 const int num_workers = MIN(pbi->max_threads & ~1, tile_cols); |
144 int i; | 144 int i; |
145 | 145 |
146 // Allocate memory used in thread synchronization. | 146 // Allocate memory used in thread synchronization. |
147 // This always needs to be done even if frame_filter_level is 0. | 147 // This always needs to be done even if frame_filter_level is 0. |
148 if (!cm->current_video_frame || cm->last_height != cm->height) { | 148 if (!cm->current_video_frame || cm->last_height != cm->height) { |
149 if (cm->last_height != cm->height) { | 149 if (cm->last_height != cm->height) { |
150 const int aligned_last_height = | 150 const int aligned_last_height = |
151 ALIGN_POWER_OF_TWO(cm->last_height, MI_SIZE_LOG2); | 151 ALIGN_POWER_OF_TWO(cm->last_height, MI_SIZE_LOG2); |
152 const int last_sb_rows = | 152 const int last_sb_rows = |
153 mi_cols_aligned_to_sb(aligned_last_height >> MI_SIZE_LOG2) >> | 153 mi_cols_aligned_to_sb(aligned_last_height >> MI_SIZE_LOG2) >> |
(...skipping 23 matching lines...) Expand all Loading... |
177 // multithreading code changes in the future then the number of workers | 177 // multithreading code changes in the future then the number of workers |
178 // used by the loopfilter should be revisited. | 178 // used by the loopfilter should be revisited. |
179 for (i = 0; i < num_workers; ++i) { | 179 for (i = 0; i < num_workers; ++i) { |
180 VP9Worker *const worker = &pbi->tile_workers[i]; | 180 VP9Worker *const worker = &pbi->tile_workers[i]; |
181 TileWorkerData *const tile_data = (TileWorkerData*)worker->data1; | 181 TileWorkerData *const tile_data = (TileWorkerData*)worker->data1; |
182 LFWorkerData *const lf_data = &tile_data->lfdata; | 182 LFWorkerData *const lf_data = &tile_data->lfdata; |
183 | 183 |
184 worker->hook = (VP9WorkerHook)loop_filter_row_worker; | 184 worker->hook = (VP9WorkerHook)loop_filter_row_worker; |
185 | 185 |
186 // Loopfilter data | 186 // Loopfilter data |
187 lf_data->frame_buffer = get_frame_new_buffer(cm); | 187 lf_data->frame_buffer = frame; |
188 lf_data->cm = cm; | 188 lf_data->cm = cm; |
189 lf_data->xd = pbi->mb; | 189 lf_data->xd = pbi->mb; |
190 lf_data->start = i; | 190 lf_data->start = i; |
191 lf_data->stop = sb_rows; | 191 lf_data->stop = sb_rows; |
192 lf_data->y_only = y_only; // always do all planes in decoder | 192 lf_data->y_only = y_only; // always do all planes in decoder |
193 | 193 |
194 lf_data->lf_sync = lf_sync; | 194 lf_data->lf_sync = lf_sync; |
195 lf_data->num_lf_workers = num_workers; | 195 lf_data->num_lf_workers = num_workers; |
196 | 196 |
197 // Start loopfiltering | 197 // Start loopfiltering |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 270 } |
271 vpx_free(lf_sync->cond_); | 271 vpx_free(lf_sync->cond_); |
272 } | 272 } |
273 #endif // CONFIG_MULTITHREAD | 273 #endif // CONFIG_MULTITHREAD |
274 vpx_free(lf_sync->cur_sb_col); | 274 vpx_free(lf_sync->cur_sb_col); |
275 // clear the structure as the source of this call may be a resize in which | 275 // clear the structure as the source of this call may be a resize in which |
276 // case this call will be followed by an _alloc() which may fail. | 276 // case this call will be followed by an _alloc() which may fail. |
277 vp9_zero(*lf_sync); | 277 vp9_zero(*lf_sync); |
278 } | 278 } |
279 } | 279 } |
OLD | NEW |