| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // Allocate memory for lf row synchronization | 216 // Allocate memory for lf row synchronization |
| 217 void vp9_loop_filter_alloc(VP9LfSync *lf_sync, VP9_COMMON *cm, int rows, | 217 void vp9_loop_filter_alloc(VP9LfSync *lf_sync, VP9_COMMON *cm, int rows, |
| 218 int width) { | 218 int width) { |
| 219 lf_sync->rows = rows; | 219 lf_sync->rows = rows; |
| 220 #if CONFIG_MULTITHREAD | 220 #if CONFIG_MULTITHREAD |
| 221 { | 221 { |
| 222 int i; | 222 int i; |
| 223 | 223 |
| 224 CHECK_MEM_ERROR(cm, lf_sync->mutex_, | 224 CHECK_MEM_ERROR(cm, lf_sync->mutex_, |
| 225 vpx_malloc(sizeof(*lf_sync->mutex_) * rows)); | 225 vpx_malloc(sizeof(*lf_sync->mutex_) * rows)); |
| 226 for (i = 0; i < rows; ++i) { | 226 if (lf_sync->mutex_) { |
| 227 pthread_mutex_init(&lf_sync->mutex_[i], NULL); | 227 for (i = 0; i < rows; ++i) { |
| 228 pthread_mutex_init(&lf_sync->mutex_[i], NULL); |
| 229 } |
| 228 } | 230 } |
| 229 | 231 |
| 230 CHECK_MEM_ERROR(cm, lf_sync->cond_, | 232 CHECK_MEM_ERROR(cm, lf_sync->cond_, |
| 231 vpx_malloc(sizeof(*lf_sync->cond_) * rows)); | 233 vpx_malloc(sizeof(*lf_sync->cond_) * rows)); |
| 232 for (i = 0; i < rows; ++i) { | 234 if (lf_sync->cond_) { |
| 233 pthread_cond_init(&lf_sync->cond_[i], NULL); | 235 for (i = 0; i < rows; ++i) { |
| 236 pthread_cond_init(&lf_sync->cond_[i], NULL); |
| 237 } |
| 234 } | 238 } |
| 235 } | 239 } |
| 236 #endif // CONFIG_MULTITHREAD | 240 #endif // CONFIG_MULTITHREAD |
| 237 | 241 |
| 238 CHECK_MEM_ERROR(cm, lf_sync->cur_sb_col, | 242 CHECK_MEM_ERROR(cm, lf_sync->cur_sb_col, |
| 239 vpx_malloc(sizeof(*lf_sync->cur_sb_col) * rows)); | 243 vpx_malloc(sizeof(*lf_sync->cur_sb_col) * rows)); |
| 240 | 244 |
| 241 // Set up nsync. | 245 // Set up nsync. |
| 242 lf_sync->sync_range = get_sync_range(width); | 246 lf_sync->sync_range = get_sync_range(width); |
| 243 } | 247 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 260 } | 264 } |
| 261 vpx_free(lf_sync->cond_); | 265 vpx_free(lf_sync->cond_); |
| 262 } | 266 } |
| 263 #endif // CONFIG_MULTITHREAD | 267 #endif // CONFIG_MULTITHREAD |
| 264 vpx_free(lf_sync->cur_sb_col); | 268 vpx_free(lf_sync->cur_sb_col); |
| 265 // clear the structure as the source of this call may be a resize in which | 269 // clear the structure as the source of this call may be a resize in which |
| 266 // case this call will be followed by an _alloc() which may fail. | 270 // case this call will be followed by an _alloc() which may fail. |
| 267 vp9_zero(*lf_sync); | 271 vp9_zero(*lf_sync); |
| 268 } | 272 } |
| 269 } | 273 } |
| OLD | NEW |