| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   72                     vpx_calloc(num_workers, sizeof(*cpi->tile_thr_data))); |   72                     vpx_calloc(num_workers, sizeof(*cpi->tile_thr_data))); | 
|   73  |   73  | 
|   74     for (i = 0; i < num_workers; i++) { |   74     for (i = 0; i < num_workers; i++) { | 
|   75       VP9Worker *const worker = &cpi->workers[i]; |   75       VP9Worker *const worker = &cpi->workers[i]; | 
|   76       EncWorkerData *thread_data = &cpi->tile_thr_data[i]; |   76       EncWorkerData *thread_data = &cpi->tile_thr_data[i]; | 
|   77  |   77  | 
|   78       ++cpi->num_workers; |   78       ++cpi->num_workers; | 
|   79       winterface->init(worker); |   79       winterface->init(worker); | 
|   80  |   80  | 
|   81       if (i < num_workers - 1) { |   81       if (i < num_workers - 1) { | 
|   82       thread_data->cpi = cpi; |   82         thread_data->cpi = cpi; | 
|   83  |   83  | 
|   84       // Allocate thread data. |   84         // Allocate thread data. | 
|   85       CHECK_MEM_ERROR(cm, thread_data->td, |   85         CHECK_MEM_ERROR(cm, thread_data->td, | 
|   86                       vpx_memalign(32, sizeof(*thread_data->td))); |   86                         vpx_memalign(32, sizeof(*thread_data->td))); | 
|   87       vp9_zero(*thread_data->td); |   87         vp9_zero(*thread_data->td); | 
|   88  |   88  | 
|   89       // Set up pc_tree. |   89         // Set up pc_tree. | 
|   90       thread_data->td->leaf_tree = NULL; |   90         thread_data->td->leaf_tree = NULL; | 
|   91       thread_data->td->pc_tree = NULL; |   91         thread_data->td->pc_tree = NULL; | 
|   92       vp9_setup_pc_tree(cm, thread_data->td); |   92         vp9_setup_pc_tree(cm, thread_data->td); | 
|   93  |   93  | 
|   94       // Allocate frame counters in thread data. |   94         // Allocate frame counters in thread data. | 
|   95       CHECK_MEM_ERROR(cm, thread_data->td->counts, |   95         CHECK_MEM_ERROR(cm, thread_data->td->counts, | 
|   96                       vpx_calloc(1, sizeof(*thread_data->td->counts))); |   96                         vpx_calloc(1, sizeof(*thread_data->td->counts))); | 
|   97  |   97  | 
|   98       // Create threads |   98         // Create threads | 
|   99       if (!winterface->reset(worker)) |   99         if (!winterface->reset(worker)) | 
|  100         vpx_internal_error(&cm->error, VPX_CODEC_ERROR, |  100           vpx_internal_error(&cm->error, VPX_CODEC_ERROR, | 
|  101                            "Tile encoder thread creation failed"); |  101                              "Tile encoder thread creation failed"); | 
|  102       } else { |  102       } else { | 
|  103         // Main thread acts as a worker and uses the thread data in cpi. |  103         // Main thread acts as a worker and uses the thread data in cpi. | 
|  104         thread_data->cpi = cpi; |  104         thread_data->cpi = cpi; | 
|  105         thread_data->td = &cpi->td; |  105         thread_data->td = &cpi->td; | 
|  106       } |  106       } | 
|  107  |  107  | 
|  108       winterface->sync(worker); |  108       winterface->sync(worker); | 
|  109     } |  109     } | 
|  110   } |  110   } | 
|  111  |  111  | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  170     VP9Worker *const worker = &cpi->workers[i]; |  170     VP9Worker *const worker = &cpi->workers[i]; | 
|  171     EncWorkerData *const thread_data = (EncWorkerData*)worker->data1; |  171     EncWorkerData *const thread_data = (EncWorkerData*)worker->data1; | 
|  172  |  172  | 
|  173     // Accumulate counters. |  173     // Accumulate counters. | 
|  174     if (i < num_workers - 1) { |  174     if (i < num_workers - 1) { | 
|  175       vp9_accumulate_frame_counts(cm, thread_data->td->counts, 0); |  175       vp9_accumulate_frame_counts(cm, thread_data->td->counts, 0); | 
|  176       accumulate_rd_opt(&cpi->td, thread_data->td); |  176       accumulate_rd_opt(&cpi->td, thread_data->td); | 
|  177     } |  177     } | 
|  178   } |  178   } | 
|  179 } |  179 } | 
| OLD | NEW |